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

            Bug ID: 102737
           Summary: [x86] Failure to optimize out bad register usage
                    involving int->double conversion
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

double foo(int s, double a)
{
  return s + a;
}

With -O3, GCC outputs this on AMD64:

foo(int, double):
        movapd  xmm1, xmm0
        pxor    xmm0, xmm0
        cvtsi2sd        xmm0, edi
        addsd   xmm0, xmm1
        ret

LLVM outputs this:

foo(int, double):
        cvtsi2sd        xmm1, edi
        addsd   xmm0, xmm1
        ret

The movapd in GCC's version can be optimized out.

Reply via email to