1//===-- SystemZ.td - SystemZ processors and features ---------*- tblgen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Feature definitions.
10//
11//===----------------------------------------------------------------------===//
12
13class SystemZFeature<string extname, string intname, string desc>
14  : Predicate<"Subtarget->has"##intname##"()">,
15    AssemblerPredicate<"Feature"##intname, extname>,
16    SubtargetFeature<extname, "Has"##intname, "true", desc>;
17
18class SystemZMissingFeature<string intname>
19  : Predicate<"!Subtarget->has"##intname##"()">;
20
21class SystemZFeatureList<list<SystemZFeature> x> {
22  list<SystemZFeature> List = x;
23}
24
25class SystemZFeatureAdd<list<SystemZFeature> x, list<SystemZFeature> y>
26  : SystemZFeatureList<!listconcat(x, y)>;
27
28// This feature is added as a subtarget feature whenever the function is
29// compiled to use soft-float.
30def FeatureSoftFloat : SystemZFeature<
31  "soft-float", "SoftFloat",
32  "Use software emulation for floating point"
33>;
34
35//===----------------------------------------------------------------------===//
36//
37// New features added in the Ninth Edition of the z/Architecture
38//
39//===----------------------------------------------------------------------===//
40
41def FeatureDistinctOps : SystemZFeature<
42  "distinct-ops", "DistinctOps",
43  "Assume that the distinct-operands facility is installed"
44>;
45
46def FeatureFastSerialization : SystemZFeature<
47  "fast-serialization", "FastSerialization",
48  "Assume that the fast-serialization facility is installed"
49>;
50
51def FeatureFPExtension : SystemZFeature<
52  "fp-extension", "FPExtension",
53  "Assume that the floating-point extension facility is installed"
54>;
55
56def FeatureHighWord : SystemZFeature<
57  "high-word", "HighWord",
58  "Assume that the high-word facility is installed"
59>;
60
61def FeatureInterlockedAccess1 : SystemZFeature<
62  "interlocked-access1", "InterlockedAccess1",
63  "Assume that interlocked-access facility 1 is installed"
64>;
65def FeatureNoInterlockedAccess1 : SystemZMissingFeature<"InterlockedAccess1">;
66
67def FeatureLoadStoreOnCond : SystemZFeature<
68  "load-store-on-cond", "LoadStoreOnCond",
69  "Assume that the load/store-on-condition facility is installed"
70>;
71def FeatureNoLoadStoreOnCond : SystemZMissingFeature<"LoadStoreOnCond">;
72
73def FeaturePopulationCount : SystemZFeature<
74  "population-count", "PopulationCount",
75  "Assume that the population-count facility is installed"
76>;
77
78def FeatureMessageSecurityAssist3 : SystemZFeature<
79  "message-security-assist-extension3", "MessageSecurityAssist3",
80  "Assume that the message-security-assist extension facility 3 is installed"
81>;
82
83def FeatureMessageSecurityAssist4 : SystemZFeature<
84  "message-security-assist-extension4", "MessageSecurityAssist4",
85  "Assume that the message-security-assist extension facility 4 is installed"
86>;
87
88def FeatureResetReferenceBitsMultiple : SystemZFeature<
89  "reset-reference-bits-multiple", "ResetReferenceBitsMultiple",
90  "Assume that the reset-reference-bits-multiple facility is installed"
91>;
92
93def Arch9NewFeatures : SystemZFeatureList<[
94    FeatureDistinctOps,
95    FeatureFastSerialization,
96    FeatureFPExtension,
97    FeatureHighWord,
98    FeatureInterlockedAccess1,
99    FeatureLoadStoreOnCond,
100    FeaturePopulationCount,
101    FeatureMessageSecurityAssist3,
102    FeatureMessageSecurityAssist4,
103    FeatureResetReferenceBitsMultiple
104]>;
105
106//===----------------------------------------------------------------------===//
107//
108// New features added in the Tenth Edition of the z/Architecture
109//
110//===----------------------------------------------------------------------===//
111
112def FeatureExecutionHint : SystemZFeature<
113  "execution-hint", "ExecutionHint",
114  "Assume that the execution-hint facility is installed"
115>;
116
117def FeatureLoadAndTrap : SystemZFeature<
118  "load-and-trap", "LoadAndTrap",
119  "Assume that the load-and-trap facility is installed"
120>;
121
122def FeatureMiscellaneousExtensions : SystemZFeature<
123  "miscellaneous-extensions", "MiscellaneousExtensions",
124  "Assume that the miscellaneous-extensions facility is installed"
125>;
126
127def FeatureProcessorAssist : SystemZFeature<
128  "processor-assist", "ProcessorAssist",
129  "Assume that the processor-assist facility is installed"
130>;
131
132def FeatureTransactionalExecution : SystemZFeature<
133  "transactional-execution", "TransactionalExecution",
134  "Assume that the transactional-execution facility is installed"
135>;
136
137def FeatureDFPZonedConversion : SystemZFeature<
138  "dfp-zoned-conversion", "DFPZonedConversion",
139  "Assume that the DFP zoned-conversion facility is installed"
140>;
141
142def FeatureEnhancedDAT2 : SystemZFeature<
143  "enhanced-dat-2", "EnhancedDAT2",
144  "Assume that the enhanced-DAT facility 2 is installed"
145>;
146
147def Arch10NewFeatures : SystemZFeatureList<[
148    FeatureExecutionHint,
149    FeatureLoadAndTrap,
150    FeatureMiscellaneousExtensions,
151    FeatureProcessorAssist,
152    FeatureTransactionalExecution,
153    FeatureDFPZonedConversion,
154    FeatureEnhancedDAT2
155]>;
156
157//===----------------------------------------------------------------------===//
158//
159// New features added in the Eleventh Edition of the z/Architecture
160//
161//===----------------------------------------------------------------------===//
162
163def FeatureLoadAndZeroRightmostByte : SystemZFeature<
164  "load-and-zero-rightmost-byte", "LoadAndZeroRightmostByte",
165  "Assume that the load-and-zero-rightmost-byte facility is installed"
166>;
167
168def FeatureLoadStoreOnCond2 : SystemZFeature<
169  "load-store-on-cond-2", "LoadStoreOnCond2",
170  "Assume that the load/store-on-condition facility 2 is installed"
171>;
172
173def FeatureMessageSecurityAssist5 : SystemZFeature<
174  "message-security-assist-extension5", "MessageSecurityAssist5",
175  "Assume that the message-security-assist extension facility 5 is installed"
176>;
177
178def FeatureDFPPackedConversion : SystemZFeature<
179  "dfp-packed-conversion", "DFPPackedConversion",
180  "Assume that the DFP packed-conversion facility is installed"
181>;
182
183def FeatureVector : SystemZFeature<
184  "vector", "Vector",
185  "Assume that the vectory facility is installed"
186>;
187def FeatureNoVector : SystemZMissingFeature<"Vector">;
188
189def Arch11NewFeatures : SystemZFeatureList<[
190    FeatureLoadAndZeroRightmostByte,
191    FeatureLoadStoreOnCond2,
192    FeatureMessageSecurityAssist5,
193    FeatureDFPPackedConversion,
194    FeatureVector
195]>;
196
197//===----------------------------------------------------------------------===//
198//
199// New features added in the Twelvth Edition of the z/Architecture
200//
201//===----------------------------------------------------------------------===//
202
203def FeatureMiscellaneousExtensions2 : SystemZFeature<
204  "miscellaneous-extensions-2", "MiscellaneousExtensions2",
205  "Assume that the miscellaneous-extensions facility 2 is installed"
206>;
207
208def FeatureGuardedStorage : SystemZFeature<
209  "guarded-storage", "GuardedStorage",
210  "Assume that the guarded-storage facility is installed"
211>;
212
213def FeatureMessageSecurityAssist7 : SystemZFeature<
214  "message-security-assist-extension7", "MessageSecurityAssist7",
215  "Assume that the message-security-assist extension facility 7 is installed"
216>;
217
218def FeatureMessageSecurityAssist8 : SystemZFeature<
219  "message-security-assist-extension8", "MessageSecurityAssist8",
220  "Assume that the message-security-assist extension facility 8 is installed"
221>;
222
223def FeatureVectorEnhancements1 : SystemZFeature<
224  "vector-enhancements-1", "VectorEnhancements1",
225  "Assume that the vector enhancements facility 1 is installed"
226>;
227def FeatureNoVectorEnhancements1 : SystemZMissingFeature<"VectorEnhancements1">;
228
229def FeatureVectorPackedDecimal : SystemZFeature<
230  "vector-packed-decimal", "VectorPackedDecimal",
231  "Assume that the vector packed decimal facility is installed"
232>;
233
234def FeatureInsertReferenceBitsMultiple : SystemZFeature<
235  "insert-reference-bits-multiple", "InsertReferenceBitsMultiple",
236  "Assume that the insert-reference-bits-multiple facility is installed"
237>;
238
239def Arch12NewFeatures : SystemZFeatureList<[
240    FeatureMiscellaneousExtensions2,
241    FeatureGuardedStorage,
242    FeatureMessageSecurityAssist7,
243    FeatureMessageSecurityAssist8,
244    FeatureVectorEnhancements1,
245    FeatureVectorPackedDecimal,
246    FeatureInsertReferenceBitsMultiple
247]>;
248
249//===----------------------------------------------------------------------===//
250//
251// New features added in the Thirteenth Edition of the z/Architecture
252//
253//===----------------------------------------------------------------------===//
254
255def FeatureMiscellaneousExtensions3 : SystemZFeature<
256  "miscellaneous-extensions-3", "MiscellaneousExtensions3",
257  "Assume that the miscellaneous-extensions facility 3 is installed"
258>;
259
260def FeatureMessageSecurityAssist9 : SystemZFeature<
261  "message-security-assist-extension9", "MessageSecurityAssist9",
262  "Assume that the message-security-assist extension facility 9 is installed"
263>;
264
265def FeatureVectorEnhancements2 : SystemZFeature<
266  "vector-enhancements-2", "VectorEnhancements2",
267  "Assume that the vector enhancements facility 2 is installed"
268>;
269
270def FeatureVectorPackedDecimalEnhancement : SystemZFeature<
271  "vector-packed-decimal-enhancement", "VectorPackedDecimalEnhancement",
272  "Assume that the vector packed decimal enhancement facility is installed"
273>;
274
275def FeatureEnhancedSort : SystemZFeature<
276  "enhanced-sort", "EnhancedSort",
277  "Assume that the enhanced-sort facility is installed"
278>;
279
280def FeatureDeflateConversion : SystemZFeature<
281  "deflate-conversion", "DeflateConversion",
282  "Assume that the deflate-conversion facility is installed"
283>;
284
285def Arch13NewFeatures : SystemZFeatureList<[
286    FeatureMiscellaneousExtensions3,
287    FeatureMessageSecurityAssist9,
288    FeatureVectorEnhancements2,
289    FeatureVectorPackedDecimalEnhancement,
290    FeatureEnhancedSort,
291    FeatureDeflateConversion
292]>;
293
294//===----------------------------------------------------------------------===//
295//
296// Cumulative supported and unsupported feature sets
297//
298//===----------------------------------------------------------------------===//
299
300def Arch8SupportedFeatures
301  : SystemZFeatureList<[]>;
302def Arch9SupportedFeatures
303  : SystemZFeatureAdd<Arch8SupportedFeatures.List,  Arch9NewFeatures.List>;
304def Arch10SupportedFeatures
305  : SystemZFeatureAdd<Arch9SupportedFeatures.List,  Arch10NewFeatures.List>;
306def Arch11SupportedFeatures
307  : SystemZFeatureAdd<Arch10SupportedFeatures.List, Arch11NewFeatures.List>;
308def Arch12SupportedFeatures
309  : SystemZFeatureAdd<Arch11SupportedFeatures.List, Arch12NewFeatures.List>;
310def Arch13SupportedFeatures
311  : SystemZFeatureAdd<Arch12SupportedFeatures.List, Arch13NewFeatures.List>;
312
313def Arch13UnsupportedFeatures
314  : SystemZFeatureList<[]>;
315def Arch12UnsupportedFeatures
316  : SystemZFeatureAdd<Arch13UnsupportedFeatures.List, Arch13NewFeatures.List>;
317def Arch11UnsupportedFeatures
318  : SystemZFeatureAdd<Arch12UnsupportedFeatures.List, Arch12NewFeatures.List>;
319def Arch10UnsupportedFeatures
320  : SystemZFeatureAdd<Arch11UnsupportedFeatures.List, Arch11NewFeatures.List>;
321def Arch9UnsupportedFeatures
322  : SystemZFeatureAdd<Arch10UnsupportedFeatures.List, Arch10NewFeatures.List>;
323def Arch8UnsupportedFeatures
324  : SystemZFeatureAdd<Arch9UnsupportedFeatures.List,  Arch9NewFeatures.List>;
325
326