-
Notifications
You must be signed in to change notification settings - Fork 15k
Open
Labels
Description
Reduced from a large example:
long patatino() {
long x = 0;
for (int i = 0; i < 5; ++i) {
while (x < 37) {
if (x % 4 == 0) {
x += 4;
}
}
}
return x;
}
-Oz
patatino():
xorl %eax, %eax
xorl %ecx, %ecx
.LBB0_1:
cmpl $5, %ecx
jne .LBB0_4
jmp .LBB0_2
.LBB0_5:
testb $3, %al
jne .LBB0_4
addq $4, %rax
.LBB0_4:
cmpq $36, %rax
jle .LBB0_5
incl %ecx
jmp .LBB0_1
.LBB0_2:
retq
-O2
patatino():
movl $40, %eax
retq
Godbolt link: https://godbolt.org/z/fzxWM693x