]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Replace REAL_VALUES_EQUAL with real_equal
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 5 Oct 2015 11:29:35 +0000 (11:29 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 5 Oct 2015 11:29:35 +0000 (11:29 +0000)
Richard B suggested we should replace dconsthalf etc. with
dconst<1, 2> ().  When I tried that, the extra comma caused problems
with some lingering uses of the old target macros for handling reals
(e.g. REAL_ARITHMETIC instead of real_arithmetic), since the constant
was then treated as two macro parameters.  It would have been possible
to add an extra level of brackets to avoid this, but I thought I might
as well take the opportunity to remove the macros instead.  (Note that
I'm only removing macros that caused a problem directly, or are closely
related to ones that did.)

This first patch replaces REAL_VALUES_EQUAL with a real_equal function.
The prototype is the same as for real_identical, which has already
undergone a half-transition in this direction.

Bootstrapped & regression-tested on x86_64-linux-gnu.  Also tested by
building one target per CPU directory and checking that there were
no new warnings and no changes in testsuite output at -O2.

gcc/c-family/
* c-lex.c (interpret_float): Use real_equal instead of
REAL_VALUES_EQUAL.

gcc/c/
* c-typeck.c (c_tree_equal): Use real_equal instead of
REAL_VALUES_EQUAL.

gcc/cp/
* tree.c (cp_tree_equal): Use real_equal instead of
REAL_VALUES_EQUAL.

gcc/
* real.h (real_equal): Declare.
(REAL_VALUES_EQUAL): Delete.
* real.c (real_equal): New function.
(real_compare): Use it.
* doc/tm.texi.in (REAL_VALUES_EQUAL): Delete.
* doc/tm.texi: Regenerate.
* builtins.c (fold_builtin_pow, fold_builtin_load_exponent): Use
real_equal instead of REAL_VALUES_EQUAL.
* config/aarch64/aarch64.c (aarch64_float_const_zero_rtx_p): Likewise.
* config/arm/arm.c (arm_const_double_rtx, neon_valid_immediate)
(fp_const_from_val): Likewise.
* config/fr30/fr30.c (fr30_const_double_is_zero): Likewise.
* config/m68k/m68k.c (standard_68881_constant_p): Likewise.
(floating_exact_log2): Likewise.
* config/sh/sh.c (fp_zero_operand, fp_one_operand): Likewise.
* config/vax/vax.c (vax_float_literal): Likewise.
* config/xtensa/predicates.md (const_float_1_operand): Likewise.
* cprop.c (implicit_set_cond_p): Likewise.
* expmed.c (expand_mult): Likewise.
* fold-const.c (const_binop): Likewise.
* simplify-rtx.c (simplify_binary_operation_1): Likewise.
(simplify_const_binary_operation): Likewise.
(simplify_const_relational_operation): Likewise.
* tree-call-cdce.c (check_pow): Likewise.
(gen_conditions_for_pow_cst_base): Likewise.
* tree-inline.c (estimate_num_insns): Likewise.
* tree-ssa-dom.c (record_equality): Likewise.
* tree-ssa-math-opts.c (representable_as_half_series_p): Likewise.
(gimple_expand_builtin_pow): Likewise.
(pass_optimize_widening_mul::execute): Likewise.
* tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise.
* tree-vect-patterns.c (vect_recog_pow_pattern): Likewise.
* tree.c (real_zerop, real_onep, real_minus_onep): Likewise.
---
 gcc/builtins.c                  | 14 +++++++-------
 gcc/c-family/c-lex.c            |  6 +++---
 gcc/c/c-typeck.c                |  2 +-
 gcc/config/aarch64/aarch64.c    |  2 +-
 gcc/config/arm/arm.c            |  6 +++---
 gcc/config/fr30/fr30.c          |  2 +-
 gcc/config/m68k/m68k.c          |  6 +++---
 gcc/config/sh/sh.c              |  4 ++--
 gcc/config/vax/vax.c            |  4 ++--
 gcc/config/xtensa/predicates.md |  2 +-
 gcc/cp/tree.c                   |  2 +-
 gcc/cprop.c                     |  2 +-
 gcc/doc/tm.texi                 |  7 -------
 gcc/doc/tm.texi.in              |  7 -------
 gcc/expmed.c                    |  2 +-
 gcc/fold-const.c                |  2 +-
 gcc/real.c                      | 10 +++++++++-
 gcc/real.h                      |  4 ++--
 gcc/simplify-rtx.c              | 16 ++++++++--------
 gcc/tree-call-cdce.c            |  4 ++--
 gcc/tree-inline.c               |  5 +++--
 gcc/tree-ssa-dom.c              |  2 +-
 gcc/tree-ssa-math-opts.c        | 16 ++++++++--------
 gcc/tree-ssa-uncprop.c          |  2 +-
 gcc/tree-vect-patterns.c        |  4 ++--
 gcc/tree.c                      |  6 +++---
 26 files changed, 67 insertions(+), 72 deletions(-)

From-SVN: r228473

30 files changed:
gcc/ChangeLog
gcc/builtins.c
gcc/c-family/ChangeLog
gcc/c-family/c-lex.c
gcc/c/ChangeLog
gcc/c/c-typeck.c
gcc/config/aarch64/aarch64.c
gcc/config/arm/arm.c
gcc/config/fr30/fr30.c
gcc/config/m68k/m68k.c
gcc/config/sh/sh.c
gcc/config/vax/vax.c
gcc/config/xtensa/predicates.md
gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/cprop.c
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/expmed.c
gcc/fold-const.c
gcc/real.c
gcc/real.h
gcc/simplify-rtx.c
gcc/tree-call-cdce.c
gcc/tree-inline.c
gcc/tree-ssa-dom.c
gcc/tree-ssa-math-opts.c
gcc/tree-ssa-uncprop.c
gcc/tree-vect-patterns.c
gcc/tree.c

index c8ab25f266357ab66996e9b8f16de5d526c5c264..8089fb029dd1a179344a8fbc2465ab2ffbcca38c 100644 (file)
@@ -1,3 +1,67 @@
+2015-10-05  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * real.h (real_equal): Declare.
+       (REAL_VALUES_EQUAL): Delete.
+       * real.c (real_equal): New function.
+       (real_compare): Use it.
+       * doc/tm.texi.in (REAL_VALUES_EQUAL): Delete.
+       * doc/tm.texi: Regenerate.
+       * builtins.c (fold_builtin_pow, fold_builtin_load_exponent): Use
+       real_equal instead of REAL_VALUES_EQUAL.
+       * config/aarch64/aarch64.c (aarch64_float_const_zero_rtx_p): Likewise.
+       * config/arm/arm.c (arm_const_double_rtx, neon_valid_immediate)
+       (fp_const_from_val): Likewise.
+       * config/fr30/fr30.c (fr30_const_double_is_zero): Likewise.
+       * config/m68k/m68k.c (standard_68881_constant_p): Likewise.
+       (floating_exact_log2): Likewise.
+       * config/sh/sh.c (fp_zero_operand, fp_one_operand): Likewise.
+       * config/vax/vax.c (vax_float_literal): Likewise.
+       * config/xtensa/predicates.md (const_float_1_operand): Likewise.
+       * cprop.c (implicit_set_cond_p): Likewise.
+       * expmed.c (expand_mult): Likewise.
+       * fold-const.c (const_binop): Likewise.
+       * simplify-rtx.c (simplify_binary_operation_1): Likewise.
+       (simplify_const_binary_operation): Likewise.
+       (simplify_const_relational_operation): Likewise.
+       * tree-call-cdce.c (check_pow): Likewise.
+       (gen_conditions_for_pow_cst_base): Likewise.
+       * tree-inline.c (estimate_num_insns): Likewise.
+       * tree-ssa-dom.c (record_equality): Likewise.
+       * tree-ssa-math-opts.c (representable_as_half_series_p): Likewise.
+       (gimple_expand_builtin_pow): Likewise.
+       (pass_optimize_widening_mul::execute): Likewise.
+       * tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise.
+       * tree-vect-patterns.c (vect_recog_pow_pattern): Likewise.
+       * tree.c (real_zerop, real_onep, real_minus_onep): Likewise.
+---
+ gcc/builtins.c                  | 14 +++++++-------
+ gcc/c-family/c-lex.c            |  6 +++---
+ gcc/c/c-typeck.c                |  2 +-
+ gcc/config/aarch64/aarch64.c    |  2 +-
+ gcc/config/arm/arm.c            |  6 +++---
+ gcc/config/fr30/fr30.c          |  2 +-
+ gcc/config/m68k/m68k.c          |  6 +++---
+ gcc/config/sh/sh.c              |  4 ++--
+ gcc/config/vax/vax.c            |  4 ++--
+ gcc/config/xtensa/predicates.md |  2 +-
+ gcc/cp/tree.c                   |  2 +-
+ gcc/cprop.c                     |  2 +-
+ gcc/doc/tm.texi                 |  7 -------
+ gcc/doc/tm.texi.in              |  7 -------
+ gcc/expmed.c                    |  2 +-
+ gcc/fold-const.c                |  2 +-
+ gcc/real.c                      | 10 +++++++++-
+ gcc/real.h                      |  4 ++--
+ gcc/simplify-rtx.c              | 16 ++++++++--------
+ gcc/tree-call-cdce.c            |  4 ++--
+ gcc/tree-inline.c               |  5 +++--
+ gcc/tree-ssa-dom.c              |  2 +-
+ gcc/tree-ssa-math-opts.c        | 16 ++++++++--------
+ gcc/tree-ssa-uncprop.c          |  2 +-
+ gcc/tree-vect-patterns.c        |  4 ++--
+ gcc/tree.c                      |  6 +++---
+ 26 files changed, 67 insertions(+), 72 deletions(-)
+
 2015-10-05  Richard Biener  <rguenther@suse.de>
 
        PR ipa/67783
index e20c1f8ff99afcd1c8fb63fe6871416f9d2e44d9..9a81a182de48e5e9ec3f8ece4d25660390c09a26 100644 (file)
@@ -8432,22 +8432,22 @@ fold_builtin_pow (location_t loc, tree fndecl, tree arg0, tree arg1, tree type)
       c = TREE_REAL_CST (arg1);
 
       /* Optimize pow(x,0.0) = 1.0.  */
-      if (REAL_VALUES_EQUAL (c, dconst0))
+      if (real_equal (&c, &dconst0))
        return omit_one_operand_loc (loc, type, build_real (type, dconst1),
                                 arg0);
 
       /* Optimize pow(x,1.0) = x.  */
-      if (REAL_VALUES_EQUAL (c, dconst1))
+      if (real_equal (&c, &dconst1))
        return arg0;
 
       /* Optimize pow(x,-1.0) = 1.0/x.  */
-      if (REAL_VALUES_EQUAL (c, dconstm1))
+      if (real_equal (&c, &dconstm1))
        return fold_build2_loc (loc, RDIV_EXPR, type,
                            build_real (type, dconst1), arg0);
 
       /* Optimize pow(x,0.5) = sqrt(x).  */
       if (flag_unsafe_math_optimizations
-         && REAL_VALUES_EQUAL (c, dconsthalf))
+         && real_equal (&c, &dconsthalf))
        {
          tree sqrtfn = mathfn_built_in (type, BUILT_IN_SQRT);
 
@@ -8461,7 +8461,7 @@ fold_builtin_pow (location_t loc, tree fndecl, tree arg0, tree arg1, tree type)
          const REAL_VALUE_TYPE dconstroot
            = real_value_truncate (TYPE_MODE (type), dconst_third ());
 
-         if (REAL_VALUES_EQUAL (c, dconstroot))
+         if (real_equal (&c, &dconstroot))
            {
              tree cbrtfn = mathfn_built_in (type, BUILT_IN_CBRT);
              if (cbrtfn != NULL_TREE)
@@ -8480,7 +8480,7 @@ fold_builtin_pow (location_t loc, tree fndecl, tree arg0, tree arg1, tree type)
              && !TREE_OVERFLOW (arg0)
              && (n > 0
                  || (!flag_trapping_math && !flag_errno_math)
-                 || !REAL_VALUES_EQUAL (TREE_REAL_CST (arg0), dconst0)))
+                 || !real_equal (&TREE_REAL_CST (arg0), &dconst0)))
            {
              REAL_VALUE_TYPE x;
              bool inexact;
@@ -9373,7 +9373,7 @@ fold_builtin_load_exponent (location_t loc, tree arg0, tree arg1,
 
                  /* Only proceed if the target mode can hold the
                     resulting value.  */
-                 if (REAL_VALUES_EQUAL (initial_result, trunc_result))
+                 if (real_equal (&initial_result, &trunc_result))
                    return build_real (type, trunc_result);
                }
            }
