https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98212
Bug ID: 98212 Summary: X86 unoptimal code for float equallity comparison followed by jump Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- For f1 code an unnecessary `comiss` instruction is used, the parity flag is still set after the `jp` instruction. For f2, I'm not sure if it's the optimal way to do that. The same problems appear for `float`, `double` and `long double` ------ void f(); void f1(float a, float b) { if (a != b) f(); } void f2(float a, float b) { if (a == b) f(); } ------ f1(float, float): ucomiss xmm0, xmm1 jp .L4 comiss xmm0, xmm1 jne .L4 ret .L4: jmp f() f2(float, float): ucomiss xmm0, xmm1 jnp .L11 .L7: ret .L11: jne .L7 jmp f() ------