<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 - [SLP] Allow vectorization for vec4 ops for avx2+"
   href="https://bugs.llvm.org/show_bug.cgi?id=47576">47576</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[SLP] Allow vectorization for vec4 ops for 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>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>Scalar Optimizations
          </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>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>typedef unsigned char pixel;
typedef unsigned short dctcoef;

void pixel_sub_wxh( dctcoef *__restrict diff, pixel *__restrict pix1, int
i_pix1, pixel *__restrict pix2, int i_pix2 )
{
    diff[0] = pix1[0] + pix2[0];
    diff[1] = pix1[1] + pix2[1];
    diff[2] = pix1[2] + pix2[2];
    diff[3] = pix1[3] + pix2[3];

}

Clang -mavx2 -O3 :

pixel_sub_wxh(unsigned short*, unsigned char*, int, unsigned char*, int):      
      # @pixel_sub_wxh(unsigned short*, unsigned char*, int, unsigned char*,
int)
        movzx   eax, byte ptr [rsi]
        movzx   edx, byte ptr [rcx]
        add     edx, eax
        mov     word ptr [rdi], dx
        movzx   eax, byte ptr [rsi + 1]
        movzx   edx, byte ptr [rcx + 1]
        add     edx, eax
        mov     word ptr [rdi + 2], dx
        movzx   eax, byte ptr [rsi + 2]
        movzx   edx, byte ptr [rcx + 2]
        add     edx, eax
        mov     word ptr [rdi + 4], dx
        movzx   eax, byte ptr [rsi + 3]
        movzx   ecx, byte ptr [rcx + 3]
        add     ecx, eax
        mov     word ptr [rdi + 6], cx
        ret

ICC -mavx2 -O3 (since 19.00) :
pixel_sub_wxh(unsigned short*, unsigned char*, int, unsigned char*, int):
        vmovd     xmm0, DWORD PTR [rsi]                         #6.15
        vmovd     xmm1, DWORD PTR [rcx]                         #6.25
        vpmovzxbw xmm0, xmm0                                    #6.15
        vpmovzxbw xmm1, xmm1                                    #6.25
        vpaddw    xmm2, xmm0, xmm1                              #6.25
        vmovq     QWORD PTR [rdi], xmm2                         #6.5
        ret     


<a href="https://gcc.godbolt.org/z/a9rxaM">https://gcc.godbolt.org/z/a9rxaM</a>

Cost model issue?</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>