1//===-- ARM.td - Describe the ARM Target Machine -----------*- tablegen -*-===// 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// 10//===----------------------------------------------------------------------===// 11 12//===----------------------------------------------------------------------===// 13// Target-independent interfaces which we are implementing 14//===----------------------------------------------------------------------===// 15 16include "llvm/Target/Target.td" 17 18//===----------------------------------------------------------------------===// 19// ARM Subtarget state. 20// 21 22// True if compiling for Thumb, false for ARM. 23def ModeThumb : SubtargetFeature<"thumb-mode", "IsThumb", 24 "true", "Thumb mode">; 25 26// True if we're using software floating point features. 27def ModeSoftFloat : SubtargetFeature<"soft-float","UseSoftFloat", 28 "true", "Use software floating " 29 "point features.">; 30 31 32//===----------------------------------------------------------------------===// 33// ARM Subtarget features. 34// 35 36// Floating Point, HW Division and Neon Support 37 38// FP loads/stores/moves, shared between VFP and MVE (even in the integer-only 39// version). 40def FeatureFPRegs : SubtargetFeature<"fpregs", "HasFPRegs", "true", 41 "Enable FP registers">; 42 43// 16-bit FP loads/stores/moves, shared between VFP (with the v8.2A FP16 44// extension) and MVE (even in the integer-only version). 45def FeatureFPRegs16 : SubtargetFeature<"fpregs16", "HasFPRegs16", "true", 46 "Enable 16-bit FP registers", 47 [FeatureFPRegs]>; 48 49def FeatureFPRegs64 : SubtargetFeature<"fpregs64", "HasFPRegs64", "true", 50 "Enable 64-bit FP registers", 51 [FeatureFPRegs]>; 52 53// True if the floating point unit supports double precision. 54def FeatureFP64 : SubtargetFeature<"fp64", "HasFP64", "true", 55 "Floating point unit supports " 56 "double precision", 57 [FeatureFPRegs64]>; 58 59// True if subtarget has the full 32 double precision FP registers for VFPv3. 60def FeatureD32 : SubtargetFeature<"d32", "HasD32", "true", 61 "Extend FP to 32 double registers">; 62 63/// Versions of the VFP flags restricted to single precision, or to 64/// 16 d-registers, or both. 65multiclass VFPver<string name, string query, string description, 66 list<SubtargetFeature> prev, 67 list<SubtargetFeature> otherimplies, 68 list<SubtargetFeature> vfp2prev = []> { 69 def _D16_SP: SubtargetFeature< 70 name#"d16sp", query#"D16SP", "true", 71 description#" with only 16 d-registers and no double precision", 72 !foreach(v, prev, !cast<SubtargetFeature>(v # "_D16_SP")) # 73 !foreach(v, vfp2prev, !cast<SubtargetFeature>(v # "_SP")) # 74 otherimplies>; 75 def _SP: SubtargetFeature< 76 name#"sp", query#"SP", "true", 77 description#" with no double precision", 78 !foreach(v, prev, !cast<SubtargetFeature>(v # "_SP")) # 79 otherimplies # [FeatureD32, !cast<SubtargetFeature>(NAME # "_D16_SP")]>; 80 def _D16: SubtargetFeature< 81 name#"d16", query#"D16", "true", 82 description#" with only 16 d-registers", 83 !foreach(v, prev, !cast<SubtargetFeature>(v # "_D16")) # 84 vfp2prev # 85 otherimplies # [FeatureFP64, !cast<SubtargetFeature>(NAME # "_D16_SP")]>; 86 def "": SubtargetFeature< 87 name, query, "true", description, 88 prev # otherimplies # [ 89 !cast<SubtargetFeature>(NAME # "_D16"), 90 !cast<SubtargetFeature>(NAME # "_SP")]>; 91} 92 93def FeatureVFP2_SP : SubtargetFeature<"vfp2sp", "HasVFPv2SP", "true", 94 "Enable VFP2 instructions with " 95 "no double precision", 96 [FeatureFPRegs]>; 97 98def FeatureVFP2 : SubtargetFeature<"vfp2", "HasVFPv2", "true", 99 "Enable VFP2 instructions", 100 [FeatureFP64, FeatureVFP2_SP]>; 101 102defm FeatureVFP3: VFPver<"vfp3", "HasVFPv3", "Enable VFP3 instructions", 103 [], [], [FeatureVFP2]>; 104 105def FeatureNEON : SubtargetFeature<"neon", "HasNEON", "true", 106 "Enable NEON instructions", 107 [FeatureVFP3]>; 108 109// True if subtarget supports half-precision FP conversions. 110def FeatureFP16 : SubtargetFeature<"fp16", "HasFP16", "true", 111 "Enable half-precision " 112 "floating point">; 113 114defm FeatureVFP4: VFPver<"vfp4", "HasVFPv4", "Enable VFP4 instructions", 115 [FeatureVFP3], [FeatureFP16]>; 116 117defm FeatureFPARMv8: VFPver<"fp-armv8", "HasFPARMv8", "Enable ARMv8 FP", 118 [FeatureVFP4], []>; 119 120// True if subtarget supports half-precision FP operations. 121def FeatureFullFP16 : SubtargetFeature<"fullfp16", "HasFullFP16", "true", 122 "Enable full half-precision " 123 "floating point", 124 [FeatureFPARMv8_D16_SP, FeatureFPRegs16]>; 125 126// True if subtarget supports half-precision FP fml operations. 127def FeatureFP16FML : SubtargetFeature<"fp16fml", "HasFP16FML", "true", 128 "Enable full half-precision " 129 "floating point fml instructions", 130 [FeatureFullFP16]>; 131 132// True if subtarget supports [su]div in Thumb mode. 133def FeatureHWDivThumb : SubtargetFeature<"hwdiv", 134 "HasDivideInThumbMode", "true", 135 "Enable divide instructions in Thumb">; 136 137// True if subtarget supports [su]div in ARM mode. 138def FeatureHWDivARM : SubtargetFeature<"hwdiv-arm", 139 "HasDivideInARMMode", "true", 140 "Enable divide instructions in ARM mode">; 141 142// Atomic Support 143 144// True if the subtarget supports DMB / DSB data barrier instructions. 145def FeatureDB : SubtargetFeature<"db", "HasDataBarrier", "true", 146 "Has data barrier (dmb/dsb) instructions">; 147 148// True if the subtarget supports CLREX instructions. 149def FeatureV7Clrex : SubtargetFeature<"v7clrex", "HasV7Clrex", "true", 150 "Has v7 clrex instruction">; 151 152// True if the subtarget supports DFB data barrier instruction. 153def FeatureDFB : SubtargetFeature<"dfb", "HasFullDataBarrier", "true", 154 "Has full data barrier (dfb) instruction">; 155 156// True if the subtarget supports v8 atomics (LDA/LDAEX etc) instructions. 157def FeatureAcquireRelease : SubtargetFeature<"acquire-release", 158 "HasAcquireRelease", "true", 159 "Has v8 acquire/release (lda/ldaex " 160 " etc) instructions">; 161 162 163// True if floating point compare + branch is slow. 164def FeatureSlowFPBrcc : SubtargetFeature<"slow-fp-brcc", "IsFPBrccSlow", "true", 165 "FP compare + branch is slow">; 166 167// True if the processor supports the Performance Monitor Extensions. These 168// include a generic cycle-counter as well as more fine-grained (often 169// implementation-specific) events. 170def FeaturePerfMon : SubtargetFeature<"perfmon", "HasPerfMon", "true", 171 "Enable support for Performance " 172 "Monitor extensions">; 173 174 175// TrustZone Security Extensions 176 177// True if processor supports TrustZone security extensions. 178def FeatureTrustZone : SubtargetFeature<"trustzone", "HasTrustZone", "true", 179 "Enable support for TrustZone " 180 "security extensions">; 181 182// True if processor supports ARMv8-M Security Extensions. 183def Feature8MSecExt : SubtargetFeature<"8msecext", "Has8MSecExt", "true", 184 "Enable support for ARMv8-M " 185 "Security Extensions">; 186 187// True if processor supports SHA1 and SHA256. 188def FeatureSHA2 : SubtargetFeature<"sha2", "HasSHA2", "true", 189 "Enable SHA1 and SHA256 support", [FeatureNEON]>; 190 191def FeatureAES : SubtargetFeature<"aes", "HasAES", "true", 192 "Enable AES support", [FeatureNEON]>; 193 194// True if processor supports Cryptography extensions. 195def FeatureCrypto : SubtargetFeature<"crypto", "HasCrypto", "true", 196 "Enable support for " 197 "Cryptography extensions", 198 [FeatureNEON, FeatureSHA2, FeatureAES]>; 199 200// True if processor supports CRC instructions. 201def FeatureCRC : SubtargetFeature<"crc", "HasCRC", "true", 202 "Enable support for CRC instructions">; 203 204// True if the ARMv8.2A dot product instructions are supported. 205def FeatureDotProd : SubtargetFeature<"dotprod", "HasDotProd", "true", 206 "Enable support for dot product instructions", 207 [FeatureNEON]>; 208 209// True if the processor supports RAS extensions. 210// Not to be confused with FeatureHasRetAddrStack (return address stack). 211def FeatureRAS : SubtargetFeature<"ras", "HasRAS", "true", 212 "Enable Reliability, Availability " 213 "and Serviceability extensions">; 214 215// Fast computation of non-negative address offsets. 216// True if processor does positive address offset computation faster. 217def FeatureFPAO : SubtargetFeature<"fpao", "HasFPAO", "true", 218 "Enable fast computation of " 219 "positive address offsets">; 220 221// Fast execution of AES crypto operations. 222// True if processor executes back to back AES instruction pairs faster. 223def FeatureFuseAES : SubtargetFeature<"fuse-aes", "HasFuseAES", "true", 224 "CPU fuses AES crypto operations">; 225 226// Fast execution of bottom and top halves of literal generation. 227// True if processor executes back to back bottom and top halves of literal generation faster. 228def FeatureFuseLiterals : SubtargetFeature<"fuse-literals", "HasFuseLiterals", "true", 229 "CPU fuses literal generation operations">; 230 231// The way of reading thread pointer. 232// True if read thread pointer from coprocessor register. 233def FeatureReadTp : SubtargetFeature<"read-tp-hard", "IsReadTPHard", "true", 234 "Reading thread pointer from register">; 235 236// Cyclone can zero VFP registers in 0 cycles. 237// True if the instructions "vmov.i32 d0, #0" and "vmov.i32 q0, #0" are 238// particularly effective at zeroing a VFP register. 239def FeatureZCZeroing : SubtargetFeature<"zcz", "HasZeroCycleZeroing", "true", 240 "Has zero-cycle zeroing instructions">; 241 242// Whether it is profitable to unpredicate certain instructions during if-conversion. 243// True if if conversion may decide to leave some instructions unpredicated. 244def FeatureProfUnpredicate : SubtargetFeature<"prof-unpr", 245 "IsProfitableToUnpredicate", "true", 246 "Is profitable to unpredicate">; 247 248// Some targets (e.g. Swift) have microcoded VGETLNi32. 249// True if VMOV will be favored over VGETLNi32. 250def FeatureSlowVGETLNi32 : SubtargetFeature<"slow-vgetlni32", 251 "HasSlowVGETLNi32", "true", 252 "Has slow VGETLNi32 - prefer VMOV">; 253 254// Some targets (e.g. Swift) have microcoded VDUP32. 255// True if VMOV will be favored over VDUP. 256def FeatureSlowVDUP32 : SubtargetFeature<"slow-vdup32", "HasSlowVDUP32", 257 "true", 258 "Has slow VDUP32 - prefer VMOV">; 259 260// Some targets (e.g. Cortex-A9) prefer VMOVSR to VMOVDRR even when using NEON 261// for scalar FP, as this allows more effective execution domain optimization. 262// True if VMOVSR will be favored over VMOVDRR. 263def FeaturePreferVMOVSR : SubtargetFeature<"prefer-vmovsr", "PreferVMOVSR", 264 "true", "Prefer VMOVSR">; 265 266// Swift has ISHST barriers compatible with Atomic Release semantics but weaker 267// than ISH. 268// True if ISHST barriers will be used for Release semantics. 269def FeaturePrefISHSTBarrier : SubtargetFeature<"prefer-ishst", "PreferISHSTBarriers", 270 "true", "Prefer ISHST barriers">; 271 272// Some targets (e.g. Cortex-A9) have muxed AGU and NEON/FPU. 273// True if the AGU and NEON/FPU units are multiplexed. 274def FeatureMuxedUnits : SubtargetFeature<"muxed-units", "HasMuxedUnits", 275 "true", 276 "Has muxed AGU and NEON/FPU">; 277 278// Whether VLDM/VSTM starting with odd register number need more microops 279// than single VLDRS. 280// True if a VLDM/VSTM starting with an odd register number is considered to 281// take more microops than single VLDRS/VSTRS. 282def FeatureSlowOddRegister : SubtargetFeature<"slow-odd-reg", "HasSlowOddRegister", 283 "true", "VLDM/VSTM starting " 284 "with an odd register is slow">; 285 286// Some targets have a renaming dependency when loading into D subregisters. 287// True if loading into a D subregister will be penalized. 288def FeatureSlowLoadDSubreg : SubtargetFeature<"slow-load-D-subreg", 289 "HasSlowLoadDSubregister", "true", 290 "Loading into D subregs is slow">; 291 292// True if use a wider stride when allocating VFP registers. 293def FeatureUseWideStrideVFP : SubtargetFeature<"wide-stride-vfp", 294 "UseWideStrideVFP", "true", 295 "Use a wide stride when allocating VFP registers">; 296 297// Some targets (e.g. Cortex-A15) never want VMOVS to be widened to VMOVD. 298// True if VMOVS will never be widened to VMOVD. 299def FeatureDontWidenVMOVS : SubtargetFeature<"dont-widen-vmovs", 300 "DontWidenVMOVS", "true", 301 "Don't widen VMOVS to VMOVD">; 302 303// Some targets (e.g. Cortex-A15) prefer to avoid mixing operations on different 304// VFP register widths. 305// True if splat a register between VFP and NEON instructions. 306def FeatureSplatVFPToNeon : SubtargetFeature<"splat-vfp-neon", 307 "UseSplatVFPToNeon", "true", 308 "Splat register from VFP to NEON", 309 [FeatureDontWidenVMOVS]>; 310 311// Whether or not it is profitable to expand VFP/NEON MLA/MLS instructions. 312// True if run the MLx expansion pass. 313def FeatureExpandMLx : SubtargetFeature<"expand-fp-mlx", 314 "ExpandMLx", "true", 315 "Expand VFP/NEON MLA/MLS instructions">; 316 317// Some targets have special RAW hazards for VFP/NEON VMLA/VMLS. 318// True if VFP/NEON VMLA/VMLS have special RAW hazards. 319def FeatureHasVMLxHazards : SubtargetFeature<"vmlx-hazards", "HasVMLxHazards", 320 "true", "Has VMLx hazards">; 321 322// Some targets (e.g. Cortex-A9) want to convert VMOVRS, VMOVSR and VMOVS from 323// VFP to NEON, as an execution domain optimization. 324// True if VMOVRS, VMOVSR and VMOVS will be converted from VFP to NEON. 325def FeatureNEONForFPMovs : SubtargetFeature<"neon-fpmovs", 326 "UseNEONForFPMovs", "true", 327 "Convert VMOVSR, VMOVRS, " 328 "VMOVS to NEON">; 329 330// Some processors benefit from using NEON instructions for scalar 331// single-precision FP operations. This affects instruction selection and should 332// only be enabled if the handling of denormals is not important. 333// Use the method useNEONForSinglePrecisionFP() to determine if NEON should actually be used. 334def FeatureNEONForFP : SubtargetFeature<"neonfp", 335 "HasNEONForFP", 336 "true", 337 "Use NEON for single precision FP">; 338 339// On some processors, VLDn instructions that access unaligned data take one 340// extra cycle. Take that into account when computing operand latencies. 341// True if VLDn instructions take an extra cycle for unaligned accesses. 342def FeatureCheckVLDnAlign : SubtargetFeature<"vldn-align", "CheckVLDnAccessAlignment", 343 "true", 344 "Check for VLDn unaligned access">; 345 346// Some processors have a nonpipelined VFP coprocessor. 347// True if VFP instructions are not pipelined. 348def FeatureNonpipelinedVFP : SubtargetFeature<"nonpipelined-vfp", 349 "NonpipelinedVFP", "true", 350 "VFP instructions are not pipelined">; 351 352// Some processors have FP multiply-accumulate instructions that don't 353// play nicely with other VFP / NEON instructions, and it's generally better 354// to just not use them. 355// If the VFP2 / NEON instructions are available, indicates 356// whether the FP VML[AS] instructions are slow (if so, don't use them). 357def FeatureHasSlowFPVMLx : SubtargetFeature<"slowfpvmlx", "SlowFPVMLx", "true", 358 "Disable VFP / NEON MAC instructions">; 359 360// VFPv4 added VFMA instructions that can similarly be fast or slow. 361// If the VFP4 / NEON instructions are available, indicates 362// whether the FP VFM[AS] instructions are slow (if so, don't use them). 363def FeatureHasSlowFPVFMx : SubtargetFeature<"slowfpvfmx", "SlowFPVFMx", "true", 364 "Disable VFP / NEON FMA instructions">; 365 366// Cortex-A8 / A9 Advanced SIMD has multiplier accumulator forwarding. 367/// True if NEON has special multiplier accumulator 368/// forwarding to allow mul + mla being issued back to back. 369def FeatureVMLxForwarding : SubtargetFeature<"vmlx-forwarding", 370 "HasVMLxForwarding", "true", 371 "Has multiplier accumulator forwarding">; 372 373// Disable 32-bit to 16-bit narrowing for experimentation. 374// True if codegen would prefer 32-bit Thumb instructions over 16-bit ones. 375def FeaturePref32BitThumb : SubtargetFeature<"32bit", "Prefers32BitThumb", "true", 376 "Prefer 32-bit Thumb instrs">; 377 378def FeaturePrefLoopAlign32 : SubtargetFeature<"loop-align", "PrefLoopLogAlignment","2", 379 "Prefer 32-bit alignment for loops">; 380 381def FeatureMVEVectorCostFactor1 : SubtargetFeature<"mve1beat", "MVEVectorCostFactor", "1", 382 "Model MVE instructions as a 1 beat per tick architecture">; 383 384def FeatureMVEVectorCostFactor2 : SubtargetFeature<"mve2beat", "MVEVectorCostFactor", "2", 385 "Model MVE instructions as a 2 beats per tick architecture">; 386 387def FeatureMVEVectorCostFactor4 : SubtargetFeature<"mve4beat", "MVEVectorCostFactor", "4", 388 "Model MVE instructions as a 4 beats per tick architecture">; 389 390/// Some instructions update CPSR partially, which can add false dependency for 391/// out-of-order implementation, e.g. Cortex-A9, unless each individual bit is 392/// mapped to a separate physical register. Avoid partial CPSR update for these 393/// processors. 394/// True if codegen would avoid using instructions 395/// that partially update CPSR and add false dependency on the previous 396/// CPSR setting instruction. 397def FeatureAvoidPartialCPSR : SubtargetFeature<"avoid-partial-cpsr", 398 "AvoidCPSRPartialUpdate", "true", 399 "Avoid CPSR partial update for OOO execution">; 400 401/// Disable +1 predication cost for instructions updating CPSR. 402/// Enabled for Cortex-A57. 403/// True if disable +1 predication cost for instructions updating CPSR. Enabled for Cortex-A57. 404def FeatureCheapPredicableCPSR : SubtargetFeature<"cheap-predicable-cpsr", 405 "CheapPredicableCPSRDef", 406 "true", 407 "Disable +1 predication cost for instructions updating CPSR">; 408 409// True if codegen should avoid using flag setting movs with shifter operand (i.e. asr, lsl, lsr). 410def FeatureAvoidMOVsShOp : SubtargetFeature<"avoid-movs-shop", 411 "AvoidMOVsShifterOperand", "true", 412 "Avoid movs instructions with " 413 "shifter operand">; 414 415// Some processors perform return stack prediction. CodeGen should avoid issue 416// "normal" call instructions to callees which do not return. 417def FeatureHasRetAddrStack : SubtargetFeature<"ret-addr-stack", 418 "HasRetAddrStack", "true", 419 "Has return address stack">; 420 421// Some processors have no branch predictor, which changes the expected cost of 422// taking a branch which affects the choice of whether to use predicated 423// instructions. 424// True if the subtarget has a branch predictor. Having 425// a branch predictor or not changes the expected cost of taking a branch 426// which affects the choice of whether to use predicated instructions. 427def FeatureHasNoBranchPredictor : SubtargetFeature<"no-branch-predictor", 428 "HasBranchPredictor", "false", 429 "Has no branch predictor">; 430 431/// DSP extension. 432/// True if the subtarget supports the DSP (saturating arith and such) instructions. 433def FeatureDSP : SubtargetFeature<"dsp", "HasDSP", "true", 434 "Supports DSP instructions in " 435 "ARM and/or Thumb2">; 436 437// True if the subtarget supports Multiprocessing extension (ARMv7 only). 438def FeatureMP : SubtargetFeature<"mp", "HasMPExtension", "true", 439 "Supports Multiprocessing extension">; 440 441// Virtualization extension - requires HW divide (ARMv7-AR ARMARM - 4.4.8). 442def FeatureVirtualization : SubtargetFeature<"virtualization", 443 "HasVirtualization", "true", 444 "Supports Virtualization extension", 445 [FeatureHWDivThumb, FeatureHWDivARM]>; 446 447// Special TRAP encoding for NaCl, which looks like a TRAP in Thumb too. 448// See ARMInstrInfo.td for details. 449// True if NaCl TRAP instruction is generated instead of the regular TRAP. 450def FeatureNaClTrap : SubtargetFeature<"nacl-trap", "UseNaClTrap", "true", 451 "NaCl trap">; 452 453// True if the subtarget disallows unaligned memory 454// accesses for some types. For details, see 455// ARMTargetLowering::allowsMisalignedMemoryAccesses(). 456def FeatureStrictAlign : SubtargetFeature<"strict-align", 457 "StrictAlign", "true", 458 "Disallow all unaligned memory " 459 "access">; 460 461// Generate calls via indirect call instructions. 462def FeatureLongCalls : SubtargetFeature<"long-calls", "GenLongCalls", "true", 463 "Generate calls via indirect call " 464 "instructions">; 465 466// Generate code that does not contain data access to code sections. 467def FeatureExecuteOnly : SubtargetFeature<"execute-only", 468 "GenExecuteOnly", "true", 469 "Enable the generation of " 470 "execute only code.">; 471 472// True if R9 is not available as a general purpose register. 473def FeatureReserveR9 : SubtargetFeature<"reserve-r9", "ReserveR9", "true", 474 "Reserve R9, making it unavailable" 475 " as GPR">; 476 477// True if MOVT / MOVW pairs are not used for materialization of 478// 32-bit imms (including global addresses). 479def FeatureNoMovt : SubtargetFeature<"no-movt", "NoMovt", "true", 480 "Don't use movt/movw pairs for " 481 "32-bit imms">; 482 483/// Implicitly convert an instruction to a different one if its immediates 484/// cannot be encoded. For example, ADD r0, r1, #FFFFFFFF -> SUB r0, r1, #1. 485def FeatureNoNegativeImmediates 486 : SubtargetFeature<"no-neg-immediates", 487 "NegativeImmediates", "false", 488 "Convert immediates and instructions " 489 "to their negated or complemented " 490 "equivalent when the immediate does " 491 "not fit in the encoding.">; 492 493// Use the MachineScheduler for instruction scheduling for the subtarget. 494def FeatureUseMISched: SubtargetFeature<"use-misched", "UseMISched", "true", 495 "Use the MachineScheduler">; 496 497// Use the MachinePipeliner for instruction scheduling for the subtarget. 498def FeatureUseMIPipeliner: SubtargetFeature<"use-mipipeliner", "UseMIPipeliner", "true", 499 "Use the MachinePipeliner">; 500 501// False if scheduling should happen again after register allocation. 502def FeatureNoPostRASched : SubtargetFeature<"disable-postra-scheduler", 503 "DisablePostRAScheduler", "true", 504 "Don't schedule again after register allocation">; 505 506// Armv8.5-A extensions 507 508// Has speculation barrier. 509def FeatureSB : SubtargetFeature<"sb", "HasSB", "true", 510 "Enable v8.5a Speculation Barrier" >; 511 512// Armv8.6-A extensions 513 514// True if subtarget supports BFloat16 floating point operations. 515def FeatureBF16 : SubtargetFeature<"bf16", "HasBF16", "true", 516 "Enable support for BFloat16 instructions", [FeatureNEON]>; 517 518// True if subtarget supports 8-bit integer matrix multiply. 519def FeatureMatMulInt8 : SubtargetFeature<"i8mm", "HasMatMulInt8", 520 "true", "Enable Matrix Multiply Int8 Extension", [FeatureNEON]>; 521 522// Armv8.1-M extensions 523 524// True if the processor supports the Low Overhead Branch extension. 525def FeatureLOB : SubtargetFeature<"lob", "HasLOB", "true", 526 "Enable Low Overhead Branch " 527 "extensions">; 528 529// Mitigate against the cve-2021-35465 security vulnurability. 530def FeatureFixCMSE_CVE_2021_35465 : SubtargetFeature<"fix-cmse-cve-2021-35465", 531 "FixCMSE_CVE_2021_35465", "true", 532 "Mitigate against the cve-2021-35465 " 533 "security vulnurability">; 534 535def FeaturePACBTI : SubtargetFeature<"pacbti", "HasPACBTI", "true", 536 "Enable Pointer Authentication and Branch " 537 "Target Identification">; 538 539/// Don't place a BTI instruction after return-twice constructs (setjmp). 540def FeatureNoBTIAtReturnTwice : SubtargetFeature<"no-bti-at-return-twice", 541 "NoBTIAtReturnTwice", "true", 542 "Don't place a BTI instruction " 543 "after a return-twice">; 544 545//===----------------------------------------------------------------------===// 546// ARM architecture class 547// 548 549// A-series ISA 550def FeatureAClass : SubtargetFeature<"aclass", "ARMProcClass", "AClass", 551 "Is application profile ('A' series)">; 552 553// R-series ISA 554def FeatureRClass : SubtargetFeature<"rclass", "ARMProcClass", "RClass", 555 "Is realtime profile ('R' series)">; 556 557// M-series ISA 558def FeatureMClass : SubtargetFeature<"mclass", "ARMProcClass", "MClass", 559 "Is microcontroller profile ('M' series)">; 560 561// True if Thumb2 instructions are supported. 562def FeatureThumb2 : SubtargetFeature<"thumb2", "HasThumb2", "true", 563 "Enable Thumb2 instructions">; 564 565// True if subtarget does not support ARM mode execution. 566def FeatureNoARM : SubtargetFeature<"noarm", "NoARM", "true", 567 "Does not support ARM mode execution">; 568 569//===----------------------------------------------------------------------===// 570// ARM ISAa. 571// 572// Specify whether target support specific ARM ISA variants. 573 574def HasV4TOps : SubtargetFeature<"v4t", "HasV4TOps", "true", 575 "Support ARM v4T instructions">; 576 577def HasV5TOps : SubtargetFeature<"v5t", "HasV5TOps", "true", 578 "Support ARM v5T instructions", 579 [HasV4TOps]>; 580 581def HasV5TEOps : SubtargetFeature<"v5te", "HasV5TEOps", "true", 582 "Support ARM v5TE, v5TEj, and " 583 "v5TExp instructions", 584 [HasV5TOps]>; 585 586def HasV6Ops : SubtargetFeature<"v6", "HasV6Ops", "true", 587 "Support ARM v6 instructions", 588 [HasV5TEOps]>; 589 590def HasV6MOps : SubtargetFeature<"v6m", "HasV6MOps", "true", 591 "Support ARM v6M instructions", 592 [HasV6Ops]>; 593 594def HasV8MBaselineOps : SubtargetFeature<"v8m", "HasV8MBaselineOps", "true", 595 "Support ARM v8M Baseline instructions", 596 [HasV6MOps]>; 597 598def HasV6KOps : SubtargetFeature<"v6k", "HasV6KOps", "true", 599 "Support ARM v6k instructions", 600 [HasV6Ops]>; 601 602def HasV6T2Ops : SubtargetFeature<"v6t2", "HasV6T2Ops", "true", 603 "Support ARM v6t2 instructions", 604 [HasV8MBaselineOps, HasV6KOps, FeatureThumb2]>; 605 606def HasV7Ops : SubtargetFeature<"v7", "HasV7Ops", "true", 607 "Support ARM v7 instructions", 608 [HasV6T2Ops, FeatureV7Clrex]>; 609 610def HasV8MMainlineOps : 611 SubtargetFeature<"v8m.main", "HasV8MMainlineOps", "true", 612 "Support ARM v8M Mainline instructions", 613 [HasV7Ops]>; 614 615def HasV8Ops : SubtargetFeature<"v8", "HasV8Ops", "true", 616 "Support ARM v8 instructions", 617 [HasV7Ops, FeaturePerfMon, FeatureAcquireRelease]>; 618 619def HasV8_1aOps : SubtargetFeature<"v8.1a", "HasV8_1aOps", "true", 620 "Support ARM v8.1a instructions", 621 [HasV8Ops]>; 622 623def HasV8_2aOps : SubtargetFeature<"v8.2a", "HasV8_2aOps", "true", 624 "Support ARM v8.2a instructions", 625 [HasV8_1aOps]>; 626 627def HasV8_3aOps : SubtargetFeature<"v8.3a", "HasV8_3aOps", "true", 628 "Support ARM v8.3a instructions", 629 [HasV8_2aOps]>; 630 631def HasV8_4aOps : SubtargetFeature<"v8.4a", "HasV8_4aOps", "true", 632 "Support ARM v8.4a instructions", 633 [HasV8_3aOps, FeatureDotProd]>; 634 635def HasV8_5aOps : SubtargetFeature<"v8.5a", "HasV8_5aOps", "true", 636 "Support ARM v8.5a instructions", 637 [HasV8_4aOps, FeatureSB]>; 638 639def HasV8_6aOps : SubtargetFeature<"v8.6a", "HasV8_6aOps", "true", 640 "Support ARM v8.6a instructions", 641 [HasV8_5aOps, FeatureBF16, 642 FeatureMatMulInt8]>; 643 644def HasV8_7aOps : SubtargetFeature<"v8.7a", "HasV8_7aOps", "true", 645 "Support ARM v8.7a instructions", 646 [HasV8_6aOps]>; 647 648def HasV8_8aOps : SubtargetFeature<"v8.8a", "HasV8_8aOps", "true", 649 "Support ARM v8.8a instructions", 650 [HasV8_7aOps]>; 651 652def HasV9_0aOps : SubtargetFeature<"v9a", "HasV9_0aOps", "true", 653 "Support ARM v9a instructions", 654 [HasV8_5aOps]>; 655 656def HasV9_1aOps : SubtargetFeature<"v9.1a", "HasV9_1aOps", "true", 657 "Support ARM v9.1a instructions", 658 [HasV8_6aOps, HasV9_0aOps]>; 659 660def HasV9_2aOps : SubtargetFeature<"v9.2a", "HasV9_2aOps", "true", 661 "Support ARM v9.2a instructions", 662 [HasV8_7aOps, HasV9_1aOps]>; 663 664def HasV9_3aOps : SubtargetFeature<"v9.3a", "HasV9_3aOps", "true", 665 "Support ARM v9.3a instructions", 666 [HasV8_8aOps, HasV9_2aOps]>; 667 668def HasV8_1MMainlineOps : SubtargetFeature< 669 "v8.1m.main", "HasV8_1MMainlineOps", "true", 670 "Support ARM v8-1M Mainline instructions", 671 [HasV8MMainlineOps]>; 672def HasMVEIntegerOps : SubtargetFeature< 673 "mve", "HasMVEIntegerOps", "true", 674 "Support M-Class Vector Extension with integer ops", 675 [HasV8_1MMainlineOps, FeatureDSP, FeatureFPRegs16, FeatureFPRegs64]>; 676def HasMVEFloatOps : SubtargetFeature< 677 "mve.fp", "HasMVEFloatOps", "true", 678 "Support M-Class Vector Extension with integer and floating ops", 679 [HasMVEIntegerOps, FeatureFPARMv8_D16_SP, FeatureFullFP16]>; 680 681def HasCDEOps : SubtargetFeature<"cde", "HasCDEOps", "true", 682 "Support CDE instructions", 683 [HasV8MMainlineOps]>; 684 685foreach i = {0-7} in 686 def FeatureCoprocCDE#i : SubtargetFeature<"cdecp"#i, 687 "CoprocCDE["#i#"]", "true", 688 "Coprocessor "#i#" ISA is CDEv1", 689 [HasCDEOps]>; 690 691//===----------------------------------------------------------------------===// 692// Control codegen mitigation against Straight Line Speculation vulnerability. 693//===----------------------------------------------------------------------===// 694 695/// Harden against Straight Line Speculation for Returns and Indirect Branches. 696def FeatureHardenSlsRetBr : SubtargetFeature<"harden-sls-retbr", 697 "HardenSlsRetBr", "true", 698 "Harden against straight line speculation across RETurn and BranchRegister " 699 "instructions">; 700/// Harden against Straight Line Speculation for indirect calls. 701def FeatureHardenSlsBlr : SubtargetFeature<"harden-sls-blr", 702 "HardenSlsBlr", "true", 703 "Harden against straight line speculation across indirect calls">; 704/// Generate thunk code for SLS mitigation in the normal text section. 705def FeatureHardenSlsNoComdat : SubtargetFeature<"harden-sls-nocomdat", 706 "HardenSlsNoComdat", "true", 707 "Generate thunk code for SLS mitigation in the normal text section">; 708 709//===----------------------------------------------------------------------===// 710// ARM Processor subtarget features. 711// 712 713def ProcA5 : SubtargetFeature<"a5", "ARMProcFamily", "CortexA5", 714 "Cortex-A5 ARM processors", []>; 715def ProcA7 : SubtargetFeature<"a7", "ARMProcFamily", "CortexA7", 716 "Cortex-A7 ARM processors", []>; 717def ProcA8 : SubtargetFeature<"a8", "ARMProcFamily", "CortexA8", 718 "Cortex-A8 ARM processors", []>; 719def ProcA9 : SubtargetFeature<"a9", "ARMProcFamily", "CortexA9", 720 "Cortex-A9 ARM processors", []>; 721def ProcA12 : SubtargetFeature<"a12", "ARMProcFamily", "CortexA12", 722 "Cortex-A12 ARM processors", []>; 723def ProcA15 : SubtargetFeature<"a15", "ARMProcFamily", "CortexA15", 724 "Cortex-A15 ARM processors", []>; 725def ProcA17 : SubtargetFeature<"a17", "ARMProcFamily", "CortexA17", 726 "Cortex-A17 ARM processors", []>; 727def ProcA32 : SubtargetFeature<"a32", "ARMProcFamily", "CortexA32", 728 "Cortex-A32 ARM processors", []>; 729def ProcA35 : SubtargetFeature<"a35", "ARMProcFamily", "CortexA35", 730 "Cortex-A35 ARM processors", []>; 731def ProcA53 : SubtargetFeature<"a53", "ARMProcFamily", "CortexA53", 732 "Cortex-A53 ARM processors", []>; 733def ProcA55 : SubtargetFeature<"a55", "ARMProcFamily", "CortexA55", 734 "Cortex-A55 ARM processors", []>; 735def ProcA57 : SubtargetFeature<"a57", "ARMProcFamily", "CortexA57", 736 "Cortex-A57 ARM processors", []>; 737def ProcA72 : SubtargetFeature<"a72", "ARMProcFamily", "CortexA72", 738 "Cortex-A72 ARM processors", []>; 739def ProcA73 : SubtargetFeature<"a73", "ARMProcFamily", "CortexA73", 740 "Cortex-A73 ARM processors", []>; 741def ProcA75 : SubtargetFeature<"a75", "ARMProcFamily", "CortexA75", 742 "Cortex-A75 ARM processors", []>; 743def ProcA76 : SubtargetFeature<"a76", "ARMProcFamily", "CortexA76", 744 "Cortex-A76 ARM processors", []>; 745def ProcA77 : SubtargetFeature<"a77", "ARMProcFamily", "CortexA77", 746 "Cortex-A77 ARM processors", []>; 747def ProcA78 : SubtargetFeature<"cortex-a78", "ARMProcFamily", "CortexA78", 748 "Cortex-A78 ARM processors", []>; 749def ProcA78C : SubtargetFeature<"a78c", "ARMProcFamily", "CortexA78C", 750 "Cortex-A78C ARM processors", []>; 751def ProcA710 : SubtargetFeature<"cortex-a710", "ARMProcFamily", 752 "CortexA710", "Cortex-A710 ARM processors", []>; 753def ProcX1 : SubtargetFeature<"cortex-x1", "ARMProcFamily", "CortexX1", 754 "Cortex-X1 ARM processors", []>; 755def ProcX1C : SubtargetFeature<"cortex-x1c", "ARMProcFamily", "CortexX1C", 756 "Cortex-X1C ARM processors", []>; 757 758def ProcV1 : SubtargetFeature<"neoverse-v1", "ARMProcFamily", 759 "NeoverseV1", "Neoverse-V1 ARM processors", []>; 760 761def ProcKrait : SubtargetFeature<"krait", "ARMProcFamily", "Krait", 762 "Qualcomm Krait processors", []>; 763def ProcKryo : SubtargetFeature<"kryo", "ARMProcFamily", "Kryo", 764 "Qualcomm Kryo processors", []>; 765def ProcSwift : SubtargetFeature<"swift", "ARMProcFamily", "Swift", 766 "Swift ARM processors", []>; 767 768def ProcExynos : SubtargetFeature<"exynos", "ARMProcFamily", "Exynos", 769 "Samsung Exynos processors", 770 [FeatureZCZeroing, 771 FeatureUseWideStrideVFP, 772 FeatureSplatVFPToNeon, 773 FeatureSlowVGETLNi32, 774 FeatureSlowVDUP32, 775 FeatureSlowFPBrcc, 776 FeatureProfUnpredicate, 777 FeatureHWDivThumb, 778 FeatureHWDivARM, 779 FeatureHasSlowFPVMLx, 780 FeatureHasSlowFPVFMx, 781 FeatureHasRetAddrStack, 782 FeatureFuseLiterals, 783 FeatureFuseAES, 784 FeatureExpandMLx, 785 FeatureCrypto, 786 FeatureCRC]>; 787 788def ProcR4 : SubtargetFeature<"r4", "ARMProcFamily", "CortexR4", 789 "Cortex-R4 ARM processors", []>; 790def ProcR5 : SubtargetFeature<"r5", "ARMProcFamily", "CortexR5", 791 "Cortex-R5 ARM processors", []>; 792def ProcR7 : SubtargetFeature<"r7", "ARMProcFamily", "CortexR7", 793 "Cortex-R7 ARM processors", []>; 794def ProcR52 : SubtargetFeature<"r52", "ARMProcFamily", "CortexR52", 795 "Cortex-R52 ARM processors", []>; 796 797def ProcM3 : SubtargetFeature<"m3", "ARMProcFamily", "CortexM3", 798 "Cortex-M3 ARM processors", []>; 799def ProcM7 : SubtargetFeature<"m7", "ARMProcFamily", "CortexM7", 800 "Cortex-M7 ARM processors", []>; 801 802//===----------------------------------------------------------------------===// 803// ARM Helper classes. 804// 805 806class Architecture<string fname, string aname, list<SubtargetFeature> features> 807 : SubtargetFeature<fname, "ARMArch", aname, 808 !strconcat(aname, " architecture"), features>; 809 810class ProcNoItin<string Name, list<SubtargetFeature> Features> 811 : Processor<Name, NoItineraries, Features>; 812 813 814//===----------------------------------------------------------------------===// 815// ARM architectures 816// 817 818def ARMv2 : Architecture<"armv2", "ARMv2", []>; 819 820def ARMv2a : Architecture<"armv2a", "ARMv2a", []>; 821 822def ARMv3 : Architecture<"armv3", "ARMv3", []>; 823 824def ARMv3m : Architecture<"armv3m", "ARMv3m", []>; 825 826def ARMv4 : Architecture<"armv4", "ARMv4", []>; 827 828def ARMv4t : Architecture<"armv4t", "ARMv4t", [HasV4TOps]>; 829 830def ARMv5t : Architecture<"armv5t", "ARMv5t", [HasV5TOps]>; 831 832def ARMv5te : Architecture<"armv5te", "ARMv5te", [HasV5TEOps]>; 833 834def ARMv5tej : Architecture<"armv5tej", "ARMv5tej", [HasV5TEOps]>; 835 836def ARMv6 : Architecture<"armv6", "ARMv6", [HasV6Ops, 837 FeatureDSP]>; 838 839def ARMv6t2 : Architecture<"armv6t2", "ARMv6t2", [HasV6T2Ops, 840 FeatureDSP]>; 841 842def ARMv6k : Architecture<"armv6k", "ARMv6k", [HasV6KOps]>; 843 844def ARMv6kz : Architecture<"armv6kz", "ARMv6kz", [HasV6KOps, 845 FeatureTrustZone]>; 846 847def ARMv6m : Architecture<"armv6-m", "ARMv6m", [HasV6MOps, 848 FeatureNoARM, 849 ModeThumb, 850 FeatureDB, 851 FeatureMClass, 852 FeatureStrictAlign]>; 853 854def ARMv6sm : Architecture<"armv6s-m", "ARMv6sm", [HasV6MOps, 855 FeatureNoARM, 856 ModeThumb, 857 FeatureDB, 858 FeatureMClass, 859 FeatureStrictAlign]>; 860 861def ARMv7a : Architecture<"armv7-a", "ARMv7a", [HasV7Ops, 862 FeatureNEON, 863 FeatureDB, 864 FeatureDSP, 865 FeatureAClass, 866 FeaturePerfMon]>; 867 868def ARMv7ve : Architecture<"armv7ve", "ARMv7ve", [HasV7Ops, 869 FeatureNEON, 870 FeatureDB, 871 FeatureDSP, 872 FeatureTrustZone, 873 FeatureMP, 874 FeatureVirtualization, 875 FeatureAClass, 876 FeaturePerfMon]>; 877 878def ARMv7r : Architecture<"armv7-r", "ARMv7r", [HasV7Ops, 879 FeatureDB, 880 FeatureDSP, 881 FeatureHWDivThumb, 882 FeatureRClass, 883 FeaturePerfMon]>; 884 885def ARMv7m : Architecture<"armv7-m", "ARMv7m", [HasV7Ops, 886 FeatureThumb2, 887 FeatureNoARM, 888 ModeThumb, 889 FeatureDB, 890 FeatureHWDivThumb, 891 FeatureMClass]>; 892 893def ARMv7em : Architecture<"armv7e-m", "ARMv7em", [HasV7Ops, 894 FeatureThumb2, 895 FeatureNoARM, 896 ModeThumb, 897 FeatureDB, 898 FeatureHWDivThumb, 899 FeatureMClass, 900 FeatureDSP]>; 901 902def ARMv8a : Architecture<"armv8-a", "ARMv8a", [HasV8Ops, 903 FeatureAClass, 904 FeatureDB, 905 FeatureFPARMv8, 906 FeatureNEON, 907 FeatureDSP, 908 FeatureTrustZone, 909 FeatureMP, 910 FeatureVirtualization, 911 FeatureCrypto, 912 FeatureCRC]>; 913 914def ARMv81a : Architecture<"armv8.1-a", "ARMv81a", [HasV8_1aOps, 915 FeatureAClass, 916 FeatureDB, 917 FeatureFPARMv8, 918 FeatureNEON, 919 FeatureDSP, 920 FeatureTrustZone, 921 FeatureMP, 922 FeatureVirtualization, 923 FeatureCrypto, 924 FeatureCRC]>; 925 926def ARMv82a : Architecture<"armv8.2-a", "ARMv82a", [HasV8_2aOps, 927 FeatureAClass, 928 FeatureDB, 929 FeatureFPARMv8, 930 FeatureNEON, 931 FeatureDSP, 932 FeatureTrustZone, 933 FeatureMP, 934 FeatureVirtualization, 935 FeatureCrypto, 936 FeatureCRC, 937 FeatureRAS]>; 938 939def ARMv83a : Architecture<"armv8.3-a", "ARMv83a", [HasV8_3aOps, 940 FeatureAClass, 941 FeatureDB, 942 FeatureFPARMv8, 943 FeatureNEON, 944 FeatureDSP, 945 FeatureTrustZone, 946 FeatureMP, 947 FeatureVirtualization, 948 FeatureCrypto, 949 FeatureCRC, 950 FeatureRAS]>; 951 952def ARMv84a : Architecture<"armv8.4-a", "ARMv84a", [HasV8_4aOps, 953 FeatureAClass, 954 FeatureDB, 955 FeatureFPARMv8, 956 FeatureNEON, 957 FeatureDSP, 958 FeatureTrustZone, 959 FeatureMP, 960 FeatureVirtualization, 961 FeatureCrypto, 962 FeatureCRC, 963 FeatureRAS, 964 FeatureDotProd]>; 965 966def ARMv85a : Architecture<"armv8.5-a", "ARMv85a", [HasV8_5aOps, 967 FeatureAClass, 968 FeatureDB, 969 FeatureFPARMv8, 970 FeatureNEON, 971 FeatureDSP, 972 FeatureTrustZone, 973 FeatureMP, 974 FeatureVirtualization, 975 FeatureCrypto, 976 FeatureCRC, 977 FeatureRAS, 978 FeatureDotProd]>; 979def ARMv86a : Architecture<"armv8.6-a", "ARMv86a", [HasV8_6aOps, 980 FeatureAClass, 981 FeatureDB, 982 FeatureFPARMv8, 983 FeatureNEON, 984 FeatureDSP, 985 FeatureTrustZone, 986 FeatureMP, 987 FeatureVirtualization, 988 FeatureCrypto, 989 FeatureCRC, 990 FeatureRAS, 991 FeatureDotProd]>; 992def ARMv87a : Architecture<"armv8.7-a", "ARMv87a", [HasV8_7aOps, 993 FeatureAClass, 994 FeatureDB, 995 FeatureFPARMv8, 996 FeatureNEON, 997 FeatureDSP, 998 FeatureTrustZone, 999 FeatureMP, 1000 FeatureVirtualization, 1001 FeatureCrypto, 1002 FeatureCRC, 1003 FeatureRAS, 1004 FeatureDotProd]>; 1005def ARMv88a : Architecture<"armv8.8-a", "ARMv88a", [HasV8_8aOps, 1006 FeatureAClass, 1007 FeatureDB, 1008 FeatureFPARMv8, 1009 FeatureNEON, 1010 FeatureDSP, 1011 FeatureTrustZone, 1012 FeatureMP, 1013 FeatureVirtualization, 1014 FeatureCrypto, 1015 FeatureCRC, 1016 FeatureRAS, 1017 FeatureDotProd]>; 1018 1019def ARMv9a : Architecture<"armv9-a", "ARMv9a", [HasV9_0aOps, 1020 FeatureAClass, 1021 FeatureDB, 1022 FeatureFPARMv8, 1023 FeatureNEON, 1024 FeatureDSP, 1025 FeatureTrustZone, 1026 FeatureMP, 1027 FeatureVirtualization, 1028 FeatureCRC, 1029 FeatureRAS, 1030 FeatureDotProd]>; 1031def ARMv91a : Architecture<"armv9.1-a", "ARMv91a", [HasV9_1aOps, 1032 FeatureAClass, 1033 FeatureDB, 1034 FeatureFPARMv8, 1035 FeatureNEON, 1036 FeatureDSP, 1037 FeatureTrustZone, 1038 FeatureMP, 1039 FeatureVirtualization, 1040 FeatureCRC, 1041 FeatureRAS, 1042 FeatureDotProd]>; 1043def ARMv92a : Architecture<"armv9.2-a", "ARMv92a", [HasV9_2aOps, 1044 FeatureAClass, 1045 FeatureDB, 1046 FeatureFPARMv8, 1047 FeatureNEON, 1048 FeatureDSP, 1049 FeatureTrustZone, 1050 FeatureMP, 1051 FeatureVirtualization, 1052 FeatureCRC, 1053 FeatureRAS, 1054 FeatureDotProd]>; 1055def ARMv93a : Architecture<"armv9.3-a", "ARMv93a", [HasV9_3aOps, 1056 FeatureAClass, 1057 FeatureDB, 1058 FeatureFPARMv8, 1059 FeatureNEON, 1060 FeatureDSP, 1061 FeatureTrustZone, 1062 FeatureMP, 1063 FeatureVirtualization, 1064 FeatureCrypto, 1065 FeatureCRC, 1066 FeatureRAS, 1067 FeatureDotProd]>; 1068 1069def ARMv8r : Architecture<"armv8-r", "ARMv8r", [HasV8Ops, 1070 FeatureRClass, 1071 FeatureDB, 1072 FeatureDFB, 1073 FeatureDSP, 1074 FeatureCRC, 1075 FeatureMP, 1076 FeatureVirtualization, 1077 FeatureFPARMv8, 1078 FeatureNEON]>; 1079 1080def ARMv8mBaseline : Architecture<"armv8-m.base", "ARMv8mBaseline", 1081 [HasV8MBaselineOps, 1082 FeatureNoARM, 1083 ModeThumb, 1084 FeatureDB, 1085 FeatureHWDivThumb, 1086 FeatureV7Clrex, 1087 Feature8MSecExt, 1088 FeatureAcquireRelease, 1089 FeatureMClass, 1090 FeatureStrictAlign]>; 1091 1092def ARMv8mMainline : Architecture<"armv8-m.main", "ARMv8mMainline", 1093 [HasV8MMainlineOps, 1094 FeatureNoARM, 1095 ModeThumb, 1096 FeatureDB, 1097 FeatureHWDivThumb, 1098 Feature8MSecExt, 1099 FeatureAcquireRelease, 1100 FeatureMClass]>; 1101 1102def ARMv81mMainline : Architecture<"armv8.1-m.main", "ARMv81mMainline", 1103 [HasV8_1MMainlineOps, 1104 FeatureNoARM, 1105 ModeThumb, 1106 FeatureDB, 1107 FeatureHWDivThumb, 1108 Feature8MSecExt, 1109 FeatureAcquireRelease, 1110 FeatureMClass, 1111 FeatureRAS, 1112 FeatureLOB]>; 1113 1114// Aliases 1115def IWMMXT : Architecture<"iwmmxt", "ARMv5te", [ARMv5te]>; 1116def IWMMXT2 : Architecture<"iwmmxt2", "ARMv5te", [ARMv5te]>; 1117def XScale : Architecture<"xscale", "ARMv5te", [ARMv5te]>; 1118def ARMv6j : Architecture<"armv6j", "ARMv7a", [ARMv6]>; 1119def ARMv7k : Architecture<"armv7k", "ARMv7a", [ARMv7a]>; 1120def ARMv7s : Architecture<"armv7s", "ARMv7a", [ARMv7a]>; 1121 1122//===----------------------------------------------------------------------===// 1123// Register File Description 1124//===----------------------------------------------------------------------===// 1125 1126include "ARMRegisterInfo.td" 1127include "ARMRegisterBanks.td" 1128include "ARMCallingConv.td" 1129 1130//===----------------------------------------------------------------------===// 1131// ARM schedules. 1132//===----------------------------------------------------------------------===// 1133// 1134include "ARMPredicates.td" 1135include "ARMSchedule.td" 1136 1137//===----------------------------------------------------------------------===// 1138// Instruction Descriptions 1139//===----------------------------------------------------------------------===// 1140 1141include "ARMInstrInfo.td" 1142def ARMInstrInfo : InstrInfo; 1143 1144//===----------------------------------------------------------------------===// 1145// ARM schedules 1146// 1147include "ARMScheduleV6.td" 1148include "ARMScheduleA8.td" 1149include "ARMScheduleA9.td" 1150include "ARMScheduleSwift.td" 1151include "ARMScheduleR52.td" 1152include "ARMScheduleA57.td" 1153include "ARMScheduleM4.td" 1154include "ARMScheduleM7.td" 1155 1156//===----------------------------------------------------------------------===// 1157// ARM processors 1158// 1159// Dummy CPU, used to target architectures 1160def : ProcessorModel<"generic", CortexA8Model, []>; 1161 1162// FIXME: Several processors below are not using their own scheduler 1163// model, but one of similar/previous processor. These should be fixed. 1164 1165def : ProcNoItin<"arm8", [ARMv4]>; 1166def : ProcNoItin<"arm810", [ARMv4]>; 1167def : ProcNoItin<"strongarm", [ARMv4]>; 1168def : ProcNoItin<"strongarm110", [ARMv4]>; 1169def : ProcNoItin<"strongarm1100", [ARMv4]>; 1170def : ProcNoItin<"strongarm1110", [ARMv4]>; 1171 1172def : ProcNoItin<"arm7tdmi", [ARMv4t]>; 1173def : ProcNoItin<"arm7tdmi-s", [ARMv4t]>; 1174def : ProcNoItin<"arm710t", [ARMv4t]>; 1175def : ProcNoItin<"arm720t", [ARMv4t]>; 1176def : ProcNoItin<"arm9", [ARMv4t]>; 1177def : ProcNoItin<"arm9tdmi", [ARMv4t]>; 1178def : ProcNoItin<"arm920", [ARMv4t]>; 1179def : ProcNoItin<"arm920t", [ARMv4t]>; 1180def : ProcNoItin<"arm922t", [ARMv4t]>; 1181def : ProcNoItin<"arm940t", [ARMv4t]>; 1182def : ProcNoItin<"ep9312", [ARMv4t]>; 1183 1184def : ProcNoItin<"arm10tdmi", [ARMv5t]>; 1185def : ProcNoItin<"arm1020t", [ARMv5t]>; 1186 1187def : ProcNoItin<"arm9e", [ARMv5te]>; 1188def : ProcNoItin<"arm926ej-s", [ARMv5te]>; 1189def : ProcNoItin<"arm946e-s", [ARMv5te]>; 1190def : ProcNoItin<"arm966e-s", [ARMv5te]>; 1191def : ProcNoItin<"arm968e-s", [ARMv5te]>; 1192def : ProcNoItin<"arm10e", [ARMv5te]>; 1193def : ProcNoItin<"arm1020e", [ARMv5te]>; 1194def : ProcNoItin<"arm1022e", [ARMv5te]>; 1195def : ProcNoItin<"xscale", [ARMv5te]>; 1196def : ProcNoItin<"iwmmxt", [ARMv5te]>; 1197 1198def : Processor<"arm1136j-s", ARMV6Itineraries, [ARMv6]>; 1199def : Processor<"arm1136jf-s", ARMV6Itineraries, [ARMv6, 1200 FeatureVFP2, 1201 FeatureHasSlowFPVMLx]>; 1202 1203def : Processor<"cortex-m0", ARMV6Itineraries, [ARMv6m, 1204 FeatureHasNoBranchPredictor]>; 1205def : Processor<"cortex-m0plus", ARMV6Itineraries, [ARMv6m, 1206 FeatureHasNoBranchPredictor]>; 1207def : Processor<"cortex-m1", ARMV6Itineraries, [ARMv6m, 1208 FeatureHasNoBranchPredictor]>; 1209def : Processor<"sc000", ARMV6Itineraries, [ARMv6m, 1210 FeatureHasNoBranchPredictor]>; 1211 1212def : Processor<"arm1176jz-s", ARMV6Itineraries, [ARMv6kz]>; 1213def : Processor<"arm1176jzf-s", ARMV6Itineraries, [ARMv6kz, 1214 FeatureVFP2, 1215 FeatureHasSlowFPVMLx]>; 1216 1217def : Processor<"mpcorenovfp", ARMV6Itineraries, [ARMv6k]>; 1218def : Processor<"mpcore", ARMV6Itineraries, [ARMv6k, 1219 FeatureVFP2, 1220 FeatureHasSlowFPVMLx]>; 1221 1222def : Processor<"arm1156t2-s", ARMV6Itineraries, [ARMv6t2]>; 1223def : Processor<"arm1156t2f-s", ARMV6Itineraries, [ARMv6t2, 1224 FeatureVFP2, 1225 FeatureHasSlowFPVMLx]>; 1226 1227def : ProcessorModel<"cortex-a5", CortexA8Model, [ARMv7a, ProcA5, 1228 FeatureHasRetAddrStack, 1229 FeatureTrustZone, 1230 FeatureSlowFPBrcc, 1231 FeatureHasSlowFPVMLx, 1232 FeatureHasSlowFPVFMx, 1233 FeatureVMLxForwarding, 1234 FeatureMP, 1235 FeatureVFP4]>; 1236 1237def : ProcessorModel<"cortex-a7", CortexA8Model, [ARMv7a, ProcA7, 1238 FeatureHasRetAddrStack, 1239 FeatureTrustZone, 1240 FeatureSlowFPBrcc, 1241 FeatureHasVMLxHazards, 1242 FeatureHasSlowFPVMLx, 1243 FeatureHasSlowFPVFMx, 1244 FeatureVMLxForwarding, 1245 FeatureMP, 1246 FeatureVFP4, 1247 FeatureVirtualization]>; 1248 1249def : ProcessorModel<"cortex-a8", CortexA8Model, [ARMv7a, ProcA8, 1250 FeatureHasRetAddrStack, 1251 FeatureNonpipelinedVFP, 1252 FeatureTrustZone, 1253 FeatureSlowFPBrcc, 1254 FeatureHasVMLxHazards, 1255 FeatureHasSlowFPVMLx, 1256 FeatureHasSlowFPVFMx, 1257 FeatureVMLxForwarding]>; 1258 1259def : ProcessorModel<"cortex-a9", CortexA9Model, [ARMv7a, ProcA9, 1260 FeatureHasRetAddrStack, 1261 FeatureTrustZone, 1262 FeatureHasVMLxHazards, 1263 FeatureVMLxForwarding, 1264 FeatureFP16, 1265 FeatureAvoidPartialCPSR, 1266 FeatureExpandMLx, 1267 FeaturePreferVMOVSR, 1268 FeatureMuxedUnits, 1269 FeatureNEONForFPMovs, 1270 FeatureCheckVLDnAlign, 1271 FeatureMP]>; 1272 1273def : ProcessorModel<"cortex-a12", CortexA9Model, [ARMv7a, ProcA12, 1274 FeatureHasRetAddrStack, 1275 FeatureTrustZone, 1276 FeatureVMLxForwarding, 1277 FeatureVFP4, 1278 FeatureAvoidPartialCPSR, 1279 FeatureVirtualization, 1280 FeatureMP]>; 1281 1282def : ProcessorModel<"cortex-a15", CortexA9Model, [ARMv7a, ProcA15, 1283 FeatureDontWidenVMOVS, 1284 FeatureSplatVFPToNeon, 1285 FeatureHasRetAddrStack, 1286 FeatureMuxedUnits, 1287 FeatureTrustZone, 1288 FeatureVFP4, 1289 FeatureMP, 1290 FeatureCheckVLDnAlign, 1291 FeatureAvoidPartialCPSR, 1292 FeatureVirtualization]>; 1293 1294def : ProcessorModel<"cortex-a17", CortexA9Model, [ARMv7a, ProcA17, 1295 FeatureHasRetAddrStack, 1296 FeatureTrustZone, 1297 FeatureMP, 1298 FeatureVMLxForwarding, 1299 FeatureVFP4, 1300 FeatureAvoidPartialCPSR, 1301 FeatureVirtualization]>; 1302 1303// FIXME: krait has currently the same features as A9 plus VFP4 and HWDiv 1304def : ProcessorModel<"krait", CortexA9Model, [ARMv7a, ProcKrait, 1305 FeatureHasRetAddrStack, 1306 FeatureMuxedUnits, 1307 FeatureCheckVLDnAlign, 1308 FeatureVMLxForwarding, 1309 FeatureFP16, 1310 FeatureAvoidPartialCPSR, 1311 FeatureVFP4, 1312 FeatureHWDivThumb, 1313 FeatureHWDivARM]>; 1314 1315def : ProcessorModel<"swift", SwiftModel, [ARMv7a, ProcSwift, 1316 FeatureHasRetAddrStack, 1317 FeatureNEONForFP, 1318 FeatureVFP4, 1319 FeatureUseWideStrideVFP, 1320 FeatureMP, 1321 FeatureHWDivThumb, 1322 FeatureHWDivARM, 1323 FeatureAvoidPartialCPSR, 1324 FeatureAvoidMOVsShOp, 1325 FeatureHasSlowFPVMLx, 1326 FeatureHasSlowFPVFMx, 1327 FeatureHasVMLxHazards, 1328 FeatureProfUnpredicate, 1329 FeaturePrefISHSTBarrier, 1330 FeatureSlowOddRegister, 1331 FeatureSlowLoadDSubreg, 1332 FeatureSlowVGETLNi32, 1333 FeatureSlowVDUP32, 1334 FeatureUseMISched, 1335 FeatureNoPostRASched]>; 1336 1337def : ProcessorModel<"cortex-r4", CortexA8Model, [ARMv7r, ProcR4, 1338 FeatureHasRetAddrStack, 1339 FeatureAvoidPartialCPSR]>; 1340 1341def : ProcessorModel<"cortex-r4f", CortexA8Model, [ARMv7r, ProcR4, 1342 FeatureHasRetAddrStack, 1343 FeatureSlowFPBrcc, 1344 FeatureHasSlowFPVMLx, 1345 FeatureHasSlowFPVFMx, 1346 FeatureVFP3_D16, 1347 FeatureAvoidPartialCPSR]>; 1348 1349def : ProcessorModel<"cortex-r5", CortexA8Model, [ARMv7r, ProcR5, 1350 FeatureHasRetAddrStack, 1351 FeatureVFP3_D16, 1352 FeatureSlowFPBrcc, 1353 FeatureHWDivARM, 1354 FeatureHasSlowFPVMLx, 1355 FeatureHasSlowFPVFMx, 1356 FeatureAvoidPartialCPSR]>; 1357 1358def : ProcessorModel<"cortex-r7", CortexA8Model, [ARMv7r, ProcR7, 1359 FeatureHasRetAddrStack, 1360 FeatureVFP3_D16, 1361 FeatureFP16, 1362 FeatureMP, 1363 FeatureSlowFPBrcc, 1364 FeatureHWDivARM, 1365 FeatureHasSlowFPVMLx, 1366 FeatureHasSlowFPVFMx, 1367 FeatureAvoidPartialCPSR]>; 1368 1369def : ProcessorModel<"cortex-r8", CortexA8Model, [ARMv7r, 1370 FeatureHasRetAddrStack, 1371 FeatureVFP3_D16, 1372 FeatureFP16, 1373 FeatureMP, 1374 FeatureSlowFPBrcc, 1375 FeatureHWDivARM, 1376 FeatureHasSlowFPVMLx, 1377 FeatureHasSlowFPVFMx, 1378 FeatureAvoidPartialCPSR]>; 1379 1380def : ProcessorModel<"cortex-m3", CortexM4Model, [ARMv7m, 1381 ProcM3, 1382 FeaturePrefLoopAlign32, 1383 FeatureUseMISched, 1384 FeatureHasNoBranchPredictor]>; 1385 1386def : ProcessorModel<"sc300", CortexM4Model, [ARMv7m, 1387 ProcM3, 1388 FeatureUseMISched, 1389 FeatureHasNoBranchPredictor]>; 1390 1391def : ProcessorModel<"cortex-m4", CortexM4Model, [ARMv7em, 1392 FeatureVFP4_D16_SP, 1393 FeaturePrefLoopAlign32, 1394 FeatureHasSlowFPVMLx, 1395 FeatureHasSlowFPVFMx, 1396 FeatureUseMISched, 1397 FeatureHasNoBranchPredictor]>; 1398 1399def : ProcessorModel<"cortex-m7", CortexM7Model, [ARMv7em, 1400 ProcM7, 1401 FeatureFPARMv8_D16, 1402 FeatureUseMIPipeliner, 1403 FeatureUseMISched]>; 1404 1405def : ProcNoItin<"cortex-m23", [ARMv8mBaseline, 1406 FeatureNoMovt, 1407 FeatureHasNoBranchPredictor]>; 1408 1409def : ProcessorModel<"cortex-m33", CortexM4Model, [ARMv8mMainline, 1410 FeatureDSP, 1411 FeatureFPARMv8_D16_SP, 1412 FeaturePrefLoopAlign32, 1413 FeatureHasSlowFPVMLx, 1414 FeatureHasSlowFPVFMx, 1415 FeatureUseMISched, 1416 FeatureHasNoBranchPredictor, 1417 FeatureFixCMSE_CVE_2021_35465]>; 1418 1419def : ProcessorModel<"cortex-m35p", CortexM4Model, [ARMv8mMainline, 1420 FeatureDSP, 1421 FeatureFPARMv8_D16_SP, 1422 FeaturePrefLoopAlign32, 1423 FeatureHasSlowFPVMLx, 1424 FeatureHasSlowFPVFMx, 1425 FeatureUseMISched, 1426 FeatureHasNoBranchPredictor, 1427 FeatureFixCMSE_CVE_2021_35465]>; 1428 1429def : ProcessorModel<"cortex-m55", CortexM4Model, [ARMv81mMainline, 1430 FeatureDSP, 1431 FeatureFPARMv8_D16, 1432 FeatureUseMISched, 1433 FeatureHasNoBranchPredictor, 1434 FeaturePrefLoopAlign32, 1435 FeatureHasSlowFPVMLx, 1436 HasMVEFloatOps, 1437 FeatureFixCMSE_CVE_2021_35465]>; 1438 1439def : ProcNoItin<"cortex-a32", [ARMv8a, 1440 FeatureHWDivThumb, 1441 FeatureHWDivARM, 1442 FeatureCrypto, 1443 FeatureCRC]>; 1444 1445def : ProcNoItin<"cortex-a35", [ARMv8a, ProcA35, 1446 FeatureHWDivThumb, 1447 FeatureHWDivARM, 1448 FeatureCrypto, 1449 FeatureCRC]>; 1450 1451def : ProcNoItin<"cortex-a53", [ARMv8a, ProcA53, 1452 FeatureHWDivThumb, 1453 FeatureHWDivARM, 1454 FeatureCrypto, 1455 FeatureCRC, 1456 FeatureFPAO]>; 1457 1458def : ProcNoItin<"cortex-a55", [ARMv82a, ProcA55, 1459 FeatureHWDivThumb, 1460 FeatureHWDivARM, 1461 FeatureDotProd]>; 1462 1463def : ProcessorModel<"cortex-a57", CortexA57Model, [ARMv8a, ProcA57, 1464 FeatureHWDivThumb, 1465 FeatureHWDivARM, 1466 FeatureCrypto, 1467 FeatureCRC, 1468 FeatureFPAO, 1469 FeatureAvoidPartialCPSR, 1470 FeatureCheapPredicableCPSR]>; 1471 1472def : ProcessorModel<"cortex-a72", CortexA57Model, [ARMv8a, ProcA72, 1473 FeatureHWDivThumb, 1474 FeatureHWDivARM, 1475 FeatureCrypto, 1476 FeatureCRC]>; 1477 1478def : ProcNoItin<"cortex-a73", [ARMv8a, ProcA73, 1479 FeatureHWDivThumb, 1480 FeatureHWDivARM, 1481 FeatureCrypto, 1482 FeatureCRC]>; 1483 1484def : ProcNoItin<"cortex-a75", [ARMv82a, ProcA75, 1485 FeatureHWDivThumb, 1486 FeatureHWDivARM, 1487 FeatureDotProd]>; 1488 1489def : ProcNoItin<"cortex-a76", [ARMv82a, ProcA76, 1490 FeatureHWDivThumb, 1491 FeatureHWDivARM, 1492 FeatureCrypto, 1493 FeatureCRC, 1494 FeatureFullFP16, 1495 FeatureDotProd]>; 1496 1497def : ProcNoItin<"cortex-a76ae", [ARMv82a, ProcA76, 1498 FeatureHWDivThumb, 1499 FeatureHWDivARM, 1500 FeatureCrypto, 1501 FeatureCRC, 1502 FeatureFullFP16, 1503 FeatureDotProd]>; 1504 1505def : ProcNoItin<"cortex-a77", [ARMv82a, ProcA77, 1506 FeatureHWDivThumb, 1507 FeatureHWDivARM, 1508 FeatureCrypto, 1509 FeatureCRC, 1510 FeatureFullFP16, 1511 FeatureDotProd]>; 1512 1513def : ProcNoItin<"cortex-a78", [ARMv82a, ProcA78, 1514 FeatureHWDivThumb, 1515 FeatureHWDivARM, 1516 FeatureCrypto, 1517 FeatureCRC, 1518 FeatureFullFP16, 1519 FeatureDotProd]>; 1520 1521def : ProcNoItin<"cortex-a78c", [ARMv82a, ProcA78C, 1522 FeatureHWDivThumb, 1523 FeatureHWDivARM, 1524 FeatureCrypto, 1525 FeatureCRC, 1526 FeatureDotProd, 1527 FeatureFullFP16]>; 1528 1529def : ProcNoItin<"cortex-a710", [ARMv9a, ProcA710, 1530 FeatureHWDivThumb, 1531 FeatureHWDivARM, 1532 FeatureFP16FML, 1533 FeatureBF16, 1534 FeatureMatMulInt8, 1535 FeatureSB]>; 1536 1537def : ProcNoItin<"cortex-x1", [ARMv82a, ProcX1, 1538 FeatureHWDivThumb, 1539 FeatureHWDivARM, 1540 FeatureCrypto, 1541 FeatureCRC, 1542 FeatureFullFP16, 1543 FeatureDotProd]>; 1544 1545def : ProcNoItin<"cortex-x1c", [ARMv82a, ProcX1C, 1546 FeatureHWDivThumb, 1547 FeatureHWDivARM, 1548 FeatureCrypto, 1549 FeatureCRC, 1550 FeatureFullFP16, 1551 FeatureDotProd]>; 1552 1553def : ProcNoItin<"neoverse-v1", [ARMv84a, 1554 FeatureHWDivThumb, 1555 FeatureHWDivARM, 1556 FeatureCrypto, 1557 FeatureCRC, 1558 FeatureFullFP16, 1559 FeatureBF16, 1560 FeatureMatMulInt8]>; 1561 1562def : ProcNoItin<"neoverse-n1", [ARMv82a, 1563 FeatureHWDivThumb, 1564 FeatureHWDivARM, 1565 FeatureCrypto, 1566 FeatureCRC, 1567 FeatureDotProd]>; 1568 1569def : ProcNoItin<"neoverse-n2", [ARMv85a, 1570 FeatureBF16, 1571 FeatureMatMulInt8]>; 1572 1573def : ProcessorModel<"cyclone", SwiftModel, [ARMv8a, ProcSwift, 1574 FeatureHasRetAddrStack, 1575 FeatureNEONForFP, 1576 FeatureVFP4, 1577 FeatureMP, 1578 FeatureHWDivThumb, 1579 FeatureHWDivARM, 1580 FeatureAvoidPartialCPSR, 1581 FeatureAvoidMOVsShOp, 1582 FeatureHasSlowFPVMLx, 1583 FeatureHasSlowFPVFMx, 1584 FeatureCrypto, 1585 FeatureUseMISched, 1586 FeatureZCZeroing, 1587 FeatureNoPostRASched]>; 1588 1589def : ProcNoItin<"exynos-m3", [ARMv8a, ProcExynos]>; 1590def : ProcNoItin<"exynos-m4", [ARMv82a, ProcExynos, 1591 FeatureFullFP16, 1592 FeatureDotProd]>; 1593def : ProcNoItin<"exynos-m5", [ARMv82a, ProcExynos, 1594 FeatureFullFP16, 1595 FeatureDotProd]>; 1596 1597def : ProcNoItin<"kryo", [ARMv8a, ProcKryo, 1598 FeatureHWDivThumb, 1599 FeatureHWDivARM, 1600 FeatureCrypto, 1601 FeatureCRC]>; 1602 1603def : ProcessorModel<"cortex-r52", CortexR52Model, [ARMv8r, ProcR52, 1604 FeatureUseMISched, 1605 FeatureFPAO]>; 1606 1607//===----------------------------------------------------------------------===// 1608// Declare the target which we are implementing 1609//===----------------------------------------------------------------------===// 1610 1611def ARMAsmWriter : AsmWriter { 1612 string AsmWriterClassName = "InstPrinter"; 1613 int PassSubtarget = 1; 1614 int Variant = 0; 1615 bit isMCAsmWriter = 1; 1616} 1617 1618def ARMAsmParser : AsmParser { 1619 bit ReportMultipleNearMisses = 1; 1620} 1621 1622def ARMAsmParserVariant : AsmParserVariant { 1623 int Variant = 0; 1624 string Name = "ARM"; 1625 string BreakCharacters = "."; 1626} 1627 1628def ARM : Target { 1629 // Pull in Instruction Info. 1630 let InstructionSet = ARMInstrInfo; 1631 let AssemblyWriters = [ARMAsmWriter]; 1632 let AssemblyParsers = [ARMAsmParser]; 1633 let AssemblyParserVariants = [ARMAsmParserVariant]; 1634 let AllowRegisterRenaming = 1; 1635} 1636