index c75d489509731773eff49f58d0a949d8889d8d73..5af62aa5a342717b54a75735882a74e52edcdbd5 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-05  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * c-lex.c (interpret_float): Use real_equal instead of
+       REAL_VALUES_EQUAL.
+
 2015-10-04  Jason Merrill  <jason@redhat.com>
 
        Implement N4514, C++ Extensions for Transactional Memory.
index 55ceb20a01f61b525cb23acdd1e95063b3633667..c69f4a6e817b693bc0bda8e0e2c2895ef289fe72 100644 (file)
@@ -914,9 +914,9 @@ interpret_float (const cpp_token *token, unsigned int flags,
        }
     }
   /* We also give a warning if the value underflows.  */
-  else if (REAL_VALUES_EQUAL (real, dconst0)
+  else if (real_equal (&real, &dconst0)
           || (const_type != type
-              && REAL_VALUES_EQUAL (real_trunc, dconst0)))
+              && real_equal (&real_trunc, &dconst0)))
     {
       REAL_VALUE_TYPE realvoidmode;
       int oflow = real_from_string (&realvoidmode, copy);
@@ -924,7 +924,7 @@ interpret_float (const cpp_token *token, unsigned int flags,
                              : (oflow < 0 ? OT_UNDERFLOW : OT_OVERFLOW));
       if (!(flags & CPP_N_USERDEF))
        {
-         if (oflow < 0 || !REAL_VALUES_EQUAL (realvoidmode, dconst0))
+         if (oflow < 0 || !real_equal (&realvoidmode, &dconst0))
            warning (OPT_Woverflow, "floating constant truncated to zero");
        }
     }
