<html>
    <head>
      <base href="https://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 --- - [AVX] bloated vector permute mask generation"
   href="https://llvm.org/bugs/show_bug.cgi?id=23073">23073</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AVX] bloated vector permute mask generation
          </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>$ cat badperm.ll 
define <8 x float> @shuffle_v8f32_70000000(<8 x float> %a, <8 x float> %b) {
  %shuffle = shufflevector <8 x float> %a, <8 x float> %b, <8 x i32> <i32 7,
i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
  ret <8 x float> %shuffle
}


$ ./llc -mattr=avx2 badperm.ll -o -
...
        movl    $7, %eax
    vmovd    %eax, %xmm1
    vpxor    %ymm2, %ymm2, %ymm2
    vpblendd    $1, %ymm1, %ymm2, %ymm1 ## ymm1 = ymm1[0],ymm2[1,2,3,4,5,6,7]
    vpermps    %ymm0, %ymm1, %ymm0
    retq


As noticed by Andrea in <a href="http://reviews.llvm.org/D8341">http://reviews.llvm.org/D8341</a>, this could've been a
vmovaps + vpermd (or vpermps depending on int/fp domain).

Or since we know that all of the high elements of the mask are zeros, the
permute mask could be shortened to a single 32-bit constant '7' load (vmovd
instead of vmovaps)?</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>