[llvm-bugs] [Bug 34357] New: [X86][AVX512] Use of different granularity broadcast prevents combining the mask inside the instruction.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 29 04:53:10 PDT 2017


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

            Bug ID: 34357
           Summary: [X86][AVX512] Use of different granularity broadcast
                    prevents combining the mask inside 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

vector broadcasts of type <2 x float> or <2 x i32> don't select the
vbroadcastf32x2 and vbroadcasti32x2 instructions. Instead they select
vbroadcastsd and vpbroadcastq (respectively).

This prevents the mask (if exists) to be combined inside the broadcast
instruction (because of the different granularity between the mask and selected
instruction), which results in an extra blend or mov instruction.

Reproducer:

define <8 x float> @test_masked_z_2xfloat_to_8xfloat_mask1(<8 x float> %vec) {
   %shuf = shufflevector <8 x float> %vec, <8 x float> undef, <8 x i32> <i32 0,
i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1>
   %res = select <8 x i1> <i1 0, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 0>, <8
x float> %shuf, <8 x float> zeroinitializer
   ret <8 x float> %res 
 }

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

LLVM emits:
  vbroadcastsd %xmm0, %ymm0
  movb $126, %al
  kmovd %eax, %k1
  vmovaps %ymm0, %ymm0 {%k1} {z}
  retq

While it can be replaced with:
  movb $126, %al
  kmovd %eax, %k1
  vbroadcastf32x2 %xmm0, %ymm0 {%k1} {z}

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


More information about the llvm-bugs mailing list