Skip to content

Commit e1d4d1c

Browse files
lian wangLian Wang
authored andcommitted
[RISCV] Add schedule class for Zbm and Zbe extension
Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D119805
1 parent 05e82be commit e1d4d1c

File tree

4 files changed

+57
-7
lines changed

4 files changed

+57
-7
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoZb.td

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -524,15 +524,19 @@ def MAXU : ALU_rr<0b0000101, 0b111, "maxu">,
524524
let Predicates = [HasStdExtZbe] in {
525525
// NOTE: These mnemonics are from the 0.94 spec. There is a name conflict with
526526
// bext in the 0.93 spec.
527-
def BDECOMPRESS : ALU_rr<0b0100100, 0b110, "bdecompress">, Sched<[]>;
528-
def BCOMPRESS : ALU_rr<0b0000100, 0b110, "bcompress">, Sched<[]>;
527+
def BDECOMPRESS : ALU_rr<0b0100100, 0b110, "bdecompress">,
528+
Sched<[WriteDecompress, ReadDecompress, ReadDecompress]>;
529+
def BCOMPRESS : ALU_rr<0b0000100, 0b110, "bcompress">,
530+
Sched<[WriteCompress, ReadCompress, ReadCompress]>;
529531
} // Predicates = [HasStdExtZbe]
530532

531533
let Predicates = [HasStdExtZbe, IsRV64] in {
532534
// NOTE: These mnemonics are from the 0.94 spec. There is a name conflict with
533535
// bextw in the 0.93 spec.
534-
def BDECOMPRESSW : ALUW_rr<0b0100100, 0b110, "bdecompressw">, Sched<[]>;
535-
def BCOMPRESSW : ALUW_rr<0b0000100, 0b110, "bcompressw">, Sched<[]>;
536+
def BDECOMPRESSW : ALUW_rr<0b0100100, 0b110, "bdecompressw">,
537+
Sched<[WriteDecompress32, ReadDecompress32, ReadDecompress32]>;
538+
def BCOMPRESSW : ALUW_rr<0b0000100, 0b110, "bcompressw">,
539+
Sched<[WriteCompress32, ReadCompress32, ReadCompress32]>;
536540
} // Predicates = [HasStdExtZbe, IsRV64]
537541

538542
let Predicates = [HasStdExtZbpOrZbkb] in {
@@ -551,10 +555,12 @@ def PACKUW : ALUW_rr<0b0100100, 0b100, "packuw">, Sched<[]>;
551555

552556
let Predicates = [HasStdExtZbm, IsRV64] in {
553557
def BMATFLIP : RVBUnary<0b0110000, 0b00011, 0b001, OPC_OP_IMM, "bmatflip">,
554-
Sched<[]>;
558+
Sched<[WriteBMatrix, ReadBMatrix]>;
555559

556-
def BMATOR : ALU_rr<0b0000100, 0b011, "bmator">, Sched<[]>;
557-
def BMATXOR : ALU_rr<0b0100100, 0b011, "bmatxor">, Sched<[]>;
560+
def BMATOR : ALU_rr<0b0000100, 0b011, "bmator">,
561+
Sched<[WriteBMatrix, ReadBMatrix, ReadBMatrix]>;
562+
def BMATXOR : ALU_rr<0b0100100, 0b011, "bmatxor">,
563+
Sched<[WriteBMatrix, ReadBMatrix, ReadBMatrix]>;
558564
} // Predicates = [HasStdExtZbm, IsRV64]
559565

560566
let Predicates = [HasStdExtZbf] in

llvm/lib/Target/RISCV/RISCVSchedRocket.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ defm : UnsupportedSchedZba;
242242
defm : UnsupportedSchedZbb;
243243
defm : UnsupportedSchedZbc;
244244
defm : UnsupportedSchedZbs;
245+
defm : UnsupportedSchedZbe;
245246
defm : UnsupportedSchedZbf;
247+
defm : UnsupportedSchedZbm;
246248
defm : UnsupportedSchedZfh;
247249
}

