------- Additional Comments From dje at gcc dot gnu dot org 2005-09-17 03:49 ------- The mult_cost argument to choose_mult_variant() and the cost of the best shift/add sequence are not always representing the same operation, so the comparison is not always correct. The synth_mult cost is just the cost of the multiplication by a constant, but the mult_cost argument includes the full rtx_cost of the insn, including address cost. For example
(mult:SI (mem/c/i:SI (reg/f:SI 123) [5 y+0 S4 A32]) (const_int 24 [0x18])) rtx_cost will include the cost of the MEM. This artificially inflates the cost of the MULT, making the shift/add sequence seem more efficient. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22067