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 545def FeatureFixCortexA57AES1742098 : SubtargetFeature<"fix-cortex-a57-aes-1742098", 546 "FixCortexA57AES1742098", "true", 547 "Work around Cortex-A57 Erratum 1742098 / Cortex-A72 Erratum 1655431 (AES)">; 548 549//===----------------------------------------------------------------------===// 550// ARM architecture class 551// 552 553// A-series ISA 554def FeatureAClass : SubtargetFeature<"aclass", "ARMProcClass", "AClass", 555 "Is application profile ('A' series)">; 556 557// R-series ISA 558def FeatureRClass : SubtargetFeature<"rclass", "ARMProcClass", "RClass", 559 "Is realtime profile ('R' series)">; 560 561// M-series ISA 562def FeatureMClass : SubtargetFeature<"mclass", "ARMProcClass", "MClass", 563 "Is microcontroller profile ('M' series)">; 564 565// True if Thumb2 instructions are supported. 566def FeatureThumb2 : SubtargetFeature<"thumb2", "HasThumb2", "true", 567 "Enable Thumb2 instructions">; 568 569// True if subtarget does not support ARM mode execution. 570def FeatureNoARM : SubtargetFeature<"noarm", "NoARM", "true", 571 "Does not support ARM mode execution">; 572 573//===----------------------------------------------------------------------===// 574// ARM ISAa. 575// 576// Specify whether target support specific ARM ISA variants. 577 578def HasV4TOps : SubtargetFeature<"v4t", "HasV4TOps", "true", 579 "Support ARM v4T instructions">; 580 581def HasV5TOps : SubtargetFeature<"v5t", "HasV5TOps", "true", 582 "Support ARM v5T instructions", 583 [HasV4TOps]>; 584 585def HasV5TEOps : SubtargetFeature<"v5te", "HasV5TEOps", "true", 586 "Support ARM v5TE, v5TEj, and " 587 "v5TExp instructions", 588 [HasV5TOps]>; 589 590def HasV6Ops : SubtargetFeature<"v6", "HasV6Ops", "true", 591 "Support ARM v6 instructions", 592 [HasV5TEOps]>; 593 594def HasV6MOps : SubtargetFeature<"v6m", "HasV6MOps", "true", 595 "Support ARM v6M instructions", 596 [HasV6Ops]>; 597 598def HasV8MBaselineOps : SubtargetFeature<"v8m", "HasV8MBaselineOps", "true", 599 "Support ARM v8M Baseline instructions", 600 [HasV6MOps]>; 601 602def HasV6KOps : SubtargetFeature<"v6k", "HasV6KOps", "true", 603 "Support ARM v6k instructions", 604 [HasV6Ops]>; 605 606def HasV6T2Ops : SubtargetFeature<"v6t2", "HasV6T2Ops", "true", 607 "Support ARM v6t2 instructions", 608 [HasV8MBaselineOps, HasV6KOps, FeatureThumb2]>; 609 610def HasV7Ops : SubtargetFeature<"v7", "HasV7Ops", "true", 611 "Support ARM v7 instructions", 612 [HasV6T2Ops, FeatureV7Clrex]>; 613 614def HasV8MMainlineOps : 615 SubtargetFeature<"v8m.main", "HasV8MMainlineOps", "true", 616 "Support ARM v8M Mainline instructions", 617 [HasV7Ops]>; 618 619def HasV8Ops : SubtargetFeature<"v8", "HasV8Ops", "true", 620 "Support ARM v8 instructions", 621 [HasV7Ops, FeaturePerfMon, FeatureAcquireRelease]>; 622 623def HasV8_1aOps : SubtargetFeature<"v8.1a", "HasV8_1aOps", "true", 624 "Support ARM v8.1a instructions", 625 [HasV8Ops]>; 626 627def HasV8_2aOps : SubtargetFeature<"v8.2a", "HasV8_2aOps", "true", 628 "Support ARM v8.2a instructions", 629 [HasV8_1aOps]>; 630 631def HasV8_3aOps : SubtargetFeature<"v8.3a", "HasV8_3aOps", "true", 632 "Support ARM v8.3a instructions", 633 [HasV8_2aOps]>; 634 635def HasV8_4aOps : SubtargetFeature<"v8.4a", "HasV8_4aOps", "true", 636 "Support ARM v8.4a instructions", 637 [HasV8_3aOps, FeatureDotProd]>; 638 639def HasV8_5aOps : SubtargetFeature<"v8.5a", "HasV8_5aOps", "true", 640 "Support ARM v8.5a instructions", 641 [HasV8_4aOps, FeatureSB]>; 642 643def HasV8_6aOps : SubtargetFeature<"v8.6a", "HasV8_6aOps", "true", 644 "Support ARM v8.6a instructions", 645 [HasV8_5aOps, FeatureBF16, 646 FeatureMatMulInt8]>; 647 648def HasV8_7aOps : SubtargetFeature<"v8.7a", "HasV8_7aOps", "true", 649 "Support ARM v8.7a instructions", 650 [HasV8_6aOps]>; 651 652def HasV8_8aOps : SubtargetFeature<"v8.8a", "HasV8_8aOps", "true", 653 "Support ARM v8.8a instructions", 654 [HasV8_7aOps]>; 655 656def HasV9_0aOps : SubtargetFeature<"v9a", "HasV9_0aOps", "true", 657 "Support ARM v9a instructions", 658 [HasV8_5aOps]>; 659 660def HasV9_1aOps : SubtargetFeature<"v9.1a", "HasV9_1aOps", "true", 661 "Support ARM v9.1a instructions", 662 [HasV8_6aOps, HasV9_0aOps]>; 663 664def HasV9_2aOps : SubtargetFeature<"v9.2a", "HasV9_2aOps", "true", 665 "Support ARM v9.2a instructions", 666 [HasV8_7aOps, HasV9_1aOps]>; 667 668def HasV9_3aOps : SubtargetFeature<"v9.3a", "HasV9_3aOps", "true", 669 "Support ARM v9.3a instructions", 670 [HasV8_8aOps, HasV9_2aOps]>; 671 672def HasV8_1MMainlineOps : SubtargetFeature< 673 "v8.1m.main", "HasV8_1MMainlineOps", "true", 674 "Support ARM v8-1M Mainline instructions", 675 [HasV8MMainlineOps]>; 676def HasMVEIntegerOps : SubtargetFeature< 677 "mve", "HasMVEIntegerOps", "true", 678 "Support M-Class Vector Extension with integer ops", 679 [HasV8_1MMainlineOps, FeatureDSP, FeatureFPRegs16, FeatureFPRegs64]>; 680def HasMVEFloatOps : SubtargetFeature< 681 "mve.fp", "HasMVEFloatOps", "true", 682 "Support M-Class Vector Extension with integer and floating ops", 683 [HasMVEIntegerOps, FeatureFPARMv8_D16_SP, FeatureFullFP16]>; 684 685def HasCDEOps : SubtargetFeature<"cde", "HasCDEOps", "true", 686 "Support CDE instructions", 687 [HasV8MMainlineOps]>; 688 689foreach i = {0-7} in 690 def FeatureCoprocCDE#i : SubtargetFeature<"cdecp"#i, 691 "CoprocCDE["#i#"]", "true", 692 "Coprocessor "#i#" ISA is CDEv1", 693 [HasCDEOps]>; 694 695//===----------------------------------------------------------------------===// 696// Control codegen mitigation against Straight Line Speculation vulnerability. 697//===----------------------------------------------------------------------===// 698 699/// Harden against Straight Line Speculation for Returns and Indirect Branches. 700def FeatureHardenSlsRetBr : SubtargetFeature<"harden-sls-retbr", 701 "HardenSlsRetBr", "true", 702 "Harden against straight line speculation across RETurn and BranchRegister " 703 "instructions">; 704/// Harden against Straight Line Speculation for indirect calls. 705def FeatureHardenSlsBlr : SubtargetFeature<"harden-sls-blr", 706 "HardenSlsBlr", "true", 707 "Harden against straight line speculation across indirect calls">; 708/// Generate thunk code for SLS mitigation in the normal text section. 709def FeatureHardenSlsNoComdat : SubtargetFeature<"harden-sls-nocomdat", 710 "HardenSlsNoComdat", "true", 711 "Generate thunk code for SLS mitigation in the normal text section">; 712 713//===----------------------------------------------------------------------===// 714// ARM Processor subtarget features. 715// 716 717def ProcA5 : SubtargetFeature<"a5", "ARMProcFamily", "CortexA5", 718 "Cortex-A5 ARM processors", []>; 719def ProcA7 : SubtargetFeature<"a7", "ARMProcFamily", "CortexA7", 720 "Cortex-A7 ARM processors", []>; 721def ProcA8 : SubtargetFeature<"a8", "ARMProcFamily", "CortexA8", 722 "Cortex-A8 ARM processors", []>; 723def ProcA9 : SubtargetFeature<"a9", "ARMProcFamily", "CortexA9", 724 "Cortex-A9 ARM processors", []>; 725def ProcA12 : SubtargetFeature<"a12", "ARMProcFamily", "CortexA12", 726 "Cortex-A12 ARM processors", []>; 727def ProcA15 : SubtargetFeature<"a15", "ARMProcFamily", "CortexA15", 728 "Cortex-A15 ARM processors", []>; 729def ProcA17 : SubtargetFeature<"a17", "ARMProcFamily", "CortexA17", 730 "Cortex-A17 ARM processors", []>; 731def ProcA32 : SubtargetFeature<"a32", "ARMProcFamily", "CortexA32", 732 "Cortex-A32 ARM processors", []>; 733def ProcA35 : SubtargetFeature<"a35", "ARMProcFamily", "CortexA35", 734 "Cortex-A35 ARM processors", []>; 735def ProcA53 : SubtargetFeature<"a53", "ARMProcFamily", "CortexA53", 736 "Cortex-A53 ARM processors", []>; 737def ProcA55 : SubtargetFeature<"a55", "ARMProcFamily", "CortexA55", 738 "Cortex-A55 ARM processors", []>; 739def ProcA57 : SubtargetFeature<"a57", "ARMProcFamily", "CortexA57", 740 "Cortex-A57 ARM processors", []>; 741def ProcA72 : SubtargetFeature<"a72", "ARMProcFamily", "CortexA72", 742 "Cortex-A72 ARM processors", []>; 743def ProcA73 : SubtargetFeature<"a73", "ARMProcFamily", "CortexA73", 744 "Cortex-A73 ARM processors", []>; 745def ProcA75 : SubtargetFeature<"a75", "ARMProcFamily", "CortexA75", 746 "Cortex-A75 ARM processors", []>; 747def ProcA76 : SubtargetFeature<"a76", "ARMProcFamily", "CortexA76", 748 "Cortex-A76 ARM processors", []>; 749def ProcA77 : SubtargetFeature<"a77", "ARMProcFamily", "CortexA77", 750 "Cortex-A77 ARM processors", []>; 751def ProcA78 : SubtargetFeature<"cortex-a78", "ARMProcFamily", "CortexA78", 752 "Cortex-A78 ARM processors", []>; 753def ProcA78C : SubtargetFeature<"a78c", "ARMProcFamily", "CortexA78C", 754 "Cortex-A78C ARM processors", []>; 755def ProcA710 : SubtargetFeature<"cortex-a710", "ARMProcFamily", 756 "CortexA710", "Cortex-A710 ARM processors", []>; 757def ProcX1 : SubtargetFeature<"cortex-x1", "ARMProcFamily", "CortexX1", 758 "Cortex-X1 ARM processors", []>; 759def ProcX1C : SubtargetFeature<"cortex-x1c", "ARMProcFamily", "CortexX1C", 760 "Cortex-X1C ARM processors", []>; 761 762def ProcV1 : SubtargetFeature<"neoverse-v1", "ARMProcFamily", 763 "NeoverseV1", "Neoverse-V1 ARM processors", []>; 764 765def ProcKrait : SubtargetFeature<"krait", "ARMProcFamily", "Krait", 766 "Qualcomm Krait processors", []>; 767def ProcKryo : SubtargetFeature<"kryo", "ARMProcFamily", "Kryo", 768 "Qualcomm Kryo processors", []>; 769def ProcSwift : SubtargetFeature<"swift", "ARMProcFamily", "Swift", 770 "Swift ARM processors", []>; 771 772def ProcExynos : SubtargetFeature<"exynos", "ARMProcFamily", "Exynos", 773 "Samsung Exynos processors", 774 [FeatureZCZeroing, 775 FeatureUseWideStrideVFP, 776 FeatureSplatVFPToNeon, 777 FeatureSlowVGETLNi32, 778 FeatureSlowVDUP32, 779 FeatureSlowFPBrcc, 780 FeatureProfUnpredicate, 781 FeatureHWDivThumb, 782 FeatureHWDivARM, 783 FeatureHasSlowFPVMLx, 784 FeatureHasSlowFPVFMx, 785 FeatureHasRetAddrStack, 786 FeatureFuseLiterals, 787 FeatureFuseAES, 788 FeatureExpandMLx, 789 FeatureCrypto, 790 FeatureCRC]>; 791 792def ProcR4 : SubtargetFeature<"r4", "ARMProcFamily", "CortexR4", 793 "Cortex-R4 ARM processors", []>; 794def ProcR5 : SubtargetFeature<"r5", "ARMProcFamily", "CortexR5", 795 "Cortex-R5 ARM processors", []>; 796def ProcR7 : SubtargetFeature<"r7", "ARMProcFamily", "CortexR7", 797 "Cortex-R7 ARM processors", []>; 798def ProcR52 : SubtargetFeature<"r52", "ARMProcFamily", "CortexR52", 799 "Cortex-R52 ARM processors", []>; 800 801def ProcM3 : SubtargetFeature<"m3", "ARMProcFamily", "CortexM3", 802 "Cortex-M3 ARM processors", []>; 803def ProcM7 : SubtargetFeature<"m7", "ARMProcFamily", "CortexM7", 804 "Cortex-M7 ARM processors", []>; 805 806//===----------------------------------------------------------------------===// 807// ARM Helper classes. 808// 809 810class Architecture<string fname, string aname, list<SubtargetFeature> features> 811 : SubtargetFeature<fname, "ARMArch", aname, 812 !strconcat(aname, " architecture"), features>; 813 814class ProcNoItin<string Name, list<SubtargetFeature> Features> 815 : Processor<Name, NoItineraries, Features>; 816 817 818//===----------------------------------------------------------------------===// 819// ARM architectures 820// 821 822def ARMv2 : Architecture<"armv2", "ARMv2", []>; 823 824def ARMv2a : Architecture<"armv2a", "ARMv2a", []>; 825 826def ARMv3 : Architecture<"armv3", "ARMv3", []>; 827 828def ARMv3m : Architecture<"armv3m", "ARMv3m", []>; 829 830def ARMv4 : Architecture<"armv4", "ARMv4", []>; 831 832def ARMv4t : Architecture<"armv4t", "ARMv4t", [HasV4TOps]>; 833 834def ARMv5t : Architecture<"armv5t", "ARMv5t", [HasV5TOps]>; 835 836def ARMv5te : Architecture<"armv5te", "ARMv5te", [HasV5TEOps]>; 837 838def ARMv5tej : Architecture<"armv5tej", "ARMv5tej", [HasV5TEOps]>; 839 840def ARMv6 : Architecture<"armv6", "ARMv6", [HasV6Ops, 841 FeatureDSP]>; 842 843def ARMv6t2 : Architecture<"armv6t2", "ARMv6t2", [HasV6T2Ops, 844 FeatureDSP]>; 845 846def ARMv6k : Architecture<"armv6k", "ARMv6k", [HasV6KOps]>; 847 848def ARMv6kz : Architecture<"armv6kz", "ARMv6kz", [HasV6KOps, 849 FeatureTrustZone]>; 850 851def ARMv6m : Architecture<"armv6-m", "ARMv6m", [HasV6MOps, 852 FeatureNoARM, 853 ModeThumb, 854 FeatureDB, 855 FeatureMClass, 856 FeatureStrictAlign]>; 857 858def ARMv6sm : Architecture<"armv6s-m", "ARMv6sm", [HasV6MOps, 859 FeatureNoARM, 860 ModeThumb, 861 FeatureDB, 862 FeatureMClass, 863 FeatureStrictAlign]>; 864 865def ARMv7a : Architecture<"armv7-a", "ARMv7a", [HasV7Ops, 866 FeatureNEON, 867 FeatureDB, 868 FeatureDSP, 869 FeatureAClass, 870 FeaturePerfMon]>; 871 872def ARMv7ve : Architecture<"armv7ve", "ARMv7ve", [HasV7Ops, 873 FeatureNEON, 874 FeatureDB, 875 FeatureDSP, 876 FeatureTrustZone, 877 FeatureMP, 878 FeatureVirtualization, 879 FeatureAClass, 880 FeaturePerfMon]>; 881 882def ARMv7r : Architecture<"armv7-r", "ARMv7r", [HasV7Ops, 883 FeatureDB, 884 FeatureDSP, 885 FeatureHWDivThumb, 886 FeatureRClass, 887 FeaturePerfMon]>; 888 889def ARMv7m : Architecture<"armv7-m", "ARMv7m", [HasV7Ops, 890 FeatureThumb2, 891 FeatureNoARM, 892 ModeThumb, 893 FeatureDB, 894 FeatureHWDivThumb, 895 FeatureMClass]>; 896 897def ARMv7em : Architecture<"armv7e-m", "ARMv7em", [HasV7Ops, 898 FeatureThumb2, 899 FeatureNoARM, 900 ModeThumb, 901 FeatureDB, 902 FeatureHWDivThumb, 903 FeatureMClass, 904 FeatureDSP]>; 905 906def ARMv8a : Architecture<"armv8-a", "ARMv8a", [HasV8Ops, 907 FeatureAClass, 908 FeatureDB, 909 FeatureFPARMv8, 910 FeatureNEON, 911 FeatureDSP, 912 FeatureTrustZone, 913 FeatureMP, 914 FeatureVirtualization, 915 FeatureCrypto, 916 FeatureCRC]>; 917 918def ARMv81a : Architecture<"armv8.1-a", "ARMv81a", [HasV8_1aOps, 919 FeatureAClass, 920 FeatureDB, 921 FeatureFPARMv8, 922 FeatureNEON, 923 FeatureDSP, 924 FeatureTrustZone, 925 FeatureMP, 926 FeatureVirtualization, 927 FeatureCrypto, 928 FeatureCRC]>; 929 930def ARMv82a : Architecture<"armv8.2-a", "ARMv82a", [HasV8_2aOps, 931 FeatureAClass, 932 FeatureDB, 933 FeatureFPARMv8, 934 FeatureNEON, 935 FeatureDSP, 936 FeatureTrustZone, 937 FeatureMP, 938 FeatureVirtualization, 939 FeatureCrypto, 940 FeatureCRC, 941 FeatureRAS]>; 942 943def ARMv83a : Architecture<"armv8.3-a", "ARMv83a", [HasV8_3aOps, 944 FeatureAClass, 945 FeatureDB, 946 FeatureFPARMv8, 947 FeatureNEON, 948 FeatureDSP, 949 FeatureTrustZone, 950 FeatureMP, 951 FeatureVirtualization, 952 FeatureCrypto, 953 FeatureCRC, 954 FeatureRAS]>; 955 956def ARMv84a : Architecture<"armv8.4-a", "ARMv84a", [HasV8_4aOps, 957 FeatureAClass, 958 FeatureDB, 959 FeatureFPARMv8, 960 FeatureNEON, 961 FeatureDSP, 962 FeatureTrustZone, 963 FeatureMP, 964 FeatureVirtualization, 965 FeatureCrypto, 966 FeatureCRC, 967 FeatureRAS, 968 FeatureDotProd]>; 969 970def ARMv85a : Architecture<"armv8.5-a", "ARMv85a", [HasV8_5aOps, 971 FeatureAClass, 972 FeatureDB, 973 FeatureFPARMv8, 974 FeatureNEON, 975 FeatureDSP, 976 FeatureTrustZone, 977 FeatureMP, 978 FeatureVirtualization, 979 FeatureCrypto, 980 FeatureCRC, 981 FeatureRAS, 982 FeatureDotProd]>; 983def ARMv86a : Architecture<"armv8.6-a", "ARMv86a", [HasV8_6aOps, 984 FeatureAClass, 985 FeatureDB, 986 FeatureFPARMv8, 987 FeatureNEON, 988 FeatureDSP, 989 FeatureTrustZone, 990 FeatureMP, 991 FeatureVirtualization, 992 FeatureCrypto, 993 FeatureCRC, 994 FeatureRAS, 995 FeatureDotProd]>; 996def ARMv87a : Architecture<"armv8.7-a", "ARMv87a", [HasV8_7aOps, 997 FeatureAClass, 998 FeatureDB, 999 FeatureFPARMv8, 1000 FeatureNEON, 1001 FeatureDSP, 1002 FeatureTrustZone, 1003 FeatureMP, 1004 FeatureVirtualization, 1005 FeatureCrypto, 1006 FeatureCRC, 1007 FeatureRAS, 1008 FeatureDotProd]>; 1009def ARMv88a : Architecture<"armv8.8-a", "ARMv88a", [HasV8_8aOps, 1010 FeatureAClass, 1011 FeatureDB, 1012 FeatureFPARMv8, 1013 FeatureNEON, 1014 FeatureDSP, 1015 FeatureTrustZone, 1016 FeatureMP, 1017 FeatureVirtualization, 1018 FeatureCrypto, 1019 FeatureCRC, 1020 FeatureRAS, 1021 FeatureDotProd]>; 1022 1023def ARMv9a : Architecture<"armv9-a", "ARMv9a", [HasV9_0aOps, 1024 FeatureAClass, 1025 FeatureDB, 1026 FeatureFPARMv8, 1027 FeatureNEON, 1028 FeatureDSP, 1029 FeatureTrustZone, 1030 FeatureMP, 1031 FeatureVirtualization, 1032 FeatureCRC, 1033 FeatureRAS, 1034 FeatureDotProd]>; 1035def ARMv91a : Architecture<"armv9.1-a", "ARMv91a", [HasV9_1aOps, 1036 FeatureAClass, 1037 FeatureDB, 1038 FeatureFPARMv8, 1039 FeatureNEON, 1040 FeatureDSP, 1041 FeatureTrustZone, 1042 FeatureMP, 1043 FeatureVirtualization, 1044 FeatureCRC, 1045 FeatureRAS, 1046 FeatureDotProd]>; 1047def ARMv92a : Architecture<"armv9.2-a", "ARMv92a", [HasV9_2aOps, 1048 FeatureAClass, 1049 FeatureDB, 1050 FeatureFPARMv8, 1051 FeatureNEON, 1052 FeatureDSP, 1053 FeatureTrustZone, 1054 FeatureMP, 1055 FeatureVirtualization, 1056 FeatureCRC, 1057 FeatureRAS, 1058 FeatureDotProd]>; 1059def ARMv93a : Architecture<"armv9.3-a", "ARMv93a", [HasV9_3aOps, 1060 FeatureAClass, 1061 FeatureDB, 1062 FeatureFPARMv8, 1063 FeatureNEON, 1064 FeatureDSP, 1065 FeatureTrustZone, 1066 FeatureMP, 1067 FeatureVirtualization, 1068 FeatureCrypto, 1069 FeatureCRC, 1070 FeatureRAS, 1071 FeatureDotProd]>; 1072 1073def ARMv8r : Architecture<"armv8-r", "ARMv8r", [HasV8Ops, 1074 FeatureRClass, 1075 FeatureDB, 1076 FeatureDFB, 1077 FeatureDSP, 1078 FeatureCRC, 1079 FeatureMP, 1080 FeatureVirtualization, 1081 FeatureFPARMv8, 1082 FeatureNEON]>; 1083 1084def ARMv8mBaseline : Architecture<"armv8-m.base", "ARMv8mBaseline", 1085 [HasV8MBaselineOps, 1086 FeatureNoARM, 1087 ModeThumb, 1088 FeatureDB, 1089 FeatureHWDivThumb, 1090 FeatureV7Clrex, 1091 Feature8MSecExt, 1092 FeatureAcquireRelease, 1093 FeatureMClass, 1094 FeatureStrictAlign]>; 1095 1096def ARMv8mMainline : Architecture<"armv8-m.main", "ARMv8mMainline", 1097 [HasV8MMainlineOps, 1098 FeatureNoARM, 1099 ModeThumb, 1100 FeatureDB, 1101 FeatureHWDivThumb, 1102 Feature8MSecExt, 1103 FeatureAcquireRelease, 1104 FeatureMClass]>; 1105 1106def ARMv81mMainline : Architecture<"armv8.1-m.main", "ARMv81mMainline", 1107 [HasV8_1MMainlineOps, 1108 FeatureNoARM, 1109 ModeThumb, 1110 FeatureDB, 1111 FeatureHWDivThumb, 1112 Feature8MSecExt, 1113 FeatureAcquireRelease, 1114 FeatureMClass, 1115 FeatureRAS, 1116 FeatureLOB]>; 1117 1118// Aliases 1119def IWMMXT : Architecture<"iwmmxt", "ARMv5te", [ARMv5te]>; 1120def IWMMXT2 : Architecture<"iwmmxt2", "ARMv5te", [ARMv5te]>; 1121def XScale : Architecture<"xscale", "ARMv5te", [ARMv5te]>; 1122def ARMv6j : Architecture<"armv6j", "ARMv7a", [ARMv6]>; 1123def ARMv7k : Architecture<"armv7k", "ARMv7a", [ARMv7a]>; 1124def ARMv7s : Architecture<"armv7s", "ARMv7a", [ARMv7a]>; 1125 1126//===----------------------------------------------------------------------===// 1127// Register File Description 1128//===----------------------------------------------------------------------===// 1129 1130include "ARMRegisterInfo.td" 1131include "ARMRegisterBanks.td" 1132include "ARMCallingConv.td" 1133 1134//===----------------------------------------------------------------------===// 1135// ARM schedules. 1136//===----------------------------------------------------------------------===// 1137// 1138include "ARMPredicates.td" 1139include "ARMSchedule.td" 1140 1141//===----------------------------------------------------------------------===// 1142// Instruction Descriptions 1143//===----------------------------------------------------------------------===// 1144 1145include "ARMInstrInfo.td" 1146def ARMInstrInfo : InstrInfo; 1147 1148//===----------------------------------------------------------------------===// 1149// ARM schedules 1150// 1151include "ARMScheduleV6.td" 1152include "ARMScheduleA8.td" 1153include "ARMScheduleA9.td" 1154include "ARMScheduleSwift.td" 1155include "ARMScheduleR52.td" 1156include "ARMScheduleA57.td" 1157include "ARMScheduleM4.td" 1158include "ARMScheduleM7.td" 1159 1160//===----------------------------------------------------------------------===// 1161// ARM processors 1162// 1163// Dummy CPU, used to target architectures 1164def : ProcessorModel<"generic", CortexA8Model, [FeatureFixCortexA57AES1742098]>; 1165 1166// FIXME: Several processors below are not using their own scheduler 1167// model, but one of similar/previous processor. These should be fixed. 1168 1169def : ProcNoItin<"arm8", [ARMv4]>; 1170def : ProcNoItin<"arm810", [ARMv4]>; 1171def : ProcNoItin<"strongarm", [ARMv4]>; 1172def : ProcNoItin<"strongarm110", [ARMv4]>; 1173def : ProcNoItin<"strongarm1100", [ARMv4]>; 1174def : ProcNoItin<"strongarm1110", [ARMv4]>; 1175 1176def : ProcNoItin<"arm7tdmi", [ARMv4t]>; 1177def : ProcNoItin<"arm7tdmi-s", [ARMv4t]>; 1178def : ProcNoItin<"arm710t", [ARMv4t]>; 1179def : ProcNoItin<"arm720t", [ARMv4t]>; 1180def : ProcNoItin<"arm9", [ARMv4t]>; 1181def : ProcNoItin<"arm9tdmi", [ARMv4t]>; 1182def : ProcNoItin<"arm920", [ARMv4t]>; 1183def : ProcNoItin<"arm920t", [ARMv4t]>; 1184def : ProcNoItin<"arm922t", [ARMv4t]>; 1185def : ProcNoItin<"arm940t", [ARMv4t]>; 1186def : ProcNoItin<"ep9312", [ARMv4t]>; 1187 1188def : ProcNoItin<"arm10tdmi", [ARMv5t]>; 1189def : ProcNoItin<"arm1020t", [ARMv5t]>; 1190 1191def : ProcNoItin<"arm9e", [ARMv5te]>; 1192def : ProcNoItin<"arm926ej-s", [ARMv5te]>; 1193def : ProcNoItin<"arm946e-s", [ARMv5te]>; 1194def : ProcNoItin<"arm966e-s", [ARMv5te]>; 1195def : ProcNoItin<"arm968e-s", [ARMv5te]>; 1196def : ProcNoItin<"arm10e", [ARMv5te]>; 1197def : ProcNoItin<"arm1020e", [ARMv5te]>; 1198def : ProcNoItin<"arm1022e", [ARMv5te]>; 1199def : ProcNoItin<"xscale", [ARMv5te]>; 1200def : ProcNoItin<"iwmmxt", [ARMv5te]>; 1201 1202def : Processor<"arm1136j-s", ARMV6Itineraries, [ARMv6]>; 1203def : Processor<"arm1136jf-s", ARMV6Itineraries, [ARMv6, 1204 FeatureVFP2, 1205 FeatureHasSlowFPVMLx]>; 1206 1207def : Processor<"cortex-m0", ARMV6Itineraries, [ARMv6m, 1208 FeatureHasNoBranchPredictor]>; 1209def : Processor<"cortex-m0plus", ARMV6Itineraries, [ARMv6m, 1210 FeatureHasNoBranchPredictor]>; 1211def : Processor<"cortex-m1", ARMV6Itineraries, [ARMv6m, 1212 FeatureHasNoBranchPredictor]>; 1213def : Processor<"sc000", ARMV6Itineraries, [ARMv6m, 1214 FeatureHasNoBranchPredictor]>; 1215 1216def : Processor<"arm1176jz-s", ARMV6Itineraries, [ARMv6kz]>; 1217def : Processor<"arm1176jzf-s", ARMV6Itineraries, [ARMv6kz, 1218 FeatureVFP2, 1219 FeatureHasSlowFPVMLx]>; 1220 1221def : Processor<"mpcorenovfp", ARMV6Itineraries, [ARMv6k]>; 1222def : Processor<"mpcore", ARMV6Itineraries, [ARMv6k, 1223 FeatureVFP2, 1224 FeatureHasSlowFPVMLx]>; 1225 1226def : Processor<"arm1156t2-s", ARMV6Itineraries, [ARMv6t2]>; 1227def : Processor<"arm1156t2f-s", ARMV6Itineraries, [ARMv6t2, 1228 FeatureVFP2, 1229 FeatureHasSlowFPVMLx]>; 1230 1231def : ProcessorModel<"cortex-a5", CortexA8Model, [ARMv7a, ProcA5, 1232 FeatureHasRetAddrStack, 1233 FeatureTrustZone, 1234 FeatureSlowFPBrcc, 1235 FeatureHasSlowFPVMLx, 1236 FeatureHasSlowFPVFMx, 1237 FeatureVMLxForwarding, 1238 FeatureMP, 1239 FeatureVFP4]>; 1240 1241def : ProcessorModel<"cortex-a7", CortexA8Model, [ARMv7a, ProcA7, 1242 FeatureHasRetAddrStack, 1243 FeatureTrustZone, 1244 FeatureSlowFPBrcc, 1245 FeatureHasVMLxHazards, 1246 FeatureHasSlowFPVMLx, 1247 FeatureHasSlowFPVFMx, 1248 FeatureVMLxForwarding, 1249 FeatureMP, 1250 FeatureVFP4, 1251 FeatureVirtualization]>; 1252 1253def : ProcessorModel<"cortex-a8", CortexA8Model, [ARMv7a, ProcA8, 1254 FeatureHasRetAddrStack, 1255 FeatureNonpipelinedVFP, 1256 FeatureTrustZone, 1257 FeatureSlowFPBrcc, 1258 FeatureHasVMLxHazards, 1259 FeatureHasSlowFPVMLx, 1260 FeatureHasSlowFPVFMx, 1261 FeatureVMLxForwarding]>; 1262 1263def : ProcessorModel<"cortex-a9", CortexA9Model, [ARMv7a, ProcA9, 1264 FeatureHasRetAddrStack, 1265 FeatureTrustZone, 1266 FeatureHasVMLxHazards, 1267 FeatureVMLxForwarding, 1268 FeatureFP16, 1269 FeatureAvoidPartialCPSR, 1270 FeatureExpandMLx, 1271 FeaturePreferVMOVSR, 1272 FeatureMuxedUnits, 1273 FeatureNEONForFPMovs, 1274 FeatureCheckVLDnAlign, 1275 FeatureMP]>; 1276 1277def : ProcessorModel<"cortex-a12", CortexA9Model, [ARMv7a, ProcA12, 1278 FeatureHasRetAddrStack, 1279 FeatureTrustZone, 1280 FeatureVMLxForwarding, 1281 FeatureVFP4, 1282 FeatureAvoidPartialCPSR, 1283 FeatureVirtualization, 1284 FeatureMP]>; 1285 1286def : ProcessorModel<"cortex-a15", CortexA9Model, [ARMv7a, ProcA15, 1287 FeatureDontWidenVMOVS, 1288 FeatureSplatVFPToNeon, 1289 FeatureHasRetAddrStack, 1290 FeatureMuxedUnits, 1291 FeatureTrustZone, 1292 FeatureVFP4, 1293 FeatureMP, 1294 FeatureCheckVLDnAlign, 1295 FeatureAvoidPartialCPSR, 1296 FeatureVirtualization]>; 1297 1298def : ProcessorModel<"cortex-a17", CortexA9Model, [ARMv7a, ProcA17, 1299 FeatureHasRetAddrStack, 1300 FeatureTrustZone, 1301 FeatureMP, 1302 FeatureVMLxForwarding, 1303 FeatureVFP4, 1304 FeatureAvoidPartialCPSR, 1305 FeatureVirtualization]>; 1306 1307// FIXME: krait has currently the same features as A9 plus VFP4 and HWDiv 1308def : ProcessorModel<"krait", CortexA9Model, [ARMv7a, ProcKrait, 1309 FeatureHasRetAddrStack, 1310 FeatureMuxedUnits, 1311 FeatureCheckVLDnAlign, 1312 FeatureVMLxForwarding, 1313 FeatureFP16, 1314 FeatureAvoidPartialCPSR, 1315 FeatureVFP4, 1316 FeatureHWDivThumb, 1317 FeatureHWDivARM]>; 1318 1319def : ProcessorModel<"swift", SwiftModel, [ARMv7a, ProcSwift, 1320 FeatureHasRetAddrStack, 1321 FeatureNEONForFP, 1322 FeatureVFP4, 1323 FeatureUseWideStrideVFP, 1324 FeatureMP, 1325 FeatureHWDivThumb, 1326 FeatureHWDivARM, 1327 FeatureAvoidPartialCPSR, 1328 FeatureAvoidMOVsShOp, 1329 FeatureHasSlowFPVMLx, 1330 FeatureHasSlowFPVFMx, 1331 FeatureHasVMLxHazards, 1332 FeatureProfUnpredicate, 1333 FeaturePrefISHSTBarrier, 1334 FeatureSlowOddRegister, 1335 FeatureSlowLoadDSubreg, 1336 FeatureSlowVGETLNi32, 1337 FeatureSlowVDUP32, 1338 FeatureUseMISched, 1339 FeatureNoPostRASched]>; 1340 1341def : ProcessorModel<"cortex-r4", CortexA8Model, [ARMv7r, ProcR4, 1342 FeatureHasRetAddrStack, 1343 FeatureAvoidPartialCPSR]>; 1344 1345def : ProcessorModel<"cortex-r4f", CortexA8Model, [ARMv7r, ProcR4, 1346 FeatureHasRetAddrStack, 1347 FeatureSlowFPBrcc, 1348 FeatureHasSlowFPVMLx, 1349 FeatureHasSlowFPVFMx, 1350 FeatureVFP3_D16, 1351 FeatureAvoidPartialCPSR]>; 1352 1353def : ProcessorModel<"cortex-r5", CortexA8Model, [ARMv7r, ProcR5, 1354 FeatureHasRetAddrStack, 1355 FeatureVFP3_D16, 1356 FeatureSlowFPBrcc, 1357 FeatureHWDivARM, 1358 FeatureHasSlowFPVMLx, 1359 FeatureHasSlowFPVFMx, 1360 FeatureAvoidPartialCPSR]>; 1361 1362def : ProcessorModel<"cortex-r7", CortexA8Model, [ARMv7r, ProcR7, 1363 FeatureHasRetAddrStack, 1364 FeatureVFP3_D16, 1365 FeatureFP16, 1366 FeatureMP, 1367 FeatureSlowFPBrcc, 1368 FeatureHWDivARM, 1369 FeatureHasSlowFPVMLx, 1370 FeatureHasSlowFPVFMx, 1371 FeatureAvoidPartialCPSR]>; 1372 1373def : ProcessorModel<"cortex-r8", CortexA8Model, [ARMv7r, 1374 FeatureHasRetAddrStack, 1375 FeatureVFP3_D16, 1376 FeatureFP16, 1377 FeatureMP, 1378 FeatureSlowFPBrcc, 1379 FeatureHWDivARM, 1380 FeatureHasSlowFPVMLx, 1381 FeatureHasSlowFPVFMx, 1382 FeatureAvoidPartialCPSR]>; 1383 1384def : ProcessorModel<"cortex-m3", CortexM4Model, [ARMv7m, 1385 ProcM3, 1386 FeaturePrefLoopAlign32, 1387 FeatureUseMISched, 1388 FeatureHasNoBranchPredictor]>; 1389 1390def : ProcessorModel<"sc300", CortexM4Model, [ARMv7m, 1391 ProcM3, 1392 FeatureUseMISched, 1393 FeatureHasNoBranchPredictor]>; 1394 1395def : ProcessorModel<"cortex-m4", CortexM4Model, [ARMv7em, 1396 FeatureVFP4_D16_SP, 1397 FeaturePrefLoopAlign32, 1398 FeatureHasSlowFPVMLx, 1399 FeatureHasSlowFPVFMx, 1400 FeatureUseMISched, 1401 FeatureHasNoBranchPredictor]>; 1402 1403def : ProcessorModel<"cortex-m7", CortexM7Model, [ARMv7em, 1404 ProcM7, 1405 FeatureFPARMv8_D16, 1406 FeatureUseMIPipeliner, 1407 FeatureUseMISched]>; 1408 1409def : ProcNoItin<"cortex-m23", [ARMv8mBaseline, 1410 FeatureNoMovt, 1411 FeatureHasNoBranchPredictor]>; 1412 1413def : ProcessorModel<"cortex-m33", CortexM4Model, [ARMv8mMainline, 1414 FeatureDSP, 1415 FeatureFPARMv8_D16_SP, 1416 FeaturePrefLoopAlign32, 1417 FeatureHasSlowFPVMLx, 1418 FeatureHasSlowFPVFMx, 1419 FeatureUseMISched, 1420 FeatureHasNoBranchPredictor, 1421 FeatureFixCMSE_CVE_2021_35465]>; 1422 1423def : ProcessorModel<"cortex-m35p", CortexM4Model, [ARMv8mMainline, 1424 FeatureDSP, 1425 FeatureFPARMv8_D16_SP, 1426 FeaturePrefLoopAlign32, 1427 FeatureHasSlowFPVMLx, 1428 FeatureHasSlowFPVFMx, 1429 FeatureUseMISched, 1430 FeatureHasNoBranchPredictor, 1431 FeatureFixCMSE_CVE_2021_35465]>; 1432 1433def : ProcessorModel<"cortex-m55", CortexM4Model, [ARMv81mMainline, 1434 FeatureDSP, 1435 FeatureFPARMv8_D16, 1436 FeatureUseMISched, 1437 FeatureHasNoBranchPredictor, 1438 FeaturePrefLoopAlign32, 1439 FeatureHasSlowFPVMLx, 1440 HasMVEFloatOps, 1441 FeatureFixCMSE_CVE_2021_35465]>; 1442 1443def : ProcNoItin<"cortex-a32", [ARMv8a, 1444 FeatureHWDivThumb, 1445 FeatureHWDivARM, 1446 FeatureCrypto, 1447 FeatureCRC]>; 1448 1449def : ProcNoItin<"cortex-a35", [ARMv8a, ProcA35, 1450 FeatureHWDivThumb, 1451 FeatureHWDivARM, 1452 FeatureCrypto, 1453 FeatureCRC]>; 1454 1455def : ProcNoItin<"cortex-a53", [ARMv8a, ProcA53, 1456 FeatureHWDivThumb, 1457 FeatureHWDivARM, 1458 FeatureCrypto, 1459 FeatureCRC, 1460 FeatureFPAO]>; 1461 1462def : ProcNoItin<"cortex-a55", [ARMv82a, ProcA55, 1463 FeatureHWDivThumb, 1464 FeatureHWDivARM, 1465 FeatureDotProd]>; 1466 1467def : ProcessorModel<"cortex-a57", CortexA57Model, [ARMv8a, ProcA57, 1468 FeatureHWDivThumb, 1469 FeatureHWDivARM, 1470 FeatureCrypto, 1471 FeatureCRC, 1472 FeatureFPAO, 1473 FeatureAvoidPartialCPSR, 1474 FeatureCheapPredicableCPSR, 1475 FeatureFixCortexA57AES1742098]>; 1476 1477def : ProcessorModel<"cortex-a72", CortexA57Model, [ARMv8a, ProcA72, 1478 FeatureHWDivThumb, 1479 FeatureHWDivARM, 1480 FeatureCrypto, 1481 FeatureCRC, 1482 FeatureFixCortexA57AES1742098]>; 1483 1484def : ProcNoItin<"cortex-a73", [ARMv8a, ProcA73, 1485 FeatureHWDivThumb, 1486 FeatureHWDivARM, 1487 FeatureCrypto, 1488 FeatureCRC]>; 1489 1490def : ProcNoItin<"cortex-a75", [ARMv82a, ProcA75, 1491 FeatureHWDivThumb, 1492 FeatureHWDivARM, 1493 FeatureDotProd]>; 1494 1495def : ProcNoItin<"cortex-a76", [ARMv82a, ProcA76, 1496 FeatureHWDivThumb, 1497 FeatureHWDivARM, 1498 FeatureCrypto, 1499 FeatureCRC, 1500 FeatureFullFP16, 1501 FeatureDotProd]>; 1502 1503def : ProcNoItin<"cortex-a76ae", [ARMv82a, ProcA76, 1504 FeatureHWDivThumb, 1505 FeatureHWDivARM, 1506 FeatureCrypto, 1507 FeatureCRC, 1508 FeatureFullFP16, 1509 FeatureDotProd]>; 1510 1511def : ProcNoItin<"cortex-a77", [ARMv82a, ProcA77, 1512 FeatureHWDivThumb, 1513 FeatureHWDivARM, 1514 FeatureCrypto, 1515 FeatureCRC, 1516 FeatureFullFP16, 1517 FeatureDotProd]>; 1518 1519def : ProcNoItin<"cortex-a78", [ARMv82a, ProcA78, 1520 FeatureHWDivThumb, 1521 FeatureHWDivARM, 1522 FeatureCrypto, 1523 FeatureCRC, 1524 FeatureFullFP16, 1525 FeatureDotProd]>; 1526 1527def : ProcNoItin<"cortex-a78c", [ARMv82a, ProcA78C, 1528 FeatureHWDivThumb, 1529 FeatureHWDivARM, 1530 FeatureCrypto, 1531 FeatureCRC, 1532 FeatureDotProd, 1533 FeatureFullFP16]>; 1534 1535def : ProcNoItin<"cortex-a710", [ARMv9a, ProcA710, 1536 FeatureHWDivThumb, 1537 FeatureHWDivARM, 1538 FeatureFP16FML, 1539 FeatureBF16, 1540 FeatureMatMulInt8, 1541 FeatureSB]>; 1542 1543def : ProcNoItin<"cortex-x1", [ARMv82a, ProcX1, 1544 FeatureHWDivThumb, 1545 FeatureHWDivARM, 1546 FeatureCrypto, 1547 FeatureCRC, 1548 FeatureFullFP16, 1549 FeatureDotProd]>; 1550 1551def : ProcNoItin<"cortex-x1c", [ARMv82a, ProcX1C, 1552 FeatureHWDivThumb, 1553 FeatureHWDivARM, 1554 FeatureCrypto, 1555 FeatureCRC, 1556 FeatureFullFP16, 1557 FeatureDotProd]>; 1558 1559def : ProcNoItin<"neoverse-v1", [ARMv84a, 1560 FeatureHWDivThumb, 1561 FeatureHWDivARM, 1562 FeatureCrypto, 1563 FeatureCRC, 1564 FeatureFullFP16, 1565 FeatureBF16, 1566 FeatureMatMulInt8]>; 1567 1568def : ProcNoItin<"neoverse-n1", [ARMv82a, 1569 FeatureHWDivThumb, 1570 FeatureHWDivARM, 1571 FeatureCrypto, 1572 FeatureCRC, 1573 FeatureDotProd]>; 1574 1575def : ProcNoItin<"neoverse-n2", [ARMv85a, 1576 FeatureBF16, 1577 FeatureMatMulInt8]>; 1578 1579def : ProcessorModel<"cyclone", SwiftModel, [ARMv8a, ProcSwift, 1580 FeatureHasRetAddrStack, 1581 FeatureNEONForFP, 1582 FeatureVFP4, 1583 FeatureMP, 1584 FeatureHWDivThumb, 1585 FeatureHWDivARM, 1586 FeatureAvoidPartialCPSR, 1587 FeatureAvoidMOVsShOp, 1588 FeatureHasSlowFPVMLx, 1589 FeatureHasSlowFPVFMx, 1590 FeatureCrypto, 1591 FeatureUseMISched, 1592 FeatureZCZeroing, 1593 FeatureNoPostRASched]>; 1594 1595def : ProcNoItin<"exynos-m3", [ARMv8a, ProcExynos]>; 1596def : ProcNoItin<"exynos-m4", [ARMv82a, ProcExynos, 1597 FeatureFullFP16, 1598 FeatureDotProd]>; 1599def : ProcNoItin<"exynos-m5", [ARMv82a, ProcExynos, 1600 FeatureFullFP16, 1601 FeatureDotProd]>; 1602 1603def : ProcNoItin<"kryo", [ARMv8a, ProcKryo, 1604 FeatureHWDivThumb, 1605 FeatureHWDivARM, 1606 FeatureCrypto, 1607 FeatureCRC]>; 1608 1609def : ProcessorModel<"cortex-r52", CortexR52Model, [ARMv8r, ProcR52, 1610 FeatureUseMISched, 1611 FeatureFPAO]>; 1612 1613//===----------------------------------------------------------------------===// 1614// Declare the target which we are implementing 1615//===----------------------------------------------------------------------===// 1616 1617def ARMAsmWriter : AsmWriter { 1618 string AsmWriterClassName = "InstPrinter"; 1619 int PassSubtarget = 1; 1620 int Variant = 0; 1621 bit isMCAsmWriter = 1; 1622} 1623 1624def ARMAsmParser : AsmParser { 1625 bit ReportMultipleNearMisses = 1; 1626} 1627 1628def ARMAsmParserVariant : AsmParserVariant { 1629 int Variant = 0; 1630 string Name = "ARM"; 1631 string BreakCharacters = "."; 1632} 1633 1634def ARM : Target { 1635 // Pull in Instruction Info. 1636 let InstructionSet = ARMInstrInfo; 1637 let AssemblyWriters = [ARMAsmWriter]; 1638 let AssemblyParsers = [ARMAsmParser]; 1639 let AssemblyParserVariants = [ARMAsmParserVariant]; 1640 let AllowRegisterRenaming = 1; 1641} 1642