index e0f169dc1d5da8e9cb6bdd7384ac004d5dfec4b1..dfa2787c54818e3686c5c7f10a7fe6eebb012cf6 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-05  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * c-typeck.c (c_tree_equal): Use real_equal instead of
+       REAL_VALUES_EQUAL.
+
 2015-10-04  Jason Merrill  <jason@redhat.com>
 
        * c-parser.c (c_lex_one_token): Handle @synchronized.
index ad02d6cfda1a3e0eab7f60e89c76e87a912fa3e3..10cad367bb2b9c005d10803b2f78b33aac239f7c 100644 (file)
@@ -12758,7 +12758,7 @@ c_tree_equal (tree t1, tree t2)
       return wi::eq_p (t1, t2);
 
     case REAL_CST:
-      return REAL_VALUES_EQUAL (TREE_REAL_CST (t1), TREE_REAL_CST (t2));
+      return real_equal (&TREE_REAL_CST (t1), &TREE_REAL_CST (t2));
 
     case STRING_CST:
       return TREE_STRING_LENGTH (t1) == TREE_STRING_LENGTH (t2)
index d4c5665cf4d0b046a6129c35007fc2ae8265812f..a1057c962b58888ba1a5e3953d70efb031dea1b1 100644 (file)
@@ -3771,7 +3771,7 @@ aarch64_float_const_zero_rtx_p (rtx x)
   REAL_VALUE_FROM_CONST_DOUBLE (r, x);
   if (REAL_VALUE_MINUS_ZERO (r))
     return !HONOR_SIGNED_ZEROS (GET_MODE (x));
