[llvm-bugs] [Bug 34370] New: [X86][AVX512] suboptimal shuffle sequence instead of one vpermps instruction

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 30 01:31:35 PDT 2017


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

            Bug ID: 34370
           Summary: [X86][AVX512] suboptimal shuffle sequence instead of
                    one vpermps instruction
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: ayman.musa at intel.com
                CC: llvm-bugs at lists.llvm.org

For the following IR:

define <8 x float> @test(<8 x float>* %vp, <8 x float> %vec2) {
   %vec = load <8 x float>, <8 x float>* %vp
   %shuf = shufflevector <8 x float> %vec, <8 x float> undef, <8 x i32> <i32 7,
i32 6, i32 3, i32 0, i32 7, i32 6, i32 3, i32 0>
   %res = select <8 x i1> <i1 1, i1 1, i1 1, i1 0, i1 1, i1 1, i1 0, i1 0>, <8
x float> %shuf, <8 x float> %vec2
   ret <8 x float> %res
 }

>> llc -mcpu=skx <file-name> -o out.s

LLVM emits (showing 3.00 throughput on IACA tool):
     vpermilps   $59, (%rdi), %ymm1 # ymm1 = mem[3,2,3,0,7,6,7,4]
     vpermpd $102, %ymm1, %ymm1      # ymm1 = ymm1[2,1,2,1]
     movb    $55, %al
     kmovd   %eax, %k1
     vmovaps %ymm1, %ymm0 {%k1}
     retq

While it can be replaced with (showing 2.86 throughput on IACA tool):
     vmovaps .LCPI3327_0(%rip), %ymm1 # ymm1 = [7,6,3,0,7,6,3,0]
     movb $55, %al
     kmovd %eax, %k1
     vpermps (%rdi), %ymm1, %ymm0 {%k1}
     retq


** Throughput results from IACA tool => lower is better.

-- 
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/20170830/e61bb9e1/attachment-0001.html>


More information about the llvm-bugs mailing list