Hi, On 05/18/2011 11:20 PM, Zdenek Dvorak wrote: >> + sa_cost = (TREE_CODE (expr) != MINUS_EXPR >> + ? shiftadd_cost[speed][mode][m] >> + : (mult == op1 >> + ? shiftsub1_cost[speed][mode][m] >> + : shiftsub0_cost[speed][mode][m])); >> + res = new_cost (sa_cost, 0); >> + res = add_costs (res, mult == op1 ? cost0 : cost1); > > just forgetting the cost of the other operand does not seem correct -- what > if it contains some more complicated subexpression? > True. I now added the cost of TREE_OPERAND (mult, 0). Thanks, - Tom 2011-05-05 Tom de Vries PR target/45098 * tree-ssa-loop-ivopts.c: Include expmed.h. (get_shiftadd_cost): New function. (force_expr_to_var_cost): Declare forward. Use get_shiftadd_cost.