Skip to content

Commit 73aa4e4

Browse files
authored
[RISCV] Use listconcat to shorten some of the profile feature lists. (#102356)
The profiles in a family gain more features overtime so each year can mostly inherit from the previous year. I did make an exception for Za128rs becoming Za64rs in RVA22. Technically Za64rs is a stricter requirement than Za128rs so it would be ok to have both, but I didn't want to change existing ISA strings. I used RVA20U64BaseFeatures as the base for RVB23U64 to shorten its list a bit. RVB23 is the first year for that family and was created as a reaction to too many features being added to RVA so inheriting from an earlier RVA seemed somewhat reasonable to me.
1 parent 32c69fa commit 73aa4e4

File tree

1 file changed

+113
-151
lines changed

1 file changed

+113
-151
lines changed

llvm/lib/Target/RISCV/RISCVProfiles.td

Lines changed: 113 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -6,169 +6,113 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
class RISCVProfile<string name, list<SubtargetFeature> features>
10-
: SubtargetFeature<name, "Is" # NAME, "true",
11-
"RISC-V " # name # " profile", features> {
12-
// Indicates if the profile is not yet ratified, so should be treated as
13-
// experimental.
14-
bit Experimental = false;
15-
}
16-
class RISCVExperimentalProfile<string name, list<SubtargetFeature> features>
17-
: RISCVProfile<"experimental-"#name, features> {
18-
let Experimental = true;
19-
}
9+
//===----------------------------------------------------------------------===//
10+
// Profile Featuyre Lists
11+
//===----------------------------------------------------------------------===//
12+
13+
// RVI Profile Family
2014

2115
defvar RVI20U32Features = [Feature32Bit, FeatureStdExtI];
2216
defvar RVI20U64Features = [Feature64Bit, FeatureStdExtI];
2317

24-
defvar RVA20U64Features = [Feature64Bit,
25-
FeatureStdExtI,
26-
FeatureStdExtM,
27-
FeatureStdExtA,
28-
FeatureStdExtF,
29-
FeatureStdExtD,
30-
FeatureStdExtC,
31-
FeatureStdExtZicntr,
32-
FeatureStdExtZiccif,
33-
FeatureStdExtZiccrse,
34-
FeatureStdExtZiccamoa,
35-
FeatureStdExtZa128rs,
36-
FeatureStdExtZicclsm];
18+
// RVA Profile Family
19+
20+
defvar RVA20U64BaseFeatures = [Feature64Bit,
21+
FeatureStdExtI,
22+
FeatureStdExtM,
23+
FeatureStdExtA,
24+
FeatureStdExtF,
25+
FeatureStdExtD,
26+
FeatureStdExtC,
27+
FeatureStdExtZicntr,
28+
FeatureStdExtZiccif,
29+
FeatureStdExtZiccrse,
30+
FeatureStdExtZiccamoa,
31+
FeatureStdExtZicclsm];
32+
defvar RVA20U64Features = !listconcat(RVA20U64BaseFeatures,
33+
[FeatureStdExtZa128rs]);
3734

35+
defvar RVA20S64BaseFeatures = [FeatureStdExtZifencei,
36+
FeatureStdExtSvbare,
37+
FeatureStdExtSvade,
38+
FeatureStdExtSsccptr,
39+
FeatureStdExtSstvecd,
40+
FeatureStdExtSstvala];
3841
defvar RVA20S64Features = !listconcat(RVA20U64Features,
39-
[FeatureStdExtZifencei,
40-
FeatureStdExtSvbare,
41-
FeatureStdExtSvade,
42-
FeatureStdExtSsccptr,
43-
FeatureStdExtSstvecd,
44-
FeatureStdExtSstvala]);
42+
RVA20S64BaseFeatures);
4543

46-
defvar RVA22U64Features = [Feature64Bit,
47-
FeatureStdExtI,
48-
FeatureStdExtM,
49-
FeatureStdExtA,
50-
FeatureStdExtF,
51-
FeatureStdExtD,
52-
FeatureStdExtC,
53-
FeatureStdExtZicntr,
54-
FeatureStdExtZiccif,
55-
FeatureStdExtZiccrse,
56-
FeatureStdExtZiccamoa,
57-
FeatureStdExtZicclsm,
58-
FeatureStdExtZa64rs,
59-
FeatureStdExtZihpm,
60-
FeatureStdExtZihintpause,
61-
FeatureStdExtZba,
62-
FeatureStdExtZbb,
63-
FeatureStdExtZbs,
64-
FeatureStdExtZic64b,
65-
FeatureStdExtZicbom,
66-
FeatureStdExtZicbop,
67-
FeatureStdExtZicboz,
68-
FeatureStdExtZfhmin,
69-
FeatureStdExtZkt];
44+
defvar RVA22U64Features = !listconcat(RVA20U64BaseFeatures,
45+
[FeatureStdExtZa64rs,
46+
FeatureStdExtZihpm,
47+
FeatureStdExtZihintpause,
48+
FeatureStdExtZba,
49+
FeatureStdExtZbb,
50+
FeatureStdExtZbs,
51+
FeatureStdExtZic64b,
52+
FeatureStdExtZicbom,
53+
FeatureStdExtZicbop,
54+
FeatureStdExtZicboz,
55+
FeatureStdExtZfhmin,
56+
FeatureStdExtZkt]);
7057

