@@ -47,13 +47,13 @@ class LDPFormat<dag outs, dag ins, string opcodestr, string argstr>
4747 bits<5> rd1;
4848 bits<5> rd2;
4949
50- let Inst{31 - 27} = rd2;
51- let Inst{26 - 23} = imm7{6 - 3};
52- let Inst{22 - 20} = 0b000;
53- let Inst{19 - 15} = rs1;
54- let Inst{14 - 12} = 0b100;
55- let Inst{11 - 7} = rd1;
56- let Inst{6 - 0} = OPC_CUSTOM_0.Value;
50+ let Inst{31- 27} = rd2;
51+ let Inst{26- 23} = imm7{6- 3};
52+ let Inst{22- 20} = 0b000;
53+ let Inst{19- 15} = rs1;
54+ let Inst{14- 12} = 0b100;
55+ let Inst{11- 7} = rd1;
56+ let Inst{6- 0} = OPC_CUSTOM_0.Value;
5757}
5858
5959// Load word pair format.
@@ -64,13 +64,13 @@ class LWPFormat<dag outs, dag ins, string opcodestr, string argstr>
6464 bits<5> rd1;
6565 bits<5> rd2;
6666
67- let Inst{31 - 27} = rd2;
68- let Inst{26 - 22} = imm7{6 - 2};
69- let Inst{21 - 20} = 0b01;
70- let Inst{19 - 15} = rs1;
71- let Inst{14 - 12} = 0b100;
72- let Inst{11 - 7} = rd1;
73- let Inst{6 - 0} = OPC_CUSTOM_0.Value;
67+ let Inst{31- 27} = rd2;
68+ let Inst{26- 22} = imm7{6- 2};
69+ let Inst{21- 20} = 0b01;
70+ let Inst{19- 15} = rs1;
71+ let Inst{14- 12} = 0b100;
72+ let Inst{11- 7} = rd1;
73+ let Inst{6- 0} = OPC_CUSTOM_0.Value;
7474}
7575
7676// Store double pair format.
@@ -81,14 +81,14 @@ class SDPFormat<dag outs, dag ins, string opcodestr, string argstr>
8181 bits<5> rs2;
8282 bits<5> rs1;
8383
84- let Inst{31 - 27} = rs3;
85- let Inst{26 - 25} = imm7{6 - 5};
86- let Inst{24 - 20} = rs2;
87- let Inst{19 - 15} = rs1;
88- let Inst{14 - 12} = 0b101;
89- let Inst{11 - 10} = imm7{4 - 3};
90- let Inst{9 - 7} = 0b000;
91- let Inst{6 - 0} = OPC_CUSTOM_0.Value;
84+ let Inst{31- 27} = rs3;
85+ let Inst{26- 25} = imm7{6- 5};
86+ let Inst{24- 20} = rs2;
87+ let Inst{19- 15} = rs1;
88+ let Inst{14- 12} = 0b101;
89+ let Inst{11- 10} = imm7{4- 3};
90+ let Inst{9- 7} = 0b000;
91+ let Inst{6- 0} = OPC_CUSTOM_0.Value;
9292}
9393
9494// Store word pair format.
@@ -99,34 +99,33 @@ class SWPFormat<dag outs, dag ins, string opcodestr, string argstr>
9999 bits<5> rs2;
100100 bits<5> rs1;
101101
102- let Inst{31 - 27} = rs3;
103- let Inst{26 - 25} = imm7{6 - 5};
104- let Inst{24 - 20} = rs2;
105- let Inst{19 - 15} = rs1;
106- let Inst{14 - 12} = 0b101;
107- let Inst{11 - 9} = imm7{4 - 2};
108- let Inst{8 - 7} = 0b01;
109- let Inst{6 - 0} = OPC_CUSTOM_0.Value;
102+ let Inst{31- 27} = rs3;
103+ let Inst{26- 25} = imm7{6- 5};
104+ let Inst{24- 20} = rs2;
105+ let Inst{19- 15} = rs1;
106+ let Inst{14- 12} = 0b101;
107+ let Inst{11- 9} = imm7{4- 2};
108+ let Inst{8- 7} = 0b01;
109+ let Inst{6- 0} = OPC_CUSTOM_0.Value;
110110}
111111
112112// Prefetch format.
113- let hasSideEffects = 0, mayLoad = 1,
114- mayStore = 1 in class
115- Mips_prefetch_ri<dag outs, dag ins, string opcodestr, string argstr>
113+ let hasSideEffects = 0, mayLoad = 1, mayStore = 1 in
114+ class Mips_prefetch_ri<dag outs, dag ins, string opcodestr, string argstr>
116115 : RVInst<outs, ins, opcodestr, argstr, [], InstFormatI> {
117116 bits<9> imm9;
118117 bits<5> rs1;
119118 bits<5> hint;
120119
121- let Inst{31 - 29} = 0b000;
122- let Inst{28 - 20} = imm9;
123- let Inst{19 - 15} = rs1;
124- let Inst{14 - 12} = 0b000;
125- let Inst{11 - 7} = hint;
126- let Inst{6 - 0} = OPC_CUSTOM_0.Value;
120+ let Inst{31- 29} = 0b000;
121+ let Inst{28- 20} = imm9;
122+ let Inst{19- 15} = rs1;
123+ let Inst{14- 12} = 0b000;
124+ let Inst{11- 7} = hint;
125+ let Inst{6- 0} = OPC_CUSTOM_0.Value;
127126}
128127
129- // MIPS Ext Insns
128+ // MIPS Ext Insns Fromat.
130129let hasSideEffects = 1, mayLoad = 0,
131130 mayStore = 0 in class MIPSExtInst_ri<bits<6> shimm5, string opcodestr>
132131 : RVInstIShift<0b00000, 0b001, OPC_OP_IMM, (outs), (ins), opcodestr, ""> {
@@ -138,128 +137,66 @@ let hasSideEffects = 1, mayLoad = 0,
138137//===----------------------------------------------------------------------===//
139138// MIPS extensions
140139//===----------------------------------------------------------------------===//
141- let Predicates = [HasVendorXMIPSCBOP], DecoderNamespace = "XMIPS" in {
142- def MIPS_PREF : Mips_prefetch_ri<(outs),
143- (ins GPR
144- : $rs1, uimm9
145- : $imm9, uimm5
146- : $hint),
147- "mips.pref", "$hint, ${imm9}(${rs1})">,
148- Sched<[]>;
149- }
150-
151140let Predicates = [HasVendorXMIPSEXECTL], DecoderNamespace = "XMIPS" in {
152141 def MIPS_EHB : MIPSExtInst_ri<0b000011, "mips.ehb">;
153142 def MIPS_IHB : MIPSExtInst_ri<0b000001, "mips.ihb">;
154143 def MIPS_PAUSE : MIPSExtInst_ri<0b000101, "mips.pause">;
155144}
156145
146+ let Predicates = [HasVendorXMIPSCBOP] ,DecoderNamespace = "XMIPS" in {
147+ def MIPS_PREF : Mips_prefetch_ri<(outs), (ins GPR:$rs1, uimm9:$imm9, uimm5:$hint),
148+ "mips.pref", "$hint, ${imm9}(${rs1})">,
149+ Sched<[]>;
150+ }
151+
157152let Predicates = [HasVendorXMIPSCBOP] in {
158153 // Prefetch Data Write.
159- def : Pat<(prefetch(AddrRegImm9(XLenVT GPR
160- : $rs1),
161- uimm9
162- : $imm9),
154+ def : Pat<(prefetch (AddrRegImm9 (XLenVT GPR:$rs1), uimm9:$imm9),
163155 (i32 1), timm, (i32 1)),
164- (MIPS_PREF GPR
165- : $rs1, uimm9
166- : $imm9, 9)>;
156+ (MIPS_PREF GPR:$rs1, uimm9:$imm9, 9)>;
167157 // Prefetch Data Read.
168- def : Pat<(prefetch(AddrRegImm9(XLenVT GPR
169- : $rs1),
170- uimm9
171- : $imm9),
158+ def : Pat<(prefetch (AddrRegImm9 (XLenVT GPR:$rs1), uimm9:$imm9),
172159 (i32 0), timm, (i32 1)),
173- (MIPS_PREF GPR
174- : $rs1, uimm9
175- : $imm9, 8)>;
160+ (MIPS_PREF GPR:$rs1, uimm9:$imm9, 8)>;
176161}
177162
178- let Predicates = [HasVendorXMIPSCMov], hasSideEffects = 0, mayLoad = 0,
179- mayStore = 0, DecoderNamespace = "XMIPS" in {
180- def MIPS_CCMOV : RVInstR4<0b11, 0b011, OPC_CUSTOM_0,
181- (outs GPR
182- : $rd),
183- (ins GPR
184- : $rs1, GPR
185- : $rs2, GPR
186- : $rs3),
187- "mips.ccmov", "$rd, $rs2, $rs1, $rs3">,
188- Sched<[]>;
163+ let Predicates = [HasVendorXMIPSCMov], hasSideEffects = 0, mayLoad = 0, mayStore = 0,
164+ DecoderNamespace = "XMIPS" in {
165+ def MIPS_CCMOV : RVInstR4<0b11, 0b011, OPC_CUSTOM_0, (outs GPR:$rd),
166+ (ins GPR:$rs1, GPR:$rs2, GPR:$rs3),
167+ "mips.ccmov", "$rd, $rs2, $rs1, $rs3">,
168+ Sched<[]>;
189169}
190170
191171let Predicates = [UseCCMovInsn] in {
192- def : Pat<(select(riscv_setne(XLenVT GPR
193- : $rs2)),
194- (XLenVT GPR
195- : $rs1),
196- (XLenVT GPR
197- : $rs3)),
198- (MIPS_CCMOV GPR
199- : $rs1, GPR
200- : $rs2, GPR
201- : $rs3)>;
202- def : Pat<(select(riscv_seteq(XLenVT GPR
203- : $rs2)),
204- (XLenVT GPR
205- : $rs3),
206- (XLenVT GPR
207- : $rs1)),
208- (MIPS_CCMOV GPR
209- : $rs1, GPR
210- : $rs2, GPR
211- : $rs3)>;
212-
213- def : Pat<(select(XLenVT GPR
214- : $rs2),
215- (XLenVT GPR
216- : $rs1),
217- (XLenVT GPR
218- : $rs3)),
219- (MIPS_CCMOV GPR
220- : $rs1, GPR
221- : $rs2, GPR
222- : $rs3)>;
172+ def : Pat<(select (riscv_setne (XLenVT GPR:$rs2)),
173+ (XLenVT GPR:$rs1), (XLenVT GPR:$rs3)),
174+ (MIPS_CCMOV GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
175+ def : Pat<(select (riscv_seteq (XLenVT GPR:$rs2)),
176+ (XLenVT GPR:$rs3), (XLenVT GPR:$rs1)),
177+ (MIPS_CCMOV GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
178+
179+ def : Pat<(select (XLenVT GPR:$rs2), (XLenVT GPR:$rs1), (XLenVT GPR:$rs3)),
180+ (MIPS_CCMOV GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
223181}
224182
225183let Predicates = [HasVendorXMIPSLSP], hasSideEffects = 0,
226- DecoderNamespace = "XMIPS" in {
227- let mayLoad = 1, mayStore = 0 in {
228- def MIPS_LWP : LWPFormat<(outs GPR
229- : $rd1, GPR
230- : $rd2),
231- (ins GPR
232- : $rs1, uimm7_lsb00
233- : $imm7),
234- "mips.lwp", "$rd1, $rd2, ${imm7}(${rs1})">,
235- Sched<[WriteLDW, WriteLDW, ReadMemBase]>;
236- def MIPS_LDP : LDPFormat<(outs GPR
237- : $rd1, GPR
238- : $rd2),
239- (ins GPR
240- : $rs1, uimm7_lsb000
241- : $imm7),
242- "mips.ldp", "$rd1, $rd2, ${imm7}(${rs1})">,
243- Sched<[WriteLDD, WriteLDD, ReadMemBase]>;
244- } // mayLoad = 1, mayStore = 0
245-
246- let mayLoad = 0, mayStore = 1 in {
247- def MIPS_SWP : SWPFormat<(outs),
248- (ins GPR
249- : $rs2, GPR
250- : $rs3, GPR
251- : $rs1, uimm7_lsb00
252- : $imm7),
253- "mips.swp", "$rs2, $rs3, ${imm7}(${rs1})">,
254- Sched<[WriteSTW, ReadStoreData, ReadStoreData, ReadMemBase]>;
255- def MIPS_SDP : SDPFormat<(outs),
256- (ins GPR
257- : $rs2, GPR
258- : $rs3, GPR
259- : $rs1, uimm7_lsb000
260- : $imm7),
261- "mips.sdp", "$rs2, $rs3, ${imm7}(${rs1})">,
262- Sched<[WriteSTD, ReadStoreData, ReadStoreData, ReadMemBase]>;
263- } // mayLoad = 0, mayStore = 1
264- } // Predicates = [HasVendorXMIPSLSP], hasSideEffects = 0, DecoderNamespace =
265- // "XMIPS"
184+ DecoderNamespace = "XMIPS" in {
185+ let mayLoad = 1, mayStore = 0 in {
186+ def MIPS_LWP : LWPFormat<(outs GPR:$rd1, GPR:$rd2), (ins GPR:$rs1, uimm7_lsb00:$imm7),
187+ "mips.lwp", "$rd1, $rd2, ${imm7}(${rs1})">,
188+ Sched<[WriteLDW, WriteLDW, ReadMemBase]>;
189+ def MIPS_LDP : LDPFormat<(outs GPR:$rd1, GPR:$rd2), (ins GPR:$rs1, uimm7_lsb000:$imm7),
190+ "mips.ldp", "$rd1, $rd2, ${imm7}(${rs1})">,
191+ Sched<[WriteLDD, WriteLDD, ReadMemBase]>;
192+ } // mayLoad = 1, mayStore = 0
193+
194+ let mayLoad = 0, mayStore = 1 in {
195+ def MIPS_SWP : SWPFormat<(outs), (ins GPR:$rs2, GPR:$rs3, GPR:$rs1, uimm7_lsb00:$imm7),
196+ "mips.swp", "$rs2, $rs3, ${imm7}(${rs1})">,
197+ Sched<[WriteSTW, ReadStoreData, ReadStoreData, ReadMemBase]>;
198+ def MIPS_SDP : SDPFormat<(outs), (ins GPR:$rs2, GPR:$rs3, GPR:$rs1, uimm7_lsb000:$imm7),
199+ "mips.sdp", "$rs2, $rs3, ${imm7}(${rs1})">,
200+ Sched<[WriteSTD, ReadStoreData, ReadStoreData, ReadMemBase]>;
201+ } // mayLoad = 0, mayStore = 1
202+ } // Predicates = [HasVendorXMIPSLSP], hasSideEffects = 0, DecoderNamespace = "XMIPS"
0 commit comments