Commit 1a1a5534 by Bin Cheng Committed by Bin Cheng

tree-ssa-loop-ivopts.c (get_shiftadd_cost): Check equality using operand_equal_p.


	* tree-ssa-loop-ivopts.c (get_shiftadd_cost): Check equality
	using operand_equal_p.

From-SVN: r204498
parent be8c1c8c
2013-11-07 Bin Cheng <bin.cheng@arm.com> 2013-11-07 Bin Cheng <bin.cheng@arm.com>
* tree-ssa-loop-ivopts.c (get_shiftadd_cost): Check equality
using operand_equal_p.
2013-11-07 Bin Cheng <bin.cheng@arm.com>
* tree-ssa-loop-ivopts.c (alloc_iv): Lower address expressions. * tree-ssa-loop-ivopts.c (alloc_iv): Lower address expressions.
* tree-affine.c (get_inner_reference_aff): Return base. * tree-affine.c (get_inner_reference_aff): Return base.
* tree-affine.h (get_inner_reference_aff): Change prototype. * tree-affine.h (get_inner_reference_aff): Change prototype.
...@@ -3500,17 +3500,21 @@ get_shiftadd_cost (tree expr, enum machine_mode mode, comp_cost cost0, ...@@ -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 m = exact_log2 (int_cst_value (cst));
int maxm = MIN (BITS_PER_WORD, GET_MODE_BITSIZE (mode)); int maxm = MIN (BITS_PER_WORD, GET_MODE_BITSIZE (mode));
int sa_cost; int sa_cost;
bool equal_p = false;
if (!(m >= 0 && m < maxm)) if (!(m >= 0 && m < maxm))
return false; return false;
if (operand_equal_p (op1, mult, 0))
equal_p = true;
sa_cost = (TREE_CODE (expr) != MINUS_EXPR sa_cost = (TREE_CODE (expr) != MINUS_EXPR
? shiftadd_cost (speed, mode, m) ? shiftadd_cost (speed, mode, m)
: (mult == op1 : (equal_p
? shiftsub1_cost (speed, mode, m) ? shiftsub1_cost (speed, mode, m)
: shiftsub0_cost (speed, mode, m))); : shiftsub0_cost (speed, mode, m)));
res = new_cost (sa_cost, 0); 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); STRIP_NOPS (multop);
if (!is_gimple_val (multop)) if (!is_gimple_val (multop))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment