Skip to content

Commit 7a6d150

Browse files
authored
[RISCV] Reorder insert_subvector and bitcast in getDeinterleaveShiftAndTrunc. (llvm#127258)
Put the bitcast before the insert_subvector. It's more likely the insert subvector can be combined with other nodes. The insert_subvector is only needed sometimes, and I'm considering reusing this function which might require pulling the insert_subvector out.
1 parent 34cf04b commit 7a6d150

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4660,10 +4660,10 @@ static SDValue getDeinterleaveShiftAndTrunc(const SDLoc &DL, MVT VT,
46604660
SDValue Res = DAG.getNode(ISD::SRL, DL, WideSrcVT, Src,
46614661
DAG.getConstant(Shift, DL, WideSrcVT));
46624662
Res = DAG.getNode(ISD::TRUNCATE, DL, ResVT, Res);
4663-
MVT IntVT = VT.changeVectorElementTypeToInteger();
4664-
Res = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, IntVT, DAG.getUNDEF(IntVT), Res,
4665-
DAG.getVectorIdxConstant(0, DL));
4666-
return DAG.getBitcast(VT, Res);
4663+
MVT CastVT = ResVT.changeVectorElementType(VT.getVectorElementType());
4664+
Res = DAG.getBitcast(CastVT, Res);
4665+
return DAG.getNode(ISD::INSERT_SUBVECTOR, DL, VT, DAG.getUNDEF(VT), Res,
4666+
DAG.getVectorIdxConstant(0, DL));
46674667
}
46684668

46694669
// Lower the following shuffle to vslidedown.

0 commit comments

Comments
 (0)