Skip to content

Commit fd347a4

Browse files
committed
fixup! Address Comments
Change-Id: I8dba54c5c78c86fab22e03b8d10079241e18d242
1 parent 1a443e5 commit fd347a4

File tree

3 files changed

+10
-22
lines changed

3 files changed

+10
-22
lines changed

llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ static SDValue selectImmSeq(SelectionDAG *CurDAG, const SDLoc &DL, const MVT VT,
205205
return SrcReg;
206206
}
207207

208-
SDValue selectImm(SelectionDAG *CurDAG, const SDLoc &DL, const MVT VT,
209-
int64_t Imm, const RISCVSubtarget &Subtarget) {
208+
static SDValue selectImm(SelectionDAG *CurDAG, const SDLoc &DL, const MVT VT,
209+
int64_t Imm, const RISCVSubtarget &Subtarget) {
210210
RISCVMatInt::InstSeq Seq = RISCVMatInt::generateInstSeq(Imm, Subtarget);
211211

212212
// Use a rematerializable pseudo instruction for short sequences if enabled.

llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,10 @@
1616
#include "RISCV.h"
1717
#include "RISCVTargetMachine.h"
1818
#include "llvm/CodeGen/SelectionDAGISel.h"
19-
#include "llvm/CodeGen/SelectionDAGNodes.h"
2019
#include "llvm/Support/KnownBits.h"
2120

2221
// RISC-V specific code to select RISC-V machine instructions for
2322
// SelectionDAG operations.
24-
25-
llvm::SDValue selectImm(llvm::SelectionDAG *CurDAG, const llvm::SDLoc &DL,
26-
const llvm::MVT VT, int64_t Imm,
27-
const llvm::RISCVSubtarget &Subtarget);
28-
2923
namespace llvm {
3024
class RISCVDAGToDAGISel : public SelectionDAGISel {
3125
const RISCVSubtarget *Subtarget = nullptr;

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "MCTargetDesc/RISCVMatInt.h"
1616
#include "RISCV.h"
1717
#include "RISCVConstantPoolValue.h"
18-
#include "RISCVISelDAGToDAG.h"
1918
#include "RISCVMachineFunctionInfo.h"
2019
#include "RISCVRegisterInfo.h"
2120
#include "RISCVSelectionDAGInfo.h"
@@ -16259,10 +16258,12 @@ static SDValue combineOrAndToBitfieldInsert(SDNode *N, SelectionDAG &DAG,
1625916258

1626016259
using namespace SDPatternMatch;
1626116260

16262-
SDValue And;
16261+
SDValue Inserted;
1626316262
APInt MaskImm, OrImm;
16264-
if (!sd_match(N, m_Or(m_OneUse(m_And(m_Value(And), m_ConstInt(MaskImm))),
16265-
m_ConstInt(OrImm))))
16263+
if (!sd_match(
16264+
N, m_SpecificVT(MVT::i32, m_Or(m_OneUse(m_And(m_Value(Inserted),
16265+
m_ConstInt(MaskImm))),
16266+
m_ConstInt(OrImm)))))
1626616267
return SDValue();
1626716268

1626816269
// Compute the Known Zero for the AND as this allows us to catch more general
@@ -16282,20 +16283,13 @@ static SDValue combineOrAndToBitfieldInsert(SDNode *N, SelectionDAG &DAG,
1628216283
if (!Known.Zero.isShiftedMask(ShAmt, Width))
1628316284
return SDValue();
1628416285

16285-
if (N->getValueType(0) != MVT::i32)
16286-
return SDValue();
16287-
1628816286
// QC_INSB(I) dst, src, #width, #shamt.
1628916287
SDLoc DL(N);
16290-
SDValue ImmNode;
1629116288

16292-
int32_t LIImm = OrImm.getSExtValue() >> ShAmt;
16293-
ImmNode = DAG.getSignedConstant(LIImm, DL, MVT::i32);
16289+
SDValue ImmNode =
16290+
DAG.getSignedConstant(OrImm.getSExtValue() >> ShAmt, DL, MVT::i32);
1629416291

16295-
if (!isInt<5>(LIImm)) {
16296-
ImmNode = selectImm(&DAG, DL, MVT::i32, LIImm, Subtarget);
16297-
}
16298-
SDValue Ops[] = {And, ImmNode, DAG.getConstant(Width, DL, MVT::i32),
16292+
SDValue Ops[] = {Inserted, ImmNode, DAG.getConstant(Width, DL, MVT::i32),
1629916293
DAG.getConstant(ShAmt, DL, MVT::i32)};
1630016294
return DAG.getNode(RISCVISD::QC_INSB, DL, MVT::i32, Ops);
1630116295
}

0 commit comments

Comments
 (0)