[LLVMbugs] [Bug 22276] New: zero vector: the hard way (x86: SSE/AVX shuffles)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 20 14:34:20 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22276

            Bug ID: 22276
           Summary: zero vector: the hard way (x86: SSE/AVX shuffles)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This is an offshoot of bug 20225. That bug starts off with a seemingly simple
zero vector creation:

$ cat zero_vector.ll 
define <4 x i64> @zero_vector() {
  %zero = insertelement <4 x i64> undef, i64 0, i32 0
  %splat = shufflevector <4 x i64> %zero, <4 x i64> undef, <4 x i32>
zeroinitializer
  ret <4 x i64> %splat
}


Targeting three different CPUs (SSE, AVX, AVX2) and getting three surprising
results using llc built from r226469:

$ ./llc -mcpu=core2  zero_vector.ll -o - 
...
    pxor    %xmm0, %xmm0
    pshufd    $68, %xmm0, %xmm0       ## xmm0 = xmm0[0,1,0,1]
    movdqa    %xmm0, %xmm1
    retq

$ ./llc -mcpu=sandybridge  zero_vector.ll -o - 
...
    vxorpd    %ymm0, %ymm0, %ymm0
    vunpcklpd    %xmm0, %xmm0, %xmm0 ## xmm0 = xmm0[0,0]
    vinsertf128    $1, %xmm0, %ymm0, %ymm0
    retq


$ ./llc -mcpu=haswell  zero_vector.ll -o - 
...
    xorl    %eax, %eax
    vmovq    %rax, %xmm0
    vbroadcastsd    %xmm0, %ymm0
    retq

-- 
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/20150120/3d863ce8/attachment.html>


More information about the llvm-bugs mailing list