PPC.td 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  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 FeatureInvariantFunctionDescriptors :
  160. SubtargetFeature<"invariant-function-descriptors",
  161. "HasInvariantFunctionDescriptors", "true",
  162. "Assume function descriptors are invariant">;
  163. def FeatureLongCall : SubtargetFeature<"longcall", "UseLongCalls", "true",
  164. "Always use indirect calls">;
  165. def FeatureHTM : SubtargetFeature<"htm", "HasHTM", "true",
  166. "Enable Hardware Transactional Memory instructions">;
  167. def FeatureMFTB : SubtargetFeature<"", "FeatureMFTB", "true",
  168. "Implement mftb using the mfspr instruction">;
  169. def FeatureFusion : SubtargetFeature<"fusion", "HasFusion", "true",
  170. "Target supports instruction fusion">;
  171. def FeatureAddiLoadFusion : SubtargetFeature<"fuse-addi-load",
  172. "HasAddiLoadFusion", "true",
  173. "Power8 Addi-Load fusion",
  174. [FeatureFusion]>;
  175. def FeatureAddisLoadFusion : SubtargetFeature<"fuse-addis-load",
  176. "HasAddisLoadFusion", "true",
  177. "Power8 Addis-Load fusion",
  178. [FeatureFusion]>;
  179. def FeatureStoreFusion : SubtargetFeature<"fuse-store", "HasStoreFusion", "true",
  180. "Target supports store clustering",
  181. [FeatureFusion]>;
  182. def FeatureUnalignedFloats :
  183. SubtargetFeature<"allow-unaligned-fp-access", "AllowsUnalignedFPAccess",
  184. "true", "CPU does not trap on unaligned FP access">;
  185. def FeaturePPCPreRASched:
  186. SubtargetFeature<"ppc-prera-sched", "UsePPCPreRASchedStrategy", "true",
  187. "Use PowerPC pre-RA scheduling strategy">;
  188. def FeaturePPCPostRASched:
  189. SubtargetFeature<"ppc-postra-sched", "UsePPCPostRASchedStrategy", "true",
  190. "Use PowerPC post-RA scheduling strategy">;
  191. def FeatureFloat128 :
  192. SubtargetFeature<"float128", "HasFloat128", "true",
  193. "Enable the __float128 data type for IEEE-754R Binary128.",
  194. [FeatureVSX]>;
  195. def FeaturePOPCNTD : SubtargetFeature<"popcntd","HasPOPCNTD",
  196. "POPCNTD_Fast",
  197. "Enable the popcnt[dw] instructions">;
  198. // Note that for the a2 processor models we should not use popcnt[dw] by
  199. // default. These processors do support the instructions, but they're
  200. // microcoded, and the software emulation is about twice as fast.
  201. def FeatureSlowPOPCNTD : SubtargetFeature<"slow-popcntd","HasPOPCNTD",
  202. "POPCNTD_Slow",
  203. "Has slow popcnt[dw] instructions">;
  204. def DeprecatedDST : SubtargetFeature<"", "DeprecatedDST", "true",
  205. "Treat vector data stream cache control instructions as deprecated">;
  206. def FeatureISA3_0 : SubtargetFeature<"isa-v30-instructions", "IsISA3_0",
  207. "true",
  208. "Enable instructions in ISA 3.0.">;
  209. def FeatureISA3_1 : SubtargetFeature<"isa-v31-instructions", "IsISA3_1",
  210. "true",
  211. "Enable instructions in ISA 3.1.",
  212. [FeatureISA3_0]>;
  213. def FeatureP9Altivec : SubtargetFeature<"power9-altivec", "HasP9Altivec", "true",
  214. "Enable POWER9 Altivec instructions",
  215. [FeatureISA3_0, FeatureP8Altivec]>;
  216. def FeatureP9Vector : SubtargetFeature<"power9-vector", "HasP9Vector", "true",
  217. "Enable POWER9 vector instructions",
  218. [FeatureISA3_0, FeatureP8Vector,
  219. FeatureP9Altivec]>;
  220. def FeatureP10Vector : SubtargetFeature<"power10-vector", "HasP10Vector",
  221. "true",
  222. "Enable POWER10 vector instructions",
  223. [FeatureISA3_1, FeatureP9Vector]>;
  224. // A separate feature for this even though it is equivalent to P9Vector
  225. // because this is a feature of the implementation rather than the architecture
  226. // and may go away with future CPU's.
  227. def FeatureVectorsUseTwoUnits : SubtargetFeature<"vectors-use-two-units",
  228. "VectorsUseTwoUnits",
  229. "true",
  230. "Vectors use two units">;
  231. def FeaturePrefixInstrs : SubtargetFeature<"prefix-instrs", "HasPrefixInstrs",
  232. "true",
  233. "Enable prefixed instructions",
  234. [FeatureISA3_0, FeatureP8Vector,
  235. FeatureP9Altivec]>;
  236. def FeaturePCRelativeMemops :
  237. SubtargetFeature<"pcrelative-memops", "HasPCRelativeMemops", "true",
  238. "Enable PC relative Memory Ops",
  239. [FeatureISA3_0, FeaturePrefixInstrs]>;
  240. def FeaturePairedVectorMemops:
  241. SubtargetFeature<"paired-vector-memops", "PairedVectorMemops", "true",
  242. "32Byte load and store instructions",
  243. [FeatureISA3_0]>;
  244. def FeatureMMA : SubtargetFeature<"mma", "HasMMA", "true",
  245. "Enable MMA instructions",
  246. [FeatureP8Vector, FeatureP9Altivec,
  247. FeaturePairedVectorMemops]>;
  248. def FeaturePredictableSelectIsExpensive :
  249. SubtargetFeature<"predictable-select-expensive",
  250. "PredictableSelectIsExpensive",
  251. "true",
  252. "Prefer likely predicted branches over selects">;
  253. // Since new processors generally contain a superset of features of those that
  254. // came before them, the idea is to make implementations of new processors
  255. // less error prone and easier to read.
  256. // Namely:
  257. // list<SubtargetFeature> P8InheritableFeatures = ...
  258. // list<SubtargetFeature> FutureProcessorAddtionalFeatures =
  259. // [ features that Power8 does not support but inheritable ]
  260. // list<SubtargetFeature> FutureProcessorSpecificFeatures =
  261. // [ features that Power8 does not support and not inheritable ]
  262. // list<SubtargetFeature> FutureProcessorInheritableFeatures =
  263. // !listconcat(P8InheritableFeatures, FutureProcessorAddtionalFeatures)
  264. // list<SubtargetFeature> FutureProcessorFeatures =
  265. // !listconcat(FutureProcessorInheritableFeatures,
  266. // FutureProcessorSpecificFeatures)
  267. // Makes it explicit and obvious what is new in FutureProcessor vs. Power8 as
  268. // well as providing a single point of definition if the feature set will be
  269. // used elsewhere.
  270. def ProcessorFeatures {
  271. // Power7
  272. list<SubtargetFeature> P7InheritableFeatures = [DirectivePwr7,
  273. FeatureAltivec,
  274. FeatureVSX,
  275. FeatureMFOCRF,
  276. FeatureFCPSGN,
  277. FeatureFSqrt,
  278. FeatureFRE,
  279. FeatureFRES,
  280. FeatureFRSQRTE,
  281. FeatureFRSQRTES,
  282. FeatureRecipPrec,
  283. FeatureSTFIWX,
  284. FeatureLFIWAX,
  285. FeatureFPRND,
  286. FeatureFPCVT,
  287. FeatureISEL,
  288. FeaturePOPCNTD,
  289. FeatureCMPB,
  290. FeatureLDBRX,
  291. Feature64Bit,
  292. /* Feature64BitRegs, */
  293. FeatureBPERMD,
  294. FeatureExtDiv,
  295. FeatureMFTB,
  296. DeprecatedDST,
  297. FeatureTwoConstNR,
  298. FeatureUnalignedFloats];
  299. list<SubtargetFeature> P7SpecificFeatures = [];
  300. list<SubtargetFeature> P7Features =
  301. !listconcat(P7InheritableFeatures, P7SpecificFeatures);
  302. // Power8
  303. list<SubtargetFeature> P8AdditionalFeatures =
  304. [DirectivePwr8,
  305. FeatureP8Altivec,
  306. FeatureP8Vector,
  307. FeatureP8Crypto,
  308. FeatureHTM,
  309. FeatureDirectMove,
  310. FeatureICBT,
  311. FeaturePartwordAtomic,
  312. FeaturePredictableSelectIsExpensive
  313. ];
  314. list<SubtargetFeature> P8SpecificFeatures = [FeatureAddiLoadFusion,
  315. FeatureAddisLoadFusion];
  316. list<SubtargetFeature> P8InheritableFeatures =
  317. !listconcat(P7InheritableFeatures, P8AdditionalFeatures);
  318. list<SubtargetFeature> P8Features =
  319. !listconcat(P8InheritableFeatures, P8SpecificFeatures);
  320. // Power9
  321. list<SubtargetFeature> P9AdditionalFeatures =
  322. [DirectivePwr9,
  323. FeatureP9Altivec,
  324. FeatureP9Vector,
  325. FeaturePPCPreRASched,
  326. FeaturePPCPostRASched,
  327. FeatureISA3_0,
  328. FeaturePredictableSelectIsExpensive
  329. ];
  330. // Some features are unique to Power9 and there is no reason to assume
  331. // they will be part of any future CPUs. One example is the narrower
  332. // dispatch for vector operations than scalar ones. For the time being,
  333. // this list also includes scheduling-related features since we do not have
  334. // enough info to create custom scheduling strategies for future CPUs.
  335. list<SubtargetFeature> P9SpecificFeatures = [FeatureVectorsUseTwoUnits];
  336. list<SubtargetFeature> P9InheritableFeatures =
  337. !listconcat(P8InheritableFeatures, P9AdditionalFeatures);
  338. list<SubtargetFeature> P9Features =
  339. !listconcat(P9InheritableFeatures, P9SpecificFeatures);
  340. // Power10
  341. // For P10 CPU we assume that all of the existing features from Power9
  342. // still exist with the exception of those we know are Power9 specific.
  343. list<SubtargetFeature> FusionFeatures = [FeatureStoreFusion];
  344. list<SubtargetFeature> P10AdditionalFeatures =
  345. !listconcat(FusionFeatures, [
  346. DirectivePwr10, FeatureISA3_1, FeaturePrefixInstrs,
  347. FeaturePCRelativeMemops, FeatureP10Vector, FeatureMMA,
  348. FeaturePairedVectorMemops]);
  349. list<SubtargetFeature> P10SpecificFeatures = [];
  350. list<SubtargetFeature> P10InheritableFeatures =
  351. !listconcat(P9InheritableFeatures, P10AdditionalFeatures);
  352. list<SubtargetFeature> P10Features =
  353. !listconcat(P10InheritableFeatures, P10SpecificFeatures);
  354. // Future
  355. // For future CPU we assume that all of the existing features from Power10
  356. // still exist with the exception of those we know are Power10 specific.
  357. list<SubtargetFeature> FutureAdditionalFeatures = [];
  358. list<SubtargetFeature> FutureSpecificFeatures = [];
  359. list<SubtargetFeature> FutureInheritableFeatures =
  360. !listconcat(P10InheritableFeatures, FutureAdditionalFeatures);
  361. list<SubtargetFeature> FutureFeatures =
  362. !listconcat(FutureInheritableFeatures, FutureSpecificFeatures);
  363. }
  364. // Note: Future features to add when support is extended to more
  365. // recent ISA levels:
  366. //
  367. // DFP p6, p6x, p7 decimal floating-point instructions
  368. // POPCNTB p5 through p7 popcntb and related instructions
  369. //===----------------------------------------------------------------------===//
  370. // Classes used for relation maps.
  371. //===----------------------------------------------------------------------===//
  372. // RecFormRel - Filter class used to relate non-record-form instructions with
  373. // their record-form variants.
  374. class RecFormRel;
  375. // AltVSXFMARel - Filter class used to relate the primary addend-killing VSX
  376. // FMA instruction forms with their corresponding factor-killing forms.
  377. class AltVSXFMARel {
  378. bit IsVSXFMAAlt = 0;
  379. }
  380. //===----------------------------------------------------------------------===//
  381. // Relation Map Definitions.
  382. //===----------------------------------------------------------------------===//
  383. def getRecordFormOpcode : InstrMapping {
  384. let FilterClass = "RecFormRel";
  385. // Instructions with the same BaseName and Interpretation64Bit values
  386. // form a row.
  387. let RowFields = ["BaseName", "Interpretation64Bit"];
  388. // Instructions with the same RC value form a column.
  389. let ColFields = ["RC"];
  390. // The key column are the non-record-form instructions.
  391. let KeyCol = ["0"];
  392. // Value columns RC=1
  393. let ValueCols = [["1"]];
  394. }
  395. def getNonRecordFormOpcode : InstrMapping {
  396. let FilterClass = "RecFormRel";
  397. // Instructions with the same BaseName and Interpretation64Bit values
  398. // form a row.
  399. let RowFields = ["BaseName", "Interpretation64Bit"];
  400. // Instructions with the same RC value form a column.
  401. let ColFields = ["RC"];
  402. // The key column are the record-form instructions.
  403. let KeyCol = ["1"];
  404. // Value columns are RC=0
  405. let ValueCols = [["0"]];
  406. }
  407. def getAltVSXFMAOpcode : InstrMapping {
  408. let FilterClass = "AltVSXFMARel";
  409. // Instructions with the same BaseName value form a row.
  410. let RowFields = ["BaseName"];
  411. // Instructions with the same IsVSXFMAAlt value form a column.
  412. let ColFields = ["IsVSXFMAAlt"];
  413. // The key column are the (default) addend-killing instructions.
  414. let KeyCol = ["0"];
  415. // Value columns IsVSXFMAAlt=1
  416. let ValueCols = [["1"]];
  417. }
  418. //===----------------------------------------------------------------------===//
  419. // Register File Description
  420. //===----------------------------------------------------------------------===//
  421. include "PPCRegisterInfo.td"
  422. include "PPCSchedule.td"
  423. include "GISel/PPCRegisterBanks.td"
  424. //===----------------------------------------------------------------------===//
  425. // PowerPC processors supported.
  426. //
  427. def : Processor<"generic", G3Itineraries, [Directive32, FeatureHardFloat,
  428. FeatureMFTB]>;
  429. def : ProcessorModel<"440", PPC440Model, [Directive440, FeatureISEL,
  430. FeatureFRES, FeatureFRSQRTE,
  431. FeatureICBT, FeatureBookE,
  432. FeatureMSYNC, FeatureMFTB]>;
  433. def : ProcessorModel<"450", PPC440Model, [Directive440, FeatureISEL,
  434. FeatureFRES, FeatureFRSQRTE,
  435. FeatureICBT, FeatureBookE,
  436. FeatureMSYNC, FeatureMFTB]>;
  437. def : Processor<"601", G3Itineraries, [Directive601, FeatureFPU]>;
  438. def : Processor<"602", G3Itineraries, [Directive602, FeatureFPU,
  439. FeatureMFTB]>;
  440. def : Processor<"603", G3Itineraries, [Directive603,
  441. FeatureFRES, FeatureFRSQRTE,
  442. FeatureMFTB]>;
  443. def : Processor<"603e", G3Itineraries, [Directive603,
  444. FeatureFRES, FeatureFRSQRTE,
  445. FeatureMFTB]>;
  446. def : Processor<"603ev", G3Itineraries, [Directive603,
  447. FeatureFRES, FeatureFRSQRTE,
  448. FeatureMFTB]>;
  449. def : Processor<"604", G3Itineraries, [Directive604,
  450. FeatureFRES, FeatureFRSQRTE,
  451. FeatureMFTB]>;
  452. def : Processor<"604e", G3Itineraries, [Directive604,
  453. FeatureFRES, FeatureFRSQRTE,
  454. FeatureMFTB]>;
  455. def : Processor<"620", G3Itineraries, [Directive620,
  456. FeatureFRES, FeatureFRSQRTE,
  457. FeatureMFTB]>;
  458. def : Processor<"750", G4Itineraries, [Directive750,
  459. FeatureFRES, FeatureFRSQRTE,
  460. FeatureMFTB]>;
  461. def : Processor<"g3", G3Itineraries, [Directive750,
  462. FeatureFRES, FeatureFRSQRTE,
  463. FeatureMFTB]>;
  464. def : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec,
  465. FeatureFRES, FeatureFRSQRTE,
  466. FeatureMFTB]>;
  467. def : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec,
  468. FeatureFRES, FeatureFRSQRTE,
  469. FeatureMFTB]>;
  470. def : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec,
  471. FeatureFRES, FeatureFRSQRTE,
  472. FeatureMFTB]>;
  473. def : Processor<"g4+", G4PlusItineraries, [Directive7400, FeatureAltivec,
  474. FeatureFRES, FeatureFRSQRTE,
  475. FeatureMFTB]>;
  476. def : ProcessorModel<"970", G5Model,
  477. [Directive970, FeatureAltivec,
  478. FeatureMFOCRF, FeatureFSqrt,
  479. FeatureFRES, FeatureFRSQRTE, FeatureSTFIWX,
  480. Feature64Bit /*, Feature64BitRegs */,
  481. FeatureMFTB]>;
  482. def : ProcessorModel<"g5", G5Model,
  483. [Directive970, FeatureAltivec,
  484. FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
  485. FeatureFRES, FeatureFRSQRTE,
  486. Feature64Bit /*, Feature64BitRegs */,
  487. FeatureMFTB, DeprecatedDST]>;
  488. def : ProcessorModel<"e500", PPCE500Model,
  489. [DirectiveE500,
  490. FeatureICBT, FeatureBookE,
  491. FeatureISEL, FeatureMFTB, FeatureMSYNC, FeatureSPE]>;
  492. def : ProcessorModel<"e500mc", PPCE500mcModel,
  493. [DirectiveE500mc,
  494. FeatureSTFIWX, FeatureICBT, FeatureBookE,
  495. FeatureISEL, FeatureMFTB]>;
  496. def : ProcessorModel<"e5500", PPCE5500Model,
  497. [DirectiveE5500, FeatureMFOCRF, Feature64Bit,
  498. FeatureSTFIWX, FeatureICBT, FeatureBookE,
  499. FeatureISEL, FeatureMFTB]>;
  500. def : ProcessorModel<"a2", PPCA2Model,
  501. [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF,
  502. FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
  503. FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
  504. FeatureSTFIWX, FeatureLFIWAX,
  505. FeatureFPRND, FeatureFPCVT, FeatureISEL,
  506. FeatureSlowPOPCNTD, FeatureCMPB, FeatureLDBRX,
  507. Feature64Bit /*, Feature64BitRegs */, FeatureMFTB]>;
  508. def : ProcessorModel<"pwr3", G5Model,
  509. [DirectivePwr3, FeatureAltivec,
  510. FeatureFRES, FeatureFRSQRTE, FeatureMFOCRF,
  511. FeatureSTFIWX, Feature64Bit]>;
  512. def : ProcessorModel<"pwr4", G5Model,
  513. [DirectivePwr4, FeatureAltivec, FeatureMFOCRF,
  514. FeatureFSqrt, FeatureFRES, FeatureFRSQRTE,
  515. FeatureSTFIWX, Feature64Bit, FeatureMFTB]>;
  516. def : ProcessorModel<"pwr5", G5Model,
  517. [DirectivePwr5, FeatureAltivec, FeatureMFOCRF,
  518. FeatureFSqrt, FeatureFRE, FeatureFRES,
  519. FeatureFRSQRTE, FeatureFRSQRTES,
  520. FeatureSTFIWX, Feature64Bit,
  521. FeatureMFTB, DeprecatedDST]>;
  522. def : ProcessorModel<"pwr5x", G5Model,
  523. [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
  524. FeatureFSqrt, FeatureFRE, FeatureFRES,
  525. FeatureFRSQRTE, FeatureFRSQRTES,
  526. FeatureSTFIWX, FeatureFPRND, Feature64Bit,
  527. FeatureMFTB, DeprecatedDST]>;
  528. def : ProcessorModel<"pwr6", G5Model,
  529. [DirectivePwr6, FeatureAltivec,
  530. FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE,
  531. FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
  532. FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
  533. FeatureFPRND, Feature64Bit /*, Feature64BitRegs */,
  534. FeatureMFTB, DeprecatedDST]>;
  535. def : ProcessorModel<"pwr6x", G5Model,
  536. [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
  537. FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
  538. FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
  539. FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
  540. FeatureFPRND, Feature64Bit,
  541. FeatureMFTB, DeprecatedDST]>;
  542. def : ProcessorModel<"pwr7", P7Model, ProcessorFeatures.P7Features>;
  543. def : ProcessorModel<"pwr8", P8Model, ProcessorFeatures.P8Features>;
  544. def : ProcessorModel<"pwr9", P9Model, ProcessorFeatures.P9Features>;
  545. // No scheduler model yet.
  546. def : ProcessorModel<"pwr10", P9Model, ProcessorFeatures.P10Features>;
  547. // No scheduler model for future CPU.
  548. def : ProcessorModel<"future", NoSchedModel,
  549. ProcessorFeatures.FutureFeatures>;
  550. def : Processor<"ppc", G3Itineraries, [Directive32, FeatureHardFloat,
  551. FeatureMFTB]>;
  552. def : Processor<"ppc32", G3Itineraries, [Directive32, FeatureHardFloat,
  553. FeatureMFTB]>;
  554. def : ProcessorModel<"ppc64", G5Model,
  555. [Directive64, FeatureAltivec,
  556. FeatureMFOCRF, FeatureFSqrt, FeatureFRES,
  557. FeatureFRSQRTE, FeatureSTFIWX,
  558. Feature64Bit /*, Feature64BitRegs */,
  559. FeatureMFTB]>;
  560. def : ProcessorModel<"ppc64le", P8Model, ProcessorFeatures.P8Features>;
  561. //===----------------------------------------------------------------------===//
  562. // Calling Conventions
  563. //===----------------------------------------------------------------------===//
  564. include "PPCCallingConv.td"
  565. def PPCInstrInfo : InstrInfo {
  566. let isLittleEndianEncoding = 1;
  567. // FIXME: Unset this when no longer needed!
  568. let decodePositionallyEncodedOperands = 1;
  569. let noNamedPositionallyEncodedOperands = 1;
  570. }
  571. def PPCAsmWriter : AsmWriter {
  572. string AsmWriterClassName = "InstPrinter";
  573. int PassSubtarget = 1;
  574. int Variant = 0;
  575. bit isMCAsmWriter = 1;
  576. }
  577. def PPCAsmParser : AsmParser {
  578. let ShouldEmitMatchRegisterName = 0;
  579. }
  580. def PPCAsmParserVariant : AsmParserVariant {
  581. int Variant = 0;
  582. // We do not use hard coded registers in asm strings. However, some
  583. // InstAlias definitions use immediate literals. Set RegisterPrefix
  584. // so that those are not misinterpreted as registers.
  585. string RegisterPrefix = "%";
  586. string BreakCharacters = ".";
  587. }
  588. def PPC : Target {
  589. // Information about the instructions.
  590. let InstructionSet = PPCInstrInfo;
  591. let AssemblyWriters = [PPCAsmWriter];
  592. let AssemblyParsers = [PPCAsmParser];
  593. let AssemblyParserVariants = [PPCAsmParserVariant];
  594. let AllowRegisterRenaming = 1;
  595. }
  596. //===----------------------------------------------------------------------===//
  597. // Pfm Counters
  598. //===----------------------------------------------------------------------===//
  599. include "PPCPfmCounters.td"