<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 - codegen regression"
   href="https://bugs.llvm.org/show_bug.cgi?id=46899">46899</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>avx512 - codegen regression
          </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>typedef unsigned char uint8_t;

static inline uint8_t x264_clip_uint8( int x )
{
  return x&(~63) ? (-x)>>7 : x;
}


void mc_weight( uint8_t *__restrict dst, uint8_t *__restrict src)
{
        for( int x = 0; x < 16; x++ )
            dst[x] = x264_clip_uint8(src[x]);
}


Clang 9 -Ofast -march=skylake-avx512

mc_weight(unsigned char*, unsigned char*):    
        vmovdqu xmm0, xmmword ptr [rsi]
        vpmovzxbd       zmm1, xmm0
        vpcmpnleub      k1, xmm0, xmmword ptr [rip + .LCPI0_0]
        vpxor   xmm0, xmm0, xmm0
        vpsubd  zmm0, zmm0, zmm1
        vpsrld  zmm1 {k1}, zmm0, 7
        vpmovdb xmmword ptr [rdi], zmm1
        vzeroupper
        ret


Clang trunk -Ofast -march=skylake-avx512

mc_weight(unsigned char*, unsigned char*):  
        vmovdqu xmm0, xmmword ptr [rsi]
        vpbroadcastq    xmm1, qword ptr [rsi + 8]
        vpmovzxbd       ymm1, xmm1 
        vpcmpltub       k1, xmm0, xmmword ptr [rip + .LCPI0_0]
        vpxor   xmm2, xmm2, xmm2
        vpsubd  ymm3, ymm2, ymm1
        vpsrld  ymm3, ymm3, 7
        kshiftrw        k2, k1, 8
        vmovdqa32       ymm3 {k2}, ymm1
        vpmovzxbd       ymm0, xmm0       
        vpsubd  ymm1, ymm2, ymm0
        vpsrld  ymm1, ymm1, 7
        vpmovdb xmm2, ymm3
        vmovdqa32       ymm1 {k1}, ymm0
        vpmovdb xmm0, ymm1
        vpunpcklqdq     xmm0, xmm0, xmm2 
        vmovdqu xmmword ptr [rdi], xmm0
        vzeroupper
        ret

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