Skip to content

Commit 04d9b98

Browse files
[RISCV] Add sched classes for Zbb integer min max instructions
1 parent 744a23f commit 04d9b98

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoZb.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,13 +424,13 @@ def CLMULH : ALU_rr<0b0000101, 0b011, "clmulh", Commutable=1>,
424424

425425
let Predicates = [HasStdExtZbb] in {
426426
def MIN : ALU_rr<0b0000101, 0b100, "min", Commutable=1>,
427-
Sched<[WriteIALU, ReadIALU, ReadIALU]>;
427+
Sched<[WriteIMinMax, ReadIMinMax, ReadIMinMax]>;
428428
def MINU : ALU_rr<0b0000101, 0b101, "minu", Commutable=1>,
429-
Sched<[WriteIALU, ReadIALU, ReadIALU]>;
429+
Sched<[WriteIMinMax, ReadIMinMax, ReadIMinMax]>;
430430
def MAX : ALU_rr<0b0000101, 0b110, "max", Commutable=1>,
431-
Sched<[WriteIALU, ReadIALU, ReadIALU]>;
431+
Sched<[WriteIMinMax, ReadIMinMax, ReadIMinMax]>;
432432
def MAXU : ALU_rr<0b0000101, 0b111, "maxu", Commutable=1>,
433-
Sched<[WriteIALU, ReadIALU, ReadIALU]>;
433+
Sched<[WriteIMinMax, ReadIMinMax, ReadIMinMax]>;
434434
} // Predicates = [HasStdExtZbb]
435435

436436
let Predicates = [HasStdExtZbkb] in {

llvm/lib/Target/RISCV/RISCVSchedSiFive7.td

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class SiFive7AnyToGPRBypass<SchedRead read, int cycles = 2>
186186
WriteBEXT, WriteBEXTI,
187187
WriteCLZ, WriteCLZ32, WriteCTZ, WriteCTZ32,
188188
WriteCPOP, WriteCPOP32,
189-
WriteREV8, WriteORCB, WriteSFB,
189+
WriteREV8, WriteORCB, WriteIMinMax, WriteSFB,
190190
WriteIMul, WriteIMul32,
191191
WriteIDiv, WriteIDiv32,
192192
WriteIRem, WriteIRem32,
@@ -305,6 +305,8 @@ def : WriteRes<WriteCPOP32, [SiFive7PipeB]>;
305305
// orc.b is in the late-B ALU.
306306
def : WriteRes<WriteORCB, [SiFive7PipeB]>;
307307

308+
def : WriteRes<WriteIMinMax, [SiFive7PipeAB]>;
309+
308310
// rev8 is in the late-A and late-B ALUs.
309311
def : WriteRes<WriteREV8, [SiFive7PipeAB]>;
310312

@@ -1041,6 +1043,7 @@ def : SiFive7AnyToGPRBypass<ReadCTZ32>;
10411043
def : ReadAdvance<ReadCPOP, 0>;
10421044
def : ReadAdvance<ReadCPOP32, 0>;
10431045
def : SiFive7AnyToGPRBypass<ReadORCB>;
1046+
def : SiFive7AnyToGPRBypass<ReadIMinMax>;
10441047
def : SiFive7AnyToGPRBypass<ReadREV8>;
10451048
def : SiFive7AnyToGPRBypass<ReadSHXADD>;
10461049
def : SiFive7AnyToGPRBypass<ReadSHXADD32>;

llvm/lib/Target/RISCV/RISCVSchedSiFiveP400.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def : WriteRes<WriteCTZ, [SiFiveP400IntArith]>;
109109
def : WriteRes<WriteCTZ32, [SiFiveP400IntArith]>;
110110

111111
def : WriteRes<WriteORCB, [SiFiveP400IntArith]>;
112+
def : WriteRes<WriteIMinMax, [SiFiveP400IntArith]>;
112113

113114
def : WriteRes<WriteREV8, [SiFiveP400IntArith]>;
114115

@@ -349,6 +350,7 @@ def : ReadAdvance<ReadCTZ32, 0>;
349350
def : ReadAdvance<ReadCPOP, 0>;
350351
def : ReadAdvance<ReadCPOP32, 0>;
351352
def : ReadAdvance<ReadORCB, 0>;
353+
def : ReadAdvance<ReadIMinMax, 0>;
352354
def : ReadAdvance<ReadREV8, 0>;
353355
def : ReadAdvance<ReadSHXADD, 0>;
354356
def : ReadAdvance<ReadSHXADD32, 0>;

llvm/lib/Target/RISCV/RISCVSchedXiangShanNanHu.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def : WriteRes<WriteRotateImm32, [XS2ALU]>;
8585
def : WriteRes<WriteRotateReg, [XS2ALU]>;
8686
def : WriteRes<WriteRotateReg32, [XS2ALU]>;
8787
def : WriteRes<WriteORCB, [XS2ALU]>;
88+
def : WriteRes<WriteIMinMax, [XS2ALU]>;
8889
def : WriteRes<WriteREV8, [XS2ALU]>;
8990

9091
// Zbkb
@@ -288,6 +289,7 @@ def : ReadAdvance<ReadCTZ32, 0>;
288289
def : ReadAdvance<ReadCPOP, 0>;
289290
def : ReadAdvance<ReadCPOP32, 0>;
290291
def : XS2LoadToALUBypass<ReadORCB>;
292+
def : XS2LoadToALUBypass<ReadIMinMax>;
291293
def : XS2LoadToALUBypass<ReadREV8>;
292294
// Zbkc
293295
def : ReadAdvance<ReadCLMUL, 0>;

llvm/lib/Target/RISCV/RISCVScheduleZb.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def WriteCPOP : SchedWrite;
2525
def WriteCPOP32 : SchedWrite;
2626
def WriteREV8 : SchedWrite;
2727
def WriteORCB : SchedWrite;
28+
def WriteIMinMax : SchedWrite;
2829

2930
// Zbc extension
3031
def WriteCLMUL : SchedWrite; // CLMUL/CLMULR/CLMULH
@@ -63,6 +64,7 @@ def ReadCPOP : SchedRead;
6364
def ReadCPOP32 : SchedRead;
6465
def ReadREV8 : SchedRead;
6566
def ReadORCB : SchedRead;
67+
def ReadIMinMax : SchedRead;
6668

6769
// Zbc extension
6870
def ReadCLMUL : SchedRead; // CLMUL/CLMULR/CLMULH
@@ -106,6 +108,7 @@ def : WriteRes<WriteCPOP, []>;
106108
def : WriteRes<WriteCPOP32, []>;
107109
def : WriteRes<WriteREV8, []>;
108110
def : WriteRes<WriteORCB, []>;
111+
def : WriteRes<WriteIMinMax, []>;
109112

110113
def : ReadAdvance<ReadRotateImm, 0>;
111114
def : ReadAdvance<ReadRotateImm32, 0>;
@@ -119,6 +122,7 @@ def : ReadAdvance<ReadCPOP, 0>;
119122
def : ReadAdvance<ReadCPOP32, 0>;
120123
def : ReadAdvance<ReadREV8, 0>;
121124
def : ReadAdvance<ReadORCB, 0>;
125+
def : ReadAdvance<ReadIMinMax, 0>;
122126
}
123127
}
124128

0 commit comments

Comments
 (0)