aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2013-10-09 01:33:34 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2013-10-08 23:33:34 +0000
commita81169d8fa4382d7d4e702323096358dd31e174a (patch)
tree092d6cf781ffef0ae94442e2b14d8b9742d75de1 /gcc
parentc80217c9fabc7bdcba6e098a4903a0d357333b8d (diff)
downloadgcc-a81169d8fa4382d7d4e702323096358dd31e174a.zip
gcc-a81169d8fa4382d7d4e702323096358dd31e174a.tar.gz
gcc-a81169d8fa4382d7d4e702323096358dd31e174a.tar.bz2
i386.c (ix86_option_override_internal): Switch to SSE math for -ffast-math when target ISA supports SSE2.
* config/i386/i386.c (ix86_option_override_internal): Switch to SSE math for -ffast-math when target ISA supports SSE2. From-SVN: r203291
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/i386/i386.c13
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d5bc285..fa1ef08 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 1713ad6..168a2ac 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -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;