<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 --- - suboptimal AVX splat"
   href="http://llvm.org/bugs/show_bug.cgi?id=22283">22283</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>suboptimal AVX splat
          </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 a follow-on to <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - vector splats: the hard way"
   href="show_bug.cgi?id=22276">bug 22276</a>, although this may be an independent bug.

In the case of a splat of a variable (such as the induction variable in a
vectorized loop), we may not be generating the optimal splat at least for an
AVX1 machine:

define <4 x i64> @splat(i64 %x) {
  %scalar_to_vector = insertelement <4 x i64> undef, i64 %x, i32 0
  %splat = shufflevector <4 x i64> %scalar_to_vector, <4 x i64> undef, <4 x
i32> zeroinitializer
  ret <4 x i64> %splat
}


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


I would expect this to match what we're currently generating for AVX2:
$ ./llc -mcpu=haswell zero_vector.ll -o -
...
    vmovq    %rdi, %xmm0
    vbroadcastsd    %xmm0, %ymm0
    retq


If the splatted integer value is actually used in this function, then that
should be a 'vpbroadcastq' with AVX2 rather than an FP instruction.</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>