Skip to content

Commit 31e410e

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #79595: zend_init_fpu() alters FPU precision
2 parents 15aa891 + 879004d commit 31e410e

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

Zend/zend_float.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@ END_EXTERN_C()
5555
Implementation notes:
5656
5757
x86_64:
58-
- Since all x86_64 compilers use SSE by default, it is probably unnecessary
59-
to use these macros there. We define them anyway since we are too lazy
60-
to differentiate the architecture. Also, the compiler option -mfpmath=i387
61-
justifies this decision.
58+
- Since all x86_64 compilers use SSE by default, we do not define these
59+
macros there. We ignore the compiler option -mfpmath=i387, because there is
60+
no reason to use it on x86_64.
6261
6362
General:
6463
- It would be nice if one could detect whether SSE if used for math via some
@@ -67,17 +66,15 @@ END_EXTERN_C()
6766
6867
MS Visual C:
6968
- Since MSVC users typically don't use autoconf or CMake, we will detect
70-
MSVC via compile time define. Floating point precision change isn't
71-
supported on 64 bit platforms, so it's NOP. See
72-
http://msdn.microsoft.com/en-us/library/c9676k6h(v=vs.110).aspx
69+
MSVC via compile time define.
7370
*/
7471

7572
/* MSVC detection (MSVC people usually don't use autoconf) */
7673
#if defined(_MSC_VER) && !defined(_WIN64)
7774
# define HAVE__CONTROLFP_S
7875
#endif /* _MSC_VER */
7976

80-
#ifdef HAVE__CONTROLFP_S
77+
#if defined(HAVE__CONTROLFP_S) && !defined(__x86_64__)
8178

8279
/* float.h defines _controlfp_s */
8380
# include <float.h>
@@ -141,7 +138,7 @@ END_EXTERN_C()
141138
return _xpfpa_result; \
142139
} while (0)
143140

144-
#elif defined(HAVE__CONTROLFP)
141+
#elif defined(HAVE__CONTROLFP) && !defined(__x86_64__)
145142

146143
/* float.h defines _controlfp */
147144
# include <float.h>
@@ -200,7 +197,7 @@ END_EXTERN_C()
200197
return _xpfpa_result; \
201198
} while (0)
202199

203-
#elif defined(HAVE__FPU_SETCW) /* glibc systems */
200+
#elif defined(HAVE__FPU_SETCW) && !defined(__x86_64__) /* glibc systems */
204201

205202
/* fpu_control.h defines _FPU_[GS]ETCW */
206203
# include <fpu_control.h>
@@ -259,7 +256,7 @@ END_EXTERN_C()
259256
return _xpfpa_result; \
260257
} while (0)
261258

262-
#elif defined(HAVE_FPSETPREC) /* FreeBSD */
259+
#elif defined(HAVE_FPSETPREC) && !defined(__x86_64__) /* FreeBSD */
263260

264261
/* fpu_control.h defines _FPU_[GS]ETCW */
265262
# include <machine/ieeefp.h>
@@ -315,7 +312,7 @@ END_EXTERN_C()
315312
return _xpfpa_result; \
316313
} while (0)
317314

318-
#elif defined(HAVE_FPU_INLINE_ASM_X86)
315+
#elif defined(HAVE_FPU_INLINE_ASM_X86) && !defined(__x86_64__)
319316

320317
/*
321318
Custom x86 inline assembler implementation.

0 commit comments

Comments
 (0)