[llvm-bugs] [Bug 47642] New: Suboptimal codegen for vector init constructor

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 25 05:14:44 PDT 2020


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

            Bug ID: 47642
           Summary: Suboptimal codegen for vector init constructor
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky 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 int __v4si __attribute__ ((__vector_size__ (16)));

__v4si
foo (__v4si x, int f)
{
  __v4si y = { f, f + 1 , f + 2, f + 3};
  return y;
}

Clang -O3:
foo(int __vector(4), int):                           # @foo(int __vector(4),
int)
        lea     eax, [rdi + 1]
        lea     ecx, [rdi + 2]
        lea     edx, [rdi + 3]
        movd    xmm0, edx
        movd    xmm1, ecx
        punpckldq       xmm1, xmm0              # xmm1 =
xmm1[0],xmm0[0],xmm1[1],xmm0[1]
        movd    xmm0, edi
        movd    xmm2, eax
        punpckldq       xmm0, xmm2              # xmm0 =
xmm0[0],xmm2[0],xmm0[1],xmm2[1]
        punpcklqdq      xmm0, xmm1              # xmm0 = xmm0[0],xmm1[0]
        ret


GCC -O3:
foo(int __vector(4), int):
        movd    xmm1, edi
        pshufd  xmm0, xmm1, 0
        paddd   xmm0, XMMWORD PTR .LC0[rip]
        ret
.LC0:
        .long   0
        .long   1
        .long   2
        .long   3



https://godbolt.org/z/TP4c4s

-- 
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/20200925/de850d9b/attachment.html>


More information about the llvm-bugs mailing list