This patch replaces all remaining uses of the old target macro
REAL_ARITHMETIC with calls to the (now generic) real_arithmetic
function.

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.  OK to install?

Thanks,
Richard


gcc/ada/
        * gcc-interface/trans.c (convert_with_check): Use real_arithmetic
        instead of REAL_ARITHMETIC.

gcc/
        * doc/tm.texi.in (REAL_ARITHMETIC): Delete.
        * doc/tm.texi: Regenerate.
        * real.h (REAL_ARITHMETIC): Delete.
        * config/i386/i386.c (ix86_expand_lround, ix86_expand_round)
        (ix86_expand_round_sse4): Use real_arithmetic instead of
        REAL_ARITHMETIC.
        * config/i386/sse.md (round<mode>2): Likewise.
        * rtl.h (rtx_to_tree_code): Likewise (in comment).
        * explow.c (rtx_to_tree_code): Likewise (in comment).
        * match.pd: Likewise.
        * simplify-rtx.c (simplify_binary_operation_1): Likewise.
        * tree-ssa-math-opts.c (representable_as_half_series_p): Likewise.
        (expand_pow_as_sqrts): Likewise.
        * tree-pretty-print.c (dump_generic_node): Remove code that
        was conditional on REAL_ARITHMETIC being undefined.

diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 9838da0..f1e2dcb 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -9048,8 +9048,8 @@ convert_with_check (Entity_Id gnat_type, tree gnu_expr, 
bool overflowp,
       /* Compute the exact value calc_type'Pred (0.5) at compile time.  */
       fmt = REAL_MODE_FORMAT (TYPE_MODE (calc_type));
       real_2expN (&half_minus_pred_half, -(fmt->p) - 1, TYPE_MODE (calc_type));
-      REAL_ARITHMETIC (pred_half, MINUS_EXPR, dconsthalf,
-                      half_minus_pred_half);
+      real_arithmetic (&pred_half, MINUS_EXPR, &dconsthalf,
+                      &half_minus_pred_half);
       gnu_pred_half = build_real (calc_type, pred_half);
 
       /* If the input is strictly negative, subtract this value
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 9c4cfbd..44847b4 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -47538,7 +47538,7 @@ ix86_expand_lround (rtx op0, rtx op1)
   /* load nextafter (0.5, 0.0) */
   fmt = REAL_MODE_FORMAT (mode);
   real_2expN (&half_minus_pred_half, -(fmt->p) - 1, mode);
-  REAL_ARITHMETIC (pred_half, MINUS_EXPR, dconsthalf, half_minus_pred_half);
+  real_arithmetic (&pred_half, MINUS_EXPR, &dconsthalf, &half_minus_pred_half);
 
   /* adj = copysign (0.5, op1) */
   adj = force_reg (mode, const_double_from_real_value (pred_half, mode));
@@ -47952,7 +47952,7 @@ ix86_expand_round (rtx operand0, rtx operand1)
   /* load nextafter (0.5, 0.0) */
   fmt = REAL_MODE_FORMAT (mode);
   real_2expN (&half_minus_pred_half, -(fmt->p) - 1, mode);
-  REAL_ARITHMETIC (pred_half, MINUS_EXPR, dconsthalf, half_minus_pred_half);
+  real_arithmetic (&pred_half, MINUS_EXPR, &dconsthalf, &half_minus_pred_half);
 
   /* xa = xa + 0.5 */
   half = force_reg (mode, const_double_from_real_value (pred_half, mode));
@@ -48003,7 +48003,7 @@ ix86_expand_round_sse4 (rtx op0, rtx op1)
   /* load nextafter (0.5, 0.0) */
   fmt = REAL_MODE_FORMAT (mode);
   real_2expN (&half_minus_pred_half, -(fmt->p) - 1, mode);
-  REAL_ARITHMETIC (pred_half, MINUS_EXPR, dconsthalf, half_minus_pred_half);
+  real_arithmetic (&pred_half, MINUS_EXPR, &dconsthalf, &half_minus_pred_half);
   half = const_double_from_real_value (pred_half, mode);
 
   /* e1 = copysign (0.5, op1) */
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 013681c..9b7a338 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -14881,7 +14881,7 @@
   /* load nextafter (0.5, 0.0) */
   fmt = REAL_MODE_FORMAT (scalar_mode);
   real_2expN (&half_minus_pred_half, -(fmt->p) - 1, scalar_mode);
-  REAL_ARITHMETIC (pred_half, MINUS_EXPR, dconsthalf, half_minus_pred_half);
+  real_arithmetic (&pred_half, MINUS_EXPR, &dconsthalf, &half_minus_pred_half);
   half = const_double_from_real_value (pred_half, scalar_mode);
 
   vec_half = ix86_build_const_vector (<MODE>mode, true, half);
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index f6a0b5d..72366b9 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -9736,21 +9736,6 @@ Determines whether @var{x} represents infinity (positive 
or negative).
 Determines whether @var{x} represents a ``NaN'' (not-a-number).
 @end deftypefn
 
-@deftypefn Macro void REAL_ARITHMETIC (REAL_VALUE_TYPE @var{output}, enum 
tree_code @var{code}, REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})
-Calculates an arithmetic operation on the two floating point values
-@var{x} and @var{y}, storing the result in @var{output} (which must be a
-variable).
-
-The operation to be performed is specified by @var{code}.  Only the
-following codes are supported: @code{PLUS_EXPR}, @code{MINUS_EXPR},
-@code{MULT_EXPR}, @code{RDIV_EXPR}, @code{MAX_EXPR}, @code{MIN_EXPR}.
-
-If @code{REAL_ARITHMETIC} is asked to evaluate division by zero and the
-target's floating point format cannot represent infinity, it will call
-@code{abort}.  Callers should check for this situation first, using
-@code{MODE_HAS_INFINITIES}.  @xref{Storage Layout}.
-@end deftypefn
-
 @deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_NEGATE (REAL_VALUE_TYPE @var{x})
 Returns the negative of the floating point value @var{x}.
 @end deftypefn
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 7fae1ca..d8d0087 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -7159,21 +7159,6 @@ Determines whether @var{x} represents infinity (positive 
or negative).
 Determines whether @var{x} represents a ``NaN'' (not-a-number).
 @end deftypefn
 
