[llvm-bugs] [Bug 47576] New: [SLP] Allow vectorization for vec4 ops for avx2+

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 18 02:47:52 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47576

            Bug ID: 47576
           Summary: [SLP] Allow vectorization for vec4 ops for avx2+
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

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     


https://gcc.godbolt.org/z/a9rxaM

Cost model issue?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200918/6496b089/attachment-0001.html>


More information about the llvm-bugs mailing list