[llvm] r342079 - [Hexagon] Use legalized type for extracted elements in scalarizeShuffle
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 12 13:58:48 PDT 2018
Author: kparzysz
Date: Wed Sep 12 13:58:48 2018
New Revision: 342079
URL: http://llvm.org/viewvc/llvm-project?rev=342079&view=rev
Log:
[Hexagon] Use legalized type for extracted elements in scalarizeShuffle
Scalarization of a shuffle will break up the source vectors into individual
elements, and use them to assemble the resulting vector. An element type of
a legal vector type may not necessarily be a legal scalar type, so make
sure that the extracted values are extended to a legal scalar type.
Modified:
llvm/trunk/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp
Modified: llvm/trunk/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp?rev=342079&r1=342078&r2=342079&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp Wed Sep 12 13:58:48 2018
@@ -1338,9 +1338,11 @@ bool HvxSelector::scalarizeShuffle(Array
MVT SingleTy = getSingleVT(MVT::i8);
SmallVector<SDValue,128> Ops;
+ LLVMContext &Ctx = *DAG.getContext();
+ MVT LegalTy = Lower.getTypeToTransformTo(Ctx, ElemTy).getSimpleVT();
for (int I : Mask) {
if (I < 0) {
- Ops.push_back(ISel.selectUndef(dl, ElemTy));
+ Ops.push_back(ISel.selectUndef(dl, LegalTy));
continue;
}
SDValue Vec;
@@ -1360,7 +1362,7 @@ bool HvxSelector::scalarizeShuffle(Array
}
}
SDValue Idx = DAG.getConstant(M, dl, MVT::i32);
- SDValue Ex = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, ElemTy, {Vec, Idx});
+ SDValue Ex = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, LegalTy, {Vec, Idx});
SDValue L = Lower.LowerOperation(Ex, DAG);
assert(L.getNode());
Ops.push_back(L);
More information about the llvm-commits
mailing list