+2015-10-05 Richard Sandiford <richard.sandiford@arm.com>
+
+ * 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 <richard.sandiford@arm.com>
* real.h (REAL_VALUES_IDENTICAL): Delete.
+2015-10-05 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc-interface/trans.c (convert_with_check): Use real_less instead
+ of REAL_VALUES_LESS.
+
2015-10-02 Doug Rupp <rupp@adacore.com>
Olivier Hainque <hainque@adacore.com>
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
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,
REAL_VALUE_FROM_CONST_DOUBLE (r, x);
- if (REAL_VALUES_LESS (r, dconst1))
+ if (real_less (&r, &dconst1))
return 0;
exp = real_exponent (&r);
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;
}
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
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
{
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;
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;
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)
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:
/* 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,
#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))
/* 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);
/* 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),
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. */
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;
}
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);