Set FLT_EVAL_METHOD to 2 only if 387 FPU is used

When 387 FPU isn't used, there is no excess precision.  We should set
FLT_EVAL_METHOD to 2 only if 387 FPU is used.

gcc/

	PR target/69225
	* config/i386/i386.h (TARGET_FLT_EVAL_METHOD): Set to 2 only if
	TARGET_80387 is true.

gcc/testsuite

	PR target/69225
	* gcc.target/i386/pr69225-1.c: New test.
	* gcc.target/i386/pr69225-2.c: Likewise.
	* gcc.target/i386/pr69225-3.c: Likewise.
	* gcc.target/i386/pr69225-4.c: Likewise.
	* gcc.target/i386/pr69225-5.c: Likewise.
	* gcc.target/i386/pr69225-6.c: Likewise.

From-SVN: r232249
This commit is contained in:
H.J. Lu 2016-01-12 00:30:30 +00:00 committed by H.J. Lu
parent 0f474f11b1
commit cf4de6af25
9 changed files with 65 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2016-01-11 H.J. Lu <hongjiu.lu@intel.com>
PR target/69225
* config/i386/i386.h (TARGET_FLT_EVAL_METHOD): Set to 2 only if
TARGET_80387 is true.
2016-01-11 Jakub Jelinek <jakub@redhat.com> 2016-01-11 Jakub Jelinek <jakub@redhat.com>
PR target/69071 PR target/69071

View File

@ -694,7 +694,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
the rounding precision is indeterminate, since either may be chosen the rounding precision is indeterminate, since either may be chosen
apparently at random. */ apparently at random. */
#define TARGET_FLT_EVAL_METHOD \ #define TARGET_FLT_EVAL_METHOD \
(TARGET_MIX_SSE_I387 ? -1 : TARGET_SSE_MATH ? 0 : 2) (TARGET_MIX_SSE_I387 ? -1 : (TARGET_80387 && !TARGET_SSE_MATH) ? 2 : 0)
/* Whether to allow x87 floating-point arithmetic on MODE (one of /* Whether to allow x87 floating-point arithmetic on MODE (one of
SFmode, DFmode and XFmode) in the current excess precision SFmode, DFmode and XFmode) in the current excess precision

View File

@ -1,3 +1,13 @@
2016-01-11 H.J. Lu <hongjiu.lu@intel.com>
PR target/69225
* gcc.target/i386/pr69225-1.c: New test.
* gcc.target/i386/pr69225-2.c: Likewise.
* gcc.target/i386/pr69225-3.c: Likewise.
* gcc.target/i386/pr69225-4.c: Likewise.
* gcc.target/i386/pr69225-5.c: Likewise.
* gcc.target/i386/pr69225-6.c: Likewise.
2016-01-11 Jakub Jelinek <jakub@redhat.com> 2016-01-11 Jakub Jelinek <jakub@redhat.com>
PR target/67462 PR target/67462

View File

@ -0,0 +1,8 @@
/* { dg-do compile} */
/* { dg-options "-msse2 -mfpmath=sse" } */
#include <float.h>
#if FLT_EVAL_METHOD != 0
# error FLT_EVAL_METHOD != 0
#endif

View File

@ -0,0 +1,8 @@
/* { dg-do compile} */
/* { dg-options "-mno-sse -mno-80387" } */
#include <float.h>
#if FLT_EVAL_METHOD != 0
# error FLT_EVAL_METHOD != 0
#endif

View File

@ -0,0 +1,8 @@
/* { dg-do compile} */
/* { dg-options "-m80387 -mfpmath=387" } */
#include <float.h>
#if FLT_EVAL_METHOD != 2
# error FLT_EVAL_METHOD != 2
#endif

View File

@ -0,0 +1,8 @@
/* { dg-do compile} */
/* { dg-options "-msse2 -mfancy-math-387 -mfpmath=sse" } */
#include <float.h>
#if FLT_EVAL_METHOD != 0
# error FLT_EVAL_METHOD != 0
#endif

View File

@ -0,0 +1,8 @@
/* { dg-do compile} */
/* { dg-options "-msse2 -m80387 -mfpmath=sse,387" } */
#include <float.h>
#if FLT_EVAL_METHOD != -1
# error FLT_EVAL_METHOD != -1
#endif

View File

@ -0,0 +1,8 @@
/* { dg-do compile} */
/* { dg-options "-mno-80387" } */
#include <float.h>
#if FLT_EVAL_METHOD != 0
# error FLT_EVAL_METHOD != 0
#endif