2011/9/26 Georg-Johann Lay <a...@gjlay.de>: > This is a minor tweak to do eq/ne comparisons one instruction shorter in the > case where the compare target is unused after the comparison: > > For 1: > DEC R0 > OR R0,R1 > OR R0,R2 > OR R0,R3 > > For -1: > AND R0,R3 > AND R0,R2 > AND R0,R1 > COM R0 > > The text peephole casesi+2 used 0xffff where -1 is the right canonical > representation, e.g. the following source > > char c; > > unsigned int cmp_p (unsigned int x) > { > if (--x == 65535) > c = 0; > return x; > } > > compiles with -S -Os -dP -fno-peephole to > > ; (insn 7 6 8 (parallel [ > ; (set (cc0) > ; (compare (reg/v:HI 24 r24 [orig:42 x ] [42]) > ; (const_int -1 [0xffffffff]))) > ; (clobber (reg:QI 18 r18)) > ; ]) cmp.c:6 184 {*cmphi} > ; (expr_list:REG_UNUSED (reg:QI 18 r18) > ; (nil))) > > > Fixed that, too. Test suite passes fine. > > Ok? > > Johann > > * config/avr/avr.md (peephole casesi+2): Use -1 > instead of 65535. > * config/avr/avr.c (avr_out_compare): Print shorter sequence for > EQ/NE comparisons against +/-1 in the case of unused-after, > non-ld-regs target. >
Please commit. Denis.