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

            Bug ID: 95441
           Summary: Failure to reuse flag from float compare
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

int f(double x)
{
    return (x < 0) - (x > 0);
}

With -Ofast, GCC outputs this :

f(double):
  pxor xmm1, xmm1
  xor eax, eax
  comisd xmm1, xmm0
  seta al
  xor edx, edx
  comisd xmm0, xmm1
  seta dl
  sub eax, edx
  ret

LLVM outputs this :

f(double):
  xorpd xmm1, xmm1
  xor eax, eax
  xor ecx, ecx
  ucomisd xmm0, xmm1
  setb al
  seta cl
  sub eax, ecx
  ret

Reply via email to