https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46854
Segher Boessenkool <segher at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |segher at gcc dot gnu.org Resolution|--- |FIXED --- Comment #5 from Segher Boessenkool <segher at gcc dot gnu.org> --- Current trunk does (with -O2) test: mr. 10,3 lis 3,.LANCHOR0@ha la 3,.LANCHOR0@l(3) beqlr 0 .p2align 5,,31 .L3: lbzu 9,1(3) cmpwi 7,9,0 bne 7,.L3 addic. 10,10,-1 bne 0,.L3 blr and with -Os test: lis 9,.LANCHOR0@ha la 9,.LANCHOR0@l(9) .L2: cmpwi 7,3,0 bne 7,.L3 mr 3,9 blr .L3: lbzu 10,1(9) cmpwi 7,10,0 bne 7,.L3 addi 3,3,-1 b .L2 Both are reasonable, with no obvious inefficiency; I'm closing this bug as fixed. (Note that since a few years we generate bdnz only in inner loops).