diff options
author | Richard Guenther <rguenther@suse.de> | 2010-03-22 12:38:02 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-03-22 12:38:02 +0000 |
commit | 6af84c851dbd4c53711ac9f5ed2147bdb29354f6 (patch) | |
tree | 9c9759baff25c5fb816bd446df19fe5b29aded78 /gcc | |
parent | 2305a1e82e8bd6498fd2c01ffb71ba597e218d0a (diff) | |
download | gcc-6af84c851dbd4c53711ac9f5ed2147bdb29354f6.zip gcc-6af84c851dbd4c53711ac9f5ed2147bdb29354f6.tar.gz gcc-6af84c851dbd4c53711ac9f5ed2147bdb29354f6.tar.bz2 |
re PR middle-end/40106 (Weird interaction between optimize_insn_for_speed_p and -funsafe-math-optimizations)
2010-03-22 Richard Guenther <rguenther@suse.de>
PR middle-end/40106
* builtins.c (expand_builtin_pow): Expand pow (x, 1.5) as
x * sqrt (x) even when optimizing for size if the target
has native support for sqrt.
From-SVN: r157623
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/builtins.c | 10 |
2 files changed, 15 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4131a49..077b6e6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2010-03-22 Richard Guenther <rguenther@suse.de> + + PR middle-end/40106 + * builtins.c (expand_builtin_pow): Expand pow (x, 1.5) as + x * sqrt (x) even when optimizing for size if the target + has native support for sqrt. + 2010-03-22 Jakub Jelinek <jakub@redhat.com> * varasm.c (make_decl_rtl_for_debug): Also clear diff --git a/gcc/builtins.c b/gcc/builtins.c index a68e743..7787f69 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -2984,10 +2984,16 @@ expand_builtin_pow (tree exp, rtx target, rtx subtarget) && ((flag_unsafe_math_optimizations && optimize_insn_for_speed_p () && powi_cost (n/2) <= POWI_MAX_MULTS) - /* Even the c==0.5 case cannot be done unconditionally + /* Even the c == 0.5 case cannot be done unconditionally when we need to preserve signed zeros, as pow (-0, 0.5) is +0, while sqrt(-0) is -0. */ - || (!HONOR_SIGNED_ZEROS (mode) && n == 1))) + || (!HONOR_SIGNED_ZEROS (mode) && n == 1) + /* For c == 1.5 we can assume that x * sqrt (x) is always + smaller than pow (x, 1.5) if sqrt will not be expanded + as a call. */ + || (n == 3 + && (optab_handler (sqrt_optab, mode)->insn_code + != CODE_FOR_nothing)))) { tree call_expr = build_call_nofold (fn, 1, narg0); /* Use expand_expr in case the newly built call expression |