From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 73219 invoked by alias); 5 Oct 2015 10:43:48 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 73170 invoked by uid 89); 5 Oct 2015 10:43:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 05 Oct 2015 10:43:45 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-20-57YPv_acSo-DCEg6ZVPknQ-1; Mon, 05 Oct 2015 11:43:40 +0100 Received: from localhost ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 5 Oct 2015 11:43:39 +0100 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: Replace REAL_VALUES_LESS with real_less Date: Mon, 05 Oct 2015 10:43:00 -0000 Message-ID: <87fv1pd290.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-MC-Unique: 57YPv_acSo-DCEg6ZVPknQ-1 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2015-10/txt/msg00381.txt.bz2 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. OK to install? Thanks, Richard 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. diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 3252ea2..9838da0 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_exp= r, 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 =3D invert_truthvalue @@ -9011,8 +9011,8 @@ convert_with_check (Entity_Id gnat_type, tree gnu_exp= r, 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 =3D 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 487cbf4..74de983 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -4365,7 +4365,7 @@ floating_exact_log2 (rtx x) =20 REAL_VALUE_FROM_CONST_DOUBLE (r, x); =20 - if (REAL_VALUES_LESS (r, dconst1)) + if (real_less (&r, &dconst1)) return 0; =20 exp =3D real_exponent (&r); diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/mic= roblaze.c index ebcf65a..9efa739 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) =20 if (mode =3D=3D 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; } =20 diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index fdd49d9..f6a0b5d 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 t= reat it as an opaque quantity. @end defmac =20 -@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 ab75ad9..7fae1ca 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 t= reat it as an opaque quantity. @end defmac =20 -@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 1c72af6..2851a29 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 =3D TYPE_MIN_VALUE (type); REAL_VALUE_TYPE l =3D real_value_from_int_cst (NULL_TREE, lt); - if (REAL_VALUES_LESS (r, l)) + if (real_less (&r, &l)) { overflow =3D true; val =3D 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 =3D real_value_from_int_cst (NULL_TREE, ut); - if (REAL_VALUES_LESS (u, r)) + if (real_less (&u, &r)) { overflow =3D true; val =3D ut; diff --git a/gcc/real.c b/gcc/real.c index d47f32a..49d6739 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -1086,6 +1086,14 @@ real_equal (const REAL_VALUE_TYPE *op0, const REAL_V= ALUE_TYPE *op1) return do_compare (op0, op1, -1) =3D=3D 0; } =20 +/* 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) <=3D 0; case GT_EXPR: diff --git a/gcc/real.h b/gcc/real.h index 1be4104..dc55ab2 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 *); =20 /* 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)) =20 -#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)) =20 diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index b4d95a2..9f791a7 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 =3D 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); =20 /* Test against the signed lower bound. */ wmin =3D 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); =20 return immed_wide_int_const (real_to_integer (&x, &fail, width), mode); @@ -1881,7 +1881,7 @@ simplify_const_unary_operation (enum rtx_code code, m= achine_mode mode, /* Test against the unsigned upper bound. */ wmax =3D 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); =20 return immed_wide_int_const (real_to_integer (&x, &fail, width), @@ -4943,7 +4943,7 @@ simplify_const_relational_operation (enum rtx_code co= de, =20 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)); } =20 /* Otherwise, see if the operands are both integers. */ diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c index 7a0275a..112a325 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 =3D 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 =3D 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)); =20 exp_domain =3D get_domain (0, false, false, 127, true, false);