xref: /freebsd-src/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.td (revision 36b606ae6aa4b24061096ba18582e0a08ccd5dba)
10b57cec5SDimitry Andric//===-- PPC.td - Describe the PowerPC Target Machine -------*- tablegen -*-===//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric//
90b57cec5SDimitry Andric// This is the top level entry point for the PowerPC target.
100b57cec5SDimitry Andric//
110b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric
130b57cec5SDimitry Andric// Get the target-independent interfaces which we are implementing.
140b57cec5SDimitry Andric//
150b57cec5SDimitry Andricinclude "llvm/Target/Target.td"
160b57cec5SDimitry Andric
170b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
180b57cec5SDimitry Andric// PowerPC Subtarget features.
190b57cec5SDimitry Andric//
200b57cec5SDimitry Andric
210b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
220b57cec5SDimitry Andric// CPU Directives                                                             //
230b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
240b57cec5SDimitry Andric
25480093f4SDimitry Andricdef Directive440 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_440", "">;
26480093f4SDimitry Andricdef Directive601 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_601", "">;
27480093f4SDimitry Andricdef Directive602 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_602", "">;
28480093f4SDimitry Andricdef Directive603 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_603", "">;
29480093f4SDimitry Andricdef Directive604 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_603", "">;
30480093f4SDimitry Andricdef Directive620 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_603", "">;
31480093f4SDimitry Andricdef Directive7400: SubtargetFeature<"", "CPUDirective", "PPC::DIR_7400", "">;
32480093f4SDimitry Andricdef Directive750 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_750", "">;
33480093f4SDimitry Andricdef Directive970 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_970", "">;
34480093f4SDimitry Andricdef Directive32  : SubtargetFeature<"", "CPUDirective", "PPC::DIR_32", "">;
35480093f4SDimitry Andricdef Directive64  : SubtargetFeature<"", "CPUDirective", "PPC::DIR_64", "">;
36480093f4SDimitry Andricdef DirectiveA2  : SubtargetFeature<"", "CPUDirective", "PPC::DIR_A2", "">;
37480093f4SDimitry Andricdef DirectiveE500   : SubtargetFeature<"", "CPUDirective",
380b57cec5SDimitry Andric                                       "PPC::DIR_E500", "">;
39480093f4SDimitry Andricdef DirectiveE500mc : SubtargetFeature<"", "CPUDirective",
400b57cec5SDimitry Andric                                       "PPC::DIR_E500mc", "">;
41480093f4SDimitry Andricdef DirectiveE5500  : SubtargetFeature<"", "CPUDirective",
420b57cec5SDimitry Andric                                       "PPC::DIR_E5500", "">;
43480093f4SDimitry Andricdef DirectivePwr3: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR3", "">;
44480093f4SDimitry Andricdef DirectivePwr4: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR4", "">;
45480093f4SDimitry Andricdef DirectivePwr5: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR5", "">;
460b57cec5SDimitry Andricdef DirectivePwr5x
47480093f4SDimitry Andric    : SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR5X", "">;
48480093f4SDimitry Andricdef DirectivePwr6: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR6", "">;
490b57cec5SDimitry Andricdef DirectivePwr6x
50480093f4SDimitry Andric    : SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR6X", "">;
51480093f4SDimitry Andricdef DirectivePwr7: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR7", "">;
52480093f4SDimitry Andricdef DirectivePwr8: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR8", "">;
53480093f4SDimitry Andricdef DirectivePwr9: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR9", "">;
545ffd83dbSDimitry Andricdef DirectivePwr10: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR10", "">;
55*36b606aeSDimitry Andricdef DirectivePwr11: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR11", "">;
56480093f4SDimitry Andricdef DirectivePwrFuture
57480093f4SDimitry Andric    : SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR_FUTURE", "">;
580b57cec5SDimitry Andric
59bdd1243dSDimitry Andric// Specifies that the selected CPU supports 64-bit instructions, regardless of
60bdd1243dSDimitry Andric// whether we are in 32-bit or 64-bit mode.
610b57cec5SDimitry Andricdef Feature64Bit     : SubtargetFeature<"64bit","Has64BitSupport", "true",
620b57cec5SDimitry Andric                                        "Enable 64-bit instructions">;
63e8d8bef9SDimitry Andricdef AIXOS: SubtargetFeature<"aix", "IsAIX", "true", "AIX OS">;
64e8d8bef9SDimitry Andricdef FeatureModernAIXAs
65e8d8bef9SDimitry Andric    : SubtargetFeature<"modern-aix-as", "HasModernAIXAs", "true",
66e8d8bef9SDimitry Andric                       "AIX system assembler is modern enough to support new mnes">;
670b57cec5SDimitry Andricdef FeatureHardFloat : SubtargetFeature<"hard-float", "HasHardFloat", "true",
680b57cec5SDimitry Andric                              "Enable floating-point instructions">;
69bdd1243dSDimitry Andric
70bdd1243dSDimitry Andric// Specifies that we are in 64-bit mode or that we should use 64-bit registers
71bdd1243dSDimitry Andric// in 32-bit mode when possible. Requires Feature64Bit to be enabled.
720b57cec5SDimitry Andricdef Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true",
730b57cec5SDimitry Andric                              "Enable 64-bit registers usage for ppc32 [beta]">;
74bdd1243dSDimitry Andric
75bdd1243dSDimitry Andric// Specify if we should store and manipulate i1 values in the individual
76bdd1243dSDimitry Andric// condition register bits.
770b57cec5SDimitry Andricdef FeatureCRBits    : SubtargetFeature<"crbits", "UseCRBits", "true",
780b57cec5SDimitry Andric                              "Use condition-register bits individually">;
790b57cec5SDimitry Andricdef FeatureFPU       : SubtargetFeature<"fpu","HasFPU","true",
800b57cec5SDimitry Andric                                        "Enable classic FPU instructions",
810b57cec5SDimitry Andric                                        [FeatureHardFloat]>;
820b57cec5SDimitry Andricdef FeatureAltivec   : SubtargetFeature<"altivec","HasAltivec", "true",
830b57cec5SDimitry Andric                                        "Enable Altivec instructions",
840b57cec5SDimitry Andric                                        [FeatureFPU]>;
850b57cec5SDimitry Andricdef FeatureSPE       : SubtargetFeature<"spe","HasSPE", "true",
860b57cec5SDimitry Andric                                        "Enable SPE instructions",
870b57cec5SDimitry Andric                                        [FeatureHardFloat]>;
88e8d8bef9SDimitry Andricdef FeatureEFPU2 : SubtargetFeature<"efpu2", "HasEFPU2", "true",
89e8d8bef9SDimitry Andric                                        "Enable Embedded Floating-Point APU 2 instructions",
90e8d8bef9SDimitry Andric                                        [FeatureSPE]>;
910b57cec5SDimitry Andricdef FeatureMFOCRF    : SubtargetFeature<"mfocrf","HasMFOCRF", "true",
920b57cec5SDimitry Andric                                        "Enable the MFOCRF instruction">;
930b57cec5SDimitry Andricdef FeatureFSqrt     : SubtargetFeature<"fsqrt","HasFSQRT", "true",
940b57cec5SDimitry Andric                                        "Enable the fsqrt instruction",
950b57cec5SDimitry Andric                                        [FeatureFPU]>;
960b57cec5SDimitry Andricdef FeatureFCPSGN    : SubtargetFeature<"fcpsgn", "HasFCPSGN", "true",
970b57cec5SDimitry Andric                                        "Enable the fcpsgn instruction",
980b57cec5SDimitry Andric                                        [FeatureFPU]>;
990b57cec5SDimitry Andricdef FeatureFRE       : SubtargetFeature<"fre", "HasFRE", "true",
1000b57cec5SDimitry Andric                                        "Enable the fre instruction",
1010b57cec5SDimitry Andric                                        [FeatureFPU]>;
1020b57cec5SDimitry Andricdef FeatureFRES      : SubtargetFeature<"fres", "HasFRES", "true",
1030b57cec5SDimitry Andric                                        "Enable the fres instruction",
1040b57cec5SDimitry Andric                                        [FeatureFPU]>;
1050b57cec5SDimitry Andricdef FeatureFRSQRTE   : SubtargetFeature<"frsqrte", "HasFRSQRTE", "true",
1060b57cec5SDimitry Andric                                        "Enable the frsqrte instruction",
1070b57cec5SDimitry Andric                                        [FeatureFPU]>;
1080b57cec5SDimitry Andricdef FeatureFRSQRTES  : SubtargetFeature<"frsqrtes", "HasFRSQRTES", "true",
1090b57cec5SDimitry Andric                                        "Enable the frsqrtes instruction",
1100b57cec5SDimitry Andric                                        [FeatureFPU]>;
1110b57cec5SDimitry Andricdef FeatureRecipPrec : SubtargetFeature<"recipprec", "HasRecipPrec", "true",
1120b57cec5SDimitry Andric                              "Assume higher precision reciprocal estimates">;
1130b57cec5SDimitry Andricdef FeatureSTFIWX    : SubtargetFeature<"stfiwx","HasSTFIWX", "true",
1140b57cec5SDimitry Andric                                        "Enable the stfiwx instruction",
1150b57cec5SDimitry Andric                                        [FeatureFPU]>;
1160b57cec5SDimitry Andricdef FeatureLFIWAX    : SubtargetFeature<"lfiwax","HasLFIWAX", "true",
1170b57cec5SDimitry Andric                                        "Enable the lfiwax instruction",
1180b57cec5SDimitry Andric                                        [FeatureFPU]>;
1190b57cec5SDimitry Andricdef FeatureFPRND     : SubtargetFeature<"fprnd", "HasFPRND", "true",
1200b57cec5SDimitry Andric                                        "Enable the fri[mnpz] instructions",
1210b57cec5SDimitry Andric                                        [FeatureFPU]>;
1220b57cec5SDimitry Andricdef FeatureFPCVT     : SubtargetFeature<"fpcvt", "HasFPCVT", "true",
1230b57cec5SDimitry Andric  "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions",
1240b57cec5SDimitry Andric                                        [FeatureFPU]>;
1250b57cec5SDimitry Andricdef FeatureISEL      : SubtargetFeature<"isel","HasISEL", "true",
1260b57cec5SDimitry Andric                                        "Enable the isel instruction">;
1270b57cec5SDimitry Andricdef FeatureBPERMD    : SubtargetFeature<"bpermd", "HasBPERMD", "true",
1280b57cec5SDimitry Andric                                        "Enable the bpermd instruction">;
1290b57cec5SDimitry Andricdef FeatureExtDiv    : SubtargetFeature<"extdiv", "HasExtDiv", "true",
1300b57cec5SDimitry Andric                                        "Enable extended divide instructions">;
1310b57cec5SDimitry Andricdef FeatureLDBRX     : SubtargetFeature<"ldbrx","HasLDBRX", "true",
1320b57cec5SDimitry Andric                                        "Enable the ldbrx instruction">;
1330b57cec5SDimitry Andricdef FeatureCMPB      : SubtargetFeature<"cmpb", "HasCMPB", "true",
1340b57cec5SDimitry Andric                                        "Enable the cmpb instruction">;
1350b57cec5SDimitry Andricdef FeatureICBT      : SubtargetFeature<"icbt","HasICBT", "true",
1360b57cec5SDimitry Andric                                        "Enable icbt instruction">;
1370b57cec5SDimitry Andricdef FeatureBookE     : SubtargetFeature<"booke", "IsBookE", "true",
1380b57cec5SDimitry Andric                                        "Enable Book E instructions",
1390b57cec5SDimitry Andric                                        [FeatureICBT]>;
1400b57cec5SDimitry Andricdef FeatureMSYNC     : SubtargetFeature<"msync", "HasOnlyMSYNC", "true",
1410b57cec5SDimitry Andric                              "Has only the msync instruction instead of sync",
1420b57cec5SDimitry Andric                              [FeatureBookE]>;
1430b57cec5SDimitry Andricdef FeatureE500      : SubtargetFeature<"e500", "IsE500", "true",
1440b57cec5SDimitry Andric                                        "Enable E500/E500mc instructions">;
145bdd1243dSDimitry Andricdef FeatureSecurePlt : SubtargetFeature<"secure-plt","IsSecurePlt", "true",
1460b57cec5SDimitry Andric                                        "Enable secure plt mode">;
1470b57cec5SDimitry Andricdef FeaturePPC4xx    : SubtargetFeature<"ppc4xx", "IsPPC4xx", "true",
1480b57cec5SDimitry Andric                                        "Enable PPC 4xx instructions">;
1490b57cec5SDimitry Andricdef FeaturePPC6xx    : SubtargetFeature<"ppc6xx", "IsPPC6xx", "true",
1500b57cec5SDimitry Andric                                        "Enable PPC 6xx instructions">;
1510b57cec5SDimitry Andricdef FeatureVSX       : SubtargetFeature<"vsx","HasVSX", "true",
1520b57cec5SDimitry Andric                                        "Enable VSX instructions",
1530b57cec5SDimitry Andric                                        [FeatureAltivec]>;
1540b57cec5SDimitry Andricdef FeatureTwoConstNR :
1550b57cec5SDimitry Andric  SubtargetFeature<"two-const-nr", "NeedsTwoConstNR", "true",
1560b57cec5SDimitry Andric                   "Requires two constant Newton-Raphson computation">;
1570b57cec5SDimitry Andricdef FeatureP8Altivec : SubtargetFeature<"power8-altivec", "HasP8Altivec", "true",
1580b57cec5SDimitry Andric                                        "Enable POWER8 Altivec instructions",
1590b57cec5SDimitry Andric                                        [FeatureAltivec]>;
1600b57cec5SDimitry Andricdef FeatureP8Crypto : SubtargetFeature<"crypto", "HasP8Crypto", "true",
1610b57cec5SDimitry Andric                                       "Enable POWER8 Crypto instructions",
1620b57cec5SDimitry Andric                                       [FeatureP8Altivec]>;
1630b57cec5SDimitry Andricdef FeatureP8Vector  : SubtargetFeature<"power8-vector", "HasP8Vector", "true",
1640b57cec5SDimitry Andric                                        "Enable POWER8 vector instructions",
1650b57cec5SDimitry Andric                                        [FeatureVSX, FeatureP8Altivec]>;
1660b57cec5SDimitry Andricdef FeatureDirectMove :
1670b57cec5SDimitry Andric  SubtargetFeature<"direct-move", "HasDirectMove", "true",
1680b57cec5SDimitry Andric                   "Enable Power8 direct move instructions",
1690b57cec5SDimitry Andric                   [FeatureVSX]>;
1700b57cec5SDimitry Andricdef FeaturePartwordAtomic : SubtargetFeature<"partword-atomics",
1710b57cec5SDimitry Andric                                             "HasPartwordAtomics", "true",
1720b57cec5SDimitry Andric                                             "Enable l[bh]arx and st[bh]cx.">;
173fe6060f1SDimitry Andricdef FeatureQuadwordAtomic : SubtargetFeature<"quadword-atomics",
174fe6060f1SDimitry Andric                                             "HasQuadwordAtomics", "true",
175fe6060f1SDimitry Andric                                             "Enable lqarx and stqcx.">;
1760b57cec5SDimitry Andricdef FeatureInvariantFunctionDescriptors :
1770b57cec5SDimitry Andric  SubtargetFeature<"invariant-function-descriptors",
1780b57cec5SDimitry Andric                   "HasInvariantFunctionDescriptors", "true",
1790b57cec5SDimitry Andric                   "Assume function descriptors are invariant">;
1800b57cec5SDimitry Andricdef FeatureLongCall : SubtargetFeature<"longcall", "UseLongCalls", "true",
1810b57cec5SDimitry Andric                                       "Always use indirect calls">;
1820b57cec5SDimitry Andricdef FeatureHTM : SubtargetFeature<"htm", "HasHTM", "true",
1830b57cec5SDimitry Andric                                  "Enable Hardware Transactional Memory instructions">;
184bdd1243dSDimitry Andricdef FeatureMFTB   : SubtargetFeature<"", "IsFeatureMFTB", "true",
1850b57cec5SDimitry Andric                                        "Implement mftb using the mfspr instruction">;
1865ffd83dbSDimitry Andricdef FeatureFusion : SubtargetFeature<"fusion", "HasFusion", "true",
1875ffd83dbSDimitry Andric                                     "Target supports instruction fusion">;
1885ffd83dbSDimitry Andricdef FeatureAddiLoadFusion : SubtargetFeature<"fuse-addi-load",
1895ffd83dbSDimitry Andric                                             "HasAddiLoadFusion", "true",
1905ffd83dbSDimitry Andric                                             "Power8 Addi-Load fusion",
1915ffd83dbSDimitry Andric                                             [FeatureFusion]>;
1925ffd83dbSDimitry Andricdef FeatureAddisLoadFusion : SubtargetFeature<"fuse-addis-load",
1935ffd83dbSDimitry Andric                                              "HasAddisLoadFusion", "true",
1945ffd83dbSDimitry Andric                                              "Power8 Addis-Load fusion",
1955ffd83dbSDimitry Andric                                              [FeatureFusion]>;
196e8d8bef9SDimitry Andricdef FeatureStoreFusion : SubtargetFeature<"fuse-store", "HasStoreFusion", "true",
197e8d8bef9SDimitry Andric                                          "Target supports store clustering",
198e8d8bef9SDimitry Andric                                          [FeatureFusion]>;
199349cc55cSDimitry Andricdef FeatureArithAddFusion :
200349cc55cSDimitry Andric  SubtargetFeature<"fuse-arith-add", "HasArithAddFusion", "true",
201349cc55cSDimitry Andric                   "Target supports Arithmetic Operations with Add fusion",
202349cc55cSDimitry Andric                   [FeatureFusion]>;
203349cc55cSDimitry Andricdef FeatureAddLogicalFusion :
204349cc55cSDimitry Andric  SubtargetFeature<"fuse-add-logical", "HasAddLogicalFusion", "true",
205349cc55cSDimitry Andric                   "Target supports Add with Logical Operations fusion",
206349cc55cSDimitry Andric                   [FeatureFusion]>;
207349cc55cSDimitry Andricdef FeatureLogicalAddFusion :
208349cc55cSDimitry Andric  SubtargetFeature<"fuse-logical-add", "HasLogicalAddFusion", "true",
209349cc55cSDimitry Andric                   "Target supports Logical with Add Operations fusion",
210349cc55cSDimitry Andric                   [FeatureFusion]>;
211349cc55cSDimitry Andricdef FeatureLogicalFusion :
212349cc55cSDimitry Andric  SubtargetFeature<"fuse-logical", "HasLogicalFusion", "true",
213349cc55cSDimitry Andric                   "Target supports Logical Operations fusion",
214349cc55cSDimitry Andric                   [FeatureFusion]>;
2154824e7fdSDimitry Andricdef FeatureSha3Fusion :
2164824e7fdSDimitry Andric  SubtargetFeature<"fuse-sha3", "HasSha3Fusion", "true",
2174824e7fdSDimitry Andric                   "Target supports SHA3 assist fusion",
2184824e7fdSDimitry Andric                   [FeatureFusion]>;
2194824e7fdSDimitry Andricdef FeatureCompareFusion:
2204824e7fdSDimitry Andric  SubtargetFeature<"fuse-cmp", "HasCompareFusion", "true",
2214824e7fdSDimitry Andric                   "Target supports Comparison Operations fusion",
2224824e7fdSDimitry Andric                   [FeatureFusion]>;
2234824e7fdSDimitry Andricdef FeatureWideImmFusion:
2244824e7fdSDimitry Andric  SubtargetFeature<"fuse-wideimm", "HasWideImmFusion", "true",
2254824e7fdSDimitry Andric                   "Target supports Wide-Immediate fusion",
2264824e7fdSDimitry Andric                   [FeatureFusion]>;
2274824e7fdSDimitry Andricdef FeatureZeroMoveFusion:
2284824e7fdSDimitry Andric  SubtargetFeature<"fuse-zeromove", "HasZeroMoveFusion", "true",
2294824e7fdSDimitry Andric                   "Target supports move to SPR with branch fusion",
2304824e7fdSDimitry Andric                   [FeatureFusion]>;
2310eae32dcSDimitry Andricdef FeatureBack2BackFusion:
2320eae32dcSDimitry Andric  SubtargetFeature<"fuse-back2back", "HasBack2BackFusion", "true",
2330eae32dcSDimitry Andric                   "Target supports general back to back fusion",
2340eae32dcSDimitry Andric                   [FeatureFusion]>;
2350946e70aSDimitry Andricdef FeatureUnalignedFloats :
2360946e70aSDimitry Andric  SubtargetFeature<"allow-unaligned-fp-access", "AllowsUnalignedFPAccess",
2370946e70aSDimitry Andric                   "true", "CPU does not trap on unaligned FP access">;
2380b57cec5SDimitry Andricdef FeaturePPCPreRASched:
2390b57cec5SDimitry Andric  SubtargetFeature<"ppc-prera-sched", "UsePPCPreRASchedStrategy", "true",
2400b57cec5SDimitry Andric                   "Use PowerPC pre-RA scheduling strategy">;
2410b57cec5SDimitry Andricdef FeaturePPCPostRASched:
2420b57cec5SDimitry Andric  SubtargetFeature<"ppc-postra-sched", "UsePPCPostRASchedStrategy", "true",
2430b57cec5SDimitry Andric                   "Use PowerPC post-RA scheduling strategy">;
2440b57cec5SDimitry Andricdef FeatureFloat128 :
2450b57cec5SDimitry Andric  SubtargetFeature<"float128", "HasFloat128", "true",
2460b57cec5SDimitry Andric                   "Enable the __float128 data type for IEEE-754R Binary128.",
2470b57cec5SDimitry Andric                   [FeatureVSX]>;
2480b57cec5SDimitry Andricdef FeaturePOPCNTD   : SubtargetFeature<"popcntd","HasPOPCNTD",
2490b57cec5SDimitry Andric                                        "POPCNTD_Fast",
2500b57cec5SDimitry Andric                                        "Enable the popcnt[dw] instructions">;
251e8d8bef9SDimitry Andric// Note that for the a2 processor models we should not use popcnt[dw] by
2520b57cec5SDimitry Andric// default. These processors do support the instructions, but they're
2530b57cec5SDimitry Andric// microcoded, and the software emulation is about twice as fast.
2540b57cec5SDimitry Andricdef FeatureSlowPOPCNTD : SubtargetFeature<"slow-popcntd","HasPOPCNTD",
2550b57cec5SDimitry Andric                                          "POPCNTD_Slow",
2560b57cec5SDimitry Andric                                          "Has slow popcnt[dw] instructions">;
2570b57cec5SDimitry Andric
258bdd1243dSDimitry Andricdef DeprecatedDST    : SubtargetFeature<"", "IsDeprecatedDST", "true",
2590b57cec5SDimitry Andric  "Treat vector data stream cache control instructions as deprecated">;
2600b57cec5SDimitry Andric
261349cc55cSDimitry Andricdef FeatureISA2_06 : SubtargetFeature<"isa-v206-instructions", "IsISA2_06",
262349cc55cSDimitry Andric                                      "true",
263349cc55cSDimitry Andric                                      "Enable instructions in ISA 2.06.">;
264fe6060f1SDimitry Andricdef FeatureISA2_07 : SubtargetFeature<"isa-v207-instructions", "IsISA2_07",
265fe6060f1SDimitry Andric                                      "true",
266fe6060f1SDimitry Andric                                      "Enable instructions in ISA 2.07.">;
2670b57cec5SDimitry Andricdef FeatureISA3_0 : SubtargetFeature<"isa-v30-instructions", "IsISA3_0",
2680b57cec5SDimitry Andric                                     "true",
269fe6060f1SDimitry Andric                                     "Enable instructions in ISA 3.0.",
270fe6060f1SDimitry Andric                                     [FeatureISA2_07]>;
2715ffd83dbSDimitry Andricdef FeatureISA3_1 : SubtargetFeature<"isa-v31-instructions", "IsISA3_1",
2725ffd83dbSDimitry Andric                                     "true",
2735ffd83dbSDimitry Andric                                     "Enable instructions in ISA 3.1.",
2745ffd83dbSDimitry Andric                                     [FeatureISA3_0]>;
27581ad6265SDimitry Andricdef FeatureISAFuture : SubtargetFeature<"isa-future-instructions",
27681ad6265SDimitry Andric                                        "IsISAFuture", "true",
27781ad6265SDimitry Andric                                        "Enable instructions for Future ISA.",
27881ad6265SDimitry Andric                                        [FeatureISA3_1]>;
2790b57cec5SDimitry Andricdef FeatureP9Altivec : SubtargetFeature<"power9-altivec", "HasP9Altivec", "true",
2800b57cec5SDimitry Andric                                        "Enable POWER9 Altivec instructions",
2810b57cec5SDimitry Andric                                        [FeatureISA3_0, FeatureP8Altivec]>;
2820b57cec5SDimitry Andricdef FeatureP9Vector  : SubtargetFeature<"power9-vector", "HasP9Vector", "true",
2830b57cec5SDimitry Andric                                        "Enable POWER9 vector instructions",
2840b57cec5SDimitry Andric                                        [FeatureISA3_0, FeatureP8Vector,
2850b57cec5SDimitry Andric                                         FeatureP9Altivec]>;
2865ffd83dbSDimitry Andricdef FeatureP10Vector  : SubtargetFeature<"power10-vector", "HasP10Vector",
2875ffd83dbSDimitry Andric                                         "true",
2885ffd83dbSDimitry Andric                                         "Enable POWER10 vector instructions",
2895ffd83dbSDimitry Andric                                         [FeatureISA3_1, FeatureP9Vector]>;
2900b57cec5SDimitry Andric// A separate feature for this even though it is equivalent to P9Vector
2910b57cec5SDimitry Andric// because this is a feature of the implementation rather than the architecture
2920b57cec5SDimitry Andric// and may go away with future CPU's.
2930b57cec5SDimitry Andricdef FeatureVectorsUseTwoUnits : SubtargetFeature<"vectors-use-two-units",
2940b57cec5SDimitry Andric                                                 "VectorsUseTwoUnits",
2950b57cec5SDimitry Andric                                                 "true",
2960b57cec5SDimitry Andric                                                 "Vectors use two units">;
2975ffd83dbSDimitry Andricdef FeaturePrefixInstrs : SubtargetFeature<"prefix-instrs", "HasPrefixInstrs",
2985ffd83dbSDimitry Andric                                           "true",
2995ffd83dbSDimitry Andric                                           "Enable prefixed instructions",
3000fca6ea1SDimitry Andric                                           [FeatureISA3_1]>;
3015ffd83dbSDimitry Andricdef FeaturePCRelativeMemops :
3025ffd83dbSDimitry Andric  SubtargetFeature<"pcrelative-memops", "HasPCRelativeMemops", "true",
3035ffd83dbSDimitry Andric                   "Enable PC relative Memory Ops",
304e8d8bef9SDimitry Andric                   [FeatureISA3_0, FeaturePrefixInstrs]>;
305e8d8bef9SDimitry Andricdef FeaturePairedVectorMemops:
306e8d8bef9SDimitry Andric  SubtargetFeature<"paired-vector-memops", "PairedVectorMemops", "true",
307e8d8bef9SDimitry Andric                   "32Byte load and store instructions",
3085ffd83dbSDimitry Andric                   [FeatureISA3_0]>;
309e8d8bef9SDimitry Andricdef FeatureMMA : SubtargetFeature<"mma", "HasMMA", "true",
310e8d8bef9SDimitry Andric                                  "Enable MMA instructions",
311e8d8bef9SDimitry Andric                                  [FeatureP8Vector, FeatureP9Altivec,
312e8d8bef9SDimitry Andric                                   FeaturePairedVectorMemops]>;
313fe6060f1SDimitry Andricdef FeatureROPProtect :
314fe6060f1SDimitry Andric  SubtargetFeature<"rop-protect", "HasROPProtect", "true",
315fe6060f1SDimitry Andric                   "Add ROP protect">;
316fe6060f1SDimitry Andric
317fe6060f1SDimitry Andricdef FeaturePrivileged :
318fe6060f1SDimitry Andric  SubtargetFeature<"privileged", "HasPrivileged", "true",
319fe6060f1SDimitry Andric                   "Add privileged instructions">;
3205ffd83dbSDimitry Andric
3215f757f3fSDimitry Andric// Specifies that local-exec TLS accesses in any function with this target
3225f757f3fSDimitry Andric// attribute should use the optimized TOC-free sequence (where the offset is an
3235f757f3fSDimitry Andric// immediate off of R13 for which the linker might add fix-up code if the
3245f757f3fSDimitry Andric// immediate is too large).
3255f757f3fSDimitry Andric// Clearly, this isn't really a feature of the subtarget, but is used as a
3265f757f3fSDimitry Andric// convenient way to affect code generation for individual functions.
3275f757f3fSDimitry Andricdef FeatureAIXLocalExecTLS :
3285f757f3fSDimitry Andric  SubtargetFeature<"aix-small-local-exec-tls", "HasAIXSmallLocalExecTLS", "true",
3295f757f3fSDimitry Andric                   "Produce a TOC-free local-exec TLS sequence for this function "
3305f757f3fSDimitry Andric                   "for 64-bit AIX">;
3315f757f3fSDimitry Andric
3320fca6ea1SDimitry Andric// Specifies that local-dynamic TLS accesses in any function with this target
3330fca6ea1SDimitry Andric// attribute should use the optimized sequence (where the offset is an immediate
3340fca6ea1SDimitry Andric// off the module-handle for which the linker might add fix-up code for if the
3350fca6ea1SDimitry Andric// immediate is too large).
3360fca6ea1SDimitry Andricdef FeatureAIXLocalDynamicTLS :
3370fca6ea1SDimitry Andric  SubtargetFeature<"aix-small-local-dynamic-tls", "HasAIXSmallLocalDynamicTLS",
3380fca6ea1SDimitry Andric                   "true", "Produce a faster local-dynamic TLS sequence for this "
3390fca6ea1SDimitry Andric                   "function for 64-bit AIX">;
3400fca6ea1SDimitry Andric
3410fca6ea1SDimitry Andricdef FeatureAIXSharedLibTLSModelOpt :
3420fca6ea1SDimitry Andric  SubtargetFeature<"aix-shared-lib-tls-model-opt",
3430fca6ea1SDimitry Andric                   "HasAIXShLibTLSModelOpt", "true",
3440fca6ea1SDimitry Andric                   "Tune TLS model at function level in shared library loaded "
3450fca6ea1SDimitry Andric                   "with the main program (for 64-bit AIX only)">;
3460fca6ea1SDimitry Andric
3475ffd83dbSDimitry Andricdef FeaturePredictableSelectIsExpensive :
3485ffd83dbSDimitry Andric  SubtargetFeature<"predictable-select-expensive",
3495ffd83dbSDimitry Andric                   "PredictableSelectIsExpensive",
3505ffd83dbSDimitry Andric                   "true",
3515ffd83dbSDimitry Andric                   "Prefer likely predicted branches over selects">;
3520b57cec5SDimitry Andric
353bdd1243dSDimitry Andricdef FeatureFastMFLR : SubtargetFeature<"fast-MFLR", "HasFastMFLR", "true",
354bdd1243dSDimitry Andric                                       "MFLR is a fast instruction">;
355bdd1243dSDimitry Andric
3560b57cec5SDimitry Andric// Since new processors generally contain a superset of features of those that
3570b57cec5SDimitry Andric// came before them, the idea is to make implementations of new processors
3580b57cec5SDimitry Andric// less error prone and easier to read.
3590b57cec5SDimitry Andric// Namely:
360480093f4SDimitry Andric//     list<SubtargetFeature> P8InheritableFeatures = ...
361480093f4SDimitry Andric//     list<SubtargetFeature> FutureProcessorAddtionalFeatures =
362480093f4SDimitry Andric//         [ features that Power8 does not support but inheritable ]
363480093f4SDimitry Andric//     list<SubtargetFeature> FutureProcessorSpecificFeatures =
364480093f4SDimitry Andric//         [ features that Power8 does not support and not inheritable ]
365480093f4SDimitry Andric//     list<SubtargetFeature> FutureProcessorInheritableFeatures =
366480093f4SDimitry Andric//         !listconcat(P8InheritableFeatures, FutureProcessorAddtionalFeatures)
367480093f4SDimitry Andric//     list<SubtargetFeature> FutureProcessorFeatures =
368480093f4SDimitry Andric//         !listconcat(FutureProcessorInheritableFeatures,
369480093f4SDimitry Andric//                     FutureProcessorSpecificFeatures)
3700b57cec5SDimitry Andric
3715ffd83dbSDimitry Andric// Makes it explicit and obvious what is new in FutureProcessor vs. Power8 as
3720b57cec5SDimitry Andric// well as providing a single point of definition if the feature set will be
3730b57cec5SDimitry Andric// used elsewhere.
3740b57cec5SDimitry Andricdef ProcessorFeatures {
375480093f4SDimitry Andric  // Power7
376480093f4SDimitry Andric  list<SubtargetFeature> P7InheritableFeatures = [DirectivePwr7,
377480093f4SDimitry Andric                                                  FeatureAltivec,
378480093f4SDimitry Andric                                                  FeatureVSX,
379480093f4SDimitry Andric                                                  FeatureMFOCRF,
380480093f4SDimitry Andric                                                  FeatureFCPSGN,
381480093f4SDimitry Andric                                                  FeatureFSqrt,
382480093f4SDimitry Andric                                                  FeatureFRE,
383480093f4SDimitry Andric                                                  FeatureFRES,
384480093f4SDimitry Andric                                                  FeatureFRSQRTE,
385480093f4SDimitry Andric                                                  FeatureFRSQRTES,
386480093f4SDimitry Andric                                                  FeatureRecipPrec,
387480093f4SDimitry Andric                                                  FeatureSTFIWX,
388480093f4SDimitry Andric                                                  FeatureLFIWAX,
389480093f4SDimitry Andric                                                  FeatureFPRND,
390480093f4SDimitry Andric                                                  FeatureFPCVT,
391480093f4SDimitry Andric                                                  FeatureISEL,
392480093f4SDimitry Andric                                                  FeaturePOPCNTD,
393480093f4SDimitry Andric                                                  FeatureCMPB,
394480093f4SDimitry Andric                                                  FeatureLDBRX,
395480093f4SDimitry Andric                                                  Feature64Bit,
396480093f4SDimitry Andric                                                  /* Feature64BitRegs, */
397480093f4SDimitry Andric                                                  FeatureBPERMD,
398480093f4SDimitry Andric                                                  FeatureExtDiv,
399480093f4SDimitry Andric                                                  FeatureMFTB,
400480093f4SDimitry Andric                                                  DeprecatedDST,
4010946e70aSDimitry Andric                                                  FeatureTwoConstNR,
402349cc55cSDimitry Andric                                                  FeatureUnalignedFloats,
403349cc55cSDimitry Andric                                                  FeatureISA2_06];
404480093f4SDimitry Andric  list<SubtargetFeature> P7SpecificFeatures = [];
405480093f4SDimitry Andric  list<SubtargetFeature> P7Features =
406480093f4SDimitry Andric    !listconcat(P7InheritableFeatures, P7SpecificFeatures);
407480093f4SDimitry Andric
408480093f4SDimitry Andric  // Power8
4095ffd83dbSDimitry Andric  list<SubtargetFeature> P8AdditionalFeatures =
4105ffd83dbSDimitry Andric    [DirectivePwr8,
411480093f4SDimitry Andric     FeatureP8Altivec,
412480093f4SDimitry Andric     FeatureP8Vector,
413480093f4SDimitry Andric     FeatureP8Crypto,
414480093f4SDimitry Andric     FeatureHTM,
415480093f4SDimitry Andric     FeatureDirectMove,
416480093f4SDimitry Andric     FeatureICBT,
4175ffd83dbSDimitry Andric     FeaturePartwordAtomic,
418fe6060f1SDimitry Andric     FeatureQuadwordAtomic,
419fe6060f1SDimitry Andric     FeaturePredictableSelectIsExpensive,
42081ad6265SDimitry Andric     FeatureISA2_07,
42181ad6265SDimitry Andric     FeatureCRBits
4225ffd83dbSDimitry Andric    ];
4235ffd83dbSDimitry Andric
4245ffd83dbSDimitry Andric  list<SubtargetFeature> P8SpecificFeatures = [FeatureAddiLoadFusion,
4255ffd83dbSDimitry Andric                                               FeatureAddisLoadFusion];
426480093f4SDimitry Andric  list<SubtargetFeature> P8InheritableFeatures =
427480093f4SDimitry Andric    !listconcat(P7InheritableFeatures, P8AdditionalFeatures);
428480093f4SDimitry Andric  list<SubtargetFeature> P8Features =
429480093f4SDimitry Andric    !listconcat(P8InheritableFeatures, P8SpecificFeatures);
430480093f4SDimitry Andric
431480093f4SDimitry Andric  // Power9
4325ffd83dbSDimitry Andric  list<SubtargetFeature> P9AdditionalFeatures =
4335ffd83dbSDimitry Andric    [DirectivePwr9,
434480093f4SDimitry Andric     FeatureP9Altivec,
435480093f4SDimitry Andric     FeatureP9Vector,
436e8d8bef9SDimitry Andric     FeaturePPCPreRASched,
437e8d8bef9SDimitry Andric     FeaturePPCPostRASched,
4385ffd83dbSDimitry Andric     FeatureISA3_0,
4395ffd83dbSDimitry Andric     FeaturePredictableSelectIsExpensive
4405ffd83dbSDimitry Andric    ];
4415ffd83dbSDimitry Andric
442480093f4SDimitry Andric  // Some features are unique to Power9 and there is no reason to assume
443480093f4SDimitry Andric  // they will be part of any future CPUs. One example is the narrower
444480093f4SDimitry Andric  // dispatch for vector operations than scalar ones. For the time being,
445480093f4SDimitry Andric  // this list also includes scheduling-related features since we do not have
446480093f4SDimitry Andric  // enough info to create custom scheduling strategies for future CPUs.
447e8d8bef9SDimitry Andric  list<SubtargetFeature> P9SpecificFeatures = [FeatureVectorsUseTwoUnits];
448480093f4SDimitry Andric  list<SubtargetFeature> P9InheritableFeatures =
449480093f4SDimitry Andric    !listconcat(P8InheritableFeatures, P9AdditionalFeatures);
450480093f4SDimitry Andric  list<SubtargetFeature> P9Features =
451480093f4SDimitry Andric    !listconcat(P9InheritableFeatures, P9SpecificFeatures);
452480093f4SDimitry Andric
4535ffd83dbSDimitry Andric  // Power10
4545ffd83dbSDimitry Andric  // For P10 CPU we assume that all of the existing features from Power9
455480093f4SDimitry Andric  // still exist with the exception of those we know are Power9 specific.
456349cc55cSDimitry Andric  list<SubtargetFeature> FusionFeatures = [
457349cc55cSDimitry Andric    FeatureStoreFusion, FeatureAddLogicalFusion, FeatureLogicalAddFusion,
4584824e7fdSDimitry Andric    FeatureLogicalFusion, FeatureArithAddFusion, FeatureSha3Fusion,
459349cc55cSDimitry Andric  ];
4605ffd83dbSDimitry Andric  list<SubtargetFeature> P10AdditionalFeatures =
461e8d8bef9SDimitry Andric    !listconcat(FusionFeatures, [
462e8d8bef9SDimitry Andric       DirectivePwr10, FeatureISA3_1, FeaturePrefixInstrs,
463e8d8bef9SDimitry Andric       FeaturePCRelativeMemops, FeatureP10Vector, FeatureMMA,
464bdd1243dSDimitry Andric       FeaturePairedVectorMemops, FeatureFastMFLR]);
4655ffd83dbSDimitry Andric  list<SubtargetFeature> P10SpecificFeatures = [];
4665ffd83dbSDimitry Andric  list<SubtargetFeature> P10InheritableFeatures =
4675ffd83dbSDimitry Andric    !listconcat(P9InheritableFeatures, P10AdditionalFeatures);
4685ffd83dbSDimitry Andric  list<SubtargetFeature> P10Features =
4695ffd83dbSDimitry Andric    !listconcat(P10InheritableFeatures, P10SpecificFeatures);
4705ffd83dbSDimitry Andric
471*36b606aeSDimitry Andric  // Power11
472*36b606aeSDimitry Andric  // For P11 CPU we assume that all the existing features from Power10
4735ffd83dbSDimitry Andric  // still exist with the exception of those we know are Power10 specific.
474*36b606aeSDimitry Andric  list<SubtargetFeature> P11AdditionalFeatures =
475*36b606aeSDimitry Andric    [DirectivePwr11];
476*36b606aeSDimitry Andric  list<SubtargetFeature> P11SpecificFeatures =
477*36b606aeSDimitry Andric    [];
478*36b606aeSDimitry Andric  list<SubtargetFeature> P11InheritableFeatures =
479*36b606aeSDimitry Andric    !listconcat(P10InheritableFeatures, P11AdditionalFeatures);
480*36b606aeSDimitry Andric  list<SubtargetFeature> P11Features =
481*36b606aeSDimitry Andric    !listconcat(P11InheritableFeatures, P11SpecificFeatures);
482*36b606aeSDimitry Andric
483*36b606aeSDimitry Andric  // Future
484*36b606aeSDimitry Andric  // For future CPU we assume that all of the existing features from Power11
485*36b606aeSDimitry Andric  // still exist with the exception of those we know are Power11 specific.
48681ad6265SDimitry Andric  list<SubtargetFeature> FutureAdditionalFeatures = [FeatureISAFuture];
487480093f4SDimitry Andric  list<SubtargetFeature> FutureSpecificFeatures = [];
488480093f4SDimitry Andric  list<SubtargetFeature> FutureInheritableFeatures =
489*36b606aeSDimitry Andric    !listconcat(P11InheritableFeatures, FutureAdditionalFeatures);
490480093f4SDimitry Andric  list<SubtargetFeature> FutureFeatures =
491480093f4SDimitry Andric    !listconcat(FutureInheritableFeatures, FutureSpecificFeatures);
4920b57cec5SDimitry Andric}
4930b57cec5SDimitry Andric
4940b57cec5SDimitry Andric// Note: Future features to add when support is extended to more
4950b57cec5SDimitry Andric// recent ISA levels:
4960b57cec5SDimitry Andric//
4970b57cec5SDimitry Andric// DFP          p6, p6x, p7        decimal floating-point instructions
4980b57cec5SDimitry Andric// POPCNTB      p5 through p7      popcntb and related instructions
4990b57cec5SDimitry Andric
5000b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
5010b57cec5SDimitry Andric// Classes used for relation maps.
5020b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
5030b57cec5SDimitry Andric// RecFormRel - Filter class used to relate non-record-form instructions with
5040b57cec5SDimitry Andric// their record-form variants.
5050b57cec5SDimitry Andricclass RecFormRel;
5060b57cec5SDimitry Andric
5070b57cec5SDimitry Andric// AltVSXFMARel - Filter class used to relate the primary addend-killing VSX
5080b57cec5SDimitry Andric// FMA instruction forms with their corresponding factor-killing forms.
5090b57cec5SDimitry Andricclass AltVSXFMARel {
5100b57cec5SDimitry Andric  bit IsVSXFMAAlt = 0;
5110b57cec5SDimitry Andric}
5120b57cec5SDimitry Andric
5130b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
5140b57cec5SDimitry Andric// Relation Map Definitions.
5150b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
5160b57cec5SDimitry Andric
5170b57cec5SDimitry Andricdef getRecordFormOpcode : InstrMapping {
5180b57cec5SDimitry Andric  let FilterClass = "RecFormRel";
5190b57cec5SDimitry Andric  // Instructions with the same BaseName and Interpretation64Bit values
5200b57cec5SDimitry Andric  // form a row.
5210b57cec5SDimitry Andric  let RowFields = ["BaseName", "Interpretation64Bit"];
5220b57cec5SDimitry Andric  // Instructions with the same RC value form a column.
5230b57cec5SDimitry Andric  let ColFields = ["RC"];
5240b57cec5SDimitry Andric  // The key column are the non-record-form instructions.
5250b57cec5SDimitry Andric  let KeyCol = ["0"];
5260b57cec5SDimitry Andric  // Value columns RC=1
5270b57cec5SDimitry Andric  let ValueCols = [["1"]];
5280b57cec5SDimitry Andric}
5290b57cec5SDimitry Andric
5300b57cec5SDimitry Andricdef getNonRecordFormOpcode : InstrMapping {
5310b57cec5SDimitry Andric  let FilterClass = "RecFormRel";
5320b57cec5SDimitry Andric  // Instructions with the same BaseName and Interpretation64Bit values
5330b57cec5SDimitry Andric  // form a row.
5340b57cec5SDimitry Andric  let RowFields = ["BaseName", "Interpretation64Bit"];
5350b57cec5SDimitry Andric  // Instructions with the same RC value form a column.
5360b57cec5SDimitry Andric  let ColFields = ["RC"];
5370b57cec5SDimitry Andric  // The key column are the record-form instructions.
5380b57cec5SDimitry Andric  let KeyCol = ["1"];
5390b57cec5SDimitry Andric  // Value columns are RC=0
5400b57cec5SDimitry Andric  let ValueCols = [["0"]];
5410b57cec5SDimitry Andric}
5420b57cec5SDimitry Andric
5430b57cec5SDimitry Andricdef getAltVSXFMAOpcode : InstrMapping {
5440b57cec5SDimitry Andric  let FilterClass = "AltVSXFMARel";
5450b57cec5SDimitry Andric  // Instructions with the same BaseName value form a row.
5460b57cec5SDimitry Andric  let RowFields = ["BaseName"];
5470b57cec5SDimitry Andric  // Instructions with the same IsVSXFMAAlt value form a column.
5480b57cec5SDimitry Andric  let ColFields = ["IsVSXFMAAlt"];
5490b57cec5SDimitry Andric  // The key column are the (default) addend-killing instructions.
5500b57cec5SDimitry Andric  let KeyCol = ["0"];
5510b57cec5SDimitry Andric  // Value columns IsVSXFMAAlt=1
5520b57cec5SDimitry Andric  let ValueCols = [["1"]];
5530b57cec5SDimitry Andric}
5540b57cec5SDimitry Andric
5550b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
5560b57cec5SDimitry Andric// Register File Description
5570b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
5580b57cec5SDimitry Andric
5590b57cec5SDimitry Andricinclude "PPCRegisterInfo.td"
5600b57cec5SDimitry Andricinclude "PPCSchedule.td"
561e8d8bef9SDimitry Andricinclude "GISel/PPCRegisterBanks.td"
5620b57cec5SDimitry Andric
5630b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
5640b57cec5SDimitry Andric// PowerPC processors supported.
5650b57cec5SDimitry Andric//
5660b57cec5SDimitry Andric
5670b57cec5SDimitry Andricdef : Processor<"generic", G3Itineraries, [Directive32, FeatureHardFloat,
5680b57cec5SDimitry Andric                                           FeatureMFTB]>;
5690b57cec5SDimitry Andricdef : ProcessorModel<"440", PPC440Model, [Directive440, FeatureISEL,
5700b57cec5SDimitry Andric                                          FeatureFRES, FeatureFRSQRTE,
5710b57cec5SDimitry Andric                                          FeatureICBT, FeatureBookE,
5720b57cec5SDimitry Andric                                          FeatureMSYNC, FeatureMFTB]>;
5730b57cec5SDimitry Andricdef : ProcessorModel<"450", PPC440Model, [Directive440, FeatureISEL,
5740b57cec5SDimitry Andric                                          FeatureFRES, FeatureFRSQRTE,
5750b57cec5SDimitry Andric                                          FeatureICBT, FeatureBookE,
5760b57cec5SDimitry Andric                                          FeatureMSYNC, FeatureMFTB]>;
5770b57cec5SDimitry Andricdef : Processor<"601", G3Itineraries, [Directive601, FeatureFPU]>;
5780b57cec5SDimitry Andricdef : Processor<"602", G3Itineraries, [Directive602, FeatureFPU,
5790b57cec5SDimitry Andric                                       FeatureMFTB]>;
5800b57cec5SDimitry Andricdef : Processor<"603", G3Itineraries, [Directive603,
5810b57cec5SDimitry Andric                                       FeatureFRES, FeatureFRSQRTE,
5820b57cec5SDimitry Andric                                       FeatureMFTB]>;
5830b57cec5SDimitry Andricdef : Processor<"603e", G3Itineraries, [Directive603,
5840b57cec5SDimitry Andric                                        FeatureFRES, FeatureFRSQRTE,
5850b57cec5SDimitry Andric                                        FeatureMFTB]>;
5860b57cec5SDimitry Andricdef : Processor<"603ev", G3Itineraries, [Directive603,
5870b57cec5SDimitry Andric                                         FeatureFRES, FeatureFRSQRTE,
5880b57cec5SDimitry Andric                                         FeatureMFTB]>;
5890b57cec5SDimitry Andricdef : Processor<"604", G3Itineraries, [Directive604,
5900b57cec5SDimitry Andric                                       FeatureFRES, FeatureFRSQRTE,
5910b57cec5SDimitry Andric                                       FeatureMFTB]>;
5920b57cec5SDimitry Andricdef : Processor<"604e", G3Itineraries, [Directive604,
5930b57cec5SDimitry Andric                                        FeatureFRES, FeatureFRSQRTE,
5940b57cec5SDimitry Andric                                        FeatureMFTB]>;
5950b57cec5SDimitry Andricdef : Processor<"620", G3Itineraries, [Directive620,
5960b57cec5SDimitry Andric                                       FeatureFRES, FeatureFRSQRTE,
5970b57cec5SDimitry Andric                                       FeatureMFTB]>;
5980b57cec5SDimitry Andricdef : Processor<"750", G4Itineraries, [Directive750,
5990b57cec5SDimitry Andric                                       FeatureFRES, FeatureFRSQRTE,
6000b57cec5SDimitry Andric                                       FeatureMFTB]>;
6010b57cec5SDimitry Andricdef : Processor<"g3", G3Itineraries, [Directive750,
6020b57cec5SDimitry Andric                                      FeatureFRES, FeatureFRSQRTE,
6030b57cec5SDimitry Andric                                      FeatureMFTB]>;
6040b57cec5SDimitry Andricdef : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec,
6050b57cec5SDimitry Andric                                        FeatureFRES, FeatureFRSQRTE,
6060b57cec5SDimitry Andric                                        FeatureMFTB]>;
6070b57cec5SDimitry Andricdef : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec,
6080b57cec5SDimitry Andric                                      FeatureFRES, FeatureFRSQRTE,
6090b57cec5SDimitry Andric                                      FeatureMFTB]>;
6100b57cec5SDimitry Andricdef : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec,
6110b57cec5SDimitry Andric                                            FeatureFRES, FeatureFRSQRTE,
6120b57cec5SDimitry Andric                                            FeatureMFTB]>;
6130b57cec5SDimitry Andricdef : Processor<"g4+", G4PlusItineraries, [Directive7400, FeatureAltivec,
6140b57cec5SDimitry Andric                                           FeatureFRES, FeatureFRSQRTE,
6150b57cec5SDimitry Andric                                           FeatureMFTB]>;
6160b57cec5SDimitry Andric
6170b57cec5SDimitry Andricdef : ProcessorModel<"970", G5Model,
6180b57cec5SDimitry Andric                  [Directive970, FeatureAltivec,
6190b57cec5SDimitry Andric                   FeatureMFOCRF, FeatureFSqrt,
6200b57cec5SDimitry Andric                   FeatureFRES, FeatureFRSQRTE, FeatureSTFIWX,
6210b57cec5SDimitry Andric                   Feature64Bit /*, Feature64BitRegs */,
6220b57cec5SDimitry Andric                   FeatureMFTB]>;
6230b57cec5SDimitry Andricdef : ProcessorModel<"g5", G5Model,
6240b57cec5SDimitry Andric                  [Directive970, FeatureAltivec,
6250b57cec5SDimitry Andric                   FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
6260b57cec5SDimitry Andric                   FeatureFRES, FeatureFRSQRTE,
6270b57cec5SDimitry Andric                   Feature64Bit /*, Feature64BitRegs */,
6280b57cec5SDimitry Andric                   FeatureMFTB, DeprecatedDST]>;
6290b57cec5SDimitry Andricdef : ProcessorModel<"e500", PPCE500Model,
6300b57cec5SDimitry Andric                  [DirectiveE500,
6310b57cec5SDimitry Andric                   FeatureICBT, FeatureBookE,
6325b5f869eSDimitry Andric                   FeatureISEL, FeatureMFTB, FeatureMSYNC, FeatureSPE]>;
6330b57cec5SDimitry Andricdef : ProcessorModel<"e500mc", PPCE500mcModel,
6340b57cec5SDimitry Andric                  [DirectiveE500mc,
6350b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureICBT, FeatureBookE,
6360b57cec5SDimitry Andric                   FeatureISEL, FeatureMFTB]>;
6370b57cec5SDimitry Andricdef : ProcessorModel<"e5500", PPCE5500Model,
6380b57cec5SDimitry Andric                  [DirectiveE5500, FeatureMFOCRF, Feature64Bit,
6390b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureICBT, FeatureBookE,
6400b57cec5SDimitry Andric                   FeatureISEL, FeatureMFTB]>;
6410b57cec5SDimitry Andricdef : ProcessorModel<"a2", PPCA2Model,
6420b57cec5SDimitry Andric                  [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF,
6430b57cec5SDimitry Andric                   FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
6440b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
6450b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureLFIWAX,
6460b57cec5SDimitry Andric                   FeatureFPRND, FeatureFPCVT, FeatureISEL,
6470b57cec5SDimitry Andric                   FeatureSlowPOPCNTD, FeatureCMPB, FeatureLDBRX,
64881ad6265SDimitry Andric                   Feature64Bit /*, Feature64BitRegs */, FeatureMFTB,
64981ad6265SDimitry Andric                   FeatureISA2_06]>;
6500b57cec5SDimitry Andricdef : ProcessorModel<"pwr3", G5Model,
6510b57cec5SDimitry Andric                  [DirectivePwr3, FeatureAltivec,
6520b57cec5SDimitry Andric                   FeatureFRES, FeatureFRSQRTE, FeatureMFOCRF,
6530b57cec5SDimitry Andric                   FeatureSTFIWX, Feature64Bit]>;
6540b57cec5SDimitry Andricdef : ProcessorModel<"pwr4", G5Model,
6550b57cec5SDimitry Andric                  [DirectivePwr4, FeatureAltivec, FeatureMFOCRF,
6560b57cec5SDimitry Andric                   FeatureFSqrt, FeatureFRES, FeatureFRSQRTE,
6570b57cec5SDimitry Andric                   FeatureSTFIWX, Feature64Bit, FeatureMFTB]>;
6580b57cec5SDimitry Andricdef : ProcessorModel<"pwr5", G5Model,
6590b57cec5SDimitry Andric                  [DirectivePwr5, FeatureAltivec, FeatureMFOCRF,
6600b57cec5SDimitry Andric                   FeatureFSqrt, FeatureFRE, FeatureFRES,
6610b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureFRSQRTES,
6620b57cec5SDimitry Andric                   FeatureSTFIWX, Feature64Bit,
6630b57cec5SDimitry Andric                   FeatureMFTB, DeprecatedDST]>;
6640b57cec5SDimitry Andricdef : ProcessorModel<"pwr5x", G5Model,
6650b57cec5SDimitry Andric                  [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
6660b57cec5SDimitry Andric                   FeatureFSqrt, FeatureFRE, FeatureFRES,
6670b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureFRSQRTES,
6680b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureFPRND, Feature64Bit,
6690b57cec5SDimitry Andric                   FeatureMFTB, DeprecatedDST]>;
6700b57cec5SDimitry Andricdef : ProcessorModel<"pwr6", G5Model,
6710b57cec5SDimitry Andric                  [DirectivePwr6, FeatureAltivec,
6720b57cec5SDimitry Andric                   FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE,
6730b57cec5SDimitry Andric                   FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
6740b57cec5SDimitry Andric                   FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
6750b57cec5SDimitry Andric                   FeatureFPRND, Feature64Bit /*, Feature64BitRegs */,
6760b57cec5SDimitry Andric                   FeatureMFTB, DeprecatedDST]>;
6770b57cec5SDimitry Andricdef : ProcessorModel<"pwr6x", G5Model,
6780b57cec5SDimitry Andric                  [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
6790b57cec5SDimitry Andric                   FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
6800b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
6810b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
6820b57cec5SDimitry Andric                   FeatureFPRND, Feature64Bit,
6830b57cec5SDimitry Andric                   FeatureMFTB, DeprecatedDST]>;
684480093f4SDimitry Andricdef : ProcessorModel<"pwr7", P7Model, ProcessorFeatures.P7Features>;
685480093f4SDimitry Andricdef : ProcessorModel<"pwr8", P8Model, ProcessorFeatures.P8Features>;
686480093f4SDimitry Andricdef : ProcessorModel<"pwr9", P9Model, ProcessorFeatures.P9Features>;
687349cc55cSDimitry Andricdef : ProcessorModel<"pwr10", P10Model, ProcessorFeatures.P10Features>;
688*36b606aeSDimitry Andricdef : ProcessorModel<"pwr11", P10Model, ProcessorFeatures.P11Features>;
689480093f4SDimitry Andric// No scheduler model for future CPU.
690480093f4SDimitry Andricdef : ProcessorModel<"future", NoSchedModel,
691480093f4SDimitry Andric                  ProcessorFeatures.FutureFeatures>;
6920b57cec5SDimitry Andricdef : Processor<"ppc", G3Itineraries, [Directive32, FeatureHardFloat,
6930b57cec5SDimitry Andric                                       FeatureMFTB]>;
6940b57cec5SDimitry Andricdef : Processor<"ppc32", G3Itineraries, [Directive32, FeatureHardFloat,
6950b57cec5SDimitry Andric                                         FeatureMFTB]>;
6960b57cec5SDimitry Andricdef : ProcessorModel<"ppc64", G5Model,
6970b57cec5SDimitry Andric                  [Directive64, FeatureAltivec,
6980b57cec5SDimitry Andric                   FeatureMFOCRF, FeatureFSqrt, FeatureFRES,
6990b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureSTFIWX,
7000b57cec5SDimitry Andric                   Feature64Bit /*, Feature64BitRegs */,
7010b57cec5SDimitry Andric                   FeatureMFTB]>;
702480093f4SDimitry Andricdef : ProcessorModel<"ppc64le", P8Model, ProcessorFeatures.P8Features>;
7030b57cec5SDimitry Andric
7040b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
7050b57cec5SDimitry Andric// Calling Conventions
7060b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
7070b57cec5SDimitry Andric
7080b57cec5SDimitry Andricinclude "PPCCallingConv.td"
7090b57cec5SDimitry Andric
7100b57cec5SDimitry Andricdef PPCInstrInfo : InstrInfo {
7110b57cec5SDimitry Andric  let isLittleEndianEncoding = 1;
7120b57cec5SDimitry Andric}
7130b57cec5SDimitry Andric
714e8d8bef9SDimitry Andricdef PPCAsmWriter : AsmWriter {
715e8d8bef9SDimitry Andric  string AsmWriterClassName  = "InstPrinter";
716e8d8bef9SDimitry Andric  int PassSubtarget = 1;
717e8d8bef9SDimitry Andric  int Variant = 0;
718e8d8bef9SDimitry Andric  bit isMCAsmWriter = 1;
719e8d8bef9SDimitry Andric}
720e8d8bef9SDimitry Andric
7210b57cec5SDimitry Andricdef PPCAsmParser : AsmParser {
7220b57cec5SDimitry Andric  let ShouldEmitMatchRegisterName = 0;
7230b57cec5SDimitry Andric}
7240b57cec5SDimitry Andric
7250b57cec5SDimitry Andricdef PPCAsmParserVariant : AsmParserVariant {
7260b57cec5SDimitry Andric  int Variant = 0;
7270b57cec5SDimitry Andric
7280b57cec5SDimitry Andric  // We do not use hard coded registers in asm strings.  However, some
7290b57cec5SDimitry Andric  // InstAlias definitions use immediate literals.  Set RegisterPrefix
7300b57cec5SDimitry Andric  // so that those are not misinterpreted as registers.
7310b57cec5SDimitry Andric  string RegisterPrefix = "%";
7320b57cec5SDimitry Andric  string BreakCharacters = ".";
7330b57cec5SDimitry Andric}
7340b57cec5SDimitry Andric
7350b57cec5SDimitry Andricdef PPC : Target {
7360b57cec5SDimitry Andric  // Information about the instructions.
7370b57cec5SDimitry Andric  let InstructionSet = PPCInstrInfo;
7380b57cec5SDimitry Andric
739e8d8bef9SDimitry Andric  let AssemblyWriters = [PPCAsmWriter];
7400b57cec5SDimitry Andric  let AssemblyParsers = [PPCAsmParser];
7410b57cec5SDimitry Andric  let AssemblyParserVariants = [PPCAsmParserVariant];
7420b57cec5SDimitry Andric  let AllowRegisterRenaming = 1;
7430b57cec5SDimitry Andric}
7440b57cec5SDimitry Andric
7450b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
7460b57cec5SDimitry Andric// Pfm Counters
7470b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
7480b57cec5SDimitry Andric
7490b57cec5SDimitry Andricinclude "PPCPfmCounters.td"
750