From: Richard Sandiford Date: Mon, 5 Oct 2015 11:32:25 +0000 (+0000) Subject: Replace REAL_VALUES_LESS with real_less X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8cb41028fe43dfc2a9c8c2a49deefb769fc1f5e4;p=gcc.git Replace REAL_VALUES_LESS with real_less This patch continues the removal of real-related macros by replacing REAL_VALUES_LESS with real_less. 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_less instead of REAL_VALUES_LESS. gcc/ * doc/tm.texi.in (REAL_VALUES_LESS): Delete. * doc/tm.texi: Regenerate. * real.h (real_less): Declare. (REAL_VALUES_LESS): Delete. * real.c (real_less): New function. (real_compare): Use it. * config/m68k/m68k.c (floating_exact_log2): Use real_less instead of REAL_VALUES_LESS. * config/microblaze/microblaze.c (microblaze_const_double_ok): Likewise. * fold-const.c (fold_convert_const_int_from_real): Likewise. * simplify-rtx.c (simplify_const_unary_operation): Likewise. (simplify_const_relational_operation): Likewise. * tree-call-cdce.c (check_pow): Likewise. (gen_conditions_for_pow_cst_base): Likewise. From-SVN: r228475 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6493e383632..0909386c6c1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2015-10-05 Richard Sandiford + + * doc/tm.texi.in (REAL_VALUES_LESS): Delete. + * doc/tm.texi: Regenerate. + * real.h (real_less): Declare. + (REAL_VALUES_LESS): Delete. + * real.c (real_less): New function. + (real_compare): Use it. + * config/m68k/m68k.c (floating_exact_log2): Use real_less instead + of REAL_VALUES_LESS. + * config/microblaze/microblaze.c (microblaze_const_double_ok): + Likewise. + * fold-const.c (fold_convert_const_int_from_real): Likewise. + * simplify-rtx.c (simplify_const_unary_operation): Likewise. + (simplify_const_relational_operation): Likewise. + * tree-call-cdce.c (check_pow): Likewise. + (gen_conditions_for_pow_cst_base): Likewise. + 2015-10-05 Richard Sandiford * real.h (REAL_VALUES_IDENTICAL): Delete. diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6703686c8e4..54c2f5c7d88 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2015-10-05 Richard Sandiford + + * gcc-interface/trans.c (convert_with_check): Use real_less instead + of REAL_VALUES_LESS. + 2015-10-02 Doug Rupp Olivier Hainque diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 3252ea2732e..9838da01189 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -8999,8 +8999,8 @@ convert_with_check (Entity_Id gnat_type, tree gnu_expr, bool overflowp, if (INTEGRAL_TYPE_P (gnu_in_basetype) ? tree_int_cst_lt (gnu_in_lb, gnu_out_lb) : (FLOAT_TYPE_P (gnu_base_type) - ? REAL_VALUES_LESS (TREE_REAL_CST (gnu_in_lb), - TREE_REAL_CST (gnu_out_lb)) + ? real_less (&TREE_REAL_CST (gnu_in_lb), + &TREE_REAL_CST (gnu_out_lb)) : 1)) gnu_cond = invert_truthvalue @@ -9011,8 +9011,8 @@ convert_with_check (Entity_Id gnat_type, tree gnu_expr, bool overflowp, if (INTEGRAL_TYPE_P (gnu_in_basetype) ? tree_int_cst_lt (gnu_out_ub, gnu_in_ub) : (FLOAT_TYPE_P (gnu_base_type) - ? REAL_VALUES_LESS (TREE_REAL_CST (gnu_out_ub), - TREE_REAL_CST (gnu_in_lb)) + ? real_less (&TREE_REAL_CST (gnu_out_ub), + &TREE_REAL_CST (gnu_in_lb)) : 1)) gnu_cond = build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, gnu_cond, diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index 487cbf4b573..74de9835f15 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -4365,7 +4365,7 @@ floating_exact_log2 (rtx x) REAL_VALUE_FROM_CONST_DOUBLE (r, x); - if (REAL_VALUES_LESS (r, dconst1)) + if (real_less (&r, &dconst1)) return 0; exp = real_exponent (&r); diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c index ebcf65a371d..9efa7397203 100644 --- a/gcc/config/microblaze/microblaze.c +++ b/gcc/config/microblaze/microblaze.c @@ -280,12 +280,12 @@ microblaze_const_double_ok (rtx op, machine_mode mode) if (mode == DFmode) { - if (REAL_VALUES_LESS (d, dfhigh) && REAL_VALUES_LESS (dflow, d)) + if (real_less (&d, &dfhigh) && real_less (&dflow, &d)) return 1; } else { - if (REAL_VALUES_LESS (d, sfhigh) && REAL_VALUES_LESS (sflow, d)) + if (real_less (&d, &sfhigh) && real_less (&sflow, &d)) return 1; } diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index fdd49d9b427..f6a0b5dd968 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -9708,10 +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_LESS (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y}) -Tests whether @var{x} is less than @var{y}. -@end deftypefn - @deftypefn Macro HOST_WIDE_INT REAL_VALUE_FIX (REAL_VALUE_TYPE @var{x}) Truncates @var{x} to a signed integer, rounding toward zero. @end deftypefn diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index ab75ad974d5..7fae1ca66e4 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -7131,10 +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_LESS (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y}) -Tests whether @var{x} is less than @var{y}. -@end deftypefn - @deftypefn Macro HOST_WIDE_INT REAL_VALUE_FIX (REAL_VALUE_TYPE @var{x}) Truncates @var{x} to a signed integer, rounding toward zero. @end deftypefn diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 1c72af639e8..2851a291b99 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1877,7 +1877,7 @@ fold_convert_const_int_from_real (enum tree_code code, tree type, const_tree arg { tree lt = TYPE_MIN_VALUE (type); REAL_VALUE_TYPE l = real_value_from_int_cst (NULL_TREE, lt); - if (REAL_VALUES_LESS (r, l)) + if (real_less (&r, &l)) { overflow = true; val = lt; @@ -1890,7 +1890,7 @@ fold_convert_const_int_from_real (enum tree_code code, tree type, const_tree arg if (ut) { REAL_VALUE_TYPE u = real_value_from_int_cst (NULL_TREE, ut); - if (REAL_VALUES_LESS (u, r)) + if (real_less (&u, &r)) { overflow = true; val = ut; diff --git a/gcc/real.c b/gcc/real.c index d47f32ad78b..49d6739eddd 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -1086,6 +1086,14 @@ real_equal (const REAL_VALUE_TYPE *op0, const REAL_VALUE_TYPE *op1) return do_compare (op0, op1, -1) == 0; } +/* Return whether OP0 < OP1. */ + +bool +real_less (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, switch (code) { case LT_EXPR: - return do_compare (op0, op1, 1) < 0; + return real_less (op0, op1); case LE_EXPR: return do_compare (op0, op1, 1) <= 0; case GT_EXPR: diff --git a/gcc/real.h b/gcc/real.h index dbb13ae1c52..be429b51599 100644 --- a/gcc/real.h +++ b/gcc/real.h @@ -250,6 +250,7 @@ extern bool real_isnegzero (const REAL_VALUE_TYPE *); /* 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 *); +extern bool real_less (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,8 +334,6 @@ extern const struct real_format arm_half_format; #define REAL_ARITHMETIC(value, code, d1, d2) \ real_arithmetic (&(value), code, &(d1), &(d2)) -#define REAL_VALUES_LESS(x, y) real_compare (LT_EXPR, &(x), &(y)) - /* Determine whether a floating-point value X is infinite. */ #define REAL_VALUE_ISINF(x) real_isinf (&(x)) diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index b4d95a22a61..9f791a7f774 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -1862,13 +1862,13 @@ simplify_const_unary_operation (enum rtx_code code, machine_mode mode, /* Test against the signed upper bound. */ wmax = wi::max_value (width, SIGNED); real_from_integer (&t, VOIDmode, wmax, SIGNED); - if (REAL_VALUES_LESS (t, x)) + if (real_less (&t, &x)) return immed_wide_int_const (wmax, mode); /* Test against the signed lower bound. */ wmin = wi::min_value (width, SIGNED); real_from_integer (&t, VOIDmode, wmin, SIGNED); - if (REAL_VALUES_LESS (x, t)) + if (real_less (&x, &t)) return immed_wide_int_const (wmin, mode); return immed_wide_int_const (real_to_integer (&x, &fail, width), mode); @@ -1881,7 +1881,7 @@ simplify_const_unary_operation (enum rtx_code code, machine_mode mode, /* Test against the unsigned upper bound. */ wmax = wi::max_value (width, UNSIGNED); real_from_integer (&t, VOIDmode, wmax, UNSIGNED); - if (REAL_VALUES_LESS (t, x)) + if (real_less (&t, &x)) return immed_wide_int_const (wmax, mode); return immed_wide_int_const (real_to_integer (&x, &fail, width), @@ -4943,7 +4943,7 @@ simplify_const_relational_operation (enum rtx_code code, return comparison_result (code, (real_equal (&d0, &d1) ? CMP_EQ : - REAL_VALUES_LESS (d0, d1) ? CMP_LT : CMP_GT)); + real_less (&d0, &d1) ? CMP_LT : CMP_GT)); } /* Otherwise, see if the operands are both integers. */ diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c index 7a0275ad1c6..112a3250c40 100644 --- a/gcc/tree-call-cdce.c +++ b/gcc/tree-call-cdce.c @@ -201,10 +201,10 @@ check_pow (gcall *pow_call) REAL_VALUE_TYPE bcv = TREE_REAL_CST (base); if (real_equal (&bcv, &dconst1)) return false; - if (REAL_VALUES_LESS (bcv, dconst1)) + if (real_less (&bcv, &dconst1)) return false; real_from_integer (&mv, TYPE_MODE (TREE_TYPE (base)), 256, UNSIGNED); - if (REAL_VALUES_LESS (mv, bcv)) + if (real_less (&mv, &bcv)) return false; return true; } @@ -421,9 +421,9 @@ gen_conditions_for_pow_cst_base (tree base, tree expn, REAL_VALUE_TYPE mv; REAL_VALUE_TYPE bcv = TREE_REAL_CST (base); gcc_assert (!real_equal (&bcv, &dconst1) - && !REAL_VALUES_LESS (bcv, dconst1)); + && !real_less (&bcv, &dconst1)); real_from_integer (&mv, TYPE_MODE (TREE_TYPE (base)), 256, UNSIGNED); - gcc_assert (!REAL_VALUES_LESS (mv, bcv)); + gcc_assert (!real_less (&mv, &bcv)); exp_domain = get_domain (0, false, false, 127, true, false);