<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 - Better codegen for AVX512 scatter"
   href="https://bugs.llvm.org/show_bug.cgi?id=47572">47572</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Better codegen for AVX512 scatter
          </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>Windows NT
          </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>#include <immintrin.h>
void sct(int *data) {
  _mm512_mask_i32scatter_epi32(data - 1, 0xffff, _mm512_set1_epi32(1),
_mm512_set1_epi32(1), 1);
}

-O3 -march=skylake-avx512


Clang:
.LCPI0_0:
        .long   1                               # 0x1
sct(int*):                               # @sct(int*)
        add     rdi, -4
        kxnorw  k1, k0, k0
        vpbroadcastd    zmm0, dword ptr [rip + .LCPI0_0] # zmm0 =
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
        vpscatterdd     zmmword ptr [rdi + zmm0] {k1}, zmm0
        vzeroupper
        ret


ICC:
sct(int*):
        vmovups   zmm0, ZMMWORD PTR .L_2il0floatpacket.0[rip]   #3.3
        vpcmpeqb  k1, xmm0, xmm0                                #3.3
        vpscatterdd DWORD PTR [-4+rdi+zmm0]{k1}, zmm0           #3.3
        vzeroupper                                              #4.1
        ret                                                     #4.1
.L_2il0floatpacket.0:
        .long  
0x00000001,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001

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