Take (again): unsigned ReverseBits (unsigned index, unsigned NumBits) { unsigned i, rev;
for (i = rev = 0; i < NumBits; i++) { rev = (rev << 1) | (index & 1); index >>= 1; } return rev; } --- CUT --- Currently we get: .L.ReverseBits: cmpdi 0,4,0 mr 0,3 li 3,0 beqlr 0 addi 9,4,-1 cmpwi 7,4,0 rldicl 9,9,0,32 addi 9,9,1 mtctr 9 beq- 7,.L8 beq- 7,.L8 But since we know that any time cmpdi r4, 0/beq is true, then cmpwi r4, 0/beq is also. I think one of the issue is that doloop is also not generating subregs with /s/u on them, even though the original subregs have them. -- Summary: [4.3/4.4 Regression] extra code for doloop with unsigned 32bit types on LP64 Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org GCC target triplet: powerpc64-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37263