AArch64.td 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525
  1. //=- AArch64.td - Describe the AArch64 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. // Target-independent interfaces which we are implementing.
  13. //===----------------------------------------------------------------------===//
  14. include "llvm/Target/Target.td"
  15. //===----------------------------------------------------------------------===//
  16. // AArch64 Subtarget features.
  17. //
  18. // Each SubtargetFeature which corresponds to an Arm Architecture feature should
  19. // be annotated with the respective FEAT_ feature name from the Architecture
  20. // Reference Manual. If a SubtargetFeature enables instructions from multiple
  21. // Arm Architecture Features, it should list all the relevant features. Not all
  22. // FEAT_ features have a corresponding SubtargetFeature.
  23. def FeatureFPARMv8 : SubtargetFeature<"fp-armv8", "HasFPARMv8", "true",
  24. "Enable ARMv8 FP (FEAT_FP)">;
  25. def FeatureNEON : SubtargetFeature<"neon", "HasNEON", "true",
  26. "Enable Advanced SIMD instructions (FEAT_AdvSIMD)", [FeatureFPARMv8]>;
  27. def FeatureSM4 : SubtargetFeature<
  28. "sm4", "HasSM4", "true",
  29. "Enable SM3 and SM4 support (FEAT_SM4, FEAT_SM3)", [FeatureNEON]>;
  30. def FeatureSHA2 : SubtargetFeature<
  31. "sha2", "HasSHA2", "true",
  32. "Enable SHA1 and SHA256 support (FEAT_SHA1, FEAT_SHA256)", [FeatureNEON]>;
  33. def FeatureSHA3 : SubtargetFeature<
  34. "sha3", "HasSHA3", "true",
  35. "Enable SHA512 and SHA3 support (FEAT_SHA3, FEAT_SHA512)", [FeatureNEON, FeatureSHA2]>;
  36. def FeatureAES : SubtargetFeature<
  37. "aes", "HasAES", "true",
  38. "Enable AES support (FEAT_AES, FEAT_PMULL)", [FeatureNEON]>;
  39. // Crypto has been split up and any combination is now valid (see the
  40. // crypto definitions above). Also, crypto is now context sensitive:
  41. // it has a different meaning for e.g. Armv8.4 than it has for Armv8.2.
  42. // Therefore, we rely on Clang, the user interacing tool, to pass on the
  43. // appropriate crypto options. But here in the backend, crypto has very little
  44. // meaning anymore. We kept the Crypto definition here for backward
  45. // compatibility, and now imply features SHA2 and AES, which was the
  46. // "traditional" meaning of Crypto.
  47. def FeatureCrypto : SubtargetFeature<"crypto", "HasCrypto", "true",
  48. "Enable cryptographic instructions", [FeatureNEON, FeatureSHA2, FeatureAES]>;
  49. def FeatureCRC : SubtargetFeature<"crc", "HasCRC", "true",
  50. "Enable ARMv8 CRC-32 checksum instructions (FEAT_CRC32)">;
  51. def FeatureRAS : SubtargetFeature<"ras", "HasRAS", "true",
  52. "Enable ARMv8 Reliability, Availability and Serviceability Extensions (FEAT_RAS, FEAT_RASv1p1)">;
  53. def FeatureRASv2 : SubtargetFeature<"rasv2", "HasRASv2", "true",
  54. "Enable ARMv8.9-A Reliability, Availability and Serviceability Extensions (FEAT_RASv2)",
  55. [FeatureRAS]>;
  56. def FeatureLSE : SubtargetFeature<"lse", "HasLSE", "true",
  57. "Enable ARMv8.1 Large System Extension (LSE) atomic instructions (FEAT_LSE)">;
  58. def FeatureLSE2 : SubtargetFeature<"lse2", "HasLSE2", "true",
  59. "Enable ARMv8.4 Large System Extension 2 (LSE2) atomicity rules (FEAT_LSE2)">;
  60. def FeatureOutlineAtomics : SubtargetFeature<"outline-atomics", "OutlineAtomics", "true",
  61. "Enable out of line atomics to support LSE instructions">;
  62. def FeatureFMV : SubtargetFeature<"fmv", "HasFMV", "true",
  63. "Enable Function Multi Versioning support.">;
  64. def FeatureRDM : SubtargetFeature<"rdm", "HasRDM", "true",
  65. "Enable ARMv8.1 Rounding Double Multiply Add/Subtract instructions (FEAT_RDM)">;
  66. def FeaturePAN : SubtargetFeature<
  67. "pan", "HasPAN", "true",
  68. "Enables ARM v8.1 Privileged Access-Never extension (FEAT_PAN)">;
  69. def FeatureLOR : SubtargetFeature<
  70. "lor", "HasLOR", "true",
  71. "Enables ARM v8.1 Limited Ordering Regions extension (FEAT_LOR)">;
  72. def FeatureCONTEXTIDREL2 : SubtargetFeature<"CONTEXTIDREL2", "HasCONTEXTIDREL2",
  73. "true", "Enable RW operand CONTEXTIDR_EL2" >;
  74. def FeatureVH : SubtargetFeature<"vh", "HasVH", "true",
  75. "Enables ARM v8.1 Virtual Host extension (FEAT_VHE)", [FeatureCONTEXTIDREL2] >;
  76. // This SubtargetFeature is special. It controls only whether codegen will turn
  77. // `llvm.readcyclecounter()` into an access to a PMUv3 System Register. The
  78. // `FEAT_PMUv3*` system registers are always available for assembly/disassembly.
  79. def FeaturePerfMon : SubtargetFeature<"perfmon", "HasPerfMon", "true",
  80. "Enable Code Generation for ARMv8 PMUv3 Performance Monitors extension (FEAT_PMUv3)">;
  81. def FeatureFullFP16 : SubtargetFeature<"fullfp16", "HasFullFP16", "true",
  82. "Full FP16 (FEAT_FP16)", [FeatureFPARMv8]>;
  83. def FeatureFP16FML : SubtargetFeature<"fp16fml", "HasFP16FML", "true",
  84. "Enable FP16 FML instructions (FEAT_FHM)", [FeatureFullFP16]>;
  85. def FeatureSPE : SubtargetFeature<"spe", "HasSPE", "true",
  86. "Enable Statistical Profiling extension (FEAT_SPE)">;
  87. def FeaturePAN_RWV : SubtargetFeature<
  88. "pan-rwv", "HasPAN_RWV", "true",
  89. "Enable v8.2 PAN s1e1R and s1e1W Variants (FEAT_PAN2)",
  90. [FeaturePAN]>;
  91. // UAO PState
  92. def FeaturePsUAO : SubtargetFeature< "uaops", "HasPsUAO", "true",
  93. "Enable v8.2 UAO PState (FEAT_UAO)">;
  94. def FeatureCCPP : SubtargetFeature<"ccpp", "HasCCPP",
  95. "true", "Enable v8.2 data Cache Clean to Point of Persistence (FEAT_DPB)" >;
  96. def FeatureSVE : SubtargetFeature<"sve", "HasSVE", "true",
  97. "Enable Scalable Vector Extension (SVE) instructions (FEAT_SVE)", [FeatureFullFP16]>;
  98. // This flag is currently still labeled as Experimental, but when fully
  99. // implemented this should tell the compiler to use the zeroing pseudos to
  100. // benefit from the reverse instructions (e.g. SUB vs SUBR) if the inactive
  101. // lanes are known to be zero. The pseudos will then be expanded using the
  102. // MOVPRFX instruction to zero the inactive lanes. This feature should only be
  103. // enabled if MOVPRFX instructions are known to merge with the destructive
  104. // operations they prefix.
  105. //
  106. // This feature could similarly be extended to support cheap merging of _any_
  107. // value into the inactive lanes using the MOVPRFX instruction that uses
  108. // merging-predication.
  109. def FeatureExperimentalZeroingPseudos
  110. : SubtargetFeature<"use-experimental-zeroing-pseudos",
  111. "UseExperimentalZeroingPseudos", "true",
  112. "Hint to the compiler that the MOVPRFX instruction is "
  113. "merged with destructive operations",
  114. []>;
  115. def FeatureUseScalarIncVL : SubtargetFeature<"use-scalar-inc-vl",
  116. "UseScalarIncVL", "true", "Prefer inc/dec over add+cnt">;
  117. def FeatureSVE2 : SubtargetFeature<"sve2", "HasSVE2", "true",
  118. "Enable Scalable Vector Extension 2 (SVE2) instructions (FEAT_SVE2)",
  119. [FeatureSVE, FeatureUseScalarIncVL]>;
  120. def FeatureSVE2AES : SubtargetFeature<"sve2-aes", "HasSVE2AES", "true",
  121. "Enable AES SVE2 instructions (FEAT_SVE_AES, FEAT_SVE_PMULL128)",
  122. [FeatureSVE2, FeatureAES]>;
  123. def FeatureSVE2SM4 : SubtargetFeature<"sve2-sm4", "HasSVE2SM4", "true",
  124. "Enable SM4 SVE2 instructions (FEAT_SVE_SM4)", [FeatureSVE2, FeatureSM4]>;
  125. def FeatureSVE2SHA3 : SubtargetFeature<"sve2-sha3", "HasSVE2SHA3", "true",
  126. "Enable SHA3 SVE2 instructions (FEAT_SVE_SHA3)", [FeatureSVE2, FeatureSHA3]>;
  127. def FeatureSVE2BitPerm : SubtargetFeature<"sve2-bitperm", "HasSVE2BitPerm", "true",
  128. "Enable bit permutation SVE2 instructions (FEAT_SVE_BitPerm)", [FeatureSVE2]>;
  129. def FeatureSVE2p1: SubtargetFeature<"sve2p1", "HasSVE2p1", "true",
  130. "Enable Scalable Vector Extension 2.1 instructions", [FeatureSVE2]>;
  131. def FeatureB16B16 : SubtargetFeature<"b16b16", "HasB16B16", "true",
  132. "Enable SVE2.1 or SME2.1 non-widening BFloat16 to BFloat16 instructions (FEAT_B16B16)", []>;
  133. def FeatureZCRegMove : SubtargetFeature<"zcm", "HasZeroCycleRegMove", "true",
  134. "Has zero-cycle register moves">;
  135. def FeatureZCZeroingGP : SubtargetFeature<"zcz-gp", "HasZeroCycleZeroingGP", "true",
  136. "Has zero-cycle zeroing instructions for generic registers">;
  137. // It is generally beneficial to rewrite "fmov s0, wzr" to "movi d0, #0".
  138. // as movi is more efficient across all cores. Newer cores can eliminate
  139. // fmovs early and there is no difference with movi, but this not true for
  140. // all implementations.
  141. def FeatureNoZCZeroingFP : SubtargetFeature<"no-zcz-fp", "HasZeroCycleZeroingFP", "false",
  142. "Has no zero-cycle zeroing instructions for FP registers">;
  143. def FeatureZCZeroing : SubtargetFeature<"zcz", "HasZeroCycleZeroing", "true",
  144. "Has zero-cycle zeroing instructions",
  145. [FeatureZCZeroingGP]>;
  146. /// ... but the floating-point version doesn't quite work in rare cases on older
  147. /// CPUs.
  148. def FeatureZCZeroingFPWorkaround : SubtargetFeature<"zcz-fp-workaround",
  149. "HasZeroCycleZeroingFPWorkaround", "true",
  150. "The zero-cycle floating-point zeroing instruction has a bug">;
  151. def FeatureStrictAlign : SubtargetFeature<"strict-align",
  152. "RequiresStrictAlign", "true",
  153. "Disallow all unaligned memory "
  154. "access">;
  155. foreach i = {1-7,9-15,18,20-28,30} in
  156. def FeatureReserveX#i : SubtargetFeature<"reserve-x"#i, "ReserveXRegister["#i#"]", "true",
  157. "Reserve X"#i#", making it unavailable "
  158. "as a GPR">;
  159. foreach i = {8-15,18} in
  160. def FeatureCallSavedX#i : SubtargetFeature<"call-saved-x"#i,
  161. "CustomCallSavedXRegs["#i#"]", "true", "Make X"#i#" callee saved.">;
  162. def FeatureBalanceFPOps : SubtargetFeature<"balance-fp-ops", "BalanceFPOps",
  163. "true",
  164. "balance mix of odd and even D-registers for fp multiply(-accumulate) ops">;
  165. def FeaturePredictableSelectIsExpensive : SubtargetFeature<
  166. "predictable-select-expensive", "PredictableSelectIsExpensive", "true",
  167. "Prefer likely predicted branches over selects">;
  168. def FeatureEnableSelectOptimize : SubtargetFeature<
  169. "enable-select-opt", "EnableSelectOptimize", "true",
  170. "Enable the select optimize pass for select loop heuristics">;
  171. def FeatureCustomCheapAsMoveHandling : SubtargetFeature<"custom-cheap-as-move",
  172. "HasCustomCheapAsMoveHandling", "true",
  173. "Use custom handling of cheap instructions">;
  174. def FeatureExynosCheapAsMoveHandling : SubtargetFeature<"exynos-cheap-as-move",
  175. "HasExynosCheapAsMoveHandling", "true",
  176. "Use Exynos specific handling of cheap instructions",
  177. [FeatureCustomCheapAsMoveHandling]>;
  178. def FeaturePostRAScheduler : SubtargetFeature<"use-postra-scheduler",
  179. "UsePostRAScheduler", "true", "Schedule again after register allocation">;
  180. def FeatureSlowMisaligned128Store : SubtargetFeature<"slow-misaligned-128store",
  181. "IsMisaligned128StoreSlow", "true", "Misaligned 128 bit stores are slow">;
  182. def FeatureSlowPaired128 : SubtargetFeature<"slow-paired-128",
  183. "IsPaired128Slow", "true", "Paired 128 bit loads and stores are slow">;
  184. def FeatureAscendStoreAddress : SubtargetFeature<"ascend-store-address",
  185. "IsStoreAddressAscend", "true",
  186. "Schedule vector stores by ascending address">;
  187. def FeatureSlowSTRQro : SubtargetFeature<"slow-strqro-store", "IsSTRQroSlow",
  188. "true", "STR of Q register with register offset is slow">;
  189. def FeatureAlternateSExtLoadCVTF32Pattern : SubtargetFeature<
  190. "alternate-sextload-cvt-f32-pattern", "UseAlternateSExtLoadCVTF32Pattern",
  191. "true", "Use alternative pattern for sextload convert to f32">;
  192. def FeatureArithmeticBccFusion : SubtargetFeature<
  193. "arith-bcc-fusion", "HasArithmeticBccFusion", "true",
  194. "CPU fuses arithmetic+bcc operations">;
  195. def FeatureArithmeticCbzFusion : SubtargetFeature<
  196. "arith-cbz-fusion", "HasArithmeticCbzFusion", "true",
  197. "CPU fuses arithmetic + cbz/cbnz operations">;
  198. def FeatureCmpBccFusion : SubtargetFeature<
  199. "cmp-bcc-fusion", "HasCmpBccFusion", "true",
  200. "CPU fuses cmp+bcc operations">;
  201. def FeatureFuseAddress : SubtargetFeature<
  202. "fuse-address", "HasFuseAddress", "true",
  203. "CPU fuses address generation and memory operations">;
  204. def FeatureFuseAES : SubtargetFeature<
  205. "fuse-aes", "HasFuseAES", "true",
  206. "CPU fuses AES crypto operations">;
  207. def FeatureFuseArithmeticLogic : SubtargetFeature<
  208. "fuse-arith-logic", "HasFuseArithmeticLogic", "true",
  209. "CPU fuses arithmetic and logic operations">;
  210. def FeatureFuseCCSelect : SubtargetFeature<
  211. "fuse-csel", "HasFuseCCSelect", "true",
  212. "CPU fuses conditional select operations">;
  213. def FeatureFuseCryptoEOR : SubtargetFeature<
  214. "fuse-crypto-eor", "HasFuseCryptoEOR", "true",
  215. "CPU fuses AES/PMULL and EOR operations">;
  216. def FeatureFuseAdrpAdd : SubtargetFeature<
  217. "fuse-adrp-add", "HasFuseAdrpAdd", "true",
  218. "CPU fuses adrp+add operations">;
  219. def FeatureFuseLiterals : SubtargetFeature<
  220. "fuse-literals", "HasFuseLiterals", "true",
  221. "CPU fuses literal generation operations">;
  222. def FeatureDisableLatencySchedHeuristic : SubtargetFeature<
  223. "disable-latency-sched-heuristic", "DisableLatencySchedHeuristic", "true",
  224. "Disable latency scheduling heuristic">;
  225. def FeatureForce32BitJumpTables
  226. : SubtargetFeature<"force-32bit-jump-tables", "Force32BitJumpTables", "true",
  227. "Force jump table entries to be 32-bits wide except at MinSize">;
  228. def FeatureRCPC : SubtargetFeature<"rcpc", "HasRCPC", "true",
  229. "Enable support for RCPC extension (FEAT_LRCPC)">;
  230. def FeatureUseRSqrt : SubtargetFeature<
  231. "use-reciprocal-square-root", "UseRSqrt", "true",
  232. "Use the reciprocal square root approximation">;
  233. def FeatureDotProd : SubtargetFeature<
  234. "dotprod", "HasDotProd", "true",
  235. "Enable dot product support (FEAT_DotProd)">;
  236. def FeaturePAuth : SubtargetFeature<
  237. "pauth", "HasPAuth", "true",
  238. "Enable v8.3-A Pointer Authentication extension (FEAT_PAuth)">;
  239. def FeatureJS : SubtargetFeature<
  240. "jsconv", "HasJS", "true",
  241. "Enable v8.3-A JavaScript FP conversion instructions (FEAT_JSCVT)",
  242. [FeatureFPARMv8]>;
  243. def FeatureCCIDX : SubtargetFeature<
  244. "ccidx", "HasCCIDX", "true",
  245. "Enable v8.3-A Extend of the CCSIDR number of sets (FEAT_CCIDX)">;
  246. def FeatureComplxNum : SubtargetFeature<
  247. "complxnum", "HasComplxNum", "true",
  248. "Enable v8.3-A Floating-point complex number support (FEAT_FCMA)",
  249. [FeatureNEON]>;
  250. def FeatureNV : SubtargetFeature<
  251. "nv", "HasNV", "true",
  252. "Enable v8.4-A Nested Virtualization Enchancement (FEAT_NV, FEAT_NV2)">;
  253. def FeatureMPAM : SubtargetFeature<
  254. "mpam", "HasMPAM", "true",
  255. "Enable v8.4-A Memory system Partitioning and Monitoring extension (FEAT_MPAM)">;
  256. def FeatureDIT : SubtargetFeature<
  257. "dit", "HasDIT", "true",
  258. "Enable v8.4-A Data Independent Timing instructions (FEAT_DIT)">;
  259. def FeatureTRACEV8_4 : SubtargetFeature<
  260. "tracev8.4", "HasTRACEV8_4", "true",
  261. "Enable v8.4-A Trace extension (FEAT_TRF)">;
  262. def FeatureAM : SubtargetFeature<
  263. "am", "HasAM", "true",
  264. "Enable v8.4-A Activity Monitors extension (FEAT_AMUv1)">;
  265. def FeatureAMVS : SubtargetFeature<
  266. "amvs", "HasAMVS", "true",
  267. "Enable v8.6-A Activity Monitors Virtualization support (FEAT_AMUv1p1)",
  268. [FeatureAM]>;
  269. def FeatureSEL2 : SubtargetFeature<
  270. "sel2", "HasSEL2", "true",
  271. "Enable v8.4-A Secure Exception Level 2 extension (FEAT_SEL2)">;
  272. def FeatureTLB_RMI : SubtargetFeature<
  273. "tlb-rmi", "HasTLB_RMI", "true",
  274. "Enable v8.4-A TLB Range and Maintenance Instructions (FEAT_TLBIOS, FEAT_TLBIRANGE)">;
  275. def FeatureFlagM : SubtargetFeature<
  276. "flagm", "HasFlagM", "true",
  277. "Enable v8.4-A Flag Manipulation Instructions (FEAT_FlagM)">;
  278. // 8.4 RCPC enchancements: LDAPR & STLR instructions with Immediate Offset
  279. def FeatureRCPC_IMMO : SubtargetFeature<"rcpc-immo", "HasRCPC_IMMO", "true",
  280. "Enable v8.4-A RCPC instructions with Immediate Offsets (FEAT_LRCPC2)",
  281. [FeatureRCPC]>;
  282. def FeatureNoNegativeImmediates : SubtargetFeature<"no-neg-immediates",
  283. "NegativeImmediates", "false",
  284. "Convert immediates and instructions "
  285. "to their negated or complemented "
  286. "equivalent when the immediate does "
  287. "not fit in the encoding.">;
  288. def FeatureLSLFast : SubtargetFeature<
  289. "lsl-fast", "HasLSLFast", "true",
  290. "CPU has a fastpath logical shift of up to 3 places">;
  291. def FeatureAggressiveFMA :
  292. SubtargetFeature<"aggressive-fma",
  293. "HasAggressiveFMA",
  294. "true",
  295. "Enable Aggressive FMA for floating-point.">;
  296. def FeatureAltFPCmp : SubtargetFeature<"altnzcv", "HasAlternativeNZCV", "true",
  297. "Enable alternative NZCV format for floating point comparisons (FEAT_FlagM2)">;
  298. def FeatureFRInt3264 : SubtargetFeature<"fptoint", "HasFRInt3264", "true",
  299. "Enable FRInt[32|64][Z|X] instructions that round a floating-point number to "
  300. "an integer (in FP format) forcing it to fit into a 32- or 64-bit int (FEAT_FRINTTS)" >;
  301. def FeatureSpecRestrict : SubtargetFeature<"specrestrict", "HasSpecRestrict",
  302. "true", "Enable architectural speculation restriction (FEAT_CSV2_2)">;
  303. def FeatureSB : SubtargetFeature<"sb", "HasSB",
  304. "true", "Enable v8.5 Speculation Barrier (FEAT_SB)" >;
  305. def FeatureSSBS : SubtargetFeature<"ssbs", "HasSSBS",
  306. "true", "Enable Speculative Store Bypass Safe bit (FEAT_SSBS, FEAT_SSBS2)" >;
  307. def FeaturePredRes : SubtargetFeature<"predres", "HasPredRes", "true",
  308. "Enable v8.5a execution and data prediction invalidation instructions (FEAT_SPECRES)" >;
  309. def FeatureCacheDeepPersist : SubtargetFeature<"ccdp", "HasCCDP",
  310. "true", "Enable v8.5 Cache Clean to Point of Deep Persistence (FEAT_DPB2)" >;
  311. def FeatureBranchTargetId : SubtargetFeature<"bti", "HasBTI",
  312. "true", "Enable Branch Target Identification (FEAT_BTI)" >;
  313. def FeatureRandGen : SubtargetFeature<"rand", "HasRandGen",
  314. "true", "Enable Random Number generation instructions (FEAT_RNG)" >;
  315. def FeatureMTE : SubtargetFeature<"mte", "HasMTE",
  316. "true", "Enable Memory Tagging Extension (FEAT_MTE, FEAT_MTE2)" >;
  317. def FeatureTRBE : SubtargetFeature<"trbe", "HasTRBE",
  318. "true", "Enable Trace Buffer Extension (FEAT_TRBE)">;
  319. def FeatureETE : SubtargetFeature<"ete", "HasETE",
  320. "true", "Enable Embedded Trace Extension (FEAT_ETE)",
  321. [FeatureTRBE]>;
  322. def FeatureTME : SubtargetFeature<"tme", "HasTME",
  323. "true", "Enable Transactional Memory Extension (FEAT_TME)" >;
  324. def FeatureTaggedGlobals : SubtargetFeature<"tagged-globals",
  325. "AllowTaggedGlobals",
  326. "true", "Use an instruction sequence for taking the address of a global "
  327. "that allows a memory tag in the upper address bits">;
  328. def FeatureBF16 : SubtargetFeature<"bf16", "HasBF16",
  329. "true", "Enable BFloat16 Extension (FEAT_BF16)" >;
  330. def FeatureMatMulInt8 : SubtargetFeature<"i8mm", "HasMatMulInt8",
  331. "true", "Enable Matrix Multiply Int8 Extension (FEAT_I8MM)">;
  332. def FeatureMatMulFP32 : SubtargetFeature<"f32mm", "HasMatMulFP32",
  333. "true", "Enable Matrix Multiply FP32 Extension (FEAT_F32MM)", [FeatureSVE]>;
  334. def FeatureMatMulFP64 : SubtargetFeature<"f64mm", "HasMatMulFP64",
  335. "true", "Enable Matrix Multiply FP64 Extension (FEAT_F64MM)", [FeatureSVE]>;
  336. def FeatureXS : SubtargetFeature<"xs", "HasXS",
  337. "true", "Enable Armv8.7-A limited-TLB-maintenance instruction (FEAT_XS)">;
  338. def FeatureWFxT : SubtargetFeature<"wfxt", "HasWFxT",
  339. "true", "Enable Armv8.7-A WFET and WFIT instruction (FEAT_WFxT)">;
  340. def FeatureHCX : SubtargetFeature<
  341. "hcx", "HasHCX", "true", "Enable Armv8.7-A HCRX_EL2 system register (FEAT_HCX)">;
  342. def FeatureLS64 : SubtargetFeature<"ls64", "HasLS64",
  343. "true", "Enable Armv8.7-A LD64B/ST64B Accelerator Extension (FEAT_LS64, FEAT_LS64_V, FEAT_LS64_ACCDATA)">;
  344. def FeatureHBC : SubtargetFeature<"hbc", "HasHBC",
  345. "true", "Enable Armv8.8-A Hinted Conditional Branches Extension (FEAT_HBC)">;
  346. def FeatureMOPS : SubtargetFeature<"mops", "HasMOPS",
  347. "true", "Enable Armv8.8-A memcpy and memset acceleration instructions (FEAT_MOPS)">;
  348. def FeatureNMI : SubtargetFeature<"nmi", "HasNMI",
  349. "true", "Enable Armv8.8-A Non-maskable Interrupts (FEAT_NMI, FEAT_GICv3_NMI)">;
  350. def FeatureBRBE : SubtargetFeature<"brbe", "HasBRBE",
  351. "true", "Enable Branch Record Buffer Extension (FEAT_BRBE)">;
  352. def FeatureSPE_EEF : SubtargetFeature<"spe-eef", "HasSPE_EEF",
  353. "true", "Enable extra register in the Statistical Profiling Extension (FEAT_SPEv1p2)">;
  354. def FeatureFineGrainedTraps : SubtargetFeature<"fgt", "HasFineGrainedTraps",
  355. "true", "Enable fine grained virtualization traps extension (FEAT_FGT)">;
  356. def FeatureEnhancedCounterVirtualization :
  357. SubtargetFeature<"ecv", "HasEnhancedCounterVirtualization",
  358. "true", "Enable enhanced counter virtualization extension (FEAT_ECV)">;
  359. def FeatureRME : SubtargetFeature<"rme", "HasRME",
  360. "true", "Enable Realm Management Extension (FEAT_RME)">;
  361. def FeatureSME : SubtargetFeature<"sme", "HasSME", "true",
  362. "Enable Scalable Matrix Extension (SME) (FEAT_SME)", [FeatureBF16, FeatureUseScalarIncVL]>;
  363. def FeatureSMEF64F64 : SubtargetFeature<"sme-f64f64", "HasSMEF64F64", "true",
  364. "Enable Scalable Matrix Extension (SME) F64F64 instructions (FEAT_SME_F64F64)", [FeatureSME]>;
  365. def FeatureSMEI16I64 : SubtargetFeature<"sme-i16i64", "HasSMEI16I64", "true",
  366. "Enable Scalable Matrix Extension (SME) I16I64 instructions (FEAT_SME_I16I64)", [FeatureSME]>;
  367. def FeatureSMEF16F16 : SubtargetFeature<"sme-f16f16", "HasSMEF16F16", "true",
  368. "Enable SME2.1 non-widening Float16 instructions (FEAT_SME_F16F16)", []>;
  369. def FeatureSME2 : SubtargetFeature<"sme2", "HasSME2", "true",
  370. "Enable Scalable Matrix Extension 2 (SME2) instructions", [FeatureSME]>;
  371. def FeatureSME2p1 : SubtargetFeature<"sme2p1", "HasSME2p1", "true",
  372. "Enable Scalable Matrix Extension 2.1 (FEAT_SME2p1) instructions", [FeatureSME2]>;
  373. def FeatureAppleA7SysReg : SubtargetFeature<"apple-a7-sysreg", "HasAppleA7SysReg", "true",
  374. "Apple A7 (the CPU formerly known as Cyclone)">;
  375. def FeatureEL2VMSA : SubtargetFeature<"el2vmsa", "HasEL2VMSA", "true",
  376. "Enable Exception Level 2 Virtual Memory System Architecture">;
  377. def FeatureEL3 : SubtargetFeature<"el3", "HasEL3", "true",
  378. "Enable Exception Level 3">;
  379. def FeatureCSSC : SubtargetFeature<"cssc", "HasCSSC", "true",
  380. "Enable Common Short Sequence Compression (CSSC) instructions (FEAT_CSSC)">;
  381. def FeatureFixCortexA53_835769 : SubtargetFeature<"fix-cortex-a53-835769",
  382. "FixCortexA53_835769", "true", "Mitigate Cortex-A53 Erratum 835769">;
  383. def FeatureNoBTIAtReturnTwice : SubtargetFeature<"no-bti-at-return-twice",
  384. "NoBTIAtReturnTwice", "true",
  385. "Don't place a BTI instruction "
  386. "after a return-twice">;
  387. def FeatureCLRBHB : SubtargetFeature<"clrbhb", "HasCLRBHB",
  388. "true", "Enable Clear BHB instruction (FEAT_CLRBHB)">;
  389. def FeaturePRFM_SLC : SubtargetFeature<"prfm-slc-target", "HasPRFM_SLC",
  390. "true", "Enable SLC target for PRFM instruction">;
  391. def FeatureSPECRES2 : SubtargetFeature<"specres2", "HasSPECRES2",
  392. "true", "Enable Speculation Restriction Instruction (FEAT_SPECRES2)",
  393. [FeaturePredRes]>;
  394. def FeatureMEC : SubtargetFeature<"mec", "HasMEC",
  395. "true", "Enable Memory Encryption Contexts Extension", [FeatureRME]>;
  396. def FeatureITE : SubtargetFeature<"ite", "HasITE",
  397. "true", "Enable Armv9.4-A Instrumentation Extension FEAT_ITE", [FeatureETE,
  398. FeatureTRBE]>;
  399. def FeatureRCPC3 : SubtargetFeature<"rcpc3", "HasRCPC3",
  400. "true", "Enable Armv8.9-A RCPC instructions for A64 and Advanced SIMD and floating-point instruction set (FEAT_LRCPC3)",
  401. [FeatureRCPC_IMMO]>;
  402. def FeatureTHE : SubtargetFeature<"the", "HasTHE",
  403. "true", "Enable Armv8.9-A Translation Hardening Extension (FEAT_THE)">;
  404. def FeatureLSE128 : SubtargetFeature<"lse128", "HasLSE128",
  405. "true", "Enable Armv9.4-A 128-bit Atomic Instructions (FEAT_LSE128)",
  406. [FeatureLSE]>;
  407. // FEAT_D128, FEAT_LVA3, FEAT_SYSREG128, and FEAT_SYSINSTR128 are mutually implicit.
  408. // Therefore group them all under a single feature flag, d128:
  409. def FeatureD128 : SubtargetFeature<"d128", "HasD128",
  410. "true", "Enable Armv9.4-A 128-bit Page Table Descriptors, System Registers "
  411. "and Instructions (FEAT_D128, FEAT_LVA3, FEAT_SYSREG128, FEAT_SYSINSTR128)",
  412. [FeatureLSE128]>;
  413. //===----------------------------------------------------------------------===//
  414. // Architectures.
  415. //
  416. def HasV8_0aOps : SubtargetFeature<"v8a", "HasV8_0aOps", "true",
  417. "Support ARM v8.0a instructions", [FeatureEL2VMSA, FeatureEL3]>;
  418. def HasV8_1aOps : SubtargetFeature<"v8.1a", "HasV8_1aOps", "true",
  419. "Support ARM v8.1a instructions", [HasV8_0aOps, FeatureCRC, FeatureLSE,
  420. FeatureRDM, FeaturePAN, FeatureLOR, FeatureVH]>;
  421. def HasV8_2aOps : SubtargetFeature<"v8.2a", "HasV8_2aOps", "true",
  422. "Support ARM v8.2a instructions", [HasV8_1aOps, FeaturePsUAO,
  423. FeaturePAN_RWV, FeatureRAS, FeatureCCPP]>;
  424. def HasV8_3aOps : SubtargetFeature<"v8.3a", "HasV8_3aOps", "true",
  425. "Support ARM v8.3a instructions", [HasV8_2aOps, FeatureRCPC, FeaturePAuth,
  426. FeatureJS, FeatureCCIDX, FeatureComplxNum]>;
  427. def HasV8_4aOps : SubtargetFeature<"v8.4a", "HasV8_4aOps", "true",
  428. "Support ARM v8.4a instructions", [HasV8_3aOps, FeatureDotProd,
  429. FeatureNV, FeatureMPAM, FeatureDIT,
  430. FeatureTRACEV8_4, FeatureAM, FeatureSEL2, FeatureTLB_RMI,
  431. FeatureFlagM, FeatureRCPC_IMMO, FeatureLSE2]>;
  432. def HasV8_5aOps : SubtargetFeature<
  433. "v8.5a", "HasV8_5aOps", "true", "Support ARM v8.5a instructions",
  434. [HasV8_4aOps, FeatureAltFPCmp, FeatureFRInt3264, FeatureSpecRestrict,
  435. FeatureSSBS, FeatureSB, FeaturePredRes, FeatureCacheDeepPersist,
  436. FeatureBranchTargetId]>;
  437. def HasV8_6aOps : SubtargetFeature<
  438. "v8.6a", "HasV8_6aOps", "true", "Support ARM v8.6a instructions",
  439. [HasV8_5aOps, FeatureAMVS, FeatureBF16, FeatureFineGrainedTraps,
  440. FeatureEnhancedCounterVirtualization, FeatureMatMulInt8]>;
  441. def HasV8_7aOps : SubtargetFeature<
  442. "v8.7a", "HasV8_7aOps", "true", "Support ARM v8.7a instructions",
  443. [HasV8_6aOps, FeatureXS, FeatureWFxT, FeatureHCX]>;
  444. def HasV8_8aOps : SubtargetFeature<
  445. "v8.8a", "HasV8_8aOps", "true", "Support ARM v8.8a instructions",
  446. [HasV8_7aOps, FeatureHBC, FeatureMOPS, FeatureNMI]>;
  447. def HasV8_9aOps : SubtargetFeature<
  448. "v8.9a", "HasV8_9aOps", "true", "Support ARM v8.9a instructions",
  449. [HasV8_8aOps, FeatureCLRBHB, FeaturePRFM_SLC, FeatureSPECRES2,
  450. FeatureCSSC, FeatureRASv2]>;
  451. def HasV9_0aOps : SubtargetFeature<
  452. "v9a", "HasV9_0aOps", "true", "Support ARM v9a instructions",
  453. [HasV8_5aOps, FeatureMEC, FeatureSVE2]>;
  454. def HasV9_1aOps : SubtargetFeature<
  455. "v9.1a", "HasV9_1aOps", "true", "Support ARM v9.1a instructions",
  456. [HasV8_6aOps, HasV9_0aOps]>;
  457. def HasV9_2aOps : SubtargetFeature<
  458. "v9.2a", "HasV9_2aOps", "true", "Support ARM v9.2a instructions",
  459. [HasV8_7aOps, HasV9_1aOps]>;
  460. def HasV9_3aOps : SubtargetFeature<
  461. "v9.3a", "HasV9_3aOps", "true", "Support ARM v9.3a instructions",
  462. [HasV8_8aOps, HasV9_2aOps]>;
  463. def HasV9_4aOps : SubtargetFeature<
  464. "v9.4a", "HasV9_4aOps", "true", "Support ARM v9.4a instructions",
  465. [HasV8_9aOps, HasV9_3aOps]>;
  466. def HasV8_0rOps : SubtargetFeature<
  467. "v8r", "HasV8_0rOps", "true", "Support ARM v8r instructions",
  468. [//v8.1
  469. FeatureCRC, FeaturePAN, FeatureRDM, FeatureLSE, FeatureCONTEXTIDREL2,
  470. //v8.2
  471. FeatureRAS, FeaturePsUAO, FeatureCCPP, FeaturePAN_RWV,
  472. //v8.3
  473. FeatureComplxNum, FeatureCCIDX, FeatureJS,
  474. FeaturePAuth, FeatureRCPC,
  475. //v8.4
  476. FeatureDotProd, FeatureTRACEV8_4, FeatureTLB_RMI,
  477. FeatureFlagM, FeatureDIT, FeatureSEL2, FeatureRCPC_IMMO,
  478. // Not mandatory in v8.0-R, but included here on the grounds that it
  479. // only enables names of system registers
  480. FeatureSpecRestrict
  481. ]>;
  482. // Only intended to be used by disassemblers.
  483. def FeatureAll
  484. : SubtargetFeature<"all", "IsAll", "true", "Enable all instructions", []>;
  485. class AssemblerPredicateWithAll<dag cond, string name="">
  486. : AssemblerPredicate<(any_of FeatureAll, cond), name>;
  487. //===----------------------------------------------------------------------===//
  488. // Register File Description
  489. //===----------------------------------------------------------------------===//
  490. include "AArch64RegisterInfo.td"
  491. include "AArch64RegisterBanks.td"
  492. include "AArch64CallingConvention.td"
  493. //===----------------------------------------------------------------------===//
  494. // Instruction Descriptions
  495. //===----------------------------------------------------------------------===//
  496. include "AArch64Schedule.td"
  497. include "AArch64InstrInfo.td"
  498. include "AArch64SchedPredicates.td"
  499. include "AArch64SchedPredExynos.td"
  500. include "AArch64SchedPredAmpere.td"
  501. include "AArch64Combine.td"
  502. def AArch64InstrInfo : InstrInfo;
  503. //===----------------------------------------------------------------------===//
  504. // Named operands for MRS/MSR/TLBI/...
  505. //===----------------------------------------------------------------------===//
  506. include "AArch64SystemOperands.td"
  507. //===----------------------------------------------------------------------===//
  508. // Access to privileged registers
  509. //===----------------------------------------------------------------------===//
  510. foreach i = 1-3 in
  511. def FeatureUseEL#i#ForTP : SubtargetFeature<"tpidr-el"#i, "UseEL"#i#"ForTP",
  512. "true", "Permit use of TPIDR_EL"#i#" for the TLS base">;
  513. //===----------------------------------------------------------------------===//
  514. // Control codegen mitigation against Straight Line Speculation vulnerability.
  515. //===----------------------------------------------------------------------===//
  516. def FeatureHardenSlsRetBr : SubtargetFeature<"harden-sls-retbr",
  517. "HardenSlsRetBr", "true",
  518. "Harden against straight line speculation across RET and BR instructions">;
  519. def FeatureHardenSlsBlr : SubtargetFeature<"harden-sls-blr",
  520. "HardenSlsBlr", "true",
  521. "Harden against straight line speculation across BLR instructions">;
  522. def FeatureHardenSlsNoComdat : SubtargetFeature<"harden-sls-nocomdat",
  523. "HardenSlsNoComdat", "true",
  524. "Generate thunk code for SLS mitigation in the normal text section">;
  525. //===----------------------------------------------------------------------===//
  526. // AArch64 Processors supported.
  527. //
  528. //===----------------------------------------------------------------------===//
  529. // Unsupported features to disable for scheduling models
  530. //===----------------------------------------------------------------------===//
  531. class AArch64Unsupported { list<Predicate> F; }
  532. def SVEUnsupported : AArch64Unsupported {
  533. let F = [HasSVE, HasSVE2, HasSVE2AES, HasSVE2SM4, HasSVE2SHA3,
  534. HasSVE2BitPerm, HasSVEorSME, HasSVE2p1, HasSVE2orSME, HasSVE2p1_or_HasSME2p1];
  535. }
  536. def PAUnsupported : AArch64Unsupported {
  537. let F = [HasPAuth];
  538. }
  539. def SMEUnsupported : AArch64Unsupported {
  540. let F = [HasSME, HasSMEF64F64, HasSMEI16I64, HasSME2, HasSVE2p1_or_HasSME2,
  541. HasSVE2p1_or_HasSME2p1, HasSME2p1, HasSMEF16F16];
  542. }
  543. include "AArch64SchedA53.td"
  544. include "AArch64SchedA55.td"
  545. include "AArch64SchedA57.td"
  546. include "AArch64SchedCyclone.td"
  547. include "AArch64SchedFalkor.td"
  548. include "AArch64SchedKryo.td"
  549. include "AArch64SchedExynosM3.td"
  550. include "AArch64SchedExynosM4.td"
  551. include "AArch64SchedExynosM5.td"
  552. include "AArch64SchedThunderX.td"
  553. include "AArch64SchedThunderX2T99.td"
  554. include "AArch64SchedA64FX.td"
  555. include "AArch64SchedThunderX3T110.td"
  556. include "AArch64SchedTSV110.td"
  557. include "AArch64SchedAmpere1.td"
  558. include "AArch64SchedNeoverseN2.td"
  559. def TuneA35 : SubtargetFeature<"a35", "ARMProcFamily", "CortexA35",
  560. "Cortex-A35 ARM processors">;
  561. def TuneA53 : SubtargetFeature<"a53", "ARMProcFamily", "CortexA53",
  562. "Cortex-A53 ARM processors", [
  563. FeatureFuseAES,
  564. FeatureFuseAdrpAdd,
  565. FeatureBalanceFPOps,
  566. FeatureCustomCheapAsMoveHandling,
  567. FeaturePostRAScheduler]>;
  568. def TuneA55 : SubtargetFeature<"a55", "ARMProcFamily", "CortexA55",
  569. "Cortex-A55 ARM processors", [
  570. FeatureFuseAES,
  571. FeatureFuseAdrpAdd,
  572. FeaturePostRAScheduler,
  573. FeatureFuseAddress]>;
  574. def TuneA510 : SubtargetFeature<"a510", "ARMProcFamily", "CortexA510",
  575. "Cortex-A510 ARM processors", [
  576. FeatureFuseAES,
  577. FeatureFuseAdrpAdd,
  578. FeaturePostRAScheduler
  579. ]>;
  580. def TuneA57 : SubtargetFeature<"a57", "ARMProcFamily", "CortexA57",
  581. "Cortex-A57 ARM processors", [
  582. FeatureFuseAES,
  583. FeatureBalanceFPOps,
  584. FeatureCustomCheapAsMoveHandling,
  585. FeatureFuseAdrpAdd,
  586. FeatureFuseLiterals,
  587. FeaturePostRAScheduler,
  588. FeatureEnableSelectOptimize,
  589. FeaturePredictableSelectIsExpensive]>;
  590. def TuneA65 : SubtargetFeature<"a65", "ARMProcFamily", "CortexA65",
  591. "Cortex-A65 ARM processors", [
  592. FeatureFuseAES,
  593. FeatureFuseAddress,
  594. FeatureFuseAdrpAdd,
  595. FeatureFuseLiterals,
  596. FeatureEnableSelectOptimize]>;
  597. def TuneA72 : SubtargetFeature<"a72", "ARMProcFamily", "CortexA72",
  598. "Cortex-A72 ARM processors", [
  599. FeatureFuseAES,
  600. FeatureFuseAdrpAdd,
  601. FeatureFuseLiterals,
  602. FeatureEnableSelectOptimize]>;
  603. def TuneA73 : SubtargetFeature<"a73", "ARMProcFamily", "CortexA73",
  604. "Cortex-A73 ARM processors", [
  605. FeatureFuseAES,
  606. FeatureFuseAdrpAdd,
  607. FeatureEnableSelectOptimize]>;
  608. def TuneA75 : SubtargetFeature<"a75", "ARMProcFamily", "CortexA75",
  609. "Cortex-A75 ARM processors", [
  610. FeatureFuseAES,
  611. FeatureFuseAdrpAdd,
  612. FeatureEnableSelectOptimize]>;
  613. def TuneA76 : SubtargetFeature<"a76", "ARMProcFamily", "CortexA76",
  614. "Cortex-A76 ARM processors", [
  615. FeatureFuseAES,
  616. FeatureFuseAdrpAdd,
  617. FeatureLSLFast,
  618. FeatureEnableSelectOptimize]>;
  619. def TuneA77 : SubtargetFeature<"a77", "ARMProcFamily", "CortexA77",
  620. "Cortex-A77 ARM processors", [
  621. FeatureCmpBccFusion,
  622. FeatureFuseAES,
  623. FeatureFuseAdrpAdd,
  624. FeatureLSLFast,
  625. FeatureEnableSelectOptimize]>;
  626. def TuneA78 : SubtargetFeature<"a78", "ARMProcFamily", "CortexA78",
  627. "Cortex-A78 ARM processors", [
  628. FeatureCmpBccFusion,
  629. FeatureFuseAES,
  630. FeatureFuseAdrpAdd,
  631. FeatureLSLFast,
  632. FeaturePostRAScheduler,
  633. FeatureEnableSelectOptimize]>;
  634. def TuneA78C : SubtargetFeature<"a78c", "ARMProcFamily",
  635. "CortexA78C",
  636. "Cortex-A78C ARM processors", [
  637. FeatureCmpBccFusion,
  638. FeatureFuseAES,
  639. FeatureFuseAdrpAdd,
  640. FeatureLSLFast,
  641. FeaturePostRAScheduler,
  642. FeatureEnableSelectOptimize]>;
  643. def TuneA710 : SubtargetFeature<"a710", "ARMProcFamily", "CortexA710",
  644. "Cortex-A710 ARM processors", [
  645. FeatureCmpBccFusion,
  646. FeatureFuseAES,
  647. FeatureFuseAdrpAdd,
  648. FeatureLSLFast,
  649. FeaturePostRAScheduler,
  650. FeatureEnableSelectOptimize]>;
  651. def TuneA715 : SubtargetFeature<"a715", "ARMProcFamily", "CortexA715",
  652. "Cortex-A715 ARM processors", [
  653. FeatureFuseAES,
  654. FeaturePostRAScheduler,
  655. FeatureCmpBccFusion,
  656. FeatureLSLFast,
  657. FeatureFuseAdrpAdd,
  658. FeatureEnableSelectOptimize]>;
  659. def TuneR82 : SubtargetFeature<"cortex-r82", "ARMProcFamily",
  660. "CortexR82",
  661. "Cortex-R82 ARM processors", [
  662. FeaturePostRAScheduler]>;
  663. def TuneX1 : SubtargetFeature<"cortex-x1", "ARMProcFamily", "CortexX1",
  664. "Cortex-X1 ARM processors", [
  665. FeatureCmpBccFusion,
  666. FeatureFuseAES,
  667. FeatureFuseAdrpAdd,
  668. FeatureLSLFast,
  669. FeaturePostRAScheduler,
  670. FeatureEnableSelectOptimize]>;
  671. def TuneX2 : SubtargetFeature<"cortex-x2", "ARMProcFamily", "CortexX2",
  672. "Cortex-X2 ARM processors", [
  673. FeatureCmpBccFusion,
  674. FeatureFuseAES,
  675. FeatureFuseAdrpAdd,
  676. FeatureLSLFast,
  677. FeaturePostRAScheduler,
  678. FeatureEnableSelectOptimize]>;
  679. def TuneX3 : SubtargetFeature<"cortex-x3", "ARMProcFamily", "CortexX3",
  680. "Cortex-X3 ARM processors", [
  681. FeatureLSLFast,
  682. FeatureFuseAdrpAdd,
  683. FeatureFuseAES,
  684. FeaturePostRAScheduler,
  685. FeatureEnableSelectOptimize]>;
  686. def TuneA64FX : SubtargetFeature<"a64fx", "ARMProcFamily", "A64FX",
  687. "Fujitsu A64FX processors", [
  688. FeaturePostRAScheduler,
  689. FeatureAggressiveFMA,
  690. FeatureArithmeticBccFusion,
  691. FeaturePredictableSelectIsExpensive
  692. ]>;
  693. def TuneCarmel : SubtargetFeature<"carmel", "ARMProcFamily", "Carmel",
  694. "Nvidia Carmel processors">;
  695. // Note that cyclone does not fuse AES instructions, but newer apple chips do
  696. // perform the fusion and cyclone is used by default when targetting apple OSes.
  697. def TuneAppleA7 : SubtargetFeature<"apple-a7", "ARMProcFamily", "AppleA7",
  698. "Apple A7 (the CPU formerly known as Cyclone)", [
  699. FeatureAlternateSExtLoadCVTF32Pattern,
  700. FeatureArithmeticBccFusion,
  701. FeatureArithmeticCbzFusion,
  702. FeatureDisableLatencySchedHeuristic,
  703. FeatureFuseAES, FeatureFuseCryptoEOR,
  704. FeatureZCRegMove,
  705. FeatureZCZeroing,
  706. FeatureZCZeroingFPWorkaround]
  707. >;
  708. def TuneAppleA10 : SubtargetFeature<"apple-a10", "ARMProcFamily", "AppleA10",
  709. "Apple A10", [
  710. FeatureAlternateSExtLoadCVTF32Pattern,
  711. FeatureArithmeticBccFusion,
  712. FeatureArithmeticCbzFusion,
  713. FeatureDisableLatencySchedHeuristic,
  714. FeatureFuseAES,
  715. FeatureFuseCryptoEOR,
  716. FeatureZCRegMove,
  717. FeatureZCZeroing]
  718. >;
  719. def TuneAppleA11 : SubtargetFeature<"apple-a11", "ARMProcFamily", "AppleA11",
  720. "Apple A11", [
  721. FeatureAlternateSExtLoadCVTF32Pattern,
  722. FeatureArithmeticBccFusion,
  723. FeatureArithmeticCbzFusion,
  724. FeatureDisableLatencySchedHeuristic,
  725. FeatureFuseAES,
  726. FeatureFuseCryptoEOR,
  727. FeatureZCRegMove,
  728. FeatureZCZeroing]
  729. >;
  730. def TuneAppleA12 : SubtargetFeature<"apple-a12", "ARMProcFamily", "AppleA12",
  731. "Apple A12", [
  732. FeatureAlternateSExtLoadCVTF32Pattern,
  733. FeatureArithmeticBccFusion,
  734. FeatureArithmeticCbzFusion,
  735. FeatureDisableLatencySchedHeuristic,
  736. FeatureFuseAES,
  737. FeatureFuseCryptoEOR,
  738. FeatureZCRegMove,
  739. FeatureZCZeroing]
  740. >;
  741. def TuneAppleA13 : SubtargetFeature<"apple-a13", "ARMProcFamily", "AppleA13",
  742. "Apple A13", [
  743. FeatureAlternateSExtLoadCVTF32Pattern,
  744. FeatureArithmeticBccFusion,
  745. FeatureArithmeticCbzFusion,
  746. FeatureDisableLatencySchedHeuristic,
  747. FeatureFuseAES,
  748. FeatureFuseCryptoEOR,
  749. FeatureZCRegMove,
  750. FeatureZCZeroing]
  751. >;
  752. def TuneAppleA14 : SubtargetFeature<"apple-a14", "ARMProcFamily", "AppleA14",
  753. "Apple A14", [
  754. FeatureAggressiveFMA,
  755. FeatureAlternateSExtLoadCVTF32Pattern,
  756. FeatureArithmeticBccFusion,
  757. FeatureArithmeticCbzFusion,
  758. FeatureDisableLatencySchedHeuristic,
  759. FeatureFuseAddress,
  760. FeatureFuseAES,
  761. FeatureFuseArithmeticLogic,
  762. FeatureFuseCCSelect,
  763. FeatureFuseCryptoEOR,
  764. FeatureFuseAdrpAdd,
  765. FeatureFuseLiterals,
  766. FeatureZCRegMove,
  767. FeatureZCZeroing]>;
  768. def TuneAppleA15 : SubtargetFeature<"apple-a15", "ARMProcFamily", "AppleA15",
  769. "Apple A15", [
  770. FeatureAlternateSExtLoadCVTF32Pattern,
  771. FeatureArithmeticBccFusion,
  772. FeatureArithmeticCbzFusion,
  773. FeatureDisableLatencySchedHeuristic,
  774. FeatureFuseAddress,
  775. FeatureFuseAES,
  776. FeatureFuseArithmeticLogic,
  777. FeatureFuseCCSelect,
  778. FeatureFuseCryptoEOR,
  779. FeatureFuseLiterals,
  780. FeatureZCRegMove,
  781. FeatureZCZeroing
  782. ]>;
  783. def TuneAppleA16 : SubtargetFeature<"apple-a16", "ARMProcFamily", "AppleA16",
  784. "Apple A16", [
  785. FeatureAlternateSExtLoadCVTF32Pattern,
  786. FeatureArithmeticBccFusion,
  787. FeatureArithmeticCbzFusion,
  788. FeatureDisableLatencySchedHeuristic,
  789. FeatureFuseAddress,
  790. FeatureFuseAES,
  791. FeatureFuseArithmeticLogic,
  792. FeatureFuseCCSelect,
  793. FeatureFuseCryptoEOR,
  794. FeatureFuseLiterals,
  795. FeatureZCRegMove,
  796. FeatureZCZeroing
  797. ]>;
  798. def TuneExynosM3 : SubtargetFeature<"exynosm3", "ARMProcFamily", "ExynosM3",
  799. "Samsung Exynos-M3 processors",
  800. [FeatureExynosCheapAsMoveHandling,
  801. FeatureForce32BitJumpTables,
  802. FeatureFuseAddress,
  803. FeatureFuseAES,
  804. FeatureFuseCCSelect,
  805. FeatureFuseAdrpAdd,
  806. FeatureFuseLiterals,
  807. FeatureLSLFast,
  808. FeaturePostRAScheduler,
  809. FeaturePredictableSelectIsExpensive]>;
  810. // Re-uses some scheduling and tunings from the ExynosM3 proc family.
  811. def TuneExynosM4 : SubtargetFeature<"exynosm4", "ARMProcFamily", "ExynosM3",
  812. "Samsung Exynos-M4 processors",
  813. [FeatureArithmeticBccFusion,
  814. FeatureArithmeticCbzFusion,
  815. FeatureExynosCheapAsMoveHandling,
  816. FeatureForce32BitJumpTables,
  817. FeatureFuseAddress,
  818. FeatureFuseAES,
  819. FeatureFuseArithmeticLogic,
  820. FeatureFuseCCSelect,
  821. FeatureFuseAdrpAdd,
  822. FeatureFuseLiterals,
  823. FeatureLSLFast,
  824. FeaturePostRAScheduler,
  825. FeatureZCZeroing]>;
  826. def TuneKryo : SubtargetFeature<"kryo", "ARMProcFamily", "Kryo",
  827. "Qualcomm Kryo processors", [
  828. FeatureCustomCheapAsMoveHandling,
  829. FeaturePostRAScheduler,
  830. FeaturePredictableSelectIsExpensive,
  831. FeatureZCZeroing,
  832. FeatureLSLFast]
  833. >;
  834. def TuneFalkor : SubtargetFeature<"falkor", "ARMProcFamily", "Falkor",
  835. "Qualcomm Falkor processors", [
  836. FeatureCustomCheapAsMoveHandling,
  837. FeaturePostRAScheduler,
  838. FeaturePredictableSelectIsExpensive,
  839. FeatureZCZeroing,
  840. FeatureLSLFast,
  841. FeatureSlowSTRQro
  842. ]>;
  843. def TuneNeoverseE1 : SubtargetFeature<"neoversee1", "ARMProcFamily", "NeoverseE1",
  844. "Neoverse E1 ARM processors", [
  845. FeatureFuseAES,
  846. FeatureFuseAdrpAdd,
  847. FeaturePostRAScheduler]>;
  848. def TuneNeoverseN1 : SubtargetFeature<"neoversen1", "ARMProcFamily", "NeoverseN1",
  849. "Neoverse N1 ARM processors", [
  850. FeatureFuseAES,
  851. FeatureFuseAdrpAdd,
  852. FeatureLSLFast,
  853. FeaturePostRAScheduler,
  854. FeatureEnableSelectOptimize]>;
  855. def TuneNeoverseN2 : SubtargetFeature<"neoversen2", "ARMProcFamily", "NeoverseN2",
  856. "Neoverse N2 ARM processors", [
  857. FeatureFuseAES,
  858. FeatureFuseAdrpAdd,
  859. FeatureLSLFast,
  860. FeaturePostRAScheduler,
  861. FeatureEnableSelectOptimize]>;
  862. def TuneNeoverse512TVB : SubtargetFeature<"neoverse512tvb", "ARMProcFamily", "Neoverse512TVB",
  863. "Neoverse 512-TVB ARM processors", [
  864. FeatureFuseAES,
  865. FeatureFuseAdrpAdd,
  866. FeatureLSLFast,
  867. FeaturePostRAScheduler,
  868. FeatureEnableSelectOptimize]>;
  869. def TuneNeoverseV1 : SubtargetFeature<"neoversev1", "ARMProcFamily", "NeoverseV1",
  870. "Neoverse V1 ARM processors", [
  871. FeatureFuseAES,
  872. FeatureFuseAdrpAdd,
  873. FeatureLSLFast,
  874. FeaturePostRAScheduler,
  875. FeatureEnableSelectOptimize]>;
  876. def TuneNeoverseV2 : SubtargetFeature<"neoversev2", "ARMProcFamily", "NeoverseV2",
  877. "Neoverse V2 ARM processors", [
  878. FeatureFuseAES,
  879. FeatureLSLFast,
  880. FeaturePostRAScheduler,
  881. FeatureEnableSelectOptimize]>;
  882. def TuneSaphira : SubtargetFeature<"saphira", "ARMProcFamily", "Saphira",
  883. "Qualcomm Saphira processors", [
  884. FeatureCustomCheapAsMoveHandling,
  885. FeaturePostRAScheduler,
  886. FeaturePredictableSelectIsExpensive,
  887. FeatureZCZeroing,
  888. FeatureLSLFast]>;
  889. def TuneThunderX2T99 : SubtargetFeature<"thunderx2t99", "ARMProcFamily", "ThunderX2T99",
  890. "Cavium ThunderX2 processors", [
  891. FeatureAggressiveFMA,
  892. FeatureArithmeticBccFusion,
  893. FeaturePostRAScheduler,
  894. FeaturePredictableSelectIsExpensive]>;
  895. def TuneThunderX3T110 : SubtargetFeature<"thunderx3t110", "ARMProcFamily",
  896. "ThunderX3T110",
  897. "Marvell ThunderX3 processors", [
  898. FeatureAggressiveFMA,
  899. FeatureArithmeticBccFusion,
  900. FeaturePostRAScheduler,
  901. FeaturePredictableSelectIsExpensive,
  902. FeatureBalanceFPOps,
  903. FeatureStrictAlign]>;
  904. def TuneThunderX : SubtargetFeature<"thunderx", "ARMProcFamily", "ThunderX",
  905. "Cavium ThunderX processors", [
  906. FeaturePostRAScheduler,
  907. FeaturePredictableSelectIsExpensive]>;
  908. def TuneThunderXT88 : SubtargetFeature<"thunderxt88", "ARMProcFamily",
  909. "ThunderXT88",
  910. "Cavium ThunderX processors", [
  911. FeaturePostRAScheduler,
  912. FeaturePredictableSelectIsExpensive]>;
  913. def TuneThunderXT81 : SubtargetFeature<"thunderxt81", "ARMProcFamily",
  914. "ThunderXT81",
  915. "Cavium ThunderX processors", [
  916. FeaturePostRAScheduler,
  917. FeaturePredictableSelectIsExpensive]>;
  918. def TuneThunderXT83 : SubtargetFeature<"thunderxt83", "ARMProcFamily",
  919. "ThunderXT83",
  920. "Cavium ThunderX processors", [
  921. FeaturePostRAScheduler,
  922. FeaturePredictableSelectIsExpensive]>;
  923. def TuneTSV110 : SubtargetFeature<"tsv110", "ARMProcFamily", "TSV110",
  924. "HiSilicon TS-V110 processors", [
  925. FeatureCustomCheapAsMoveHandling,
  926. FeatureFuseAES,
  927. FeaturePostRAScheduler]>;
  928. def TuneAmpere1 : SubtargetFeature<"ampere1", "ARMProcFamily", "Ampere1",
  929. "Ampere Computing Ampere-1 processors", [
  930. FeaturePostRAScheduler,
  931. FeatureFuseAES,
  932. FeatureLSLFast,
  933. FeatureAggressiveFMA,
  934. FeatureArithmeticBccFusion,
  935. FeatureCmpBccFusion,
  936. FeatureFuseAddress,
  937. FeatureFuseLiterals]>;
  938. def TuneAmpere1A : SubtargetFeature<"ampere1a", "ARMProcFamily", "Ampere1A",
  939. "Ampere Computing Ampere-1A processors", [
  940. FeaturePostRAScheduler,
  941. FeatureFuseAES,
  942. FeatureLSLFast,
  943. FeatureAggressiveFMA,
  944. FeatureArithmeticBccFusion,
  945. FeatureCmpBccFusion,
  946. FeatureFuseAddress,
  947. FeatureFuseLiterals,
  948. FeatureFuseLiterals]>;
  949. def ProcessorFeatures {
  950. list<SubtargetFeature> A53 = [HasV8_0aOps, FeatureCRC, FeatureCrypto,
  951. FeatureFPARMv8, FeatureNEON, FeaturePerfMon];
  952. list<SubtargetFeature> A55 = [HasV8_2aOps, FeatureCrypto, FeatureFPARMv8,
  953. FeatureNEON, FeatureFullFP16, FeatureDotProd,
  954. FeatureRCPC, FeaturePerfMon];
  955. list<SubtargetFeature> A510 = [HasV9_0aOps, FeatureNEON, FeaturePerfMon,
  956. FeatureMatMulInt8, FeatureBF16, FeatureAM,
  957. FeatureMTE, FeatureETE, FeatureSVE2BitPerm,
  958. FeatureFP16FML];
  959. list<SubtargetFeature> A65 = [HasV8_2aOps, FeatureCrypto, FeatureFPARMv8,
  960. FeatureNEON, FeatureFullFP16, FeatureDotProd,
  961. FeatureRCPC, FeatureSSBS, FeatureRAS,
  962. FeaturePerfMon];
  963. list<SubtargetFeature> A76 = [HasV8_2aOps, FeatureCrypto, FeatureFPARMv8,
  964. FeatureNEON, FeatureFullFP16, FeatureDotProd,
  965. FeatureRCPC, FeatureSSBS, FeaturePerfMon];
  966. list<SubtargetFeature> A77 = [HasV8_2aOps, FeatureCrypto, FeatureFPARMv8,
  967. FeatureNEON, FeatureFullFP16, FeatureDotProd,
  968. FeatureRCPC, FeaturePerfMon, FeatureSSBS];
  969. list<SubtargetFeature> A78 = [HasV8_2aOps, FeatureCrypto, FeatureFPARMv8,
  970. FeatureNEON, FeatureFullFP16, FeatureDotProd,
  971. FeatureRCPC, FeaturePerfMon, FeatureSPE,
  972. FeatureSSBS];
  973. list<SubtargetFeature> A78C = [HasV8_2aOps, FeatureCrypto, FeatureFPARMv8,
  974. FeatureNEON, FeatureFullFP16, FeatureDotProd,
  975. FeatureFlagM, FeatureFP16FML, FeaturePAuth,
  976. FeaturePerfMon, FeatureRCPC, FeatureSPE,
  977. FeatureSSBS];
  978. list<SubtargetFeature> A710 = [HasV9_0aOps, FeatureNEON, FeaturePerfMon,
  979. FeatureETE, FeatureMTE, FeatureFP16FML,
  980. FeatureSVE2BitPerm, FeatureBF16, FeatureMatMulInt8];
  981. list<SubtargetFeature> A715 = [HasV9_0aOps, FeatureNEON, FeatureMTE,
  982. FeatureFP16FML, FeatureSVE, FeatureTRBE,
  983. FeatureSVE2BitPerm, FeatureBF16, FeatureETE,
  984. FeaturePerfMon, FeatureMatMulInt8, FeatureSPE];
  985. list<SubtargetFeature> R82 = [HasV8_0rOps, FeaturePerfMon, FeatureFullFP16,
  986. FeatureFP16FML, FeatureSSBS, FeaturePredRes,
  987. FeatureSB];
  988. list<SubtargetFeature> X1 = [HasV8_2aOps, FeatureCrypto, FeatureFPARMv8,
  989. FeatureNEON, FeatureRCPC, FeaturePerfMon,
  990. FeatureSPE, FeatureFullFP16, FeatureDotProd,
  991. FeatureSSBS];
  992. list<SubtargetFeature> X1C = [HasV8_2aOps, FeatureCrypto, FeatureFPARMv8,
  993. FeatureNEON, FeatureRCPC_IMMO, FeaturePerfMon,
  994. FeatureSPE, FeatureFullFP16, FeatureDotProd,
  995. FeaturePAuth, FeatureSSBS, FeatureFlagM,
  996. FeatureLSE2];
  997. list<SubtargetFeature> X2 = [HasV9_0aOps, FeatureNEON, FeaturePerfMon,
  998. FeatureMatMulInt8, FeatureBF16, FeatureAM,
  999. FeatureMTE, FeatureETE, FeatureSVE2BitPerm,
  1000. FeatureFP16FML];
  1001. list<SubtargetFeature> X3 = [HasV9_0aOps, FeatureSVE, FeatureNEON,
  1002. FeaturePerfMon, FeatureETE, FeatureTRBE,
  1003. FeatureSPE, FeatureBF16, FeatureMatMulInt8,
  1004. FeatureMTE, FeatureSVE2BitPerm, FeatureFullFP16,
  1005. FeatureFP16FML];
  1006. list<SubtargetFeature> A64FX = [HasV8_2aOps, FeatureFPARMv8, FeatureNEON,
  1007. FeatureSHA2, FeaturePerfMon, FeatureFullFP16,
  1008. FeatureSVE, FeatureComplxNum];
  1009. list<SubtargetFeature> Carmel = [HasV8_2aOps, FeatureNEON, FeatureCrypto,
  1010. FeatureFullFP16];
  1011. list<SubtargetFeature> AppleA7 = [HasV8_0aOps, FeatureCrypto, FeatureFPARMv8,
  1012. FeatureNEON,FeaturePerfMon, FeatureAppleA7SysReg];
  1013. list<SubtargetFeature> AppleA10 = [HasV8_0aOps, FeatureCrypto, FeatureFPARMv8,
  1014. FeatureNEON, FeaturePerfMon, FeatureCRC,
  1015. FeatureRDM, FeaturePAN, FeatureLOR, FeatureVH];
  1016. list<SubtargetFeature> AppleA11 = [HasV8_2aOps, FeatureCrypto, FeatureFPARMv8,
  1017. FeatureNEON, FeaturePerfMon, FeatureFullFP16];
  1018. list<SubtargetFeature> AppleA12 = [HasV8_3aOps, FeatureCrypto, FeatureFPARMv8,
  1019. FeatureNEON, FeaturePerfMon, FeatureFullFP16];
  1020. list<SubtargetFeature> AppleA13 = [HasV8_4aOps, FeatureCrypto, FeatureFPARMv8,
  1021. FeatureNEON, FeaturePerfMon, FeatureFullFP16,
  1022. FeatureFP16FML, FeatureSHA3];
  1023. list<SubtargetFeature> AppleA14 = [HasV8_4aOps, FeatureCrypto, FeatureFPARMv8,
  1024. FeatureNEON, FeaturePerfMon, FeatureFRInt3264,
  1025. FeatureSpecRestrict, FeatureSSBS, FeatureSB,
  1026. FeaturePredRes, FeatureCacheDeepPersist,
  1027. FeatureFullFP16, FeatureFP16FML, FeatureSHA3,
  1028. FeatureAltFPCmp];
  1029. list<SubtargetFeature> AppleA15 = [HasV8_6aOps, FeatureCrypto, FeatureFPARMv8,
  1030. FeatureNEON, FeaturePerfMon, FeatureSHA3,
  1031. FeatureFullFP16, FeatureFP16FML];
  1032. list<SubtargetFeature> AppleA16 = [HasV8_6aOps, FeatureCrypto, FeatureFPARMv8,
  1033. FeatureNEON, FeaturePerfMon, FeatureSHA3,
  1034. FeatureFullFP16, FeatureFP16FML,
  1035. FeatureHCX];
  1036. list<SubtargetFeature> ExynosM3 = [HasV8_0aOps, FeatureCRC, FeatureCrypto,
  1037. FeaturePerfMon];
  1038. list<SubtargetFeature> ExynosM4 = [HasV8_2aOps, FeatureCrypto, FeatureDotProd,
  1039. FeatureFullFP16, FeaturePerfMon];
  1040. list<SubtargetFeature> Falkor = [HasV8_0aOps, FeatureCRC, FeatureCrypto,
  1041. FeatureFPARMv8, FeatureNEON, FeaturePerfMon,
  1042. FeatureRDM];
  1043. list<SubtargetFeature> NeoverseE1 = [HasV8_2aOps, FeatureCrypto, FeatureDotProd,
  1044. FeatureFPARMv8, FeatureFullFP16, FeatureNEON,
  1045. FeatureRCPC, FeatureSSBS, FeaturePerfMon];
  1046. list<SubtargetFeature> NeoverseN1 = [HasV8_2aOps, FeatureCrypto, FeatureDotProd,
  1047. FeatureFPARMv8, FeatureFullFP16, FeatureNEON,
  1048. FeatureRCPC, FeatureSPE, FeatureSSBS,
  1049. FeaturePerfMon];
  1050. list<SubtargetFeature> NeoverseN2 = [HasV8_5aOps, FeatureBF16, FeatureETE,
  1051. FeatureMatMulInt8, FeatureMTE, FeatureSVE2,
  1052. FeatureSVE2BitPerm, FeatureTRBE, FeatureCrypto,
  1053. FeaturePerfMon];
  1054. list<SubtargetFeature> Neoverse512TVB = [HasV8_4aOps, FeatureBF16, FeatureCacheDeepPersist,
  1055. FeatureCrypto, FeatureFPARMv8, FeatureFP16FML,
  1056. FeatureFullFP16, FeatureMatMulInt8, FeatureNEON,
  1057. FeaturePerfMon, FeatureRandGen, FeatureSPE,
  1058. FeatureSSBS, FeatureSVE];
  1059. list<SubtargetFeature> NeoverseV1 = [HasV8_4aOps, FeatureBF16, FeatureCacheDeepPersist,
  1060. FeatureCrypto, FeatureFPARMv8, FeatureFP16FML,
  1061. FeatureFullFP16, FeatureMatMulInt8, FeatureNEON,
  1062. FeaturePerfMon, FeatureRandGen, FeatureSPE,
  1063. FeatureSSBS, FeatureSVE];
  1064. list<SubtargetFeature> NeoverseV2 = [HasV9_0aOps, FeatureBF16, FeatureSPE,
  1065. FeaturePerfMon, FeatureETE, FeatureMatMulInt8,
  1066. FeatureNEON, FeatureSVE2BitPerm, FeatureFP16FML,
  1067. FeatureMTE, FeatureRandGen];
  1068. list<SubtargetFeature> Saphira = [HasV8_4aOps, FeatureCrypto, FeatureFPARMv8,
  1069. FeatureNEON, FeatureSPE, FeaturePerfMon];
  1070. list<SubtargetFeature> ThunderX = [HasV8_0aOps, FeatureCRC, FeatureCrypto,
  1071. FeatureFPARMv8, FeaturePerfMon, FeatureNEON];
  1072. list<SubtargetFeature> ThunderX2T99 = [HasV8_1aOps, FeatureCRC, FeatureCrypto,
  1073. FeatureFPARMv8, FeatureNEON, FeatureLSE];
  1074. list<SubtargetFeature> ThunderX3T110 = [HasV8_3aOps, FeatureCRC, FeatureCrypto,
  1075. FeatureFPARMv8, FeatureNEON, FeatureLSE,
  1076. FeaturePAuth, FeaturePerfMon];
  1077. list<SubtargetFeature> TSV110 = [HasV8_2aOps, FeatureCrypto, FeatureFPARMv8,
  1078. FeatureNEON, FeaturePerfMon, FeatureSPE,
  1079. FeatureFullFP16, FeatureFP16FML, FeatureDotProd];
  1080. list<SubtargetFeature> Ampere1 = [HasV8_6aOps, FeatureNEON, FeaturePerfMon,
  1081. FeatureSSBS, FeatureRandGen, FeatureSB,
  1082. FeatureSHA2, FeatureSHA3, FeatureAES];
  1083. list<SubtargetFeature> Ampere1A = [HasV8_6aOps, FeatureNEON, FeaturePerfMon,
  1084. FeatureMTE, FeatureSSBS, FeatureRandGen,
  1085. FeatureSB, FeatureSM4, FeatureSHA2,
  1086. FeatureSHA3, FeatureAES];
  1087. // ETE and TRBE are future architecture extensions. We temporarily enable them
  1088. // by default for users targeting generic AArch64. The extensions do not
  1089. // affect code generated by the compiler and can be used only by explicitly
  1090. // mentioning the new system register names in assembly.
  1091. list<SubtargetFeature> Generic = [FeatureFPARMv8, FeatureNEON, FeatureETE];
  1092. }
  1093. // FeatureFuseAdrpAdd is enabled under Generic to allow linker merging
  1094. // optimizations.
  1095. def : ProcessorModel<"generic", CortexA55Model, ProcessorFeatures.Generic,
  1096. [FeatureFuseAES, FeatureFuseAdrpAdd, FeaturePostRAScheduler,
  1097. FeatureEnableSelectOptimize]>;
  1098. def : ProcessorModel<"cortex-a35", CortexA53Model, ProcessorFeatures.A53,
  1099. [TuneA35]>;
  1100. def : ProcessorModel<"cortex-a34", CortexA53Model, ProcessorFeatures.A53,
  1101. [TuneA35]>;
  1102. def : ProcessorModel<"cortex-a53", CortexA53Model, ProcessorFeatures.A53,
  1103. [TuneA53]>;
  1104. def : ProcessorModel<"cortex-a55", CortexA55Model, ProcessorFeatures.A55,
  1105. [TuneA55]>;
  1106. def : ProcessorModel<"cortex-a510", CortexA55Model, ProcessorFeatures.A510,
  1107. [TuneA510]>;
  1108. def : ProcessorModel<"cortex-a57", CortexA57Model, ProcessorFeatures.A53,
  1109. [TuneA57]>;
  1110. def : ProcessorModel<"cortex-a65", CortexA53Model, ProcessorFeatures.A65,
  1111. [TuneA65]>;
  1112. def : ProcessorModel<"cortex-a65ae", CortexA53Model, ProcessorFeatures.A65,
  1113. [TuneA65]>;
  1114. def : ProcessorModel<"cortex-a72", CortexA57Model, ProcessorFeatures.A53,
  1115. [TuneA72]>;
  1116. def : ProcessorModel<"cortex-a73", CortexA57Model, ProcessorFeatures.A53,
  1117. [TuneA73]>;
  1118. def : ProcessorModel<"cortex-a75", CortexA57Model, ProcessorFeatures.A55,
  1119. [TuneA75]>;
  1120. def : ProcessorModel<"cortex-a76", CortexA57Model, ProcessorFeatures.A76,
  1121. [TuneA76]>;
  1122. def : ProcessorModel<"cortex-a76ae", CortexA57Model, ProcessorFeatures.A76,
  1123. [TuneA76]>;
  1124. def : ProcessorModel<"cortex-a77", CortexA57Model, ProcessorFeatures.A77,
  1125. [TuneA77]>;
  1126. def : ProcessorModel<"cortex-a78", CortexA57Model, ProcessorFeatures.A78,
  1127. [TuneA78]>;
  1128. def : ProcessorModel<"cortex-a78c", CortexA57Model, ProcessorFeatures.A78C,
  1129. [TuneA78C]>;
  1130. def : ProcessorModel<"cortex-a710", NeoverseN2Model, ProcessorFeatures.A710,
  1131. [TuneA710]>;
  1132. def : ProcessorModel<"cortex-a715", NeoverseN2Model, ProcessorFeatures.A715,
  1133. [TuneA715]>;
  1134. def : ProcessorModel<"cortex-r82", CortexA55Model, ProcessorFeatures.R82,
  1135. [TuneR82]>;
  1136. def : ProcessorModel<"cortex-x1", CortexA57Model, ProcessorFeatures.X1,
  1137. [TuneX1]>;
  1138. def : ProcessorModel<"cortex-x1c", CortexA57Model, ProcessorFeatures.X1C,
  1139. [TuneX1]>;
  1140. def : ProcessorModel<"cortex-x2", NeoverseN2Model, ProcessorFeatures.X2,
  1141. [TuneX2]>;
  1142. def : ProcessorModel<"cortex-x3", NeoverseN2Model, ProcessorFeatures.X3,
  1143. [TuneX3]>;
  1144. def : ProcessorModel<"neoverse-e1", CortexA53Model,
  1145. ProcessorFeatures.NeoverseE1, [TuneNeoverseE1]>;
  1146. def : ProcessorModel<"neoverse-n1", CortexA57Model,
  1147. ProcessorFeatures.NeoverseN1, [TuneNeoverseN1]>;
  1148. def : ProcessorModel<"neoverse-n2", NeoverseN2Model,
  1149. ProcessorFeatures.NeoverseN2, [TuneNeoverseN2]>;
  1150. def : ProcessorModel<"neoverse-512tvb", NeoverseN2Model,
  1151. ProcessorFeatures.Neoverse512TVB, [TuneNeoverse512TVB]>;
  1152. def : ProcessorModel<"neoverse-v1", NeoverseN2Model,
  1153. ProcessorFeatures.NeoverseV1, [TuneNeoverseV1]>;
  1154. def : ProcessorModel<"neoverse-v2", NeoverseN2Model,
  1155. ProcessorFeatures.NeoverseV2, [TuneNeoverseV2]>;
  1156. def : ProcessorModel<"exynos-m3", ExynosM3Model, ProcessorFeatures.ExynosM3,
  1157. [TuneExynosM3]>;
  1158. def : ProcessorModel<"exynos-m4", ExynosM4Model, ProcessorFeatures.ExynosM4,
  1159. [TuneExynosM4]>;
  1160. def : ProcessorModel<"exynos-m5", ExynosM5Model, ProcessorFeatures.ExynosM4,
  1161. [TuneExynosM4]>;
  1162. def : ProcessorModel<"falkor", FalkorModel, ProcessorFeatures.Falkor,
  1163. [TuneFalkor]>;
  1164. def : ProcessorModel<"saphira", FalkorModel, ProcessorFeatures.Saphira,
  1165. [TuneSaphira]>;
  1166. def : ProcessorModel<"kryo", KryoModel, ProcessorFeatures.A53, [TuneKryo]>;
  1167. // Cavium ThunderX/ThunderX T8X Processors
  1168. def : ProcessorModel<"thunderx", ThunderXT8XModel, ProcessorFeatures.ThunderX,
  1169. [TuneThunderX]>;
  1170. def : ProcessorModel<"thunderxt88", ThunderXT8XModel,
  1171. ProcessorFeatures.ThunderX, [TuneThunderXT88]>;
  1172. def : ProcessorModel<"thunderxt81", ThunderXT8XModel,
  1173. ProcessorFeatures.ThunderX, [TuneThunderXT81]>;
  1174. def : ProcessorModel<"thunderxt83", ThunderXT8XModel,
  1175. ProcessorFeatures.ThunderX, [TuneThunderXT83]>;
  1176. // Cavium ThunderX2T9X Processors. Formerly Broadcom Vulcan.
  1177. def : ProcessorModel<"thunderx2t99", ThunderX2T99Model,
  1178. ProcessorFeatures.ThunderX2T99, [TuneThunderX2T99]>;
  1179. // Marvell ThunderX3T110 Processors.
  1180. def : ProcessorModel<"thunderx3t110", ThunderX3T110Model,
  1181. ProcessorFeatures.ThunderX3T110, [TuneThunderX3T110]>;
  1182. def : ProcessorModel<"tsv110", TSV110Model, ProcessorFeatures.TSV110,
  1183. [TuneTSV110]>;
  1184. // Support cyclone as an alias for apple-a7 so we can still LTO old bitcode.
  1185. def : ProcessorModel<"cyclone", CycloneModel, ProcessorFeatures.AppleA7,
  1186. [TuneAppleA7]>;
  1187. // iPhone and iPad CPUs
  1188. def : ProcessorModel<"apple-a7", CycloneModel, ProcessorFeatures.AppleA7,
  1189. [TuneAppleA7]>;
  1190. def : ProcessorModel<"apple-a8", CycloneModel, ProcessorFeatures.AppleA7,
  1191. [TuneAppleA7]>;
  1192. def : ProcessorModel<"apple-a9", CycloneModel, ProcessorFeatures.AppleA7,
  1193. [TuneAppleA7]>;
  1194. def : ProcessorModel<"apple-a10", CycloneModel, ProcessorFeatures.AppleA10,
  1195. [TuneAppleA10]>;
  1196. def : ProcessorModel<"apple-a11", CycloneModel, ProcessorFeatures.AppleA11,
  1197. [TuneAppleA11]>;
  1198. def : ProcessorModel<"apple-a12", CycloneModel, ProcessorFeatures.AppleA12,
  1199. [TuneAppleA12]>;
  1200. def : ProcessorModel<"apple-a13", CycloneModel, ProcessorFeatures.AppleA13,
  1201. [TuneAppleA13]>;
  1202. def : ProcessorModel<"apple-a14", CycloneModel, ProcessorFeatures.AppleA14,
  1203. [TuneAppleA14]>;
  1204. def : ProcessorModel<"apple-a15", CycloneModel, ProcessorFeatures.AppleA15,
  1205. [TuneAppleA15]>;
  1206. def : ProcessorModel<"apple-a16", CycloneModel, ProcessorFeatures.AppleA16,
  1207. [TuneAppleA16]>;
  1208. // Mac CPUs
  1209. def : ProcessorModel<"apple-m1", CycloneModel, ProcessorFeatures.AppleA14,
  1210. [TuneAppleA14]>;
  1211. def : ProcessorModel<"apple-m2", CycloneModel, ProcessorFeatures.AppleA15,
  1212. [TuneAppleA15]>;
  1213. // watch CPUs.
  1214. def : ProcessorModel<"apple-s4", CycloneModel, ProcessorFeatures.AppleA12,
  1215. [TuneAppleA12]>;
  1216. def : ProcessorModel<"apple-s5", CycloneModel, ProcessorFeatures.AppleA12,
  1217. [TuneAppleA12]>;
  1218. // Alias for the latest Apple processor model supported by LLVM.
  1219. def : ProcessorModel<"apple-latest", CycloneModel, ProcessorFeatures.AppleA16,
  1220. [TuneAppleA16]>;
  1221. // Fujitsu A64FX
  1222. def : ProcessorModel<"a64fx", A64FXModel, ProcessorFeatures.A64FX,
  1223. [TuneA64FX]>;
  1224. // Nvidia Carmel
  1225. def : ProcessorModel<"carmel", NoSchedModel, ProcessorFeatures.Carmel,
  1226. [TuneCarmel]>;
  1227. // Ampere Computing
  1228. def : ProcessorModel<"ampere1", Ampere1Model, ProcessorFeatures.Ampere1,
  1229. [TuneAmpere1]>;
  1230. def : ProcessorModel<"ampere1a", Ampere1Model, ProcessorFeatures.Ampere1A,
  1231. [TuneAmpere1A]>;
  1232. //===----------------------------------------------------------------------===//
  1233. // Assembly parser
  1234. //===----------------------------------------------------------------------===//
  1235. def GenericAsmParserVariant : AsmParserVariant {
  1236. int Variant = 0;
  1237. string Name = "generic";
  1238. string BreakCharacters = ".";
  1239. string TokenizingCharacters = "[]*!/";
  1240. }
  1241. def AppleAsmParserVariant : AsmParserVariant {
  1242. int Variant = 1;
  1243. string Name = "apple-neon";
  1244. string BreakCharacters = ".";
  1245. string TokenizingCharacters = "[]*!/";
  1246. }
  1247. //===----------------------------------------------------------------------===//
  1248. // Assembly printer
  1249. //===----------------------------------------------------------------------===//
  1250. // AArch64 Uses the MC printer for asm output, so make sure the TableGen
  1251. // AsmWriter bits get associated with the correct class.
  1252. def GenericAsmWriter : AsmWriter {
  1253. string AsmWriterClassName = "InstPrinter";
  1254. int PassSubtarget = 1;
  1255. int Variant = 0;
  1256. bit isMCAsmWriter = 1;
  1257. }
  1258. def AppleAsmWriter : AsmWriter {
  1259. let AsmWriterClassName = "AppleInstPrinter";
  1260. int PassSubtarget = 1;
  1261. int Variant = 1;
  1262. int isMCAsmWriter = 1;
  1263. }
  1264. //===----------------------------------------------------------------------===//
  1265. // Target Declaration
  1266. //===----------------------------------------------------------------------===//
  1267. def AArch64 : Target {
  1268. let InstructionSet = AArch64InstrInfo;
  1269. let AssemblyParserVariants = [GenericAsmParserVariant, AppleAsmParserVariant];
  1270. let AssemblyWriters = [GenericAsmWriter, AppleAsmWriter];
  1271. let AllowRegisterRenaming = 1;
  1272. }
  1273. //===----------------------------------------------------------------------===//
  1274. // Pfm Counters
  1275. //===----------------------------------------------------------------------===//
  1276. include "AArch64PfmCounters.td"