diff options
author | Michael Matz <matz@gcc.gnu.org> | 2010-03-18 16:07:53 +0000 |
---|---|---|
committer | Michael Matz <matz@gcc.gnu.org> | 2010-03-18 16:07:53 +0000 |
commit | c21372c41eb1f5995048a67bfc9512d860c986cb (patch) | |
tree | 4ff7adbdf79516249e130b74195c2cb0583b9375 /gcc/builtins.c | |
parent | 82fa5f8aa727db4ab9f172ddc454fc25325b82ca (diff) | |
download | gcc-c21372c41eb1f5995048a67bfc9512d860c986cb.zip gcc-c21372c41eb1f5995048a67bfc9512d860c986cb.tar.gz gcc-c21372c41eb1f5995048a67bfc9512d860c986cb.tar.bz2 |
re PR middle-end/43419 (gcc replaces pow(x, 0.5) by sqrt(x), invalid when x is -0)
PR middle-end/43419
* builtins.c (expand_builtin_pow): Don't transform pow(x, 0.5)
into sqrt(x) if we need to preserve signed zeros.
testsuite/
* gcc.dg/pr43419.c: New testcase.
From-SVN: r157543
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 1e089ef9..705a255 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -2980,7 +2980,10 @@ 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) - || n == 1)) + /* 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))) { tree call_expr = build_call_nofold (fn, 1, narg0); /* Use expand_expr in case the newly built call expression |