Skip to content

Commit 680b3b7

Browse files
authored
[RISCV][Scheduler] Add scheduling definitions for 128-bit Zfa instructions (#140003)
Followup of #139495 and #139508
1 parent ca6398c commit 680b3b7

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoZfa.td

+10-3
Original file line numberDiff line numberDiff line change
@@ -177,17 +177,24 @@ def FLEQ_H : FPCmp_rr<0b1010010, 0b100, "fleq.h", FPR16>;
177177

178178
let Predicates = [HasStdExtZfa, HasStdExtQ] in {
179179
let isReMaterializable = 1, isAsCheapAsAMove = 1 in
180-
def FLI_Q : FPFLI_r<0b1111011, 0b00001, 0b000, FPR128, "fli.q">;
180+
def FLI_Q : FPFLI_r<0b1111011, 0b00001, 0b000, FPR128, "fli.q">,
181+
Sched<[WriteFLI128]>;
181182

183+
let SchedRW = [WriteFMinMax128, ReadFMinMax128, ReadFMinMax128] in {
182184
def FMINM_Q: FPALU_rr<0b0010111, 0b010, "fminm.q", FPR128, Commutable=1>;
183185
def FMAXM_Q: FPALU_rr<0b0010111, 0b011, "fmaxm.q", FPR128, Commutable=1>;
186+
}
184187

185-
def FROUND_Q : FPUnaryOp_r_frm<0b0100011, 0b00100, FPR128, FPR128, "fround.q">;
188+
def FROUND_Q : FPUnaryOp_r_frm<0b0100011, 0b00100, FPR128, FPR128, "fround.q">,
189+
Sched<[WriteFRoundF128, ReadFRoundF128]>;
186190
def FROUNDNX_Q : FPUnaryOp_r_frm<0b0100011, 0b00101, FPR128, FPR128,
187-
"froundnx.q">;
191+
"froundnx.q">,
192+
Sched<[WriteFRoundF128, ReadFRoundF128]>;
188193

194+
let SchedRW = [WriteFCmp128, ReadFCmp128, ReadFCmp128] in {
189195
def FLTQ_Q : FPCmp_rr<0b1010011, 0b101, "fltq.q", FPR128>;
190196
def FLEQ_Q : FPCmp_rr<0b1010011, 0b100, "fleq.q", FPR128>;
197+
}
191198
} // Predicates = [HasStdExtZfa, HasStdExtQ]
192199

193200
let Predicates = [HasStdExtZfa, HasStdExtQ, IsRV64] in {

llvm/lib/Target/RISCV/RISCVSchedGenericOOO.td

+1
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ def : ReadAdvance<ReadFSqrt16, 0>;
494494
//===----------------------------------------------------------------------===//
495495
defm : UnsupportedSchedQ;
496496
defm : UnsupportedSchedV;
497+
defm : UnsupportedSchedZfaWithQ;
497498
defm : UnsupportedSchedZvk;
498499
defm : UnsupportedSchedSFB;
499500
defm : UnsupportedSchedXsfvcp;

llvm/lib/Target/RISCV/RISCVSchedule.td

+13-1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def WriteFCvtF64ToF128 : SchedWrite;
9797
def WriteFRoundF32 : SchedWrite;
9898
def WriteFRoundF64 : SchedWrite;
9999
def WriteFRoundF16 : SchedWrite;
100+
def WriteFRoundF128 : SchedWrite;
100101

101102
def WriteFClass16 : SchedWrite; // 16-bit floating point classify
102103
def WriteFClass32 : SchedWrite; // 32-bit floating point classify
@@ -125,6 +126,7 @@ def WriteFMovI64ToF64 : SchedWrite; // RV64I only
125126
def WriteFLI16 : SchedWrite; // Floating point constant load
126127
def WriteFLI32 : SchedWrite; // Floating point constant load
127128
def WriteFLI64 : SchedWrite; // Floating point constant load
129+
def WriteFLI128 : SchedWrite; // Floating point constant load
128130

129131
def WriteFLD16 : SchedWrite; // Floating point sp load
130132
def WriteFLD32 : SchedWrite; // Floating point sp load
@@ -244,6 +246,7 @@ def ReadFCvtF64ToF128 : SchedRead;
244246
def ReadFRoundF16 : SchedRead;
245247
def ReadFRoundF32 : SchedRead;
246248
def ReadFRoundF64 : SchedRead;
249+
def ReadFRoundF128 : SchedRead;
247250

248251
def ReadFClass16 : SchedRead;
249252
def ReadFClass32 : SchedRead;
@@ -442,7 +445,16 @@ def : ReadAdvance<ReadSFBALU, 0>;
442445
} // Unsupported = true
443446
}
444447

445-
multiclass UnsupportedSchedZfa {
448+
multiclass UnsupportedSchedZfaWithQ {
449+
let Unsupported = true in {
450+
def : WriteRes<WriteFRoundF128, []>;
451+
def : WriteRes<WriteFLI128, []>;
452+
453+
def : ReadAdvance<ReadFRoundF128, 0>;
454+
}
455+
}
456+
457+
multiclass UnsupportedSchedZfa : UnsupportedSchedZfaWithQ {
446458
let Unsupported = true in {
447459
def : WriteRes<WriteFRoundF16, []>;
448460
def : WriteRes<WriteFRoundF32, []>;

0 commit comments

Comments
 (0)