Re: Suboptimal code generated for ?: as a condition

2006-04-17 Thread Jeffrey A Law
On Mon, 2006-04-17 at 14:48 +0200, Marcin 'Qrczak' Kowalczyk wrote: > 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-

Suboptimal code generated for ?: as a condition

2006-04-17 Thread Marcin 'Qrczak' Kowalczyk
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: movl4(%esp), %eax