Skip to content

Commit

Permalink
[RISCV] Add sched classes for Zbb integer min max instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmaitland committed Mar 14, 2024
1 parent b97c129 commit 6205441
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
8 changes: 4 additions & 4 deletions llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,13 @@ def CLMULH : ALU_rr<0b0000101, 0b011, "clmulh", Commutable=1>,

let Predicates = [HasStdExtZbb] in {
def MIN : ALU_rr<0b0000101, 0b100, "min", Commutable=1>,
Sched<[WriteIALU, ReadIALU, ReadIALU]>;
Sched<[WriteIMinMax, ReadIMinMax, ReadIMinMax]>;
def MINU : ALU_rr<0b0000101, 0b101, "minu", Commutable=1>,
Sched<[WriteIALU, ReadIALU, ReadIALU]>;
Sched<[WriteIMinMax, ReadIMinMax, ReadIMinMax]>;
def MAX : ALU_rr<0b0000101, 0b110, "max", Commutable=1>,
Sched<[WriteIALU, ReadIALU, ReadIALU]>;
Sched<[WriteIMinMax, ReadIMinMax, ReadIMinMax]>;
def MAXU : ALU_rr<0b0000101, 0b111, "maxu", Commutable=1>,
Sched<[WriteIALU, ReadIALU, ReadIALU]>;
Sched<[WriteIMinMax, ReadIMinMax, ReadIMinMax]>;
} // Predicates = [HasStdExtZbb]

let Predicates = [HasStdExtZbkb] in {
Expand Down
5 changes: 4 additions & 1 deletion llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class SiFive7AnyToGPRBypass<SchedRead read, int cycles = 2>
WriteBEXT, WriteBEXTI,
WriteCLZ, WriteCLZ32, WriteCTZ, WriteCTZ32,
WriteCPOP, WriteCPOP32,
WriteREV8, WriteORCB, WriteSFB,
WriteREV8, WriteORCB, WriteIMinMax, WriteSFB,
WriteIMul, WriteIMul32,
WriteIDiv, WriteIDiv32,
WriteIRem, WriteIRem32,
Expand Down Expand Up @@ -305,6 +305,8 @@ def : WriteRes<WriteCPOP32, [SiFive7PipeB]>;
// orc.b is in the late-B ALU.
def : WriteRes<WriteORCB, [SiFive7PipeB]>;

def : WriteRes<WriteIMinMax, [SiFive7PipeAB]>;

// rev8 is in the late-A and late-B ALUs.
def : WriteRes<WriteREV8, [SiFive7PipeAB]>;

Expand Down Expand Up @@ -1041,6 +1043,7 @@ def : SiFive7AnyToGPRBypass<ReadCTZ32>;
def : ReadAdvance<ReadCPOP, 0>;
def : ReadAdvance<ReadCPOP32, 0>;
def : SiFive7AnyToGPRBypass<ReadORCB>;
def : SiFive7AnyToGPRBypass<ReadIMinMax>;
def : SiFive7AnyToGPRBypass<ReadREV8>;
def : SiFive7AnyToGPRBypass<ReadSHXADD>;
def : SiFive7AnyToGPRBypass<ReadSHXADD32>;
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/RISCV/RISCVSchedSiFiveP400.td
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def : WriteRes<WriteCTZ, [SiFiveP400IntArith]>;
def : WriteRes<WriteCTZ32, [SiFiveP400IntArith]>;

def : WriteRes<WriteORCB, [SiFiveP400IntArith]>;
def : WriteRes<WriteIMinMax, [SiFiveP400IntArith]>;

def : WriteRes<WriteREV8, [SiFiveP400IntArith]>;

Expand Down Expand Up @@ -349,6 +350,7 @@ def : ReadAdvance<ReadCTZ32, 0>;
def : ReadAdvance<ReadCPOP, 0>;
def : ReadAdvance<ReadCPOP32, 0>;
def : ReadAdvance<ReadORCB, 0>;
def : ReadAdvance<ReadIMinMax, 0>;
def : ReadAdvance<ReadREV8, 0>;
def : ReadAdvance<ReadSHXADD, 0>;
def : ReadAdvance<ReadSHXADD32, 0>;
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/RISCV/RISCVSchedXiangShanNanHu.td
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def : WriteRes<WriteRotateImm32, [XS2ALU]>;
def : WriteRes<WriteRotateReg, [XS2ALU]>;
def : WriteRes<WriteRotateReg32, [XS2ALU]>;
def : WriteRes<WriteORCB, [XS2ALU]>;
def : WriteRes<WriteIMinMax, [XS2ALU]>;
def : WriteRes<WriteREV8, [XS2ALU]>;

// Zbkb
Expand Down Expand Up @@ -288,6 +289,7 @@ def : ReadAdvance<ReadCTZ32, 0>;
def : ReadAdvance<ReadCPOP, 0>;
def : ReadAdvance<ReadCPOP32, 0>;
def : XS2LoadToALUBypass<ReadORCB>;
def : XS2LoadToALUBypass<ReadIMinMax>;
def : XS2LoadToALUBypass<ReadREV8>;
// Zbkc
def : ReadAdvance<ReadCLMUL, 0>;
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Target/RISCV/RISCVScheduleZb.td
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def WriteCPOP : SchedWrite;
def WriteCPOP32 : SchedWrite;
def WriteREV8 : SchedWrite;
def WriteORCB : SchedWrite;
def WriteIMinMax : SchedWrite;

// Zbc extension
def WriteCLMUL : SchedWrite; // CLMUL/CLMULR/CLMULH
Expand Down Expand Up @@ -63,6 +64,7 @@ def ReadCPOP : SchedRead;
def ReadCPOP32 : SchedRead;
def ReadREV8 : SchedRead;
def ReadORCB : SchedRead;
def ReadIMinMax : SchedRead;

// Zbc extension
def ReadCLMUL : SchedRead; // CLMUL/CLMULR/CLMULH
Expand Down Expand Up @@ -106,6 +108,7 @@ def : WriteRes<WriteCPOP, []>;
def : WriteRes<WriteCPOP32, []>;
def : WriteRes<WriteREV8, []>;
def : WriteRes<WriteORCB, []>;
def : WriteRes<WriteIMinMax, []>;

def : ReadAdvance<ReadRotateImm, 0>;
def : ReadAdvance<ReadRotateImm32, 0>;
Expand All @@ -119,6 +122,7 @@ def : ReadAdvance<ReadCPOP, 0>;
def : ReadAdvance<ReadCPOP32, 0>;
def : ReadAdvance<ReadREV8, 0>;
def : ReadAdvance<ReadORCB, 0>;
def : ReadAdvance<ReadIMinMax, 0>;
}
}

Expand Down

0 comments on commit 6205441

Please sign in to comment.