[llvm-bugs] [Bug 32547] New: [AVX-512] Missed opportunity to select kunpckbw

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 6 00:50:07 PDT 2017


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

            Bug ID: 32547
           Summary: [AVX-512] Missed opportunity to select kunpckbw
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: zvi.rackover at intel.com
                CC: llvm-bugs at lists.llvm.org

define void @foo2(<8 x float> %a, <8 x float> %b, <8 x float> %c, <8 x float>
%d, float* %p) {
 entry:
   %0 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float> %a, <8 x
float> %b, i32 1, i8 -1)
   %1 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float> %c, <8 x
float> %d, i32 1, i8 -1)
   %conv.i = zext i8 %0 to i16
   %conv.i18 = zext i8 %1 to i16
   %shl = shl nuw i16 %conv.i, 8
   %or = or i16 %shl, %conv.i18
   %2 = bitcast float* %p to <16 x float>*
   %3 = bitcast i16 %or to <16 x i1>
   tail call void @llvm.masked.store.v16f32.p0v16f32(<16 x float>
zeroinitializer, <16 x float>* %2, i32 64, <16 x i1> %3) #4
   ret void
 }

 declare void @llvm.masked.store.v16f32.p0v16f32(<16 x float>, <16 x float>*,
i32, <16 x i1>)

llc -mcpu=skx gives:

     vcmpltps    %ymm1, %ymm0, %k0
     vcmpltps    %ymm3, %ymm2, %k1
     kmovb   %k0, %eax
     kmovb   %k1, %ecx
     shll    $8, %eax
     orl %ecx, %eax
     kmovw   %eax, %k1
     vxorps  %zmm0, %zmm0, %zmm0
     vmovaps %zmm0, (%rdi) {%k1}
     vzeroupper
     retq

A better codegen would be:
     vcmpltps    %ymm1, %ymm0, %k0
     vcmpltps    %ymm3, %ymm2, %k1
     kunpckbw  %k1, %k0, %k2
     vxorps    %zmm0, %zmm0, %zmm0
     vmovups   %zmm0, (%rdi){%k2}
     vzeroupper
     ret

-- 
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/20170406/5794245e/attachment-0001.html>


More information about the llvm-bugs mailing list