<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 - [AVX512][Regression] Failed to use vpsubusw"
   href="https://bugs.llvm.org/show_bug.cgi?id=48223">48223</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AVX512][Regression] Failed to use vpsubusw
          </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, pengfei.wang@intel.com, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>#define SIZE 32
#define WSIZE 64
unsigned short head[SIZE] __attribute__((aligned(64)));

void f(void)
{
  for (unsigned n = 0; n < SIZE; ++n) {
    unsigned short m = head[n];
    head[n] = (unsigned short)(m >= WSIZE ? m-WSIZE : 0);
  }
}

Clang 11 or newer with -O3 -mavx512f:

f():                                  # @f()
        vmovdqa ymm0, ymmword ptr [rip + .LCPI0_0] # ymm0 =
[64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64]
        vmovdqa ymm1, ymmword ptr [rip + head+32]
        vpmaxuw ymm2, ymm1, ymm0
        vpcmpeqw        ymm2, ymm1, ymm2
        vmovdqa ymm3, ymmword ptr [rip + head]
        vpmaxuw ymm0, ymm3, ymm0
        vpcmpeqw        ymm0, ymm3, ymm0
        vinserti64x4    zmm0, zmm0, ymm2, 1
        vmovdqa ymm2, ymmword ptr [rip + .LCPI0_1] # ymm2 =
[65472,65472,65472,65472,65472,65472,65472,65472,65472,65472,65472,65472,65472,65472,65472,65472]
        vpaddw  ymm1, ymm1, ymm2
        vpaddw  ymm2, ymm3, ymm2
        vinserti64x4    zmm1, zmm2, ymm1, 1
        vpandq  zmm0, zmm0, zmm1
        vmovdqa64       zmmword ptr [rip + head], zmm0
        vzeroupper
        ret

Clang 10 or ICC -O3 -mavx512f:
f():                                  # @f()
        vmovdqa ymm0, ymmword ptr [rip + head]
        vmovdqa ymm1, ymmword ptr [rip + head+32]
        vmovdqa ymm2, ymmword ptr [rip + .LCPI0_0] # ymm2 =
[64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64]
        vpsubusw        ymm1, ymm1, ymm2
        vpsubusw        ymm0, ymm0, ymm2
        vmovdqa ymmword ptr [rip + head], ymm0
        vmovdqa ymmword ptr [rip + head+32], ymm1
        vzeroupper
        ret</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>