blob: 25160b5c469e8f481eda3bad34d4f591cc5b5e9d [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", "">;
40def DirectiveE5500 : SubtargetFeature<"", "DarwinDirective",
41 "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", "">;
45def DirectivePwr5x: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR5X", "">;
Hal Finkelf2b9c382012-06-11 15:43:08 +000046def DirectivePwr6: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6", "">;
Bill Schmidt52742c22013-02-01 22:59:51 +000047def DirectivePwr6x: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6X", "">;
Hal Finkelf2b9c382012-06-11 15:43:08 +000048def DirectivePwr7: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR7", "">;
Will Schmidt970ff642014-06-26 13:36:19 +000049def DirectivePwr8: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR8", "">;
Jim Laskey59e7a772006-12-12 20:57:08 +000050
Chris Lattnera35f3062006-06-16 17:34:12 +000051def Feature64Bit : SubtargetFeature<"64bit","Has64BitSupport", "true",
Chris Lattner0d4923b2005-10-23 05:28:51 +000052 "Enable 64-bit instructions">;
Chris Lattnera35f3062006-06-16 17:34:12 +000053def Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true",
54 "Enable 64-bit registers usage for ppc32 [beta]">;
Hal Finkel940ab932014-02-28 00:27:01 +000055def FeatureCRBits : SubtargetFeature<"crbits", "UseCRBits", "true",
56 "Use condition-register bits individually">;
Evan Chengd98701c2006-01-27 08:09:42 +000057def FeatureAltivec : SubtargetFeature<"altivec","HasAltivec", "true",
Chris Lattner0d4923b2005-10-23 05:28:51 +000058 "Enable Altivec instructions">;
Joerg Sonnenberger39f095a2014-08-07 12:18:21 +000059def FeatureSPE : SubtargetFeature<"spe","HasSPE", "true",
60 "Enable SPE instructions">;
Hal Finkelbfd3d082012-06-11 19:57:01 +000061def FeatureMFOCRF : SubtargetFeature<"mfocrf","HasMFOCRF", "true",
62 "Enable the MFOCRF instruction">;
Evan Chengd98701c2006-01-27 08:09:42 +000063def FeatureFSqrt : SubtargetFeature<"fsqrt","HasFSQRT", "true",
Hal Finkel49033792011-10-14 18:54:13 +000064 "Enable the fsqrt instruction">;
Hal Finkeldbc78e12013-08-19 05:01:02 +000065def FeatureFCPSGN : SubtargetFeature<"fcpsgn", "HasFCPSGN", "true",
66 "Enable the fcpsgn instruction">;
Hal Finkel2e103312013-04-03 04:01:11 +000067def FeatureFRE : SubtargetFeature<"fre", "HasFRE", "true",
68 "Enable the fre instruction">;
69def FeatureFRES : SubtargetFeature<"fres", "HasFRES", "true",
70 "Enable the fres instruction">;
71def FeatureFRSQRTE : SubtargetFeature<"frsqrte", "HasFRSQRTE", "true",
72 "Enable the frsqrte instruction">;
73def FeatureFRSQRTES : SubtargetFeature<"frsqrtes", "HasFRSQRTES", "true",
74 "Enable the frsqrtes instruction">;
75def FeatureRecipPrec : SubtargetFeature<"recipprec", "HasRecipPrec", "true",
76 "Assume higher precision reciprocal estimates">;
Chris Lattnerb9f35f02006-02-28 07:08:22 +000077def FeatureSTFIWX : SubtargetFeature<"stfiwx","HasSTFIWX", "true",
Hal Finkel49033792011-10-14 18:54:13 +000078 "Enable the stfiwx instruction">;
Hal Finkelbeb296b2013-03-31 10:12:51 +000079def FeatureLFIWAX : SubtargetFeature<"lfiwax","HasLFIWAX", "true",
80 "Enable the lfiwax instruction">;
Hal Finkelc20a08d2013-03-29 08:57:48 +000081def FeatureFPRND : SubtargetFeature<"fprnd", "HasFPRND", "true",
82 "Enable the fri[mnpz] instructions">;
Hal Finkelf6d45f22013-04-01 17:52:07 +000083def FeatureFPCVT : SubtargetFeature<"fpcvt", "HasFPCVT", "true",
84 "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions">;
Hal Finkel460e94d2012-06-22 23:10:08 +000085def FeatureISEL : SubtargetFeature<"isel","HasISEL", "true",
86 "Enable the isel instruction">;
Hal Finkela4d07482013-03-28 13:29:47 +000087def FeaturePOPCNTD : SubtargetFeature<"popcntd","HasPOPCNTD", "true",
88 "Enable the popcnt[dw] instructions">;
Hal Finkel31d29562013-03-28 19:25:55 +000089def FeatureLDBRX : SubtargetFeature<"ldbrx","HasLDBRX", "true",
90 "Enable the ldbrx instruction">;
Hal Finkel4edc66b2015-01-03 01:16:37 +000091def FeatureCMPB : SubtargetFeature<"cmpb", "HasCMPB", "true",
92 "Enable the cmpb instruction">;
Bill Schmidt082cfc02015-01-14 20:17:10 +000093def FeatureICBT : SubtargetFeature<"icbt","HasICBT", "true",
94 "Enable icbt instruction">;
Hal Finkel6fa56972011-10-17 04:03:49 +000095def FeatureBookE : SubtargetFeature<"booke", "IsBookE", "true",
Bill Schmidt082cfc02015-01-14 20:17:10 +000096 "Enable Book E instructions",
97 [FeatureICBT]>;
Hal Finkelfe3368c2014-10-02 22:34:22 +000098def FeatureMSYNC : SubtargetFeature<"msync", "HasOnlyMSYNC", "true",
99 "Has only the msync instruction instead of sync",
100 [FeatureBookE]>;
Joerg Sonnenberger6ae087a2014-08-07 12:31:28 +0000101def FeatureE500 : SubtargetFeature<"e500", "IsE500", "true",
Joerg Sonnenberger0b2ebcb2014-08-04 15:47:38 +0000102 "Enable E500/E500mc instructions">;
103def FeaturePPC4xx : SubtargetFeature<"ppc4xx", "IsPPC4xx", "true",
104 "Enable PPC 4xx instructions">;
Joerg Sonnenberger74052102014-08-04 17:07:41 +0000105def FeaturePPC6xx : SubtargetFeature<"ppc6xx", "IsPPC6xx", "true",
106 "Enable PPC 6xx instructions">;
Hal Finkelefb305e2013-01-30 21:17:42 +0000107def FeatureQPX : SubtargetFeature<"qpx","HasQPX", "true",
108 "Enable QPX instructions">;
Eric Christopher081efcc2013-10-16 20:38:58 +0000109def FeatureVSX : SubtargetFeature<"vsx","HasVSX", "true",
Hal Finkel27774d92014-03-13 07:58:58 +0000110 "Enable VSX instructions",
111 [FeatureAltivec]>;
Bill Schmidtfe88b182015-02-03 21:58:23 +0000112def FeatureP8Altivec : SubtargetFeature<"power8-altivec", "HasP8Altivec", "true",
113 "Enable POWER8 Altivec instructions",
114 [FeatureAltivec]>;
Nemanja Ivanovice8effe12015-03-04 20:44:33 +0000115def FeatureP8Crypto : SubtargetFeature<"crypto", "HasP8Crypto", "true",
Nemanja Ivanovic0adf26b2015-03-10 20:51:07 +0000116 "Enable POWER8 Crypto instructions",
117 [FeatureP8Altivec]>;
NAKAMURA Takumicc4487e2014-12-09 01:03:27 +0000118def FeatureP8Vector : SubtargetFeature<"power8-vector", "HasP8Vector", "true",
119 "Enable POWER8 vector instructions",
Bill Schmidtfe88b182015-02-03 21:58:23 +0000120 [FeatureVSX, FeatureP8Altivec]>;
Nemanja Ivanovic0adf26b2015-03-10 20:51:07 +0000121def FeaturePartwordAtomic : SubtargetFeature<"partword-atomics",
122 "HasPartwordAtomics", "true",
123 "Enable l[bh]arx and st[bh]cx.">;
Hal Finkele2ab0f12015-01-15 21:17:34 +0000124def FeatureInvariantFunctionDescriptors :
125 SubtargetFeature<"invariant-function-descriptors",
126 "HasInvariantFunctionDescriptors", "true",
127 "Assume function descriptors are invariant">;
128
Hal Finkel0096dbd2013-09-12 14:40:06 +0000129def DeprecatedMFTB : SubtargetFeature<"", "DeprecatedMFTB", "true",
130 "Treat mftb as deprecated">;
131def DeprecatedDST : SubtargetFeature<"", "DeprecatedDST", "true",
132 "Treat vector data stream cache control instructions as deprecated">;
133
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000134// Note: Future features to add when support is extended to more
135// recent ISA levels:
136//
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000137// DFP p6, p6x, p7 decimal floating-point instructions
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000138// POPCNTB p5 through p7 popcntb and related instructions
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000139
Jim Laskey74ab9962005-10-19 19:51:16 +0000140//===----------------------------------------------------------------------===//
Hal Finkel654d43b2013-04-12 02:18:09 +0000141// Classes used for relation maps.
142//===----------------------------------------------------------------------===//
143// RecFormRel - Filter class used to relate non-record-form instructions with
144// their record-form variants.
145class RecFormRel;
146
Hal Finkel25e04542014-03-25 18:55:11 +0000147// AltVSXFMARel - Filter class used to relate the primary addend-killing VSX
148// FMA instruction forms with their corresponding factor-killing forms.
149class AltVSXFMARel {
150 bit IsVSXFMAAlt = 0;
151}
152
Hal Finkel654d43b2013-04-12 02:18:09 +0000153//===----------------------------------------------------------------------===//
154// Relation Map Definitions.
155//===----------------------------------------------------------------------===//
156
157def getRecordFormOpcode : InstrMapping {
158 let FilterClass = "RecFormRel";
159 // Instructions with the same BaseName and Interpretation64Bit values
160 // form a row.
161 let RowFields = ["BaseName", "Interpretation64Bit"];
162 // Instructions with the same RC value form a column.
163 let ColFields = ["RC"];
164 // The key column are the non-record-form instructions.
165 let KeyCol = ["0"];
166 // Value columns RC=1
167 let ValueCols = [["1"]];
168}
169
170def getNonRecordFormOpcode : InstrMapping {
171 let FilterClass = "RecFormRel";
172 // Instructions with the same BaseName and Interpretation64Bit values
173 // form a row.
174 let RowFields = ["BaseName", "Interpretation64Bit"];
175 // Instructions with the same RC value form a column.
176 let ColFields = ["RC"];
177 // The key column are the record-form instructions.
178 let KeyCol = ["1"];
179 // Value columns are RC=0
180 let ValueCols = [["0"]];
181}
182
Hal Finkel25e04542014-03-25 18:55:11 +0000183def getAltVSXFMAOpcode : InstrMapping {
184 let FilterClass = "AltVSXFMARel";
185 // Instructions with the same BaseName and Interpretation64Bit values
186 // form a row.
187 let RowFields = ["BaseName"];
188 // Instructions with the same RC value form a column.
189 let ColFields = ["IsVSXFMAAlt"];
190 // The key column are the (default) addend-killing instructions.
191 let KeyCol = ["0"];
192 // Value columns IsVSXFMAAlt=1
193 let ValueCols = [["1"]];
194}
195
Hal Finkel654d43b2013-04-12 02:18:09 +0000196//===----------------------------------------------------------------------===//
Chris Lattnera389f0d2005-10-23 22:08:13 +0000197// Register File Description
198//===----------------------------------------------------------------------===//
199
200include "PPCRegisterInfo.td"
201include "PPCSchedule.td"
202include "PPCInstrInfo.td"
203
204//===----------------------------------------------------------------------===//
205// PowerPC processors supported.
Jim Laskey74ab9962005-10-19 19:51:16 +0000206//
207
Jim Laskey59e7a772006-12-12 20:57:08 +0000208def : Processor<"generic", G3Itineraries, [Directive32]>;
Hal Finkel5a7162f2013-11-29 06:32:17 +0000209def : ProcessorModel<"440", PPC440Model, [Directive440, FeatureISEL,
210 FeatureFRES, FeatureFRSQRTE,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000211 FeatureICBT, FeatureBookE,
212 FeatureMSYNC, DeprecatedMFTB]>;
Hal Finkel5a7162f2013-11-29 06:32:17 +0000213def : ProcessorModel<"450", PPC440Model, [Directive440, FeatureISEL,
214 FeatureFRES, FeatureFRSQRTE,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000215 FeatureICBT, FeatureBookE,
216 FeatureMSYNC, DeprecatedMFTB]>;
Jim Laskey59e7a772006-12-12 20:57:08 +0000217def : Processor<"601", G3Itineraries, [Directive601]>;
218def : Processor<"602", G3Itineraries, [Directive602]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000219def : Processor<"603", G3Itineraries, [Directive603,
220 FeatureFRES, FeatureFRSQRTE]>;
221def : Processor<"603e", G3Itineraries, [Directive603,
222 FeatureFRES, FeatureFRSQRTE]>;
223def : Processor<"603ev", G3Itineraries, [Directive603,
224 FeatureFRES, FeatureFRSQRTE]>;
225def : Processor<"604", G3Itineraries, [Directive604,
226 FeatureFRES, FeatureFRSQRTE]>;
227def : Processor<"604e", G3Itineraries, [Directive604,
228 FeatureFRES, FeatureFRSQRTE]>;
229def : Processor<"620", G3Itineraries, [Directive620,
230 FeatureFRES, FeatureFRSQRTE]>;
231def : Processor<"750", G4Itineraries, [Directive750,
232 FeatureFRES, FeatureFRSQRTE]>;
233def : Processor<"g3", G3Itineraries, [Directive750,
234 FeatureFRES, FeatureFRSQRTE]>;
235def : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec,
236 FeatureFRES, FeatureFRSQRTE]>;
237def : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec,
238 FeatureFRES, FeatureFRSQRTE]>;
239def : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec,
240 FeatureFRES, FeatureFRSQRTE]>;
241def : Processor<"g4+", G4PlusItineraries, [Directive7400, FeatureAltivec,
242 FeatureFRES, FeatureFRSQRTE]>;
Bill Schmidt279cabb2015-01-25 18:05:42 +0000243
244/* Since new processors generally contain a superset of features of those that
245 came before them, the idea is to make implementations of new processors
246 less error prone and easier to read.
247 Namely:
248 list<SubtargetFeature> Power8FeatureList = ...
249 list<SubtargetFeature> FutureProcessorSpecificFeatureList =
250 [ features that Power8 does not support ]
251 list<SubtargetFeature> FutureProcessorFeatureList =
252 !listconcat(Power8FeatureList, FutureProcessorSpecificFeatureList)
253
254 Makes it explicit and obvious what is new in FutureProcesor vs. Power8 as
255 well as providing a single point of definition if the feature set will be
256 used elsewhere.
257
258*/
259def ProcessorFeatures {
260 list<SubtargetFeature> Power8FeatureList =
Bill Schmidtfe88b182015-02-03 21:58:23 +0000261 [DirectivePwr8, FeatureAltivec, FeatureP8Altivec, FeatureVSX,
262 FeatureP8Vector, FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt,
263 FeatureFRE, FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
Bill Schmidt279cabb2015-01-25 18:05:42 +0000264 FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX,
265 FeatureFPRND, FeatureFPCVT, FeatureISEL,
Nemanja Ivanovice8effe12015-03-04 20:44:33 +0000266 FeaturePOPCNTD, FeatureCMPB, FeatureLDBRX, FeatureP8Crypto,
Bill Schmidt279cabb2015-01-25 18:05:42 +0000267 Feature64Bit /*, Feature64BitRegs */, FeatureICBT,
Nemanja Ivanovic0adf26b2015-03-10 20:51:07 +0000268 FeaturePartwordAtomic, DeprecatedMFTB, DeprecatedDST];
Bill Schmidt279cabb2015-01-25 18:05:42 +0000269}
270
Hal Finkel1a958cf2013-04-05 05:49:18 +0000271def : ProcessorModel<"970", G5Model,
Jim Laskey59e7a772006-12-12 20:57:08 +0000272 [Directive970, FeatureAltivec,
Hal Finkel2e103312013-04-03 04:01:11 +0000273 FeatureMFOCRF, FeatureFSqrt,
274 FeatureFRES, FeatureFRSQRTE, FeatureSTFIWX,
Jim Laskey13a19452005-10-22 08:04:24 +0000275 Feature64Bit /*, Feature64BitRegs */]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000276def : ProcessorModel<"g5", G5Model,
Jim Laskey59e7a772006-12-12 20:57:08 +0000277 [Directive970, FeatureAltivec,
Hal Finkelbfd3d082012-06-11 19:57:01 +0000278 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Hal Finkel2e103312013-04-03 04:01:11 +0000279 FeatureFRES, FeatureFRSQRTE,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000280 Feature64Bit /*, Feature64BitRegs */,
281 DeprecatedMFTB, DeprecatedDST]>;
Hal Finkel742b5352012-08-28 16:12:39 +0000282def : ProcessorModel<"e500mc", PPCE500mcModel,
283 [DirectiveE500mc, FeatureMFOCRF,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000284 FeatureSTFIWX, FeatureICBT, FeatureBookE,
285 FeatureISEL, DeprecatedMFTB]>;
Hal Finkel742b5352012-08-28 16:12:39 +0000286def : ProcessorModel<"e5500", PPCE5500Model,
287 [DirectiveE5500, FeatureMFOCRF, Feature64Bit,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000288 FeatureSTFIWX, FeatureICBT, FeatureBookE,
289 FeatureISEL, DeprecatedMFTB]>;
Hal Finkel5fde1b02013-04-05 05:34:08 +0000290def : ProcessorModel<"a2", PPCA2Model,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000291 [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000292 FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
Hal Finkel2e103312013-04-03 04:01:11 +0000293 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
294 FeatureSTFIWX, FeatureLFIWAX,
Hal Finkelf6d45f22013-04-01 17:52:07 +0000295 FeatureFPRND, FeatureFPCVT, FeatureISEL,
Hal Finkel4edc66b2015-01-03 01:16:37 +0000296 FeaturePOPCNTD, FeatureCMPB, FeatureLDBRX, Feature64Bit
Hal Finkel0096dbd2013-09-12 14:40:06 +0000297 /*, Feature64BitRegs */, DeprecatedMFTB]>;
Hal Finkel5fde1b02013-04-05 05:34:08 +0000298def : ProcessorModel<"a2q", PPCA2Model,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000299 [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000300 FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
Hal Finkel2e103312013-04-03 04:01:11 +0000301 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
302 FeatureSTFIWX, FeatureLFIWAX,
Hal Finkelf6d45f22013-04-01 17:52:07 +0000303 FeatureFPRND, FeatureFPCVT, FeatureISEL,
Hal Finkel4edc66b2015-01-03 01:16:37 +0000304 FeaturePOPCNTD, FeatureCMPB, FeatureLDBRX, Feature64Bit
Hal Finkel0096dbd2013-09-12 14:40:06 +0000305 /*, Feature64BitRegs */, FeatureQPX, DeprecatedMFTB]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000306def : ProcessorModel<"pwr3", G5Model,
Hal Finkel2e103312013-04-03 04:01:11 +0000307 [DirectivePwr3, FeatureAltivec,
308 FeatureFRES, FeatureFRSQRTE, FeatureMFOCRF,
Bill Schmidt52742c22013-02-01 22:59:51 +0000309 FeatureSTFIWX, Feature64Bit]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000310def : ProcessorModel<"pwr4", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000311 [DirectivePwr4, FeatureAltivec, FeatureMFOCRF,
Hal Finkel2e103312013-04-03 04:01:11 +0000312 FeatureFSqrt, FeatureFRES, FeatureFRSQRTE,
313 FeatureSTFIWX, Feature64Bit]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000314def : ProcessorModel<"pwr5", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000315 [DirectivePwr5, FeatureAltivec, FeatureMFOCRF,
Hal Finkel2e103312013-04-03 04:01:11 +0000316 FeatureFSqrt, FeatureFRE, FeatureFRES,
317 FeatureFRSQRTE, FeatureFRSQRTES,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000318 FeatureSTFIWX, Feature64Bit,
319 DeprecatedMFTB, DeprecatedDST]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000320def : ProcessorModel<"pwr5x", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000321 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
Hal Finkel2e103312013-04-03 04:01:11 +0000322 FeatureFSqrt, FeatureFRE, FeatureFRES,
323 FeatureFRSQRTE, FeatureFRSQRTES,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000324 FeatureSTFIWX, FeatureFPRND, Feature64Bit,
325 DeprecatedMFTB, DeprecatedDST]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000326def : ProcessorModel<"pwr6", G5Model,
Hal Finkelf2b9c382012-06-11 15:43:08 +0000327 [DirectivePwr6, FeatureAltivec,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000328 FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE,
Hal Finkel2e103312013-04-03 04:01:11 +0000329 FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
Hal Finkel4edc66b2015-01-03 01:16:37 +0000330 FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000331 FeatureFPRND, Feature64Bit /*, Feature64BitRegs */,
332 DeprecatedMFTB, DeprecatedDST]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000333def : ProcessorModel<"pwr6x", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000334 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000335 FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
Hal Finkel2e103312013-04-03 04:01:11 +0000336 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
Hal Finkel4edc66b2015-01-03 01:16:37 +0000337 FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000338 FeatureFPRND, Feature64Bit,
339 DeprecatedMFTB, DeprecatedDST]>;
Hal Finkel42daeae2013-11-30 20:55:12 +0000340def : ProcessorModel<"pwr7", P7Model,
Bill Schmidt09135002014-12-09 03:02:48 +0000341 [DirectivePwr7, FeatureAltivec, FeatureVSX,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000342 FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE,
Hal Finkel2e103312013-04-03 04:01:11 +0000343 FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
344 FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX,
345 FeatureFPRND, FeatureFPCVT, FeatureISEL,
Hal Finkel4edc66b2015-01-03 01:16:37 +0000346 FeaturePOPCNTD, FeatureCMPB, FeatureLDBRX,
Nemanja Ivanovic0adf26b2015-03-10 20:51:07 +0000347 Feature64Bit /*, Feature64BitRegs */, FeaturePartwordAtomic,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000348 DeprecatedMFTB, DeprecatedDST]>;
Bill Schmidt279cabb2015-01-25 18:05:42 +0000349def : ProcessorModel<"pwr8", P8Model, ProcessorFeatures.Power8FeatureList>;
Jim Laskey59e7a772006-12-12 20:57:08 +0000350def : Processor<"ppc", G3Itineraries, [Directive32]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000351def : ProcessorModel<"ppc64", G5Model,
Jim Laskey59e7a772006-12-12 20:57:08 +0000352 [Directive64, FeatureAltivec,
Hal Finkel7ac45922013-04-03 14:40:18 +0000353 FeatureMFOCRF, FeatureFSqrt, FeatureFRES,
354 FeatureFRSQRTE, FeatureSTFIWX,
Jim Laskey13a19452005-10-22 08:04:24 +0000355 Feature64Bit /*, Feature64BitRegs */]>;
Bill Schmidt279cabb2015-01-25 18:05:42 +0000356def : ProcessorModel<"ppc64le", P8Model, ProcessorFeatures.Power8FeatureList>;
Jim Laskey74ab9962005-10-19 19:51:16 +0000357
Chris Lattner4f2e4e02007-03-06 00:59:59 +0000358//===----------------------------------------------------------------------===//
359// Calling Conventions
360//===----------------------------------------------------------------------===//
361
362include "PPCCallingConv.td"
363
Chris Lattner51348c52006-03-12 09:13:49 +0000364def PPCInstrInfo : InstrInfo {
Chris Lattner51348c52006-03-12 09:13:49 +0000365 let isLittleEndianEncoding = 1;
Hal Finkel23453472013-12-19 16:13:01 +0000366
367 // FIXME: Unset this when no longer needed!
368 let decodePositionallyEncodedOperands = 1;
Hal Finkel5457bd02014-03-13 07:57:54 +0000369
370 let noNamedPositionallyEncodedOperands = 1;
Chris Lattner51348c52006-03-12 09:13:49 +0000371}
372
Ulrich Weigand640192d2013-05-03 19:49:39 +0000373def PPCAsmParser : AsmParser {
374 let ShouldEmitMatchRegisterName = 0;
375}
376
Ulrich Weigandc0944b52013-07-08 14:49:37 +0000377def PPCAsmParserVariant : AsmParserVariant {
378 int Variant = 0;
379
380 // We do not use hard coded registers in asm strings. However, some
381 // InstAlias definitions use immediate literals. Set RegisterPrefix
382 // so that those are not misinterpreted as registers.
383 string RegisterPrefix = "%";
384}
385
Chris Lattner0921e3b2005-10-14 23:37:35 +0000386def PPC : Target {
Chris Lattner51348c52006-03-12 09:13:49 +0000387 // Information about the instructions.
388 let InstructionSet = PPCInstrInfo;
Rafael Espindola50712a42013-12-02 04:55:42 +0000389
Ulrich Weigand640192d2013-05-03 19:49:39 +0000390 let AssemblyParsers = [PPCAsmParser];
Ulrich Weigandc0944b52013-07-08 14:49:37 +0000391 let AssemblyParserVariants = [PPCAsmParserVariant];
Chris Lattner0921e3b2005-10-14 23:37:35 +0000392}