public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Move sqrt and cbrt simplifications to match.pd
@ 2015-10-05 15:17 Richard Sandiford
  2015-10-06  8:13 ` Richard Biener
  2015-10-06  8:59 ` Marc Glisse
  0 siblings, 2 replies; 9+ messages in thread
From: Richard Sandiford @ 2015-10-05 15:17 UTC (permalink / raw)
  To: gcc-patches

This patch moves the sqrt and cbrt simplification rules to match.pd.
builtins.c now only does the constant folding.

Bootstrapped & regression-tested on x86_64-linux-gnu.  OK to install?

Thanks,
Richard


gcc/
	* builtins.c (fold_builtin_sqrt, fold_builtin_cbrt): Delete.
	(fold_builtin_1): Update accordingly.  Handle constant arguments here.
	* match.pd: Add rules previously handled by fold_builtin_sqrt
	and fold_builtin_cbrt.

gcc/testsuite/
	* gcc.dg/builtins-47.c: Test the optimized dump instead.

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 85ba6dd..3df60e8 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -158,8 +158,6 @@ static bool integer_valued_real_p (tree);
 static tree fold_trunc_transparent_mathfn (location_t, tree, tree);
 static rtx expand_builtin_fabs (tree, rtx, rtx);
 static rtx expand_builtin_signbit (tree, rtx);
-static tree fold_builtin_sqrt (location_t, tree, tree);
-static tree fold_builtin_cbrt (location_t, tree, tree);
 static tree fold_builtin_pow (location_t, tree, tree, tree, tree);
 static tree fold_builtin_powi (location_t, tree, tree, tree, tree);
 static tree fold_builtin_cos (location_t, tree, tree, tree);
@@ -7706,145 +7704,6 @@ fold_builtin_cproj (location_t loc, tree arg, tree type)
   return NULL_TREE;
 }
 
-/* Fold a builtin function call to sqrt, sqrtf, or sqrtl with argument ARG.
-   Return NULL_TREE if no simplification can be made.  */
-
-static tree
-fold_builtin_sqrt (location_t loc, tree arg, tree type)
-{
-
-  enum built_in_function fcode;
-  tree res;
-
-  if (!validate_arg (arg, REAL_TYPE))
-    return NULL_TREE;
-
-  /* Calculate the result when the argument is a constant.  */
-  if ((res = do_mpfr_arg1 (arg, type, mpfr_sqrt, &dconst<0> (), NULL, true)))
-    return res;
-
-  /* Optimize sqrt(expN(x)) = expN(x*0.5).  */
-  fcode = builtin_mathfn_code (arg);
-  if (flag_unsafe_math_optimizations && BUILTIN_EXPONENT_P (fcode))
-    {
-      tree expfn = TREE_OPERAND (CALL_EXPR_FN (arg), 0);
-      arg = fold_build2_loc (loc, MULT_EXPR, type,
-			 CALL_EXPR_ARG (arg, 0),
-			 build_real (type, dconst<1, 2> ()));
-      return build_call_expr_loc (loc, expfn, 1, arg);
-    }
-
-  /* Optimize sqrt(Nroot(x)) -> pow(x,1/(2*N)).  */
-  if (flag_unsafe_math_optimizations && BUILTIN_ROOT_P (fcode))
-    {
-      tree powfn = mathfn_built_in (type, BUILT_IN_POW);
-
-      if (powfn)
-	{
-	  tree arg0 = CALL_EXPR_ARG (arg, 0);
-	  tree arg1 = (BUILTIN_SQRT_P (fcode)
-		       ? build_real (type, dconst<1, 4> ())
-		       : build_real_truncate (type, dconst<1, 6> ()));
-	  return build_call_expr_loc (loc, powfn, 2, arg0, arg1);
-	}
-    }
-
-  /* Optimize sqrt(pow(x,y)) = pow(|x|,y*0.5).  */
-  if (flag_unsafe_math_optimizations
-      && (fcode == BUILT_IN_POW
-	  || fcode == BUILT_IN_POWF
-	  || fcode == BUILT_IN_POWL))
-    {
-      tree powfn = TREE_OPERAND (CALL_EXPR_FN (arg), 0);
-      tree arg0 = CALL_EXPR_ARG (arg, 0);
-      tree arg1 = CALL_EXPR_ARG (arg, 1);
-      tree narg1;
-      if (!tree_expr_nonnegative_p (arg0))
-	arg0 = build1 (ABS_EXPR, type, arg0);
-      narg1 = fold_build2_loc (loc, MULT_EXPR, type, arg1,
-			   build_real (type, dconst<1, 2> ()));
-      return build_call_expr_loc (loc, powfn, 2, arg0, narg1);
-    }
-
-  return NULL_TREE;
-}
-
-/* Fold a builtin function call to cbrt, cbrtf, or cbrtl with argument ARG.
-   Return NULL_TREE if no simplification can be made.  */
-
-static tree
-fold_builtin_cbrt (location_t loc, tree arg, tree type)
-{
-  const enum built_in_function fcode = builtin_mathfn_code (arg);
-  tree res;
-
-  if (!validate_arg (arg, REAL_TYPE))
-    return NULL_TREE;
-
-  /* Calculate the result when the argument is a constant.  */
-  if ((res = do_mpfr_arg1 (arg, type, mpfr_cbrt, NULL, NULL, 0)))
-    return res;
-
-  if (flag_unsafe_math_optimizations)
-    {
-      /* Optimize cbrt(expN(x)) -> expN(x/3).  */
-      if (BUILTIN_EXPONENT_P (fcode))
-	{
-	  tree expfn = TREE_OPERAND (CALL_EXPR_FN (arg), 0);
-	  arg = fold_build2_loc (loc, MULT_EXPR, type,
-				 CALL_EXPR_ARG (arg, 0),
-				 build_real_truncate (type, dconst<1, 3> ()));
-	  return build_call_expr_loc (loc, expfn, 1, arg);
-	}
-
-      /* Optimize cbrt(sqrt(x)) -> pow(x,1/6).  */
-      if (BUILTIN_SQRT_P (fcode))
-	{
-	  tree powfn = mathfn_built_in (type, BUILT_IN_POW);
-
-	  if (powfn)
-	    {
-	      tree arg0 = CALL_EXPR_ARG (arg, 0);
-	      tree tree_root = build_real_truncate (type, dconst<1, 6> ());
-	      return build_call_expr_loc (loc, powfn, 2, arg0, tree_root);
-	    }
-	}
-
-      /* Optimize cbrt(cbrt(x)) -> pow(x,1/9) iff x is nonnegative.  */
-      if (BUILTIN_CBRT_P (fcode))
-	{
-	  tree arg0 = CALL_EXPR_ARG (arg, 0);
-	  if (tree_expr_nonnegative_p (arg0))
-	    {
-	      tree powfn = mathfn_built_in (type, BUILT_IN_POW);
-
-	      if (powfn)
-		{
-		  tree tree_root = build_real_truncate (type, dconst<1, 9> ());
-		  return build_call_expr_loc (loc, powfn, 2, arg0, tree_root);
-		}
-	    }
-	}
-
-      /* Optimize cbrt(pow(x,y)) -> pow(x,y/3) iff x is nonnegative.  */
-      if (fcode == BUILT_IN_POW
-          || fcode == BUILT_IN_POWF
-	  || fcode == BUILT_IN_POWL)
-	{
-	  tree arg00 = CALL_EXPR_ARG (arg, 0);
-	  tree arg01 = CALL_EXPR_ARG (arg, 1);
-	  if (tree_expr_nonnegative_p (arg00))
-	    {
-	      tree powfn = TREE_OPERAND (CALL_EXPR_FN (arg), 0);
-	      tree c = build_real_truncate (type, dconst<1, 3> ());
-	      tree narg01 = fold_build2_loc (loc, MULT_EXPR, type, arg01, c);
-	      return build_call_expr_loc (loc, powfn, 2, arg00, narg01);
-	    }
-	}
-    }
-  return NULL_TREE;
-}
-
 /* Fold function call to builtin cos, cosf, or cosl with argument ARG.
    TYPE is the type of the return value.  Return NULL_TREE if no
    simplification can be made.  */
