http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43088
Georg-Johann Lay <gjl at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Component|target |rtl-optimization Known to work| |4.7.0 Resolution| |FIXED Target Milestone|--- |4.7.0 --- Comment #7 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-07-04 13:30:03 UTC --- Closed in 4.7.0 This was a flaw in insn combine as explained above. In 4.7.0 trunk (SVN 175811) the problem is solved and the two versions, one with 0x3f and one with 0x3e, yield the same, optimal assembler: foo_3f: lds r24,count.1210 ; 5 *movqi/4 [length = 2] subi r24,lo8(-(1)) ; 6 addqi3/2 [length = 1] sts count.1210,r24 ; 7 *movqi/3 [length = 2] andi r24,lo8(63) ; 8 andqi3/2 [length = 1] breq .L2 ; 10 branch [length = 1] cbi 40-0x20,0 ; 16 *cbi [length = 1] ret ; 36 return [length = 1] .L2: sbi 40-0x20,0 ; 25 *sbi [length = 1] ret ; 38 return [length = 1] .size foo_3f, .-foo_3f foo_3e: lds r24,count.1214 ; 5 *movqi/4 [length = 2] subi r24,lo8(-(1)) ; 6 addqi3/2 [length = 1] sts count.1214,r24 ; 7 *movqi/3 [length = 2] andi r24,lo8(62) ; 8 andqi3/2 [length = 1] breq .L5 ; 10 branch [length = 1] cbi 40-0x20,0 ; 16 *cbi [length = 1] ret ; 34 return [length = 1] .L5: sbi 40-0x20,0 ; 25 *sbi [length = 1] ret ; 36 return [length = 1]