llvm/lib/Target/RISCV/RISCVSchedSiFive7.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ defm : UnsupportedSchedZba;
229229
defm : UnsupportedSchedZbb;
230230
defm : UnsupportedSchedZbc;
231231
defm : UnsupportedSchedZbs;
232+
defm : UnsupportedSchedZbe;
232233
defm : UnsupportedSchedZbf;
234+
defm : UnsupportedSchedZbm;
233235
defm : UnsupportedSchedZfh;
234236
}

llvm/lib/Target/RISCV/RISCVScheduleB.td

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,19 @@ def WriteCLMUL : SchedWrite; // CLMUL/CLMULR/CLMULH
3333
def WriteSingleBit : SchedWrite; // BCLR/BSET/BINV/BEXT
3434
def WriteSingleBitImm: SchedWrite; // BCLRI/BSETI/BINVI/BEXTI
3535

36+
// Zbe extension
37+
def WriteDecompress : SchedWrite; // bdecompress
38+
def WriteCompress : SchedWrite; // bcompress
39+
def WriteDecompress32: SchedWrite; // bdecompressw
40+
def WriteCompress32 : SchedWrite; // bcompressw
41+
3642
// Zbf extension
3743
def WriteBFP : SchedWrite; // BFP
3844
def WriteBFP32 : SchedWrite; // BFPW
3945

46+
// Zbm extension
47+
def WriteBMatrix : SchedWrite; // bmator/bmatxor/bmatflip
48+
4049
/// Define scheduler resources associated with use operands.
4150

4251
// Zba extension
@@ -64,10 +73,19 @@ def ReadCLMUL : SchedRead; // CLMUL/CLMULR/CLMULH
6473
def ReadSingleBit : SchedRead; // BCLR/BSET/BINV/BEXT
6574
def ReadSingleBitImm: SchedRead; // BCLRI/BSETI/BINVI/BEXTI
6675

76+
// Zbe extension
77+
def ReadDecompress : SchedRead; // bdecompress
78+
def ReadCompress : SchedRead; // bcompress
79+
def ReadDecompress32: SchedRead; // bdecompressw
80+
def ReadCompress32 : SchedRead; // bcompressw
81+
6782
// Zbf extension
6883
def ReadBFP : SchedRead; // BFP
6984
def ReadBFP32 : SchedRead; // BFPW
7085

86+
// Zbm extension
87+
def ReadBMatrix : SchedRead; // bmator/bmatxor/bmatflip
88+
7189
/// Define default scheduler resources for B.
7290

7391
multiclass UnsupportedSchedZba {
@@ -128,6 +146,20 @@ def : ReadAdvance<ReadSingleBitImm, 0>;
128146
}
129147
}
130148

149+
multiclass UnsupportedSchedZbe {
150+
let Unsupported = true in {
151+
def : WriteRes<WriteDecompress, []>;
152+
def : WriteRes<WriteCompress, []>;
153+
def : WriteRes<WriteDecompress32, []>;
154+
def : WriteRes<WriteCompress32, []>;
155+
156+
def : ReadAdvance<ReadDecompress, 0>;
157+
def : ReadAdvance<ReadCompress, 0>;
158+
def : ReadAdvance<ReadDecompress32, 0>;
159+
def : ReadAdvance<ReadCompress32, 0>;
160+
}
161+
}
162+
131163
multiclass UnsupportedSchedZbf {
132164
let Unsupported = true in {
133165
def : WriteRes<WriteBFP, []>;
@@ -137,3 +169,11 @@ def : ReadAdvance<ReadBFP, 0>;
137169
def : ReadAdvance<ReadBFP32, 0>;
138170
}
139171
}
172+
173+
multiclass UnsupportedSchedZbm {
174+
let Unsupported = true in {
175+
def : WriteRes<WriteBMatrix, []>;
176+
177+
def : ReadAdvance<ReadBMatrix, 0>;
178+
}
179+
}

0 commit comments

Comments
 (0)