Skip to content

Commit 72f4e65

Browse files
committed
[RISCV] Revise interface of isLegalBitRotate [nfc]
Remove a dead parameter (DAG), and replace the ShuffleVectorSDNode param with the two things we need from the shuffle (mask and VT). There's further room to improve this code, but this gets me what I need for an upcoming patch.
1 parent 4ac79a8 commit 72f4e65

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

+5-9
Original file line numberDiff line numberDiff line change
@@ -5072,21 +5072,17 @@ static SDValue lowerBitreverseShuffle(ShuffleVectorSDNode *SVN,
50725072
return Res;
50735073
}
50745074

5075-
static bool isLegalBitRotate(ShuffleVectorSDNode *SVN,
5076-
SelectionDAG &DAG,
5075+
static bool isLegalBitRotate(ArrayRef<int> Mask, EVT VT,
50775076
const RISCVSubtarget &Subtarget,
50785077
MVT &RotateVT, unsigned &RotateAmt) {
5079-
SDLoc DL(SVN);
5080-
5081-
EVT VT = SVN->getValueType(0);
50825078
unsigned NumElts = VT.getVectorNumElements();
50835079
unsigned EltSizeInBits = VT.getScalarSizeInBits();
50845080
unsigned NumSubElts;
5085-
if (!ShuffleVectorInst::isBitRotateMask(SVN->getMask(), EltSizeInBits, 2,
5081+
if (!ShuffleVectorInst::isBitRotateMask(Mask, EltSizeInBits, 2,
50865082
NumElts, NumSubElts, RotateAmt))
50875083
return false;
50885084
RotateVT = MVT::getVectorVT(MVT::getIntegerVT(EltSizeInBits * NumSubElts),
5089-
NumElts / NumSubElts);
5085+
NumElts / NumSubElts);
50905086

50915087
// We might have a RotateVT that isn't legal, e.g. v4i64 on zve32x.
50925088
return Subtarget.getTargetLowering()->isTypeLegal(RotateVT);
@@ -5103,7 +5099,7 @@ static SDValue lowerVECTOR_SHUFFLEAsRotate(ShuffleVectorSDNode *SVN,
51035099
EVT VT = SVN->getValueType(0);
51045100
unsigned RotateAmt;
51055101
MVT RotateVT;
5106-
if (!isLegalBitRotate(SVN, DAG, Subtarget, RotateVT, RotateAmt))
5102+
if (!isLegalBitRotate(SVN->getMask(), VT, Subtarget, RotateVT, RotateAmt))
51075103
return SDValue();
51085104

51095105
SDValue Op = DAG.getBitcast(RotateVT, SVN->getOperand(0));
@@ -5142,7 +5138,7 @@ static SDValue lowerShuffleViaVRegSplitting(ShuffleVectorSDNode *SVN,
51425138
// expansion for.
51435139
unsigned RotateAmt;
51445140
MVT RotateVT;
5145-
if (isLegalBitRotate(SVN, DAG, Subtarget, RotateVT, RotateAmt))
5141+
if (isLegalBitRotate(Mask, VT, Subtarget, RotateVT, RotateAmt))
51465142
return SDValue();
51475143

51485144
MVT ElemVT = VT.getVectorElementType();

0 commit comments

Comments
 (0)