blob: ac1c3060046864bad9ce00a1cdbcc8937c3314b1 [file] [log] [blame]
Jia Liub22310f2012-02-18 12:03:15 +00001//===-- PPC.td - Describe the PowerPC Target Machine -------*- tablegen -*-===//
2//
Chris Lattner0921e3b2005-10-14 23:37:35 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Jia Liub22310f2012-02-18 12:03:15 +00007//
Chris Lattner0921e3b2005-10-14 23:37:35 +00008//===----------------------------------------------------------------------===//
9//
10// This is the top level entry point for the PowerPC target.
11//
12//===----------------------------------------------------------------------===//
13
14// Get the target-independent interfaces which we are implementing.
15//
Evan Cheng977e7be2008-11-24 07:34:46 +000016include "llvm/Target/Target.td"
Chris Lattner0921e3b2005-10-14 23:37:35 +000017
18//===----------------------------------------------------------------------===//
Jim Laskey13a19452005-10-22 08:04:24 +000019// PowerPC Subtarget features.
Jim Laskey74ab9962005-10-19 19:51:16 +000020//
Nemanja Ivanovicd384cd92015-03-04 17:09:12 +000021
Jim Laskey59e7a772006-12-12 20:57:08 +000022//===----------------------------------------------------------------------===//
23// CPU Directives //
24//===----------------------------------------------------------------------===//
25
Hal Finkel6fa56972011-10-17 04:03:49 +000026def Directive440 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_440", "">;
Jim Laskey59e7a772006-12-12 20:57:08 +000027def Directive601 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_601", "">;
28def Directive602 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_602", "">;
29def Directive603 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">;
30def Directive604 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">;
31def Directive620 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">;
32def Directive7400: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_7400", "">;
33def Directive750 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_750", "">;
34def Directive970 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_970", "">;
35def Directive32 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_32", "">;
36def Directive64 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_64", "">;
Hal Finkel9f9f8922012-04-01 19:22:40 +000037def DirectiveA2 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_A2", "">;
Hal Finkel742b5352012-08-28 16:12:39 +000038def DirectiveE500mc : SubtargetFeature<"", "DarwinDirective",
39 "PPC::DIR_E500mc", "">;
Eric Christopher47d372f2016-06-23 01:33:38 +000040def DirectiveE5500 : SubtargetFeature<"", "DarwinDirective",
Hal Finkel742b5352012-08-28 16:12:39 +000041 "PPC::DIR_E5500", "">;
Bill Schmidt52742c22013-02-01 22:59:51 +000042def DirectivePwr3: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR3", "">;
43def DirectivePwr4: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR4", "">;
44def DirectivePwr5: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR5", "">;
Eric Christopher47d372f2016-06-23 01:33:38 +000045def DirectivePwr5x
46 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR5X", "">;
Hal Finkelf2b9c382012-06-11 15:43:08 +000047def DirectivePwr6: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6", "">;
Eric Christopher47d372f2016-06-23 01:33:38 +000048def DirectivePwr6x
49 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6X", "">;
Hal Finkelf2b9c382012-06-11 15:43:08 +000050def DirectivePwr7: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR7", "">;
Will Schmidt970ff642014-06-26 13:36:19 +000051def DirectivePwr8: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR8", "">;
Nemanja Ivanovic6e29baf2016-05-09 18:54:58 +000052def DirectivePwr9: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR9", "">;
Jim Laskey59e7a772006-12-12 20:57:08 +000053
Chris Lattnera35f3062006-06-16 17:34:12 +000054def Feature64Bit : SubtargetFeature<"64bit","Has64BitSupport", "true",
Chris Lattner0d4923b2005-10-23 05:28:51 +000055 "Enable 64-bit instructions">;
Petar Jovanovic280f7102015-12-14 17:57:33 +000056def FeatureSoftFloat : SubtargetFeature<"soft-float", "UseSoftFloat", "true",
57 "Use software emulation for floating point">;
Chris Lattnera35f3062006-06-16 17:34:12 +000058def Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true",
59 "Enable 64-bit registers usage for ppc32 [beta]">;
Hal Finkel940ab932014-02-28 00:27:01 +000060def FeatureCRBits : SubtargetFeature<"crbits", "UseCRBits", "true",
61 "Use condition-register bits individually">;
Evan Chengd98701c2006-01-27 08:09:42 +000062def FeatureAltivec : SubtargetFeature<"altivec","HasAltivec", "true",
Chris Lattner0d4923b2005-10-23 05:28:51 +000063 "Enable Altivec instructions">;
Joerg Sonnenberger39f095a2014-08-07 12:18:21 +000064def FeatureSPE : SubtargetFeature<"spe","HasSPE", "true",
65 "Enable SPE instructions">;
Hal Finkelbfd3d082012-06-11 19:57:01 +000066def FeatureMFOCRF : SubtargetFeature<"mfocrf","HasMFOCRF", "true",
67 "Enable the MFOCRF instruction">;
Evan Chengd98701c2006-01-27 08:09:42 +000068def FeatureFSqrt : SubtargetFeature<"fsqrt","HasFSQRT", "true",
Hal Finkel49033792011-10-14 18:54:13 +000069 "Enable the fsqrt instruction">;
Hal Finkeldbc78e12013-08-19 05:01:02 +000070def FeatureFCPSGN : SubtargetFeature<"fcpsgn", "HasFCPSGN", "true",
71 "Enable the fcpsgn instruction">;
Hal Finkel2e103312013-04-03 04:01:11 +000072def FeatureFRE : SubtargetFeature<"fre", "HasFRE", "true",
73 "Enable the fre instruction">;
74def FeatureFRES : SubtargetFeature<"fres", "HasFRES", "true",
75 "Enable the fres instruction">;
76def FeatureFRSQRTE : SubtargetFeature<"frsqrte", "HasFRSQRTE", "true",
77 "Enable the frsqrte instruction">;
78def FeatureFRSQRTES : SubtargetFeature<"frsqrtes", "HasFRSQRTES", "true",
79 "Enable the frsqrtes instruction">;
80def FeatureRecipPrec : SubtargetFeature<"recipprec", "HasRecipPrec", "true",
81 "Assume higher precision reciprocal estimates">;
Chris Lattnerb9f35f02006-02-28 07:08:22 +000082def FeatureSTFIWX : SubtargetFeature<"stfiwx","HasSTFIWX", "true",
Hal Finkel49033792011-10-14 18:54:13 +000083 "Enable the stfiwx instruction">;
Hal Finkelbeb296b2013-03-31 10:12:51 +000084def FeatureLFIWAX : SubtargetFeature<"lfiwax","HasLFIWAX", "true",
85 "Enable the lfiwax instruction">;
Hal Finkelc20a08d2013-03-29 08:57:48 +000086def FeatureFPRND : SubtargetFeature<"fprnd", "HasFPRND", "true",
87 "Enable the fri[mnpz] instructions">;
Hal Finkelf6d45f22013-04-01 17:52:07 +000088def FeatureFPCVT : SubtargetFeature<"fpcvt", "HasFPCVT", "true",
89 "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions">;
Hal Finkel460e94d2012-06-22 23:10:08 +000090def FeatureISEL : SubtargetFeature<"isel","HasISEL", "true",
91 "Enable the isel instruction">;
Nemanja Ivanovicc0904792015-04-09 23:54:37 +000092def FeatureBPERMD : SubtargetFeature<"bpermd", "HasBPERMD", "true",
93 "Enable the bpermd instruction">;
94def FeatureExtDiv : SubtargetFeature<"extdiv", "HasExtDiv", "true",
95 "Enable extended divide instructions">;
Hal Finkel31d29562013-03-28 19:25:55 +000096def FeatureLDBRX : SubtargetFeature<"ldbrx","HasLDBRX", "true",
97 "Enable the ldbrx instruction">;
Hal Finkel4edc66b2015-01-03 01:16:37 +000098def FeatureCMPB : SubtargetFeature<"cmpb", "HasCMPB", "true",
99 "Enable the cmpb instruction">;
Bill Schmidt082cfc02015-01-14 20:17:10 +0000100def FeatureICBT : SubtargetFeature<"icbt","HasICBT", "true",
101 "Enable icbt instruction">;
Hal Finkel6fa56972011-10-17 04:03:49 +0000102def FeatureBookE : SubtargetFeature<"booke", "IsBookE", "true",
Bill Schmidt082cfc02015-01-14 20:17:10 +0000103 "Enable Book E instructions",
104 [FeatureICBT]>;
Hal Finkelfe3368c2014-10-02 22:34:22 +0000105def FeatureMSYNC : SubtargetFeature<"msync", "HasOnlyMSYNC", "true",
106 "Has only the msync instruction instead of sync",
107 [FeatureBookE]>;
Joerg Sonnenberger6ae087a2014-08-07 12:31:28 +0000108def FeatureE500 : SubtargetFeature<"e500", "IsE500", "true",
Joerg Sonnenberger0b2ebcb2014-08-04 15:47:38 +0000109 "Enable E500/E500mc instructions">;
110def FeaturePPC4xx : SubtargetFeature<"ppc4xx", "IsPPC4xx", "true",
111 "Enable PPC 4xx instructions">;
Joerg Sonnenberger74052102014-08-04 17:07:41 +0000112def FeaturePPC6xx : SubtargetFeature<"ppc6xx", "IsPPC6xx", "true",
113 "Enable PPC 6xx instructions">;
Hal Finkelefb305e2013-01-30 21:17:42 +0000114def FeatureQPX : SubtargetFeature<"qpx","HasQPX", "true",
115 "Enable QPX instructions">;
Eric Christopher081efcc2013-10-16 20:38:58 +0000116def FeatureVSX : SubtargetFeature<"vsx","HasVSX", "true",
Hal Finkel27774d92014-03-13 07:58:58 +0000117 "Enable VSX instructions",
118 [FeatureAltivec]>;
Bill Schmidtfe88b182015-02-03 21:58:23 +0000119def FeatureP8Altivec : SubtargetFeature<"power8-altivec", "HasP8Altivec", "true",
120 "Enable POWER8 Altivec instructions",
121 [FeatureAltivec]>;
Nemanja Ivanovice8effe12015-03-04 20:44:33 +0000122def FeatureP8Crypto : SubtargetFeature<"crypto", "HasP8Crypto", "true",
Nemanja Ivanovic0adf26b2015-03-10 20:51:07 +0000123 "Enable POWER8 Crypto instructions",
124 [FeatureP8Altivec]>;
NAKAMURA Takumicc4487e2014-12-09 01:03:27 +0000125def FeatureP8Vector : SubtargetFeature<"power8-vector", "HasP8Vector", "true",
126 "Enable POWER8 vector instructions",
Bill Schmidtfe88b182015-02-03 21:58:23 +0000127 [FeatureVSX, FeatureP8Altivec]>;
Nemanja Ivanovicc38b5312015-04-11 10:40:42 +0000128def FeatureDirectMove :
129 SubtargetFeature<"direct-move", "HasDirectMove", "true",
130 "Enable Power8 direct move instructions",
131 [FeatureVSX]>;
Nemanja Ivanovic0adf26b2015-03-10 20:51:07 +0000132def FeaturePartwordAtomic : SubtargetFeature<"partword-atomics",
133 "HasPartwordAtomics", "true",
134 "Enable l[bh]arx and st[bh]cx.">;
Hal Finkele2ab0f12015-01-15 21:17:34 +0000135def FeatureInvariantFunctionDescriptors :
136 SubtargetFeature<"invariant-function-descriptors",
137 "HasInvariantFunctionDescriptors", "true",
138 "Assume function descriptors are invariant">;
Hal Finkelb074a602016-08-30 00:59:23 +0000139def FeatureLongCall : SubtargetFeature<"longcall", "UseLongCalls", "true",
140 "Always use indirect calls">;
Kit Barton535e69d2015-03-25 19:36:23 +0000141def FeatureHTM : SubtargetFeature<"htm", "HasHTM", "true",
142 "Enable Hardware Transactional Memory instructions">;
Kit Barton4f79f962015-06-16 16:01:15 +0000143def FeatureMFTB : SubtargetFeature<"", "FeatureMFTB", "true",
144 "Implement mftb using the mfspr instruction">;
Eric Christopher25bf4a82015-11-20 22:38:20 +0000145def FeatureFusion : SubtargetFeature<"fusion", "HasFusion", "true",
146 "Target supports add/load integer fusion.">;
Nemanja Ivanovicb033f672015-12-15 12:19:34 +0000147def FeatureFloat128 :
148 SubtargetFeature<"float128", "HasFloat128", "true",
149 "Enable the __float128 data type for IEEE-754R Binary128.",
150 [FeatureVSX]>;
Hal Finkelfa7057a2016-03-29 01:36:01 +0000151def FeaturePOPCNTD : SubtargetFeature<"popcntd","HasPOPCNTD",
152 "POPCNTD_Fast",
153 "Enable the popcnt[dw] instructions">;
Hal Finkel7059d412016-03-28 17:52:08 +0000154// Note that for the a2/a2q processor models we should not use popcnt[dw] by
155// default. These processors do support the instructions, but they're
156// microcoded, and the software emulation is about twice as fast.
Hal Finkelfa7057a2016-03-29 01:36:01 +0000157def FeatureSlowPOPCNTD : SubtargetFeature<"slow-popcntd","HasPOPCNTD",
158 "POPCNTD_Slow",
159 "Has slow popcnt[dw] instructions">;
160
161def DeprecatedDST : SubtargetFeature<"", "DeprecatedDST", "true",
162 "Treat vector data stream cache control instructions as deprecated">;
Hal Finkel7059d412016-03-28 17:52:08 +0000163
Nemanja Ivanovica621a7f2016-03-31 15:26:37 +0000164def FeatureISA3_0 : SubtargetFeature<"isa-v30-instructions", "IsISA3_0",
165 "true",
166 "Enable instructions added in ISA 3.0.">;
Nemanja Ivanovic87bcae32016-04-13 18:51:18 +0000167def FeatureP9Altivec : SubtargetFeature<"power9-altivec", "HasP9Altivec", "true",
168 "Enable POWER9 Altivec instructions",
169 [FeatureISA3_0, FeatureP8Altivec]>;
170def FeatureP9Vector : SubtargetFeature<"power9-vector", "HasP9Vector", "true",
171 "Enable POWER9 vector instructions",
172 [FeatureISA3_0, FeatureP8Vector,
173 FeatureP9Altivec]>;
Nemanja Ivanovica621a7f2016-03-31 15:26:37 +0000174
Eric Christopher47d372f2016-06-23 01:33:38 +0000175// Since new processors generally contain a superset of features of those that
176// came before them, the idea is to make implementations of new processors
177// less error prone and easier to read.
178// Namely:
179// list<SubtargetFeature> Power8FeatureList = ...
180// list<SubtargetFeature> FutureProcessorSpecificFeatureList =
181// [ features that Power8 does not support ]
182// list<SubtargetFeature> FutureProcessorFeatureList =
183// !listconcat(Power8FeatureList, FutureProcessorSpecificFeatureList)
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000184
Eric Christopher47d372f2016-06-23 01:33:38 +0000185// Makes it explicit and obvious what is new in FutureProcesor vs. Power8 as
186// well as providing a single point of definition if the feature set will be
187// used elsewhere.
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000188def ProcessorFeatures {
189 list<SubtargetFeature> Power7FeatureList =
190 [DirectivePwr7, FeatureAltivec, FeatureVSX,
191 FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE,
192 FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
193 FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX,
194 FeatureFPRND, FeatureFPCVT, FeatureISEL,
195 FeaturePOPCNTD, FeatureCMPB, FeatureLDBRX,
Hal Finkel58f5f9c2015-04-11 13:40:36 +0000196 Feature64Bit /*, Feature64BitRegs */,
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000197 FeatureBPERMD, FeatureExtDiv,
Kit Barton4f79f962015-06-16 16:01:15 +0000198 FeatureMFTB, DeprecatedDST];
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000199 list<SubtargetFeature> Power8SpecificFeatures =
200 [DirectivePwr8, FeatureP8Altivec, FeatureP8Vector, FeatureP8Crypto,
Eric Christopher25bf4a82015-11-20 22:38:20 +0000201 FeatureHTM, FeatureDirectMove, FeatureICBT, FeaturePartwordAtomic,
202 FeatureFusion];
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000203 list<SubtargetFeature> Power8FeatureList =
204 !listconcat(Power7FeatureList, Power8SpecificFeatures);
Nemanja Ivanovic87bcae32016-04-13 18:51:18 +0000205 list<SubtargetFeature> Power9SpecificFeatures =
206 [FeatureP9Altivec, FeatureP9Vector, FeatureISA3_0];
Nemanja Ivanovic6e29baf2016-05-09 18:54:58 +0000207 list<SubtargetFeature> Power9FeatureList =
208 !listconcat(Power8FeatureList, Power9SpecificFeatures);
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000209}
210
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000211// Note: Future features to add when support is extended to more
212// recent ISA levels:
213//
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000214// DFP p6, p6x, p7 decimal floating-point instructions
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000215// POPCNTB p5 through p7 popcntb and related instructions
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000216
Jim Laskey74ab9962005-10-19 19:51:16 +0000217//===----------------------------------------------------------------------===//
Hal Finkel654d43b2013-04-12 02:18:09 +0000218// Classes used for relation maps.
219//===----------------------------------------------------------------------===//
220// RecFormRel - Filter class used to relate non-record-form instructions with
221// their record-form variants.
222class RecFormRel;
223
Hal Finkel25e04542014-03-25 18:55:11 +0000224// AltVSXFMARel - Filter class used to relate the primary addend-killing VSX
225// FMA instruction forms with their corresponding factor-killing forms.
226class AltVSXFMARel {
227 bit IsVSXFMAAlt = 0;
228}
229
Hal Finkel654d43b2013-04-12 02:18:09 +0000230//===----------------------------------------------------------------------===//
231// Relation Map Definitions.
232//===----------------------------------------------------------------------===//
233
234def getRecordFormOpcode : InstrMapping {
235 let FilterClass = "RecFormRel";
236 // Instructions with the same BaseName and Interpretation64Bit values
237 // form a row.
238 let RowFields = ["BaseName", "Interpretation64Bit"];
239 // Instructions with the same RC value form a column.
240 let ColFields = ["RC"];
241 // The key column are the non-record-form instructions.
242 let KeyCol = ["0"];
243 // Value columns RC=1
244 let ValueCols = [["1"]];
245}
246
247def getNonRecordFormOpcode : InstrMapping {
248 let FilterClass = "RecFormRel";
249 // Instructions with the same BaseName and Interpretation64Bit values
250 // form a row.
251 let RowFields = ["BaseName", "Interpretation64Bit"];
252 // Instructions with the same RC value form a column.
253 let ColFields = ["RC"];
254 // The key column are the record-form instructions.
255 let KeyCol = ["1"];
256 // Value columns are RC=0
257 let ValueCols = [["0"]];
258}
259
Hal Finkel25e04542014-03-25 18:55:11 +0000260def getAltVSXFMAOpcode : InstrMapping {
261 let FilterClass = "AltVSXFMARel";
262 // Instructions with the same BaseName and Interpretation64Bit values
263 // form a row.
264 let RowFields = ["BaseName"];
265 // Instructions with the same RC value form a column.
266 let ColFields = ["IsVSXFMAAlt"];
267 // The key column are the (default) addend-killing instructions.
268 let KeyCol = ["0"];
269 // Value columns IsVSXFMAAlt=1
270 let ValueCols = [["1"]];
271}
272
Hal Finkel654d43b2013-04-12 02:18:09 +0000273//===----------------------------------------------------------------------===//
Chris Lattnera389f0d2005-10-23 22:08:13 +0000274// Register File Description
275//===----------------------------------------------------------------------===//
276
277include "PPCRegisterInfo.td"
278include "PPCSchedule.td"
279include "PPCInstrInfo.td"
280
281//===----------------------------------------------------------------------===//
282// PowerPC processors supported.
Jim Laskey74ab9962005-10-19 19:51:16 +0000283//
284
Kit Barton4f79f962015-06-16 16:01:15 +0000285def : Processor<"generic", G3Itineraries, [Directive32, FeatureMFTB]>;
Hal Finkel5a7162f2013-11-29 06:32:17 +0000286def : ProcessorModel<"440", PPC440Model, [Directive440, FeatureISEL,
287 FeatureFRES, FeatureFRSQRTE,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000288 FeatureICBT, FeatureBookE,
Kit Barton4f79f962015-06-16 16:01:15 +0000289 FeatureMSYNC, FeatureMFTB]>;
Hal Finkel5a7162f2013-11-29 06:32:17 +0000290def : ProcessorModel<"450", PPC440Model, [Directive440, FeatureISEL,
291 FeatureFRES, FeatureFRSQRTE,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000292 FeatureICBT, FeatureBookE,
Kit Barton4f79f962015-06-16 16:01:15 +0000293 FeatureMSYNC, FeatureMFTB]>;
Jim Laskey59e7a772006-12-12 20:57:08 +0000294def : Processor<"601", G3Itineraries, [Directive601]>;
Kit Barton4f79f962015-06-16 16:01:15 +0000295def : Processor<"602", G3Itineraries, [Directive602,
296 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000297def : Processor<"603", G3Itineraries, [Directive603,
Kit Barton4f79f962015-06-16 16:01:15 +0000298 FeatureFRES, FeatureFRSQRTE,
299 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000300def : Processor<"603e", G3Itineraries, [Directive603,
Kit Barton4f79f962015-06-16 16:01:15 +0000301 FeatureFRES, FeatureFRSQRTE,
302 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000303def : Processor<"603ev", G3Itineraries, [Directive603,
Kit Barton4f79f962015-06-16 16:01:15 +0000304 FeatureFRES, FeatureFRSQRTE,
305 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000306def : Processor<"604", G3Itineraries, [Directive604,
Kit Barton4f79f962015-06-16 16:01:15 +0000307 FeatureFRES, FeatureFRSQRTE,
308 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000309def : Processor<"604e", G3Itineraries, [Directive604,
Kit Barton4f79f962015-06-16 16:01:15 +0000310 FeatureFRES, FeatureFRSQRTE,
311 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000312def : Processor<"620", G3Itineraries, [Directive620,
Kit Barton4f79f962015-06-16 16:01:15 +0000313 FeatureFRES, FeatureFRSQRTE,
314 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000315def : Processor<"750", G4Itineraries, [Directive750,
Kit Barton4f79f962015-06-16 16:01:15 +0000316 FeatureFRES, FeatureFRSQRTE,
317 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000318def : Processor<"g3", G3Itineraries, [Directive750,
Kit Barton4f79f962015-06-16 16:01:15 +0000319 FeatureFRES, FeatureFRSQRTE,
320 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000321def : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec,
Kit Barton4f79f962015-06-16 16:01:15 +0000322 FeatureFRES, FeatureFRSQRTE,
323 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000324def : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec,
Kit Barton4f79f962015-06-16 16:01:15 +0000325 FeatureFRES, FeatureFRSQRTE,
326 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000327def : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec,
Kit Barton4f79f962015-06-16 16:01:15 +0000328 FeatureFRES, FeatureFRSQRTE,
329 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000330def : Processor<"g4+", G4PlusItineraries, [Directive7400, FeatureAltivec,
Kit Barton4f79f962015-06-16 16:01:15 +0000331 FeatureFRES, FeatureFRSQRTE,
332 FeatureMFTB]>;
Bill Schmidt279cabb2015-01-25 18:05:42 +0000333
Hal Finkel1a958cf2013-04-05 05:49:18 +0000334def : ProcessorModel<"970", G5Model,
Jim Laskey59e7a772006-12-12 20:57:08 +0000335 [Directive970, FeatureAltivec,
Hal Finkel2e103312013-04-03 04:01:11 +0000336 FeatureMFOCRF, FeatureFSqrt,
337 FeatureFRES, FeatureFRSQRTE, FeatureSTFIWX,
Kit Barton4f79f962015-06-16 16:01:15 +0000338 Feature64Bit /*, Feature64BitRegs */,
339 FeatureMFTB]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000340def : ProcessorModel<"g5", G5Model,
Jim Laskey59e7a772006-12-12 20:57:08 +0000341 [Directive970, FeatureAltivec,
Hal Finkelbfd3d082012-06-11 19:57:01 +0000342 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Hal Finkel2e103312013-04-03 04:01:11 +0000343 FeatureFRES, FeatureFRSQRTE,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000344 Feature64Bit /*, Feature64BitRegs */,
Kit Barton4f79f962015-06-16 16:01:15 +0000345 FeatureMFTB, DeprecatedDST]>;
Hal Finkel742b5352012-08-28 16:12:39 +0000346def : ProcessorModel<"e500mc", PPCE500mcModel,
Hal Finkel005f8402015-11-25 10:14:31 +0000347 [DirectiveE500mc,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000348 FeatureSTFIWX, FeatureICBT, FeatureBookE,
Kit Barton4f79f962015-06-16 16:01:15 +0000349 FeatureISEL, FeatureMFTB]>;
Hal Finkel742b5352012-08-28 16:12:39 +0000350def : ProcessorModel<"e5500", PPCE5500Model,
351 [DirectiveE5500, FeatureMFOCRF, Feature64Bit,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000352 FeatureSTFIWX, FeatureICBT, FeatureBookE,
Kit Barton4f79f962015-06-16 16:01:15 +0000353 FeatureISEL, FeatureMFTB]>;
Hal Finkel5fde1b02013-04-05 05:34:08 +0000354def : ProcessorModel<"a2", PPCA2Model,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000355 [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000356 FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
Hal Finkel2e103312013-04-03 04:01:11 +0000357 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
358 FeatureSTFIWX, FeatureLFIWAX,
Hal Finkelf6d45f22013-04-01 17:52:07 +0000359 FeatureFPRND, FeatureFPCVT, FeatureISEL,
Hal Finkelfa7057a2016-03-29 01:36:01 +0000360 FeatureSlowPOPCNTD, FeatureCMPB, FeatureLDBRX,
Hal Finkel7059d412016-03-28 17:52:08 +0000361 Feature64Bit /*, Feature64BitRegs */, FeatureMFTB]>;
Hal Finkel5fde1b02013-04-05 05:34:08 +0000362def : ProcessorModel<"a2q", PPCA2Model,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000363 [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000364 FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
Hal Finkel2e103312013-04-03 04:01:11 +0000365 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
366 FeatureSTFIWX, FeatureLFIWAX,
Hal Finkelf6d45f22013-04-01 17:52:07 +0000367 FeatureFPRND, FeatureFPCVT, FeatureISEL,
Hal Finkelfa7057a2016-03-29 01:36:01 +0000368 FeatureSlowPOPCNTD, FeatureCMPB, FeatureLDBRX,
Hal Finkel7059d412016-03-28 17:52:08 +0000369 Feature64Bit /*, Feature64BitRegs */, FeatureQPX,
370 FeatureMFTB]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000371def : ProcessorModel<"pwr3", G5Model,
Hal Finkel2e103312013-04-03 04:01:11 +0000372 [DirectivePwr3, FeatureAltivec,
373 FeatureFRES, FeatureFRSQRTE, FeatureMFOCRF,
Bill Schmidt52742c22013-02-01 22:59:51 +0000374 FeatureSTFIWX, Feature64Bit]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000375def : ProcessorModel<"pwr4", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000376 [DirectivePwr4, FeatureAltivec, FeatureMFOCRF,
Hal Finkel2e103312013-04-03 04:01:11 +0000377 FeatureFSqrt, FeatureFRES, FeatureFRSQRTE,
Kit Barton4f79f962015-06-16 16:01:15 +0000378 FeatureSTFIWX, Feature64Bit, FeatureMFTB]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000379def : ProcessorModel<"pwr5", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000380 [DirectivePwr5, FeatureAltivec, FeatureMFOCRF,
Hal Finkel2e103312013-04-03 04:01:11 +0000381 FeatureFSqrt, FeatureFRE, FeatureFRES,
382 FeatureFRSQRTE, FeatureFRSQRTES,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000383 FeatureSTFIWX, Feature64Bit,
Kit Barton4f79f962015-06-16 16:01:15 +0000384 FeatureMFTB, DeprecatedDST]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000385def : ProcessorModel<"pwr5x", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000386 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
Hal Finkel2e103312013-04-03 04:01:11 +0000387 FeatureFSqrt, FeatureFRE, FeatureFRES,
388 FeatureFRSQRTE, FeatureFRSQRTES,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000389 FeatureSTFIWX, FeatureFPRND, Feature64Bit,
Kit Barton4f79f962015-06-16 16:01:15 +0000390 FeatureMFTB, DeprecatedDST]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000391def : ProcessorModel<"pwr6", G5Model,
Hal Finkelf2b9c382012-06-11 15:43:08 +0000392 [DirectivePwr6, FeatureAltivec,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000393 FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE,
Hal Finkel2e103312013-04-03 04:01:11 +0000394 FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
Hal Finkel4edc66b2015-01-03 01:16:37 +0000395 FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000396 FeatureFPRND, Feature64Bit /*, Feature64BitRegs */,
Kit Barton4f79f962015-06-16 16:01:15 +0000397 FeatureMFTB, DeprecatedDST]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000398def : ProcessorModel<"pwr6x", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000399 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000400 FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
Hal Finkel2e103312013-04-03 04:01:11 +0000401 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
Hal Finkel4edc66b2015-01-03 01:16:37 +0000402 FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000403 FeatureFPRND, Feature64Bit,
Kit Barton4f79f962015-06-16 16:01:15 +0000404 FeatureMFTB, DeprecatedDST]>;
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000405def : ProcessorModel<"pwr7", P7Model, ProcessorFeatures.Power7FeatureList>;
Bill Schmidt279cabb2015-01-25 18:05:42 +0000406def : ProcessorModel<"pwr8", P8Model, ProcessorFeatures.Power8FeatureList>;
Nemanja Ivanovic6e29baf2016-05-09 18:54:58 +0000407// FIXME: Same as P8 until the POWER9 scheduling info is available
408def : ProcessorModel<"pwr9", P8Model, ProcessorFeatures.Power9FeatureList>;
Kit Barton4f79f962015-06-16 16:01:15 +0000409def : Processor<"ppc", G3Itineraries, [Directive32, FeatureMFTB]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000410def : ProcessorModel<"ppc64", G5Model,
Jim Laskey59e7a772006-12-12 20:57:08 +0000411 [Directive64, FeatureAltivec,
Hal Finkel7ac45922013-04-03 14:40:18 +0000412 FeatureMFOCRF, FeatureFSqrt, FeatureFRES,
413 FeatureFRSQRTE, FeatureSTFIWX,
Kit Barton4f79f962015-06-16 16:01:15 +0000414 Feature64Bit /*, Feature64BitRegs */,
415 FeatureMFTB]>;
Bill Schmidt279cabb2015-01-25 18:05:42 +0000416def : ProcessorModel<"ppc64le", P8Model, ProcessorFeatures.Power8FeatureList>;
Jim Laskey74ab9962005-10-19 19:51:16 +0000417
Chris Lattner4f2e4e02007-03-06 00:59:59 +0000418//===----------------------------------------------------------------------===//
419// Calling Conventions
420//===----------------------------------------------------------------------===//
421
422include "PPCCallingConv.td"
423
Chris Lattner51348c52006-03-12 09:13:49 +0000424def PPCInstrInfo : InstrInfo {
Chris Lattner51348c52006-03-12 09:13:49 +0000425 let isLittleEndianEncoding = 1;
Hal Finkel23453472013-12-19 16:13:01 +0000426
427 // FIXME: Unset this when no longer needed!
428 let decodePositionallyEncodedOperands = 1;
Hal Finkel5457bd02014-03-13 07:57:54 +0000429
430 let noNamedPositionallyEncodedOperands = 1;
Chris Lattner51348c52006-03-12 09:13:49 +0000431}
432
Ulrich Weigand640192d2013-05-03 19:49:39 +0000433def PPCAsmParser : AsmParser {
434 let ShouldEmitMatchRegisterName = 0;
435}
436
Ulrich Weigandc0944b52013-07-08 14:49:37 +0000437def PPCAsmParserVariant : AsmParserVariant {
438 int Variant = 0;
439
440 // We do not use hard coded registers in asm strings. However, some
441 // InstAlias definitions use immediate literals. Set RegisterPrefix
442 // so that those are not misinterpreted as registers.
443 string RegisterPrefix = "%";
Colin LeMahieu8a0453e2015-11-09 00:31:07 +0000444 string BreakCharacters = ".";
Ulrich Weigandc0944b52013-07-08 14:49:37 +0000445}
446
Chris Lattner0921e3b2005-10-14 23:37:35 +0000447def PPC : Target {
Chris Lattner51348c52006-03-12 09:13:49 +0000448 // Information about the instructions.
449 let InstructionSet = PPCInstrInfo;
Rafael Espindola50712a42013-12-02 04:55:42 +0000450
Ulrich Weigand640192d2013-05-03 19:49:39 +0000451 let AssemblyParsers = [PPCAsmParser];
Ulrich Weigandc0944b52013-07-08 14:49:37 +0000452 let AssemblyParserVariants = [PPCAsmParserVariant];
Chris Lattner0921e3b2005-10-14 23:37:35 +0000453}