http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50358
Bug #: 50358
Summary: AVR: Implement [u]maddqihi4 [u]msubqihi4 patterns on
the enhanced core
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: target
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Target: avr
avr-gcc 4.6.1 -Os -mmcu=atmega8 translates the following test function
int madd_x (int i, char a, char b)
{
return i + a*b;
}
to
muls r22,r20 ; 10 mulqihi3
movw r20,r0
clr r1
add r20,r24 ; 11 *addhi3/1
adc r21,r25
movw r24,r20 ; 31 *movhi/1
where it could be
muls r22,r20 ; *maddqihi4/1
add r24,r0
adc r25,r1
clr r1
instead i.e. the addition can be done in place and the product need not to be
moved out of R0, reducing code size and register pressure and increasing speed.