i386: Set ix86_fpmath to FPMATH_387 without SSE
authorH.J. Lu <hongjiu.lu@intel.com>
Tue, 19 Feb 2019 14:19:33 +0000 (14:19 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Tue, 19 Feb 2019 14:19:33 +0000 (06:19 -0800)
ix86_fpmath should be set to combination of FPMATH_387 and FPMATH_SSE.
When SSE is disabled, it should be set to FPMATH_387 and 387 codegen is
also controlled by -msoft-float.

gcc/

PR target/89397
* config/i386/i386.c (ix86_option_override_internal): Set
opts->x_ix86_fpmath to FPMATH_387 when SSE is disabled.

gcc/testsuite/

PR target/89397
* gcc.target/i386/pr89397.c: New test.

From-SVN: r269017

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr89397.c [new file with mode: 0644]

index 3c9e17a5a97b04e560003ec769d7d02c7c77406c..58630f7bb1dcfbe368927ca87d0ea112abd018a3 100644 (file)
@@ -1,3 +1,9 @@
+2019-02-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/89397
+       * config/i386/i386.c (ix86_option_override_internal): Set
+       opts->x_ix86_fpmath to FPMATH_387 when SSE is disabled.
+
 2019-02-19  Richard Biener  <rguenther@suse.de>
 
         PR middle-end/88074
index 591a7cdccdc7178758dbb1e6a79924eae2c3e1ef..bed17330fa82bb06dd76c11e6bae7e1ba0ba5ef2 100644 (file)
@@ -4310,10 +4310,9 @@ ix86_option_override_internal (bool main_args_p,
          if (!TARGET_SSE_P (opts->x_ix86_isa_flags))
            {
              if (TARGET_80387_P (opts->x_target_flags))
-               {
-                 warning (0, "SSE instruction set disabled, using 387 arithmetics");
-                 opts->x_ix86_fpmath = FPMATH_387;
-               }
+               warning (0, "SSE instruction set disabled, using 387 arithmetics");
+             /* NB: 387 codegen is guarded by TARGET_80387.  */
+             opts->x_ix86_fpmath = FPMATH_387;
            }
          else if ((opts->x_ix86_fpmath & FPMATH_387)
                   && !TARGET_80387_P (opts->x_target_flags))
index 9e34716496a72000cb02b48ccb1c86ffebd034cf..5796a150c0dad045c2f092a45545607b5963fa66 100644 (file)
@@ -1,3 +1,8 @@
+2019-02-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/89397
+       * gcc.target/i386/pr89397.c: New test.
+
 2019-02-19  Richard Biener  <rguenther@suse.de>
 
         PR middle-end/88074
diff --git a/gcc/testsuite/gcc.target/i386/pr89397.c b/gcc/testsuite/gcc.target/i386/pr89397.c
new file mode 100644 (file)
index 0000000..42afa6c
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-mfpmath=sse,387 -msoft-float -mno-sse" } */
+
+_Atomic double a;
+int b;
+
+void
+foo (void)
+{
+  a += b; /* { dg-error "SSE register return with SSE disabled" "" { target { ! ia32 } } } */
+}