Skip to content

Commit 8b9e760

Browse files
authored
[RISCV] Don't use RVInstIBase for P-ext plui/pli. NFC (#149940)
These instructions don't have an rs1 field unlike other instructions that use RVInstIBase. Rename the classes to not use Unary since we have historically used that for a single register operand.
1 parent 739e764 commit 8b9e760

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoP.td

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,34 @@ def simm10_unsigned : RISCVOp {
4444
//===----------------------------------------------------------------------===//
4545

4646
let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
47-
class RVPUnaryImm10<bits<7> funct7, string opcodestr,
48-
DAGOperand TyImm10 = simm10>
49-
: RVInstIBase<0b010, OPC_OP_IMM_32, (outs GPR:$rd), (ins TyImm10:$imm10),
50-
opcodestr, "$rd, $imm10"> {
47+
class RVPLoadImm10<bits<7> funct7, string opcodestr,
48+
DAGOperand TyImm10 = simm10>
49+
: RVInst<(outs GPR:$rd), (ins TyImm10:$imm10), opcodestr, "$rd, $imm10", [],
50+
InstFormatOther> {
5151
bits<10> imm10;
52+
bits<5> rd;
5253

5354
let Inst{31-25} = funct7;
5455
let Inst{24-16} = imm10{8-0};
5556
let Inst{15} = imm10{9};
57+
let Inst{14-12} = 0b010;
58+
let Inst{11-7} = rd;
59+
let Inst{6-0} = OPC_OP_IMM_32.Value;
5660
}
5761

5862
let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
59-
class RVPUnaryImm8<bits<8> funct8, string opcodestr>
60-
: RVInstIBase<0b010, OPC_OP_IMM_32, (outs GPR:$rd), (ins uimm8:$uimm8),
61-
opcodestr, "$rd, $uimm8"> {
63+
class RVPLoadImm8<bits<8> funct8, string opcodestr>
64+
: RVInst<(outs GPR:$rd), (ins uimm8:$uimm8), opcodestr, "$rd, $uimm8", [],
65+
InstFormatOther> {
6266
bits<8> uimm8;
67+
bits<5> rd;
6368

6469
let Inst{31-24} = funct8;
6570
let Inst{23-16} = uimm8;
6671
let Inst{15} = 0b0;
72+
let Inst{14-12} = 0b010;
73+
let Inst{11-7} = rd;
74+
let Inst{6-0} = OPC_OP_IMM_32.Value;
6775
}
6876

6977
let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
@@ -140,11 +148,11 @@ def PSSLAI_W : RVPUnaryImm5<0b101, "psslai.w">;
140148
} // Predicates = [HasStdExtP, IsRV64]
141149

142150
let Predicates = [HasStdExtP] in
143-
def PLI_H : RVPUnaryImm10<0b1011000, "pli.h">;
151+
def PLI_H : RVPLoadImm10<0b1011000, "pli.h">;
144152
let Predicates = [HasStdExtP, IsRV64] in
145-
def PLI_W : RVPUnaryImm10<0b1011001, "pli.w">;
153+
def PLI_W : RVPLoadImm10<0b1011001, "pli.w">;
146154
let Predicates = [HasStdExtP] in
147-
def PLI_B : RVPUnaryImm8<0b10110100, "pli.b">;
155+
def PLI_B : RVPLoadImm8<0b10110100, "pli.b">;
148156

149157
let Predicates = [HasStdExtP] in {
150158
def PSEXT_H_B : RVPUnaryWUF<0b00, 0b00100, "psext.h.b">;
@@ -157,6 +165,6 @@ def PSEXT_W_H : RVPUnaryWUF<0b01, 0b00101, "psext.w.h">;
157165
} // Predicates = [HasStdExtP, IsRV64]
158166

159167
let Predicates = [HasStdExtP] in
160-
def PLUI_H : RVPUnaryImm10<0b1111000, "plui.h", simm10_unsigned>;
168+
def PLUI_H : RVPLoadImm10<0b1111000, "plui.h", simm10_unsigned>;
161169
let Predicates = [HasStdExtP, IsRV64] in
162-
def PLUI_W : RVPUnaryImm10<0b1111001, "plui.w", simm10_unsigned>;
170+
def PLUI_W : RVPLoadImm10<0b1111001, "plui.w", simm10_unsigned>;

0 commit comments

Comments
 (0)