58+
defvar RVA22S64BaseFeatures = !listconcat(RVA20S64BaseFeatures,
59+
[FeatureStdExtSscounterenw,
60+
FeatureStdExtSvpbmt,
61+
FeatureStdExtSvinval]);
7162
defvar RVA22S64Features = !listconcat(RVA22U64Features,
72-
[FeatureStdExtZifencei,
73-
FeatureStdExtSvbare,
74-
FeatureStdExtSvade,
75-
FeatureStdExtSsccptr,
76-
FeatureStdExtSstvecd,
77-
FeatureStdExtSstvala,
78-
FeatureStdExtSscounterenw,
79-
FeatureStdExtSvpbmt,
80-
FeatureStdExtSvinval]);
63+
RVA22S64BaseFeatures);
8164

82-
defvar RVA23U64Features = [Feature64Bit,
83-
FeatureStdExtI,
84-
FeatureStdExtM,
85-
FeatureStdExtA,
86-
FeatureStdExtF,
87-
FeatureStdExtD,
88-
FeatureStdExtC,
89-
FeatureStdExtZicntr,
90-
FeatureStdExtZihpm,
91-
FeatureStdExtZiccif,
92-
FeatureStdExtZiccrse,
93-
FeatureStdExtZiccamoa,
94-
FeatureStdExtZicclsm,
95-
FeatureStdExtZa64rs,
96-
FeatureStdExtZihintpause,
97-
FeatureStdExtZba,
98-
FeatureStdExtZbb,
99-
FeatureStdExtZbs,
100-
FeatureStdExtZic64b,
101-
FeatureStdExtZicbom,
102-
FeatureStdExtZicbop,
103-
FeatureStdExtZicboz,
104-
FeatureStdExtZfhmin,
105-
FeatureStdExtZkt,
106-
FeatureStdExtV,
107-
FeatureStdExtZvfhmin,
108-
FeatureStdExtZvbb,
109-
FeatureStdExtZvkt,
110-
FeatureStdExtZihintntl,
111-
FeatureStdExtZicond,
112-
FeatureStdExtZimop,
113-
FeatureStdExtZcmop,
114-
FeatureStdExtZcb,
115-
FeatureStdExtZfa,
116-
FeatureStdExtZawrs];
65+
defvar RVA23U64Features = !listconcat(RVA22U64Features,
66+
[FeatureStdExtV,
67+
FeatureStdExtZvfhmin,
68+
FeatureStdExtZvbb,
69+
FeatureStdExtZvkt,
70+
FeatureStdExtZihintntl,
71+
FeatureStdExtZicond,
72+
FeatureStdExtZimop,
73+
FeatureStdExtZcmop,
74+
FeatureStdExtZcb,
75+
FeatureStdExtZfa,
76+
FeatureStdExtZawrs]);
11777

