Skip to content

[RISCV][Scheduler] Add scheduling definitions for 128-bit Zfa instructions #140003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions llvm/lib/Target/RISCV/RISCVInstrInfoZfa.td
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,24 @@ def FLEQ_H : FPCmp_rr<0b1010010, 0b100, "fleq.h", FPR16>;

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

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

def FROUND_Q : FPUnaryOp_r_frm<0b0100011, 0b00100, FPR128, FPR128, "fround.q">;
def FROUND_Q : FPUnaryOp_r_frm<0b0100011, 0b00100, FPR128, FPR128, "fround.q">,
Sched<[WriteFRoundF128, ReadFRoundF128]>;
def FROUNDNX_Q : FPUnaryOp_r_frm<0b0100011, 0b00101, FPR128, FPR128,
"froundnx.q">;
"froundnx.q">,
Sched<[WriteFRoundF128, ReadFRoundF128]>;

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

let Predicates = [HasStdExtZfa, HasStdExtQ, IsRV64] in {
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/RISCV/RISCVSchedGenericOOO.td
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ def : ReadAdvance<ReadFSqrt16, 0>;
//===----------------------------------------------------------------------===//
defm : UnsupportedSchedQ;
defm : UnsupportedSchedV;
defm : UnsupportedSchedZfaWithQ;
defm : UnsupportedSchedZvk;
defm : UnsupportedSchedSFB;
defm : UnsupportedSchedXsfvcp;
Expand Down
14 changes: 13 additions & 1 deletion llvm/lib/Target/RISCV/RISCVSchedule.td
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def WriteFCvtF64ToF128 : SchedWrite;
def WriteFRoundF32 : SchedWrite;
def WriteFRoundF64 : SchedWrite;
def WriteFRoundF16 : SchedWrite;
def WriteFRoundF128 : SchedWrite;

def WriteFClass16 : SchedWrite; // 16-bit floating point classify
def WriteFClass32 : SchedWrite; // 32-bit floating point classify
Expand Down Expand Up @@ -125,6 +126,7 @@ def WriteFMovI64ToF64 : SchedWrite; // RV64I only
def WriteFLI16 : SchedWrite; // Floating point constant load
def WriteFLI32 : SchedWrite; // Floating point constant load
def WriteFLI64 : SchedWrite; // Floating point constant load
def WriteFLI128 : SchedWrite; // Floating point constant load

def WriteFLD16 : SchedWrite; // Floating point sp load
def WriteFLD32 : SchedWrite; // Floating point sp load
Expand Down Expand Up @@ -244,6 +246,7 @@ def ReadFCvtF64ToF128 : SchedRead;
def ReadFRoundF16 : SchedRead;
def ReadFRoundF32 : SchedRead;
def ReadFRoundF64 : SchedRead;
def ReadFRoundF128 : SchedRead;

def ReadFClass16 : SchedRead;
def ReadFClass32 : SchedRead;
Expand Down Expand Up @@ -442,7 +445,16 @@ def : ReadAdvance<ReadSFBALU, 0>;
} // Unsupported = true
}

multiclass UnsupportedSchedZfa {
multiclass UnsupportedSchedZfaWithQ {
let Unsupported = true in {
def : WriteRes<WriteFRoundF128, []>;
def : WriteRes<WriteFLI128, []>;

def : ReadAdvance<ReadFRoundF128, 0>;
}
}

multiclass UnsupportedSchedZfa : UnsupportedSchedZfaWithQ {
let Unsupported = true in {
def : WriteRes<WriteFRoundF16, []>;
def : WriteRes<WriteFRoundF32, []>;
Expand Down