Symptoms: gcc fails to notice flags already available and generates redundant comparisons.
After tracking down a real world performance issue i couldn't rid of without ressorting to inline asm, i've bugged Uros; he produced that reduced testcase. int test(float a, float b) { int lt = a < b; int eq = a == b; return lt + eq; } with gcc-4.2-20060805/cygwin, -O3 -march=k8 -mfpmath=sse -fomit-frame-pointer -ffast-math: 00401050 <test(float, float)>: 401050: movss 0x4(%esp),%xmm1 401056: xor %eax,%eax 401058: movss 0x8(%esp),%xmm0 40105e: comiss %xmm0,%xmm1 401061: sete %al 401064: xor %edx,%edx 401066: comiss %xmm0,%xmm1 401069: setb %dl 40106c: add %edx,%eax 40106e: ret Also happens on x86-64. This is not only related to PR 17390, but also integer compares :) -- Summary: missed optimization, redundant scalar SSE comparisons Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tbptbp at gmail dot com GCC host triplet: x86* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28691