Skip to content

Commit a04588e

Browse files
aankit-caaankit-quic
authored andcommitted
[HEXAGON] Fix hvx-isel for extract_subvector op (llvm#129672)
Fixes a crash with extract_subvectors in Hexagon backend seen when the source vector is a vector-pair and result vector is not hvx vector size. LLVM Issue: llvm#128775 Fixes llvm#128775 --------- Co-authored-by: aankit-quic <[email protected]>
1 parent 96e401c commit a04588e

File tree

4 files changed

+302
-268
lines changed

4 files changed

+302
-268
lines changed

llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,11 +1265,15 @@ HexagonTargetLowering::extractHvxSubvectorReg(SDValue OrigOp, SDValue VecV,
12651265
// the subvector of interest. The subvector will never overlap two single
12661266
// vectors.
12671267
if (isHvxPairTy(VecTy)) {
1268-
if (Idx * ElemWidth >= 8*HwLen)
1268+
unsigned SubIdx = Hexagon::vsub_lo;
1269+
if (Idx * ElemWidth >= 8 * HwLen) {
1270+
SubIdx = Hexagon::vsub_hi;
12691271
Idx -= VecTy.getVectorNumElements() / 2;
1272+
}
12701273

1271-
VecV = OrigOp;
1272-
if (typeSplit(VecTy).first == ResTy)
1274+
VecTy = typeSplit(VecTy).first;
1275+
VecV = DAG.getTargetExtractSubreg(SubIdx, dl, VecTy, VecV);
1276+
if (VecTy == ResTy)
12731277
return VecV;
12741278
}
12751279

0 commit comments

Comments
 (0)