aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorNaveen H.S <Naveen.Hurugalawadi@caviumnetworks.com>2015-08-26 03:39:17 +0000
committerNaveen H.S <naveenh@gcc.gnu.org>2015-08-26 03:39:17 +0000
commit354016403304928441c3f4c2a1009a108a1b6b60 (patch)
tree28feaf1844e9260eba866a5a3cc14df7aa00aca9 /gcc/fold-const.c
parent6031a5e32cc168cae5fe9fa06a2557e0b20a5a81 (diff)
downloadgcc-354016403304928441c3f4c2a1009a108a1b6b60.zip
gcc-354016403304928441c3f4c2a1009a108a1b6b60.tar.gz
gcc-354016403304928441c3f4c2a1009a108a1b6b60.tar.bz2
fold-const.c (fold_binary_loc): Move Optimize root(x)*root(y) as root(x*y) to match.pd.
2015-08-26 Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> * fold-const.c (fold_binary_loc) : Move Optimize root(x)*root(y) as root(x*y) to match.pd. Move Optimize expN(x)*expN(y) as expN(x+y) to match.pd. Move Optimize pow(x,y)*pow(x,z) as pow(x,y+z) to match.pd. Move Optimize a/root(b/c) into a*root(c/b) to match.pd. Move Optimize x/expN(y) into x*expN(-y) to match.pd. * match.pd (mult (root:s @0) (root:s @1)): New simplifier. (mult (POW:s @0 @1) (POW:s @0 @2)) : New simplifier. (mult (exps:s @0) (exps:s @1)) : New simplifier. (rdiv @0 (root:s (rdiv:s @1 @2))) : New simplifier. (rdiv @0 (exps:s @1)) : New simplifier. From-SVN: r227207
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c79
1 files changed, 0 insertions, 79 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 1e01726..c826e67 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -9947,51 +9947,6 @@ fold_binary_loc (location_t loc,
if (flag_unsafe_math_optimizations)
{
- enum built_in_function fcode0 = builtin_mathfn_code (arg0);
- enum built_in_function fcode1 = builtin_mathfn_code (arg1);
-
- /* Optimizations of root(...)*root(...). */
- if (fcode0 == fcode1 && BUILTIN_ROOT_P (fcode0))
- {
- tree rootfn, arg;
- tree arg00 = CALL_EXPR_ARG (arg0, 0);
- tree arg10 = CALL_EXPR_ARG (arg1, 0);
-
- /* Optimize root(x)*root(y) as root(x*y). */
- rootfn = TREE_OPERAND (CALL_EXPR_FN (arg0), 0);
- arg = fold_build2_loc (loc, MULT_EXPR, type, arg00, arg10);
- return build_call_expr_loc (loc, rootfn, 1, arg);
- }
-
- /* Optimize expN(x)*expN(y) as expN(x+y). */
- if (fcode0 == fcode1 && BUILTIN_EXPONENT_P (fcode0))
- {
- tree expfn = TREE_OPERAND (CALL_EXPR_FN (arg0), 0);
- tree arg = fold_build2_loc (loc, PLUS_EXPR, type,
- CALL_EXPR_ARG (arg0, 0),
- CALL_EXPR_ARG (arg1, 0));
- return build_call_expr_loc (loc, expfn, 1, arg);
- }
-
- /* Optimizations of pow(...)*pow(...). */
- if ((fcode0 == BUILT_IN_POW && fcode1 == BUILT_IN_POW)
- || (fcode0 == BUILT_IN_POWF && fcode1 == BUILT_IN_POWF)
- || (fcode0 == BUILT_IN_POWL && fcode1 == BUILT_IN_POWL))
- {
- tree arg00 = CALL_EXPR_ARG (arg0, 0);
- tree arg01 = CALL_EXPR_ARG (arg0, 1);
- tree arg10 = CALL_EXPR_ARG (arg1, 0);
- tree arg11 = CALL_EXPR_ARG (arg1, 1);
-
- /* Optimize pow(x,y)*pow(x,z) as pow(x,y+z). */
- if (operand_equal_p (arg00, arg10, 0))
- {
- tree powfn = TREE_OPERAND (CALL_EXPR_FN (arg0), 0);
- tree arg = fold_build2_loc (loc, PLUS_EXPR, type,
- arg01, arg11);
- return build_call_expr_loc (loc, powfn, 2, arg00, arg);
- }
- }
/* Canonicalize x*x as pow(x,2.0), which is expanded as x*x. */
if (!in_gimple_form
@@ -10403,40 +10358,6 @@ fold_binary_loc (location_t loc,
TREE_OPERAND (arg1, 0));
}
- if (flag_unsafe_math_optimizations)
- {
- enum built_in_function fcode1 = builtin_mathfn_code (arg1);
-
- /* Optimize a/root(b/c) into a*root(c/b). */
- if (BUILTIN_CBRT_P (fcode1))
- {
- tree rootarg = CALL_EXPR_ARG (arg1, 0);
-
- if (TREE_CODE (rootarg) == RDIV_EXPR)
- {
- tree rootfn = TREE_OPERAND (CALL_EXPR_FN (arg1), 0);
- tree b = TREE_OPERAND (rootarg, 0);
- tree c = TREE_OPERAND (rootarg, 1);
-
- tree tmp = fold_build2_loc (loc, RDIV_EXPR, type, c, b);
-
- tmp = build_call_expr_loc (loc, rootfn, 1, tmp);
- return fold_build2_loc (loc, MULT_EXPR, type, arg0, tmp);
- }
- }
-
- /* Optimize x/expN(y) into x*expN(-y). */
- if (BUILTIN_EXPONENT_P (fcode1))
- {
- tree expfn = TREE_OPERAND (CALL_EXPR_FN (arg1), 0);
- tree arg = negate_expr (CALL_EXPR_ARG (arg1, 0));
- arg1 = build_call_expr_loc (loc,
- expfn, 1,
- fold_convert_loc (loc, type, arg));
- return fold_build2_loc (loc, MULT_EXPR, type, arg0, arg1);
- }
-
- }
return NULL_TREE;
case TRUNC_DIV_EXPR: