1818// Operand and SDNode transformation definitions.
1919//===----------------------------------------------------------------------===//
2020
21+ def RVPGPRPairRV32 : RegisterOperand<GPRPair> {
22+ let ParserMatchClass = GPRPairRV32Operand;
23+ let EncoderMethod = "getRVPGPRPair";
24+ let DecoderMethod = "decodeRVPGPRPair";
25+ }
26+
2127def simm10 : RISCVSImmLeafOp<10> {
2228 let MCOperandPredicate = [{
2329 int64_t Imm;
@@ -38,7 +44,7 @@ class RVPUnary<bits<5> funct5, bits<7> wuimm,
3844 : RVInstIBase<funct3, opcode, (outs GPR:$rd), (ins GPR:$rs1),
3945 opcodestr, "$rd, $rs1"> {
4046 let Inst{31-27} = funct5;
41- let Inst{26-20} = wuimm;
47+ let Inst{26-20} = wuimm;
4248}
4349
4450let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
@@ -72,8 +78,8 @@ class RVPUnaryWUF<bits<2> w, bits<5> uf, string opcodestr>
7278
7379let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
7480class RVPUnaryWUFRs1pRdp<bits<2> w, bits<5> uf, string opcodestr>
75- : RVInstIBase<0b010, OPC_OP_IMM_32, (outs GPRPairRV32 :$rdp),
76- (ins GPRPairRV32 :$rs1p), opcodestr, "$rdp, $rs1p"> {
81+ : RVInstIBase<0b010, OPC_OP_IMM_32, (outs RVPGPRPairRV32 :$rdp),
82+ (ins RVPGPRPairRV32 :$rs1p), opcodestr, "$rdp, $rs1p"> {
7783 bits<4> rs1p;
7884 bits<4> rdp;
7985
@@ -101,7 +107,7 @@ class RVPUnary1F0<bits<3> f, bits<7> wuimm, string opcodestr>
101107 (ins GPR:$rs1), "$rd, $rs1">;
102108
103109class RVPUnary0F0Rdp<bits<3> f, bits<7> wuimm, string opcodestr>
104- : RVPUnaryF<0, f, 0, wuimm, opcodestr, 0b100 , (outs GPRPairRV32 :$rdp),
110+ : RVPUnaryF<0, f, 0, wuimm, opcodestr, 0b010 , (outs RVPGPRPairRV32 :$rdp),
105111 (ins GPR:$rs1), "$rdp, $rs1"> {
106112 bits<4> rdp;
107113
@@ -111,7 +117,7 @@ class RVPUnary0F0Rdp<bits<3> f, bits<7> wuimm, string opcodestr>
111117
112118class RVPUnary0F0Rs1p<bits<3> f, bits<7> wuimm, string opcodestr>
113119 : RVPUnaryF<0, f, 0, wuimm, opcodestr, 0b100, (outs GPR:$rd),
114- (ins GPRPairRV32 :$rs1p), "$rd, $rs1p"> {
120+ (ins RVPGPRPairRV32 :$rs1p), "$rd, $rs1p"> {
115121 bits<4> rs1p;
116122
117123 let Inst{19-16} = rs1p;
@@ -120,8 +126,8 @@ class RVPUnary0F0Rs1p<bits<3> f, bits<7> wuimm, string opcodestr>
120126
121127class RVPUnary0F0Rs1pRdp<bits<3> f, bits<7> wuimm, string opcodestr,
122128 bit aft = 0b0>
123- : RVPUnaryF<0, f, 0, wuimm, opcodestr, 0b100 , (outs GPRPairRV32 :$rdp),
124- (ins GPRPairRV32 :$rs1p), "$rdp, $rs1p"> {
129+ : RVPUnaryF<0, f, 0, wuimm, opcodestr, 0b110 , (outs RVPGPRPairRV32 :$rdp),
130+ (ins RVPGPRPairRV32 :$rs1p), "$rdp, $rs1p"> {
125131 bits<4> rs1p;
126132 bits<4> rdp;
127133
@@ -153,7 +159,7 @@ class RVPBinary1F0W<bits<3> f, bits<2> w, string opcodestr, bits<3> funct3,
153159
154160class RVPBinary0F1WRdp<bits<3> f, bits<2> w, string opcodestr,
155161 RISCVOpcode Opcode = OPC_OP_IMM_32>
156- : RVPBinaryFW<0, f, 1, w, opcodestr, 0b010, Opcode, (outs GPRPairRV32 :$rdp),
162+ : RVPBinaryFW<0, f, 1, w, opcodestr, 0b010, Opcode, (outs RVPGPRPairRV32 :$rdp),
157163 (ins GPR:$rs1, GPR:$rs2), "$rdp, $rs1, $rs2"> {
158164 bits<4> rdp;
159165
@@ -164,7 +170,7 @@ class RVPBinary0F1WRdp<bits<3> f, bits<2> w, string opcodestr,
164170class RVPBinary0F1WRs1p<bits<3> f, bits<2> w, string opcodestr,
165171 bit aft = 0b0, RISCVOpcode Opcode = OPC_OP_IMM_32>
166172 : RVPBinaryFW<0, f, 1, w, opcodestr, 0b100, Opcode, (outs GPR:$rd),
167- (ins GPRPairRV32 :$rs1p, GPR:$rs2), "$rd, $rs1p, $rs2"> {
173+ (ins RVPGPRPairRV32 :$rs1p, GPR:$rs2), "$rd, $rs1p, $rs2"> {
168174 bits<4> rs1p;
169175
170176 let Inst{19-16} = rs1p;
@@ -173,8 +179,8 @@ class RVPBinary0F1WRs1p<bits<3> f, bits<2> w, string opcodestr,
173179
174180class RVPBinary0F1WRs1pRdp<bits<3> f, bits<2> w, string opcodestr,
175181 bit aft = 0b0, RISCVOpcode Opcode = OPC_OP_IMM_32>
176- : RVPBinaryFW<0, f, 1, w, opcodestr, 0b110, Opcode, (outs GPRPairRV32 :$rdp),
177- (ins GPRPairRV32 :$rs1p, GPR:$rs2), "$rdp, $rs1p, $rs2"> {
182+ : RVPBinaryFW<0, f, 1, w, opcodestr, 0b110, Opcode, (outs RVPGPRPairRV32 :$rdp),
183+ (ins RVPGPRPairRV32 :$rs1p, GPR:$rs2), "$rdp, $rs1p, $rs2"> {
178184 bits<4> rs1p;
179185 bits<4> rdp;
180186
@@ -187,8 +193,8 @@ class RVPBinary0F1WRs1pRdp<bits<3> f, bits<2> w, string opcodestr,
187193let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
188194class RVPBinary1FWRs2pRs1pRdp<bits<4> f, bits<2> w, string opcodestr,
189195 bit aft = 0b0, RISCVOpcode Opcode = OPC_OP_IMM_32>
190- : RVInstRBase<0b110, Opcode, (outs GPRPairRV32 :$rdp),
191- (ins GPRPairRV32 :$rs1p, GPRPairRV32 :$rs2p),
196+ : RVInstRBase<0b110, Opcode, (outs RVPGPRPairRV32 :$rdp),
197+ (ins RVPGPRPairRV32 :$rs1p, RVPGPRPairRV32 :$rs2p),
192198 opcodestr, "$rdp, $rs1p, $rs2p"> {
193199 bits<4> rs1p;
194200 bits<4> rs2p;
@@ -208,8 +214,8 @@ class RVPBinary1FWRs2pRs1pRdp<bits<4> f, bits<2> w, string opcodestr,
208214class RVPBinary1F0WRs2pRs1pRdp<bits<3> f, bits<2> w, string opcodestr,
209215 bit bfr = 0b1, bit aft = 0b0,
210216 RISCVOpcode Opcode = OPC_OP_IMM_32>
211- : RVPBinaryFW<1, f, 0, w, opcodestr, 0b110, Opcode, (outs GPRPairRV32 :$rdp),
212- (ins GPRPairRV32 :$rs1p, GPRPairRV32 :$rs2p), "$rdp, $rs1p, $rs2p"> {
217+ : RVPBinaryFW<1, f, 0, w, opcodestr, 0b110, Opcode, (outs RVPGPRPairRV32 :$rdp),
218+ (ins RVPGPRPairRV32 :$rs1p, RVPGPRPairRV32 :$rs2p), "$rdp, $rs1p, $rs2p"> {
213219 bits<4> rs1p;
214220 bits<4> rs2p;
215221 bits<4> rdp;
@@ -237,34 +243,14 @@ class RVPBinary1LongFW<bits<4> f, bits<2> w, bits<3> funct3, string opcodestr>
237243 (ins GPR:$rs1, GPR:$rs2), "$rd, $rs1, $rs2">;
238244
239245class RVPBinary0LongFW<bits<4> f, bits<2> w, string opcodestr>
240- : RVPBinaryLongFW<0, f, w, opcodestr, 0b010, (outs GPRPairRV32 :$rdp),
241- (ins GPR:$rs1, GPRPairRV32 :$rs2), "$rdp, $rs1, $rs2"> {
246+ : RVPBinaryLongFW<0, f, w, opcodestr, 0b010, (outs RVPGPRPairRV32 :$rdp),
247+ (ins GPR:$rs1, RVPGPRPairRV32 :$rs2), "$rdp, $rs1, $rs2"> {
242248 bits<4> rdp;
243249
244250 let Inst{11-8} = rdp;
245251 let Inst{7} = 0b1;
246252}
247253
248- multiclass RVPUnaryBH<bits<5> funct5, string opcodestr> {
249- def NAME # _B : RVPUnary<funct5, 0b0001000, 0b010, OPC_OP_IMM_32, opcodestr # ".b">;
250- def NAME # _H : RVPUnary<funct5, 0b0010000, 0b010, OPC_OP_IMM_32, opcodestr # ".h">;
251- }
252-
253- multiclass RVPUnaryHNonPacked<bits<5> funct5, string opcodestr> {
254- def P # NAME # _H : RVPUnary<funct5, 0b0010000, 0b010, OPC_OP_IMM_32, "p" # opcodestr # ".h">;
255- def NAME: RVPUnary<funct5, 0b0100000, 0b010, OPC_OP_IMM_32, opcodestr>;
256- }
257-
258- multiclass RVPUnaryBHW<bits<5> funct5, string opcodestr> {
259- defm NAME : RVPUnaryBH<funct5, opcodestr>;
260- def NAME # _W: RVPUnary<funct5, 0b0100000, 0b010, OPC_OP_IMM_32, opcodestr # ".w">;
261- }
262-
263- multiclass RVPUnaryHW<bits<5> funct5, string opcodestr> {
264- def NAME # _H : RVPUnary<funct5, 0b0010000, 0b010, OPC_OP_IMM_32, opcodestr # ".h">;
265- def NAME # _W: RVPUnary<funct5, 0b0100000, 0b010, OPC_OP_IMM_32, opcodestr # ".w">;
266- }
267-
268254//===----------------------------------------------------------------------===//
269255// Instructions
270256//===----------------------------------------------------------------------===//
@@ -273,10 +259,8 @@ let Predicates = [HasStdExtP] in {
273259def CLS : RVPUnary<0b01100, 0b0000011, 0b001, OPC_OP_IMM, "cls">;
274260def ABS : RVPUnary<0b01100, 0b0000111, 0b001, OPC_OP_IMM, "abs">;
275261} // Predicates = [HasStdExtP]
276- let DecoderNamespace = "RISCV32Only_",
277- Predicates = [HasStdExtP, IsRV32] in {
262+ let Predicates = [HasStdExtP, IsRV32] in
278263def REV_RV32 : RVPUnary<0b01101, 0b0011111, 0b101, OPC_OP_IMM, "rev">;
279- } // Predicates = [HasStdExtP, IsRV32]
280264
281265let Predicates = [HasStdExtP, IsRV64] in {
282266def REV16 : RVPUnary<0b01101, 0b0110000, 0b101, OPC_OP_IMM, "rev16">;
@@ -286,15 +270,17 @@ def CLSW : RVPUnary<0b01100, 0b0000011, 0b001, OPC_OP_IMM_32, "clsw">;
286270def ABSW : RVPUnary<0b01100, 0b0000111, 0b001, OPC_OP_IMM_32, "absw">;
287271} // Predicates = [HasStdExtP, IsRV64]
288272
273+ let Predicates = [HasStdExtP] in {
274+ def PSLLI_B : RVPUnary<0b10000, 0b0001000, 0b010, OPC_OP_IMM_32, "pslli.b">;
275+ def PSLLI_H : RVPUnary<0b10000, 0b0010000, 0b010, OPC_OP_IMM_32, "pslli.h">;
276+ def PSSLAI_H : RVPUnary<0b11010, 0b0010000, 0b010, OPC_OP_IMM_32, "psslai.h">;
277+ } // Predicates = [HasStdExtP]
289278let DecoderNamespace = "RISCV32Only_",
290- Predicates = [HasStdExtP, IsRV32] in {
291- defm PSLLI_RV32 : RVPUnaryBH<0b10000, "pslli">;
292- defm SSLAI_RV32 : RVPUnaryHNonPacked<0b11010, "sslai">;
293- } // Predicates = [HasStdExtP, IsRV32]
294-
279+ Predicates = [HasStdExtP, IsRV32] in
280+ def SSLAI : RVPUnary<0b11010, 0b0100000, 0b010, OPC_OP_IMM_32, "sslai">;
295281let Predicates = [HasStdExtP, IsRV64] in {
296- defm PSLLI_RV64 : RVPUnaryBHW <0b10000, "pslli">;
297- defm PSSLAI_RV64 : RVPUnaryHW<0b01010, "psslai">;
282+ def PSLLI_W : RVPUnary <0b10000, 0b0100000, 0b010, OPC_OP_IMM_32, "pslli.w ">;
283+ def PSSLAI_W : RVPUnary<0b11010, 0b0100000, 0b010, OPC_OP_IMM_32, "psslai.w ">;
298284} // Predicates = [HasStdExtP, IsRV64]
299285
300286let Predicates = [HasStdExtP] in
@@ -622,8 +608,8 @@ def PM4ADDASU_B : RVPBinary1LongFW<0b1101, 0b10, 0b101, "pm4addasu.b">;
622608} // Predicates = [HasStdExtP]
623609let DecoderNamespace = "RISCV32Only_",
624610 Predicates = [HasStdExtP, IsRV32] in {
625- def MQACC_H01 : RVPBinary1LongFW<0b0111 , 0b00, 0b101, "mqacc.h01">;
626- def MQRACC_H01 : RVPBinary1LongFW<0b0111 , 0b10, 0b101, "mqracc.h01">;
611+ def MQACC_H01 : RVPBinary1LongFW<0b1111 , 0b00, 0b101, "mqacc.h01">;
612+ def MQRACC_H01 : RVPBinary1LongFW<0b1111 , 0b10, 0b101, "mqracc.h01">;
627613} // Predicates = [HasStdExtP, IsRV32]
628614
629615let Predicates = [HasStdExtP, IsRV64] in {
@@ -809,9 +795,9 @@ def PWSLAI_B : RVPUnary0F0Rdp<0b100, 0b0010000, "pwslai.b">;
809795def PWSLAI_H : RVPUnary0F0Rdp<0b100, 0b0100000, "pwslai.h">;
810796def WSLAI : RVPUnary0F0Rdp<0b100, 0b1000000, "wslai">;
811797
812- def PLI_DH : RVPUnaryImm9<0b0011000, "pli.dh", GPRPairRV32 >;
813- def PLI_DB : RVPUnaryImm8<0b00110100, "pli.db", GPRPairRV32 >;
814- def PLUI_DH : RVPUnaryImm9<0b0111000, "plui.dh", GPRPairRV32 >;
798+ def PLI_DH : RVPUnaryImm9<0b0011000, "pli.dh", RVPGPRPairRV32 >;
799+ def PLI_DB : RVPUnaryImm8<0b00110100, "pli.db", RVPGPRPairRV32 >;
800+ def PLUI_DH : RVPUnaryImm9<0b0111000, "plui.dh", RVPGPRPairRV32 >;
815801
816802
817803def PWSLLI_BS : RVPBinary0F1WRdp<0b000, 0b00, "pwslli.bs">;
0 commit comments