@@ -76,14 +76,16 @@ def IsNotSingleFloat : Predicate<"!Subtarget.isSingleFloat()">;
76
76
// FP load.
77
77
class FPLoad<bits<6> op, string opstr, PatFrag FOp, RegisterClass RC,
78
78
Operand MemOpnd>:
79
- FFI<op, (outs RC:$ft), (ins MemOpnd:$base),
80
- !strconcat(opstr, "\t$ft, $base"), [(set RC:$ft, (FOp addr:$base))]>;
79
+ FMem<op, (outs RC:$ft), (ins MemOpnd:$addr),
80
+ !strconcat(opstr, "\t$ft, $addr"), [(set RC:$ft, (FOp addr:$addr))],
81
+ IILoad>;
81
82
82
83
// FP store.
83
84
class FPStore<bits<6> op, string opstr, PatFrag FOp, RegisterClass RC,
84
85
Operand MemOpnd>:
85
- FFI<op, (outs), (ins RC:$ft, MemOpnd:$base),
86
- !strconcat(opstr, "\t$ft, $base"), [(store RC:$ft, addr:$base)]>;
86
+ FMem<op, (outs), (ins RC:$ft, MemOpnd:$addr),
87
+ !strconcat(opstr, "\t$ft, $addr"), [(store RC:$ft, addr:$addr)],
88
+ IIStore>;
87
89
88
90
// Instructions that convert an FP value to 32-bit fixed point.
89
91
multiclass FFR1_W_M<bits<6> funct, string opstr> {
@@ -158,22 +160,28 @@ defm FSQRT : FFR1P_M<0x4, "sqrt", fsqrt>;
158
160
// stores, and moves between floating-point and integer registers.
159
161
// When defining instructions, we reference all 32-bit registers,
160
162
// regardless of register aliasing.
161
- let fd = 0 in {
162
- /// Move Control Registers From/To CPU Registers
163
- def CFC1 : FFR<0x11, 0x0, 0x2, (outs CPURegs:$rt), (ins CCR:$fs),
163
+
164
+ class FFRGPR<bits<5> _fmt, dag outs, dag ins, string asmstr, list<dag> pattern>:
165
+ FFR<0x11, 0x0, _fmt, outs, ins, asmstr, pattern> {
166
+ bits<5> rt;
167
+ let ft = rt;
168
+ let fd = 0;
169
+ }
170
+
171
+ /// Move Control Registers From/To CPU Registers
172
+ def CFC1 : FFRGPR<0x2, (outs CPURegs:$rt), (ins CCR:$fs),
164
173
"cfc1\t$rt, $fs", []>;
165
174
166
- def CTC1 : FFR<0x11, 0x0, 0x6, (outs CCR:$rt ), (ins CPURegs:$fs ),
167
- "ctc1\t$fs , $rt ", []>;
175
+ def CTC1 : FFRGPR< 0x6, (outs CCR:$fs ), (ins CPURegs:$rt ),
176
+ "ctc1\t$rt , $fs ", []>;
168
177
169
- def MFC1 : FFR<0x11, 0x00, 0x00, (outs CPURegs:$rt), (ins FGR32:$fs),
178
+ def MFC1 : FFRGPR< 0x00, (outs CPURegs:$rt), (ins FGR32:$fs),
170
179
"mfc1\t$rt, $fs",
171
180
[(set CPURegs:$rt, (bitconvert FGR32:$fs))]>;
172
181
173
- def MTC1 : FFR<0x11, 0x00, 0x04, (outs FGR32:$fs), (ins CPURegs:$rt),
182
+ def MTC1 : FFRGPR< 0x04, (outs FGR32:$fs), (ins CPURegs:$rt),
174
183
"mtc1\t$rt, $fs",
175
184
[(set FGR32:$fs, (bitconvert CPURegs:$rt))]>;
176
- }
177
185
178
186
def FMOV_S : FFR1<0x6, 16, "mov", "s", FGR32, FGR32>;
179
187
def FMOV_D32 : FFR1<0x6, 17, "mov", "d", AFGR64, AFGR64>,
@@ -203,7 +211,7 @@ let Predicates = [NotN64] in {
203
211
}
204
212
205
213
/// Floating-point Aritmetic
206
- defm FADD : FFR2P_M<0x10 , "add", fadd, 1>;
214
+ defm FADD : FFR2P_M<0x00 , "add", fadd, 1>;
207
215
defm FDIV : FFR2P_M<0x03, "div", fdiv>;
208
216
defm FMUL : FFR2P_M<0x02, "mul", fmul, 1>;
209
217
defm FSUB : FFR2P_M<0x01, "sub", fsub>;
@@ -218,12 +226,16 @@ def MIPS_BRANCH_T : PatLeaf<(i32 1)>;
218
226
219
227
/// Floating Point Branch of False/True (Likely)
220
228
let isBranch=1, isTerminator=1, hasDelaySlot=1, base=0x8, Uses=[FCR31] in
221
- class FBRANCH<PatLeaf op, string asmstr> : FFI<0x11, (outs),
222
- (ins brtarget:$dst), !strconcat(asmstr, "\t$dst"),
223
- [(MipsFPBrcond op, bb:$dst)]>;
229
+ class FBRANCH<bits<1> nd, bits<1> tf, PatLeaf op, string asmstr> :
230
+ FFI<0x11, (outs), (ins brtarget:$dst), !strconcat(asmstr, "\t$dst"),
231
+ [(MipsFPBrcond op, bb:$dst)]> {
232
+ let Inst{20-18} = 0;
233
+ let Inst{17} = nd;
234
+ let Inst{16} = tf;
235
+ }
224
236
225
- def BC1F : FBRANCH<MIPS_BRANCH_F, "bc1f">;
226
- def BC1T : FBRANCH<MIPS_BRANCH_T, "bc1t">;
237
+ def BC1F : FBRANCH<0, 0, MIPS_BRANCH_F, "bc1f">;
238
+ def BC1T : FBRANCH<0, 1, MIPS_BRANCH_T, "bc1t">;
227
239
228
240
//===----------------------------------------------------------------------===//
229
241
// Floating Point Flag Conditions
@@ -249,11 +261,11 @@ def MIPS_FCOND_NGT : PatLeaf<(i32 15)>;
249
261
250
262
/// Floating Point Compare
251
263
let Defs=[FCR31] in {
252
- def FCMP_S32 : FCC<0x0 , (outs), (ins FGR32:$fs, FGR32:$ft, condcode:$cc),
264
+ def FCMP_S32 : FCC<0x10 , (outs), (ins FGR32:$fs, FGR32:$ft, condcode:$cc),
253
265
"c.$cc.s\t$fs, $ft",
254
266
[(MipsFPCmp FGR32:$fs, FGR32:$ft, imm:$cc)]>;
255
267
256
- def FCMP_D32 : FCC<0x1 , (outs), (ins AFGR64:$fs, AFGR64:$ft, condcode:$cc),
268
+ def FCMP_D32 : FCC<0x11 , (outs), (ins AFGR64:$fs, AFGR64:$ft, condcode:$cc),
257
269
"c.$cc.d\t$fs, $ft",
258
270
[(MipsFPCmp AFGR64:$fs, AFGR64:$ft, imm:$cc)]>,
259
271
Requires<[NotFP64bit]>;
@@ -287,14 +299,16 @@ let Predicates = [NotFP64bit] in {
287
299
defm : MovnPats<AFGR64, MOVN_D>;
288
300
}
289
301
290
- let usesCustomInserter = 1, Uses = [FCR31], Constraints = "$F = $dst" in {
302
+ let cc = 0, usesCustomInserter = 1, Uses = [FCR31],
303
+ Constraints = "$F = $dst" in {
291
304
// flag:float, data:int
292
305
class CondMovFPInt<SDNode cmov, bits<1> tf, string instr_asm> :
293
306
FCMOV<tf, (outs CPURegs:$dst), (ins CPURegs:$T, CPURegs:$F),
294
307
!strconcat(instr_asm, "\t$dst, $T, $$fcc0"),
295
308
[(set CPURegs:$dst, (cmov CPURegs:$T, CPURegs:$F))]>;
296
309
297
310
// flag:float, data:float
311
+ let cc = 0 in
298
312
class CondMovFPFP<RegisterClass RC, SDNode cmov, bits<5> fmt, bits<1> tf,
299
313
string instr_asm> :
300
314
FFCMOV<fmt, tf, (outs RC:$dst), (ins RC:$T, RC:$F),
0 commit comments