]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386.c (ix86_option_override_internal): Switch to SSE math for -ffast-math when targe...
authorJan Hubicka <jh@suse.cz>
Tue, 8 Oct 2013 23:33:34 +0000 (01:33 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 8 Oct 2013 23:33:34 +0000 (23:33 +0000)
* config/i386/i386.c (ix86_option_override_internal): Switch
to SSE math for -ffast-math when target ISA supports SSE2.

From-SVN: r203291

gcc/ChangeLog
gcc/config/i386/i386.c

index d5bc285e92f7058766ff01a74c6d12c69c9b9567..fa1ef08d9baf01e676cba622bd3f07bb8f06f917 100644 (file)
@@ -1,3 +1,8 @@
+2013-10-08  Jan Hubicka  <jh@suse.cz>
+
+       * config/i386/i386.c (ix86_option_override_internal): Switch
+       to SSE math for -ffast-math when target ISA supports SSE2.
+
 2013-10-08  Andrew MacLeod  <amacleod@redhat.com>
 
        * tree-flow.h: Remove some prototypes.
index 1713ad6f06d55079ac25f7da212ad618ff526027..168a2ac50ead72320f4013de144318cfbe507512 100644 (file)
@@ -3769,6 +3769,19 @@ ix86_option_override_internal (bool main_args_p)
            }
        }
     }
+  /* For all chips supporting SSE2, -mfpmath=sse performs better than
+     fpmath=387.  The second is however default at many targets since the
+     extra 80bit precision of temporaries is considered to be part of ABI.
+     Overwrite the default at least for -ffast-math. 
+     TODO: -mfpmath=both seems to produce same performing code with bit
+     smaller binaries.  It is however not clear if register allocation is
+     ready for this setting.
+     Also -mfpmath=387 is overall a lot more compact (bout 4-5%) than SSE
+     codegen.  We may switch to 387 with -ffast-math for size optimized
+     functions. */
+  else if (fast_math_flags_set_p (&global_options)
+          && TARGET_SSE2)
+    ix86_fpmath = FPMATH_SSE;
   else
     ix86_fpmath = TARGET_FPMATH_DEFAULT;