forked from OSchip/llvm-project
[X86] When inserting into the upper bits of a vXi1 vector, make sure we shift enough bits if we widened the vector.
We may need to widen the vector to make the shifts legal, but if we do that we need to make sure we shift left/right after accounting for the new size. If not we can't guarantee we are shifting in zeros. The test cases affected actually show cases where we should move the shifts all together, but that's another problem. llvm-svn: 320248
This commit is contained in:
parent
ba23343a45
commit
6504a8f888
|
@ -5099,7 +5099,8 @@ static SDValue insert1BitVector(SDValue Op, SelectionDAG &DAG,
|
|||
// Zero upper bits of the Vec
|
||||
WideSubVec = DAG.getNode(X86ISD::KSHIFTL, dl, WideOpVT, WideSubVec,
|
||||
DAG.getConstant(IdxVal, dl, MVT::i8));
|
||||
SDValue ShiftBits = DAG.getConstant(SubVecNumElems, dl, MVT::i8);
|
||||
NumElems = WideOpVT.getVectorNumElements();
|
||||
SDValue ShiftBits = DAG.getConstant(NumElems - IdxVal, dl, MVT::i8);
|
||||
Vec = DAG.getNode(ISD::INSERT_SUBVECTOR, dl, WideOpVT, Undef, Vec, ZeroIdx);
|
||||
Vec = DAG.getNode(X86ISD::KSHIFTL, dl, WideOpVT, Vec, ShiftBits);
|
||||
Vec = DAG.getNode(X86ISD::KSHIFTR, dl, WideOpVT, Vec, ShiftBits);
|
||||
|
|
|
@ -79,8 +79,8 @@ define <4 x i1> @test5(<2 x i1> %a, <2 x i1>%b) {
|
|||
; CHECK-NEXT: vpsllq $63, %xmm1, %xmm0
|
||||
; CHECK-NEXT: vptestmq %xmm0, %xmm0, %k1
|
||||
; CHECK-NEXT: kshiftlb $2, %k1, %k1
|
||||
; CHECK-NEXT: kshiftlb $2, %k0, %k0
|
||||
; CHECK-NEXT: kshiftrb $2, %k0, %k0
|
||||
; CHECK-NEXT: kshiftlb $6, %k0, %k0
|
||||
; CHECK-NEXT: kshiftrb $6, %k0, %k0
|
||||
; CHECK-NEXT: korb %k1, %k0, %k0
|
||||
; CHECK-NEXT: vpmovm2d %k0, %xmm0
|
||||
; CHECK-NEXT: retq
|
||||
|
@ -97,8 +97,8 @@ define <16 x i1> @test6(<2 x i1> %a, <2 x i1>%b) {
|
|||
; CHECK-NEXT: vpsllq $63, %xmm1, %xmm0
|
||||
; CHECK-NEXT: vptestmq %xmm0, %xmm0, %k1
|
||||
; CHECK-NEXT: kshiftlb $2, %k1, %k1
|
||||
; CHECK-NEXT: kshiftlb $2, %k0, %k0
|
||||
; CHECK-NEXT: kshiftrb $2, %k0, %k0
|
||||
; CHECK-NEXT: kshiftlb $6, %k0, %k0
|
||||
; CHECK-NEXT: kshiftrb $6, %k0, %k0
|
||||
; CHECK-NEXT: korb %k1, %k0, %k0
|
||||
; CHECK-NEXT: vpmovm2b %k0, %xmm0
|
||||
; CHECK-NEXT: retq
|
||||
|
|
Loading…
Reference in New Issue