[llvm-bugs] [Bug 34359] New: [X86][AVX512] 128-bit shuffles of 256-bit vectors prefer AVX2 instructions instead of AVX512 preventing combining masks into the instruction

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 29 05:49:24 PDT 2017


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

            Bug ID: 34359
           Summary: [X86][AVX512] 128-bit shuffles of 256-bit vectors
                    prefer AVX2 instructions instead of AVX512 preventing
                    combining masks into the 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

128-bit shuffles of 256-bit vectors prefer the perm2f128 and perm2i128 AVX2
instructions which cannot accept a merge-mask.

Selecting AVX512 instructions like vshufi64x2, vshufi32x4, vshuff64x2 would
enable combining the mask into them replacing the extra blend instruction from
the AVX2 sequence.

Reproducer (for <4 x double> type):

define <4 x double> @test_4xdouble_masked_shuff_mask0(<4 x double> %vec1, <4 x
double> %vec2, <4 x double> %vec3) {
   %shuf = shufflevector <4 x double> %vec1, <4 x double> %vec2, <4 x i32> <i32
2, i32 3, i32 4, i32 5>
   %res = select <4 x i1> <i1 0, i1 1, i1 1, i1 1>, <4 x double> %shuf, <4 x
double> %vec3
   ret <4 x double> %res 
 }

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

LLVM emits (showing 3.81 throughput on IACA tool):
  vperm2f128  $33, %ymm1, %ymm0, %ymm0
  movb $14, %al
  kmovd %eax, %k1
  vblendmpd %ymm0, %ymm2, %ymm0 {%k1}
  retq 

While it can be replaced with (showing 2.86 throughput on IACA tool):
  movb $126, %al
  kmovd %eax, %k1
  vshuff64x2 $1, %ymm1, %ymm0, %ymm2 {%k1}
  vmovapd %ymm2, %ymm0

** 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/20170829/9e5e3e1e/attachment.html>


More information about the llvm-bugs mailing list