diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2016-05-30 17:38:43 +0000 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2016-05-30 17:38:43 +0000 |
commit | 797147aa323e434fb3cc56638d37c9970a1cbff6 (patch) | |
tree | b9dd12d620d1ed8f0a93d7a1c705c4673c8666f3 | |
parent | 1a83f526a248e52e8b559c3d3bc8ac236d776924 (diff) | |
download | llvm-797147aa323e434fb3cc56638d37c9970a1cbff6.tar.gz |
Merging r266438:
------------------------------------------------------------------------
r266438 | niravd | 2016-04-15 08:01:38 -0700 (Fri, 15 Apr 2016) | 15 lines
Fix typing on generated LXV2DX/STXV2DX instructions
[PPC] Previously when casting generic loads to LXV2DX/ST instructions we
would leave the original load return type in place allowing for an
assertion failure when we merge two equivalent LXV2DX nodes with
different types.
This fixes PR27350.
Reviewers: nemanjai
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D19133
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_38@271217 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/PowerPC/PPCISelLowering.cpp | 28 | ||||
-rw-r--r-- | test/CodeGen/PowerPC/pr27350.ll | 26 |
2 files changed, 49 insertions, 5 deletions
diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index af9ad077a7ce..b1b3fe76b9b6 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -10109,13 +10109,24 @@ SDValue PPCTargetLowering::expandVSXLoadForLE(SDNode *N, MVT VecTy = N->getValueType(0).getSimpleVT(); SDValue LoadOps[] = { Chain, Base }; SDValue Load = DAG.getMemIntrinsicNode(PPCISD::LXVD2X, dl, - DAG.getVTList(VecTy, MVT::Other), - LoadOps, VecTy, MMO); + DAG.getVTList(MVT::v2f64, MVT::Other), + LoadOps, MVT::v2f64, MMO); + DCI.AddToWorklist(Load.getNode()); Chain = Load.getValue(1); - SDValue Swap = DAG.getNode(PPCISD::XXSWAPD, dl, - DAG.getVTList(VecTy, MVT::Other), Chain, Load); + SDValue Swap = DAG.getNode( + PPCISD::XXSWAPD, dl, DAG.getVTList(MVT::v2f64, MVT::Other), Chain, Load); DCI.AddToWorklist(Swap.getNode()); + + // Add a bitcast if the resulting load type doesn't match v2f64. + if (VecTy != MVT::v2f64) { + SDValue N = DAG.getNode(ISD::BITCAST, dl, VecTy, Swap); + DCI.AddToWorklist(N.getNode()); + // Package {bitcast value, swap's chain} to match Load's shape. + return DAG.getNode(ISD::MERGE_VALUES, dl, DAG.getVTList(VecTy, MVT::Other), + N, Swap.getValue(1)); + } + return Swap; } @@ -10159,8 +10170,15 @@ SDValue PPCTargetLowering::expandVSXStoreForLE(SDNode *N, SDValue Src = N->getOperand(SrcOpnd); MVT VecTy = Src.getValueType().getSimpleVT(); + + // All stores are done as v2f64 and possible bit cast. + if (VecTy != MVT::v2f64) { + Src = DAG.getNode(ISD::BITCAST, dl, MVT::v2f64, Src); + DCI.AddToWorklist(Src.getNode()); + } + SDValue Swap = DAG.getNode(PPCISD::XXSWAPD, dl, - DAG.getVTList(VecTy, MVT::Other), Chain, Src); + DAG.getVTList(MVT::v2f64, MVT::Other), Chain, Src); DCI.AddToWorklist(Swap.getNode()); Chain = Swap.getValue(1); SDValue StoreOps[] = { Chain, Swap, Base }; diff --git a/test/CodeGen/PowerPC/pr27350.ll b/test/CodeGen/PowerPC/pr27350.ll new file mode 100644 index 000000000000..a3f35b2e41a6 --- /dev/null +++ b/test/CodeGen/PowerPC/pr27350.ll @@ -0,0 +1,26 @@ +; RUN: llc -mcpu=ppc64le -mtriple=powerpc64le-unknown-linux-gnu < %s + +; Function Attrs: argmemonly nounwind +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #0 + +; Function Attrs: nounwind +define internal fastcc void @foo() unnamed_addr #1 align 2 { +entry: + call void @llvm.memcpy.p0i8.p0i8.i64(i8* undef, i8* null, i64 16, i32 8, i1 false) + %0 = load <2 x i64>, <2 x i64>* null, align 8 + %1 = extractelement <2 x i64> %0, i32 1 + %.fca.1.insert159.i = insertvalue [2 x i64] undef, i64 %1, 1 + tail call fastcc void @bar([2 x i64] undef, [2 x i64] %.fca.1.insert159.i) #2 + unreachable +} + +; Function Attrs: nounwind +declare fastcc void @bar([2 x i64], [2 x i64]) unnamed_addr #1 align 2 + +attributes #0 = { argmemonly nounwind } +attributes #1 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="ppc64le" "target-features"="+altivec,+bpermd,+crypto,+direct-move,+extdiv,+power8-vector,+vsx,-qpx" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #2 = { nounwind } + +!llvm.ident = !{!0} + +!0 = !{!"clang version 3.9.0 (trunk) (llvm/trunk 266222)"} |