https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98169
Bug ID: 98169 Summary: isnan pattern not folded Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- The two following functions should produce the same assembly, at least on x86, but for f1 gcc does not recognize the pattern for f1 and produce not optimal code. The problem is the same for all floating types. bool f1(float a) { return a == a; } bool f2(float a) { return !__builtin_isnan(a); } Furthermore, for __float128, instead of calling __unordtf2 the following code call __netf2 bool f3(__float128 a) { return a != a; }