[llvm-bugs] [Bug 45748] New: Bad optimization of reverse-initialization of 128-bit vector with 64-bit vectors

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 29 17:02:39 PDT 2020


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

            Bug ID: 45748
           Summary: Bad optimization of reverse-initialization of 128-bit
                    vector with 64-bit vectors
           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

typedef int32_t v2si __attribute__((vector_size(8)));
typedef int64_t v2di __attribute__((vector_size(16)));

v2di setr_epi64(v2si q0, v2si q1)
{
    return v2di{(int64_t)q0, (int64_t)q1};
}

GCC -O3 produces :

setr_epi64(int __vector(2), int __vector(2)):
  punpcklqdq xmm0, xmm1
  ret

LLVM produces :

setr_epi64(int __vector(2), int __vector(2)): # @setr_epi64(int __vector(2),
int __vector(2))
  movq rax, xmm0
  movq rcx, xmm1
  movq xmm1, rcx
  movq xmm0, rax
  punpcklqdq xmm0, xmm1 # xmm0 = xmm0[0],xmm1[0]
  ret

The code here cannot be further minimized, from what I've been able to see with
my tests.

See also https://godbolt.org/z/ZC-SWs

-- 
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/20200430/6c040d65/attachment-0001.html>


More information about the llvm-bugs mailing list