<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Broadcasting the high word in AVX2"
   href="https://bugs.llvm.org/show_bug.cgi?id=47194">47194</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Broadcasting the high word in AVX2
          </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>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>david.bolvansky@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>From
<a href="https://stackoverflow.com/questions/57505111/broadcasting-the-high-word-in-avx2">https://stackoverflow.com/questions/57505111/broadcasting-the-high-word-in-avx2</a>:

#include <immintrin.h>

__m256i bcast_mse(__m256i v) {
    __m256i temp = _mm256_permute2x128_si256(v, v, 0x11);
    __m256i ctrl = _mm256_set_epi8( 
        15, 14, 15, 14, 15, 14, 15, 14,
        15, 14, 15, 14, 15, 14, 15, 14,
        15, 14, 15, 14, 15, 14, 15, 14,
        15, 14, 15, 14, 15, 14, 15, 14
    ); 
    return _mm256_shuffle_epi8(temp, ctrl);
}

Clang -O3 -mavx2:
bcast_mse(long long __vector(4)):                      # @bcast_mse(long long
__vector(4))
        vpshufhw        ymm0, ymm0, 255                 # ymm0 =
ymm0[0,1,2,3,7,7,7,7,8,9,10,11,15,15,15,15]
        vpshufd ymm0, ymm0, 170                 # ymm0 = ymm0[2,2,2,2,6,6,6,6]
        vpermq  ymm0, ymm0, 170                 # ymm0 = ymm0[2,2,2,2]
        ret

GCC/ICC -O3 -mavx2:
bcast_mse(__m256i):
        vperm2i128 ymm1, ymm0, ymm0, 17                         #4.20
        vpshufb   ymm0, ymm1, YMMWORD PTR .L_2il0floatpacket.0[rip] #11.12
        ret                                                     #11.12
.L_2il0floatpacket.0:
        .long  
0x0f0e0f0e,0x0f0e0f0e,0x0f0e0f0e,0x0f0e0f0e,0x0f0e0f0e,0x0f0e0f0e,0x0f0e0f0e,0x0f0e0f0e


Godbolt:
<a href="https://godbolt.org/z/cWb9Po">https://godbolt.org/z/cWb9Po</a></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>