summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff options
context:
space:
mode:
authorJonas Paulsson <paulsson@linux.vnet.ibm.com>2018-02-02 08:48:02 +0000
committerJonas Paulsson <paulsson@linux.vnet.ibm.com>2018-02-02 08:48:02 +0000
commit422dfbf7cc4d8cb1a61e6b84bbed5464ea3155c5 (patch)
treefafd2095c21c3802847e237009b9ae96bc0ed568 /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
parent659cffeec4663adca85940f91a43b29e8bd038fd (diff)
downloadbcm5719-llvm-422dfbf7cc4d8cb1a61e6b84bbed5464ea3155c5.tar.gz
bcm5719-llvm-422dfbf7cc4d8cb1a61e6b84bbed5464ea3155c5.zip
[SelectionDAG] Consider endianness in scalarizeVectorStore().
When handling vectors with non byte-sized elements, reverse the order of the elements in the built integer if the target is Big-Endian. SystemZ tests updated. Review: Eli Friedman, Ulrich Weigand. https://reviews.llvm.org/D42786 llvm-svn: 324063
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index ed5681f1eff..1b04ab8cfc9 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -3457,9 +3457,12 @@ SDValue TargetLowering::scalarizeVectorStore(StoreSDNode *ST,
DAG.getConstant(Idx, SL, IdxVT));
SDValue Trunc = DAG.getNode(ISD::TRUNCATE, SL, MemSclVT, Elt);
SDValue ExtElt = DAG.getNode(ISD::ZERO_EXTEND, SL, IntVT, Trunc);
+ unsigned ShiftIntoIdx =
+ (DAG.getDataLayout().isBigEndian() ? (NumElem - 1) - Idx : Idx);
SDValue ShiftAmount =
- DAG.getConstant(Idx * MemSclVT.getSizeInBits(), SL, IntVT);
- SDValue ShiftedElt = DAG.getNode(ISD::SHL, SL, IntVT, ExtElt, ShiftAmount);
+ DAG.getConstant(ShiftIntoIdx * MemSclVT.getSizeInBits(), SL, IntVT);
+ SDValue ShiftedElt =
+ DAG.getNode(ISD::SHL, SL, IntVT, ExtElt, ShiftAmount);
CurrVal = DAG.getNode(ISD::OR, SL, IntVT, CurrVal, ShiftedElt);
}
OpenPOWER on IntegriCloud