xref: /freebsd-src/contrib/llvm-project/llvm/lib/Target/ARM/ARMFeatures.td (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1*0fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
2*0fca6ea1SDimitry Andric// ARM Subtarget state.
3*0fca6ea1SDimitry Andric//
4*0fca6ea1SDimitry Andric
5*0fca6ea1SDimitry Andric// True if compiling for Thumb, false for ARM.
6*0fca6ea1SDimitry Andricdef ModeThumb             : SubtargetFeature<"thumb-mode", "IsThumb",
7*0fca6ea1SDimitry Andric                                             "true", "Thumb mode">;
8*0fca6ea1SDimitry Andric
9*0fca6ea1SDimitry Andric// True if we're using software floating point features.
10*0fca6ea1SDimitry Andricdef ModeSoftFloat         : SubtargetFeature<"soft-float","UseSoftFloat",
11*0fca6ea1SDimitry Andric                                             "true", "Use software floating "
12*0fca6ea1SDimitry Andric                                             "point features.">;
13*0fca6ea1SDimitry Andric
14*0fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
15*0fca6ea1SDimitry Andric// ARM Subtarget features.
16*0fca6ea1SDimitry Andric//
17*0fca6ea1SDimitry Andric
18*0fca6ea1SDimitry Andric// This is currently only used by AArch64, but is required here because ARM and
19*0fca6ea1SDimitry Andric// AArch64 share a tablegen backend for TargetParser.
20*0fca6ea1SDimitry Andricclass Extension<
21*0fca6ea1SDimitry Andric  string TargetFeatureName,            // String used for -target-feature.
22*0fca6ea1SDimitry Andric  string Spelling,                     // The XYZ in HasXYZ and AEK_XYZ.
23*0fca6ea1SDimitry Andric  string Desc,                         // Description.
24*0fca6ea1SDimitry Andric  list<SubtargetFeature> Implies = []  // List of dependent features.
25*0fca6ea1SDimitry Andric> : SubtargetFeature<TargetFeatureName, "Has" # Spelling, "true", Desc, Implies>
26*0fca6ea1SDimitry Andric{
27*0fca6ea1SDimitry Andric    string ArchExtKindSpelling = "AEK_" # Spelling; // ArchExtKind enum name.
28*0fca6ea1SDimitry Andric}
29*0fca6ea1SDimitry Andric
30*0fca6ea1SDimitry Andric// Floating Point, HW Division and Neon Support
31*0fca6ea1SDimitry Andric
32*0fca6ea1SDimitry Andric// FP loads/stores/moves, shared between VFP and MVE (even in the integer-only
33*0fca6ea1SDimitry Andric// version).
34*0fca6ea1SDimitry Andricdef FeatureFPRegs         : SubtargetFeature<"fpregs", "HasFPRegs", "true",
35*0fca6ea1SDimitry Andric                                             "Enable FP registers">;
36*0fca6ea1SDimitry Andric
37*0fca6ea1SDimitry Andric// 16-bit FP loads/stores/moves, shared between VFP (with the v8.2A FP16
38*0fca6ea1SDimitry Andric// extension) and MVE (even in the integer-only version).
39*0fca6ea1SDimitry Andricdef FeatureFPRegs16       : SubtargetFeature<"fpregs16", "HasFPRegs16", "true",
40*0fca6ea1SDimitry Andric                                             "Enable 16-bit FP registers",
41*0fca6ea1SDimitry Andric                                             [FeatureFPRegs]>;
42*0fca6ea1SDimitry Andric
43*0fca6ea1SDimitry Andricdef FeatureFPRegs64       : SubtargetFeature<"fpregs64", "HasFPRegs64", "true",
44*0fca6ea1SDimitry Andric                                             "Enable 64-bit FP registers",
45*0fca6ea1SDimitry Andric                                             [FeatureFPRegs]>;
46*0fca6ea1SDimitry Andric
47*0fca6ea1SDimitry Andric// True if the floating point unit supports double precision.
48*0fca6ea1SDimitry Andricdef FeatureFP64           : SubtargetFeature<"fp64", "HasFP64", "true",
49*0fca6ea1SDimitry Andric                                             "Floating point unit supports "
50*0fca6ea1SDimitry Andric                                             "double precision",
51*0fca6ea1SDimitry Andric                                             [FeatureFPRegs64]>;
52*0fca6ea1SDimitry Andric
53*0fca6ea1SDimitry Andric// True if subtarget has the full 32 double precision FP registers for VFPv3.
54*0fca6ea1SDimitry Andricdef FeatureD32            : SubtargetFeature<"d32", "HasD32", "true",
55*0fca6ea1SDimitry Andric                                             "Extend FP to 32 double registers">;
56*0fca6ea1SDimitry Andric
57*0fca6ea1SDimitry Andric/// Versions of the VFP flags restricted to single precision, or to
58*0fca6ea1SDimitry Andric/// 16 d-registers, or both.
59*0fca6ea1SDimitry Andricmulticlass VFPver<string name, string query, string description,
60*0fca6ea1SDimitry Andric                  list<SubtargetFeature> prev,
61*0fca6ea1SDimitry Andric                  list<SubtargetFeature> otherimplies,
62*0fca6ea1SDimitry Andric                  list<SubtargetFeature> vfp2prev = []> {
63*0fca6ea1SDimitry Andric  def _D16_SP: SubtargetFeature<
64*0fca6ea1SDimitry Andric    name#"d16sp", query#"D16SP", "true",
65*0fca6ea1SDimitry Andric    description#" with only 16 d-registers and no double precision",
66*0fca6ea1SDimitry Andric    !foreach(v, prev, !cast<SubtargetFeature>(v # "_D16_SP")) #
67*0fca6ea1SDimitry Andric      !foreach(v, vfp2prev, !cast<SubtargetFeature>(v # "_SP")) #
68*0fca6ea1SDimitry Andric      otherimplies>;
69*0fca6ea1SDimitry Andric  def _SP: SubtargetFeature<
70*0fca6ea1SDimitry Andric    name#"sp", query#"SP", "true",
71*0fca6ea1SDimitry Andric    description#" with no double precision",
72*0fca6ea1SDimitry Andric    !foreach(v, prev, !cast<SubtargetFeature>(v # "_SP")) #
73*0fca6ea1SDimitry Andric      otherimplies # [FeatureD32, !cast<SubtargetFeature>(NAME # "_D16_SP")]>;
74*0fca6ea1SDimitry Andric  def _D16: SubtargetFeature<
75*0fca6ea1SDimitry Andric    name#"d16", query#"D16", "true",
76*0fca6ea1SDimitry Andric    description#" with only 16 d-registers",
77*0fca6ea1SDimitry Andric    !foreach(v, prev, !cast<SubtargetFeature>(v # "_D16")) #
78*0fca6ea1SDimitry Andric      vfp2prev #
79*0fca6ea1SDimitry Andric      otherimplies # [FeatureFP64, !cast<SubtargetFeature>(NAME # "_D16_SP")]>;
80*0fca6ea1SDimitry Andric  def "": SubtargetFeature<
81*0fca6ea1SDimitry Andric    name, query, "true", description,
82*0fca6ea1SDimitry Andric    prev # otherimplies # [
83*0fca6ea1SDimitry Andric        !cast<SubtargetFeature>(NAME # "_D16"),
84*0fca6ea1SDimitry Andric        !cast<SubtargetFeature>(NAME # "_SP")]>;
85*0fca6ea1SDimitry Andric}
86*0fca6ea1SDimitry Andric
87*0fca6ea1SDimitry Andricdef FeatureVFP2_SP        : SubtargetFeature<"vfp2sp", "HasVFPv2SP", "true",
88*0fca6ea1SDimitry Andric                                             "Enable VFP2 instructions with "
89*0fca6ea1SDimitry Andric                                             "no double precision",
90*0fca6ea1SDimitry Andric                                             [FeatureFPRegs]>;
91*0fca6ea1SDimitry Andric
92*0fca6ea1SDimitry Andricdef FeatureVFP2           : SubtargetFeature<"vfp2", "HasVFPv2", "true",
93*0fca6ea1SDimitry Andric                                             "Enable VFP2 instructions",
94*0fca6ea1SDimitry Andric                                             [FeatureFP64, FeatureVFP2_SP]>;
95*0fca6ea1SDimitry Andric
96*0fca6ea1SDimitry Andricdefm FeatureVFP3: VFPver<"vfp3", "HasVFPv3", "Enable VFP3 instructions",
97*0fca6ea1SDimitry Andric                         [], [], [FeatureVFP2]>;
98*0fca6ea1SDimitry Andric
99*0fca6ea1SDimitry Andricdef FeatureNEON           : SubtargetFeature<"neon", "HasNEON", "true",
100*0fca6ea1SDimitry Andric                                             "Enable NEON instructions",
101*0fca6ea1SDimitry Andric                                             [FeatureVFP3]>;
102*0fca6ea1SDimitry Andric
103*0fca6ea1SDimitry Andric// True if subtarget supports half-precision FP conversions.
104*0fca6ea1SDimitry Andricdef FeatureFP16           : SubtargetFeature<"fp16", "HasFP16", "true",
105*0fca6ea1SDimitry Andric                                             "Enable half-precision "
106*0fca6ea1SDimitry Andric                                             "floating point">;
107*0fca6ea1SDimitry Andric
108*0fca6ea1SDimitry Andricdefm FeatureVFP4: VFPver<"vfp4", "HasVFPv4", "Enable VFP4 instructions",
109*0fca6ea1SDimitry Andric                         [FeatureVFP3], [FeatureFP16]>;
110*0fca6ea1SDimitry Andric
111*0fca6ea1SDimitry Andricdefm FeatureFPARMv8: VFPver<"fp-armv8", "HasFPARMv8", "Enable ARMv8 FP",
112*0fca6ea1SDimitry Andric                         [FeatureVFP4], []>;
113*0fca6ea1SDimitry Andric
114*0fca6ea1SDimitry Andric// True if subtarget supports half-precision FP operations.
115*0fca6ea1SDimitry Andricdef FeatureFullFP16       : SubtargetFeature<"fullfp16", "HasFullFP16", "true",
116*0fca6ea1SDimitry Andric                                             "Enable full half-precision "
117*0fca6ea1SDimitry Andric                                             "floating point",
118*0fca6ea1SDimitry Andric                                             [FeatureFPARMv8_D16_SP, FeatureFPRegs16]>;
119*0fca6ea1SDimitry Andric
120*0fca6ea1SDimitry Andric// True if subtarget supports half-precision FP fml operations.
121*0fca6ea1SDimitry Andricdef FeatureFP16FML        : SubtargetFeature<"fp16fml", "HasFP16FML", "true",
122*0fca6ea1SDimitry Andric                                             "Enable full half-precision "
123*0fca6ea1SDimitry Andric                                             "floating point fml instructions",
124*0fca6ea1SDimitry Andric                                             [FeatureFullFP16]>;
125*0fca6ea1SDimitry Andric
126*0fca6ea1SDimitry Andric// True if subtarget supports [su]div in Thumb mode.
127*0fca6ea1SDimitry Andricdef FeatureHWDivThumb     : SubtargetFeature<"hwdiv",
128*0fca6ea1SDimitry Andric                                             "HasDivideInThumbMode", "true",
129*0fca6ea1SDimitry Andric                                             "Enable divide instructions in Thumb">;
130*0fca6ea1SDimitry Andric
131*0fca6ea1SDimitry Andric// True if subtarget supports [su]div in ARM mode.
132*0fca6ea1SDimitry Andricdef FeatureHWDivARM       : SubtargetFeature<"hwdiv-arm",
133*0fca6ea1SDimitry Andric                                             "HasDivideInARMMode", "true",
134*0fca6ea1SDimitry Andric                                             "Enable divide instructions in ARM mode">;
135*0fca6ea1SDimitry Andric
136*0fca6ea1SDimitry Andric// Atomic Support
137*0fca6ea1SDimitry Andric
138*0fca6ea1SDimitry Andric// True if the subtarget supports DMB / DSB data barrier instructions.
139*0fca6ea1SDimitry Andricdef FeatureDB             : SubtargetFeature<"db", "HasDataBarrier", "true",
140*0fca6ea1SDimitry Andric                                             "Has data barrier (dmb/dsb) instructions">;
141*0fca6ea1SDimitry Andric
142*0fca6ea1SDimitry Andric// True if the subtarget supports CLREX instructions.
143*0fca6ea1SDimitry Andricdef FeatureV7Clrex        : SubtargetFeature<"v7clrex", "HasV7Clrex", "true",
144*0fca6ea1SDimitry Andric                                             "Has v7 clrex instruction">;
145*0fca6ea1SDimitry Andric
146*0fca6ea1SDimitry Andric// True if the subtarget supports DFB data barrier instruction.
147*0fca6ea1SDimitry Andricdef FeatureDFB  : SubtargetFeature<"dfb", "HasFullDataBarrier", "true",
148*0fca6ea1SDimitry Andric                                   "Has full data barrier (dfb) instruction">;
149*0fca6ea1SDimitry Andric
150*0fca6ea1SDimitry Andric// True if the subtarget supports v8 atomics (LDA/LDAEX etc) instructions.
151*0fca6ea1SDimitry Andricdef FeatureAcquireRelease : SubtargetFeature<"acquire-release",
152*0fca6ea1SDimitry Andric                                             "HasAcquireRelease", "true",
153*0fca6ea1SDimitry Andric                                             "Has v8 acquire/release (lda/ldaex "
154*0fca6ea1SDimitry Andric                                             " etc) instructions">;
155*0fca6ea1SDimitry Andric
156*0fca6ea1SDimitry Andric
157*0fca6ea1SDimitry Andric// True if floating point compare + branch is slow.
158*0fca6ea1SDimitry Andricdef FeatureSlowFPBrcc     : SubtargetFeature<"slow-fp-brcc", "IsFPBrccSlow", "true",
159*0fca6ea1SDimitry Andric                                             "FP compare + branch is slow">;
160*0fca6ea1SDimitry Andric
161*0fca6ea1SDimitry Andric// True if the processor supports the Performance Monitor Extensions. These
162*0fca6ea1SDimitry Andric// include a generic cycle-counter as well as more fine-grained (often
163*0fca6ea1SDimitry Andric// implementation-specific) events.
164*0fca6ea1SDimitry Andricdef FeaturePerfMon        : SubtargetFeature<"perfmon", "HasPerfMon", "true",
165*0fca6ea1SDimitry Andric                                             "Enable support for Performance "
166*0fca6ea1SDimitry Andric                                             "Monitor extensions">;
167*0fca6ea1SDimitry Andric
168*0fca6ea1SDimitry Andric
169*0fca6ea1SDimitry Andric// TrustZone Security Extensions
170*0fca6ea1SDimitry Andric
171*0fca6ea1SDimitry Andric// True if processor supports TrustZone security extensions.
172*0fca6ea1SDimitry Andricdef FeatureTrustZone      : SubtargetFeature<"trustzone", "HasTrustZone", "true",
173*0fca6ea1SDimitry Andric                                             "Enable support for TrustZone "
174*0fca6ea1SDimitry Andric                                             "security extensions">;
175*0fca6ea1SDimitry Andric
176*0fca6ea1SDimitry Andric// True if processor supports ARMv8-M Security Extensions.
177*0fca6ea1SDimitry Andricdef Feature8MSecExt       : SubtargetFeature<"8msecext", "Has8MSecExt", "true",
178*0fca6ea1SDimitry Andric                                             "Enable support for ARMv8-M "
179*0fca6ea1SDimitry Andric                                             "Security Extensions">;
180*0fca6ea1SDimitry Andric
181*0fca6ea1SDimitry Andric// True if processor supports SHA1 and SHA256.
182*0fca6ea1SDimitry Andricdef FeatureSHA2           : SubtargetFeature<"sha2", "HasSHA2", "true",
183*0fca6ea1SDimitry Andric                                             "Enable SHA1 and SHA256 support", [FeatureNEON]>;
184*0fca6ea1SDimitry Andric
185*0fca6ea1SDimitry Andricdef FeatureAES            : SubtargetFeature<"aes", "HasAES", "true",
186*0fca6ea1SDimitry Andric                                             "Enable AES support", [FeatureNEON]>;
187*0fca6ea1SDimitry Andric
188*0fca6ea1SDimitry Andric// True if processor supports Cryptography extensions.
189*0fca6ea1SDimitry Andricdef FeatureCrypto         : SubtargetFeature<"crypto", "HasCrypto", "true",
190*0fca6ea1SDimitry Andric                                             "Enable support for "
191*0fca6ea1SDimitry Andric                                             "Cryptography extensions",
192*0fca6ea1SDimitry Andric                                             [FeatureNEON, FeatureSHA2, FeatureAES]>;
193*0fca6ea1SDimitry Andric
194*0fca6ea1SDimitry Andric// True if processor supports CRC instructions.
195*0fca6ea1SDimitry Andricdef FeatureCRC            : SubtargetFeature<"crc", "HasCRC", "true",
196*0fca6ea1SDimitry Andric                                             "Enable support for CRC instructions">;
197*0fca6ea1SDimitry Andric
198*0fca6ea1SDimitry Andric// True if the ARMv8.2A dot product instructions are supported.
199*0fca6ea1SDimitry Andricdef FeatureDotProd        : SubtargetFeature<"dotprod", "HasDotProd", "true",
200*0fca6ea1SDimitry Andric                                             "Enable support for dot product instructions",
201*0fca6ea1SDimitry Andric                                             [FeatureNEON]>;
202*0fca6ea1SDimitry Andric
203*0fca6ea1SDimitry Andric// True if the processor supports RAS extensions.
204*0fca6ea1SDimitry Andric// Not to be confused with FeatureHasRetAddrStack (return address stack).
205*0fca6ea1SDimitry Andricdef FeatureRAS            : SubtargetFeature<"ras", "HasRAS", "true",
206*0fca6ea1SDimitry Andric                                             "Enable Reliability, Availability "
207*0fca6ea1SDimitry Andric                                             "and Serviceability extensions">;
208*0fca6ea1SDimitry Andric
209*0fca6ea1SDimitry Andric// Fast computation of non-negative address offsets.
210*0fca6ea1SDimitry Andric// True if processor does positive address offset computation faster.
211*0fca6ea1SDimitry Andricdef FeatureFPAO           : SubtargetFeature<"fpao", "HasFPAO", "true",
212*0fca6ea1SDimitry Andric                                             "Enable fast computation of "
213*0fca6ea1SDimitry Andric                                             "positive address offsets">;
214*0fca6ea1SDimitry Andric
215*0fca6ea1SDimitry Andric// Fast execution of AES crypto operations.
216*0fca6ea1SDimitry Andric// True if processor executes back to back AES instruction pairs faster.
217*0fca6ea1SDimitry Andricdef FeatureFuseAES        : SubtargetFeature<"fuse-aes", "HasFuseAES", "true",
218*0fca6ea1SDimitry Andric                                             "CPU fuses AES crypto operations">;
219*0fca6ea1SDimitry Andric
220*0fca6ea1SDimitry Andric// Fast execution of bottom and top halves of literal generation.
221*0fca6ea1SDimitry Andric// True if processor executes back to back bottom and top halves of literal generation faster.
222*0fca6ea1SDimitry Andricdef FeatureFuseLiterals   : SubtargetFeature<"fuse-literals", "HasFuseLiterals", "true",
223*0fca6ea1SDimitry Andric                                             "CPU fuses literal generation operations">;
224*0fca6ea1SDimitry Andric
225*0fca6ea1SDimitry Andric// Choice of hardware register to use as the thread pointer, if any.
226*0fca6ea1SDimitry Andricdef FeatureReadTpTPIDRURW :  SubtargetFeature<"read-tp-tpidrurw", "IsReadTPTPIDRURW", "true",
227*0fca6ea1SDimitry Andric                                      "Reading thread pointer from TPIDRURW register">;
228*0fca6ea1SDimitry Andricdef FeatureReadTpTPIDRURO :  SubtargetFeature<"read-tp-tpidruro", "IsReadTPTPIDRURO", "true",
229*0fca6ea1SDimitry Andric                                      "Reading thread pointer from TPIDRURO register">;
230*0fca6ea1SDimitry Andricdef FeatureReadTpTPIDRPRW :  SubtargetFeature<"read-tp-tpidrprw", "IsReadTPTPIDRPRW", "true",
231*0fca6ea1SDimitry Andric                                      "Reading thread pointer from TPIDRPRW register">;
232*0fca6ea1SDimitry Andric
233*0fca6ea1SDimitry Andric// Cyclone can zero VFP registers in 0 cycles.
234*0fca6ea1SDimitry Andric// True if the instructions "vmov.i32 d0, #0" and "vmov.i32 q0, #0" are
235*0fca6ea1SDimitry Andric// particularly effective at zeroing a VFP register.
236*0fca6ea1SDimitry Andricdef FeatureZCZeroing      : SubtargetFeature<"zcz", "HasZeroCycleZeroing", "true",
237*0fca6ea1SDimitry Andric                                             "Has zero-cycle zeroing instructions">;
238*0fca6ea1SDimitry Andric
239*0fca6ea1SDimitry Andric// Whether it is profitable to unpredicate certain instructions during if-conversion.
240*0fca6ea1SDimitry Andric// True if if conversion may decide to leave some instructions unpredicated.
241*0fca6ea1SDimitry Andricdef FeatureProfUnpredicate : SubtargetFeature<"prof-unpr",
242*0fca6ea1SDimitry Andric                                              "IsProfitableToUnpredicate", "true",
243*0fca6ea1SDimitry Andric                                              "Is profitable to unpredicate">;
244*0fca6ea1SDimitry Andric
245*0fca6ea1SDimitry Andric// Some targets (e.g. Swift) have microcoded VGETLNi32.
246*0fca6ea1SDimitry Andric// True if VMOV will be favored over VGETLNi32.
247*0fca6ea1SDimitry Andricdef FeatureSlowVGETLNi32  : SubtargetFeature<"slow-vgetlni32",
248*0fca6ea1SDimitry Andric                                             "HasSlowVGETLNi32", "true",
249*0fca6ea1SDimitry Andric                                             "Has slow VGETLNi32 - prefer VMOV">;
250*0fca6ea1SDimitry Andric
251*0fca6ea1SDimitry Andric// Some targets (e.g. Swift) have microcoded VDUP32.
252*0fca6ea1SDimitry Andric// True if VMOV will be favored over VDUP.
253*0fca6ea1SDimitry Andricdef FeatureSlowVDUP32     : SubtargetFeature<"slow-vdup32", "HasSlowVDUP32",
254*0fca6ea1SDimitry Andric                                             "true",
255*0fca6ea1SDimitry Andric                                             "Has slow VDUP32 - prefer VMOV">;
256*0fca6ea1SDimitry Andric
257*0fca6ea1SDimitry Andric// Some targets (e.g. Cortex-A9) prefer VMOVSR to VMOVDRR even when using NEON
258*0fca6ea1SDimitry Andric// for scalar FP, as this allows more effective execution domain optimization.
259*0fca6ea1SDimitry Andric// True if VMOVSR will be favored over VMOVDRR.
260*0fca6ea1SDimitry Andricdef FeaturePreferVMOVSR   : SubtargetFeature<"prefer-vmovsr", "PreferVMOVSR",
261*0fca6ea1SDimitry Andric                                             "true", "Prefer VMOVSR">;
262*0fca6ea1SDimitry Andric
263*0fca6ea1SDimitry Andric// Swift has ISHST barriers compatible with Atomic Release semantics but weaker
264*0fca6ea1SDimitry Andric// than ISH.
265*0fca6ea1SDimitry Andric// True if ISHST barriers will be used for Release semantics.
266*0fca6ea1SDimitry Andricdef FeaturePrefISHSTBarrier : SubtargetFeature<"prefer-ishst", "PreferISHSTBarriers",
267*0fca6ea1SDimitry Andric                                               "true", "Prefer ISHST barriers">;
268*0fca6ea1SDimitry Andric
269*0fca6ea1SDimitry Andric// Some targets (e.g. Cortex-A9) have muxed AGU and NEON/FPU.
270*0fca6ea1SDimitry Andric// True if the AGU and NEON/FPU units are multiplexed.
271*0fca6ea1SDimitry Andricdef FeatureMuxedUnits     : SubtargetFeature<"muxed-units", "HasMuxedUnits",
272*0fca6ea1SDimitry Andric                                             "true",
273*0fca6ea1SDimitry Andric                                             "Has muxed AGU and NEON/FPU">;
274*0fca6ea1SDimitry Andric
275*0fca6ea1SDimitry Andric// Whether VLDM/VSTM starting with odd register number need more microops
276*0fca6ea1SDimitry Andric// than single VLDRS.
277*0fca6ea1SDimitry Andric// True if a VLDM/VSTM starting with an odd register number is considered to
278*0fca6ea1SDimitry Andric// take more microops than single VLDRS/VSTRS.
279*0fca6ea1SDimitry Andricdef FeatureSlowOddRegister : SubtargetFeature<"slow-odd-reg", "HasSlowOddRegister",
280*0fca6ea1SDimitry Andric                                              "true", "VLDM/VSTM starting "
281*0fca6ea1SDimitry Andric                                              "with an odd register is slow">;
282*0fca6ea1SDimitry Andric
283*0fca6ea1SDimitry Andric// Some targets have a renaming dependency when loading into D subregisters.
284*0fca6ea1SDimitry Andric// True if loading into a D subregister will be penalized.
285*0fca6ea1SDimitry Andricdef FeatureSlowLoadDSubreg : SubtargetFeature<"slow-load-D-subreg",
286*0fca6ea1SDimitry Andric                                              "HasSlowLoadDSubregister", "true",
287*0fca6ea1SDimitry Andric                                              "Loading into D subregs is slow">;
288*0fca6ea1SDimitry Andric
289*0fca6ea1SDimitry Andric// True if use a wider stride when allocating VFP registers.
290*0fca6ea1SDimitry Andricdef FeatureUseWideStrideVFP : SubtargetFeature<"wide-stride-vfp",
291*0fca6ea1SDimitry Andric                                               "UseWideStrideVFP", "true",
292*0fca6ea1SDimitry Andric                                               "Use a wide stride when allocating VFP registers">;
293*0fca6ea1SDimitry Andric
294*0fca6ea1SDimitry Andric// Some targets (e.g. Cortex-A15) never want VMOVS to be widened to VMOVD.
295*0fca6ea1SDimitry Andric// True if VMOVS will never be widened to VMOVD.
296*0fca6ea1SDimitry Andricdef FeatureDontWidenVMOVS : SubtargetFeature<"dont-widen-vmovs",
297*0fca6ea1SDimitry Andric                                             "DontWidenVMOVS", "true",
298*0fca6ea1SDimitry Andric                                             "Don't widen VMOVS to VMOVD">;
299*0fca6ea1SDimitry Andric
300*0fca6ea1SDimitry Andric// Some targets (e.g. Cortex-A15) prefer to avoid mixing operations on different
301*0fca6ea1SDimitry Andric// VFP register widths.
302*0fca6ea1SDimitry Andric// True if splat a register between VFP and NEON instructions.
303*0fca6ea1SDimitry Andricdef FeatureSplatVFPToNeon : SubtargetFeature<"splat-vfp-neon",
304*0fca6ea1SDimitry Andric                                             "UseSplatVFPToNeon", "true",
305*0fca6ea1SDimitry Andric                                             "Splat register from VFP to NEON",
306*0fca6ea1SDimitry Andric                                             [FeatureDontWidenVMOVS]>;
307*0fca6ea1SDimitry Andric
308*0fca6ea1SDimitry Andric// Whether or not it is profitable to expand VFP/NEON MLA/MLS instructions.
309*0fca6ea1SDimitry Andric// True if run the MLx expansion pass.
310*0fca6ea1SDimitry Andricdef FeatureExpandMLx      : SubtargetFeature<"expand-fp-mlx",
311*0fca6ea1SDimitry Andric                                             "ExpandMLx", "true",
312*0fca6ea1SDimitry Andric                                             "Expand VFP/NEON MLA/MLS instructions">;
313*0fca6ea1SDimitry Andric
314*0fca6ea1SDimitry Andric// Some targets have special RAW hazards for VFP/NEON VMLA/VMLS.
315*0fca6ea1SDimitry Andric// True if VFP/NEON VMLA/VMLS have special RAW hazards.
316*0fca6ea1SDimitry Andricdef FeatureHasVMLxHazards : SubtargetFeature<"vmlx-hazards", "HasVMLxHazards",
317*0fca6ea1SDimitry Andric                                             "true", "Has VMLx hazards">;
318*0fca6ea1SDimitry Andric
319*0fca6ea1SDimitry Andric// Some targets (e.g. Cortex-A9) want to convert VMOVRS, VMOVSR and VMOVS from
320*0fca6ea1SDimitry Andric// VFP to NEON, as an execution domain optimization.
321*0fca6ea1SDimitry Andric// True if VMOVRS, VMOVSR and VMOVS will be converted from VFP to NEON.
322*0fca6ea1SDimitry Andricdef FeatureNEONForFPMovs  : SubtargetFeature<"neon-fpmovs",
323*0fca6ea1SDimitry Andric                                             "UseNEONForFPMovs", "true",
324*0fca6ea1SDimitry Andric                                             "Convert VMOVSR, VMOVRS, "
325*0fca6ea1SDimitry Andric                                             "VMOVS to NEON">;
326*0fca6ea1SDimitry Andric
327*0fca6ea1SDimitry Andric// Some processors benefit from using NEON instructions for scalar
328*0fca6ea1SDimitry Andric// single-precision FP operations. This affects instruction selection and should
329*0fca6ea1SDimitry Andric// only be enabled if the handling of denormals is not important.
330*0fca6ea1SDimitry Andric// Use the method useNEONForSinglePrecisionFP() to determine if NEON should actually be used.
331*0fca6ea1SDimitry Andricdef FeatureNEONForFP      : SubtargetFeature<"neonfp",
332*0fca6ea1SDimitry Andric                                             "HasNEONForFP",
333*0fca6ea1SDimitry Andric                                             "true",
334*0fca6ea1SDimitry Andric                                             "Use NEON for single precision FP">;
335*0fca6ea1SDimitry Andric
336*0fca6ea1SDimitry Andric// On some processors, VLDn instructions that access unaligned data take one
337*0fca6ea1SDimitry Andric// extra cycle. Take that into account when computing operand latencies.
338*0fca6ea1SDimitry Andric// True if VLDn instructions take an extra cycle for unaligned accesses.
339*0fca6ea1SDimitry Andricdef FeatureCheckVLDnAlign : SubtargetFeature<"vldn-align", "CheckVLDnAccessAlignment",
340*0fca6ea1SDimitry Andric                                             "true",
341*0fca6ea1SDimitry Andric                                             "Check for VLDn unaligned access">;
342*0fca6ea1SDimitry Andric
343*0fca6ea1SDimitry Andric// Some processors have a nonpipelined VFP coprocessor.
344*0fca6ea1SDimitry Andric// True if VFP instructions are not pipelined.
345*0fca6ea1SDimitry Andricdef FeatureNonpipelinedVFP : SubtargetFeature<"nonpipelined-vfp",
346*0fca6ea1SDimitry Andric                                              "NonpipelinedVFP", "true",
347*0fca6ea1SDimitry Andric                                              "VFP instructions are not pipelined">;
348*0fca6ea1SDimitry Andric
349*0fca6ea1SDimitry Andric// Some processors have FP multiply-accumulate instructions that don't
350*0fca6ea1SDimitry Andric// play nicely with other VFP / NEON instructions, and it's generally better
351*0fca6ea1SDimitry Andric// to just not use them.
352*0fca6ea1SDimitry Andric// If the VFP2 / NEON instructions are available, indicates
353*0fca6ea1SDimitry Andric// whether the FP VML[AS] instructions are slow (if so, don't use them).
354*0fca6ea1SDimitry Andricdef FeatureHasSlowFPVMLx  : SubtargetFeature<"slowfpvmlx", "SlowFPVMLx", "true",
355*0fca6ea1SDimitry Andric                                             "Disable VFP / NEON MAC instructions">;
356*0fca6ea1SDimitry Andric
357*0fca6ea1SDimitry Andric// VFPv4 added VFMA instructions that can similarly be fast or slow.
358*0fca6ea1SDimitry Andric// If the VFP4 / NEON instructions are available, indicates
359*0fca6ea1SDimitry Andric// whether the FP VFM[AS] instructions are slow (if so, don't use them).
360*0fca6ea1SDimitry Andricdef FeatureHasSlowFPVFMx  : SubtargetFeature<"slowfpvfmx", "SlowFPVFMx", "true",
361*0fca6ea1SDimitry Andric                                             "Disable VFP / NEON FMA instructions">;
362*0fca6ea1SDimitry Andric
363*0fca6ea1SDimitry Andric// Cortex-A8 / A9 Advanced SIMD has multiplier accumulator forwarding.
364*0fca6ea1SDimitry Andric/// True if NEON has special multiplier accumulator
365*0fca6ea1SDimitry Andric/// forwarding to allow mul + mla being issued back to back.
366*0fca6ea1SDimitry Andricdef FeatureVMLxForwarding : SubtargetFeature<"vmlx-forwarding",
367*0fca6ea1SDimitry Andric                                             "HasVMLxForwarding", "true",
368*0fca6ea1SDimitry Andric                                             "Has multiplier accumulator forwarding">;
369*0fca6ea1SDimitry Andric
370*0fca6ea1SDimitry Andric// Disable 32-bit to 16-bit narrowing for experimentation.
371*0fca6ea1SDimitry Andric// True if codegen would prefer 32-bit Thumb instructions over 16-bit ones.
372*0fca6ea1SDimitry Andricdef FeaturePref32BitThumb : SubtargetFeature<"32bit", "Prefers32BitThumb", "true",
373*0fca6ea1SDimitry Andric                                             "Prefer 32-bit Thumb instrs">;
374*0fca6ea1SDimitry Andric
375*0fca6ea1SDimitry Andricdef FeaturePrefLoopAlign32 : SubtargetFeature<"loop-align", "PrefLoopLogAlignment","2",
376*0fca6ea1SDimitry Andric                                              "Prefer 32-bit alignment for loops">;
377*0fca6ea1SDimitry Andric
378*0fca6ea1SDimitry Andricdef FeatureMVEVectorCostFactor1 : SubtargetFeature<"mve1beat", "MVEVectorCostFactor", "4",
379*0fca6ea1SDimitry Andric                        "Model MVE instructions as a 1 beat per tick architecture">;
380*0fca6ea1SDimitry Andric
381*0fca6ea1SDimitry Andricdef FeatureMVEVectorCostFactor2 : SubtargetFeature<"mve2beat", "MVEVectorCostFactor", "2",
382*0fca6ea1SDimitry Andric                        "Model MVE instructions as a 2 beats per tick architecture">;
383*0fca6ea1SDimitry Andric
384*0fca6ea1SDimitry Andricdef FeatureMVEVectorCostFactor4 : SubtargetFeature<"mve4beat", "MVEVectorCostFactor", "1",
385*0fca6ea1SDimitry Andric                        "Model MVE instructions as a 4 beats per tick architecture">;
386*0fca6ea1SDimitry Andric
387*0fca6ea1SDimitry Andric/// Some instructions update CPSR partially, which can add false dependency for
388*0fca6ea1SDimitry Andric/// out-of-order implementation, e.g. Cortex-A9, unless each individual bit is
389*0fca6ea1SDimitry Andric/// mapped to a separate physical register. Avoid partial CPSR update for these
390*0fca6ea1SDimitry Andric/// processors.
391*0fca6ea1SDimitry Andric/// True if codegen would avoid using instructions
392*0fca6ea1SDimitry Andric/// that partially update CPSR and add false dependency on the previous
393*0fca6ea1SDimitry Andric/// CPSR setting instruction.
394*0fca6ea1SDimitry Andricdef FeatureAvoidPartialCPSR : SubtargetFeature<"avoid-partial-cpsr",
395*0fca6ea1SDimitry Andric                                               "AvoidCPSRPartialUpdate", "true",
396*0fca6ea1SDimitry Andric                                 "Avoid CPSR partial update for OOO execution">;
397*0fca6ea1SDimitry Andric
398*0fca6ea1SDimitry Andric/// Disable +1 predication cost for instructions updating CPSR.
399*0fca6ea1SDimitry Andric/// Enabled for Cortex-A57.
400*0fca6ea1SDimitry Andric/// True if disable +1 predication cost for instructions updating CPSR. Enabled for Cortex-A57.
401*0fca6ea1SDimitry Andricdef FeatureCheapPredicableCPSR : SubtargetFeature<"cheap-predicable-cpsr",
402*0fca6ea1SDimitry Andric                                                  "CheapPredicableCPSRDef",
403*0fca6ea1SDimitry Andric                                                  "true",
404*0fca6ea1SDimitry Andric                  "Disable +1 predication cost for instructions updating CPSR">;
405*0fca6ea1SDimitry Andric
406*0fca6ea1SDimitry Andric// True if codegen should avoid using flag setting movs with shifter operand (i.e. asr, lsl, lsr).
407*0fca6ea1SDimitry Andricdef FeatureAvoidMOVsShOp  : SubtargetFeature<"avoid-movs-shop",
408*0fca6ea1SDimitry Andric                                             "AvoidMOVsShifterOperand", "true",
409*0fca6ea1SDimitry Andric                                             "Avoid movs instructions with "
410*0fca6ea1SDimitry Andric                                             "shifter operand">;
411*0fca6ea1SDimitry Andric
412*0fca6ea1SDimitry Andric// Some processors perform return stack prediction. CodeGen should avoid issue
413*0fca6ea1SDimitry Andric// "normal" call instructions to callees which do not return.
414*0fca6ea1SDimitry Andricdef FeatureHasRetAddrStack : SubtargetFeature<"ret-addr-stack",
415*0fca6ea1SDimitry Andric                                              "HasRetAddrStack", "true",
416*0fca6ea1SDimitry Andric                                              "Has return address stack">;
417*0fca6ea1SDimitry Andric
418*0fca6ea1SDimitry Andric// Some processors have no branch predictor, which changes the expected cost of
419*0fca6ea1SDimitry Andric// taking a branch which affects the choice of whether to use predicated
420*0fca6ea1SDimitry Andric// instructions.
421*0fca6ea1SDimitry Andric// True if the subtarget has a branch predictor. Having
422*0fca6ea1SDimitry Andric// a branch predictor or not changes the expected cost of taking a branch
423*0fca6ea1SDimitry Andric// which affects the choice of whether to use predicated instructions.
424*0fca6ea1SDimitry Andricdef FeatureHasNoBranchPredictor : SubtargetFeature<"no-branch-predictor",
425*0fca6ea1SDimitry Andric                                                   "HasBranchPredictor", "false",
426*0fca6ea1SDimitry Andric                                                   "Has no branch predictor">;
427*0fca6ea1SDimitry Andric
428*0fca6ea1SDimitry Andric/// DSP extension.
429*0fca6ea1SDimitry Andric/// True if the subtarget supports the DSP (saturating arith and such) instructions.
430*0fca6ea1SDimitry Andricdef FeatureDSP            : SubtargetFeature<"dsp", "HasDSP", "true",
431*0fca6ea1SDimitry Andric                                             "Supports DSP instructions in "
432*0fca6ea1SDimitry Andric                                             "ARM and/or Thumb2">;
433*0fca6ea1SDimitry Andric
434*0fca6ea1SDimitry Andric// True if the subtarget supports Multiprocessing extension (ARMv7 only).
435*0fca6ea1SDimitry Andricdef FeatureMP             : SubtargetFeature<"mp", "HasMPExtension", "true",
436*0fca6ea1SDimitry Andric                                        "Supports Multiprocessing extension">;
437*0fca6ea1SDimitry Andric
438*0fca6ea1SDimitry Andric// Virtualization extension - requires HW divide (ARMv7-AR ARMARM - 4.4.8).
439*0fca6ea1SDimitry Andricdef FeatureVirtualization : SubtargetFeature<"virtualization",
440*0fca6ea1SDimitry Andric                                             "HasVirtualization", "true",
441*0fca6ea1SDimitry Andric                                             "Supports Virtualization extension",
442*0fca6ea1SDimitry Andric                                             [FeatureHWDivThumb, FeatureHWDivARM]>;
443*0fca6ea1SDimitry Andric
444*0fca6ea1SDimitry Andric// Special TRAP encoding for NaCl, which looks like a TRAP in Thumb too.
445*0fca6ea1SDimitry Andric// See ARMInstrInfo.td for details.
446*0fca6ea1SDimitry Andric// True if NaCl TRAP instruction is generated instead of the regular TRAP.
447*0fca6ea1SDimitry Andricdef FeatureNaClTrap       : SubtargetFeature<"nacl-trap", "UseNaClTrap", "true",
448*0fca6ea1SDimitry Andric                                             "NaCl trap">;
449*0fca6ea1SDimitry Andric
450*0fca6ea1SDimitry Andric// True if the subtarget disallows unaligned memory
451*0fca6ea1SDimitry Andric// accesses for some types.  For details, see
452*0fca6ea1SDimitry Andric// ARMTargetLowering::allowsMisalignedMemoryAccesses().
453*0fca6ea1SDimitry Andricdef FeatureStrictAlign    : SubtargetFeature<"strict-align",
454*0fca6ea1SDimitry Andric                                             "StrictAlign", "true",
455*0fca6ea1SDimitry Andric                                             "Disallow all unaligned memory "
456*0fca6ea1SDimitry Andric                                             "access">;
457*0fca6ea1SDimitry Andric
458*0fca6ea1SDimitry Andric// Generate calls via indirect call instructions.
459*0fca6ea1SDimitry Andricdef FeatureLongCalls      : SubtargetFeature<"long-calls", "GenLongCalls", "true",
460*0fca6ea1SDimitry Andric                                             "Generate calls via indirect call "
461*0fca6ea1SDimitry Andric                                             "instructions">;
462*0fca6ea1SDimitry Andric
463*0fca6ea1SDimitry Andric// Generate code that does not contain data access to code sections.
464*0fca6ea1SDimitry Andricdef FeatureExecuteOnly    : SubtargetFeature<"execute-only",
465*0fca6ea1SDimitry Andric                                             "GenExecuteOnly", "true",
466*0fca6ea1SDimitry Andric                                             "Enable the generation of "
467*0fca6ea1SDimitry Andric                                             "execute only code.">;
468*0fca6ea1SDimitry Andric
469*0fca6ea1SDimitry Andric// True if R9 is not available as a general purpose register.
470*0fca6ea1SDimitry Andricdef FeatureReserveR9      : SubtargetFeature<"reserve-r9", "ReserveR9", "true",
471*0fca6ea1SDimitry Andric                                             "Reserve R9, making it unavailable"
472*0fca6ea1SDimitry Andric                                             " as GPR">;
473*0fca6ea1SDimitry Andric
474*0fca6ea1SDimitry Andric// True if MOVT / MOVW pairs are not used for materialization of
475*0fca6ea1SDimitry Andric// 32-bit imms (including global addresses).
476*0fca6ea1SDimitry Andricdef FeatureNoMovt         : SubtargetFeature<"no-movt", "NoMovt", "true",
477*0fca6ea1SDimitry Andric                                             "Don't use movt/movw pairs for "
478*0fca6ea1SDimitry Andric                                             "32-bit imms">;
479*0fca6ea1SDimitry Andric
480*0fca6ea1SDimitry Andric/// Implicitly convert an instruction to a different one if its immediates
481*0fca6ea1SDimitry Andric/// cannot be encoded. For example, ADD r0, r1, #FFFFFFFF -> SUB r0, r1, #1.
482*0fca6ea1SDimitry Andricdef FeatureNoNegativeImmediates
483*0fca6ea1SDimitry Andric                          : SubtargetFeature<"no-neg-immediates",
484*0fca6ea1SDimitry Andric                                             "NegativeImmediates", "false",
485*0fca6ea1SDimitry Andric                                             "Convert immediates and instructions "
486*0fca6ea1SDimitry Andric                                             "to their negated or complemented "
487*0fca6ea1SDimitry Andric                                             "equivalent when the immediate does "
488*0fca6ea1SDimitry Andric                                             "not fit in the encoding.">;
489*0fca6ea1SDimitry Andric
490*0fca6ea1SDimitry Andric// Use the MachineScheduler for instruction scheduling for the subtarget.
491*0fca6ea1SDimitry Andricdef FeatureUseMISched: SubtargetFeature<"use-misched", "UseMISched", "true",
492*0fca6ea1SDimitry Andric                                        "Use the MachineScheduler">;
493*0fca6ea1SDimitry Andric
494*0fca6ea1SDimitry Andric// Use the MachinePipeliner for instruction scheduling for the subtarget.
495*0fca6ea1SDimitry Andricdef FeatureUseMIPipeliner: SubtargetFeature<"use-mipipeliner", "UseMIPipeliner", "true",
496*0fca6ea1SDimitry Andric                                            "Use the MachinePipeliner">;
497*0fca6ea1SDimitry Andric
498*0fca6ea1SDimitry Andric// False if scheduling should happen again after register allocation.
499*0fca6ea1SDimitry Andricdef FeatureNoPostRASched : SubtargetFeature<"disable-postra-scheduler",
500*0fca6ea1SDimitry Andric    "DisablePostRAScheduler", "true",
501*0fca6ea1SDimitry Andric    "Don't schedule again after register allocation">;
502*0fca6ea1SDimitry Andric
503*0fca6ea1SDimitry Andric// Armv8.5-A extensions
504*0fca6ea1SDimitry Andric
505*0fca6ea1SDimitry Andric// Has speculation barrier.
506*0fca6ea1SDimitry Andricdef FeatureSB       : SubtargetFeature<"sb", "HasSB", "true",
507*0fca6ea1SDimitry Andric  "Enable v8.5a Speculation Barrier" >;
508*0fca6ea1SDimitry Andric
509*0fca6ea1SDimitry Andric// Armv8.6-A extensions
510*0fca6ea1SDimitry Andric
511*0fca6ea1SDimitry Andric// True if subtarget supports BFloat16 floating point operations.
512*0fca6ea1SDimitry Andricdef FeatureBF16     : SubtargetFeature<"bf16", "HasBF16", "true",
513*0fca6ea1SDimitry Andric  "Enable support for BFloat16 instructions",  [FeatureNEON]>;
514*0fca6ea1SDimitry Andric
515*0fca6ea1SDimitry Andric// True if subtarget supports 8-bit integer matrix multiply.
516*0fca6ea1SDimitry Andricdef FeatureMatMulInt8 : SubtargetFeature<"i8mm", "HasMatMulInt8",
517*0fca6ea1SDimitry Andric    "true", "Enable Matrix Multiply Int8 Extension", [FeatureNEON]>;
518*0fca6ea1SDimitry Andric
519*0fca6ea1SDimitry Andric// Armv8.1-M extensions
520*0fca6ea1SDimitry Andric
521*0fca6ea1SDimitry Andric// True if the processor supports the Low Overhead Branch extension.
522*0fca6ea1SDimitry Andricdef FeatureLOB            : SubtargetFeature<"lob", "HasLOB", "true",
523*0fca6ea1SDimitry Andric                                             "Enable Low Overhead Branch "
524*0fca6ea1SDimitry Andric                                             "extensions">;
525*0fca6ea1SDimitry Andric
526*0fca6ea1SDimitry Andric// Mitigate against the cve-2021-35465 security vulnurability.
527*0fca6ea1SDimitry Andricdef FeatureFixCMSE_CVE_2021_35465 : SubtargetFeature<"fix-cmse-cve-2021-35465",
528*0fca6ea1SDimitry Andric                                        "FixCMSE_CVE_2021_35465", "true",
529*0fca6ea1SDimitry Andric                                        "Mitigate against the cve-2021-35465 "
530*0fca6ea1SDimitry Andric                                        "security vulnurability">;
531*0fca6ea1SDimitry Andric
532*0fca6ea1SDimitry Andricdef FeaturePACBTI         : SubtargetFeature<"pacbti", "HasPACBTI", "true",
533*0fca6ea1SDimitry Andric                                             "Enable Pointer Authentication and Branch "
534*0fca6ea1SDimitry Andric                                             "Target Identification">;
535*0fca6ea1SDimitry Andric
536*0fca6ea1SDimitry Andric/// Don't place a BTI instruction after return-twice constructs (setjmp).
537*0fca6ea1SDimitry Andricdef FeatureNoBTIAtReturnTwice : SubtargetFeature<"no-bti-at-return-twice",
538*0fca6ea1SDimitry Andric                                                 "NoBTIAtReturnTwice", "true",
539*0fca6ea1SDimitry Andric                                                 "Don't place a BTI instruction "
540*0fca6ea1SDimitry Andric                                                 "after a return-twice">;
541*0fca6ea1SDimitry Andric
542*0fca6ea1SDimitry Andric// Armv8.9-A/Armv9.4-A 2022 Architecture Extensions
543*0fca6ea1SDimitry Andricdef FeatureCLRBHB : SubtargetFeature<"clrbhb", "HasCLRBHB", "true",
544*0fca6ea1SDimitry Andric                                     "Enable Clear BHB instruction">;
545*0fca6ea1SDimitry Andric
546*0fca6ea1SDimitry Andric
547*0fca6ea1SDimitry Andricdef FeatureFixCortexA57AES1742098 : SubtargetFeature<"fix-cortex-a57-aes-1742098",
548*0fca6ea1SDimitry Andric  "FixCortexA57AES1742098", "true",
549*0fca6ea1SDimitry Andric  "Work around Cortex-A57 Erratum 1742098 / Cortex-A72 Erratum 1655431 (AES)">;
550*0fca6ea1SDimitry Andric
551*0fca6ea1SDimitry Andric// If frame pointers are in use, they must follow the AAPCS definition, which
552*0fca6ea1SDimitry Andric// always uses R11 as the frame pointer. If this is not set, we can use R7 as
553*0fca6ea1SDimitry Andric// the frame pointer for Thumb1-only code, which is more efficient, but less
554*0fca6ea1SDimitry Andric// compatible. Note that this feature does not control whether frame pointers
555*0fca6ea1SDimitry Andric// are emitted, that is controlled by the "frame-pointer" function attribute.
556*0fca6ea1SDimitry Andricdef FeatureAAPCSFrameChain : SubtargetFeature<"aapcs-frame-chain",
557*0fca6ea1SDimitry Andric                                              "CreateAAPCSFrameChain", "true",
558*0fca6ea1SDimitry Andric                                              "Create an AAPCS compliant frame chain">;
559*0fca6ea1SDimitry Andric
560*0fca6ea1SDimitry Andric// Assume that lock-free 32-bit atomics are available, even if the target
561*0fca6ea1SDimitry Andric// and operating system combination would not usually provide them. The user
562*0fca6ea1SDimitry Andric// is responsible for providing any necessary __sync implementations. Code
563*0fca6ea1SDimitry Andric// built with this feature is not ABI-compatible with code built without this
564*0fca6ea1SDimitry Andric// feature, if atomic variables are exposed across the ABI boundary.
565*0fca6ea1SDimitry Andricdef FeatureAtomics32 : SubtargetFeature<
566*0fca6ea1SDimitry Andric    "atomics-32", "HasForced32BitAtomics", "true",
567*0fca6ea1SDimitry Andric    "Assume that lock-free 32-bit atomics are available">;
568*0fca6ea1SDimitry Andric
569*0fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
570*0fca6ea1SDimitry Andric// ARM architecture class
571*0fca6ea1SDimitry Andric//
572*0fca6ea1SDimitry Andric
573*0fca6ea1SDimitry Andric// A-series ISA
574*0fca6ea1SDimitry Andricdef FeatureAClass : SubtargetFeature<"aclass", "ARMProcClass", "AClass",
575*0fca6ea1SDimitry Andric                                     "Is application profile ('A' series)">;
576*0fca6ea1SDimitry Andric
577*0fca6ea1SDimitry Andric// R-series ISA
578*0fca6ea1SDimitry Andricdef FeatureRClass : SubtargetFeature<"rclass", "ARMProcClass", "RClass",
579*0fca6ea1SDimitry Andric                                     "Is realtime profile ('R' series)">;
580*0fca6ea1SDimitry Andric
581*0fca6ea1SDimitry Andric// M-series ISA
582*0fca6ea1SDimitry Andricdef FeatureMClass : SubtargetFeature<"mclass", "ARMProcClass", "MClass",
583*0fca6ea1SDimitry Andric                                     "Is microcontroller profile ('M' series)">;
584*0fca6ea1SDimitry Andric
585*0fca6ea1SDimitry Andric// True if Thumb2 instructions are supported.
586*0fca6ea1SDimitry Andricdef FeatureThumb2 : SubtargetFeature<"thumb2", "HasThumb2", "true",
587*0fca6ea1SDimitry Andric                                     "Enable Thumb2 instructions">;
588*0fca6ea1SDimitry Andric
589*0fca6ea1SDimitry Andric// True if subtarget does not support ARM mode execution.
590*0fca6ea1SDimitry Andricdef FeatureNoARM  : SubtargetFeature<"noarm", "NoARM", "true",
591*0fca6ea1SDimitry Andric                                     "Does not support ARM mode execution">;
592*0fca6ea1SDimitry Andric
593*0fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
594*0fca6ea1SDimitry Andric// ARM ISAa.
595*0fca6ea1SDimitry Andric//
596*0fca6ea1SDimitry Andric// Specify whether target support specific ARM ISA variants.
597*0fca6ea1SDimitry Andric
598*0fca6ea1SDimitry Andricdef HasV4TOps   : SubtargetFeature<"v4t", "HasV4TOps", "true",
599*0fca6ea1SDimitry Andric                                   "Support ARM v4T instructions">;
600*0fca6ea1SDimitry Andric
601*0fca6ea1SDimitry Andricdef HasV5TOps   : SubtargetFeature<"v5t", "HasV5TOps", "true",
602*0fca6ea1SDimitry Andric                                   "Support ARM v5T instructions",
603*0fca6ea1SDimitry Andric                                   [HasV4TOps]>;
604*0fca6ea1SDimitry Andric
605*0fca6ea1SDimitry Andricdef HasV5TEOps  : SubtargetFeature<"v5te", "HasV5TEOps", "true",
606*0fca6ea1SDimitry Andric                                   "Support ARM v5TE, v5TEj, and "
607*0fca6ea1SDimitry Andric                                   "v5TExp instructions",
608*0fca6ea1SDimitry Andric                                   [HasV5TOps]>;
609*0fca6ea1SDimitry Andric
610*0fca6ea1SDimitry Andricdef HasV6Ops    : SubtargetFeature<"v6", "HasV6Ops", "true",
611*0fca6ea1SDimitry Andric                                   "Support ARM v6 instructions",
612*0fca6ea1SDimitry Andric                                   [HasV5TEOps]>;
613*0fca6ea1SDimitry Andric
614*0fca6ea1SDimitry Andricdef HasV6MOps   : SubtargetFeature<"v6m", "HasV6MOps", "true",
615*0fca6ea1SDimitry Andric                                   "Support ARM v6M instructions",
616*0fca6ea1SDimitry Andric                                   [HasV6Ops]>;
617*0fca6ea1SDimitry Andric
618*0fca6ea1SDimitry Andricdef HasV8MBaselineOps : SubtargetFeature<"v8m", "HasV8MBaselineOps", "true",
619*0fca6ea1SDimitry Andric                                         "Support ARM v8M Baseline instructions",
620*0fca6ea1SDimitry Andric                                         [HasV6MOps]>;
621*0fca6ea1SDimitry Andric
622*0fca6ea1SDimitry Andricdef HasV6KOps   : SubtargetFeature<"v6k", "HasV6KOps", "true",
623*0fca6ea1SDimitry Andric                                   "Support ARM v6k instructions",
624*0fca6ea1SDimitry Andric                                   [HasV6Ops]>;
625*0fca6ea1SDimitry Andric
626*0fca6ea1SDimitry Andricdef HasV6T2Ops  : SubtargetFeature<"v6t2", "HasV6T2Ops", "true",
627*0fca6ea1SDimitry Andric                                   "Support ARM v6t2 instructions",
628*0fca6ea1SDimitry Andric                                   [HasV8MBaselineOps, HasV6KOps, FeatureThumb2]>;
629*0fca6ea1SDimitry Andric
630*0fca6ea1SDimitry Andricdef HasV7Ops    : SubtargetFeature<"v7", "HasV7Ops", "true",
631*0fca6ea1SDimitry Andric                                   "Support ARM v7 instructions",
632*0fca6ea1SDimitry Andric                                   [HasV6T2Ops, FeatureV7Clrex]>;
633*0fca6ea1SDimitry Andric
634*0fca6ea1SDimitry Andricdef HasV8MMainlineOps :
635*0fca6ea1SDimitry Andric                  SubtargetFeature<"v8m.main", "HasV8MMainlineOps", "true",
636*0fca6ea1SDimitry Andric                                   "Support ARM v8M Mainline instructions",
637*0fca6ea1SDimitry Andric                                   [HasV7Ops]>;
638*0fca6ea1SDimitry Andric
639*0fca6ea1SDimitry Andricdef HasV8Ops    : SubtargetFeature<"v8", "HasV8Ops", "true",
640*0fca6ea1SDimitry Andric                                   "Support ARM v8 instructions",
641*0fca6ea1SDimitry Andric                                   [HasV7Ops, FeaturePerfMon, FeatureAcquireRelease]>;
642*0fca6ea1SDimitry Andric
643*0fca6ea1SDimitry Andricdef HasV8_1aOps : SubtargetFeature<"v8.1a", "HasV8_1aOps", "true",
644*0fca6ea1SDimitry Andric                                   "Support ARM v8.1a instructions",
645*0fca6ea1SDimitry Andric                                   [HasV8Ops]>;
646*0fca6ea1SDimitry Andric
647*0fca6ea1SDimitry Andricdef HasV8_2aOps : SubtargetFeature<"v8.2a", "HasV8_2aOps", "true",
648*0fca6ea1SDimitry Andric                                   "Support ARM v8.2a instructions",
649*0fca6ea1SDimitry Andric                                   [HasV8_1aOps]>;
650*0fca6ea1SDimitry Andric
651*0fca6ea1SDimitry Andricdef HasV8_3aOps   : SubtargetFeature<"v8.3a", "HasV8_3aOps", "true",
652*0fca6ea1SDimitry Andric                                   "Support ARM v8.3a instructions",
653*0fca6ea1SDimitry Andric                                   [HasV8_2aOps]>;
654*0fca6ea1SDimitry Andric
655*0fca6ea1SDimitry Andricdef HasV8_4aOps   : SubtargetFeature<"v8.4a", "HasV8_4aOps", "true",
656*0fca6ea1SDimitry Andric                                   "Support ARM v8.4a instructions",
657*0fca6ea1SDimitry Andric                                   [HasV8_3aOps, FeatureDotProd]>;
658*0fca6ea1SDimitry Andric
659*0fca6ea1SDimitry Andricdef HasV8_5aOps   : SubtargetFeature<"v8.5a", "HasV8_5aOps", "true",
660*0fca6ea1SDimitry Andric                                   "Support ARM v8.5a instructions",
661*0fca6ea1SDimitry Andric                                   [HasV8_4aOps, FeatureSB]>;
662*0fca6ea1SDimitry Andric
663*0fca6ea1SDimitry Andricdef HasV8_6aOps   : SubtargetFeature<"v8.6a", "HasV8_6aOps", "true",
664*0fca6ea1SDimitry Andric                                   "Support ARM v8.6a instructions",
665*0fca6ea1SDimitry Andric                                   [HasV8_5aOps, FeatureBF16,
666*0fca6ea1SDimitry Andric                                    FeatureMatMulInt8]>;
667*0fca6ea1SDimitry Andric
668*0fca6ea1SDimitry Andricdef HasV8_7aOps   : SubtargetFeature<"v8.7a", "HasV8_7aOps", "true",
669*0fca6ea1SDimitry Andric                                   "Support ARM v8.7a instructions",
670*0fca6ea1SDimitry Andric                                   [HasV8_6aOps]>;
671*0fca6ea1SDimitry Andric
672*0fca6ea1SDimitry Andricdef HasV8_8aOps   : SubtargetFeature<"v8.8a", "HasV8_8aOps", "true",
673*0fca6ea1SDimitry Andric                                   "Support ARM v8.8a instructions",
674*0fca6ea1SDimitry Andric                                   [HasV8_7aOps]>;
675*0fca6ea1SDimitry Andric
676*0fca6ea1SDimitry Andricdef HasV8_9aOps   : SubtargetFeature<"v8.9a", "HasV8_9aOps", "true",
677*0fca6ea1SDimitry Andric                                   "Support ARM v8.9a instructions",
678*0fca6ea1SDimitry Andric                                   [HasV8_8aOps, FeatureCLRBHB]>;
679*0fca6ea1SDimitry Andric
680*0fca6ea1SDimitry Andricdef HasV9_0aOps   : SubtargetFeature<"v9a", "HasV9_0aOps", "true",
681*0fca6ea1SDimitry Andric                                   "Support ARM v9a instructions",
682*0fca6ea1SDimitry Andric                                   [HasV8_5aOps]>;
683*0fca6ea1SDimitry Andric
684*0fca6ea1SDimitry Andricdef HasV9_1aOps   : SubtargetFeature<"v9.1a", "HasV9_1aOps", "true",
685*0fca6ea1SDimitry Andric                                   "Support ARM v9.1a instructions",
686*0fca6ea1SDimitry Andric                                   [HasV8_6aOps, HasV9_0aOps]>;
687*0fca6ea1SDimitry Andric
688*0fca6ea1SDimitry Andricdef HasV9_2aOps   : SubtargetFeature<"v9.2a", "HasV9_2aOps", "true",
689*0fca6ea1SDimitry Andric                                   "Support ARM v9.2a instructions",
690*0fca6ea1SDimitry Andric                                   [HasV8_7aOps, HasV9_1aOps]>;
691*0fca6ea1SDimitry Andric
692*0fca6ea1SDimitry Andricdef HasV9_3aOps   : SubtargetFeature<"v9.3a", "HasV9_3aOps", "true",
693*0fca6ea1SDimitry Andric                                   "Support ARM v9.3a instructions",
694*0fca6ea1SDimitry Andric                                   [HasV8_8aOps, HasV9_2aOps]>;
695*0fca6ea1SDimitry Andric
696*0fca6ea1SDimitry Andricdef HasV9_4aOps   : SubtargetFeature<"v9.4a", "HasV9_4aOps", "true",
697*0fca6ea1SDimitry Andric                                   "Support ARM v9.4a instructions",
698*0fca6ea1SDimitry Andric                                   [HasV8_9aOps, HasV9_3aOps]>;
699*0fca6ea1SDimitry Andric
700*0fca6ea1SDimitry Andric// Armv9.5-A is a v9-only architecture. From v9.5-A onwards there's no mapping
701*0fca6ea1SDimitry Andric// to an equivalent v8.x version.
702*0fca6ea1SDimitry Andricdef HasV9_5aOps   : SubtargetFeature<"v9.5a", "HasV9_5aOps", "true",
703*0fca6ea1SDimitry Andric                                   "Support ARM v9.5a instructions",
704*0fca6ea1SDimitry Andric                                   [HasV9_4aOps]>;
705*0fca6ea1SDimitry Andric
706*0fca6ea1SDimitry Andricdef HasV8_1MMainlineOps : SubtargetFeature<
707*0fca6ea1SDimitry Andric               "v8.1m.main", "HasV8_1MMainlineOps", "true",
708*0fca6ea1SDimitry Andric               "Support ARM v8-1M Mainline instructions",
709*0fca6ea1SDimitry Andric               [HasV8MMainlineOps]>;
710*0fca6ea1SDimitry Andricdef HasMVEIntegerOps : SubtargetFeature<
711*0fca6ea1SDimitry Andric               "mve", "HasMVEIntegerOps", "true",
712*0fca6ea1SDimitry Andric               "Support M-Class Vector Extension with integer ops",
713*0fca6ea1SDimitry Andric               [HasV8_1MMainlineOps, FeatureDSP, FeatureFPRegs16, FeatureFPRegs64]>;
714*0fca6ea1SDimitry Andricdef HasMVEFloatOps : SubtargetFeature<
715*0fca6ea1SDimitry Andric               "mve.fp", "HasMVEFloatOps", "true",
716*0fca6ea1SDimitry Andric               "Support M-Class Vector Extension with integer and floating ops",
717*0fca6ea1SDimitry Andric               [HasMVEIntegerOps, FeatureFPARMv8_D16_SP, FeatureFullFP16]>;
718*0fca6ea1SDimitry Andric
719*0fca6ea1SDimitry Andricdef HasCDEOps : SubtargetFeature<"cde", "HasCDEOps", "true",
720*0fca6ea1SDimitry Andric                                 "Support CDE instructions",
721*0fca6ea1SDimitry Andric                                 [HasV8MMainlineOps]>;
722*0fca6ea1SDimitry Andric
723*0fca6ea1SDimitry Andricforeach i = {0-7} in
724*0fca6ea1SDimitry Andric    def FeatureCoprocCDE#i : SubtargetFeature<"cdecp"#i,
725*0fca6ea1SDimitry Andric                                              "CoprocCDE["#i#"]", "true",
726*0fca6ea1SDimitry Andric                                              "Coprocessor "#i#" ISA is CDEv1",
727*0fca6ea1SDimitry Andric                                              [HasCDEOps]>;
728*0fca6ea1SDimitry Andric
729*0fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
730*0fca6ea1SDimitry Andric// Control codegen mitigation against Straight Line Speculation vulnerability.
731*0fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
732*0fca6ea1SDimitry Andric
733*0fca6ea1SDimitry Andric/// Harden against Straight Line Speculation for Returns and Indirect Branches.
734*0fca6ea1SDimitry Andricdef FeatureHardenSlsRetBr : SubtargetFeature<"harden-sls-retbr",
735*0fca6ea1SDimitry Andric  "HardenSlsRetBr", "true",
736*0fca6ea1SDimitry Andric  "Harden against straight line speculation across RETurn and BranchRegister "
737*0fca6ea1SDimitry Andric  "instructions">;
738*0fca6ea1SDimitry Andric/// Harden against Straight Line Speculation for indirect calls.
739*0fca6ea1SDimitry Andricdef FeatureHardenSlsBlr : SubtargetFeature<"harden-sls-blr",
740*0fca6ea1SDimitry Andric  "HardenSlsBlr", "true",
741*0fca6ea1SDimitry Andric  "Harden against straight line speculation across indirect calls">;
742*0fca6ea1SDimitry Andric/// Generate thunk code for SLS mitigation in the normal text section.
743*0fca6ea1SDimitry Andricdef FeatureHardenSlsNoComdat : SubtargetFeature<"harden-sls-nocomdat",
744*0fca6ea1SDimitry Andric  "HardenSlsNoComdat", "true",
745*0fca6ea1SDimitry Andric  "Generate thunk code for SLS mitigation in the normal text section">;
746*0fca6ea1SDimitry Andric
747*0fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
748*0fca6ea1SDimitry Andric// Endianness of instruction encodings in memory.
749*0fca6ea1SDimitry Andric//
750*0fca6ea1SDimitry Andric// In the current Arm architecture, this is usually little-endian regardless of
751*0fca6ea1SDimitry Andric// data endianness. But before Armv7 it was typical for instruction endianness
752*0fca6ea1SDimitry Andric// to match data endianness, so that a big-endian system was consistently big-
753*0fca6ea1SDimitry Andric// endian. And Armv7-R can be configured to use big-endian instructions.
754*0fca6ea1SDimitry Andric//
755*0fca6ea1SDimitry Andric// Additionally, even when targeting Armv7-A, big-endian instructions can be
756*0fca6ea1SDimitry Andric// found in relocatable object files, because the Arm ABI specifies that the
757*0fca6ea1SDimitry Andric// linker byte-reverses them depending on the target architecture.
758*0fca6ea1SDimitry Andric//
759*0fca6ea1SDimitry Andric// So we have a feature here to indicate that instructions are stored big-
760*0fca6ea1SDimitry Andric// endian, which you can set when instantiating an MCDisassembler.
761*0fca6ea1SDimitry Andricdef ModeBigEndianInstructions : SubtargetFeature<"big-endian-instructions",
762*0fca6ea1SDimitry Andric    "BigEndianInstructions", "true",
763*0fca6ea1SDimitry Andric     "Expect instructions to be stored big-endian.">;
764*0fca6ea1SDimitry Andric
765