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