On December 31, 2015 10:29:19 AM GMT+01:00, Jakub Jelinek <ja...@redhat.com> 
wrote:
>Hi!
>
>The PR61441 change added REAL_VALUE_ISSIGNALING_NAN checks for both
>operands, but only arg1 is guaranteed to be a REAL_CST at this point.
>If arg0 is not a REAL_CST, I think we can allow all the opts the
>function
>does, as all transformations replace the pow with some other expression
>that uses the argument some way (sqrt, cbrt, cbrt of sqrt,
>multiplication by
>itself, ...), so sNaN exteptions should be preserved.
>
>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

Richard.

>2015-12-31  Jakub Jelinek  <ja...@redhat.com>
>
>       PR tree-optimization/69070
>       * tree-ssa-math-opts.c (gimple_expand_builtin_pow): Only test
>       REAL_VALUE_ISSIGNALING_NAN on arg0 if arg0 is a REAL_CST.
>
>       * gcc.dg/pr69070.c: New test.
>
>--- gcc/tree-ssa-math-opts.c.jj        2015-12-22 19:18:51.000000000 +0100
>+++ gcc/tree-ssa-math-opts.c   2015-12-29 14:15:49.587126962 +0100
>@@ -1538,7 +1538,8 @@ gimple_expand_builtin_pow (gimple_stmt_i
>   /* Don't perform the operation if flag_signaling_nans is on
>      and the operand is a signaling NaN.  */
>   if (HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg1)))
>-      && (REAL_VALUE_ISSIGNALING_NAN (TREE_REAL_CST (arg0))
>+      && ((TREE_CODE (arg0) == REAL_CST
>+         && REAL_VALUE_ISSIGNALING_NAN (TREE_REAL_CST (arg0)))
>         || REAL_VALUE_ISSIGNALING_NAN (TREE_REAL_CST (arg1))))
>     return NULL_TREE;
> 
>--- gcc/testsuite/gcc.dg/pr69070.c.jj  2015-12-29 14:22:38.313434143
>+0100
>+++ gcc/testsuite/gcc.dg/pr69070.c     2015-12-29 14:22:24.000000000 +0100
>@@ -0,0 +1,9 @@
>+/* PR tree-optimization/69070 */
>+/* { dg-do compile } */
>+/* { dg-options "-O2 -fsignaling-nans" } */
>+
>+double
>+foo (double d)
>+{
>+  return __builtin_pow (d, 2);
>+}
>
>       Jakub


Reply via email to