[llvm-bugs] [Bug 31657] New: AVX-512: Missed opportunity of folding masked-loads

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 16 10:12:09 PST 2017


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

            Bug ID: 31657
           Summary: AVX-512: Missed opportunity of folding masked-loads
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: zvi.rackover at intel.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

For the following case:

define <16 x float> @masked_loads_add(<16 x float>* %pA, <16 x float>* %pB, <16
x float>* %pC, i16 %D) {
   %Mask = bitcast i16 %D to <16 x i1>
   %wide.masked.load = call <16 x float> @llvm.masked.load.v16f32.p0v16f32(<16
x float>* %pA, i32 4, <16 x i1> %Mask, <16 x float> undef)
   %wide.masked.load11 = call <16 x float>
@llvm.masked.load.v16f32.p0v16f32(<16 x float>* %pB, i32 4, <16 x i1> %Mask,
<16 x float> undef)
   %Add = fadd <16 x float> %wide.masked.load, %wide.masked.load11
   ret <16 x float> %Add
}

llc -mcpu=skylake-avx512 generates:
        kmovw   %ecx, %k1
        vmovups (%rdi), %zmm0 {%k1} {z}
        vmovups (%rsi), %zmm1 {%k1} {z}
        vaddps  %zmm1, %zmm0, %zmm0
        retq

We could do better if we folded the masked-load into the add:
        kmovw   %ecx, %k1
        vmovaps (%rdi), %zmm0 {%k1} {z}
        vaddps  (%rsi), %zmm0, %zmm0 {%k1} {z}
        retq

-- 
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/20170116/597de9cd/attachment.html>


More information about the llvm-bugs mailing list