Skip to content

Commit c7ab9f7

Browse files
committed
Use tuimm
1 parent 18ee0a9 commit c7ab9f7

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,16 +1845,6 @@ void RISCVDAGToDAGISel::Select(SDNode *Node) {
18451845
CurDAG->RemoveDeadNode(Node);
18461846
return;
18471847
}
1848-
case RISCVISD::QC_SETWMI: {
1849-
SDValue Chain = Node->getOperand(0);
1850-
SDVTList VTs = Node->getVTList();
1851-
SDValue Ops[] = {Node->getOperand(1), Node->getOperand(2),
1852-
Node->getOperand(3), Node->getOperand(4), Chain};
1853-
MachineSDNode *New = CurDAG->getMachineNode(RISCV::QC_SETWMI, DL, VTs, Ops);
1854-
CurDAG->setNodeMemRefs(New, {cast<MemSDNode>(Node)->getMemOperand()});
1855-
ReplaceNode(Node, New);
1856-
return;
1857-
}
18581848
case ISD::INTRINSIC_WO_CHAIN: {
18591849
unsigned IntNo = Node->getConstantOperandVal(0);
18601850
switch (IntNo) {

llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ def uimm5nonzero : RISCVOp<XLenVT>,
3535
}];
3636
}
3737

38+
def tuimm5nonzero : TImmLeaf<XLenVT, [{return (Imm != 0) && isUInt<5>(Imm);}]>;
39+
3840
def uimm5gt3 : RISCVOp<XLenVT>, ImmLeaf<XLenVT,
3941
[{return (Imm > 3) && isUInt<5>(Imm);}]> {
4042
let ParserMatchClass = UImmAsmOperand<5, "GT3">;
@@ -100,6 +102,8 @@ def uimm5slist : RISCVOp<XLenVT>, ImmLeaf<XLenVT,
100102
}];
101103
}
102104

105+
def tuimm7_lsb00 : TImmLeaf<XLenVT,[{return isShiftedUInt<5, 2>(Imm);}]>;
106+
103107
def uimm10 : RISCVUImmLeafOp<10>;
104108

105109
def uimm11 : RISCVUImmLeafOp<11>;
@@ -1574,6 +1578,11 @@ def : QCISELECTIICCPat <SETEQ, QC_SELECTIIEQ>;
15741578
def : QCISELECTIICCPat <SETNE, QC_SELECTIINE>;
15751579
} // Predicates = [HasVendorXqcics, IsRV32]
15761580

1581+
let Predicates = [HasVendorXqcilsm, IsRV32] in {
1582+
def : Pat<(qc_setwmi i32:$rd, GPR:$rs1, tuimm5nonzero:$uimm5, tuimm7_lsb00:$uimm7),
1583+
(QC_SETWMI i32:$rd, GPR:$rs1, tuimm5nonzero:$uimm5, tuimm7_lsb00:$uimm7)>;
1584+
} // Predicates = [HasVendorXqcilsm, IsRV32]
1585+
15771586
//===----------------------------------------------------------------------===/i
15781587
// Compress Instruction tablegen backend.
15791588
//===----------------------------------------------------------------------===//

llvm/lib/Target/RISCV/RISCVSelectionDAGInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ SDValue RISCVSelectionDAGInfo::EmitTargetCodeForMemset(
8282
uint64_t NumberOfBytesToWrite = ConstantSize->getZExtValue();
8383

8484
// Do this only if it is word aligned and we write multiple of 4 bytes.
85-
if (!(Alignment.value() >= 4) || !((NumberOfBytesToWrite & 3) == 0))
85+
if (!(Alignment >= 4) || !((NumberOfBytesToWrite & 3) == 0))
8686
return SDValue();
8787

8888
SmallVector<SDValue, 8> OutChains;

0 commit comments

Comments
 (0)