aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2015-10-05 11:29:35 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2015-10-05 11:29:35 +0000
commit624d31fe0135b7b33529f4e8fae88a4877bfc204 (patch)
tree9ff1a2cfb5bbe32283d5601af93e89a8f4260dc5 /gcc/builtins.c
parent7d475a547690022aeb7e0bfbd51bc476c6ca31c0 (diff)
downloadgcc-624d31fe0135b7b33529f4e8fae88a4877bfc204.zip
gcc-624d31fe0135b7b33529f4e8fae88a4877bfc204.tar.gz
gcc-624d31fe0135b7b33529f4e8fae88a4877bfc204.tar.bz2
Replace REAL_VALUES_EQUAL with real_equal
Richard B suggested we should replace dconsthalf etc. with dconst<1, 2> (). When I tried that, the extra comma caused problems with some lingering uses of the old target macros for handling reals (e.g. REAL_ARITHMETIC instead of real_arithmetic), since the constant was then treated as two macro parameters. It would have been possible to add an extra level of brackets to avoid this, but I thought I might as well take the opportunity to remove the macros instead. (Note that I'm only removing macros that caused a problem directly, or are closely related to ones that did.) This first patch replaces REAL_VALUES_EQUAL with a real_equal function. The prototype is the same as for real_identical, which has already undergone a half-transition in this direction. 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/c-family/ * c-lex.c (interpret_float): Use real_equal instead of REAL_VALUES_EQUAL. gcc/c/ * c-typeck.c (c_tree_equal): Use real_equal instead of REAL_VALUES_EQUAL. gcc/cp/ * tree.c (cp_tree_equal): Use real_equal instead of REAL_VALUES_EQUAL. gcc/ * real.h (real_equal): Declare. (REAL_VALUES_EQUAL): Delete. * real.c (real_equal): New function. (real_compare): Use it. * doc/tm.texi.in (REAL_VALUES_EQUAL): Delete. * doc/tm.texi: Regenerate. * builtins.c (fold_builtin_pow, fold_builtin_load_exponent): Use real_equal instead of REAL_VALUES_EQUAL. * config/aarch64/aarch64.c (aarch64_float_const_zero_rtx_p): Likewise. * config/arm/arm.c (arm_const_double_rtx, neon_valid_immediate) (fp_const_from_val): Likewise. * config/fr30/fr30.c (fr30_const_double_is_zero): Likewise. * config/m68k/m68k.c (standard_68881_constant_p): Likewise. (floating_exact_log2): Likewise. * config/sh/sh.c (fp_zero_operand, fp_one_operand): Likewise. * config/vax/vax.c (vax_float_literal): Likewise. * config/xtensa/predicates.md (const_float_1_operand): Likewise. * cprop.c (implicit_set_cond_p): Likewise. * expmed.c (expand_mult): Likewise. * fold-const.c (const_binop): Likewise. * simplify-rtx.c (simplify_binary_operation_1): Likewise. (simplify_const_binary_operation): Likewise. (simplify_const_relational_operation): Likewise. * tree-call-cdce.c (check_pow): Likewise. (gen_conditions_for_pow_cst_base): Likewise. * tree-inline.c (estimate_num_insns): Likewise. * tree-ssa-dom.c (record_equality): Likewise. * tree-ssa-math-opts.c (representable_as_half_series_p): Likewise. (gimple_expand_builtin_pow): Likewise. (pass_optimize_widening_mul::execute): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Likewise. * tree.c (real_zerop, real_onep, real_minus_onep): Likewise. --- gcc/builtins.c | 14 +++++++------- gcc/c-family/c-lex.c | 6 +++--- gcc/c/c-typeck.c | 2 +- gcc/config/aarch64/aarch64.c | 2 +- gcc/config/arm/arm.c | 6 +++--- gcc/config/fr30/fr30.c | 2 +- gcc/config/m68k/m68k.c | 6 +++--- gcc/config/sh/sh.c | 4 ++-- gcc/config/vax/vax.c | 4 ++-- gcc/config/xtensa/predicates.md | 2 +- gcc/cp/tree.c | 2 +- gcc/cprop.c | 2 +- gcc/doc/tm.texi | 7 ------- gcc/doc/tm.texi.in | 7 ------- gcc/expmed.c | 2 +- gcc/fold-const.c | 2 +- gcc/real.c | 10 +++++++++- gcc/real.h | 4 ++-- gcc/simplify-rtx.c | 16 ++++++++-------- gcc/tree-call-cdce.c | 4 ++-- gcc/tree-inline.c | 5 +++-- gcc/tree-ssa-dom.c | 2 +- gcc/tree-ssa-math-opts.c | 16 ++++++++-------- gcc/tree-ssa-uncprop.c | 2 +- gcc/tree-vect-patterns.c | 4 ++-- gcc/tree.c | 6 +++--- 26 files changed, 67 insertions(+), 72 deletions(-) From-SVN: r228473
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index e20c1f8..9a81a18 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -8432,22 +8432,22 @@ fold_builtin_pow (location_t loc, tree fndecl, tree arg0, tree arg1, tree type)
c = TREE_REAL_CST (arg1);
/* Optimize pow(x,0.0) = 1.0. */
- if (REAL_VALUES_EQUAL (c, dconst0))
+ if (real_equal (&c, &dconst0))
return omit_one_operand_loc (loc, type, build_real (type, dconst1),
arg0);
/* Optimize pow(x,1.0) = x. */
- if (REAL_VALUES_EQUAL (c, dconst1))
+ if (real_equal (&c, &dconst1))
return arg0;
/* Optimize pow(x,-1.0) = 1.0/x. */
- if (REAL_VALUES_EQUAL (c, dconstm1))
+ if (real_equal (&c, &dconstm1))
return fold_build2_loc (loc, RDIV_EXPR, type,
build_real (type, dconst1), arg0);
/* Optimize pow(x,0.5) = sqrt(x). */
if (flag_unsafe_math_optimizations
- && REAL_VALUES_EQUAL (c, dconsthalf))
+ && real_equal (&c, &dconsthalf))
{
tree sqrtfn = mathfn_built_in (type, BUILT_IN_SQRT);
@@ -8461,7 +8461,7 @@ fold_builtin_pow (location_t loc, tree fndecl, tree arg0, tree arg1, tree type)
const REAL_VALUE_TYPE dconstroot
= real_value_truncate (TYPE_MODE (type), dconst_third ());
- if (REAL_VALUES_EQUAL (c, dconstroot))
+ if (real_equal (&c, &dconstroot))
{
tree cbrtfn = mathfn_built_in (type, BUILT_IN_CBRT);
if (cbrtfn != NULL_TREE)
@@ -8480,7 +8480,7 @@ fold_builtin_pow (location_t loc, tree fndecl, tree arg0, tree arg1, tree type)
&& !TREE_OVERFLOW (arg0)
&& (n > 0
|| (!flag_trapping_math && !flag_errno_math)
- || !REAL_VALUES_EQUAL (TREE_REAL_CST (arg0), dconst0)))
+ || !real_equal (&TREE_REAL_CST (arg0), &dconst0)))
{
REAL_VALUE_TYPE x;
bool inexact;
@@ -9373,7 +9373,7 @@ fold_builtin_load_exponent (location_t loc, tree arg0, tree arg1,
/* Only proceed if the target mode can hold the
resulting value. */
- if (REAL_VALUES_EQUAL (initial_result, trunc_result))
+ if (real_equal (&initial_result, &trunc_result))
return build_real (type, trunc_result);
}
}