-  return REAL_VALUES_EQUAL (r, dconst0);
+  return real_equal (&r, &dconst0);
 }
 
 /* Return the fixed registers used for condition codes.  */
index 02f5dc37ead14eab794be760e2281cd2ff103fa6..184ce5095588ec852d9791159cdd170480b27e35 100644 (file)
@@ -12107,7 +12107,7 @@ arm_const_double_rtx (rtx x)
   if (REAL_VALUE_MINUS_ZERO (r))
     return 0;
 
-  if (REAL_VALUES_EQUAL (r, value_fp0))
+  if (real_equal (&r, &value_fp0))
     return 1;
 
   return 0;
@@ -12319,7 +12319,7 @@ neon_valid_immediate (rtx op, machine_mode mode, int inverse,
 
           REAL_VALUE_FROM_CONST_DOUBLE (re, elt);
 
-          if (!REAL_VALUES_EQUAL (r0, re))
+          if (!real_equal (&r0, &re))
             return -1;
         }
 
@@ -17594,7 +17594,7 @@ fp_const_from_val (REAL_VALUE_TYPE *r)
   if (!fp_consts_inited)
     init_fp_table ();
 
-  gcc_assert (REAL_VALUES_EQUAL (*r, value_fp0));
+  gcc_assert (real_equal (r, &value_fp0));
   return "0";
 }
 
index 3308b55d9cf7d1c3763c7efef337f74e11cc5b7f..0cac6ce2cf1187fe82c7d0ec229bfb38ab79853c 100644 (file)
@@ -895,7 +895,7 @@ fr30_const_double_is_zero (rtx operand)
 
   REAL_VALUE_FROM_CONST_DOUBLE (d, operand);
 
-  return REAL_VALUES_EQUAL (d, dconst0);
+  return real_equal (&d, &dconst0);
 }
 
 /*}}}*/
index c26f37bb2ee671e6c4bd89e36bd8548257cba0d8..b7d96a55e44ecb8e8dba493e6008cf31fd0a52e7 100644 (file)
@@ -4336,7 +4336,7 @@ standard_68881_constant_p (rtx x)
 
   REAL_VALUE_FROM_CONST_DOUBLE (r, x);
 
-  /* Use REAL_VALUES_IDENTICAL instead of REAL_VALUES_EQUAL so that -0.0
+  /* Use REAL_VALUES_IDENTICAL instead of real_equal so that -0.0
      is rejected.  */
   for (i = 0; i < 6; i++)
     {
@@ -4347,7 +4347,7 @@ standard_68881_constant_p (rtx x)
   if (GET_MODE (x) == SFmode)
     return 0;
 
-  if (REAL_VALUES_EQUAL (r, values_68881[6]))
+  if (real_equal (&r, &values_68881[6]))
     return (codes_68881[6]);
 
   /* larger powers of ten in the constants ram are not used
@@ -4371,7 +4371,7 @@ floating_exact_log2 (rtx x)
 
   exp = real_exponent (&r);
   real_2expN (&r1, exp, DFmode);
-  if (REAL_VALUES_EQUAL (r1, r))
+  if (real_equal (&r1, &r))
     return exp;
 
   return 0;
index 904201b22b025275951c540270b811dfa2da8260..a0d2e16fcffaa35cda4873b6dd9d428d00add0a2 100644 (file)
@@ -10006,7 +10006,7 @@ fp_zero_operand (rtx op)
     return false;
 
   REAL_VALUE_FROM_CONST_DOUBLE (r, op);
-  return REAL_VALUES_EQUAL (r, dconst0) && ! REAL_VALUE_MINUS_ZERO (r);
+  return real_equal (&r, &dconst0) && ! REAL_VALUE_MINUS_ZERO (r);
 }
 
 /* Returns true if OP is a floating point value with value 1.0.  */
@@ -10019,7 +10019,7 @@ fp_one_operand (rtx op)
     return false;
 
   REAL_VALUE_FROM_CONST_DOUBLE (r, op);
-  return REAL_VALUES_EQUAL (r, dconst1);
+  return real_equal (&r, &dconst1);
 }
 
 /* Return the TLS type for TLS symbols.  */