-@deftypefn Macro void REAL_ARITHMETIC (REAL_VALUE_TYPE @var{output}, enum 
tree_code @var{code}, REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})
-Calculates an arithmetic operation on the two floating point values
-@var{x} and @var{y}, storing the result in @var{output} (which must be a
-variable).
-
-The operation to be performed is specified by @var{code}.  Only the
-following codes are supported: @code{PLUS_EXPR}, @code{MINUS_EXPR},
-@code{MULT_EXPR}, @code{RDIV_EXPR}, @code{MAX_EXPR}, @code{MIN_EXPR}.
-
-If @code{REAL_ARITHMETIC} is asked to evaluate division by zero and the
-target's floating point format cannot represent infinity, it will call
-@code{abort}.  Callers should check for this situation first, using
-@code{MODE_HAS_INFINITIES}.  @xref{Storage Layout}.
-@end deftypefn
-
 @deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_NEGATE (REAL_VALUE_TYPE @var{x})
 Returns the negative of the floating point value @var{x}.
 @end deftypefn
diff --git a/gcc/explow.c b/gcc/explow.c
index d104a79..807c926 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -1900,7 +1900,7 @@ hard_libcall_value (machine_mode mode, rtx fun)
 }
 
 /* Look up the tree code for a given rtx code
-   to provide the arithmetic operation for REAL_ARITHMETIC.
+   to provide the arithmetic operation for real_arithmetic.
    The function returns an int because the caller may not know
    what `enum tree_code' means.  */
 
