> -----Original Message----- > From: Georg-Johann Lay > Sent: Friday, October 05, 2012 8:30 AM > To: gcc-patches@gcc.gnu.org > Cc: Denis Chertykov; Weddington, Eric > Subject: [Patch,avr]: Fix PR54815 > > avr-gcc compiles code like > > void f (int, int); > > void f_or (int x) > { > f (x, x | 42); > } > > to > > f_or: > ldi r22,lo8(42) ; 15 *movhi/5 [length = 2] > ldi r23,0 > or r22,r24 ; 6 iorhi3/1 [length = 2] > or r23,r25 > rjmp f > > but this is more efficient: > > f_or: > movw r22,r24 ; 15 *movhi/1 [length = 1] > ori r22,42 ; 6 iorhi3/3 [length = 1] > rjmp f ; 9 call_insn/4 [length = 1] > > The second variant is generated with the attached patch which makes > alternatives where the 3rd operand is a register slightly more expensive. > > The saturated additions and subtractions in avr-fixed.md already contain > such > constraint costs, so they need not to be fixed. > > Ok for trunk? >
Approved, please apply. Thanks for your work! :-) Eric