9
9
//
10
10
//===----------------------------------------------------------------------===//
11
11
12
- // A SubtargetFeature that can be toggled from the command line, and therefore
13
- // has an AEK_* entry in ArmExtKind .
12
+ // A SubtargetFeature that can be toggled from the command line, or be part of
13
+ // a Function Multiversioning (FMV) attribute string .
14
14
//
15
- // If Function MultiVersioning (FMV) properties are left at their defaults
16
- // (FEAT_INIT, no dependencies, priority 0) it indiates that this extension is
17
- // not an FMV feature, but can be enabled via the command line (-march, -mcpu,
18
- // etc).
19
- //
20
- // Conversely if the ArchExtKindSpelling is set to AEK_NONE, this indicates
21
- // that a feature is FMV-only, and can not be selected on the command line.
22
- // Such extensions should be added via FMVOnlyExtension.
15
+ // If FMV properties are left at their defaults (FEAT_INIT, no dependencies,
16
+ // priority 0) it indiates that this extension is not an FMV feature, but can
17
+ // be enabled via the command line (-march, -mcpu, etc).
23
18
class Extension<
24
19
string TargetFeatureName, // String used for -target-feature and -march, unless overridden.
25
20
string Spelling, // The XYZ in HasXYZ and AEK_XYZ.
@@ -28,7 +23,8 @@ class Extension<
28
23
// FMV properties
29
24
string _FMVBit = "FEAT_INIT", // FEAT_INIT is repurposed to indicate "not an FMV feature"
30
25
string _FMVDependencies = "",
31
- int _FMVPriority = 0
26
+ int _FMVPriority = 0,
27
+ string _IsFMVOnly = "false" // Indicates if the extension is available on the command line.
32
28
> : SubtargetFeature<TargetFeatureName, "Has" # Spelling, "true", Desc, Implies>
33
29
{
34
30
string ArchExtKindSpelling = "AEK_" # Spelling; // ArchExtKind enum name.
@@ -43,7 +39,7 @@ class Extension<
43
39
// Used for correcting historical names while remaining backwards compatible.
44
40
string MArchAlias = "";
45
41
46
- // Function MultiVersioning (FMV) properties
42
+ // Function Multiversioning (FMV) properties
47
43
48
44
// A C++ expression giving the number of the bit in the FMV ABI.
49
45
// Currently this is given as a value from the enum "CPUFeatures".
@@ -56,43 +52,64 @@ class Extension<
56
52
57
53
// The FMV priority
58
54
int FMVPriority = _FMVPriority;
55
+
56
+ // Indicates if the extension is available on the command line.
57
+ string IsFMVOnly = _IsFMVOnly;
59
58
}
60
59
61
60
// Some extensions are available for FMV but can not be controlled via the
62
- // command line. These entries:
63
- // - are SubtargetFeatures, so they have (unused) FieldNames on the subtarget
64
- // e.g. HasFMVOnlyFEAT_XYZ
65
- // - have incorrect (empty) Implies fields, because the code that handles FMV
66
- // ignores these dependencies and looks only at FMVDependencies.
67
- // - have no description.
68
- //
69
- // In the generated data structures for extensions (ExtensionInfo), AEK_NONE is
70
- // used to indicate that a feature is FMV only. Therefore ArchExtKindSpelling is
71
- // manually overridden here.
72
- class FMVOnlyExtension<string FMVBit, string Name, string Deps, int Priority>
73
- : Extension<Name, "FMVOnly"#FMVBit, "", [], FMVBit, Deps, Priority> {
74
- let ArchExtKindSpelling = "AEK_NONE"; // AEK_NONE indicates FMV-only feature
75
- }
61
+ // command line, neither have a TargetFeatureName. Since they have no effect
62
+ // on their own, their description is left empty. However they can have side
63
+ // effects by implying other Subtarget Features. These extensions are used
64
+ // in FMV for detection purposes.
65
+
66
+ let MArchName = "dgh" in
67
+ def : Extension<"", "DGH", "", [], "FEAT_DGH", "", 260, "true">;
68
+
69
+ let MArchName = "ebf16" in
70
+ def : Extension<"", "EBF16", "", [], "FEAT_EBF16", "+bf16", 290, "true">;
71
+
72
+ let MArchName = "ls64_accdata" in
73
+ def : Extension<"", "LS64_ACCDATA", "", [], "FEAT_LS64_ACCDATA",
74
+ "+ls64", 540, "true">;
75
+
76
+ let MArchName = "ls64_v" in
77
+ def : Extension<"", "LS64_V", "", [], "FEAT_LS64_V", "", 530, "true">;
78
+
79
+ let MArchName = "memtag2" in
80
+ def : Extension<"", "MEMTAG2", "", [], "FEAT_MEMTAG2", "+mte", 450, "true">;
81
+
82
+ let MArchName = "memtag3" in
83
+ def : Extension<"", "MEMTAG3", "", [], "FEAT_MEMTAG3", "+mte", 460, "true">;
84
+
85
+ let MArchName = "pmull" in
86
+ def : Extension<"", "PMULL", "", [], "FEAT_PMULL",
87
+ "+aes,+fp-armv8,+neon", 160, "true">;
88
+
89
+ let MArchName = "rpres" in
90
+ def : Extension<"", "RPRES", "", [], "FEAT_RPRES", "", 300, "true">;
91
+
92
+ let MArchName = "sha1" in
93
+ def : Extension<"", "SHA1", "", [], "FEAT_SHA1", "+fp-armv8,+neon", 120, "true">;
94
+
95
+ let MArchName = "ssbs2" in
96
+ def : Extension<"", "SSBS2", "", [], "FEAT_SSBS2", "+ssbs", 500, "true">;
97
+
98
+ let MArchName = "sve-bf16" in
99
+ def : Extension<"", "SVE_BF16", "", [], "FEAT_SVE_BF16",
100
+ "+sve,+bf16,+fullfp16,+fp-armv8,+neon", 320, "true">;
101
+
102
+ let MArchName = "sve-ebf16" in
103
+ def : Extension<"", "SVE_EBF16", "", [], "FEAT_SVE_EBF16",
104
+ "+sve,+bf16,+fullfp16,+fp-armv8,+neon", 330, "true">;
105
+
106
+ let MArchName = "sve-i8mm" in
107
+ def : Extension<"", "SVE_I8MM", "", [], "FEAT_SVE_I8MM",
108
+ "+sve,+i8mm,+fullfp16,+fp-armv8,+neon", 340, "true">;
76
109
77
- def : FMVOnlyExtension<"FEAT_DGH", "dgh", "", 260>;
78
- def : FMVOnlyExtension<"FEAT_DPB", "dpb", "+ccpp", 190>;
79
- def : FMVOnlyExtension<"FEAT_DPB2", "dpb2", "+ccpp,+ccdp", 200>;
80
- def : FMVOnlyExtension<"FEAT_EBF16", "ebf16", "+bf16", 290>;
81
- def : FMVOnlyExtension<"FEAT_FLAGM2", "flagm2", "+flagm,+altnzcv", 30>;
82
- def : FMVOnlyExtension<"FEAT_FRINTTS", "frintts", "+fptoint", 250>;
83
- def : FMVOnlyExtension<"FEAT_LS64_ACCDATA", "ls64_accdata", "+ls64", 540>;
84
- def : FMVOnlyExtension<"FEAT_LS64_V", "ls64_v", "", 530>;
85
- def : FMVOnlyExtension<"FEAT_MEMTAG2", "memtag2", "+mte", 450>;
86
- def : FMVOnlyExtension<"FEAT_MEMTAG3", "memtag3", "+mte", 460>;
87
- def : FMVOnlyExtension<"FEAT_PMULL", "pmull", "+aes,+fp-armv8,+neon", 160>;
88
- def : FMVOnlyExtension<"FEAT_RCPC2", "rcpc2", "+rcpc", 240>;
89
- def : FMVOnlyExtension<"FEAT_RPRES", "rpres", "", 300>;
90
- def : FMVOnlyExtension<"FEAT_SHA1", "sha1", "+fp-armv8,+neon", 120>;
91
- def : FMVOnlyExtension<"FEAT_SSBS2", "ssbs2", "+ssbs", 500>;
92
- def : FMVOnlyExtension<"FEAT_SVE_BF16", "sve-bf16", "+sve,+bf16,+fullfp16,+fp-armv8,+neon", 320>;
93
- def : FMVOnlyExtension<"FEAT_SVE_EBF16", "sve-ebf16", "+sve,+bf16,+fullfp16,+fp-armv8,+neon", 330>;
94
- def : FMVOnlyExtension<"FEAT_SVE_I8MM", "sve-i8mm", "+sve,+i8mm,+fullfp16,+fp-armv8,+neon", 340>;
95
- def : FMVOnlyExtension<"FEAT_SVE_PMULL128", "sve2-pmull128", "+sve2,+sve,+sve2-aes,+fullfp16,+fp-armv8,+neon", 390>;
110
+ let MArchName = "sve2-pmull128" in
111
+ def : Extension<"", "SVE_PMULL128", "", [], "FEAT_SVE_PMULL128",
112
+ "+sve2,+sve,+sve2-aes,+fullfp16,+fp-armv8,+neon", 390, "true">;
96
113
97
114
98
115
// Each SubtargetFeature which corresponds to an Arm Architecture feature should
@@ -216,8 +233,10 @@ def FeaturePAN_RWV : SubtargetFeature<
216
233
def FeaturePsUAO : SubtargetFeature< "uaops", "HasPsUAO", "true",
217
234
"Enable v8.2 UAO PState (FEAT_UAO)">;
218
235
219
- def FeatureCCPP : SubtargetFeature<"ccpp", "HasCCPP",
220
- "true", "Enable v8.2 data Cache Clean to Point of Persistence (FEAT_DPB)" >;
236
+ let MArchName = "dpb" in
237
+ def FeatureCCPP : Extension<"ccpp", "CCPP",
238
+ "Enable v8.2 data Cache Clean to Point of Persistence (FEAT_DPB)", [],
239
+ "FEAT_DPB", "+ccpp", 190, "true">;
221
240
222
241
def FeatureSVE : Extension<"sve", "SVE",
223
242
"Enable Scalable Vector Extension (SVE) instructions (FEAT_SVE)", [FeatureFullFP16],
@@ -491,9 +510,10 @@ def FeatureFlagM : Extension<
491
510
"FEAT_FLAGM", "+flagm", 20>;
492
511
493
512
// 8.4 RCPC enchancements: LDAPR & STLR instructions with Immediate Offset
494
- def FeatureRCPC_IMMO : SubtargetFeature<"rcpc-immo", "HasRCPC_IMMO", "true",
513
+ let MArchName = "rcpc2" in
514
+ def FeatureRCPC_IMMO : Extension<"rcpc-immo", "RCPC_IMMO",
495
515
"Enable v8.4-A RCPC instructions with Immediate Offsets (FEAT_LRCPC2)",
496
- [FeatureRCPC]>;
516
+ [FeatureRCPC], "FEAT_RCPC2", "+rcpc", 240, "true" >;
497
517
498
518
def FeatureNoNegativeImmediates : SubtargetFeature<"no-neg-immediates",
499
519
"NegativeImmediates", "false",
@@ -525,12 +545,16 @@ def FeatureAggressiveFMA :
525
545
"true",
526
546
"Enable Aggressive FMA for floating-point.">;
527
547
528
- def FeatureAltFPCmp : SubtargetFeature<"altnzcv", "HasAlternativeNZCV", "true",
529
- "Enable alternative NZCV format for floating point comparisons (FEAT_FlagM2)">;
548
+ let MArchName = "flagm2" in
549
+ def FeatureAltFPCmp : Extension<"altnzcv", "AlternativeNZCV",
550
+ "Enable alternative NZCV format for floating point comparisons (FEAT_FlagM2)",
551
+ [], "FEAT_FLAGM2", "+flagm,+altnzcv", 30, "true">;
530
552
531
- def FeatureFRInt3264 : SubtargetFeature<"fptoint", "HasFRInt3264", "true",
553
+ let MArchName = "frintts" in
554
+ def FeatureFRInt3264 : Extension<"fptoint", "FRInt3264",
532
555
"Enable FRInt[32|64][Z|X] instructions that round a floating-point number to "
533
- "an integer (in FP format) forcing it to fit into a 32- or 64-bit int (FEAT_FRINTTS)" >;
556
+ "an integer (in FP format) forcing it to fit into a 32- or 64-bit int (FEAT_FRINTTS)",
557
+ [], "FEAT_FRINTTS", "+fptoint", 250, "true">;
534
558
535
559
def FeatureSpecRestrict : SubtargetFeature<"specrestrict", "HasSpecRestrict",
536
560
"true", "Enable architectural speculation restriction (FEAT_CSV2_2)">;
@@ -547,13 +571,14 @@ def FeaturePredRes : Extension<"predres", "PredRes",
547
571
"Enable v8.5a execution and data prediction invalidation instructions (FEAT_SPECRES)", [],
548
572
"FEAT_PREDRES", "+predres", 480>;
549
573
550
- def FeatureCacheDeepPersist : SubtargetFeature<"ccdp", "CCDP", "true",
551
- "Enable v8.5 Cache Clean to Point of Deep Persistence (FEAT_DPB2)" >;
574
+ let MArchName = "dpb2" in
575
+ def FeatureCacheDeepPersist : Extension<"ccdp", "CCDP",
576
+ "Enable v8.5 Cache Clean to Point of Deep Persistence (FEAT_DPB2)", [],
577
+ "FEAT_DPB2", "+ccpp,+ccdp", 200, "true">;
552
578
553
- let ArchExtKindSpelling = "AEK_NONE" in
554
579
def FeatureBranchTargetId : Extension<"bti", "BTI",
555
580
"Enable Branch Target Identification (FEAT_BTI)", [],
556
- "FEAT_BTI", "+bti", 510>;
581
+ "FEAT_BTI", "+bti", 510, "true" >;
557
582
558
583
let ArchExtKindSpelling = "AEK_RAND", MArchName = "rng" in
559
584
def FeatureRandGen : Extension<"rand", "RandGen",
0 commit comments