diff --git a/gcc/match.pd b/gcc/match.pd
index d7f4e91..9962b0a 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -1699,8 +1699,8 @@ along with GCC; see the file COPYING3.  If not see
       (with
        {
          REAL_VALUE_TYPE c2;
-        REAL_ARITHMETIC (c2, MULT_EXPR,
-                         TREE_REAL_CST (@1), TREE_REAL_CST (@1));
+        real_arithmetic (&c2, MULT_EXPR,
+                         &TREE_REAL_CST (@1), &TREE_REAL_CST (@1));
         real_convert (&c2, TYPE_MODE (TREE_TYPE (@0)), &c2);
        }
        (if (REAL_VALUE_ISINF (c2))
@@ -1714,8 +1714,8 @@ along with GCC; see the file COPYING3.  If not see
       (with
        {
                 REAL_VALUE_TYPE c2;
-        REAL_ARITHMETIC (c2, MULT_EXPR,
-                         TREE_REAL_CST (@1), TREE_REAL_CST (@1));
+        real_arithmetic (&c2, MULT_EXPR,
+                         &TREE_REAL_CST (@1), &TREE_REAL_CST (@1));
         real_convert (&c2, TYPE_MODE (TREE_TYPE (@0)), &c2);
        }
        (if (REAL_VALUE_ISINF (c2))
diff --git a/gcc/real.h b/gcc/real.h
index dc55ab2..0ce3270 100644
--- a/gcc/real.h
+++ b/gcc/real.h
@@ -331,9 +331,6 @@ extern const struct real_format arm_half_format;
 /* ====================================================================== */
 /* Crap.  */
 
-#define REAL_ARITHMETIC(value, code, d1, d2) \
-  real_arithmetic (&(value), code, &(d1), &(d2))
-
 /* Determine whether a floating-point value X is infinite.  */
 #define REAL_VALUE_ISINF(x)            real_isinf (&(x))
 
diff --git a/gcc/rtl.h b/gcc/rtl.h
index ac56133..a592a1e 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3452,7 +3452,7 @@ extern int regstack_completed;
 extern int cse_not_expected;
 
 /* Translates rtx code to tree code, for those codes needed by
-   REAL_ARITHMETIC.  The function returns an int because the caller may not
+   real_arithmetic.  The function returns an int because the caller may not
    know what `enum tree_code' means.  */
 
 extern int rtx_to_tree_code (enum rtx_code);
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 9f791a7..96eaae7 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -3111,7 +3111,7 @@ simplify_binary_operation_1 (enum rtx_code code, 
machine_mode mode,
              if (flag_reciprocal_math
                  && !real_equal (&d, &dconst0))
                {
-                 REAL_ARITHMETIC (d, RDIV_EXPR, dconst1, d);
+                 real_arithmetic (&d, RDIV_EXPR, &dconst1, &d);
                  tem = CONST_DOUBLE_FROM_REAL_VALUE (d, mode);
                  return simplify_gen_binary (MULT, mode, op0, tem);
                }
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 7cd1fe7..ce3f6a8 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -1428,7 +1428,6 @@ dump_generic_node (pretty_printer *pp, tree node, int 
spc, int flags,
        if (TREE_OVERFLOW (node))
          pp_string (pp, " overflow");
 
-#if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
        d = TREE_REAL_CST (node);
        if (REAL_VALUE_ISINF (d))
          pp_string (pp, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf");
@@ -1440,15 +1439,6 @@ dump_generic_node (pretty_printer *pp, tree node, int 
spc, int flags,
            real_to_decimal (string, &d, sizeof (string), 0, 1);
            pp_string (pp, string);
          }
-#else
-       {
-         HOST_WIDE_INT i;
-         unsigned char *p = (unsigned char *) &TREE_REAL_CST (node);
-         pp_string (pp, "0x");
-         for (i = 0; i < sizeof TREE_REAL_CST (node); i++)
-           output_formatted_integer (pp, "%02x", *p++);
-       }
-#endif
        break;
       }
 
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 63245fc..39c027c 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -1140,7 +1140,7 @@ representable_as_half_series_p (REAL_VALUE_TYPE c, 
unsigned n,
       REAL_VALUE_TYPE res;
 
       /* If something inexact happened bail out now.  */
-      if (REAL_ARITHMETIC (res, MINUS_EXPR, remainder, factor))
+      if (real_arithmetic (&res, MINUS_EXPR, &remainder, &factor))
        return false;
 
       /* We have hit zero.  The number is representable as a sum
@@ -1160,7 +1160,7 @@ representable_as_half_series_p (REAL_VALUE_TYPE c, 
unsigned n,
       else
        info->factors[i] = false;
 
-      REAL_ARITHMETIC (factor, MULT_EXPR, factor, dconsthalf);
+      real_arithmetic (&factor, MULT_EXPR, &factor, &dconsthalf);
     }
   return false;
 }
@@ -1317,7 +1317,7 @@ expand_pow_as_sqrts (gimple_stmt_iterator *gsi, 
location_t loc,
   REAL_VALUE_TYPE frac_part;
 
   real_floor (&whole_part, mode, &exp);
-  REAL_ARITHMETIC (frac_part, MINUS_EXPR, exp, whole_part);
+  real_arithmetic (&frac_part, MINUS_EXPR, &exp, &whole_part);
 
 
   REAL_VALUE_TYPE ceil_whole = dconst0;
@@ -1326,7 +1326,7 @@ expand_pow_as_sqrts (gimple_stmt_iterator *gsi, 
location_t loc,
   if (neg_exp)
     {
       real_ceil (&ceil_whole, mode, &exp);
-      REAL_ARITHMETIC (ceil_fract, MINUS_EXPR, ceil_whole, exp);
+      real_arithmetic (&ceil_fract, MINUS_EXPR, &ceil_whole, &exp);
     }
 
   if (!representable_as_half_series_p (frac_part, max_depth, &synth_info))

Reply via email to