xref: /freebsd/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.td (revision e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)
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", "">;
55480093f4SDimitry Andricdef DirectivePwrFuture
56480093f4SDimitry Andric    : SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR_FUTURE", "">;
570b57cec5SDimitry Andric
580b57cec5SDimitry Andricdef Feature64Bit     : SubtargetFeature<"64bit","Has64BitSupport", "true",
590b57cec5SDimitry Andric                                        "Enable 64-bit instructions">;
60*e8d8bef9SDimitry Andricdef AIXOS: SubtargetFeature<"aix", "IsAIX", "true", "AIX OS">;
61*e8d8bef9SDimitry Andricdef FeatureModernAIXAs
62*e8d8bef9SDimitry Andric    : SubtargetFeature<"modern-aix-as", "HasModernAIXAs", "true",
63*e8d8bef9SDimitry Andric                       "AIX system assembler is modern enough to support new mnes">;
640b57cec5SDimitry Andricdef FeatureHardFloat : SubtargetFeature<"hard-float", "HasHardFloat", "true",
650b57cec5SDimitry Andric                              "Enable floating-point instructions">;
660b57cec5SDimitry Andricdef Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true",
670b57cec5SDimitry Andric                              "Enable 64-bit registers usage for ppc32 [beta]">;
680b57cec5SDimitry Andricdef FeatureCRBits    : SubtargetFeature<"crbits", "UseCRBits", "true",
690b57cec5SDimitry Andric                              "Use condition-register bits individually">;
700b57cec5SDimitry Andricdef FeatureFPU       : SubtargetFeature<"fpu","HasFPU","true",
710b57cec5SDimitry Andric                                        "Enable classic FPU instructions",
720b57cec5SDimitry Andric                                        [FeatureHardFloat]>;
730b57cec5SDimitry Andricdef FeatureAltivec   : SubtargetFeature<"altivec","HasAltivec", "true",
740b57cec5SDimitry Andric                                        "Enable Altivec instructions",
750b57cec5SDimitry Andric                                        [FeatureFPU]>;
760b57cec5SDimitry Andricdef FeatureSPE       : SubtargetFeature<"spe","HasSPE", "true",
770b57cec5SDimitry Andric                                        "Enable SPE instructions",
780b57cec5SDimitry Andric                                        [FeatureHardFloat]>;
79*e8d8bef9SDimitry Andricdef FeatureEFPU2 : SubtargetFeature<"efpu2", "HasEFPU2", "true",
80*e8d8bef9SDimitry Andric                                        "Enable Embedded Floating-Point APU 2 instructions",
81*e8d8bef9SDimitry Andric                                        [FeatureSPE]>;
820b57cec5SDimitry Andricdef FeatureMFOCRF    : SubtargetFeature<"mfocrf","HasMFOCRF", "true",
830b57cec5SDimitry Andric                                        "Enable the MFOCRF instruction">;
840b57cec5SDimitry Andricdef FeatureFSqrt     : SubtargetFeature<"fsqrt","HasFSQRT", "true",
850b57cec5SDimitry Andric                                        "Enable the fsqrt instruction",
860b57cec5SDimitry Andric                                        [FeatureFPU]>;
870b57cec5SDimitry Andricdef FeatureFCPSGN    : SubtargetFeature<"fcpsgn", "HasFCPSGN", "true",
880b57cec5SDimitry Andric                                        "Enable the fcpsgn instruction",
890b57cec5SDimitry Andric                                        [FeatureFPU]>;
900b57cec5SDimitry Andricdef FeatureFRE       : SubtargetFeature<"fre", "HasFRE", "true",
910b57cec5SDimitry Andric                                        "Enable the fre instruction",
920b57cec5SDimitry Andric                                        [FeatureFPU]>;
930b57cec5SDimitry Andricdef FeatureFRES      : SubtargetFeature<"fres", "HasFRES", "true",
940b57cec5SDimitry Andric                                        "Enable the fres instruction",
950b57cec5SDimitry Andric                                        [FeatureFPU]>;
960b57cec5SDimitry Andricdef FeatureFRSQRTE   : SubtargetFeature<"frsqrte", "HasFRSQRTE", "true",
970b57cec5SDimitry Andric                                        "Enable the frsqrte instruction",
980b57cec5SDimitry Andric                                        [FeatureFPU]>;
990b57cec5SDimitry Andricdef FeatureFRSQRTES  : SubtargetFeature<"frsqrtes", "HasFRSQRTES", "true",
1000b57cec5SDimitry Andric                                        "Enable the frsqrtes instruction",
1010b57cec5SDimitry Andric                                        [FeatureFPU]>;
1020b57cec5SDimitry Andricdef FeatureRecipPrec : SubtargetFeature<"recipprec", "HasRecipPrec", "true",
1030b57cec5SDimitry Andric                              "Assume higher precision reciprocal estimates">;
1040b57cec5SDimitry Andricdef FeatureSTFIWX    : SubtargetFeature<"stfiwx","HasSTFIWX", "true",
1050b57cec5SDimitry Andric                                        "Enable the stfiwx instruction",
1060b57cec5SDimitry Andric                                        [FeatureFPU]>;
1070b57cec5SDimitry Andricdef FeatureLFIWAX    : SubtargetFeature<"lfiwax","HasLFIWAX", "true",
1080b57cec5SDimitry Andric                                        "Enable the lfiwax instruction",
1090b57cec5SDimitry Andric                                        [FeatureFPU]>;
1100b57cec5SDimitry Andricdef FeatureFPRND     : SubtargetFeature<"fprnd", "HasFPRND", "true",
1110b57cec5SDimitry Andric                                        "Enable the fri[mnpz] instructions",
1120b57cec5SDimitry Andric                                        [FeatureFPU]>;
1130b57cec5SDimitry Andricdef FeatureFPCVT     : SubtargetFeature<"fpcvt", "HasFPCVT", "true",
1140b57cec5SDimitry Andric  "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions",
1150b57cec5SDimitry Andric                                        [FeatureFPU]>;
1160b57cec5SDimitry Andricdef FeatureISEL      : SubtargetFeature<"isel","HasISEL", "true",
1170b57cec5SDimitry Andric                                        "Enable the isel instruction">;
1180b57cec5SDimitry Andricdef FeatureBPERMD    : SubtargetFeature<"bpermd", "HasBPERMD", "true",
1190b57cec5SDimitry Andric                                        "Enable the bpermd instruction">;
1200b57cec5SDimitry Andricdef FeatureExtDiv    : SubtargetFeature<"extdiv", "HasExtDiv", "true",
1210b57cec5SDimitry Andric                                        "Enable extended divide instructions">;
1220b57cec5SDimitry Andricdef FeatureLDBRX     : SubtargetFeature<"ldbrx","HasLDBRX", "true",
1230b57cec5SDimitry Andric                                        "Enable the ldbrx instruction">;
1240b57cec5SDimitry Andricdef FeatureCMPB      : SubtargetFeature<"cmpb", "HasCMPB", "true",
1250b57cec5SDimitry Andric                                        "Enable the cmpb instruction">;
1260b57cec5SDimitry Andricdef FeatureICBT      : SubtargetFeature<"icbt","HasICBT", "true",
1270b57cec5SDimitry Andric                                        "Enable icbt instruction">;
1280b57cec5SDimitry Andricdef FeatureBookE     : SubtargetFeature<"booke", "IsBookE", "true",
1290b57cec5SDimitry Andric                                        "Enable Book E instructions",
1300b57cec5SDimitry Andric                                        [FeatureICBT]>;
1310b57cec5SDimitry Andricdef FeatureMSYNC     : SubtargetFeature<"msync", "HasOnlyMSYNC", "true",
1320b57cec5SDimitry Andric                              "Has only the msync instruction instead of sync",
1330b57cec5SDimitry Andric                              [FeatureBookE]>;
1340b57cec5SDimitry Andricdef FeatureE500      : SubtargetFeature<"e500", "IsE500", "true",
1350b57cec5SDimitry Andric                                        "Enable E500/E500mc instructions">;
1360b57cec5SDimitry Andricdef FeatureSecurePlt : SubtargetFeature<"secure-plt","SecurePlt", "true",
1370b57cec5SDimitry Andric                                        "Enable secure plt mode">;
1380b57cec5SDimitry Andricdef FeaturePPC4xx    : SubtargetFeature<"ppc4xx", "IsPPC4xx", "true",
1390b57cec5SDimitry Andric                                        "Enable PPC 4xx instructions">;
1400b57cec5SDimitry Andricdef FeaturePPC6xx    : SubtargetFeature<"ppc6xx", "IsPPC6xx", "true",
1410b57cec5SDimitry Andric                                        "Enable PPC 6xx instructions">;
1420b57cec5SDimitry Andricdef FeatureVSX       : SubtargetFeature<"vsx","HasVSX", "true",
1430b57cec5SDimitry Andric                                        "Enable VSX instructions",
1440b57cec5SDimitry Andric                                        [FeatureAltivec]>;
1450b57cec5SDimitry Andricdef FeatureTwoConstNR :
1460b57cec5SDimitry Andric  SubtargetFeature<"two-const-nr", "NeedsTwoConstNR", "true",
1470b57cec5SDimitry Andric                   "Requires two constant Newton-Raphson computation">;
1480b57cec5SDimitry Andricdef FeatureP8Altivec : SubtargetFeature<"power8-altivec", "HasP8Altivec", "true",
1490b57cec5SDimitry Andric                                        "Enable POWER8 Altivec instructions",
1500b57cec5SDimitry Andric                                        [FeatureAltivec]>;
1510b57cec5SDimitry Andricdef FeatureP8Crypto : SubtargetFeature<"crypto", "HasP8Crypto", "true",
1520b57cec5SDimitry Andric                                       "Enable POWER8 Crypto instructions",
1530b57cec5SDimitry Andric                                       [FeatureP8Altivec]>;
1540b57cec5SDimitry Andricdef FeatureP8Vector  : SubtargetFeature<"power8-vector", "HasP8Vector", "true",
1550b57cec5SDimitry Andric                                        "Enable POWER8 vector instructions",
1560b57cec5SDimitry Andric                                        [FeatureVSX, FeatureP8Altivec]>;
1570b57cec5SDimitry Andricdef FeatureDirectMove :
1580b57cec5SDimitry Andric  SubtargetFeature<"direct-move", "HasDirectMove", "true",
1590b57cec5SDimitry Andric                   "Enable Power8 direct move instructions",
1600b57cec5SDimitry Andric                   [FeatureVSX]>;
1610b57cec5SDimitry Andricdef FeaturePartwordAtomic : SubtargetFeature<"partword-atomics",
1620b57cec5SDimitry Andric                                             "HasPartwordAtomics", "true",
1630b57cec5SDimitry Andric                                             "Enable l[bh]arx and st[bh]cx.">;
1640b57cec5SDimitry Andricdef FeatureInvariantFunctionDescriptors :
1650b57cec5SDimitry Andric  SubtargetFeature<"invariant-function-descriptors",
1660b57cec5SDimitry Andric                   "HasInvariantFunctionDescriptors", "true",
1670b57cec5SDimitry Andric                   "Assume function descriptors are invariant">;
1680b57cec5SDimitry Andricdef FeatureLongCall : SubtargetFeature<"longcall", "UseLongCalls", "true",
1690b57cec5SDimitry Andric                                       "Always use indirect calls">;
1700b57cec5SDimitry Andricdef FeatureHTM : SubtargetFeature<"htm", "HasHTM", "true",
1710b57cec5SDimitry Andric                                  "Enable Hardware Transactional Memory instructions">;
1720b57cec5SDimitry Andricdef FeatureMFTB   : SubtargetFeature<"", "FeatureMFTB", "true",
1730b57cec5SDimitry Andric                                        "Implement mftb using the mfspr instruction">;
1745ffd83dbSDimitry Andricdef FeatureFusion : SubtargetFeature<"fusion", "HasFusion", "true",
1755ffd83dbSDimitry Andric                                     "Target supports instruction fusion">;
1765ffd83dbSDimitry Andricdef FeatureAddiLoadFusion : SubtargetFeature<"fuse-addi-load",
1775ffd83dbSDimitry Andric                                             "HasAddiLoadFusion", "true",
1785ffd83dbSDimitry Andric                                             "Power8 Addi-Load fusion",
1795ffd83dbSDimitry Andric                                             [FeatureFusion]>;
1805ffd83dbSDimitry Andricdef FeatureAddisLoadFusion : SubtargetFeature<"fuse-addis-load",
1815ffd83dbSDimitry Andric                                              "HasAddisLoadFusion", "true",
1825ffd83dbSDimitry Andric                                              "Power8 Addis-Load fusion",
1835ffd83dbSDimitry Andric                                              [FeatureFusion]>;
184*e8d8bef9SDimitry Andricdef FeatureStoreFusion : SubtargetFeature<"fuse-store", "HasStoreFusion", "true",
185*e8d8bef9SDimitry Andric                                          "Target supports store clustering",
186*e8d8bef9SDimitry Andric                                          [FeatureFusion]>;
1870946e70aSDimitry Andricdef FeatureUnalignedFloats :
1880946e70aSDimitry Andric  SubtargetFeature<"allow-unaligned-fp-access", "AllowsUnalignedFPAccess",
1890946e70aSDimitry Andric                   "true", "CPU does not trap on unaligned FP access">;
1900b57cec5SDimitry Andricdef FeaturePPCPreRASched:
1910b57cec5SDimitry Andric  SubtargetFeature<"ppc-prera-sched", "UsePPCPreRASchedStrategy", "true",
1920b57cec5SDimitry Andric                   "Use PowerPC pre-RA scheduling strategy">;
1930b57cec5SDimitry Andricdef FeaturePPCPostRASched:
1940b57cec5SDimitry Andric  SubtargetFeature<"ppc-postra-sched", "UsePPCPostRASchedStrategy", "true",
1950b57cec5SDimitry Andric                   "Use PowerPC post-RA scheduling strategy">;
1960b57cec5SDimitry Andricdef FeatureFloat128 :
1970b57cec5SDimitry Andric  SubtargetFeature<"float128", "HasFloat128", "true",
1980b57cec5SDimitry Andric                   "Enable the __float128 data type for IEEE-754R Binary128.",
1990b57cec5SDimitry Andric                   [FeatureVSX]>;
2000b57cec5SDimitry Andricdef FeaturePOPCNTD   : SubtargetFeature<"popcntd","HasPOPCNTD",
2010b57cec5SDimitry Andric                                        "POPCNTD_Fast",
2020b57cec5SDimitry Andric                                        "Enable the popcnt[dw] instructions">;
203*e8d8bef9SDimitry Andric// Note that for the a2 processor models we should not use popcnt[dw] by
2040b57cec5SDimitry Andric// default. These processors do support the instructions, but they're
2050b57cec5SDimitry Andric// microcoded, and the software emulation is about twice as fast.
2060b57cec5SDimitry Andricdef FeatureSlowPOPCNTD : SubtargetFeature<"slow-popcntd","HasPOPCNTD",
2070b57cec5SDimitry Andric                                          "POPCNTD_Slow",
2080b57cec5SDimitry Andric                                          "Has slow popcnt[dw] instructions">;
2090b57cec5SDimitry Andric
2100b57cec5SDimitry Andricdef DeprecatedDST    : SubtargetFeature<"", "DeprecatedDST", "true",
2110b57cec5SDimitry Andric  "Treat vector data stream cache control instructions as deprecated">;
2120b57cec5SDimitry Andric
2130b57cec5SDimitry Andricdef FeatureISA3_0 : SubtargetFeature<"isa-v30-instructions", "IsISA3_0",
2140b57cec5SDimitry Andric                                     "true",
2155ffd83dbSDimitry Andric                                     "Enable instructions in ISA 3.0.">;
2165ffd83dbSDimitry Andricdef FeatureISA3_1 : SubtargetFeature<"isa-v31-instructions", "IsISA3_1",
2175ffd83dbSDimitry Andric                                     "true",
2185ffd83dbSDimitry Andric                                     "Enable instructions in ISA 3.1.",
2195ffd83dbSDimitry Andric                                     [FeatureISA3_0]>;
2200b57cec5SDimitry Andricdef FeatureP9Altivec : SubtargetFeature<"power9-altivec", "HasP9Altivec", "true",
2210b57cec5SDimitry Andric                                        "Enable POWER9 Altivec instructions",
2220b57cec5SDimitry Andric                                        [FeatureISA3_0, FeatureP8Altivec]>;
2230b57cec5SDimitry Andricdef FeatureP9Vector  : SubtargetFeature<"power9-vector", "HasP9Vector", "true",
2240b57cec5SDimitry Andric                                        "Enable POWER9 vector instructions",
2250b57cec5SDimitry Andric                                        [FeatureISA3_0, FeatureP8Vector,
2260b57cec5SDimitry Andric                                         FeatureP9Altivec]>;
2275ffd83dbSDimitry Andricdef FeatureP10Vector  : SubtargetFeature<"power10-vector", "HasP10Vector",
2285ffd83dbSDimitry Andric                                         "true",
2295ffd83dbSDimitry Andric                                         "Enable POWER10 vector instructions",
2305ffd83dbSDimitry Andric                                         [FeatureISA3_1, FeatureP9Vector]>;
2310b57cec5SDimitry Andric// A separate feature for this even though it is equivalent to P9Vector
2320b57cec5SDimitry Andric// because this is a feature of the implementation rather than the architecture
2330b57cec5SDimitry Andric// and may go away with future CPU's.
2340b57cec5SDimitry Andricdef FeatureVectorsUseTwoUnits : SubtargetFeature<"vectors-use-two-units",
2350b57cec5SDimitry Andric                                                 "VectorsUseTwoUnits",
2360b57cec5SDimitry Andric                                                 "true",
2370b57cec5SDimitry Andric                                                 "Vectors use two units">;
2385ffd83dbSDimitry Andricdef FeaturePrefixInstrs : SubtargetFeature<"prefix-instrs", "HasPrefixInstrs",
2395ffd83dbSDimitry Andric                                           "true",
2405ffd83dbSDimitry Andric                                           "Enable prefixed instructions",
2415ffd83dbSDimitry Andric                                           [FeatureISA3_0, FeatureP8Vector,
2425ffd83dbSDimitry Andric                                            FeatureP9Altivec]>;
2435ffd83dbSDimitry Andricdef FeaturePCRelativeMemops :
2445ffd83dbSDimitry Andric  SubtargetFeature<"pcrelative-memops", "HasPCRelativeMemops", "true",
2455ffd83dbSDimitry Andric                   "Enable PC relative Memory Ops",
246*e8d8bef9SDimitry Andric                   [FeatureISA3_0, FeaturePrefixInstrs]>;
247*e8d8bef9SDimitry Andricdef FeaturePairedVectorMemops:
248*e8d8bef9SDimitry Andric  SubtargetFeature<"paired-vector-memops", "PairedVectorMemops", "true",
249*e8d8bef9SDimitry Andric                   "32Byte load and store instructions",
2505ffd83dbSDimitry Andric                   [FeatureISA3_0]>;
251*e8d8bef9SDimitry Andricdef FeatureMMA : SubtargetFeature<"mma", "HasMMA", "true",
252*e8d8bef9SDimitry Andric                                  "Enable MMA instructions",
253*e8d8bef9SDimitry Andric                                  [FeatureP8Vector, FeatureP9Altivec,
254*e8d8bef9SDimitry Andric                                   FeaturePairedVectorMemops]>;
2555ffd83dbSDimitry Andric
2565ffd83dbSDimitry Andricdef FeaturePredictableSelectIsExpensive :
2575ffd83dbSDimitry Andric  SubtargetFeature<"predictable-select-expensive",
2585ffd83dbSDimitry Andric                   "PredictableSelectIsExpensive",
2595ffd83dbSDimitry Andric                   "true",
2605ffd83dbSDimitry Andric                   "Prefer likely predicted branches over selects">;
2610b57cec5SDimitry Andric
2620b57cec5SDimitry Andric// Since new processors generally contain a superset of features of those that
2630b57cec5SDimitry Andric// came before them, the idea is to make implementations of new processors
2640b57cec5SDimitry Andric// less error prone and easier to read.
2650b57cec5SDimitry Andric// Namely:
266480093f4SDimitry Andric//     list<SubtargetFeature> P8InheritableFeatures = ...
267480093f4SDimitry Andric//     list<SubtargetFeature> FutureProcessorAddtionalFeatures =
268480093f4SDimitry Andric//         [ features that Power8 does not support but inheritable ]
269480093f4SDimitry Andric//     list<SubtargetFeature> FutureProcessorSpecificFeatures =
270480093f4SDimitry Andric//         [ features that Power8 does not support and not inheritable ]
271480093f4SDimitry Andric//     list<SubtargetFeature> FutureProcessorInheritableFeatures =
272480093f4SDimitry Andric//         !listconcat(P8InheritableFeatures, FutureProcessorAddtionalFeatures)
273480093f4SDimitry Andric//     list<SubtargetFeature> FutureProcessorFeatures =
274480093f4SDimitry Andric//         !listconcat(FutureProcessorInheritableFeatures,
275480093f4SDimitry Andric//                     FutureProcessorSpecificFeatures)
2760b57cec5SDimitry Andric
2775ffd83dbSDimitry Andric// Makes it explicit and obvious what is new in FutureProcessor vs. Power8 as
2780b57cec5SDimitry Andric// well as providing a single point of definition if the feature set will be
2790b57cec5SDimitry Andric// used elsewhere.
2800b57cec5SDimitry Andricdef ProcessorFeatures {
281480093f4SDimitry Andric  // Power7
282480093f4SDimitry Andric  list<SubtargetFeature> P7InheritableFeatures = [DirectivePwr7,
283480093f4SDimitry Andric                                                  FeatureAltivec,
284480093f4SDimitry Andric                                                  FeatureVSX,
285480093f4SDimitry Andric                                                  FeatureMFOCRF,
286480093f4SDimitry Andric                                                  FeatureFCPSGN,
287480093f4SDimitry Andric                                                  FeatureFSqrt,
288480093f4SDimitry Andric                                                  FeatureFRE,
289480093f4SDimitry Andric                                                  FeatureFRES,
290480093f4SDimitry Andric                                                  FeatureFRSQRTE,
291480093f4SDimitry Andric                                                  FeatureFRSQRTES,
292480093f4SDimitry Andric                                                  FeatureRecipPrec,
293480093f4SDimitry Andric                                                  FeatureSTFIWX,
294480093f4SDimitry Andric                                                  FeatureLFIWAX,
295480093f4SDimitry Andric                                                  FeatureFPRND,
296480093f4SDimitry Andric                                                  FeatureFPCVT,
297480093f4SDimitry Andric                                                  FeatureISEL,
298480093f4SDimitry Andric                                                  FeaturePOPCNTD,
299480093f4SDimitry Andric                                                  FeatureCMPB,
300480093f4SDimitry Andric                                                  FeatureLDBRX,
301480093f4SDimitry Andric                                                  Feature64Bit,
302480093f4SDimitry Andric                                                  /* Feature64BitRegs, */
303480093f4SDimitry Andric                                                  FeatureBPERMD,
304480093f4SDimitry Andric                                                  FeatureExtDiv,
305480093f4SDimitry Andric                                                  FeatureMFTB,
306480093f4SDimitry Andric                                                  DeprecatedDST,
3070946e70aSDimitry Andric                                                  FeatureTwoConstNR,
3080946e70aSDimitry Andric                                                  FeatureUnalignedFloats];
309480093f4SDimitry Andric  list<SubtargetFeature> P7SpecificFeatures = [];
310480093f4SDimitry Andric  list<SubtargetFeature> P7Features =
311480093f4SDimitry Andric    !listconcat(P7InheritableFeatures, P7SpecificFeatures);
312480093f4SDimitry Andric
313480093f4SDimitry Andric  // Power8
3145ffd83dbSDimitry Andric  list<SubtargetFeature> P8AdditionalFeatures =
3155ffd83dbSDimitry Andric    [DirectivePwr8,
316480093f4SDimitry Andric     FeatureP8Altivec,
317480093f4SDimitry Andric     FeatureP8Vector,
318480093f4SDimitry Andric     FeatureP8Crypto,
319480093f4SDimitry Andric     FeatureHTM,
320480093f4SDimitry Andric     FeatureDirectMove,
321480093f4SDimitry Andric     FeatureICBT,
3225ffd83dbSDimitry Andric     FeaturePartwordAtomic,
3235ffd83dbSDimitry Andric     FeaturePredictableSelectIsExpensive
3245ffd83dbSDimitry Andric    ];
3255ffd83dbSDimitry Andric
3265ffd83dbSDimitry Andric  list<SubtargetFeature> P8SpecificFeatures = [FeatureAddiLoadFusion,
3275ffd83dbSDimitry Andric                                               FeatureAddisLoadFusion];
328480093f4SDimitry Andric  list<SubtargetFeature> P8InheritableFeatures =
329480093f4SDimitry Andric    !listconcat(P7InheritableFeatures, P8AdditionalFeatures);
330480093f4SDimitry Andric  list<SubtargetFeature> P8Features =
331480093f4SDimitry Andric    !listconcat(P8InheritableFeatures, P8SpecificFeatures);
332480093f4SDimitry Andric
333480093f4SDimitry Andric  // Power9
3345ffd83dbSDimitry Andric  list<SubtargetFeature> P9AdditionalFeatures =
3355ffd83dbSDimitry Andric    [DirectivePwr9,
336480093f4SDimitry Andric     FeatureP9Altivec,
337480093f4SDimitry Andric     FeatureP9Vector,
338*e8d8bef9SDimitry Andric     FeaturePPCPreRASched,
339*e8d8bef9SDimitry Andric     FeaturePPCPostRASched,
3405ffd83dbSDimitry Andric     FeatureISA3_0,
3415ffd83dbSDimitry Andric     FeaturePredictableSelectIsExpensive
3425ffd83dbSDimitry Andric    ];
3435ffd83dbSDimitry Andric
344480093f4SDimitry Andric  // Some features are unique to Power9 and there is no reason to assume
345480093f4SDimitry Andric  // they will be part of any future CPUs. One example is the narrower
346480093f4SDimitry Andric  // dispatch for vector operations than scalar ones. For the time being,
347480093f4SDimitry Andric  // this list also includes scheduling-related features since we do not have
348480093f4SDimitry Andric  // enough info to create custom scheduling strategies for future CPUs.
349*e8d8bef9SDimitry Andric  list<SubtargetFeature> P9SpecificFeatures = [FeatureVectorsUseTwoUnits];
350480093f4SDimitry Andric  list<SubtargetFeature> P9InheritableFeatures =
351480093f4SDimitry Andric    !listconcat(P8InheritableFeatures, P9AdditionalFeatures);
352480093f4SDimitry Andric  list<SubtargetFeature> P9Features =
353480093f4SDimitry Andric    !listconcat(P9InheritableFeatures, P9SpecificFeatures);
354480093f4SDimitry Andric
3555ffd83dbSDimitry Andric  // Power10
3565ffd83dbSDimitry Andric  // For P10 CPU we assume that all of the existing features from Power9
357480093f4SDimitry Andric  // still exist with the exception of those we know are Power9 specific.
358*e8d8bef9SDimitry Andric  list<SubtargetFeature> FusionFeatures = [FeatureStoreFusion];
3595ffd83dbSDimitry Andric  list<SubtargetFeature> P10AdditionalFeatures =
360*e8d8bef9SDimitry Andric    !listconcat(FusionFeatures, [
361*e8d8bef9SDimitry Andric       DirectivePwr10, FeatureISA3_1, FeaturePrefixInstrs,
362*e8d8bef9SDimitry Andric       FeaturePCRelativeMemops, FeatureP10Vector, FeatureMMA,
363*e8d8bef9SDimitry Andric       FeaturePairedVectorMemops]);
3645ffd83dbSDimitry Andric  list<SubtargetFeature> P10SpecificFeatures = [];
3655ffd83dbSDimitry Andric  list<SubtargetFeature> P10InheritableFeatures =
3665ffd83dbSDimitry Andric    !listconcat(P9InheritableFeatures, P10AdditionalFeatures);
3675ffd83dbSDimitry Andric  list<SubtargetFeature> P10Features =
3685ffd83dbSDimitry Andric    !listconcat(P10InheritableFeatures, P10SpecificFeatures);
3695ffd83dbSDimitry Andric
3705ffd83dbSDimitry Andric  // Future
3715ffd83dbSDimitry Andric  // For future CPU we assume that all of the existing features from Power10
3725ffd83dbSDimitry Andric  // still exist with the exception of those we know are Power10 specific.
373480093f4SDimitry Andric  list<SubtargetFeature> FutureAdditionalFeatures = [];
374480093f4SDimitry Andric  list<SubtargetFeature> FutureSpecificFeatures = [];
375480093f4SDimitry Andric  list<SubtargetFeature> FutureInheritableFeatures =
3765ffd83dbSDimitry Andric    !listconcat(P10InheritableFeatures, FutureAdditionalFeatures);
377480093f4SDimitry Andric  list<SubtargetFeature> FutureFeatures =
378480093f4SDimitry Andric    !listconcat(FutureInheritableFeatures, FutureSpecificFeatures);
3790b57cec5SDimitry Andric}
3800b57cec5SDimitry Andric
3810b57cec5SDimitry Andric// Note: Future features to add when support is extended to more
3820b57cec5SDimitry Andric// recent ISA levels:
3830b57cec5SDimitry Andric//
3840b57cec5SDimitry Andric// DFP          p6, p6x, p7        decimal floating-point instructions
3850b57cec5SDimitry Andric// POPCNTB      p5 through p7      popcntb and related instructions
3860b57cec5SDimitry Andric
3870b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
3880b57cec5SDimitry Andric// Classes used for relation maps.
3890b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
3900b57cec5SDimitry Andric// RecFormRel - Filter class used to relate non-record-form instructions with
3910b57cec5SDimitry Andric// their record-form variants.
3920b57cec5SDimitry Andricclass RecFormRel;
3930b57cec5SDimitry Andric
3940b57cec5SDimitry Andric// AltVSXFMARel - Filter class used to relate the primary addend-killing VSX
3950b57cec5SDimitry Andric// FMA instruction forms with their corresponding factor-killing forms.
3960b57cec5SDimitry Andricclass AltVSXFMARel {
3970b57cec5SDimitry Andric  bit IsVSXFMAAlt = 0;
3980b57cec5SDimitry Andric}
3990b57cec5SDimitry Andric
4000b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
4010b57cec5SDimitry Andric// Relation Map Definitions.
4020b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
4030b57cec5SDimitry Andric
4040b57cec5SDimitry Andricdef getRecordFormOpcode : InstrMapping {
4050b57cec5SDimitry Andric  let FilterClass = "RecFormRel";
4060b57cec5SDimitry Andric  // Instructions with the same BaseName and Interpretation64Bit values
4070b57cec5SDimitry Andric  // form a row.
4080b57cec5SDimitry Andric  let RowFields = ["BaseName", "Interpretation64Bit"];
4090b57cec5SDimitry Andric  // Instructions with the same RC value form a column.
4100b57cec5SDimitry Andric  let ColFields = ["RC"];
4110b57cec5SDimitry Andric  // The key column are the non-record-form instructions.
4120b57cec5SDimitry Andric  let KeyCol = ["0"];
4130b57cec5SDimitry Andric  // Value columns RC=1
4140b57cec5SDimitry Andric  let ValueCols = [["1"]];
4150b57cec5SDimitry Andric}
4160b57cec5SDimitry Andric
4170b57cec5SDimitry Andricdef getNonRecordFormOpcode : InstrMapping {
4180b57cec5SDimitry Andric  let FilterClass = "RecFormRel";
4190b57cec5SDimitry Andric  // Instructions with the same BaseName and Interpretation64Bit values
4200b57cec5SDimitry Andric  // form a row.
4210b57cec5SDimitry Andric  let RowFields = ["BaseName", "Interpretation64Bit"];
4220b57cec5SDimitry Andric  // Instructions with the same RC value form a column.
4230b57cec5SDimitry Andric  let ColFields = ["RC"];
4240b57cec5SDimitry Andric  // The key column are the record-form instructions.
4250b57cec5SDimitry Andric  let KeyCol = ["1"];
4260b57cec5SDimitry Andric  // Value columns are RC=0
4270b57cec5SDimitry Andric  let ValueCols = [["0"]];
4280b57cec5SDimitry Andric}
4290b57cec5SDimitry Andric
4300b57cec5SDimitry Andricdef getAltVSXFMAOpcode : InstrMapping {
4310b57cec5SDimitry Andric  let FilterClass = "AltVSXFMARel";
4320b57cec5SDimitry Andric  // Instructions with the same BaseName value form a row.
4330b57cec5SDimitry Andric  let RowFields = ["BaseName"];
4340b57cec5SDimitry Andric  // Instructions with the same IsVSXFMAAlt value form a column.
4350b57cec5SDimitry Andric  let ColFields = ["IsVSXFMAAlt"];
4360b57cec5SDimitry Andric  // The key column are the (default) addend-killing instructions.
4370b57cec5SDimitry Andric  let KeyCol = ["0"];
4380b57cec5SDimitry Andric  // Value columns IsVSXFMAAlt=1
4390b57cec5SDimitry Andric  let ValueCols = [["1"]];
4400b57cec5SDimitry Andric}
4410b57cec5SDimitry Andric
4420b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
4430b57cec5SDimitry Andric// Register File Description
4440b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
4450b57cec5SDimitry Andric
4460b57cec5SDimitry Andricinclude "PPCRegisterInfo.td"
4470b57cec5SDimitry Andricinclude "PPCSchedule.td"
448*e8d8bef9SDimitry Andricinclude "GISel/PPCRegisterBanks.td"
4490b57cec5SDimitry Andric
4500b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
4510b57cec5SDimitry Andric// PowerPC processors supported.
4520b57cec5SDimitry Andric//
4530b57cec5SDimitry Andric
4540b57cec5SDimitry Andricdef : Processor<"generic", G3Itineraries, [Directive32, FeatureHardFloat,
4550b57cec5SDimitry Andric                                           FeatureMFTB]>;
4560b57cec5SDimitry Andricdef : ProcessorModel<"440", PPC440Model, [Directive440, FeatureISEL,
4570b57cec5SDimitry Andric                                          FeatureFRES, FeatureFRSQRTE,
4580b57cec5SDimitry Andric                                          FeatureICBT, FeatureBookE,
4590b57cec5SDimitry Andric                                          FeatureMSYNC, FeatureMFTB]>;
4600b57cec5SDimitry Andricdef : ProcessorModel<"450", PPC440Model, [Directive440, FeatureISEL,
4610b57cec5SDimitry Andric                                          FeatureFRES, FeatureFRSQRTE,
4620b57cec5SDimitry Andric                                          FeatureICBT, FeatureBookE,
4630b57cec5SDimitry Andric                                          FeatureMSYNC, FeatureMFTB]>;
4640b57cec5SDimitry Andricdef : Processor<"601", G3Itineraries, [Directive601, FeatureFPU]>;
4650b57cec5SDimitry Andricdef : Processor<"602", G3Itineraries, [Directive602, FeatureFPU,
4660b57cec5SDimitry Andric                                       FeatureMFTB]>;
4670b57cec5SDimitry Andricdef : Processor<"603", G3Itineraries, [Directive603,
4680b57cec5SDimitry Andric                                       FeatureFRES, FeatureFRSQRTE,
4690b57cec5SDimitry Andric                                       FeatureMFTB]>;
4700b57cec5SDimitry Andricdef : Processor<"603e", G3Itineraries, [Directive603,
4710b57cec5SDimitry Andric                                        FeatureFRES, FeatureFRSQRTE,
4720b57cec5SDimitry Andric                                        FeatureMFTB]>;
4730b57cec5SDimitry Andricdef : Processor<"603ev", G3Itineraries, [Directive603,
4740b57cec5SDimitry Andric                                         FeatureFRES, FeatureFRSQRTE,
4750b57cec5SDimitry Andric                                         FeatureMFTB]>;
4760b57cec5SDimitry Andricdef : Processor<"604", G3Itineraries, [Directive604,
4770b57cec5SDimitry Andric                                       FeatureFRES, FeatureFRSQRTE,
4780b57cec5SDimitry Andric                                       FeatureMFTB]>;
4790b57cec5SDimitry Andricdef : Processor<"604e", G3Itineraries, [Directive604,
4800b57cec5SDimitry Andric                                        FeatureFRES, FeatureFRSQRTE,
4810b57cec5SDimitry Andric                                        FeatureMFTB]>;
4820b57cec5SDimitry Andricdef : Processor<"620", G3Itineraries, [Directive620,
4830b57cec5SDimitry Andric                                       FeatureFRES, FeatureFRSQRTE,
4840b57cec5SDimitry Andric                                       FeatureMFTB]>;
4850b57cec5SDimitry Andricdef : Processor<"750", G4Itineraries, [Directive750,
4860b57cec5SDimitry Andric                                       FeatureFRES, FeatureFRSQRTE,
4870b57cec5SDimitry Andric                                       FeatureMFTB]>;
4880b57cec5SDimitry Andricdef : Processor<"g3", G3Itineraries, [Directive750,
4890b57cec5SDimitry Andric                                      FeatureFRES, FeatureFRSQRTE,
4900b57cec5SDimitry Andric                                      FeatureMFTB]>;
4910b57cec5SDimitry Andricdef : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec,
4920b57cec5SDimitry Andric                                        FeatureFRES, FeatureFRSQRTE,
4930b57cec5SDimitry Andric                                        FeatureMFTB]>;
4940b57cec5SDimitry Andricdef : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec,
4950b57cec5SDimitry Andric                                      FeatureFRES, FeatureFRSQRTE,
4960b57cec5SDimitry Andric                                      FeatureMFTB]>;
4970b57cec5SDimitry Andricdef : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec,
4980b57cec5SDimitry Andric                                            FeatureFRES, FeatureFRSQRTE,
4990b57cec5SDimitry Andric                                            FeatureMFTB]>;
5000b57cec5SDimitry Andricdef : Processor<"g4+", G4PlusItineraries, [Directive7400, FeatureAltivec,
5010b57cec5SDimitry Andric                                           FeatureFRES, FeatureFRSQRTE,
5020b57cec5SDimitry Andric                                           FeatureMFTB]>;
5030b57cec5SDimitry Andric
5040b57cec5SDimitry Andricdef : ProcessorModel<"970", G5Model,
5050b57cec5SDimitry Andric                  [Directive970, FeatureAltivec,
5060b57cec5SDimitry Andric                   FeatureMFOCRF, FeatureFSqrt,
5070b57cec5SDimitry Andric                   FeatureFRES, FeatureFRSQRTE, FeatureSTFIWX,
5080b57cec5SDimitry Andric                   Feature64Bit /*, Feature64BitRegs */,
5090b57cec5SDimitry Andric                   FeatureMFTB]>;
5100b57cec5SDimitry Andricdef : ProcessorModel<"g5", G5Model,
5110b57cec5SDimitry Andric                  [Directive970, FeatureAltivec,
5120b57cec5SDimitry Andric                   FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
5130b57cec5SDimitry Andric                   FeatureFRES, FeatureFRSQRTE,
5140b57cec5SDimitry Andric                   Feature64Bit /*, Feature64BitRegs */,
5150b57cec5SDimitry Andric                   FeatureMFTB, DeprecatedDST]>;
5160b57cec5SDimitry Andricdef : ProcessorModel<"e500", PPCE500Model,
5170b57cec5SDimitry Andric                  [DirectiveE500,
5180b57cec5SDimitry Andric                   FeatureICBT, FeatureBookE,
5195b5f869eSDimitry Andric                   FeatureISEL, FeatureMFTB, FeatureMSYNC, FeatureSPE]>;
5200b57cec5SDimitry Andricdef : ProcessorModel<"e500mc", PPCE500mcModel,
5210b57cec5SDimitry Andric                  [DirectiveE500mc,
5220b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureICBT, FeatureBookE,
5230b57cec5SDimitry Andric                   FeatureISEL, FeatureMFTB]>;
5240b57cec5SDimitry Andricdef : ProcessorModel<"e5500", PPCE5500Model,
5250b57cec5SDimitry Andric                  [DirectiveE5500, FeatureMFOCRF, Feature64Bit,
5260b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureICBT, FeatureBookE,
5270b57cec5SDimitry Andric                   FeatureISEL, FeatureMFTB]>;
5280b57cec5SDimitry Andricdef : ProcessorModel<"a2", PPCA2Model,
5290b57cec5SDimitry Andric                  [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF,
5300b57cec5SDimitry Andric                   FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
5310b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
5320b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureLFIWAX,
5330b57cec5SDimitry Andric                   FeatureFPRND, FeatureFPCVT, FeatureISEL,
5340b57cec5SDimitry Andric                   FeatureSlowPOPCNTD, FeatureCMPB, FeatureLDBRX,
5350b57cec5SDimitry Andric                   Feature64Bit /*, Feature64BitRegs */, FeatureMFTB]>;
5360b57cec5SDimitry Andricdef : ProcessorModel<"pwr3", G5Model,
5370b57cec5SDimitry Andric                  [DirectivePwr3, FeatureAltivec,
5380b57cec5SDimitry Andric                   FeatureFRES, FeatureFRSQRTE, FeatureMFOCRF,
5390b57cec5SDimitry Andric                   FeatureSTFIWX, Feature64Bit]>;
5400b57cec5SDimitry Andricdef : ProcessorModel<"pwr4", G5Model,
5410b57cec5SDimitry Andric                  [DirectivePwr4, FeatureAltivec, FeatureMFOCRF,
5420b57cec5SDimitry Andric                   FeatureFSqrt, FeatureFRES, FeatureFRSQRTE,
5430b57cec5SDimitry Andric                   FeatureSTFIWX, Feature64Bit, FeatureMFTB]>;
5440b57cec5SDimitry Andricdef : ProcessorModel<"pwr5", G5Model,
5450b57cec5SDimitry Andric                  [DirectivePwr5, FeatureAltivec, FeatureMFOCRF,
5460b57cec5SDimitry Andric                   FeatureFSqrt, FeatureFRE, FeatureFRES,
5470b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureFRSQRTES,
5480b57cec5SDimitry Andric                   FeatureSTFIWX, Feature64Bit,
5490b57cec5SDimitry Andric                   FeatureMFTB, DeprecatedDST]>;
5500b57cec5SDimitry Andricdef : ProcessorModel<"pwr5x", G5Model,
5510b57cec5SDimitry Andric                  [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
5520b57cec5SDimitry Andric                   FeatureFSqrt, FeatureFRE, FeatureFRES,
5530b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureFRSQRTES,
5540b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureFPRND, Feature64Bit,
5550b57cec5SDimitry Andric                   FeatureMFTB, DeprecatedDST]>;
5560b57cec5SDimitry Andricdef : ProcessorModel<"pwr6", G5Model,
5570b57cec5SDimitry Andric                  [DirectivePwr6, FeatureAltivec,
5580b57cec5SDimitry Andric                   FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE,
5590b57cec5SDimitry Andric                   FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
5600b57cec5SDimitry Andric                   FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
5610b57cec5SDimitry Andric                   FeatureFPRND, Feature64Bit /*, Feature64BitRegs */,
5620b57cec5SDimitry Andric                   FeatureMFTB, DeprecatedDST]>;
5630b57cec5SDimitry Andricdef : ProcessorModel<"pwr6x", G5Model,
5640b57cec5SDimitry Andric                  [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
5650b57cec5SDimitry Andric                   FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
5660b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
5670b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
5680b57cec5SDimitry Andric                   FeatureFPRND, Feature64Bit,
5690b57cec5SDimitry Andric                   FeatureMFTB, DeprecatedDST]>;
570480093f4SDimitry Andricdef : ProcessorModel<"pwr7", P7Model, ProcessorFeatures.P7Features>;
571480093f4SDimitry Andricdef : ProcessorModel<"pwr8", P8Model, ProcessorFeatures.P8Features>;
572480093f4SDimitry Andricdef : ProcessorModel<"pwr9", P9Model, ProcessorFeatures.P9Features>;
5735ffd83dbSDimitry Andric// No scheduler model yet.
574*e8d8bef9SDimitry Andricdef : ProcessorModel<"pwr10", P9Model, ProcessorFeatures.P10Features>;
575480093f4SDimitry Andric// No scheduler model for future CPU.
576480093f4SDimitry Andricdef : ProcessorModel<"future", NoSchedModel,
577480093f4SDimitry Andric                  ProcessorFeatures.FutureFeatures>;
5780b57cec5SDimitry Andricdef : Processor<"ppc", G3Itineraries, [Directive32, FeatureHardFloat,
5790b57cec5SDimitry Andric                                       FeatureMFTB]>;
5800b57cec5SDimitry Andricdef : Processor<"ppc32", G3Itineraries, [Directive32, FeatureHardFloat,
5810b57cec5SDimitry Andric                                         FeatureMFTB]>;
5820b57cec5SDimitry Andricdef : ProcessorModel<"ppc64", G5Model,
5830b57cec5SDimitry Andric                  [Directive64, FeatureAltivec,
5840b57cec5SDimitry Andric                   FeatureMFOCRF, FeatureFSqrt, FeatureFRES,
5850b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureSTFIWX,
5860b57cec5SDimitry Andric                   Feature64Bit /*, Feature64BitRegs */,
5870b57cec5SDimitry Andric                   FeatureMFTB]>;
588480093f4SDimitry Andricdef : ProcessorModel<"ppc64le", P8Model, ProcessorFeatures.P8Features>;
5890b57cec5SDimitry Andric
5900b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
5910b57cec5SDimitry Andric// Calling Conventions
5920b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
5930b57cec5SDimitry Andric
5940b57cec5SDimitry Andricinclude "PPCCallingConv.td"
5950b57cec5SDimitry Andric
5960b57cec5SDimitry Andricdef PPCInstrInfo : InstrInfo {
5970b57cec5SDimitry Andric  let isLittleEndianEncoding = 1;
5980b57cec5SDimitry Andric
5990b57cec5SDimitry Andric  // FIXME: Unset this when no longer needed!
6000b57cec5SDimitry Andric  let decodePositionallyEncodedOperands = 1;
6010b57cec5SDimitry Andric
6020b57cec5SDimitry Andric  let noNamedPositionallyEncodedOperands = 1;
6030b57cec5SDimitry Andric}
6040b57cec5SDimitry Andric
605*e8d8bef9SDimitry Andricdef PPCAsmWriter : AsmWriter {
606*e8d8bef9SDimitry Andric  string AsmWriterClassName  = "InstPrinter";
607*e8d8bef9SDimitry Andric  int PassSubtarget = 1;
608*e8d8bef9SDimitry Andric  int Variant = 0;
609*e8d8bef9SDimitry Andric  bit isMCAsmWriter = 1;
610*e8d8bef9SDimitry Andric}
611*e8d8bef9SDimitry Andric
6120b57cec5SDimitry Andricdef PPCAsmParser : AsmParser {
6130b57cec5SDimitry Andric  let ShouldEmitMatchRegisterName = 0;
6140b57cec5SDimitry Andric}
6150b57cec5SDimitry Andric
6160b57cec5SDimitry Andricdef PPCAsmParserVariant : AsmParserVariant {
6170b57cec5SDimitry Andric  int Variant = 0;
6180b57cec5SDimitry Andric
6190b57cec5SDimitry Andric  // We do not use hard coded registers in asm strings.  However, some
6200b57cec5SDimitry Andric  // InstAlias definitions use immediate literals.  Set RegisterPrefix
6210b57cec5SDimitry Andric  // so that those are not misinterpreted as registers.
6220b57cec5SDimitry Andric  string RegisterPrefix = "%";
6230b57cec5SDimitry Andric  string BreakCharacters = ".";
6240b57cec5SDimitry Andric}
6250b57cec5SDimitry Andric
6260b57cec5SDimitry Andricdef PPC : Target {
6270b57cec5SDimitry Andric  // Information about the instructions.
6280b57cec5SDimitry Andric  let InstructionSet = PPCInstrInfo;
6290b57cec5SDimitry Andric
630*e8d8bef9SDimitry Andric  let AssemblyWriters = [PPCAsmWriter];
6310b57cec5SDimitry Andric  let AssemblyParsers = [PPCAsmParser];
6320b57cec5SDimitry Andric  let AssemblyParserVariants = [PPCAsmParserVariant];
6330b57cec5SDimitry Andric  let AllowRegisterRenaming = 1;
6340b57cec5SDimitry Andric}
6350b57cec5SDimitry Andric
6360b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
6370b57cec5SDimitry Andric// Pfm Counters
6380b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
6390b57cec5SDimitry Andric
6400b57cec5SDimitry Andricinclude "PPCPfmCounters.td"
641