[llvm-bugs] [Bug 30563] New: [AVX512F] Suboptimal code generated for a _mm_mask_store_sd expansion

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 29 08:15:59 PDT 2016


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

            Bug ID: 30563
           Summary: [AVX512F] Suboptimal code generated for a
                    _mm_mask_store_sd expansion
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            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

We currently do not support the AVX512F _mm_mask_store_sd
[https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mask_store_sd]
intrinics, but a reasonable expansion of this intrinsics to LLVM IR may be:

define void @_mm_mask_store_sd(double* nocapture %__W, i8 zeroext %__U, <2 x
double> %__A) local_unnamed_addr {
 entry:
   %tobool.i = trunc i8 %__U to i1
   %mask = insertelement <2 x i1> <i1 undef, i1 false>, i1 %tobool.i, i32 0
   %V = bitcast double * %__W to <2 x double>*
   call void @llvm.masked.store.v2f64.p0v2f64(<2 x double> %__A, <2 x double>*
%V, i32 16, <2 x i1> %mask)
   ret void
 }
 declare void @llvm.masked.store.v2f64.p0v2f64(<2 x double>, <2 x double>*,
i32, <2 x i1>)

which should be lowered to:
==========================================
        kmovw     %esi, %k1
        vmovsd    %xmm0, (%rdi){%k1}
==========================================

'llc -mcpu=knl' generates:
==========================================
        vmovq   %rsi, %xmm1
        vpsllq  $63, %xmm1, %xmm1
        vpsrad  $31, %xmm1, %xmm1
        vpshufd $245, %xmm1, %xmm1      # xmm1 = xmm1[1,1,3,3]
        vmaskmovpd      %xmm0, %xmm1, (%rdi)
        retq
==========================================

'llc -mcpu=skylake-avx512' generates:
==========================================
        andl    $1, %esi
        kmovw   %esi, %k0
        kxorw   %k0, %k0, %k1
        kshiftrw        $1, %k1, %k1
        kshiftlw        $1, %k1, %k1
        korw    %k0, %k1, %k1
        vmovapd %xmm0, (%rdi) {%k1}
        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/20160929/a6d0c3c1/attachment.html>


More information about the llvm-bugs mailing list