78+
defvar RVA23S64BaseFeatures = !listconcat(RVA22S64BaseFeatures,
79+
[FeatureStdExtSvnapot,
80+
FeatureStdExtSstc,
81+
FeatureStdExtSscofpmf,
82+
FeatureStdExtSsnpm,
83+
FeatureStdExtSsu64xl,
84+
FeatureStdExtH,
85+
FeatureStdExtSsstateen,
86+
FeatureStdExtShcounterenw,
87+
FeatureStdExtShvstvala,
88+
FeatureStdExtShtvala,
89+
FeatureStdExtShvstvecd,
90+
FeatureStdExtShvsatpa,
91+
FeatureStdExtShgatpa]);
11892
defvar RVA23S64Features = !listconcat(RVA23U64Features,
119-
[FeatureStdExtZifencei,
120-
FeatureStdExtSvbare,
121-
FeatureStdExtSvade,
122-
FeatureStdExtSsccptr,
123-
FeatureStdExtSstvecd,
124-
FeatureStdExtSstvala,
125-
FeatureStdExtSscounterenw,
126-
FeatureStdExtSvpbmt,
127-
FeatureStdExtSvinval,
128-
FeatureStdExtSvnapot,
129-
FeatureStdExtSstc,
130-
FeatureStdExtSscofpmf,
131-
FeatureStdExtSsnpm,
132-
FeatureStdExtSsu64xl,
133-
FeatureStdExtH,
134-
FeatureStdExtSsstateen,
135-
FeatureStdExtShcounterenw,
136-
FeatureStdExtShvstvala,
137-
FeatureStdExtShtvala,
138-
FeatureStdExtShvstvecd,
139-
FeatureStdExtShvsatpa,
140-
FeatureStdExtShgatpa]);
141-
142-
defvar RVB23U64Features = [Feature64Bit,
143-
FeatureStdExtI,
144-
FeatureStdExtM,
145-
FeatureStdExtA,
146-
FeatureStdExtF,
147-
FeatureStdExtD,
148-
FeatureStdExtC,
149-
FeatureStdExtZicntr,
150-
FeatureStdExtZihpm,
151-
FeatureStdExtZiccif,
152-
FeatureStdExtZiccrse,
153-
FeatureStdExtZiccamoa,
154-
FeatureStdExtZicclsm,
155-
FeatureStdExtZa64rs,
156-
FeatureStdExtZihintpause,
157-
FeatureStdExtZba,
158-
FeatureStdExtZbb,
159-
FeatureStdExtZbs,
160-
FeatureStdExtZic64b,
161-
FeatureStdExtZicbom,
162-
FeatureStdExtZicbop,
163-
FeatureStdExtZicboz,
164-
FeatureStdExtZkt,
165-
FeatureStdExtZihintntl,
166-
FeatureStdExtZicond,
167-
FeatureStdExtZimop,
168-
FeatureStdExtZcmop,
169-
FeatureStdExtZcb,
170-
FeatureStdExtZfa,
171-
FeatureStdExtZawrs];
93+
RVA23S64BaseFeatures);
94+
95+
// RVB Profile Family
96+
97+
defvar RVB23U64Features = !listconcat(RVA20U64BaseFeatures,
98+
[FeatureStdExtZihpm,
99+
FeatureStdExtZa64rs,
100+
FeatureStdExtZihintpause,
101+
FeatureStdExtZba,
102+
FeatureStdExtZbb,
103+
FeatureStdExtZbs,
104+
FeatureStdExtZic64b,
105+
FeatureStdExtZicbom,
106+
FeatureStdExtZicbop,
107+
FeatureStdExtZicboz,
108+
FeatureStdExtZkt,
109+
FeatureStdExtZihintntl,
110+
FeatureStdExtZicond,
111+
FeatureStdExtZimop,
112+
FeatureStdExtZcmop,
113+
FeatureStdExtZcb,
114+
FeatureStdExtZfa,
115+
FeatureStdExtZawrs]);
172116

173117
defvar RVB23S64Features = !listconcat(RVB23U64Features,
174118
[FeatureStdExtZifencei,
@@ -185,6 +129,8 @@ defvar RVB23S64Features = !listconcat(RVB23U64Features,
185129
FeatureStdExtSscofpmf,
186130
FeatureStdExtSsu64xl]);
187131

132+
// RVM Profile Family
133+
188134
defvar RVM23U32Features = [Feature32Bit,
189135
FeatureStdExtI,
190136
FeatureStdExtM,
@@ -199,6 +145,22 @@ defvar RVM23U32Features = [Feature32Bit,
199145
FeatureStdExtZimop,
200146
FeatureStdExtZcmop];
201147

148+
//===----------------------------------------------------------------------===//
149+
// Profile Definitions for ISA String
150+
//===----------------------------------------------------------------------===//
151+
152+
class RISCVProfile<string name, list<SubtargetFeature> features>
153+
: SubtargetFeature<name, "Is" # NAME, "true",
154+
"RISC-V " # name # " profile", features> {
155+
// Indicates if the profile is not yet ratified, so should be treated as
156+
// experimental.
157+
bit Experimental = false;
158+
}
159+
class RISCVExperimentalProfile<string name, list<SubtargetFeature> features>
160+
: RISCVProfile<"experimental-"#name, features> {
161+
let Experimental = true;
162+
}
163+
202164
def RVI20U32 : RISCVProfile<"rvi20u32", RVI20U32Features>;
203165
def RVI20U64 : RISCVProfile<"rvi20u64", RVI20U64Features>;
204166
def RVA20U64 : RISCVProfile<"rva20u64", RVA20U64Features>;

0 commit comments

Comments
 (0)