mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-02 07:32:52 +00:00
Use the splat index to generate the desired shuffle. Otherwise we
could only get undefs and the vector shuffle becomes an undef, generating wrong code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137295 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
586272d67c
commit
a5134a0ea3
@ -4125,15 +4125,15 @@ static SDValue PromoteVectorToScalarSplat(ShuffleVectorSDNode *SV,
|
||||
int NumElems = SrcVT.getVectorNumElements();
|
||||
|
||||
assert(SrcVT.is256BitVector() && "unknown howto handle vector type");
|
||||
assert(SV->isSplat() && "shuffle must be a splat");
|
||||
|
||||
SmallVector<int, 4> Mask;
|
||||
for (int i = 0; i < NumElems/2; ++i)
|
||||
Mask.push_back(SV->getMaskElt(i));
|
||||
int SplatIdx = SV->getSplatIndex();
|
||||
const int Mask[4] = { SplatIdx, SplatIdx, SplatIdx, SplatIdx };
|
||||
|
||||
EVT SVT = EVT::getVectorVT(*DAG.getContext(), SrcVT.getVectorElementType(),
|
||||
NumElems/2);
|
||||
SDValue SV1 = DAG.getVectorShuffle(SVT, dl, V1.getOperand(1),
|
||||
DAG.getUNDEF(SVT), &Mask[0]);
|
||||
DAG.getUNDEF(SVT), Mask);
|
||||
SDValue InsV = Insert128BitVector(DAG.getUNDEF(SrcVT), SV1,
|
||||
DAG.getConstant(0, MVT::i32), DAG, dl);
|
||||
|
||||
|
@ -77,3 +77,13 @@ __load_and_broadcast_32.exit1249: ; preds = %load.i1247, %for_ex
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: vpshufd $0
|
||||
; CHECK-NEXT: vinsertf128 $1
|
||||
define <8 x float> @funcF(i32* %ptr) nounwind {
|
||||
%val = load i32* %ptr, align 4
|
||||
%ret6 = insertelement <8 x i32> undef, i32 %val, i32 6
|
||||
%ret7 = insertelement <8 x i32> %ret6, i32 %val, i32 7
|
||||
%tmp = bitcast <8 x i32> %ret7 to <8 x float>
|
||||
ret <8 x float> %tmp
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user