xref: /freebsd/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.td (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric//===-- PPC.td - Describe the PowerPC Target Machine -------*- tablegen -*-===//
2*0b57cec5SDimitry Andric//
3*0b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric//
7*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric//
9*0b57cec5SDimitry Andric// This is the top level entry point for the PowerPC target.
10*0b57cec5SDimitry Andric//
11*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
12*0b57cec5SDimitry Andric
13*0b57cec5SDimitry Andric// Get the target-independent interfaces which we are implementing.
14*0b57cec5SDimitry Andric//
15*0b57cec5SDimitry Andricinclude "llvm/Target/Target.td"
16*0b57cec5SDimitry Andric
17*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
18*0b57cec5SDimitry Andric// PowerPC Subtarget features.
19*0b57cec5SDimitry Andric//
20*0b57cec5SDimitry Andric
21*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
22*0b57cec5SDimitry Andric// CPU Directives                                                             //
23*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
24*0b57cec5SDimitry Andric
25*0b57cec5SDimitry Andricdef Directive440 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_440", "">;
26*0b57cec5SDimitry Andricdef Directive601 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_601", "">;
27*0b57cec5SDimitry Andricdef Directive602 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_602", "">;
28*0b57cec5SDimitry Andricdef Directive603 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">;
29*0b57cec5SDimitry Andricdef Directive604 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">;
30*0b57cec5SDimitry Andricdef Directive620 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">;
31*0b57cec5SDimitry Andricdef Directive7400: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_7400", "">;
32*0b57cec5SDimitry Andricdef Directive750 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_750", "">;
33*0b57cec5SDimitry Andricdef Directive970 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_970", "">;
34*0b57cec5SDimitry Andricdef Directive32  : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_32", "">;
35*0b57cec5SDimitry Andricdef Directive64  : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_64", "">;
36*0b57cec5SDimitry Andricdef DirectiveA2  : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_A2", "">;
37*0b57cec5SDimitry Andricdef DirectiveE500   : SubtargetFeature<"", "DarwinDirective",
38*0b57cec5SDimitry Andric                                       "PPC::DIR_E500", "">;
39*0b57cec5SDimitry Andricdef DirectiveE500mc : SubtargetFeature<"", "DarwinDirective",
40*0b57cec5SDimitry Andric                                       "PPC::DIR_E500mc", "">;
41*0b57cec5SDimitry Andricdef DirectiveE5500  : SubtargetFeature<"", "DarwinDirective",
42*0b57cec5SDimitry Andric                                       "PPC::DIR_E5500", "">;
43*0b57cec5SDimitry Andricdef DirectivePwr3: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR3", "">;
44*0b57cec5SDimitry Andricdef DirectivePwr4: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR4", "">;
45*0b57cec5SDimitry Andricdef DirectivePwr5: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR5", "">;
46*0b57cec5SDimitry Andricdef DirectivePwr5x
47*0b57cec5SDimitry Andric    : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR5X", "">;
48*0b57cec5SDimitry Andricdef DirectivePwr6: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6", "">;
49*0b57cec5SDimitry Andricdef DirectivePwr6x
50*0b57cec5SDimitry Andric    : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6X", "">;
51*0b57cec5SDimitry Andricdef DirectivePwr7: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR7", "">;
52*0b57cec5SDimitry Andricdef DirectivePwr8: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR8", "">;
53*0b57cec5SDimitry Andricdef DirectivePwr9: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR9", "">;
54*0b57cec5SDimitry Andric
55*0b57cec5SDimitry Andricdef Feature64Bit     : SubtargetFeature<"64bit","Has64BitSupport", "true",
56*0b57cec5SDimitry Andric                                        "Enable 64-bit instructions">;
57*0b57cec5SDimitry Andricdef FeatureHardFloat : SubtargetFeature<"hard-float", "HasHardFloat", "true",
58*0b57cec5SDimitry Andric                              "Enable floating-point instructions">;
59*0b57cec5SDimitry Andricdef Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true",
60*0b57cec5SDimitry Andric                              "Enable 64-bit registers usage for ppc32 [beta]">;
61*0b57cec5SDimitry Andricdef FeatureCRBits    : SubtargetFeature<"crbits", "UseCRBits", "true",
62*0b57cec5SDimitry Andric                              "Use condition-register bits individually">;
63*0b57cec5SDimitry Andricdef FeatureFPU       : SubtargetFeature<"fpu","HasFPU","true",
64*0b57cec5SDimitry Andric                                        "Enable classic FPU instructions",
65*0b57cec5SDimitry Andric                                        [FeatureHardFloat]>;
66*0b57cec5SDimitry Andricdef FeatureAltivec   : SubtargetFeature<"altivec","HasAltivec", "true",
67*0b57cec5SDimitry Andric                                        "Enable Altivec instructions",
68*0b57cec5SDimitry Andric                                        [FeatureFPU]>;
69*0b57cec5SDimitry Andricdef FeatureSPE       : SubtargetFeature<"spe","HasSPE", "true",
70*0b57cec5SDimitry Andric                                        "Enable SPE instructions",
71*0b57cec5SDimitry Andric                                        [FeatureHardFloat]>;
72*0b57cec5SDimitry Andricdef FeatureMFOCRF    : SubtargetFeature<"mfocrf","HasMFOCRF", "true",
73*0b57cec5SDimitry Andric                                        "Enable the MFOCRF instruction">;
74*0b57cec5SDimitry Andricdef FeatureFSqrt     : SubtargetFeature<"fsqrt","HasFSQRT", "true",
75*0b57cec5SDimitry Andric                                        "Enable the fsqrt instruction",
76*0b57cec5SDimitry Andric                                        [FeatureFPU]>;
77*0b57cec5SDimitry Andricdef FeatureFCPSGN    : SubtargetFeature<"fcpsgn", "HasFCPSGN", "true",
78*0b57cec5SDimitry Andric                                        "Enable the fcpsgn instruction",
79*0b57cec5SDimitry Andric                                        [FeatureFPU]>;
80*0b57cec5SDimitry Andricdef FeatureFRE       : SubtargetFeature<"fre", "HasFRE", "true",
81*0b57cec5SDimitry Andric                                        "Enable the fre instruction",
82*0b57cec5SDimitry Andric                                        [FeatureFPU]>;
83*0b57cec5SDimitry Andricdef FeatureFRES      : SubtargetFeature<"fres", "HasFRES", "true",
84*0b57cec5SDimitry Andric                                        "Enable the fres instruction",
85*0b57cec5SDimitry Andric                                        [FeatureFPU]>;
86*0b57cec5SDimitry Andricdef FeatureFRSQRTE   : SubtargetFeature<"frsqrte", "HasFRSQRTE", "true",
87*0b57cec5SDimitry Andric                                        "Enable the frsqrte instruction",
88*0b57cec5SDimitry Andric                                        [FeatureFPU]>;
89*0b57cec5SDimitry Andricdef FeatureFRSQRTES  : SubtargetFeature<"frsqrtes", "HasFRSQRTES", "true",
90*0b57cec5SDimitry Andric                                        "Enable the frsqrtes instruction",
91*0b57cec5SDimitry Andric                                        [FeatureFPU]>;
92*0b57cec5SDimitry Andricdef FeatureRecipPrec : SubtargetFeature<"recipprec", "HasRecipPrec", "true",
93*0b57cec5SDimitry Andric                              "Assume higher precision reciprocal estimates">;
94*0b57cec5SDimitry Andricdef FeatureSTFIWX    : SubtargetFeature<"stfiwx","HasSTFIWX", "true",
95*0b57cec5SDimitry Andric                                        "Enable the stfiwx instruction",
96*0b57cec5SDimitry Andric                                        [FeatureFPU]>;
97*0b57cec5SDimitry Andricdef FeatureLFIWAX    : SubtargetFeature<"lfiwax","HasLFIWAX", "true",
98*0b57cec5SDimitry Andric                                        "Enable the lfiwax instruction",
99*0b57cec5SDimitry Andric                                        [FeatureFPU]>;
100*0b57cec5SDimitry Andricdef FeatureFPRND     : SubtargetFeature<"fprnd", "HasFPRND", "true",
101*0b57cec5SDimitry Andric                                        "Enable the fri[mnpz] instructions",
102*0b57cec5SDimitry Andric                                        [FeatureFPU]>;
103*0b57cec5SDimitry Andricdef FeatureFPCVT     : SubtargetFeature<"fpcvt", "HasFPCVT", "true",
104*0b57cec5SDimitry Andric  "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions",
105*0b57cec5SDimitry Andric                                        [FeatureFPU]>;
106*0b57cec5SDimitry Andricdef FeatureISEL      : SubtargetFeature<"isel","HasISEL", "true",
107*0b57cec5SDimitry Andric                                        "Enable the isel instruction">;
108*0b57cec5SDimitry Andricdef FeatureBPERMD    : SubtargetFeature<"bpermd", "HasBPERMD", "true",
109*0b57cec5SDimitry Andric                                        "Enable the bpermd instruction">;
110*0b57cec5SDimitry Andricdef FeatureExtDiv    : SubtargetFeature<"extdiv", "HasExtDiv", "true",
111*0b57cec5SDimitry Andric                                        "Enable extended divide instructions">;
112*0b57cec5SDimitry Andricdef FeatureLDBRX     : SubtargetFeature<"ldbrx","HasLDBRX", "true",
113*0b57cec5SDimitry Andric                                        "Enable the ldbrx instruction">;
114*0b57cec5SDimitry Andricdef FeatureCMPB      : SubtargetFeature<"cmpb", "HasCMPB", "true",
115*0b57cec5SDimitry Andric                                        "Enable the cmpb instruction">;
116*0b57cec5SDimitry Andricdef FeatureICBT      : SubtargetFeature<"icbt","HasICBT", "true",
117*0b57cec5SDimitry Andric                                        "Enable icbt instruction">;
118*0b57cec5SDimitry Andricdef FeatureBookE     : SubtargetFeature<"booke", "IsBookE", "true",
119*0b57cec5SDimitry Andric                                        "Enable Book E instructions",
120*0b57cec5SDimitry Andric                                        [FeatureICBT]>;
121*0b57cec5SDimitry Andricdef FeatureMSYNC     : SubtargetFeature<"msync", "HasOnlyMSYNC", "true",
122*0b57cec5SDimitry Andric                              "Has only the msync instruction instead of sync",
123*0b57cec5SDimitry Andric                              [FeatureBookE]>;
124*0b57cec5SDimitry Andricdef FeatureE500      : SubtargetFeature<"e500", "IsE500", "true",
125*0b57cec5SDimitry Andric                                        "Enable E500/E500mc instructions">;
126*0b57cec5SDimitry Andricdef FeatureSecurePlt : SubtargetFeature<"secure-plt","SecurePlt", "true",
127*0b57cec5SDimitry Andric                                        "Enable secure plt mode">;
128*0b57cec5SDimitry Andricdef FeaturePPC4xx    : SubtargetFeature<"ppc4xx", "IsPPC4xx", "true",
129*0b57cec5SDimitry Andric                                        "Enable PPC 4xx instructions">;
130*0b57cec5SDimitry Andricdef FeaturePPC6xx    : SubtargetFeature<"ppc6xx", "IsPPC6xx", "true",
131*0b57cec5SDimitry Andric                                        "Enable PPC 6xx instructions">;
132*0b57cec5SDimitry Andricdef FeatureQPX       : SubtargetFeature<"qpx","HasQPX", "true",
133*0b57cec5SDimitry Andric                                        "Enable QPX instructions",
134*0b57cec5SDimitry Andric                                        [FeatureFPU]>;
135*0b57cec5SDimitry Andricdef FeatureVSX       : SubtargetFeature<"vsx","HasVSX", "true",
136*0b57cec5SDimitry Andric                                        "Enable VSX instructions",
137*0b57cec5SDimitry Andric                                        [FeatureAltivec]>;
138*0b57cec5SDimitry Andricdef FeatureTwoConstNR :
139*0b57cec5SDimitry Andric  SubtargetFeature<"two-const-nr", "NeedsTwoConstNR", "true",
140*0b57cec5SDimitry Andric                   "Requires two constant Newton-Raphson computation">;
141*0b57cec5SDimitry Andricdef FeatureP8Altivec : SubtargetFeature<"power8-altivec", "HasP8Altivec", "true",
142*0b57cec5SDimitry Andric                                        "Enable POWER8 Altivec instructions",
143*0b57cec5SDimitry Andric                                        [FeatureAltivec]>;
144*0b57cec5SDimitry Andricdef FeatureP8Crypto : SubtargetFeature<"crypto", "HasP8Crypto", "true",
145*0b57cec5SDimitry Andric                                       "Enable POWER8 Crypto instructions",
146*0b57cec5SDimitry Andric                                       [FeatureP8Altivec]>;
147*0b57cec5SDimitry Andricdef FeatureP8Vector  : SubtargetFeature<"power8-vector", "HasP8Vector", "true",
148*0b57cec5SDimitry Andric                                        "Enable POWER8 vector instructions",
149*0b57cec5SDimitry Andric                                        [FeatureVSX, FeatureP8Altivec]>;
150*0b57cec5SDimitry Andricdef FeatureDirectMove :
151*0b57cec5SDimitry Andric  SubtargetFeature<"direct-move", "HasDirectMove", "true",
152*0b57cec5SDimitry Andric                   "Enable Power8 direct move instructions",
153*0b57cec5SDimitry Andric                   [FeatureVSX]>;
154*0b57cec5SDimitry Andricdef FeaturePartwordAtomic : SubtargetFeature<"partword-atomics",
155*0b57cec5SDimitry Andric                                             "HasPartwordAtomics", "true",
156*0b57cec5SDimitry Andric                                             "Enable l[bh]arx and st[bh]cx.">;
157*0b57cec5SDimitry Andricdef FeatureInvariantFunctionDescriptors :
158*0b57cec5SDimitry Andric  SubtargetFeature<"invariant-function-descriptors",
159*0b57cec5SDimitry Andric                   "HasInvariantFunctionDescriptors", "true",
160*0b57cec5SDimitry Andric                   "Assume function descriptors are invariant">;
161*0b57cec5SDimitry Andricdef FeatureLongCall : SubtargetFeature<"longcall", "UseLongCalls", "true",
162*0b57cec5SDimitry Andric                                       "Always use indirect calls">;
163*0b57cec5SDimitry Andricdef FeatureHTM : SubtargetFeature<"htm", "HasHTM", "true",
164*0b57cec5SDimitry Andric                                  "Enable Hardware Transactional Memory instructions">;
165*0b57cec5SDimitry Andricdef FeatureMFTB   : SubtargetFeature<"", "FeatureMFTB", "true",
166*0b57cec5SDimitry Andric                                        "Implement mftb using the mfspr instruction">;
167*0b57cec5SDimitry Andricdef FeaturePPCPreRASched:
168*0b57cec5SDimitry Andric  SubtargetFeature<"ppc-prera-sched", "UsePPCPreRASchedStrategy", "true",
169*0b57cec5SDimitry Andric                   "Use PowerPC pre-RA scheduling strategy">;
170*0b57cec5SDimitry Andricdef FeaturePPCPostRASched:
171*0b57cec5SDimitry Andric  SubtargetFeature<"ppc-postra-sched", "UsePPCPostRASchedStrategy", "true",
172*0b57cec5SDimitry Andric                   "Use PowerPC post-RA scheduling strategy">;
173*0b57cec5SDimitry Andricdef FeatureFloat128 :
174*0b57cec5SDimitry Andric  SubtargetFeature<"float128", "HasFloat128", "true",
175*0b57cec5SDimitry Andric                   "Enable the __float128 data type for IEEE-754R Binary128.",
176*0b57cec5SDimitry Andric                   [FeatureVSX]>;
177*0b57cec5SDimitry Andricdef FeaturePOPCNTD   : SubtargetFeature<"popcntd","HasPOPCNTD",
178*0b57cec5SDimitry Andric                                        "POPCNTD_Fast",
179*0b57cec5SDimitry Andric                                        "Enable the popcnt[dw] instructions">;
180*0b57cec5SDimitry Andric// Note that for the a2/a2q processor models we should not use popcnt[dw] by
181*0b57cec5SDimitry Andric// default. These processors do support the instructions, but they're
182*0b57cec5SDimitry Andric// microcoded, and the software emulation is about twice as fast.
183*0b57cec5SDimitry Andricdef FeatureSlowPOPCNTD : SubtargetFeature<"slow-popcntd","HasPOPCNTD",
184*0b57cec5SDimitry Andric                                          "POPCNTD_Slow",
185*0b57cec5SDimitry Andric                                          "Has slow popcnt[dw] instructions">;
186*0b57cec5SDimitry Andric
187*0b57cec5SDimitry Andricdef DeprecatedDST    : SubtargetFeature<"", "DeprecatedDST", "true",
188*0b57cec5SDimitry Andric  "Treat vector data stream cache control instructions as deprecated">;
189*0b57cec5SDimitry Andric
190*0b57cec5SDimitry Andricdef FeatureISA3_0 : SubtargetFeature<"isa-v30-instructions", "IsISA3_0",
191*0b57cec5SDimitry Andric                                     "true",
192*0b57cec5SDimitry Andric                                     "Enable instructions added in ISA 3.0.">;
193*0b57cec5SDimitry Andricdef FeatureP9Altivec : SubtargetFeature<"power9-altivec", "HasP9Altivec", "true",
194*0b57cec5SDimitry Andric                                        "Enable POWER9 Altivec instructions",
195*0b57cec5SDimitry Andric                                        [FeatureISA3_0, FeatureP8Altivec]>;
196*0b57cec5SDimitry Andricdef FeatureP9Vector  : SubtargetFeature<"power9-vector", "HasP9Vector", "true",
197*0b57cec5SDimitry Andric                                        "Enable POWER9 vector instructions",
198*0b57cec5SDimitry Andric                                        [FeatureISA3_0, FeatureP8Vector,
199*0b57cec5SDimitry Andric                                         FeatureP9Altivec]>;
200*0b57cec5SDimitry Andric// A separate feature for this even though it is equivalent to P9Vector
201*0b57cec5SDimitry Andric// because this is a feature of the implementation rather than the architecture
202*0b57cec5SDimitry Andric// and may go away with future CPU's.
203*0b57cec5SDimitry Andricdef FeatureVectorsUseTwoUnits : SubtargetFeature<"vectors-use-two-units",
204*0b57cec5SDimitry Andric                                                 "VectorsUseTwoUnits",
205*0b57cec5SDimitry Andric                                                 "true",
206*0b57cec5SDimitry Andric                                                 "Vectors use two units">;
207*0b57cec5SDimitry Andric
208*0b57cec5SDimitry Andric// Since new processors generally contain a superset of features of those that
209*0b57cec5SDimitry Andric// came before them, the idea is to make implementations of new processors
210*0b57cec5SDimitry Andric// less error prone and easier to read.
211*0b57cec5SDimitry Andric// Namely:
212*0b57cec5SDimitry Andric//     list<SubtargetFeature> Power8FeatureList = ...
213*0b57cec5SDimitry Andric//     list<SubtargetFeature> FutureProcessorSpecificFeatureList =
214*0b57cec5SDimitry Andric//         [ features that Power8 does not support ]
215*0b57cec5SDimitry Andric//     list<SubtargetFeature> FutureProcessorFeatureList =
216*0b57cec5SDimitry Andric//         !listconcat(Power8FeatureList, FutureProcessorSpecificFeatureList)
217*0b57cec5SDimitry Andric
218*0b57cec5SDimitry Andric// Makes it explicit and obvious what is new in FutureProcesor vs. Power8 as
219*0b57cec5SDimitry Andric// well as providing a single point of definition if the feature set will be
220*0b57cec5SDimitry Andric// used elsewhere.
221*0b57cec5SDimitry Andricdef ProcessorFeatures {
222*0b57cec5SDimitry Andric  list<SubtargetFeature> Power7FeatureList =
223*0b57cec5SDimitry Andric      [DirectivePwr7, FeatureAltivec, FeatureVSX,
224*0b57cec5SDimitry Andric       FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE,
225*0b57cec5SDimitry Andric       FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
226*0b57cec5SDimitry Andric       FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX,
227*0b57cec5SDimitry Andric       FeatureFPRND, FeatureFPCVT, FeatureISEL,
228*0b57cec5SDimitry Andric       FeaturePOPCNTD, FeatureCMPB, FeatureLDBRX,
229*0b57cec5SDimitry Andric       Feature64Bit /*, Feature64BitRegs */,
230*0b57cec5SDimitry Andric       FeatureBPERMD, FeatureExtDiv,
231*0b57cec5SDimitry Andric       FeatureMFTB, DeprecatedDST, FeatureTwoConstNR];
232*0b57cec5SDimitry Andric  list<SubtargetFeature> Power8SpecificFeatures =
233*0b57cec5SDimitry Andric      [DirectivePwr8, FeatureP8Altivec, FeatureP8Vector, FeatureP8Crypto,
234*0b57cec5SDimitry Andric       FeatureHTM, FeatureDirectMove, FeatureICBT, FeaturePartwordAtomic];
235*0b57cec5SDimitry Andric  list<SubtargetFeature> Power8FeatureList =
236*0b57cec5SDimitry Andric      !listconcat(Power7FeatureList, Power8SpecificFeatures);
237*0b57cec5SDimitry Andric  list<SubtargetFeature> Power9SpecificFeatures =
238*0b57cec5SDimitry Andric      [DirectivePwr9, FeatureP9Altivec, FeatureP9Vector, FeatureISA3_0,
239*0b57cec5SDimitry Andric       FeatureVectorsUseTwoUnits, FeaturePPCPreRASched, FeaturePPCPostRASched];
240*0b57cec5SDimitry Andric  list<SubtargetFeature> Power9FeatureList =
241*0b57cec5SDimitry Andric      !listconcat(Power8FeatureList, Power9SpecificFeatures);
242*0b57cec5SDimitry Andric}
243*0b57cec5SDimitry Andric
244*0b57cec5SDimitry Andric// Note: Future features to add when support is extended to more
245*0b57cec5SDimitry Andric// recent ISA levels:
246*0b57cec5SDimitry Andric//
247*0b57cec5SDimitry Andric// DFP          p6, p6x, p7        decimal floating-point instructions
248*0b57cec5SDimitry Andric// POPCNTB      p5 through p7      popcntb and related instructions
249*0b57cec5SDimitry Andric
250*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
251*0b57cec5SDimitry Andric// Classes used for relation maps.
252*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
253*0b57cec5SDimitry Andric// RecFormRel - Filter class used to relate non-record-form instructions with
254*0b57cec5SDimitry Andric// their record-form variants.
255*0b57cec5SDimitry Andricclass RecFormRel;
256*0b57cec5SDimitry Andric
257*0b57cec5SDimitry Andric// AltVSXFMARel - Filter class used to relate the primary addend-killing VSX
258*0b57cec5SDimitry Andric// FMA instruction forms with their corresponding factor-killing forms.
259*0b57cec5SDimitry Andricclass AltVSXFMARel {
260*0b57cec5SDimitry Andric  bit IsVSXFMAAlt = 0;
261*0b57cec5SDimitry Andric}
262*0b57cec5SDimitry Andric
263*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
264*0b57cec5SDimitry Andric// Relation Map Definitions.
265*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
266*0b57cec5SDimitry Andric
267*0b57cec5SDimitry Andricdef getRecordFormOpcode : InstrMapping {
268*0b57cec5SDimitry Andric  let FilterClass = "RecFormRel";
269*0b57cec5SDimitry Andric  // Instructions with the same BaseName and Interpretation64Bit values
270*0b57cec5SDimitry Andric  // form a row.
271*0b57cec5SDimitry Andric  let RowFields = ["BaseName", "Interpretation64Bit"];
272*0b57cec5SDimitry Andric  // Instructions with the same RC value form a column.
273*0b57cec5SDimitry Andric  let ColFields = ["RC"];
274*0b57cec5SDimitry Andric  // The key column are the non-record-form instructions.
275*0b57cec5SDimitry Andric  let KeyCol = ["0"];
276*0b57cec5SDimitry Andric  // Value columns RC=1
277*0b57cec5SDimitry Andric  let ValueCols = [["1"]];
278*0b57cec5SDimitry Andric}
279*0b57cec5SDimitry Andric
280*0b57cec5SDimitry Andricdef getNonRecordFormOpcode : InstrMapping {
281*0b57cec5SDimitry Andric  let FilterClass = "RecFormRel";
282*0b57cec5SDimitry Andric  // Instructions with the same BaseName and Interpretation64Bit values
283*0b57cec5SDimitry Andric  // form a row.
284*0b57cec5SDimitry Andric  let RowFields = ["BaseName", "Interpretation64Bit"];
285*0b57cec5SDimitry Andric  // Instructions with the same RC value form a column.
286*0b57cec5SDimitry Andric  let ColFields = ["RC"];
287*0b57cec5SDimitry Andric  // The key column are the record-form instructions.
288*0b57cec5SDimitry Andric  let KeyCol = ["1"];
289*0b57cec5SDimitry Andric  // Value columns are RC=0
290*0b57cec5SDimitry Andric  let ValueCols = [["0"]];
291*0b57cec5SDimitry Andric}
292*0b57cec5SDimitry Andric
293*0b57cec5SDimitry Andricdef getAltVSXFMAOpcode : InstrMapping {
294*0b57cec5SDimitry Andric  let FilterClass = "AltVSXFMARel";
295*0b57cec5SDimitry Andric  // Instructions with the same BaseName value form a row.
296*0b57cec5SDimitry Andric  let RowFields = ["BaseName"];
297*0b57cec5SDimitry Andric  // Instructions with the same IsVSXFMAAlt value form a column.
298*0b57cec5SDimitry Andric  let ColFields = ["IsVSXFMAAlt"];
299*0b57cec5SDimitry Andric  // The key column are the (default) addend-killing instructions.
300*0b57cec5SDimitry Andric  let KeyCol = ["0"];
301*0b57cec5SDimitry Andric  // Value columns IsVSXFMAAlt=1
302*0b57cec5SDimitry Andric  let ValueCols = [["1"]];
303*0b57cec5SDimitry Andric}
304*0b57cec5SDimitry Andric
305*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
306*0b57cec5SDimitry Andric// Register File Description
307*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
308*0b57cec5SDimitry Andric
309*0b57cec5SDimitry Andricinclude "PPCRegisterInfo.td"
310*0b57cec5SDimitry Andricinclude "PPCSchedule.td"
311*0b57cec5SDimitry Andric
312*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
313*0b57cec5SDimitry Andric// PowerPC processors supported.
314*0b57cec5SDimitry Andric//
315*0b57cec5SDimitry Andric
316*0b57cec5SDimitry Andricdef : Processor<"generic", G3Itineraries, [Directive32, FeatureHardFloat,
317*0b57cec5SDimitry Andric                                           FeatureMFTB]>;
318*0b57cec5SDimitry Andricdef : ProcessorModel<"440", PPC440Model, [Directive440, FeatureISEL,
319*0b57cec5SDimitry Andric                                          FeatureFRES, FeatureFRSQRTE,
320*0b57cec5SDimitry Andric                                          FeatureICBT, FeatureBookE,
321*0b57cec5SDimitry Andric                                          FeatureMSYNC, FeatureMFTB]>;
322*0b57cec5SDimitry Andricdef : ProcessorModel<"450", PPC440Model, [Directive440, FeatureISEL,
323*0b57cec5SDimitry Andric                                          FeatureFRES, FeatureFRSQRTE,
324*0b57cec5SDimitry Andric                                          FeatureICBT, FeatureBookE,
325*0b57cec5SDimitry Andric                                          FeatureMSYNC, FeatureMFTB]>;
326*0b57cec5SDimitry Andricdef : Processor<"601", G3Itineraries, [Directive601, FeatureFPU]>;
327*0b57cec5SDimitry Andricdef : Processor<"602", G3Itineraries, [Directive602, FeatureFPU,
328*0b57cec5SDimitry Andric                                       FeatureMFTB]>;
329*0b57cec5SDimitry Andricdef : Processor<"603", G3Itineraries, [Directive603,
330*0b57cec5SDimitry Andric                                       FeatureFRES, FeatureFRSQRTE,
331*0b57cec5SDimitry Andric                                       FeatureMFTB]>;
332*0b57cec5SDimitry Andricdef : Processor<"603e", G3Itineraries, [Directive603,
333*0b57cec5SDimitry Andric                                        FeatureFRES, FeatureFRSQRTE,
334*0b57cec5SDimitry Andric                                        FeatureMFTB]>;
335*0b57cec5SDimitry Andricdef : Processor<"603ev", G3Itineraries, [Directive603,
336*0b57cec5SDimitry Andric                                         FeatureFRES, FeatureFRSQRTE,
337*0b57cec5SDimitry Andric                                         FeatureMFTB]>;
338*0b57cec5SDimitry Andricdef : Processor<"604", G3Itineraries, [Directive604,
339*0b57cec5SDimitry Andric                                       FeatureFRES, FeatureFRSQRTE,
340*0b57cec5SDimitry Andric                                       FeatureMFTB]>;
341*0b57cec5SDimitry Andricdef : Processor<"604e", G3Itineraries, [Directive604,
342*0b57cec5SDimitry Andric                                        FeatureFRES, FeatureFRSQRTE,
343*0b57cec5SDimitry Andric                                        FeatureMFTB]>;
344*0b57cec5SDimitry Andricdef : Processor<"620", G3Itineraries, [Directive620,
345*0b57cec5SDimitry Andric                                       FeatureFRES, FeatureFRSQRTE,
346*0b57cec5SDimitry Andric                                       FeatureMFTB]>;
347*0b57cec5SDimitry Andricdef : Processor<"750", G4Itineraries, [Directive750,
348*0b57cec5SDimitry Andric                                       FeatureFRES, FeatureFRSQRTE,
349*0b57cec5SDimitry Andric                                       FeatureMFTB]>;
350*0b57cec5SDimitry Andricdef : Processor<"g3", G3Itineraries, [Directive750,
351*0b57cec5SDimitry Andric                                      FeatureFRES, FeatureFRSQRTE,
352*0b57cec5SDimitry Andric                                      FeatureMFTB]>;
353*0b57cec5SDimitry Andricdef : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec,
354*0b57cec5SDimitry Andric                                        FeatureFRES, FeatureFRSQRTE,
355*0b57cec5SDimitry Andric                                        FeatureMFTB]>;
356*0b57cec5SDimitry Andricdef : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec,
357*0b57cec5SDimitry Andric                                      FeatureFRES, FeatureFRSQRTE,
358*0b57cec5SDimitry Andric                                      FeatureMFTB]>;
359*0b57cec5SDimitry Andricdef : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec,
360*0b57cec5SDimitry Andric                                            FeatureFRES, FeatureFRSQRTE,
361*0b57cec5SDimitry Andric                                            FeatureMFTB]>;
362*0b57cec5SDimitry Andricdef : Processor<"g4+", G4PlusItineraries, [Directive7400, FeatureAltivec,
363*0b57cec5SDimitry Andric                                           FeatureFRES, FeatureFRSQRTE,
364*0b57cec5SDimitry Andric                                           FeatureMFTB]>;
365*0b57cec5SDimitry Andric
366*0b57cec5SDimitry Andricdef : ProcessorModel<"970", G5Model,
367*0b57cec5SDimitry Andric                  [Directive970, FeatureAltivec,
368*0b57cec5SDimitry Andric                   FeatureMFOCRF, FeatureFSqrt,
369*0b57cec5SDimitry Andric                   FeatureFRES, FeatureFRSQRTE, FeatureSTFIWX,
370*0b57cec5SDimitry Andric                   Feature64Bit /*, Feature64BitRegs */,
371*0b57cec5SDimitry Andric                   FeatureMFTB]>;
372*0b57cec5SDimitry Andricdef : ProcessorModel<"g5", G5Model,
373*0b57cec5SDimitry Andric                  [Directive970, FeatureAltivec,
374*0b57cec5SDimitry Andric                   FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
375*0b57cec5SDimitry Andric                   FeatureFRES, FeatureFRSQRTE,
376*0b57cec5SDimitry Andric                   Feature64Bit /*, Feature64BitRegs */,
377*0b57cec5SDimitry Andric                   FeatureMFTB, DeprecatedDST]>;
378*0b57cec5SDimitry Andricdef : ProcessorModel<"e500", PPCE500Model,
379*0b57cec5SDimitry Andric                  [DirectiveE500,
380*0b57cec5SDimitry Andric                   FeatureICBT, FeatureBookE,
381*0b57cec5SDimitry Andric                   FeatureISEL, FeatureMFTB]>;
382*0b57cec5SDimitry Andricdef : ProcessorModel<"e500mc", PPCE500mcModel,
383*0b57cec5SDimitry Andric                  [DirectiveE500mc,
384*0b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureICBT, FeatureBookE,
385*0b57cec5SDimitry Andric                   FeatureISEL, FeatureMFTB]>;
386*0b57cec5SDimitry Andricdef : ProcessorModel<"e5500", PPCE5500Model,
387*0b57cec5SDimitry Andric                  [DirectiveE5500, FeatureMFOCRF, Feature64Bit,
388*0b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureICBT, FeatureBookE,
389*0b57cec5SDimitry Andric                   FeatureISEL, FeatureMFTB]>;
390*0b57cec5SDimitry Andricdef : ProcessorModel<"a2", PPCA2Model,
391*0b57cec5SDimitry Andric                  [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF,
392*0b57cec5SDimitry Andric                   FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
393*0b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
394*0b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureLFIWAX,
395*0b57cec5SDimitry Andric                   FeatureFPRND, FeatureFPCVT, FeatureISEL,
396*0b57cec5SDimitry Andric                   FeatureSlowPOPCNTD, FeatureCMPB, FeatureLDBRX,
397*0b57cec5SDimitry Andric                   Feature64Bit /*, Feature64BitRegs */, FeatureMFTB]>;
398*0b57cec5SDimitry Andricdef : ProcessorModel<"a2q", PPCA2Model,
399*0b57cec5SDimitry Andric                  [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF,
400*0b57cec5SDimitry Andric                   FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
401*0b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
402*0b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureLFIWAX,
403*0b57cec5SDimitry Andric                   FeatureFPRND, FeatureFPCVT, FeatureISEL,
404*0b57cec5SDimitry Andric                   FeatureSlowPOPCNTD, FeatureCMPB, FeatureLDBRX,
405*0b57cec5SDimitry Andric                   Feature64Bit /*, Feature64BitRegs */, FeatureQPX,
406*0b57cec5SDimitry Andric                   FeatureMFTB]>;
407*0b57cec5SDimitry Andricdef : ProcessorModel<"pwr3", G5Model,
408*0b57cec5SDimitry Andric                  [DirectivePwr3, FeatureAltivec,
409*0b57cec5SDimitry Andric                   FeatureFRES, FeatureFRSQRTE, FeatureMFOCRF,
410*0b57cec5SDimitry Andric                   FeatureSTFIWX, Feature64Bit]>;
411*0b57cec5SDimitry Andricdef : ProcessorModel<"pwr4", G5Model,
412*0b57cec5SDimitry Andric                  [DirectivePwr4, FeatureAltivec, FeatureMFOCRF,
413*0b57cec5SDimitry Andric                   FeatureFSqrt, FeatureFRES, FeatureFRSQRTE,
414*0b57cec5SDimitry Andric                   FeatureSTFIWX, Feature64Bit, FeatureMFTB]>;
415*0b57cec5SDimitry Andricdef : ProcessorModel<"pwr5", G5Model,
416*0b57cec5SDimitry Andric                  [DirectivePwr5, FeatureAltivec, FeatureMFOCRF,
417*0b57cec5SDimitry Andric                   FeatureFSqrt, FeatureFRE, FeatureFRES,
418*0b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureFRSQRTES,
419*0b57cec5SDimitry Andric                   FeatureSTFIWX, Feature64Bit,
420*0b57cec5SDimitry Andric                   FeatureMFTB, DeprecatedDST]>;
421*0b57cec5SDimitry Andricdef : ProcessorModel<"pwr5x", G5Model,
422*0b57cec5SDimitry Andric                  [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
423*0b57cec5SDimitry Andric                   FeatureFSqrt, FeatureFRE, FeatureFRES,
424*0b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureFRSQRTES,
425*0b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureFPRND, Feature64Bit,
426*0b57cec5SDimitry Andric                   FeatureMFTB, DeprecatedDST]>;
427*0b57cec5SDimitry Andricdef : ProcessorModel<"pwr6", G5Model,
428*0b57cec5SDimitry Andric                  [DirectivePwr6, FeatureAltivec,
429*0b57cec5SDimitry Andric                   FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE,
430*0b57cec5SDimitry Andric                   FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
431*0b57cec5SDimitry Andric                   FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
432*0b57cec5SDimitry Andric                   FeatureFPRND, Feature64Bit /*, Feature64BitRegs */,
433*0b57cec5SDimitry Andric                   FeatureMFTB, DeprecatedDST]>;
434*0b57cec5SDimitry Andricdef : ProcessorModel<"pwr6x", G5Model,
435*0b57cec5SDimitry Andric                  [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
436*0b57cec5SDimitry Andric                   FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
437*0b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
438*0b57cec5SDimitry Andric                   FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
439*0b57cec5SDimitry Andric                   FeatureFPRND, Feature64Bit,
440*0b57cec5SDimitry Andric                   FeatureMFTB, DeprecatedDST]>;
441*0b57cec5SDimitry Andricdef : ProcessorModel<"pwr7", P7Model, ProcessorFeatures.Power7FeatureList>;
442*0b57cec5SDimitry Andricdef : ProcessorModel<"pwr8", P8Model, ProcessorFeatures.Power8FeatureList>;
443*0b57cec5SDimitry Andricdef : ProcessorModel<"pwr9", P9Model, ProcessorFeatures.Power9FeatureList>;
444*0b57cec5SDimitry Andricdef : Processor<"ppc", G3Itineraries, [Directive32, FeatureHardFloat,
445*0b57cec5SDimitry Andric                                       FeatureMFTB]>;
446*0b57cec5SDimitry Andricdef : Processor<"ppc32", G3Itineraries, [Directive32, FeatureHardFloat,
447*0b57cec5SDimitry Andric                                         FeatureMFTB]>;
448*0b57cec5SDimitry Andricdef : ProcessorModel<"ppc64", G5Model,
449*0b57cec5SDimitry Andric                  [Directive64, FeatureAltivec,
450*0b57cec5SDimitry Andric                   FeatureMFOCRF, FeatureFSqrt, FeatureFRES,
451*0b57cec5SDimitry Andric                   FeatureFRSQRTE, FeatureSTFIWX,
452*0b57cec5SDimitry Andric                   Feature64Bit /*, Feature64BitRegs */,
453*0b57cec5SDimitry Andric                   FeatureMFTB]>;
454*0b57cec5SDimitry Andricdef : ProcessorModel<"ppc64le", P8Model, ProcessorFeatures.Power8FeatureList>;
455*0b57cec5SDimitry Andric
456*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
457*0b57cec5SDimitry Andric// Calling Conventions
458*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
459*0b57cec5SDimitry Andric
460*0b57cec5SDimitry Andricinclude "PPCCallingConv.td"
461*0b57cec5SDimitry Andric
462*0b57cec5SDimitry Andricdef PPCInstrInfo : InstrInfo {
463*0b57cec5SDimitry Andric  let isLittleEndianEncoding = 1;
464*0b57cec5SDimitry Andric
465*0b57cec5SDimitry Andric  // FIXME: Unset this when no longer needed!
466*0b57cec5SDimitry Andric  let decodePositionallyEncodedOperands = 1;
467*0b57cec5SDimitry Andric
468*0b57cec5SDimitry Andric  let noNamedPositionallyEncodedOperands = 1;
469*0b57cec5SDimitry Andric}
470*0b57cec5SDimitry Andric
471*0b57cec5SDimitry Andricdef PPCAsmParser : AsmParser {
472*0b57cec5SDimitry Andric  let ShouldEmitMatchRegisterName = 0;
473*0b57cec5SDimitry Andric}
474*0b57cec5SDimitry Andric
475*0b57cec5SDimitry Andricdef PPCAsmParserVariant : AsmParserVariant {
476*0b57cec5SDimitry Andric  int Variant = 0;
477*0b57cec5SDimitry Andric
478*0b57cec5SDimitry Andric  // We do not use hard coded registers in asm strings.  However, some
479*0b57cec5SDimitry Andric  // InstAlias definitions use immediate literals.  Set RegisterPrefix
480*0b57cec5SDimitry Andric  // so that those are not misinterpreted as registers.
481*0b57cec5SDimitry Andric  string RegisterPrefix = "%";
482*0b57cec5SDimitry Andric  string BreakCharacters = ".";
483*0b57cec5SDimitry Andric}
484*0b57cec5SDimitry Andric
485*0b57cec5SDimitry Andricdef PPC : Target {
486*0b57cec5SDimitry Andric  // Information about the instructions.
487*0b57cec5SDimitry Andric  let InstructionSet = PPCInstrInfo;
488*0b57cec5SDimitry Andric
489*0b57cec5SDimitry Andric  let AssemblyParsers = [PPCAsmParser];
490*0b57cec5SDimitry Andric  let AssemblyParserVariants = [PPCAsmParserVariant];
491*0b57cec5SDimitry Andric  let AllowRegisterRenaming = 1;
492*0b57cec5SDimitry Andric}
493*0b57cec5SDimitry Andric
494*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
495*0b57cec5SDimitry Andric// Pfm Counters
496*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
497*0b57cec5SDimitry Andric
498*0b57cec5SDimitry Andricinclude "PPCPfmCounters.td"
499