[llvm-bugs] [Bug 46075] New: Failure to produce vxorps to avoid latency on AVX operations

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 26 06:47:17 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46075

            Bug ID: 46075
           Summary: Failure to produce vxorps to avoid latency on AVX
                    operations
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: gabravier at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

double f(double x, int i)
{
    return x * i;
}

With `-O3 -mavx2`, Clang produces this :

f(double, int): # @f(double, int)
  vcvtsi2sd xmm1, xmm1, edi
  vmulsd xmm0, xmm1, xmm0
  ret

GCC produces this :

f(double, int):
  vmovsd xmm1, xmm0, xmm0
  vxorps xmm0, xmm0, xmm0
  vcvtsi2sd xmm0, xmm0, edi
  vmulsd xmm0, xmm0, xmm1
  ret

According to GCC developers on here :
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57954, using `vxorps` avoids a
latency which is caused by non-zeroing an AVX register before using it. This
seems to affect literally all X86 processors (as GCC uses `vxorps` for them
all) and Clang uses `vxorps` for none.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200526/791e1a66/attachment.html>


More information about the llvm-bugs mailing list