-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
| Bugzilla Link | 31305 |
| Version | trunk |
| OS | Windows NT |
| Blocks | #30613 |
| CC | @topperc,@RKSimon |
Extended Description
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