Skip to content

Commit 1f8d11d

Browse files
committed
Add new flag resource.
1 parent 76dabf7 commit 1f8d11d

13 files changed

+11196
-11107
lines changed

llvm/lib/Target/AArch64/AArch64SchedNeoverseV1.td

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ def V1UnitV0 : ProcResource<1>; // FP/ASIMD 0
5555
def V1UnitV1 : ProcResource<1>; // FP/ASIMD 1
5656
def V1UnitV2 : ProcResource<1>; // FP/ASIMD 2
5757
def V1UnitV3 : ProcResource<1>; // FP/ASIMD 3
58+
def V1UnitFlg : ProcResource<3>; // Flags
5859

5960
def V1UnitI : ProcResGroup<[V1UnitS,
6061
V1UnitM0, V1UnitM1]>; // Integer units
61-
def V1UnitJ : ProcResGroup<[V1UnitS, V1UnitM0]>; // Integer 0-2 units
6262
def V1UnitM : ProcResGroup<[V1UnitM0, V1UnitM1]>; // Integer multicycle units
6363
def V1UnitL : ProcResGroup<[V1UnitL01, V1UnitL2]>; // Load units
6464
def V1UnitV : ProcResGroup<[V1UnitV0, V1UnitV1,
@@ -98,13 +98,14 @@ def V1Write_0c_0Z : SchedWriteRes<[]>;
9898

9999
def V1Write_1c_1B : SchedWriteRes<[V1UnitB]> { let Latency = 1; }
100100
def V1Write_1c_1I : SchedWriteRes<[V1UnitI]> { let Latency = 1; }
101-
def V1Write_1c_1J : SchedWriteRes<[V1UnitJ]> { let Latency = 1; }
101+
def V1Write_1c_1I_1Flg : SchedWriteRes<[V1UnitI, V1UnitFlg]> { let Latency = 1; }
102102
def V1Write_4c_1L : SchedWriteRes<[V1UnitL]> { let Latency = 4; }
103103
def V1Write_6c_1L : SchedWriteRes<[V1UnitL]> { let Latency = 6; }
104104
def V1Write_1c_1L01 : SchedWriteRes<[V1UnitL01]> { let Latency = 1; }
105105
def V1Write_4c_1L01 : SchedWriteRes<[V1UnitL01]> { let Latency = 4; }
106106
def V1Write_6c_1L01 : SchedWriteRes<[V1UnitL01]> { let Latency = 6; }
107107
def V1Write_2c_1M : SchedWriteRes<[V1UnitM]> { let Latency = 2; }
108+
def V1Write_2c_1M_1Flg : SchedWriteRes<[V1UnitM, V1UnitFlg]> { let Latency = 2; }
108109
def V1Write_3c_1M : SchedWriteRes<[V1UnitM]> { let Latency = 3; }
109110
def V1Write_4c_1M : SchedWriteRes<[V1UnitM]> { let Latency = 4; }
110111
def V1Write_1c_1M0 : SchedWriteRes<[V1UnitM0]> { let Latency = 1; }
@@ -595,7 +596,7 @@ def : InstRW<[V1Write_1c_1B], (instregex "^[CT]BN?Z[XW]$")>;
595596
def : SchedAlias<WriteI, V1Write_1c_1I>;
596597

597598
// ALU, basic, flagset
598-
def : InstRW<[V1Write_1c_1J],
599+
def : InstRW<[V1Write_1c_1I_1Flg],
599600
(instregex "^(ADD|SUB)S[WX]r[ir]$",
600601
"^(ADC|SBC)S[WX]r$",
601602
"^ANDS[WX]ri$",
@@ -614,19 +615,19 @@ def : SchedAlias<WriteISReg, V1WriteISReg>;
614615
// Arithmetic, flagset, LSL shift, shift <= 4
615616
// Arithmetic, flagset, LSR/ASR/ROR shift or LSL shift > 4
616617
def V1WriteISRegS : SchedWriteVariant<
617-
[SchedVar<IsCheapLSL, [V1Write_1c_1J]>,
618-
SchedVar<NoSchedPred, [V1Write_2c_1M]>]>;
618+
[SchedVar<IsCheapLSL, [V1Write_1c_1I_1Flg]>,
619+
SchedVar<NoSchedPred, [V1Write_2c_1M_1Flg]>]>;
619620
def : InstRW<[V1WriteISRegS],
620621
(instregex "^(ADD|SUB)S(([WX]r[sx])|Xrx64)$")>;
621622

622623
// Logical, shift, no flagset
623624
def : InstRW<[V1Write_1c_1I], (instregex "^(AND|BIC|EON|EOR|ORN|ORR)[WX]rs$")>;
624625

625626
// Logical, shift, flagset
626-
def : InstRW<[V1Write_2c_1M], (instregex "^(AND|BIC)S[WX]rs$")>;
627+
def : InstRW<[V1Write_2c_1M_1Flg], (instregex "^(AND|BIC)S[WX]rs$")>;
627628

628629
// Flag manipulation instructions
629-
def : InstRW<[V1Write_1c_1J], (instrs SETF8, SETF16, RMIF, CFINV)>;
630+
def : InstRW<[V1Write_1c_1I_1Flg], (instrs SETF8, SETF16, RMIF, CFINV)>;
630631

631632

632633
// Divide and multiply instructions

llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ def V2UnitV3 : ProcResource<1>; // FP/ASIMD 3
5252
def V2UnitL01 : ProcResource<2>; // Load/Store 0/1
5353
def V2UnitL2 : ProcResource<1>; // Load 2
5454
def V2UnitD : ProcResource<2>; // Store data 0/1
55+
def V2UnitFlg : ProcResource<3>; // Flags
5556

5657
def V2UnitR : ProcResGroup<[V2UnitS0, V2UnitS1]>; // Integer single-cycle 0/1
5758
def V2UnitS : ProcResGroup<[V2UnitS0, V2UnitS1, V2UnitS2, V2UnitS3]>; // Integer single-cycle 0/1/2/3
5859
def V2UnitF : ProcResGroup<[V2UnitS0, V2UnitS1, V2UnitM0, V2UnitM1]>; // Integer single-cycle 0/1 and single/multicycle 0/1
59-
def V2UnitG : ProcResGroup<[V2UnitS0, V2UnitS1, V2UnitM0]>; // Integer single-cycle 0/1 and single/multicycle 0
6060
def V2UnitI : ProcResGroup<[V2UnitS0, V2UnitS1, V2UnitS2, V2UnitS3, V2UnitM0, V2UnitM1]>; // Integer single-cycle 0/1/2/3 and single/multicycle 0/1
6161
def V2UnitM : ProcResGroup<[V2UnitM0, V2UnitM1]>; // Integer single/multicycle 0/1
6262
def V2UnitL : ProcResGroup<[V2UnitL01, V2UnitL2]>; // Load/Store 0/1 and Load 2
@@ -98,12 +98,13 @@ def V2Write_0c : SchedWriteRes<[]> { let Latency = 0; }
9898

9999
def V2Write_1c_1B : SchedWriteRes<[V2UnitB]> { let Latency = 1; }
100100
def V2Write_1c_1F : SchedWriteRes<[V2UnitF]> { let Latency = 1; }
101-
def V2Write_1c_1G : SchedWriteRes<[V2UnitG]> { let Latency = 1; }
101+
def V2Write_1c_1F_1Flg : SchedWriteRes<[V2UnitF, V2UnitFlg]> { let Latency = 1; }
102102
def V2Write_1c_1I : SchedWriteRes<[V2UnitI]> { let Latency = 1; }
103103
def V2Write_1c_1M : SchedWriteRes<[V2UnitM]> { let Latency = 1; }
104104
def V2Write_1c_1M0 : SchedWriteRes<[V2UnitM0]> { let Latency = 1; }
105105
def V2Write_1c_1L01 : SchedWriteRes<[V2UnitL01]> { let Latency = 1; }
106106
def V2Write_2c_1M : SchedWriteRes<[V2UnitM]> { let Latency = 2; }
107+
def V2Write_2c_1M_1Flg : SchedWriteRes<[V2UnitM, V2UnitFlg]> { let Latency = 2; }
107108
def V2Write_3c_1M : SchedWriteRes<[V2UnitM]> { let Latency = 3; }
108109
def V2Write_2c_1M0 : SchedWriteRes<[V2UnitM0]> { let Latency = 2; }
109110
def V2Write_3c_1M0 : SchedWriteRes<[V2UnitM0]> { let Latency = 3; }
@@ -888,12 +889,12 @@ def V2Write_ArithI : SchedWriteVariant<[
888889
SchedVar<NoSchedPred, [V2Write_2c_1M]>]>;
889890

890891
def V2Write_ArithF : SchedWriteVariant<[
891-
SchedVar<IsCheapLSL, [V2Write_1c_1G]>,
892-
SchedVar<NoSchedPred, [V2Write_2c_1M]>]>;
892+
SchedVar<IsCheapLSL, [V2Write_1c_1F_1Flg]>,
893+
SchedVar<NoSchedPred, [V2Write_2c_1M_1Flg]>]>;
893894

894895
def V2Write_Logical : SchedWriteVariant<[
895-
SchedVar<NeoverseNoLSL, [V2Write_1c_1G]>,
896-
SchedVar<NoSchedPred, [V2Write_2c_1M]>]>;
896+
SchedVar<NeoverseNoLSL, [V2Write_1c_1F_1Flg]>,
897+
SchedVar<NoSchedPred, [V2Write_2c_1M_1Flg]>]>;
897898

