------- Comment #10 from rguenth at gcc dot gnu dot org 2007-11-12 15:01 ------- of course in the -O2 case I forgot to paste the rest of the fn in, here it is:
.p2align 4,,7 .p2align 3 .L5: addl $-1000000000, %eax adcl $-1, %edx movl $1000000000, 8(%esp) movl $0, 12(%esp) movl %eax, (%esp) movl %edx, 4(%esp) call __umoddi3 leave ret so unfortunately the expanders don't deal with modulus the same way as with the div/mul sequence. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34027