------- Comment #22 from law at redhat dot com 2006-04-17 16:40 -------
Here's some code which can be clearly improved with the in-progress patch to
add additional ASSERT_EXPRs:
int f(void);
void test(int x) {
if (x & 1 ? x == 0 : x > 0) f();
}
Right now we generate something like:
movl 4(%esp), %eax
testb $1, %al
je .L2
testl %eax, %eax
sete %al
testb %al, %al
jne .L9
.L7:
rep ; ret
.p2align 4,,7
.L2:
testl %eax, %eax
setg %al
testb %al, %al
je .L7
.L9:
jmp f
With the work-in-progress patch we generate the more compact and efficient:
movl 4(%esp), %eax
testb $1, %al
jne .L5
testl %eax, %eax
jg .L7
.L5:
rep ; ret
.p2align 4,,7
.L7:
jmp f
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15911