898899
def V2Write_Extr : SchedWriteVariant<[
899900
SchedVar<IsRORImmIdiomPred, [V2Write_1c_1I]>,
@@ -1111,7 +1112,7 @@ def : InstRW<[V2Write_1c_1B_1R], (instrs BL, BLR)>;
11111112
def : SchedAlias<WriteI, V2Write_1c_1I>;
11121113

11131114
// ALU, basic, flagset
1114-
def : InstRW<[V2Write_1c_1G],
1115+
def : InstRW<[V2Write_1c_1F_1Flg],
11151116
(instregex "^(ADD|SUB)S[WX]r[ir]$",
11161117
"^(ADC|SBC)S[WX]r$",
11171118
"^ANDS[WX]ri$",
@@ -1132,7 +1133,7 @@ def : InstRW<[V2Write_ArithF],
11321133
def : InstRW<[V2Write_2c_1M], (instrs ADDG, SUBG)>;
11331134

11341135
// Conditional compare
1135-
def : InstRW<[V2Write_1c_1G], (instregex "^CCM[NP][WX][ir]")>;
1136+
def : InstRW<[V2Write_1c_1F_1Flg], (instregex "^CCM[NP][WX][ir]")>;
11361137

11371138
// Convert floating-point condition flags
11381139
// Flag manipulation instructions
@@ -1146,7 +1147,7 @@ def : InstRW<[V2Write_2c_1M], (instrs IRG, IRGstack)>;
11461147
def : InstRW<[V2Write_1c_1I], (instrs GMI, SUBP)>;
11471148

11481149
// Subtract Pointer, flagset
1149-
def : InstRW<[V2Write_1c_1G], (instrs SUBPS)>;
1150+
def : InstRW<[V2Write_1c_1F_1Flg], (instrs SUBPS)>;
11501151

11511152
// Logical, shift, no flagset
11521153
def : InstRW<[V2Write_1c_1I], (instregex "^(AND|BIC|EON|EOR|ORN)[WX]rs$")>;

llvm/test/tools/llvm-mca/AArch64/Neoverse/512tvb-sve-instructions.s

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,25 @@ abs z0.b, p0/m, z0.b
2121
# CHECK-NEXT: [0.1] - V1UnitB
2222
# CHECK-NEXT: [1.0] - V1UnitD
2323
# CHECK-NEXT: [1.1] - V1UnitD
24-
# CHECK-NEXT: [2] - V1UnitL2
25-
# CHECK-NEXT: [3.0] - V1UnitL01
26-
# CHECK-NEXT: [3.1] - V1UnitL01
27-
# CHECK-NEXT: [4] - V1UnitM0
28-
# CHECK-NEXT: [5] - V1UnitM1
29-
# CHECK-NEXT: [6.0] - V1UnitS
30-
# CHECK-NEXT: [6.1] - V1UnitS
31-
# CHECK-NEXT: [7] - V1UnitV0
32-
# CHECK-NEXT: [8] - V1UnitV1
33-
# CHECK-NEXT: [9] - V1UnitV2
34-
# CHECK-NEXT: [10] - V1UnitV3
24+
# CHECK-NEXT: [2.0] - V1UnitFlg
25+
# CHECK-NEXT: [2.1] - V1UnitFlg
26+
# CHECK-NEXT: [2.2] - V1UnitFlg
27+
# CHECK-NEXT: [3] - V1UnitL2
28+
# CHECK-NEXT: [4.0] - V1UnitL01
29+
# CHECK-NEXT: [4.1] - V1UnitL01
30+
# CHECK-NEXT: [5] - V1UnitM0
31+
# CHECK-NEXT: [6] - V1UnitM1
32+
# CHECK-NEXT: [7.0] - V1UnitS
33+
# CHECK-NEXT: [7.1] - V1UnitS
34+
# CHECK-NEXT: [8] - V1UnitV0
35+
# CHECK-NEXT: [9] - V1UnitV1
36+
# CHECK-NEXT: [10] - V1UnitV2
37+
# CHECK-NEXT: [11] - V1UnitV3
3538

3639
# CHECK: Resource pressure per iteration:
37-
# CHECK-NEXT: [0.0] [0.1] [1.0] [1.1] [2] [3.0] [3.1] [4] [5] [6.0] [6.1] [7] [8] [9] [10]
38-
# CHECK-NEXT: - - - - - - - - - - - 0.50 0.50 - -
40+
# CHECK-NEXT: [0.0] [0.1] [1.0] [1.1] [2.0] [2.1] [2.2] [3] [4.0] [4.1] [5] [6] [7.0] [7.1] [8] [9] [10] [11]
41+
# CHECK-NEXT: - - - - - - - - - - - - - - 0.50 0.50 - -
3942

4043
# CHECK: Resource pressure by instruction:
41-
# CHECK-NEXT: [0.0] [0.1] [1.0] [1.1] [2] [3.0] [3.1] [4] [5] [6.0] [6.1] [7] [8] [9] [10] Instructions:
42-
# CHECK-NEXT: - - - - - - - - - - - 0.50 0.50 - - abs z0.b, p0/m, z0.b
44+
# CHECK-NEXT: [0.0] [0.1] [1.0] [1.1] [2.0] [2.1] [2.2] [3] [4.0] [4.1] [5] [6] [7.0] [7.1] [8] [9] [10] [11] Instructions:
45+
# CHECK-NEXT: - - - - - - - - - - - - - - 0.50 0.50 - - abs z0.b, p0/m, z0.b

0 commit comments

Comments
 (0)