[llvm-bugs] [Bug 32546] New: [AVX-512] Missed opportunity to perform k-operations before copying to GPR

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 6 00:26:15 PDT 2017


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

            Bug ID: 32546
           Summary: [AVX-512] Missed opportunity to perform k-operations
                    before copying to GPR
           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 <4 x i64> @foo(<8 x float> %a, <8 x float> %b, <8 x float> %c, <8 x
float> %d) {
 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)
   %and17 = and i8 %1, %0
   %and = zext i8 %and17 to i32
   %2 = insertelement <8 x i32> undef, i32 %and, i32 0
   %vecinit7.i = shufflevector <8 x i32> %2, <8 x i32> undef, <8 x i32>
zeroinitializer
   %3 = bitcast <8 x i32> %vecinit7.i to <4 x i64>
   ret <4 x i64> %3
 }

 declare i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float>, <8 x float>, i32, i8)

llc -mcpu=skx gives:

     vcmpltps    %ymm1, %ymm0, %k0
     kmovb   %k0, %eax
     vcmpltps    %ymm3, %ymm2, %k0
     kmovb   %k0, %ecx
     andb    %al, %cl
     movzbl  %cl, %eax
     vpbroadcastd    %eax, %ymm0
     retq

A better sequence would be:

     vcmpps    $1, %ymm1, %ymm0, %k0
     vcmpps    $1, %ymm3, %ymm2, %k1
     kandw %k0, %k1, %k1
     kmovw     %k1, %edx                      
     vpbroadcastd %edx, %ymm0            
     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/0b477b72/attachment.html>


More information about the llvm-bugs mailing list