summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-ivopts.c
diff options
context:
space:
mode:
authoramker <amker@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-07 08:34:02 +0000
committeramker <amker@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-07 08:34:02 +0000
commitbe3e66f7a5542d200e63fc8b00f9cd3bcf5db999 (patch)
treed117536054d5fdf9039e45d6c0a4d1915332bb5d /gcc/tree-ssa-loop-ivopts.c
parent388424f0d3a9b723b8f87976aa650dde8c905f7e (diff)
downloadgcc-be3e66f7a5542d200e63fc8b00f9cd3bcf5db999.tar.gz
* tree-ssa-loop-ivopts.c (get_shiftadd_cost): Check equality
using operand_equal_p. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204498 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r--gcc/tree-ssa-loop-ivopts.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 220aae6878b..f7da1267416 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -3500,17 +3500,21 @@ get_shiftadd_cost (tree expr, enum machine_mode mode, comp_cost cost0,
int m = exact_log2 (int_cst_value (cst));
int maxm = MIN (BITS_PER_WORD, GET_MODE_BITSIZE (mode));
int sa_cost;
+ bool equal_p = false;
if (!(m >= 0 && m < maxm))
return false;
+ if (operand_equal_p (op1, mult, 0))
+ equal_p = true;
+
sa_cost = (TREE_CODE (expr) != MINUS_EXPR
? shiftadd_cost (speed, mode, m)
- : (mult == op1
+ : (equal_p
? shiftsub1_cost (speed, mode, m)
: shiftsub0_cost (speed, mode, m)));
res = new_cost (sa_cost, 0);
- res = add_costs (res, mult == op1 ? cost0 : cost1);
+ res = add_costs (res, equal_p ? cost0 : cost1);
STRIP_NOPS (multop);
if (!is_gimple_val (multop))