aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2015-10-21 20:16:36 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2015-10-21 20:16:36 +0000
commit4adfc9a5d353d64b5bf39536064d300f9e45a0cf (patch)
tree92fc7ae80645bb51dac3ca4e697a59042c1d8bd8 /gcc/fold-const.c
parent6a75d560c855081ddb8147bf6cec378cda55901b (diff)
downloadgcc-4adfc9a5d353d64b5bf39536064d300f9e45a0cf.zip
gcc-4adfc9a5d353d64b5bf39536064d300f9e45a0cf.tar.gz
gcc-4adfc9a5d353d64b5bf39536064d300f9e45a0cf.tar.bz2
Remove fold_strip_sign_ops
This patch deletes fold_strip_sign_ops in favour of the gimple-ssa-backprop.c pass. Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. gcc/ * fold-const.h (fold_strip_sign_ops): Delete. * fold-const.c (fold_strip_sign_ops): Likewise. (fold_unary_loc, fold_binary_loc): Remove calls to it. * builtins.c (fold_builtin_cos, fold_builtin_cosh) (fold_builtin_ccos): Delete. (fold_builtin_pow): Don't call fold_strip_sign_ops. (fold_builtin_hypot, fold_builtin_copysign): Likewise. Remove fndecl argument. (fold_builtin_1): Update calls accordingly. Handle constant cos, cosh, ccos and ccosh here. gcc/testsuite/ * gcc.dg/torture/builtin-symmetric-1.c: Don't run at -O0. From-SVN: r229140
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c96
1 files changed, 0 insertions, 96 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index dff1d55..042d43f 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -7803,15 +7803,6 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0)
TREE_TYPE (targ0),
targ0));
}
-
- /* Strip sign ops from argument. */
- if (TREE_CODE (type) == REAL_TYPE)
- {
- tem = fold_strip_sign_ops (arg0);
- if (tem)
- return fold_build1_loc (loc, ABS_EXPR, type,
- fold_convert_loc (loc, type, tem));
- }
return NULL_TREE;
case BIT_NOT_EXPR:
@@ -9859,17 +9850,6 @@ fold_binary_loc (location_t loc,
}
else
{
- /* Strip sign operations from X in X*X, i.e. -Y*-Y -> Y*Y. */
- if (operand_equal_p (arg0, arg1, 0))
- {
- tree tem = fold_strip_sign_ops (arg0);
- if (tem != NULL_TREE)
- {
- tem = fold_convert_loc (loc, type, tem);
- return fold_build2_loc (loc, MULT_EXPR, type, tem, tem);
- }
- }
-
/* Fold z * +-I to __complex__ (-+__imag z, +-__real z).
This is not the same for NaNs or if signed zeros are
involved. */
@@ -14252,82 +14232,6 @@ ptr_difference_const (tree e1, tree e2, HOST_WIDE_INT *diff)
return true;
}
-/* Simplify the floating point expression EXP when the sign of the
- result is not significant. Return NULL_TREE if no simplification
- is possible. */
-
-tree
-fold_strip_sign_ops (tree exp)
-{
- tree arg0, arg1;
- location_t loc = EXPR_LOCATION (exp);
-
- switch (TREE_CODE (exp))
- {
- case ABS_EXPR:
- case NEGATE_EXPR:
- arg0 = fold_strip_sign_ops (TREE_OPERAND (exp, 0));
- return arg0 ? arg0 : TREE_OPERAND (exp, 0);
-
- case MULT_EXPR:
- case RDIV_EXPR:
- if (HONOR_SIGN_DEPENDENT_ROUNDING (element_mode (exp)))
- return NULL_TREE;
- arg0 = fold_strip_sign_ops (TREE_OPERAND (exp, 0));
- arg1 = fold_strip_sign_ops (TREE_OPERAND (exp, 1));
- if (arg0 != NULL_TREE || arg1 != NULL_TREE)
- return fold_build2_loc (loc, TREE_CODE (exp), TREE_TYPE (exp),
- arg0 ? arg0 : TREE_OPERAND (exp, 0),
- arg1 ? arg1 : TREE_OPERAND (exp, 1));
- break;
-
- case COMPOUND_EXPR:
- arg0 = TREE_OPERAND (exp, 0);
- arg1 = fold_strip_sign_ops (TREE_OPERAND (exp, 1));
- if (arg1)
- return fold_build2_loc (loc, COMPOUND_EXPR, TREE_TYPE (exp), arg0, arg1);
- break;
-
- case COND_EXPR:
- arg0 = fold_strip_sign_ops (TREE_OPERAND (exp, 1));
- arg1 = fold_strip_sign_ops (TREE_OPERAND (exp, 2));
- if (arg0 || arg1)
- return fold_build3_loc (loc,
- COND_EXPR, TREE_TYPE (exp), TREE_OPERAND (exp, 0),
- arg0 ? arg0 : TREE_OPERAND (exp, 1),
- arg1 ? arg1 : TREE_OPERAND (exp, 2));
- break;
-
- case CALL_EXPR:
- {
- const enum built_in_function fcode = builtin_mathfn_code (exp);
- switch (fcode)
- {
- CASE_FLT_FN (BUILT_IN_COPYSIGN):
- /* Strip copysign function call, return the 1st argument. */
- arg0 = CALL_EXPR_ARG (exp, 0);
- arg1 = CALL_EXPR_ARG (exp, 1);
- return omit_one_operand_loc (loc, TREE_TYPE (exp), arg0, arg1);
-
- default:
- /* Strip sign ops from the argument of "odd" math functions. */
- if (negate_mathfn_p (fcode))
- {
- arg0 = fold_strip_sign_ops (CALL_EXPR_ARG (exp, 0));
- if (arg0)
- return build_call_expr_loc (loc, get_callee_fndecl (exp), 1, arg0);
- }
- break;
- }
- }
- break;
-
- default:
- break;
- }
- return NULL_TREE;
-}
-
/* Return OFF converted to a pointer offset type suitable as offset for
POINTER_PLUS_EXPR. Use location LOC for this conversion. */
tree