[llvm-bugs] [Bug 49931] New: Codegen regression between 10 and 11 with -mprefer-vector-width=512

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 12 05:33:03 PDT 2021


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

            Bug ID: 49931
           Summary: Codegen regression between 10 and 11 with
                    -mprefer-vector-width=512
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, pengfei.wang at intel.com,
                    spatel+llvm at rotateright.com

typedef unsigned char uint8_t;


void foo( uint8_t *__restrict dst, uint8_t *__restrict src )
{
        for( int x = 0; x < 16; x++ )
            dst[x] =  (dst[x]-src[x])>>2;
}

Clang flags: -O3 -mavx512vnni -mprefer-vector-width=512

See the change in the use of ZMM registers.

LLVM 11+:
foo(unsigned char*, unsigned char*):                             #
@foo(unsigned char*, unsigned char*)
        vpmovzxbw       ymm0, xmmword ptr [rdi] # ymm0 =
mem[0],zero,mem[1],zero,mem[2],zero,mem[3],zero,mem[4],zero,mem[5],zero,mem[6],zero,mem[7],zero,mem[8],zero,mem[9],zero,mem[10],zero,mem[11],zero,mem[12],zero,mem[13],zero,mem[14],zero,mem[15],zero
        vpmovzxbw       ymm1, xmmword ptr [rsi] # ymm1 =
mem[0],zero,mem[1],zero,mem[2],zero,mem[3],zero,mem[4],zero,mem[5],zero,mem[6],zero,mem[7],zero,mem[8],zero,mem[9],zero,mem[10],zero,mem[11],zero,mem[12],zero,mem[13],zero,mem[14],zero,mem[15],zero
        vpsubw  ymm0, ymm0, ymm1
        vpsrlw  ymm0, ymm0, 2
        vpmovzxwd       zmm0, ymm0              # zmm0 =
ymm0[0],zero,ymm0[1],zero,ymm0[2],zero,ymm0[3],zero,ymm0[4],zero,ymm0[5],zero,ymm0[6],zero,ymm0[7],zero,ymm0[8],zero,ymm0[9],zero,ymm0[10],zero,ymm0[11],zero,ymm0[12],zero,ymm0[13],zero,ymm0[14],zero,ymm0[15],zero
        vpmovdb xmmword ptr [rdi], zmm0
        vzeroupper
        ret


LLVM 10:
foo(unsigned char*, unsigned char*):                             #
@foo(unsigned char*, unsigned char*)
        vpmovzxbd       zmm0, xmmword ptr [rdi] # zmm0 =
mem[0],zero,zero,zero,mem[1],zero,zero,zero,mem[2],zero,zero,zero,mem[3],zero,zero,zero,mem[4],zero,zero,zero,mem[5],zero,zero,zero,mem[6],zero,zero,zero,mem[7],zero,zero,zero,mem[8],zero,zero,zero,mem[9],zero,zero,zero,mem[10],zero,zero,zero,mem[11],zero,zero,zero,mem[12],zero,zero,zero,mem[13],zero,zero,zero,mem[14],zero,zero,zero,mem[15],zero,zero,zero
        vpmovzxbd       zmm1, xmmword ptr [rsi] # zmm1 =
mem[0],zero,zero,zero,mem[1],zero,zero,zero,mem[2],zero,zero,zero,mem[3],zero,zero,zero,mem[4],zero,zero,zero,mem[5],zero,zero,zero,mem[6],zero,zero,zero,mem[7],zero,zero,zero,mem[8],zero,zero,zero,mem[9],zero,zero,zero,mem[10],zero,zero,zero,mem[11],zero,zero,zero,mem[12],zero,zero,zero,mem[13],zero,zero,zero,mem[14],zero,zero,zero,mem[15],zero,zero,zero
        vpsubd  zmm0, zmm0, zmm1
        vpsrld  zmm0, zmm0, 2
        vpmovdb xmmword ptr [rdi], zmm0
        vzeroupper
        ret

Godbolt:
https://godbolt.org/z/4zPv8rMvP

-- 
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/20210412/8fec06f1/attachment.html>


More information about the llvm-bugs mailing list