@@ -9943,10 +9802,14 @@ fold_builtin_1 (location_t loc, tree fndecl, tree arg0)
       return fold_builtin_carg (loc, arg0, type);
 
     CASE_FLT_FN (BUILT_IN_SQRT):
-      return fold_builtin_sqrt (loc, arg0, type);
+      if (validate_arg (arg0, REAL_TYPE))
+	return do_mpfr_arg1 (arg0, type, mpfr_sqrt, &dconst<0> (), NULL, true);
+      break;
 
     CASE_FLT_FN (BUILT_IN_CBRT):
-      return fold_builtin_cbrt (loc, arg0, type);
+      if (validate_arg (arg0, REAL_TYPE))
+	return do_mpfr_arg1 (arg0, type, mpfr_cbrt, NULL, NULL, 0);
+      break;
 
     CASE_FLT_FN (BUILT_IN_ASIN):
       if (validate_arg (arg0, REAL_TYPE))
diff --git a/gcc/match.pd b/gcc/match.pd
index 5ab8c06..db8b731 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -2315,3 +2315,44 @@ along with GCC; see the file COPYING3.  If not see
     (with { tree utype = unsigned_type_for (TREE_TYPE (@0)); }
      (convert (bit_and (op (convert:utype @0) (convert:utype @1))
 	       (convert:utype @4))))))))
+
+(if (flag_unsafe_math_optimizations)
+ (for sqrts (SQRT)
+      cbrts (CBRT)
+      exps (EXP EXP2 EXP10 POW10)
+  /* sqrt(expN(x)) -> expN(x*0.5).  */
+  (simplify
+   (sqrts (exps @0))
+   (exps (mult @0 { build_real (type, dconst<1, 2> ()); })))
+  /* cbrt(expN(x)) -> expN(x/3).  */
+  (simplify
+   (cbrts (exps @0))
+   (exps (mult @0 { build_real_truncate (type, dconst<1, 3> ()); }))))
+
+ (for sqrts (SQRT)
+      cbrts (CBRT)
+      pows (POW)
+  /* sqrt(sqrt(x)) -> pow(x,1/4).  */
+  (simplify
+   (sqrts (sqrts @0))
+   (pows @0 { build_real (type, dconst<1, 4> ()); }))
+  /* cbrt(sqrt(x)) -> pow(x,1/6).  */
+  (simplify
+   (sqrts (cbrts @0))
+   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
+  /* sqrt(cbrt(x)) -> pow(x,1/6).  */
+  (simplify
+   (cbrts (sqrts @0))
+   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
+  /* cbrt(cbrt(x)) -> pow(x,1/9), iff x is nonnegative.  */
+  (simplify
+   (cbrts (cbrts nonnegative_p@0))
+   (pows @0 { build_real_truncate (type, dconst<1, 9> ()); }))
+  /* sqrt(pow(x,y)) -> pow(|x|,y*0.5).  */
+  (simplify
+   (sqrts (pows @0 @1))
+   (pows (abs @0) (mult @1 { build_real (type, dconst<1, 2> ()); })))
+  /* cbrt(pow(x,y)) -> pow(x,y/3), iff x is nonnegative.  */
+  (simplify
+   (cbrts (pows nonnegative_p@0 @1))
+   (pows @0 (mult @1 { build_real_truncate (type, dconst<1, 3> ()); })))))
diff --git a/gcc/testsuite/gcc.dg/builtins-47.c b/gcc/testsuite/gcc.dg/builtins-47.c
index 024d7ee..fbe9d21 100644
--- a/gcc/testsuite/gcc.dg/builtins-47.c
+++ b/gcc/testsuite/gcc.dg/builtins-47.c
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-O -ffast-math -fdump-tree-gimple" } */
+/* { dg-options "-O -ffast-math -fdump-tree-optimized" } */
 
 extern double sqrt (double);
 extern double pow (double, double);
@@ -15,5 +15,5 @@ int main ()
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "sqrt" 0 "gimple" } } */
-/* { dg-final { scan-tree-dump-times "pow" 0 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "sqrt" 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "pow" 0 "optimized" } } */

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Move sqrt and cbrt simplifications to match.pd
  2015-10-05 15:17 Move sqrt and cbrt simplifications to match.pd Richard Sandiford
