https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103193

            Bug ID: 103193
           Summary: gcc for x86_64: wrong code generation: ucomiss instead
                    of comiss
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pavel.morozkin at gmail dot com
  Target Milestone: ---

This code:
#pragma STDC FENV_ACCESS ON
float f;
_Bool b;
f = NAN;
b = f >= f; // ucomiss (wrong), comiss (correct)

results in:
ucomiss xmm0, DWORD PTR [rbp-4]


Per IEEE 754-2008 the ">=" is compareSignalingGreaterEqual, which can be
implemented using comiss.

Notes:
1. Yes, the #pragma STDC FENV_ACCESS ON is not yet supported. Just wanted to
point out that under #pragma STDC FENV_ACCESS ON gcc needs to generate comiss
(not ucomiss).
2. Adding volatile to float f; results in generation of comiss (expected).

Reply via email to