[llvm-bugs] [Bug 31305] New: Incorrect code generated for llvm.masked.store <2 x i1> with a variable mask
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Dec 7 00:25:30 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=31305
Bug ID: 31305
Summary: Incorrect code generated for llvm.masked.store <2 x
i1> with a variable mask
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
define void @unmasked(<2 x i1> %x, <2 x i1>* %ptr) nounwind {
store <2 x i1> %x, <2 x i1>* %ptr
ret void
}
define void @masked_const(<2 x i1> %x, <2 x i1>* %ptr) nounwind {
call void @llvm.masked.store.v2i1.p0v2i1(<2 x i1> %x, <2 x i1>* %ptr, i32 0,
<2 x i1> <i1 1, i1 1>)
ret void
}
For both functions above we generate:
llc -mcpu=skx
vpsllq $63, %xmm0, %xmm0
vptestmq %xmm0, %xmm0, %k0
kmovb %k0, (%rdi)
retq
But in the case of a variable mask:
define void @masked_var(<2 x i1> %x, <2 x i1>* %ptr) nounwind {
call void @llvm.masked.store.v2i1.p0v2i1(<2 x i1> %x, <2 x i1>* %ptr, i32 0,
<2 x i1> %x)
ret void
}
the generated code stores each vector element in a distinct byte:
vpsllq $63, %xmm0, %xmm0
vptestmq %xmm0, %xmm0, %k0
kshiftlw $15, %k0, %k1
kshiftrw $15, %k1, %k1
kmovw %k1, %eax
andl $1, %eax
testb %al, %al
je .LBB2_2
# BB#1: # %cond.store
kmovb %k1, (%rdi)
.LBB2_2: # %else
kshiftlw $14, %k0, %k0
kshiftrw $15, %k0, %k0
kmovw %k0, %eax
andl $1, %eax
testb %al, %al
je .LBB2_4
# BB#3: # %cond.store1
kmovb %k0, 1(%rdi)
.LBB2_4: # %else2
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/20161207/e714a6f2/attachment.html>
More information about the llvm-bugs
mailing list