PPC.td 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. //===-- PPC.td - Describe the PowerPC 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. // This is the top level entry point for the PowerPC target.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. // Get the target-independent interfaces which we are implementing.
  13. //
  14. include "llvm/Target/Target.td"
  15. //===----------------------------------------------------------------------===//
  16. // PowerPC Subtarget features.
  17. //
  18. //===----------------------------------------------------------------------===//
  19. // CPU Directives //
  20. //===----------------------------------------------------------------------===//
  21. def Directive440 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_440", "">;
  22. def Directive601 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_601", "">;
  23. def Directive602 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_602", "">;
  24. def Directive603 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_603", "">;
  25. def Directive604 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_603", "">;
  26. def Directive620 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_603", "">;
  27. def Directive7400: SubtargetFeature<"", "CPUDirective", "PPC::DIR_7400", "">;
  28. def Directive750 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_750", "">;
  29. def Directive970 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_970", "">;
  30. def Directive32 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_32", "">;
  31. def Directive64 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_64", "">;
  32. def DirectiveA2 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_A2", "">;
  33. def DirectiveE500 : SubtargetFeature<"", "CPUDirective",
  34. "PPC::DIR_E500", "">;
  35. def DirectiveE500mc : SubtargetFeature<"", "CPUDirective",
  36. "PPC::DIR_E500mc", "">;
  37. def DirectiveE5500 : SubtargetFeature<"", "CPUDirective",
  38. "PPC::DIR_E5500", "">;
  39. def DirectivePwr3: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR3", "">;
  40. def DirectivePwr4: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR4", "">;
  41. def DirectivePwr5: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR5", "">;
  42. def DirectivePwr5x
  43. : SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR5X", "">;
  44. def DirectivePwr6: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR6", "">;
  45. def DirectivePwr6x
  46. : SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR6X", "">;
  47. def DirectivePwr7: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR7", "">;
  48. def DirectivePwr8: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR8", "">;
  49. def DirectivePwr9: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR9", "">;
  50. def DirectivePwr10: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR10", "">;
  51. def DirectivePwrFuture
  52. : SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR_FUTURE", "">;
  53. def Feature64Bit : SubtargetFeature<"64bit","Has64BitSupport", "true",
  54. "Enable 64-bit instructions">;
  55. def AIXOS: SubtargetFeature<"aix", "IsAIX", "true", "AIX OS">;
  56. def FeatureModernAIXAs
  57. : SubtargetFeature<"modern-aix-as", "HasModernAIXAs", "true",
  58. "AIX system assembler is modern enough to support new mnes">;
  59. def FeatureHardFloat : SubtargetFeature<"hard-float", "HasHardFloat", "true",
  60. "Enable floating-point instructions">;
  61. def Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true",
  62. "Enable 64-bit registers usage for ppc32 [beta]">;
  63. def FeatureCRBits : SubtargetFeature<"crbits", "UseCRBits", "true",
  64. "Use condition-register bits individually">;
  65. def FeatureFPU : SubtargetFeature<"fpu","HasFPU","true",
  66. "Enable classic FPU instructions",
  67. [FeatureHardFloat]>;
  68. def FeatureAltivec : SubtargetFeature<"altivec","HasAltivec", "true",
  69. "Enable Altivec instructions",
  70. [FeatureFPU]>;
  71. def FeatureSPE : SubtargetFeature<"spe","HasSPE", "true",
  72. "Enable SPE instructions",
  73. [FeatureHardFloat]>;
  74. def FeatureEFPU2 : SubtargetFeature<"efpu2", "HasEFPU2", "true",
  75. "Enable Embedded Floating-Point APU 2 instructions",
  76. [FeatureSPE]>;
  77. def FeatureMFOCRF : SubtargetFeature<"mfocrf","HasMFOCRF", "true",
  78. "Enable the MFOCRF instruction">;
  79. def FeatureFSqrt : SubtargetFeature<"fsqrt","HasFSQRT", "true",
  80. "Enable the fsqrt instruction",
  81. [FeatureFPU]>;
  82. def FeatureFCPSGN : SubtargetFeature<"fcpsgn", "HasFCPSGN", "true",
  83. "Enable the fcpsgn instruction",
  84. [FeatureFPU]>;
  85. def FeatureFRE : SubtargetFeature<"fre", "HasFRE", "true",
  86. "Enable the fre instruction",
  87. [FeatureFPU]>;
  88. def FeatureFRES : SubtargetFeature<"fres", "HasFRES", "true",
  89. "Enable the fres instruction",
  90. [FeatureFPU]>;
  91. def FeatureFRSQRTE : SubtargetFeature<"frsqrte", "HasFRSQRTE", "true",
  92. "Enable the frsqrte instruction",
  93. [FeatureFPU]>;
  94. def FeatureFRSQRTES : SubtargetFeature<"frsqrtes", "HasFRSQRTES", "true",
  95. "Enable the frsqrtes instruction",
  96. [FeatureFPU]>;
  97. def FeatureRecipPrec : SubtargetFeature<"recipprec", "HasRecipPrec", "true",
  98. "Assume higher precision reciprocal estimates">;
  99. def FeatureSTFIWX : SubtargetFeature<"stfiwx","HasSTFIWX", "true",
  100. "Enable the stfiwx instruction",
  101. [FeatureFPU]>;
  102. def FeatureLFIWAX : SubtargetFeature<"lfiwax","HasLFIWAX", "true",
  103. "Enable the lfiwax instruction",
  104. [FeatureFPU]>;
  105. def FeatureFPRND : SubtargetFeature<"fprnd", "HasFPRND", "true",
  106. "Enable the fri[mnpz] instructions",
  107. [FeatureFPU]>;
  108. def FeatureFPCVT : SubtargetFeature<"fpcvt", "HasFPCVT", "true",
  109. "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions",
  110. [FeatureFPU]>;
  111. def FeatureISEL : SubtargetFeature<"isel","HasISEL", "true",
  112. "Enable the isel instruction">;
  113. def FeatureBPERMD : SubtargetFeature<"bpermd", "HasBPERMD", "true",
  114. "Enable the bpermd instruction">;
  115. def FeatureExtDiv : SubtargetFeature<"extdiv", "HasExtDiv", "true",
  116. "Enable extended divide instructions">;
  117. def FeatureLDBRX : SubtargetFeature<"ldbrx","HasLDBRX", "true",
  118. "Enable the ldbrx instruction">;
  119. def FeatureCMPB : SubtargetFeature<"cmpb", "HasCMPB", "true",
  120. "Enable the cmpb instruction">;
  121. def FeatureICBT : SubtargetFeature<"icbt","HasICBT", "true",
  122. "Enable icbt instruction">;
  123. def FeatureBookE : SubtargetFeature<"booke", "IsBookE", "true",
  124. "Enable Book E instructions",
  125. [FeatureICBT]>;
  126. def FeatureMSYNC : SubtargetFeature<"msync", "HasOnlyMSYNC", "true",
  127. "Has only the msync instruction instead of sync",
  128. [FeatureBookE]>;
  129. def FeatureE500 : SubtargetFeature<"e500", "IsE500", "true",
  130. "Enable E500/E500mc instructions">;
  131. def FeatureSecurePlt : SubtargetFeature<"secure-plt","SecurePlt", "true",
  132. "Enable secure plt mode">;
  133. def FeaturePPC4xx : SubtargetFeature<"ppc4xx", "IsPPC4xx", "true",
  134. "Enable PPC 4xx instructions">;
  135. def FeaturePPC6xx : SubtargetFeature<"ppc6xx", "IsPPC6xx", "true",
  136. "Enable PPC 6xx instructions">;
  137. def FeatureVSX : SubtargetFeature<"vsx","HasVSX", "true",
  138. "Enable VSX instructions",
  139. [FeatureAltivec]>;
  140. def FeatureTwoConstNR :
  141. SubtargetFeature<"two-const-nr", "NeedsTwoConstNR", "true",
  142. "Requires two constant Newton-Raphson computation">;
  143. def FeatureP8Altivec : SubtargetFeature<"power8-altivec", "HasP8Altivec", "true",
  144. "Enable POWER8 Altivec instructions",
  145. [FeatureAltivec]>;
  146. def FeatureP8Crypto : SubtargetFeature<"crypto", "HasP8Crypto", "true",
  147. "Enable POWER8 Crypto instructions",
  148. [FeatureP8Altivec]>;
  149. def FeatureP8Vector : SubtargetFeature<"power8-vector", "HasP8Vector", "true",
  150. "Enable POWER8 vector instructions",
  151. [FeatureVSX, FeatureP8Altivec]>;
  152. def FeatureDirectMove :
  153. SubtargetFeature<"direct-move", "HasDirectMove", "true",
  154. "Enable Power8 direct move instructions",
  155. [FeatureVSX]>;
  156. def FeaturePartwordAtomic : SubtargetFeature<"partword-atomics",
  157. "HasPartwordAtomics", "true",
  158. "Enable l[bh]arx and st[bh]cx.">;
  159. def FeatureQuadwordAtomic : SubtargetFeature<"quadword-atomics",
  160. "HasQuadwordAtomics", "true",
  161. "Enable lqarx and stqcx.">;
  162. def FeatureInvariantFunctionDescriptors :
  163. SubtargetFeature<"invariant-function-descriptors",
  164. "HasInvariantFunctionDescriptors", "true",
  165. "Assume function descriptors are invariant">;
  166. def FeatureLongCall : SubtargetFeature<"longcall", "UseLongCalls", "true",
  167. "Always use indirect calls">;
  168. def FeatureHTM : SubtargetFeature<"htm", "HasHTM", "true",
  169. "Enable Hardware Transactional Memory instructions">;
  170. def FeatureMFTB : SubtargetFeature<"", "FeatureMFTB", "true",
  171. "Implement mftb using the mfspr instruction">;
  172. def FeatureFusion : SubtargetFeature<"fusion", "HasFusion", "true",
  173. "Target supports instruction fusion">;
  174. def FeatureAddiLoadFusion : SubtargetFeature<"fuse-addi-load",
  175. "HasAddiLoadFusion", "true",
  176. "Power8 Addi-Load fusion",
  177. [FeatureFusion]>;
  178. def FeatureAddisLoadFusion : SubtargetFeature<"fuse-addis-load",
  179. "HasAddisLoadFusion", "true",
  180. "Power8 Addis-Load fusion",
  181. [FeatureFusion]>;
  182. def FeatureStoreFusion : SubtargetFeature<"fuse-store", "HasStoreFusion", "true",
  183. "Target supports store clustering",
  184. [FeatureFusion]>;
  185. def FeatureArithAddFusion :
  186. SubtargetFeature<"fuse-arith-add", "HasArithAddFusion", "true",
  187. "Target supports Arithmetic Operations with Add fusion",
  188. [FeatureFusion]>;
  189. def FeatureAddLogicalFusion :
  190. SubtargetFeature<"fuse-add-logical", "HasAddLogicalFusion", "true",
  191. "Target supports Add with Logical Operations fusion",
  192. [FeatureFusion]>;
  193. def FeatureLogicalAddFusion :
  194. SubtargetFeature<"fuse-logical-add", "HasLogicalAddFusion", "true",
  195. "Target supports Logical with Add Operations fusion",
  196. [FeatureFusion]>;
  197. def FeatureLogicalFusion :
  198. SubtargetFeature<"fuse-logical", "HasLogicalFusion", "true",
  199. "Target supports Logical Operations fusion",
  200. [FeatureFusion]>;
  201. def FeatureSha3Fusion :
  202. SubtargetFeature<"fuse-sha3", "HasSha3Fusion", "true",
  203. "Target supports SHA3 assist fusion",
  204. [FeatureFusion]>;
  205. def FeatureCompareFusion:
  206. SubtargetFeature<"fuse-cmp", "HasCompareFusion", "true",
  207. "Target supports Comparison Operations fusion",
  208. [FeatureFusion]>;
  209. def FeatureWideImmFusion:
  210. SubtargetFeature<"fuse-wideimm", "HasWideImmFusion", "true",
  211. "Target supports Wide-Immediate fusion",
  212. [FeatureFusion]>;
  213. def FeatureZeroMoveFusion:
  214. SubtargetFeature<"fuse-zeromove", "HasZeroMoveFusion", "true",
  215. "Target supports move to SPR with branch fusion",
  216. [FeatureFusion]>;
  217. def FeatureBack2BackFusion:
  218. SubtargetFeature<"fuse-back2back", "HasBack2BackFusion", "true",
  219. "Target supports general back to back fusion",
  220. [FeatureFusion]>;
  221. def FeatureUnalignedFloats :
  222. SubtargetFeature<"allow-unaligned-fp-access", "AllowsUnalignedFPAccess",
  223. "true", "CPU does not trap on unaligned FP access">;
  224. def FeaturePPCPreRASched:
  225. SubtargetFeature<"ppc-prera-sched", "UsePPCPreRASchedStrategy", "true",
  226. "Use PowerPC pre-RA scheduling strategy">;
  227. def FeaturePPCPostRASched:
  228. SubtargetFeature<"ppc-postra-sched", "UsePPCPostRASchedStrategy", "true",
  229. "Use PowerPC post-RA scheduling strategy">;
  230. def FeatureFloat128 :
  231. SubtargetFeature<"float128", "HasFloat128", "true",
  232. "Enable the __float128 data type for IEEE-754R Binary128.",
  233. [FeatureVSX]>;
  234. def FeaturePOPCNTD : SubtargetFeature<"popcntd","HasPOPCNTD",
  235. "POPCNTD_Fast",
  236. "Enable the popcnt[dw] instructions">;
  237. // Note that for the a2 processor models we should not use popcnt[dw] by
  238. // default. These processors do support the instructions, but they're
  239. // microcoded, and the software emulation is about twice as fast.
  240. def FeatureSlowPOPCNTD : SubtargetFeature<"slow-popcntd","HasPOPCNTD",
  241. "POPCNTD_Slow",
  242. "Has slow popcnt[dw] instructions">;
  243. def DeprecatedDST : SubtargetFeature<"", "DeprecatedDST", "true",
  244. "Treat vector data stream cache control instructions as deprecated">;
  245. def FeatureISA2_06 : SubtargetFeature<"isa-v206-instructions", "IsISA2_06",
  246. "true",
  247. "Enable instructions in ISA 2.06.">;
  248. def FeatureISA2_07 : SubtargetFeature<"isa-v207-instructions", "IsISA2_07",
  249. "true",
  250. "Enable instructions in ISA 2.07.">;
  251. def FeatureISA3_0 : SubtargetFeature<"isa-v30-instructions", "IsISA3_0",
  252. "true",
  253. "Enable instructions in ISA 3.0.",
  254. [FeatureISA2_07]>;
  255. def FeatureISA3_1 : SubtargetFeature<"isa-v31-instructions", "IsISA3_1",
  256. "true",
  257. "Enable instructions in ISA 3.1.",
  258. [FeatureISA3_0]>;
  259. def FeatureP9Altivec : SubtargetFeature<"power9-altivec", "HasP9Altivec", "true",
  260. "Enable POWER9 Altivec instructions",
  261. [FeatureISA3_0, FeatureP8Altivec]>;
  262. def FeatureP9Vector : SubtargetFeature<"power9-vector", "HasP9Vector", "true",
  263. "Enable POWER9 vector instructions",
  264. [FeatureISA3_0, FeatureP8Vector,
  265. FeatureP9Altivec]>;
  266. def FeatureP10Vector : SubtargetFeature<"power10-vector", "HasP10Vector",
  267. "true",
  268. "Enable POWER10 vector instructions",
  269. [FeatureISA3_1, FeatureP9Vector]>;
  270. // A separate feature for this even though it is equivalent to P9Vector
  271. // because this is a feature of the implementation rather than the architecture
  272. // and may go away with future CPU's.
  273. def FeatureVectorsUseTwoUnits : SubtargetFeature<"vectors-use-two-units",
  274. "VectorsUseTwoUnits",
  275. "true",
  276. "Vectors use two units">;
  277. def FeaturePrefixInstrs : SubtargetFeature<"prefix-instrs", "HasPrefixInstrs",
  278. "true",
  279. "Enable prefixed instructions",
  280. [FeatureISA3_0, FeatureP8Vector,
  281. FeatureP9Altivec]>;
  282. def FeaturePCRelativeMemops :
  283. SubtargetFeature<"pcrelative-memops", "HasPCRelativeMemops", "true",
  284. "Enable PC relative Memory Ops",
  285. [FeatureISA3_0, FeaturePrefixInstrs]>;
  286. def FeaturePairedVectorMemops:
  287. SubtargetFeature<"paired-vector-memops", "PairedVectorMemops", "true",
  288. "32Byte load and store instructions",
  289. [FeatureISA3_0]>;
  290. def FeatureMMA : SubtargetFeature<"mma", "HasMMA", "true",
  291. "Enable MMA instructions",
  292. [FeatureP8Vector, FeatureP9Altivec,
  293. FeaturePairedVectorMemops]>;
  294. def FeatureROPProtect :
  295. SubtargetFeature<"rop-protect", "HasROPProtect", "true",
  296. "Add ROP protect">;
  297. def FeaturePrivileged :
  298. SubtargetFeature<"privileged", "HasPrivileged", "true",
  299. "Add privileged instructions">;
  300. def FeaturePredictableSelectIsExpensive :
  301. SubtargetFeature<"predictable-select-expensive",
  302. "PredictableSelectIsExpensive",
  303. "true",
  304. "Prefer likely predicted branches over selects">;
  305. // Since new processors generally contain a superset of features of those that
  306. // came before them, the idea is to make implementations of new processors
  307. // less error prone and easier to read.
  308. // Namely:
  309. // list<SubtargetFeature> P8InheritableFeatures = ...
  310. // list<SubtargetFeature> FutureProcessorAddtionalFeatures =
  311. // [ features that Power8 does not support but inheritable ]
  312. // list<SubtargetFeature> FutureProcessorSpecificFeatures =
  313. // [ features that Power8 does not support and not inheritable ]
  314. // list<SubtargetFeature> FutureProcessorInheritableFeatures =
  315. // !listconcat(P8InheritableFeatures, FutureProcessorAddtionalFeatures)
  316. // list<SubtargetFeature> FutureProcessorFeatures =
  317. // !listconcat(FutureProcessorInheritableFeatures,
  318. // FutureProcessorSpecificFeatures)
  319. // Makes it explicit and obvious what is new in FutureProcessor vs. Power8 as
  320. // well as providing a single point of definition if the feature set will be
  321. // used elsewhere.
  322. def ProcessorFeatures {
  323. // Power7
  324. list<SubtargetFeature> P7InheritableFeatures = [DirectivePwr7,
  325. FeatureAltivec,
  326. FeatureVSX,
  327. FeatureMFOCRF,
  328. FeatureFCPSGN,
  329. FeatureFSqrt,
  330. FeatureFRE,
  331. FeatureFRES,
  332. FeatureFRSQRTE,
  333. FeatureFRSQRTES,
  334. FeatureRecipPrec,
  335. FeatureSTFIWX,
  336. FeatureLFIWAX,
  337. FeatureFPRND,
  338. FeatureFPCVT,
  339. FeatureISEL,
  340. FeaturePOPCNTD,
  341. FeatureCMPB,
  342. FeatureLDBRX,
  343. Feature64Bit,
  344. /* Feature64BitRegs, */
  345. FeatureBPERMD,
  346. FeatureExtDiv,
  347. FeatureMFTB,
  348. DeprecatedDST,
  349. FeatureTwoConstNR,
  350. FeatureUnalignedFloats,
  351. FeatureISA2_06];
  352. list<SubtargetFeature> P7SpecificFeatures = [];
  353. list<SubtargetFeature> P7Features =
  354. !listconcat(P7InheritableFeatures, P7SpecificFeatures);
  355. // Power8
  356. list<SubtargetFeature> P8AdditionalFeatures =
  357. [DirectivePwr8,
  358. FeatureP8Altivec,
  359. FeatureP8Vector,
  360. FeatureP8Crypto,
  361. FeatureHTM,
  362. FeatureDirectMove,
  363. FeatureICBT,
  364. FeaturePartwordAtomic,
  365. FeatureQuadwordAtomic,
  366. FeaturePredictableSelectIsExpensive,
  367. FeatureISA2_07
  368. ];
  369. list<SubtargetFeature> P8SpecificFeatures = [FeatureAddiLoadFusion,
  370. FeatureAddisLoadFusion];
  371. list<SubtargetFeature> P8InheritableFeatures =
  372. !listconcat(P7InheritableFeatures, P8AdditionalFeatures);
  373. list<SubtargetFeature> P8Features =
  374. !listconcat(P8InheritableFeatures, P8SpecificFeatures);
  375. // Power9
  376. list<SubtargetFeature> P9AdditionalFeatures =
  377. [DirectivePwr9,
  378. FeatureP9Altivec,
  379. FeatureP9Vector,
  380. FeaturePPCPreRASched,
  381. FeaturePPCPostRASched,
  382. FeatureISA3_0,
  383. FeaturePredictableSelectIsExpensive
  384. ];
  385. // Some features are unique to Power9 and there is no reason to assume
  386. // they will be part of any future CPUs. One example is the narrower
  387. // dispatch for vector operations than scalar ones. For the time being,
  388. // this list also includes scheduling-related features since we do not have
  389. // enough info to create custom scheduling strategies for future CPUs.
  390. list<SubtargetFeature> P9SpecificFeatures = [FeatureVectorsUseTwoUnits];
  391. list<SubtargetFeature> P9InheritableFeatures =
  392. !listconcat(P8InheritableFeatures, P9AdditionalFeatures);
  393. list<SubtargetFeature> P9Features =
  394. !listconcat(P9InheritableFeatures, P9SpecificFeatures);
  395. // Power10
  396. // For P10 CPU we assume that all of the existing features from Power9
  397. // still exist with the exception of those we know are Power9 specific.
  398. list<SubtargetFeature> FusionFeatures = [
  399. FeatureStoreFusion, FeatureAddLogicalFusion, FeatureLogicalAddFusion,
  400. FeatureLogicalFusion, FeatureArithAddFusion, FeatureSha3Fusion,
  401. ];
  402. list<SubtargetFeature> P10AdditionalFeatures =
  403. !listconcat(FusionFeatures, [
  404. DirectivePwr10, FeatureISA3_1, FeaturePrefixInstrs,
  405. FeaturePCRelativeMemops, FeatureP10Vector, FeatureMMA,
  406. FeaturePairedVectorMemops]);
  407. list<SubtargetFeature> P10SpecificFeatures = [];
  408. list<SubtargetFeature> P10InheritableFeatures =
  409. !listconcat(P9InheritableFeatures, P10AdditionalFeatures);
  410. list<SubtargetFeature> P10Features =
  411. !listconcat(P10InheritableFeatures, P10SpecificFeatures);
  412. // Future
  413. // For future CPU we assume that all of the existing features from Power10
  414. // still exist with the exception of those we know are Power10 specific.
  415. list<SubtargetFeature> FutureAdditionalFeatures = [];
  416. list<SubtargetFeature> FutureSpecificFeatures = [];
  417. list<SubtargetFeature> FutureInheritableFeatures =
  418. !listconcat(P10InheritableFeatures, FutureAdditionalFeatures);
  419. list<SubtargetFeature> FutureFeatures =
  420. !listconcat(FutureInheritableFeatures, FutureSpecificFeatures);
  421. }
  422. // Note: Future features to add when support is extended to more
  423. // recent ISA levels:
  424. //
  425. // DFP p6, p6x, p7 decimal floating-point instructions
  426. // POPCNTB p5 through p7 popcntb and related instructions
  427. //===----------------------------------------------------------------------===//
  428. // Classes used for relation maps.
  429. //===----------------------------------------------------------------------===//
  430. // RecFormRel - Filter class used to relate non-record-form instructions with
  431. // their record-form variants.
  432. class RecFormRel;
  433. // AltVSXFMARel - Filter class used to relate the primary addend-killing VSX
  434. // FMA instruction forms with their corresponding factor-killing forms.
  435. class AltVSXFMARel {
  436. bit IsVSXFMAAlt = 0;
  437. }
  438. //===----------------------------------------------------------------------===//
  439. // Relation Map Definitions.
  440. //===----------------------------------------------------------------------===//
  441. def getRecordFormOpcode : InstrMapping {
  442. let FilterClass = "RecFormRel";
  443. // Instructions with the same BaseName and Interpretation64Bit values
  444. // form a row.
  445. let RowFields = ["BaseName", "Interpretation64Bit"];
  446. // Instructions with the same RC value form a column.
  447. let ColFields = ["RC"];
  448. // The key column are the non-record-form instructions.
  449. let KeyCol = ["0"];
  450. // Value columns RC=1
  451. let ValueCols = [["1"]];
  452. }
  453. def getNonRecordFormOpcode : InstrMapping {
  454. let FilterClass = "RecFormRel";
  455. // Instructions with the same BaseName and Interpretation64Bit values
  456. // form a row.
  457. let RowFields = ["BaseName", "Interpretation64Bit"];
  458. // Instructions with the same RC value form a column.
  459. let ColFields = ["RC"];
  460. // The key column are the record-form instructions.
  461. let KeyCol = ["1"];
  462. // Value columns are RC=0
  463. let ValueCols = [["0"]];
  464. }
  465. def getAltVSXFMAOpcode : InstrMapping {
  466. let FilterClass = "AltVSXFMARel";
  467. // Instructions with the same BaseName value form a row.
  468. let RowFields = ["BaseName"];
  469. // Instructions with the same IsVSXFMAAlt value form a column.
  470. let ColFields = ["IsVSXFMAAlt"];
  471. // The key column are the (default) addend-killing instructions.
  472. let KeyCol = ["0"];
  473. // Value columns IsVSXFMAAlt=1
  474. let ValueCols = [["1"]];
  475. }
  476. //===----------------------------------------------------------------------===//
  477. // Register File Description
  478. //===----------------------------------------------------------------------===//
  479. include "PPCRegisterInfo.td"
  480. include "PPCSchedule.td"
  481. include "GISel/PPCRegisterBanks.td"
  482. //===----------------------------------------------------------------------===//
  483. // PowerPC processors supported.
  484. //
  485. def : Processor<"generic", G3Itineraries, [Directive32, FeatureHardFloat,
  486. FeatureMFTB]>;
  487. def : ProcessorModel<"440", PPC440Model, [Directive440, FeatureISEL,
  488. FeatureFRES, FeatureFRSQRTE,
  489. FeatureICBT, FeatureBookE,
  490. FeatureMSYNC, FeatureMFTB]>;
  491. def : ProcessorModel<"450", PPC440Model, [Directive440, FeatureISEL,
  492. FeatureFRES, FeatureFRSQRTE,
  493. FeatureICBT, FeatureBookE,
  494. FeatureMSYNC, FeatureMFTB]>;
  495. def : Processor<"601", G3Itineraries, [Directive601, FeatureFPU]>;
  496. def : Processor<"602", G3Itineraries, [Directive602, FeatureFPU,
  497. FeatureMFTB]>;
  498. def : Processor<"603", G3Itineraries, [Directive603,
  499. FeatureFRES, FeatureFRSQRTE,
  500. FeatureMFTB]>;
  501. def : Processor<"603e", G3Itineraries, [Directive603,
  502. FeatureFRES, FeatureFRSQRTE,
  503. FeatureMFTB]>;
  504. def : Processor<"603ev", G3Itineraries, [Directive603,
  505. FeatureFRES, FeatureFRSQRTE,
  506. FeatureMFTB]>;
  507. def : Processor<"604", G3Itineraries, [Directive604,
  508. FeatureFRES, FeatureFRSQRTE,
  509. FeatureMFTB]>;
  510. def : Processor<"604e", G3Itineraries, [Directive604,
  511. FeatureFRES, FeatureFRSQRTE,
  512. FeatureMFTB]>;
  513. def : Processor<"620", G3Itineraries, [Directive620,
  514. FeatureFRES, FeatureFRSQRTE,
  515. FeatureMFTB]>;
  516. def : Processor<"750", G4Itineraries, [Directive750,
  517. FeatureFRES, FeatureFRSQRTE,
  518. FeatureMFTB]>;
  519. def : Processor<"g3", G3Itineraries, [Directive750,
  520. FeatureFRES, FeatureFRSQRTE,
  521. FeatureMFTB]>;
  522. def : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec,
  523. FeatureFRES, FeatureFRSQRTE,
  524. FeatureMFTB]>;
  525. def : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec,
  526. FeatureFRES, FeatureFRSQRTE,
  527. FeatureMFTB]>;
  528. def : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec,
  529. FeatureFRES, FeatureFRSQRTE,
  530. FeatureMFTB]>;
  531. def : Processor<"g4+", G4PlusItineraries, [Directive7400, FeatureAltivec,
  532. FeatureFRES, FeatureFRSQRTE,
  533. FeatureMFTB]>;
  534. def : ProcessorModel<"970", G5Model,
  535. [Directive970, FeatureAltivec,
  536. FeatureMFOCRF, FeatureFSqrt,
  537. FeatureFRES, FeatureFRSQRTE, FeatureSTFIWX,
  538. Feature64Bit /*, Feature64BitRegs */,
  539. FeatureMFTB]>;
  540. def : ProcessorModel<"g5", G5Model,
  541. [Directive970, FeatureAltivec,
  542. FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
  543. FeatureFRES, FeatureFRSQRTE,
  544. Feature64Bit /*, Feature64BitRegs */,
  545. FeatureMFTB, DeprecatedDST]>;
  546. def : ProcessorModel<"e500", PPCE500Model,
  547. [DirectiveE500,
  548. FeatureICBT, FeatureBookE,
  549. FeatureISEL, FeatureMFTB, FeatureMSYNC, FeatureSPE]>;
  550. def : ProcessorModel<"e500mc", PPCE500mcModel,
  551. [DirectiveE500mc,
  552. FeatureSTFIWX, FeatureICBT, FeatureBookE,
  553. FeatureISEL, FeatureMFTB]>;
  554. def : ProcessorModel<"e5500", PPCE5500Model,
  555. [DirectiveE5500, FeatureMFOCRF, Feature64Bit,
  556. FeatureSTFIWX, FeatureICBT, FeatureBookE,
  557. FeatureISEL, FeatureMFTB]>;
  558. def : ProcessorModel<"a2", PPCA2Model,
  559. [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF,
  560. FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
  561. FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
  562. FeatureSTFIWX, FeatureLFIWAX,
  563. FeatureFPRND, FeatureFPCVT, FeatureISEL,
  564. FeatureSlowPOPCNTD, FeatureCMPB, FeatureLDBRX,
  565. Feature64Bit /*, Feature64BitRegs */, FeatureMFTB]>;
  566. def : ProcessorModel<"pwr3", G5Model,
  567. [DirectivePwr3, FeatureAltivec,
  568. FeatureFRES, FeatureFRSQRTE, FeatureMFOCRF,
  569. FeatureSTFIWX, Feature64Bit]>;
  570. def : ProcessorModel<"pwr4", G5Model,
  571. [DirectivePwr4, FeatureAltivec, FeatureMFOCRF,
  572. FeatureFSqrt, FeatureFRES, FeatureFRSQRTE,
  573. FeatureSTFIWX, Feature64Bit, FeatureMFTB]>;
  574. def : ProcessorModel<"pwr5", G5Model,
  575. [DirectivePwr5, FeatureAltivec, FeatureMFOCRF,
  576. FeatureFSqrt, FeatureFRE, FeatureFRES,
  577. FeatureFRSQRTE, FeatureFRSQRTES,
  578. FeatureSTFIWX, Feature64Bit,
  579. FeatureMFTB, DeprecatedDST]>;
  580. def : ProcessorModel<"pwr5x", G5Model,
  581. [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
  582. FeatureFSqrt, FeatureFRE, FeatureFRES,
  583. FeatureFRSQRTE, FeatureFRSQRTES,
  584. FeatureSTFIWX, FeatureFPRND, Feature64Bit,
  585. FeatureMFTB, DeprecatedDST]>;
  586. def : ProcessorModel<"pwr6", G5Model,
  587. [DirectivePwr6, FeatureAltivec,
  588. FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE,
  589. FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
  590. FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
  591. FeatureFPRND, Feature64Bit /*, Feature64BitRegs */,
  592. FeatureMFTB, DeprecatedDST]>;
  593. def : ProcessorModel<"pwr6x", G5Model,
  594. [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
  595. FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
  596. FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
  597. FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
  598. FeatureFPRND, Feature64Bit,
  599. FeatureMFTB, DeprecatedDST]>;
  600. def : ProcessorModel<"pwr7", P7Model, ProcessorFeatures.P7Features>;
  601. def : ProcessorModel<"pwr8", P8Model, ProcessorFeatures.P8Features>;
  602. def : ProcessorModel<"pwr9", P9Model, ProcessorFeatures.P9Features>;
  603. def : ProcessorModel<"pwr10", P10Model, ProcessorFeatures.P10Features>;
  604. // No scheduler model for future CPU.
  605. def : ProcessorModel<"future", NoSchedModel,
  606. ProcessorFeatures.FutureFeatures>;
  607. def : Processor<"ppc", G3Itineraries, [Directive32, FeatureHardFloat,
  608. FeatureMFTB]>;
  609. def : Processor<"ppc32", G3Itineraries, [Directive32, FeatureHardFloat,
  610. FeatureMFTB]>;
  611. def : ProcessorModel<"ppc64", G5Model,
  612. [Directive64, FeatureAltivec,
  613. FeatureMFOCRF, FeatureFSqrt, FeatureFRES,
  614. FeatureFRSQRTE, FeatureSTFIWX,
  615. Feature64Bit /*, Feature64BitRegs */,
  616. FeatureMFTB]>;
  617. def : ProcessorModel<"ppc64le", P8Model, ProcessorFeatures.P8Features>;
  618. //===----------------------------------------------------------------------===//
  619. // Calling Conventions
  620. //===----------------------------------------------------------------------===//
  621. include "PPCCallingConv.td"
  622. def PPCInstrInfo : InstrInfo {
  623. let isLittleEndianEncoding = 1;
  624. // FIXME: Unset this when no longer needed!
  625. let decodePositionallyEncodedOperands = 1;
  626. let noNamedPositionallyEncodedOperands = 1;
  627. }
  628. def PPCAsmWriter : AsmWriter {
  629. string AsmWriterClassName = "InstPrinter";
  630. int PassSubtarget = 1;
  631. int Variant = 0;
  632. bit isMCAsmWriter = 1;
  633. }
  634. def PPCAsmParser : AsmParser {
  635. let ShouldEmitMatchRegisterName = 0;
  636. }
  637. def PPCAsmParserVariant : AsmParserVariant {
  638. int Variant = 0;
  639. // We do not use hard coded registers in asm strings. However, some
  640. // InstAlias definitions use immediate literals. Set RegisterPrefix
  641. // so that those are not misinterpreted as registers.
  642. string RegisterPrefix = "%";
  643. string BreakCharacters = ".";
  644. }
  645. def PPC : Target {
  646. // Information about the instructions.
  647. let InstructionSet = PPCInstrInfo;
  648. let AssemblyWriters = [PPCAsmWriter];
  649. let AssemblyParsers = [PPCAsmParser];
  650. let AssemblyParserVariants = [PPCAsmParserVariant];
  651. let AllowRegisterRenaming = 1;
  652. }
  653. //===----------------------------------------------------------------------===//
  654. // Pfm Counters
  655. //===----------------------------------------------------------------------===//
  656. include "PPCPfmCounters.td"