@ 2015-10-06  8:13 ` Richard Biener
  2015-10-06  8:59 ` Marc Glisse
  1 sibling, 0 replies; 9+ messages in thread
From: Richard Biener @ 2015-10-06  8:13 UTC (permalink / raw)
  To: GCC Patches, richard.sandiford

On Mon, Oct 5, 2015 at 5:17 PM, Richard Sandiford
<richard.sandiford@arm.com> wrote:
> This patch moves the sqrt and cbrt simplification rules to match.pd.
> builtins.c now only does the constant folding.
>
> Bootstrapped & regression-tested on x86_64-linux-gnu.  OK to install?

Ok (once prerequesites are approved).

People may notice that on GENERIC we no longer simplify these - this is because
genmatch doesn't output a toplevel entry for simplifying calls (well,
I was lazy,
would need to have hooked into builtins.c folding somewhere but IMHO GENERIC
call folding should go).

Thanks,
Richard.

> Thanks,
> Richard
>
>
> gcc/
>         * builtins.c (fold_builtin_sqrt, fold_builtin_cbrt): Delete.
>         (fold_builtin_1): Update accordingly.  Handle constant arguments here.
>         * match.pd: Add rules previously handled by fold_builtin_sqrt
>         and fold_builtin_cbrt.
>
> gcc/testsuite/
>         * gcc.dg/builtins-47.c: Test the optimized dump instead.
>
> diff --git a/gcc/builtins.c b/gcc/builtins.c
> index 85ba6dd..3df60e8 100644
> --- a/gcc/builtins.c
> +++ b/gcc/builtins.c
> @@ -158,8 +158,6 @@ static bool integer_valued_real_p (tree);
>  static tree fold_trunc_transparent_mathfn (location_t, tree, tree);
>  static rtx expand_builtin_fabs (tree, rtx, rtx);
>  static rtx expand_builtin_signbit (tree, rtx);
> -static tree fold_builtin_sqrt (location_t, tree, tree);
> -static tree fold_builtin_cbrt (location_t, tree, tree);
>  static tree fold_builtin_pow (location_t, tree, tree, tree, tree);
>  static tree fold_builtin_powi (location_t, tree, tree, tree, tree);
>  static tree fold_builtin_cos (location_t, tree, tree, tree);
> @@ -7706,145 +7704,6 @@ fold_builtin_cproj (location_t loc, tree arg, tree type)
>    return NULL_TREE;
>  }
>
> -/* Fold a builtin function call to sqrt, sqrtf, or sqrtl with argument ARG.
> -   Return NULL_TREE if no simplification can be made.  */
> -
> -static tree
> -fold_builtin_sqrt (location_t loc, tree arg, tree type)
> -{
> -
> -  enum built_in_function fcode;
> -  tree res;
> -
> -  if (!validate_arg (arg, REAL_TYPE))
> -    return NULL_TREE;
> -
> -  /* Calculate the result when the argument is a constant.  */
> -  if ((res = do_mpfr_arg1 (arg, type, mpfr_sqrt, &dconst<0> (), NULL, true)))
> -    return res;
> -
> -  /* Optimize sqrt(expN(x)) = expN(x*0.5).  */
> -  fcode = builtin_mathfn_code (arg);
> -  if (flag_unsafe_math_optimizations && BUILTIN_EXPONENT_P (fcode))
> -    {
> -      tree expfn = TREE_OPERAND (CALL_EXPR_FN (arg), 0);
> -      arg = fold_build2_loc (loc, MULT_EXPR, type,
> -                        CALL_EXPR_ARG (arg, 0),
> -                        build_real (type, dconst<1, 2> ()));
> -      return build_call_expr_loc (loc, expfn, 1, arg);
> -    }
> -
> -  /* Optimize sqrt(Nroot(x)) -> pow(x,1/(2*N)).  */
> -  if (flag_unsafe_math_optimizations && BUILTIN_ROOT_P (fcode))
> -    {
> -      tree powfn = mathfn_built_in (type, BUILT_IN_POW);
> -
> -      if (powfn)
> -       {
> -         tree arg0 = CALL_EXPR_ARG (arg, 0);
> -         tree arg1 = (BUILTIN_SQRT_P (fcode)
> -                      ? build_real (type, dconst<1, 4> ())
> -                      : build_real_truncate (type, dconst<1, 6> ()));
> -         return build_call_expr_loc (loc, powfn, 2, arg0, arg1);
> -       }
> -    }
> -
> -  /* Optimize sqrt(pow(x,y)) = pow(|x|,y*0.5).  */
> -  if (flag_unsafe_math_optimizations
> -      && (fcode == BUILT_IN_POW
> -         || fcode == BUILT_IN_POWF
> -         || fcode == BUILT_IN_POWL))
> -    {
> -      tree powfn = TREE_OPERAND (CALL_EXPR_FN (arg), 0);
> -      tree arg0 = CALL_EXPR_ARG (arg, 0);
> -      tree arg1 = CALL_EXPR_ARG (arg, 1);
> -      tree narg1;
> -      if (!tree_expr_nonnegative_p (arg0))
> -       arg0 = build1 (ABS_EXPR, type, arg0);
> -      narg1 = fold_build2_loc (loc, MULT_EXPR, type, arg1,
> -                          build_real (type, dconst<1, 2> ()));
> -      return build_call_expr_loc (loc, powfn, 2, arg0, narg1);
> -    }
> -
> -  return NULL_TREE;
> -}
> -
> -/* Fold a builtin function call to cbrt, cbrtf, or cbrtl with argument ARG.
> -   Return NULL_TREE if no simplification can be made.  */
> -
> -static tree
> -fold_builtin_cbrt (location_t loc, tree arg, tree type)
> -{
> -  const enum built_in_function fcode = builtin_mathfn_code (arg);
> -  tree res;
> -
> -  if (!validate_arg (arg, REAL_TYPE))
> -    return NULL_TREE;
> -
> -  /* Calculate the result when the argument is a constant.  */
> -  if ((res = do_mpfr_arg1 (arg, type, mpfr_cbrt, NULL, NULL, 0)))
> -    return res;
> -
> -  if (flag_unsafe_math_optimizations)
> -    {
> -      /* Optimize cbrt(expN(x)) -> expN(x/3).  */
> -      if (BUILTIN_EXPONENT_P (fcode))
> -       {
> -         tree expfn = TREE_OPERAND (CALL_EXPR_FN (arg), 0);
> -         arg = fold_build2_loc (loc, MULT_EXPR, type,
> -                                CALL_EXPR_ARG (arg, 0),
> -                                build_real_truncate (type, dconst<1, 3> ()));
> -         return build_call_expr_loc (loc, expfn, 1, arg);
> -       }
> -
> -      /* Optimize cbrt(sqrt(x)) -> pow(x,1/6).  */
> -      if (BUILTIN_SQRT_P (fcode))
> -       {
> -         tree powfn = mathfn_built_in (type, BUILT_IN_POW);
> -
> -         if (powfn)
> -           {
> -             tree arg0 = CALL_EXPR_ARG (arg, 0);
> -             tree tree_root = build_real_truncate (type, dconst<1, 6> ());
> -             return build_call_expr_loc (loc, powfn, 2, arg0, tree_root);
> -           }
> -       }
> -
> -      /* Optimize cbrt(cbrt(x)) -> pow(x,1/9) iff x is nonnegative.  */
> -      if (BUILTIN_CBRT_P (fcode))
> -       {
> -         tree arg0 = CALL_EXPR_ARG (arg, 0);
> -         if (tree_expr_nonnegative_p (arg0))
> -           {
> -             tree powfn = mathfn_built_in (type, BUILT_IN_POW);
> -
> -             if (powfn)
> -               {
> -                 tree tree_root = build_real_truncate (type, dconst<1, 9> ());
> -                 return build_call_expr_loc (loc, powfn, 2, arg0, tree_root);
> -               }
> -           }
> -       }
> -
> -      /* Optimize cbrt(pow(x,y)) -> pow(x,y/3) iff x is nonnegative.  */
> -      if (fcode == BUILT_IN_POW
> -          || fcode == BUILT_IN_POWF
> -         || fcode == BUILT_IN_POWL)
> -       {
> -         tree arg00 = CALL_EXPR_ARG (arg, 0);
> -         tree arg01 = CALL_EXPR_ARG (arg, 1);
> -         if (tree_expr_nonnegative_p (arg00))
> -           {
> -             tree powfn = TREE_OPERAND (CALL_EXPR_FN (arg), 0);
> -             tree c = build_real_truncate (type, dconst<1, 3> ());
> -             tree narg01 = fold_build2_loc (loc, MULT_EXPR, type, arg01, c);
> -             return build_call_expr_loc (loc, powfn, 2, arg00, narg01);
> -           }
> -       }
> -    }
> -  return NULL_TREE;
> -}
> -
>  /* Fold function call to builtin cos, cosf, or cosl with argument ARG.
>     TYPE is the type of the return value.  Return NULL_TREE if no
>     simplification can be made.  */
> @@ -9943,10 +9802,14 @@ fold_builtin_1 (location_t loc, tree fndecl, tree arg0)
>        return fold_builtin_carg (loc, arg0, type);
>
>      CASE_FLT_FN (BUILT_IN_SQRT):
> -      return fold_builtin_sqrt (loc, arg0, type);
> +      if (validate_arg (arg0, REAL_TYPE))
> +       return do_mpfr_arg1 (arg0, type, mpfr_sqrt, &dconst<0> (), NULL, true);
> +      break;
>
>      CASE_FLT_FN (BUILT_IN_CBRT):
> -      return fold_builtin_cbrt (loc, arg0, type);
> +      if (validate_arg (arg0, REAL_TYPE))
> +       return do_mpfr_arg1 (arg0, type, mpfr_cbrt, NULL, NULL, 0);
> +      break;
>
>      CASE_FLT_FN (BUILT_IN_ASIN):
>        if (validate_arg (arg0, REAL_TYPE))
> diff --git a/gcc/match.pd b/gcc/match.pd
> index 5ab8c06..db8b731 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -2315,3 +2315,44 @@ along with GCC; see the file COPYING3.  If not see
>      (with { tree utype = unsigned_type_for (TREE_TYPE (@0)); }
>       (convert (bit_and (op (convert:utype @0) (convert:utype @1))
>                (convert:utype @4))))))))
> +
> +(if (flag_unsafe_math_optimizations)
> + (for sqrts (SQRT)
> +      cbrts (CBRT)
> +      exps (EXP EXP2 EXP10 POW10)
> +  /* sqrt(expN(x)) -> expN(x*0.5).  */
> +  (simplify
> +   (sqrts (exps @0))
> +   (exps (mult @0 { build_real (type, dconst<1, 2> ()); })))
> +  /* cbrt(expN(x)) -> expN(x/3).  */
> +  (simplify
> +   (cbrts (exps @0))
> +   (exps (mult @0 { build_real_truncate (type, dconst<1, 3> ()); }))))
> +
> + (for sqrts (SQRT)
> +      cbrts (CBRT)
> +      pows (POW)
> +  /* sqrt(sqrt(x)) -> pow(x,1/4).  */
> +  (simplify
> +   (sqrts (sqrts @0))
> +   (pows @0 { build_real (type, dconst<1, 4> ()); }))
> +  /* cbrt(sqrt(x)) -> pow(x,1/6).  */
> +  (simplify
> +   (sqrts (cbrts @0))
> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
> +  /* sqrt(cbrt(x)) -> pow(x,1/6).  */
> +  (simplify
> +   (cbrts (sqrts @0))
> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
> +  /* cbrt(cbrt(x)) -> pow(x,1/9), iff x is nonnegative.  */
> +  (simplify
> +   (cbrts (cbrts nonnegative_p@0))
> +   (pows @0 { build_real_truncate (type, dconst<1, 9> ()); }))
> +  /* sqrt(pow(x,y)) -> pow(|x|,y*0.5).  */
> +  (simplify
> +   (sqrts (pows @0 @1))
> +   (pows (abs @0) (mult @1 { build_real (type, dconst<1, 2> ()); })))
> +  /* cbrt(pow(x,y)) -> pow(x,y/3), iff x is nonnegative.  */
> +  (simplify
> +   (cbrts (pows nonnegative_p@0 @1))
> +   (pows @0 (mult @1 { build_real_truncate (type, dconst<1, 3> ()); })))))
> diff --git a/gcc/testsuite/gcc.dg/builtins-47.c b/gcc/testsuite/gcc.dg/builtins-47.c
> index 024d7ee..fbe9d21 100644
> --- a/gcc/testsuite/gcc.dg/builtins-47.c
> +++ b/gcc/testsuite/gcc.dg/builtins-47.c
> @@ -1,5 +1,5 @@
>  /* { dg-do run } */
> -/* { dg-options "-O -ffast-math -fdump-tree-gimple" } */
> +/* { dg-options "-O -ffast-math -fdump-tree-optimized" } */
>
>  extern double sqrt (double);
>  extern double pow (double, double);
> @@ -15,5 +15,5 @@ int main ()
>    return 0;
>  }
>
> -/* { dg-final { scan-tree-dump-times "sqrt" 0 "gimple" } } */
> -/* { dg-final { scan-tree-dump-times "pow" 0 "gimple" } } */
> +/* { dg-final { scan-tree-dump-times "sqrt" 0 "optimized" } } */
> +/* { dg-final { scan-tree-dump-times "pow" 0 "optimized" } } */
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Move sqrt and cbrt simplifications to match.pd
  2015-10-05 15:17 Move sqrt and cbrt simplifications to match.pd Richard Sandiford
  2015-10-06  8:13 ` Richard Biener
@ 2015-10-06  8:59 ` Marc Glisse
  2015-10-08 16:55   ` Richard Sandiford
  1 sibling, 1 reply; 9+ messages in thread
From: Marc Glisse @ 2015-10-06  8:59 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: gcc-patches

On Mon, 5 Oct 2015, Richard Sandiford wrote:

> +  /* cbrt(sqrt(x)) -> pow(x,1/6).  */
> +  (simplify
> +   (sqrts (cbrts @0))
> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
> +  /* sqrt(cbrt(x)) -> pow(x,1/6).  */
> +  (simplify
> +   (cbrts (sqrts @0))
> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))

I think you swapped the comments (not that it matters).

-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Move sqrt and cbrt simplifications to match.pd
  2015-10-06  8:59 ` Marc Glisse
@ 2015-10-08 16:55   ` Richard Sandiford
  2015-10-09 14:35     ` Christophe Lyon
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Sandiford @ 2015-10-08 16:55 UTC (permalink / raw)
  To: Marc Glisse; +Cc: gcc-patches

Marc Glisse <marc.glisse@inria.fr> writes:
> On Mon, 5 Oct 2015, Richard Sandiford wrote:
>
>> +  /* cbrt(sqrt(x)) -> pow(x,1/6).  */
>> +  (simplify
>> +   (sqrts (cbrts @0))
>> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
>> +  /* sqrt(cbrt(x)) -> pow(x,1/6).  */
>> +  (simplify
>> +   (cbrts (sqrts @0))
>> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
>
> I think you swapped the comments (not that it matters).

Thanks, fixed in the committed version.

Richard

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Move sqrt and cbrt simplifications to match.pd
  2015-10-08 16:55   ` Richard Sandiford
@ 2015-10-09 14:35     ` Christophe Lyon
  2015-10-09 15:07       ` Richard Sandiford
  0 siblings, 1 reply; 9+ messages in thread
From: Christophe Lyon @ 2015-10-09 14:35 UTC (permalink / raw)
  To: gcc-patches, Richard Sandiford

On 8 October 2015 at 18:55, Richard Sandiford <richard.sandiford@arm.com> wrote:
> Marc Glisse <marc.glisse@inria.fr> writes:
>> On Mon, 5 Oct 2015, Richard Sandiford wrote:
>>
>>> +  /* cbrt(sqrt(x)) -> pow(x,1/6).  */
>>> +  (simplify
>>> +   (sqrts (cbrts @0))
>>> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
>>> +  /* sqrt(cbrt(x)) -> pow(x,1/6).  */
>>> +  (simplify
>>> +   (cbrts (sqrts @0))
>>> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
>>
>> I think you swapped the comments (not that it matters).
>
> Thanks, fixed in the committed version.
>
> Richard
>
Hi Richard,

Since you committed this patch, I've noticed that gcc.dg/builtins-10.c fails
on arm-none-linux-gnueabi targets (as opposed to arm-none-linux-gnueabihf).

gcc.log shows:
/cchfHDHc.o: In function `test':
builtins-10.c:(.text+0x60): undefined reference to `link_error'
collect2: error: ld returned 1 exit status

Does this ring a bell?

Christophe.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Move sqrt and cbrt simplifications to match.pd
  2015-10-09 14:35     ` Christophe Lyon
@ 2015-10-09 15:07       ` Richard Sandiford
  2015-10-09 16:17         ` Richard Sandiford
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Sandiford @ 2015-10-09 15:07 UTC (permalink / raw)
  To: Christophe Lyon; +Cc: gcc-patches

Christophe Lyon <christophe.lyon@linaro.org> writes:
> On 8 October 2015 at 18:55, Richard Sandiford <richard.sandiford@arm.com> wrote:
>> Marc Glisse <marc.glisse@inria.fr> writes:
>>> On Mon, 5 Oct 2015, Richard Sandiford wrote:
>>>
>>>> +  /* cbrt(sqrt(x)) -> pow(x,1/6).  */
>>>> +  (simplify
>>>> +   (sqrts (cbrts @0))
>>>> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
>>>> +  /* sqrt(cbrt(x)) -> pow(x,1/6).  */
>>>> +  (simplify
>>>> +   (cbrts (sqrts @0))
>>>> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
>>>
>>> I think you swapped the comments (not that it matters).
>>
>> Thanks, fixed in the committed version.
>>
>> Richard
>>
> Hi Richard,
>
> Since you committed this patch, I've noticed that gcc.dg/builtins-10.c fails
> on arm-none-linux-gnueabi targets (as opposed to arm-none-linux-gnueabihf).
>
> gcc.log shows:
> /cchfHDHc.o: In function `test':
> builtins-10.c:(.text+0x60): undefined reference to `link_error'
> collect2: error: ld returned 1 exit status

Looks like this is the same fold_strip_sign_ops problem that I was seeing
with some WIP follow-on patches.  We don't fold pow(abs(x), 4) to pow(x, 4).

Hope to have a fix soon.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Move sqrt and cbrt simplifications to match.pd
  2015-10-09 15:07       ` Richard Sandiford
@ 2015-10-09 16:17         ` Richard Sandiford
  2015-10-12 10:01           ` Richard Biener
  2015-10-12 14:11           ` Christophe Lyon
  0 siblings, 2 replies; 9+ messages in thread
From: Richard Sandiford @ 2015-10-09 16:17 UTC (permalink / raw)
  To: Christophe Lyon; +Cc: gcc-patches

Richard Sandiford <richard.sandiford@arm.com> writes:
> Christophe Lyon <christophe.lyon@linaro.org> writes:
>> On 8 October 2015 at 18:55, Richard Sandiford
>> <richard.sandiford@arm.com> wrote:
>>> Marc Glisse <marc.glisse@inria.fr> writes:
>>>> On Mon, 5 Oct 2015, Richard Sandiford wrote:
>>>>
>>>>> +  /* cbrt(sqrt(x)) -> pow(x,1/6).  */
>>>>> +  (simplify
>>>>> +   (sqrts (cbrts @0))
>>>>> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
>>>>> +  /* sqrt(cbrt(x)) -> pow(x,1/6).  */
>>>>> +  (simplify
>>>>> +   (cbrts (sqrts @0))
>>>>> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
>>>>
>>>> I think you swapped the comments (not that it matters).
>>>
>>> Thanks, fixed in the committed version.
>>>
>>> Richard
>>>
>> Hi Richard,
>>
>> Since you committed this patch, I've noticed that gcc.dg/builtins-10.c fails
>> on arm-none-linux-gnueabi targets (as opposed to arm-none-linux-gnueabihf).
>>
>> gcc.log shows:
>> /cchfHDHc.o: In function `test':
>> builtins-10.c:(.text+0x60): undefined reference to `link_error'
>> collect2: error: ld returned 1 exit status
>
> Looks like this is the same fold_strip_sign_ops problem that I was seeing
> with some WIP follow-on patches.  We don't fold pow(abs(x), 4) to pow(x, 4).

Here's the patch I'm testing.

Thanks,
Richard


gcc/
	* real.h (real_isinteger): Declare.
	* real.c (real_isinteger): New function.
	* match.pd: Simplify pow(|x|,y) and pow(-x,y) to pow(x,y)
	if y is an even integer.

diff --git a/gcc/match.pd b/gcc/match.pd
index b87c436..67f9d54 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -309,12 +309,19 @@ along with GCC; see the file COPYING3.  If not see
        && TYPE_OVERFLOW_UNDEFINED (type))
    @0)))
 
-/* Simplify cos (-x) -> cos (x).  */
 (for op (negate abs)
-(for coss (COS COSH)
- (simplify
-  (coss (op @0))
-   (coss @0))))
+ /* Simplify cos(-x) and cos(|x|) -> cos(x).  Similarly for cosh.  */
+ (for coss (COS COSH)
+  (simplify
+   (coss (op @0))
+    (coss @0)))
+ /* Simplify pow(-x, y) and pow(|x|,y) -> pow(x,y) if y is an even integer.  */
+ (for pows (POW)
+  (simplify
+   (pows (op @0) REAL_CST@1)
+   (with { HOST_WIDE_INT n; }
+    (if (real_isinteger (&TREE_REAL_CST (@1), &n) && (n & 1) == 0)
+     (pows @0 @1))))))
 
 /* X % Y is smaller than Y.  */
 (for cmp (lt ge)
diff --git a/gcc/real.c b/gcc/real.c
index f633ffd..85ac83d 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -4997,6 +4997,24 @@ real_isinteger (const REAL_VALUE_TYPE *c, machine_mode mode)
   return real_identical (c, &cint);
 }
 
+/* Check whether C is an integer that fits in a HOST_WIDE_INT,
+   storing it in *INT_OUT if so.  */
+
+bool
+real_isinteger (const REAL_VALUE_TYPE *c, HOST_WIDE_INT *int_out)
+{
+  REAL_VALUE_TYPE cint;
+
+  HOST_WIDE_INT n = real_to_integer (c);
+  real_from_integer (&cint, VOIDmode, n, SIGNED);
+  if (real_identical (c, &cint))
+    {
+      *int_out = n;
+      return true;
+    }
+  return false;
+}
+
 /* Write into BUF the maximum representable finite floating-point
    number, (1 - b**-p) * b**emax for a given FP format FMT as a hex
    float string.  LEN is the size of BUF, and the buffer must be large
diff --git a/gcc/real.h b/gcc/real.h
index 706859b..e65b526 100644
--- a/gcc/real.h
+++ b/gcc/real.h
@@ -467,7 +467,8 @@ extern void real_round (REAL_VALUE_TYPE *, machine_mode,
 extern void real_copysign (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *);
 
 /* Check whether the real constant value given is an integer.  */
-extern bool real_isinteger (const REAL_VALUE_TYPE *c, machine_mode mode);
+extern bool real_isinteger (const REAL_VALUE_TYPE *, machine_mode);
+extern bool real_isinteger (const REAL_VALUE_TYPE *, HOST_WIDE_INT *);
 
 /* Write into BUF the maximum representable finite floating-point
    number, (1 - b**-p) * b**emax for a given FP format FMT as a hex

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Move sqrt and cbrt simplifications to match.pd
  2015-10-09 16:17         ` Richard Sandiford
@ 2015-10-12 10:01           ` Richard Biener
  2015-10-12 14:11           ` Christophe Lyon
  1 sibling, 0 replies; 9+ messages in thread
From: Richard Biener @ 2015-10-12 10:01 UTC (permalink / raw)
  To: Christophe Lyon, gcc-patches, richard.sandiford

On Fri, Oct 9, 2015 at 6:17 PM, Richard Sandiford
<richard.sandiford@arm.com> wrote:
> Richard Sandiford <richard.sandiford@arm.com> writes:
>> Christophe Lyon <christophe.lyon@linaro.org> writes:
>>> On 8 October 2015 at 18:55, Richard Sandiford
>>> <richard.sandiford@arm.com> wrote:
>>>> Marc Glisse <marc.glisse@inria.fr> writes:
>>>>> On Mon, 5 Oct 2015, Richard Sandiford wrote:
>>>>>
>>>>>> +  /* cbrt(sqrt(x)) -> pow(x,1/6).  */
>>>>>> +  (simplify
>>>>>> +   (sqrts (cbrts @0))
>>>>>> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
>>>>>> +  /* sqrt(cbrt(x)) -> pow(x,1/6).  */
>>>>>> +  (simplify
>>>>>> +   (cbrts (sqrts @0))
>>>>>> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
>>>>>
>>>>> I think you swapped the comments (not that it matters).
>>>>
>>>> Thanks, fixed in the committed version.
>>>>
>>>> Richard
>>>>
>>> Hi Richard,
>>>
>>> Since you committed this patch, I've noticed that gcc.dg/builtins-10.c fails
>>> on arm-none-linux-gnueabi targets (as opposed to arm-none-linux-gnueabihf).
>>>
>>> gcc.log shows:
>>> /cchfHDHc.o: In function `test':
>>> builtins-10.c:(.text+0x60): undefined reference to `link_error'
>>> collect2: error: ld returned 1 exit status
>>
>> Looks like this is the same fold_strip_sign_ops problem that I was seeing
>> with some WIP follow-on patches.  We don't fold pow(abs(x), 4) to pow(x, 4).
>
> Here's the patch I'm testing.

Ok.

Thanks,
Richard.

> Thanks,
> Richard
>
>
> gcc/
>         * real.h (real_isinteger): Declare.
>         * real.c (real_isinteger): New function.
>         * match.pd: Simplify pow(|x|,y) and pow(-x,y) to pow(x,y)
>         if y is an even integer.
>
> diff --git a/gcc/match.pd b/gcc/match.pd
> index b87c436..67f9d54 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -309,12 +309,19 @@ along with GCC; see the file COPYING3.  If not see
>         && TYPE_OVERFLOW_UNDEFINED (type))
>     @0)))
>
> -/* Simplify cos (-x) -> cos (x).  */
>  (for op (negate abs)
> -(for coss (COS COSH)
> - (simplify
> -  (coss (op @0))
> -   (coss @0))))
> + /* Simplify cos(-x) and cos(|x|) -> cos(x).  Similarly for cosh.  */
> + (for coss (COS COSH)
> +  (simplify
> +   (coss (op @0))
> +    (coss @0)))
> + /* Simplify pow(-x, y) and pow(|x|,y) -> pow(x,y) if y is an even integer.  */
> + (for pows (POW)
> +  (simplify
> +   (pows (op @0) REAL_CST@1)
> +   (with { HOST_WIDE_INT n; }
> +    (if (real_isinteger (&TREE_REAL_CST (@1), &n) && (n & 1) == 0)
> +     (pows @0 @1))))))
>
>  /* X % Y is smaller than Y.  */
>  (for cmp (lt ge)
> diff --git a/gcc/real.c b/gcc/real.c
> index f633ffd..85ac83d 100644
> --- a/gcc/real.c
> +++ b/gcc/real.c
> @@ -4997,6 +4997,24 @@ real_isinteger (const REAL_VALUE_TYPE *c, machine_mode mode)
>    return real_identical (c, &cint);
>  }
>
> +/* Check whether C is an integer that fits in a HOST_WIDE_INT,
> +   storing it in *INT_OUT if so.  */
> +
> +bool
> +real_isinteger (const REAL_VALUE_TYPE *c, HOST_WIDE_INT *int_out)
> +{
> +  REAL_VALUE_TYPE cint;
> +
> +  HOST_WIDE_INT n = real_to_integer (c);
> +  real_from_integer (&cint, VOIDmode, n, SIGNED);
> +  if (real_identical (c, &cint))
> +    {
> +      *int_out = n;
> +      return true;
> +    }
> +  return false;
> +}
> +
>  /* Write into BUF the maximum representable finite floating-point
>     number, (1 - b**-p) * b**emax for a given FP format FMT as a hex
>     float string.  LEN is the size of BUF, and the buffer must be large
> diff --git a/gcc/real.h b/gcc/real.h
> index 706859b..e65b526 100644
> --- a/gcc/real.h
> +++ b/gcc/real.h
> @@ -467,7 +467,8 @@ extern void real_round (REAL_VALUE_TYPE *, machine_mode,
>  extern void real_copysign (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *);
>
>  /* Check whether the real constant value given is an integer.  */
> -extern bool real_isinteger (const REAL_VALUE_TYPE *c, machine_mode mode);
> +extern bool real_isinteger (const REAL_VALUE_TYPE *, machine_mode);
> +extern bool real_isinteger (const REAL_VALUE_TYPE *, HOST_WIDE_INT *);
>
>  /* Write into BUF the maximum representable finite floating-point
>     number, (1 - b**-p) * b**emax for a given FP format FMT as a hex
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Move sqrt and cbrt simplifications to match.pd
  2015-10-09 16:17         ` Richard Sandiford
  2015-10-12 10:01           ` Richard Biener
@ 2015-10-12 14:11           ` Christophe Lyon
  1 sibling, 0 replies; 9+ messages in thread
From: Christophe Lyon @ 2015-10-12 14:11 UTC (permalink / raw)
  To: Christophe Lyon, gcc-patches, Richard Sandiford

On 9 October 2015 at 18:17, Richard Sandiford <richard.sandiford@arm.com> wrote:
> Richard Sandiford <richard.sandiford@arm.com> writes:
>> Christophe Lyon <christophe.lyon@linaro.org> writes:
>>> On 8 October 2015 at 18:55, Richard Sandiford
>>> <richard.sandiford@arm.com> wrote:
>>>> Marc Glisse <marc.glisse@inria.fr> writes:
>>>>> On Mon, 5 Oct 2015, Richard Sandiford wrote:
>>>>>
>>>>>> +  /* cbrt(sqrt(x)) -> pow(x,1/6).  */
>>>>>> +  (simplify
>>>>>> +   (sqrts (cbrts @0))
>>>>>> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
>>>>>> +  /* sqrt(cbrt(x)) -> pow(x,1/6).  */
>>>>>> +  (simplify
>>>>>> +   (cbrts (sqrts @0))
>>>>>> +   (pows @0 { build_real_truncate (type, dconst<1, 6> ()); }))
>>>>>
>>>>> I think you swapped the comments (not that it matters).
>>>>
>>>> Thanks, fixed in the committed version.
>>>>
>>>> Richard
>>>>
>>> Hi Richard,
>>>
>>> Since you committed this patch, I've noticed that gcc.dg/builtins-10.c fails
>>> on arm-none-linux-gnueabi targets (as opposed to arm-none-linux-gnueabihf).
>>>
>>> gcc.log shows:
>>> /cchfHDHc.o: In function `test':
>>> builtins-10.c:(.text+0x60): undefined reference to `link_error'
>>> collect2: error: ld returned 1 exit status
>>
>> Looks like this is the same fold_strip_sign_ops problem that I was seeing
>> with some WIP follow-on patches.  We don't fold pow(abs(x), 4) to pow(x, 4).
>
> Here's the patch I'm testing.
>
> Thanks,
> Richard
>
>
> gcc/
>         * real.h (real_isinteger): Declare.
>         * real.c (real_isinteger): New function.
>         * match.pd: Simplify pow(|x|,y) and pow(-x,y) to pow(x,y)
>         if y is an even integer.
>

This makes sense indeed. I was wondering why I didn't notice
regressions on arm-*hf targets:
are such optimizations caught in later passes for some targets?

> diff --git a/gcc/match.pd b/gcc/match.pd
> index b87c436..67f9d54 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -309,12 +309,19 @@ along with GCC; see the file COPYING3.  If not see
>         && TYPE_OVERFLOW_UNDEFINED (type))
>     @0)))
>
> -/* Simplify cos (-x) -> cos (x).  */
>  (for op (negate abs)
> -(for coss (COS COSH)
> - (simplify
> -  (coss (op @0))
> -   (coss @0))))
> + /* Simplify cos(-x) and cos(|x|) -> cos(x).  Similarly for cosh.  */
> + (for coss (COS COSH)
> +  (simplify
> +   (coss (op @0))
> +    (coss @0)))
> + /* Simplify pow(-x, y) and pow(|x|,y) -> pow(x,y) if y is an even integer.  */
> + (for pows (POW)
> +  (simplify
> +   (pows (op @0) REAL_CST@1)
> +   (with { HOST_WIDE_INT n; }
> +    (if (real_isinteger (&TREE_REAL_CST (@1), &n) && (n & 1) == 0)
> +     (pows @0 @1))))))
>
>  /* X % Y is smaller than Y.  */
>  (for cmp (lt ge)
> diff --git a/gcc/real.c b/gcc/real.c
> index f633ffd..85ac83d 100644
> --- a/gcc/real.c
> +++ b/gcc/real.c
> @@ -4997,6 +4997,24 @@ real_isinteger (const REAL_VALUE_TYPE *c, machine_mode mode)
>    return real_identical (c, &cint);
>  }
>
> +/* Check whether C is an integer that fits in a HOST_WIDE_INT,
> +   storing it in *INT_OUT if so.  */
> +
> +bool
> +real_isinteger (const REAL_VALUE_TYPE *c, HOST_WIDE_INT *int_out)
> +{
> +  REAL_VALUE_TYPE cint;
> +
> +  HOST_WIDE_INT n = real_to_integer (c);
> +  real_from_integer (&cint, VOIDmode, n, SIGNED);
> +  if (real_identical (c, &cint))
> +    {
> +      *int_out = n;
> +      return true;
> +    }
> +  return false;
> +}
> +
>  /* Write into BUF the maximum representable finite floating-point
>     number, (1 - b**-p) * b**emax for a given FP format FMT as a hex
>     float string.  LEN is the size of BUF, and the buffer must be large
> diff --git a/gcc/real.h b/gcc/real.h
> index 706859b..e65b526 100644
> --- a/gcc/real.h
> +++ b/gcc/real.h
> @@ -467,7 +467,8 @@ extern void real_round (REAL_VALUE_TYPE *, machine_mode,
>  extern void real_copysign (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *);
>
>  /* Check whether the real constant value given is an integer.  */
> -extern bool real_isinteger (const REAL_VALUE_TYPE *c, machine_mode mode);
> +extern bool real_isinteger (const REAL_VALUE_TYPE *, machine_mode);
> +extern bool real_isinteger (const REAL_VALUE_TYPE *, HOST_WIDE_INT *);
>
>  /* Write into BUF the maximum representable finite floating-point
>     number, (1 - b**-p) * b**emax for a given FP format FMT as a hex
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-10-12 14:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-05 15:17 Move sqrt and cbrt simplifications to match.pd Richard Sandiford
2015-10-06  8:13 ` Richard Biener
2015-10-06  8:59 ` Marc Glisse
2015-10-08 16:55   ` Richard Sandiford
2015-10-09 14:35     ` Christophe Lyon
2015-10-09 15:07       ` Richard Sandiford
2015-10-09 16:17         ` Richard Sandiford
2015-10-12 10:01           ` Richard Biener
2015-10-12 14:11           ` Christophe Lyon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).