<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - zero vector: the hard way (x86: SSE/AVX shuffles)"
   href="http://llvm.org/bugs/show_bug.cgi?id=22276">22276</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>zero vector: the hard way (x86: SSE/AVX shuffles)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>spatel+llvm@rotateright.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is an offshoot of <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Generates a total mess of SIMD for simple array initialization"
   href="show_bug.cgi?id=20225">bug 20225</a>. 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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>