llvm.org GIT mirror llvm / c005469
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320248 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 1 year, 11 months ago
2 changed file(s) with 6 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
50985098 // Zero upper bits of the Vec
50995099 WideSubVec = DAG.getNode(X86ISD::KSHIFTL, dl, WideOpVT, WideSubVec,
51005100 DAG.getConstant(IdxVal, dl, MVT::i8));
5101 SDValue ShiftBits = DAG.getConstant(SubVecNumElems, dl, MVT::i8);
5101 NumElems = WideOpVT.getVectorNumElements();
5102 SDValue ShiftBits = DAG.getConstant(NumElems - IdxVal, dl, MVT::i8);
51025103 Vec = DAG.getNode(ISD::INSERT_SUBVECTOR, dl, WideOpVT, Undef, Vec, ZeroIdx);
51035104 Vec = DAG.getNode(X86ISD::KSHIFTL, dl, WideOpVT, Vec, ShiftBits);
51045105 Vec = DAG.getNode(X86ISD::KSHIFTR, dl, WideOpVT, Vec, ShiftBits);
7878 ; CHECK-NEXT: vpsllq $63, %xmm1, %xmm0
7979 ; CHECK-NEXT: vptestmq %xmm0, %xmm0, %k1
8080 ; CHECK-NEXT: kshiftlb $2, %k1, %k1
81 ; CHECK-NEXT: kshiftlb $2, %k0, %k0
82 ; CHECK-NEXT: kshiftrb $2, %k0, %k0
81 ; CHECK-NEXT: kshiftlb $6, %k0, %k0
82 ; CHECK-NEXT: kshiftrb $6, %k0, %k0
8383 ; CHECK-NEXT: korb %k1, %k0, %k0
8484 ; CHECK-NEXT: vpmovm2d %k0, %xmm0
8585 ; CHECK-NEXT: retq
9696 ; CHECK-NEXT: vpsllq $63, %xmm1, %xmm0
9797 ; CHECK-NEXT: vptestmq %xmm0, %xmm0, %k1
9898 ; CHECK-NEXT: kshiftlb $2, %k1, %k1
99 ; CHECK-NEXT: kshiftlb $2, %k0, %k0
100 ; CHECK-NEXT: kshiftrb $2, %k0, %k0
99 ; CHECK-NEXT: kshiftlb $6, %k0, %k0
100 ; CHECK-NEXT: kshiftrb $6, %k0, %k0
101101 ; CHECK-NEXT: korb %k1, %k0, %k0
102102 ; CHECK-NEXT: vpmovm2b %k0, %xmm0
103103 ; CHECK-NEXT: retq