Skip to content

Commit 96ab083

Browse files
Lian WangLian Wang
Lian Wang
authored and
Lian Wang
committed
[RISCV] Support VECTOR_REVERSE mask operation.
Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D128627
1 parent 3c126d5 commit 96ab083

File tree

2 files changed

+599
-30
lines changed

2 files changed

+599
-30
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
525525
setOperationAction(
526526
{ISD::VP_FPTOSI, ISD::VP_FPTOUI, ISD::VP_TRUNCATE, ISD::VP_SETCC}, VT,
527527
Custom);
528+
setOperationAction(ISD::VECTOR_REVERSE, VT, Custom);
528529
}
529530

530531
for (MVT VT : IntVecVTs) {
@@ -5638,6 +5639,12 @@ SDValue RISCVTargetLowering::lowerVECTOR_REVERSE(SDValue Op,
56385639
SelectionDAG &DAG) const {
56395640
SDLoc DL(Op);
56405641
MVT VecVT = Op.getSimpleValueType();
5642+
if (VecVT.getVectorElementType() == MVT::i1) {
5643+
MVT WidenVT = MVT::getVectorVT(MVT::i8, VecVT.getVectorElementCount());
5644+
SDValue Op1 = DAG.getNode(ISD::ZERO_EXTEND, DL, WidenVT, Op.getOperand(0));
5645+
SDValue Op2 = DAG.getNode(ISD::VECTOR_REVERSE, DL, WidenVT, Op1);
5646+
return DAG.getNode(ISD::TRUNCATE, DL, VecVT, Op2);
5647+
}
56415648
unsigned EltSize = VecVT.getScalarSizeInBits();
56425649
unsigned MinSize = VecVT.getSizeInBits().getKnownMinValue();
56435650
unsigned VectorBitsMax = Subtarget.getRealMaxVLen();

0 commit comments

Comments
 (0)