]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
emit-rtl.c (dconstpi): Delete.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Sat, 3 Feb 2007 20:49:51 +0000 (20:49 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Sat, 3 Feb 2007 20:49:51 +0000 (20:49 +0000)
* emit-rtl.c (dconstpi): Delete.
(dconstsqrt2): New.
(init_emit_once): Delete dconstpi and init dconstsqrt2.
* real.h (dconstpi): Delete.
(dconstsqrt2): New.
* builtins.c (fold_builtin_cabs): Use dconstsqrt2.
(fold_builtin_hypot): Likewise.

From-SVN: r121550

gcc/ChangeLog
gcc/builtins.c
gcc/emit-rtl.c
gcc/real.h

index e5287e272723b3cdf685f1f680eeaef544472cf2..b6ccf374c96c4855de8605cdd0aba8da9fd44d95 100644 (file)
@@ -1,3 +1,13 @@
+2007-02-03  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * emit-rtl.c (dconstpi): Delete.
+       (dconstsqrt2): New.
+       (init_emit_once): Delete dconstpi and init dconstsqrt2.
+       * real.h (dconstpi): Delete.
+       (dconstsqrt2): New.
+       * builtins.c (fold_builtin_cabs): Use dconstsqrt2.
+       (fold_builtin_hypot): Likewise.
+
 2007-02-03  Tom Tromey  <tromey@redhat.com>
 
        PR driver/30246
index b7ce1e4c5d822107ba635918483cbc28e690146e..b7ff78203f810a3859a669619dc2175c02ace04d 100644 (file)
@@ -7158,13 +7158,12 @@ fold_builtin_cabs (tree arglist, tree type, tree fndecl)
       if (flag_unsafe_math_optimizations
          && operand_equal_p (real, imag, OEP_PURE_SAME))
         {
-         REAL_VALUE_TYPE sqrt2;
-
-         real_sqrt (&sqrt2, TYPE_MODE (type), &dconst2);
+         const REAL_VALUE_TYPE sqrt2_trunc
+           = real_value_truncate (TYPE_MODE (type), dconstsqrt2);
          STRIP_NOPS (real);
          return fold_build2 (MULT_EXPR, type,
                              fold_build1 (ABS_EXPR, type, real),
-                             build_real (type, sqrt2));
+                             build_real (type, sqrt2_trunc));
        }
     }
 
@@ -8059,12 +8058,11 @@ fold_builtin_hypot (tree fndecl, tree arglist, tree type)
   if (flag_unsafe_math_optimizations
       && operand_equal_p (arg0, arg1, OEP_PURE_SAME))
     {
-      REAL_VALUE_TYPE sqrt2;
-
-      real_sqrt (&sqrt2, TYPE_MODE (type), &dconst2);
+      const REAL_VALUE_TYPE sqrt2_trunc
+       = real_value_truncate (TYPE_MODE (type), dconstsqrt2);
       return fold_build2 (MULT_EXPR, type,
                          fold_build1 (ABS_EXPR, type, arg0),
-                         build_real (type, sqrt2));
+                         build_real (type, sqrt2_trunc));
     }
 
   return NULL_TREE;
index 94381a9e16c1b5dc02584f9112ba25fa4f6c3432..1faa57ffedb6e408936fcc5cf6c7435cb0ba82fc 100644 (file)
@@ -105,7 +105,7 @@ REAL_VALUE_TYPE dconstm1;
 REAL_VALUE_TYPE dconstm2;
 REAL_VALUE_TYPE dconsthalf;
 REAL_VALUE_TYPE dconstthird;
-REAL_VALUE_TYPE dconstpi;
+REAL_VALUE_TYPE dconstsqrt2;
 REAL_VALUE_TYPE dconste;
 
 /* All references to the following fixed hard registers go through
@@ -5154,8 +5154,8 @@ init_emit_once (int line_numbers)
 
   /* Initialize mathematical constants for constant folding builtins.
      These constants need to be given to at least 160 bits precision.  */
-  real_from_string (&dconstpi,
-    "3.1415926535897932384626433832795028841971693993751058209749445923078");
+  real_from_string (&dconstsqrt2,
+    "1.4142135623730950488016887242096980785696718753769480731766797379907");
   real_from_string (&dconste,
     "2.7182818284590452353602874713526624977572470936999595749669676277241");
 
index 81ee855dbfae5b1a5df3f1ee4933cafda2bb1ac6..fda1095b1bc88dc5f26c44d604a9d52d53ee4b1f 100644 (file)
@@ -387,7 +387,7 @@ extern REAL_VALUE_TYPE dconstm1;
 extern REAL_VALUE_TYPE dconstm2;
 extern REAL_VALUE_TYPE dconsthalf;
 extern REAL_VALUE_TYPE dconstthird;
-extern REAL_VALUE_TYPE dconstpi;
+extern REAL_VALUE_TYPE dconstsqrt2;
 extern REAL_VALUE_TYPE dconste;
 
 /* Function to return a real value (not a tree node)