index 7e0a2c276290fc7ecc2764a97ac1af9dec21bc4b..2ad0e0adce8a3f0233998427f1c9b46812b1cad9 100644 (file)
@@ -661,11 +661,11 @@ vax_float_literal (rtx c)
       bool ok;
       real_from_integer (&s, mode, x, SIGNED);
 
-      if (REAL_VALUES_EQUAL (r, s))
+      if (real_equal (&r, &s))
        return true;
       ok = exact_real_inverse (mode, &s);
       gcc_assert (ok);
-      if (REAL_VALUES_EQUAL (r, s))
+      if (real_equal (&r, &s))
        return true;
     }
   return false;
index d7dfa1107f8ddfa179f3a077f343a058736d141d..e297b82de2001d60c0fb9f5ece69a67622dd81b1 100644 (file)
 {
   REAL_VALUE_TYPE d;
   REAL_VALUE_FROM_CONST_DOUBLE (d, op);
-  return REAL_VALUES_EQUAL (d, dconst1);
+  return real_equal (&d, &dconst1);
 })
 
 (define_predicate "fpmem_offset_operand"
index bc169b82bd0626b09cd22ee476b797f5fa210dbc..d4fd5146eed48294a1d063bd44137b64714722a7 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-05  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * tree.c (cp_tree_equal): Use real_equal instead of
+       REAL_VALUES_EQUAL.
+
 2015-10-04  Jason Merrill  <jason@redhat.com>
 
        Implement N4514, C++ Extensions for Transactional Memory.
index 987ebe8e2aaadf74c3cccdf7d83ee87bad5d9915..b9b801f311cf0e327d655f18c3bad106ed16c8a4 100644 (file)
@@ -2852,7 +2852,7 @@ cp_tree_equal (tree t1, tree t2)
       return tree_int_cst_equal (t1, t2);
 
     case REAL_CST:
-      return REAL_VALUES_EQUAL (TREE_REAL_CST (t1), TREE_REAL_CST (t2));
+      return real_equal (&TREE_REAL_CST (t1), &TREE_REAL_CST (t2));
 
     case STRING_CST:
       return TREE_STRING_LENGTH (t1) == TREE_STRING_LENGTH (t2)
index 28e9e54e93b0a777eba12d04ad5cf6ebb1868b20..aa23a07513f5843be209e464e5b3200c64c94d81 100644 (file)
@@ -1355,7 +1355,7 @@ implicit_set_cond_p (const_rtx cond)
        {
          REAL_VALUE_TYPE d;
          REAL_VALUE_FROM_CONST_DOUBLE (d, cst);
-         if (REAL_VALUES_EQUAL (d, dconst0))
+         if (real_equal (&d, &dconst0))
            return 0;
        }
       else
index 610d6c1c7b5ee8fa7706b50ce54e7aee429194a4..fdd49d9b427dac574a4b22e8fed5e280dd11066a 100644 (file)
@@ -9708,13 +9708,6 @@ array of @code{HOST_WIDE_INT}, but all code should treat it as an opaque
 quantity.
 @end defmac
 
-@deftypefn Macro int REAL_VALUES_EQUAL (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})
-Compares for equality the two values, @var{x} and @var{y}.  If the target
-floating point format supports negative zeroes and/or NaNs,
-@samp{REAL_VALUES_EQUAL (-0.0, 0.0)} is true, and
-@samp{REAL_VALUES_EQUAL (NaN, NaN)} is false.
-@end deftypefn
-
 @deftypefn Macro int REAL_VALUES_LESS (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})
 Tests whether @var{x} is less than @var{y}.
 @end deftypefn
index 2ee0294c25d3e747fc78718a1c855f84f8d392bc..ab75ad974d5f5a583f6ad9a63050b69ef7d728d0 100644 (file)
@@ -7131,13 +7131,6 @@ array of @code{HOST_WIDE_INT}, but all code should treat it as an opaque
 quantity.
 @end defmac
 
-@deftypefn Macro int REAL_VALUES_EQUAL (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})
-Compares for equality the two values, @var{x} and @var{y}.  If the target
-floating point format supports negative zeroes and/or NaNs,
-@samp{REAL_VALUES_EQUAL (-0.0, 0.0)} is true, and
-@samp{REAL_VALUES_EQUAL (NaN, NaN)} is false.
-@end deftypefn
-
 @deftypefn Macro int REAL_VALUES_LESS (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})
 Tests whether @var{x} is less than @var{y}.
 @end deftypefn
