http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59174
Georg-Johann Lay <gjl at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target| |avr Priority|P3 |P4 Status|UNCONFIRMED |NEW Last reconfirmed| |2013-12-02 CC| |gjl at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> --- Confirmed with the trunk. This is an issue of cost computation in the avr backend. If you compile with -O2 -mmcu=atmega2560 -mlog=rtx_costs you will see avr_rtx_costs[test:combine(206)]=true (speed) total=36, outer=set: (mult:HI (reg:HI 47 [ D.1460 ]) (const_int 10 [0xa])) ... avr_rtx_costs[test:combine(206)]=true (speed) total=32, outer=set: (plus:HI (ashift:HI (reg:HI 47 [ D.1460 ]) (const_int 3 [0x3])) (ashift:HI (reg:HI 47 [ D.1460 ]) (const_int 1 [0x1]))) thus the MULT variant is taken as more costly that the ASHIFT + PLUS version.