There is a missing opportunity for optimization. int f(void); void test(int x) { if (x & 1 ? x == 0 : x > 0) f(); }
This is gcc-4.1.0-0.20051206 with some patches by PLD Linux Distribution. gcc -S -O2 -fomit-frame-pointer generates the following code: test: 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 It makes little sense to materialize the boolean result of the condition in %al, and then to test %al for 0. I would expect direct conditional jumps to branches of the outer if. -- __("< Marcin Kowalczyk \__/ [EMAIL PROTECTED] ^^ http://qrnik.knm.org.pl/~qrczak/