Remove remaining uses of REAL_ARITHMETIC

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.

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.

From-SVN: r228476
This commit is contained in:
Richard Sandiford 2015-10-05 11:35:07 +00:00 committed by Richard Sandiford
parent 8cb41028fe
commit 5c88ea9456
14 changed files with 40 additions and 60 deletions

View File

@ -1,3 +1,21 @@
2015-10-05 Richard Sandiford <richard.sandiford@arm.com>
* 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.
2015-10-05 Richard Sandiford <richard.sandiford@arm.com>
* doc/tm.texi.in (REAL_VALUES_LESS): Delete.

View File

@ -1,3 +1,8 @@
2015-10-05 Richard Sandiford <richard.sandiford@arm.com>
* gcc-interface/trans.c (convert_with_check): Use real_arithmetic
instead of REAL_ARITHMETIC.
2015-10-05 Richard Sandiford <richard.sandiford@arm.com>
* gcc-interface/trans.c (convert_with_check): Use real_less instead

View File

@ -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

View File

@ -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) */

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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. */

View File

@ -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))

View File

@ -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))

View File

@ -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);

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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))