------- Comment #8 from ramana dot r at gmail dot com 2009-02-08 05:17 ------- (In reply to comment #7) > Note you have to do with -fno-inline now on the mainline as the function is > inlined at -O2. >
It looks as though this is fixed in 4.3 and mainline today. I checked with 4.1 and saw that the problem existed in 4.1 Looking at the assembly generated for the function, I no longer see a cmp and mov as reported in the bug report. I see similar code generated in 4.1 but no longer in 4.3 or 4.4. I see subs generated for 4.3 and 4.4 in the loop kernel as of version r143940 for 4.3 and 144002 for mainline. Here is the snippet of code from 4.1, 4.3 and 4.4 as given below. 4.1 .L8: ldr r3, .L12 umull r1, r2, r3, ip mov r2, r2, lsr #3 mov r3, r2, asl #1 mov r1, r2, asl #3 add r3, r3, r1 rsb r3, r3, ip add r3, r3, #48 cmp r2, #0 ---- Insns from original bug report. mov ip, r2 ---- strb r3, [r0, #-1]! bne .L8 4.3 .L5: umull r2, r3, r5, ip mov r3, r3, lsr #3 mov r2, r3, asl #1 mov r1, r3, asl #3 add r2, r2, r1 rsb r2, r2, ip add r2, r2, #48 subs ip, r3, #0 strb r2, [r0, #-1]! bne .L5 4.4 .L5: umull r1, r2, r4, ip mov r2, r2, lsr #3 add r1, r2, r2, asl #2 sub ip, ip, r1, asl #1 add r1, ip, #48 subs ip, r2, #0 strb r1, [r0, #-1]! bne .L5 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9663