index 604a957a07ba5e5b810598e0e15a36944889daf1..07578e7c7564237ba923262de72885b1b154f3d1 100644 (file)
@@ -3239,7 +3239,7 @@ expand_mult (machine_mode mode, rtx op0, rtx op1, rtx target,
       REAL_VALUE_TYPE d;
       REAL_VALUE_FROM_CONST_DOUBLE (d, scalar_op1);
 
-      if (REAL_VALUES_EQUAL (d, dconst2))
+      if (real_equal (&d, &dconst2))
        {
          op0 = force_reg (GET_MODE (op0), op0);
          return expand_binop (mode, add_optab, op0, op0,
index 7231fd65d50fac7e9efbd6c1969cb06f77d785cd..768b39b0469435cac669b0fa252ecfef78f17991 100644 (file)
@@ -1176,7 +1176,7 @@ const_binop (enum tree_code code, tree arg1, tree arg2)
       /* Don't perform operation if it would raise a division
         by zero exception.  */
       if (code == RDIV_EXPR
-         && REAL_VALUES_EQUAL (d2, dconst0)
+         && real_equal (&d2, &dconst0)
          && (flag_trapping_math || ! MODE_HAS_INFINITIES (mode)))
        return NULL_TREE;
 
index c1ff78d903f138e027cba19100f43118bca86c88..d47f32ad78bc7dd8050f01349c9f3f95b0532747 100644 (file)
@@ -1078,6 +1078,14 @@ real_value_abs (const REAL_VALUE_TYPE *op0)
   return r;
 }
 
+/* Return whether OP0 == OP1.  */
+
+bool
+real_equal (const REAL_VALUE_TYPE *op0, const REAL_VALUE_TYPE *op1)
+{
+  return do_compare (op0, op1, -1) == 0;
+}
+
 bool
 real_compare (int icode, const REAL_VALUE_TYPE *op0,
              const REAL_VALUE_TYPE *op1)
@@ -1095,7 +1103,7 @@ real_compare (int icode, const REAL_VALUE_TYPE *op0,
     case GE_EXPR:
       return do_compare (op0, op1, -1) >= 0;
     case EQ_EXPR:
-      return do_compare (op0, op1, -1) == 0;
+      return real_equal (op0, op1);
     case NE_EXPR:
       return do_compare (op0, op1, -1) != 0;
     case UNORDERED_EXPR:
index bd2a864b59b2e9a54c6a345dc5ccf73ba11db6a8..0f20660eb91aa3d474e05ec6a3f919595161f6ad 100644 (file)
@@ -247,8 +247,9 @@ extern bool real_isneg (const REAL_VALUE_TYPE *);
 /* Determine whether a floating-point value X is minus zero.  */
 extern bool real_isnegzero (const REAL_VALUE_TYPE *);
 
-/* Compare two floating-point objects for bitwise identity.  */
+/* Test relationships between reals.  */
 extern bool real_identical (const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *);
+extern bool real_equal (const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *);
 
 /* Extend or truncate to a new mode.  */
 extern void real_convert (REAL_VALUE_TYPE *, machine_mode,
@@ -333,7 +334,6 @@ extern const struct real_format arm_half_format;
   real_arithmetic (&(value), code, &(d1), &(d2))
 
 #define REAL_VALUES_IDENTICAL(x, y)    real_identical (&(x), &(y))
-#define REAL_VALUES_EQUAL(x, y)                real_compare (EQ_EXPR, &(x), &(y))
 #define REAL_VALUES_LESS(x, y)         real_compare (LT_EXPR, &(x), &(y))
 
 /* Determine whether a floating-point value X is infinite.  */
index 8d86e57bf79f3c48167e60e5d763dec6b4e8b9d3..b4d95a22a61eeb8d947e89b2e711ec369bba98c2 100644 (file)
@@ -2472,11 +2472,11 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
          REAL_VALUE_TYPE d;
          REAL_VALUE_FROM_CONST_DOUBLE (d, trueop1);
 
-         if (REAL_VALUES_EQUAL (d, dconst2))
+         if (real_equal (&d, &dconst2))
            return simplify_gen_binary (PLUS, mode, op0, copy_rtx (op0));
 
          if (!HONOR_SNANS (mode)
-             && REAL_VALUES_EQUAL (d, dconstm1))
+             && real_equal (&d, &dconstm1))
            return simplify_gen_unary (NEG, mode, op0, mode);
        }
 
@@ -3102,14 +3102,14 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
              REAL_VALUE_FROM_CONST_DOUBLE (d, trueop1);
 
              /* x/-1.0 is -x.  */
-             if (REAL_VALUES_EQUAL (d, dconstm1)
+             if (real_equal (&d, &dconstm1)
                  && !HONOR_SNANS (mode))
                return simplify_gen_unary (NEG, mode, op0, mode);
 
              /* Change FP division by a constant into multiplication.
                 Only do this with -freciprocal-math.  */
              if (flag_reciprocal_math
-                 && !REAL_VALUES_EQUAL (d, dconst0))
+                 && !real_equal (&d, &dconst0))
                {
                  REAL_ARITHMETIC (d, RDIV_EXPR, dconst1, d);
                  tem = CONST_DOUBLE_FROM_REAL_VALUE (d, mode);
@@ -3872,7 +3872,7 @@ simplify_const_binary_operation (enum rtx_code code, machine_mode mode,
            return 0;
 
          if (code == DIV
-             && REAL_VALUES_EQUAL (f1, dconst0)
+             && real_equal (&f1, &dconst0)
              && (flag_trapping_math || ! MODE_HAS_INFINITIES (mode)))
            return 0;
 
@@ -3905,9 +3905,9 @@ simplify_const_binary_operation (enum rtx_code code, machine_mode mode,
 
          if (code == MULT && MODE_HAS_INFINITIES (mode) && HONOR_NANS (mode)
              && flag_trapping_math
-             && ((REAL_VALUE_ISINF (f0) && REAL_VALUES_EQUAL (f1, dconst0))
+             && ((REAL_VALUE_ISINF (f0) && real_equal (&f1, &dconst0))
                  || (REAL_VALUE_ISINF (f1)
-                     && REAL_VALUES_EQUAL (f0, dconst0))))
+                     && real_equal (&f0, &dconst0))))
            /* Inf * 0 = NaN plus exception.  */
            return 0;
 
@@ -4942,7 +4942,7 @@ simplify_const_relational_operation (enum rtx_code code,
          }
 
       return comparison_result (code,
-                               (REAL_VALUES_EQUAL (d0, d1) ? CMP_EQ :
+                               (real_equal (&d0, &d1) ? CMP_EQ :
                                 REAL_VALUES_LESS (d0, d1) ? CMP_LT : CMP_GT));
     }
 
index e872eda018937284784fdd226e4cfbd01d804b88..7a0275ad1c6bbac03aecd4f8a281a28c574afcf0 100644 (file)
@@ -199,7 +199,7 @@ check_pow (gcall *pow_call)
       /* Only handle a fixed range of constant.  */
       REAL_VALUE_TYPE mv;
       REAL_VALUE_TYPE bcv = TREE_REAL_CST (base);
-      if (REAL_VALUES_EQUAL (bcv, dconst1))
+      if (real_equal (&bcv, &dconst1))
         return false;
       if (REAL_VALUES_LESS (bcv, dconst1))
         return false;
@@ -420,7 +420,7 @@ gen_conditions_for_pow_cst_base (tree base, tree expn,
      sure it is consistent with check_pow.  */
   REAL_VALUE_TYPE mv;
   REAL_VALUE_TYPE bcv = TREE_REAL_CST (base);
-  gcc_assert (!REAL_VALUES_EQUAL (bcv, dconst1)
+  gcc_assert (!real_equal (&bcv, &dconst1)
               && !REAL_VALUES_LESS (bcv, dconst1));
   real_from_integer (&mv, TYPE_MODE (TREE_TYPE (base)), 256, UNSIGNED);
   gcc_assert (!REAL_VALUES_LESS (mv, bcv));
index ac9586ecdbf198f42e68e1801c6733de661614f2..9b525f388fc209a5be0de8db79b20fc552802488 100644 (file)
@@ -4092,8 +4092,9 @@ estimate_num_insns (gimple *stmt, eni_weights *weights)
                    case BUILT_IN_POWF:
                    case BUILT_IN_POWL:
                      if (TREE_CODE (gimple_call_arg (stmt, 1)) == REAL_CST
-                         && REAL_VALUES_EQUAL
-                         (TREE_REAL_CST (gimple_call_arg (stmt, 1)), dconst2))
+                         && (real_equal
+                             (&TREE_REAL_CST (gimple_call_arg (stmt, 1)),
+                              &dconst2)))
                        return estimate_operator_cost
                            (MULT_EXPR, weights, gimple_call_arg (stmt, 0),
                             gimple_call_arg (stmt, 0));
index d9408165157a5c35d1d244b51c4576bcc7cf29ff..c226da55340a7ac99b39dd66f17fb66fc7ea7366 100644 (file)
@@ -1158,7 +1158,7 @@ record_equality (tree x, tree y, class const_and_copies *const_and_copies)
      nonzero.  */
   if (HONOR_SIGNED_ZEROS (x)
       && (TREE_CODE (y) != REAL_CST
-         || REAL_VALUES_EQUAL (dconst0, TREE_REAL_CST (y))))
+         || real_equal (&dconst0, &TREE_REAL_CST (y))))
     return;
 
   const_and_copies->record_const_or_copy (x, y, prev_x);
index 97477391e0f47fc1f700bfc0eb10cc4c90cdd6af..63245fcbb0f4e7e67cce779bb0b6dae833136cc0 100644 (file)
@@ -1145,7 +1145,7 @@ representable_as_half_series_p (REAL_VALUE_TYPE c, unsigned n,
 
       /* We have hit zero.  The number is representable as a sum
          of powers of 0.5.  */
-      if (REAL_VALUES_EQUAL (res, dconst0))
+      if (real_equal (&res, &dconst0))
        {
          info->factors[i] = true;
          info->deepest = i + 1;
@@ -1509,7 +1509,7 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
      unless signed zeros must be maintained.  pow(-0,0.5) = +0, while
      sqrt(-0) = -0.  */
   if (sqrtfn
-      && REAL_VALUES_EQUAL (c, dconsthalf)
+      && real_equal (&c, &dconsthalf)
       && !HONOR_SIGNED_ZEROS (mode))
     return build_and_insert_call (gsi, loc, sqrtfn, arg0);
 
@@ -1527,7 +1527,7 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
   if (flag_unsafe_math_optimizations
       && cbrtfn
       && (gimple_val_nonnegative_real_p (arg0) || !HONOR_NANS (mode))
-      && REAL_VALUES_EQUAL (c, dconst1_3))
+      && real_equal (&c, &dconst1_3))
     return build_and_insert_call (gsi, loc, cbrtfn, arg0);
   
   /* Optimize pow(x,1./6.) = cbrt(sqrt(x)).  Don't do this optimization
@@ -1541,7 +1541,7 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
       && (gimple_val_nonnegative_real_p (arg0) || !HONOR_NANS (mode))
       && speed_p
       && hw_sqrt_exists
-      && REAL_VALUES_EQUAL (c, dconst1_6))
+      && real_equal (&c, &dconst1_6))
     {
       /* sqrt(x)  */
       sqrt_arg0 = build_and_insert_call (gsi, loc, sqrtfn, arg0);
@@ -1556,7 +1556,7 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
   if (flag_unsafe_math_optimizations
       && sqrtfn
       && hw_sqrt_exists
-      && (speed_p || REAL_VALUES_EQUAL (c, dconst1_4))
+      && (speed_p || real_equal (&c, &dconst1_4))
       && !HONOR_SIGNED_ZEROS (mode))
     {
       unsigned int max_depth = speed_p
@@ -3589,9 +3589,9 @@ pass_optimize_widening_mul::execute (function *fun)
                      case BUILT_IN_POW:
                      case BUILT_IN_POWL:
                        if (TREE_CODE (gimple_call_arg (stmt, 1)) == REAL_CST
-                           && REAL_VALUES_EQUAL
-                                (TREE_REAL_CST (gimple_call_arg (stmt, 1)),
-                                 dconst2)
+                           && real_equal
+                                (&TREE_REAL_CST (gimple_call_arg (stmt, 1)),
+                                 &dconst2)
                            && convert_mult_to_fma (stmt,
                                                    gimple_call_arg (stmt, 0),
                                                    gimple_call_arg (stmt, 0)))
index d045341ebc36a662f9a881eb7107b942dcbf4636..0f16c508c946813bf80fe511f378d74266a424f8 100644 (file)
@@ -153,7 +153,7 @@ associate_equivalences_with_edges (void)
                     this value unless we know that the value is nonzero.  */
                  if (HONOR_SIGNED_ZEROS (op0)
                      && (TREE_CODE (op1) != REAL_CST
-                         || REAL_VALUES_EQUAL (dconst0, TREE_REAL_CST (op1))))
+                         || real_equal (&dconst0, &TREE_REAL_CST (op1))))
                    continue;
 
                  equivalency = XNEW (struct edge_equivalency);
index 830801a0224c31c346c0392779104d706b1cae9d..48b5298645bb38076ee99685d02184413ba86b97 100644 (file)
@@ -1084,7 +1084,7 @@ vect_recog_pow_pattern (vec<gimple *> *stmts, tree *type_in,
   if ((tree_fits_shwi_p (exp)
        && tree_to_shwi (exp) == 2)
       || (TREE_CODE (exp) == REAL_CST
-          && REAL_VALUES_EQUAL (TREE_REAL_CST (exp), dconst2)))
+          && real_equal (&TREE_REAL_CST (exp), &dconst2)))
     {
       *type_in = TREE_TYPE (base);
 
@@ -1095,7 +1095,7 @@ vect_recog_pow_pattern (vec<gimple *> *stmts, tree *type_in,
 
   /* Catch square root.  */
   if (TREE_CODE (exp) == REAL_CST
-      && REAL_VALUES_EQUAL (TREE_REAL_CST (exp), dconsthalf))
+      && real_equal (&TREE_REAL_CST (exp), &dconsthalf))
     {
       tree newfn = mathfn_built_in (TREE_TYPE (base), BUILT_IN_SQRT);
       *type_in = get_vectype_for_scalar_type (TREE_TYPE (base));
index af318495f0f1f091d45c06dfef218dfbd98343f8..4bd3cae9ebf311766f868a85b1ebba1b20462968 100644 (file)
@@ -2546,7 +2546,7 @@ real_zerop (const_tree expr)
   switch (TREE_CODE (expr))
     {
     case REAL_CST:
-      return REAL_VALUES_EQUAL (TREE_REAL_CST (expr), dconst0)
+      return real_equal (&TREE_REAL_CST (expr), &dconst0)
             && !(DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (expr))));
     case COMPLEX_CST:
       return real_zerop (TREE_REALPART (expr))
@@ -2576,7 +2576,7 @@ real_onep (const_tree expr)
   switch (TREE_CODE (expr))
     {
     case REAL_CST:
-      return REAL_VALUES_EQUAL (TREE_REAL_CST (expr), dconst1)
+      return real_equal (&TREE_REAL_CST (expr), &dconst1)
             && !(DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (expr))));
     case COMPLEX_CST:
       return real_onep (TREE_REALPART (expr))
@@ -2605,7 +2605,7 @@ real_minus_onep (const_tree expr)
   switch (TREE_CODE (expr))
     {
     case REAL_CST:
-      return REAL_VALUES_EQUAL (TREE_REAL_CST (expr), dconstm1)
+      return real_equal (&TREE_REAL_CST (expr), &dconstm1)
             && !(DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (expr))));
     case COMPLEX_CST:
       return real_minus_onep (TREE_REALPART (expr))