blob: 98e6e98e69744a9e04f564b4b4e7ed3b440cf443 [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", "">;
Justin Hibbitsceb3cd92018-07-18 04:24:49 +000038def DirectiveE500 : SubtargetFeature<"", "DarwinDirective",
39 "PPC::DIR_E500", "">;
Hal Finkel742b5352012-08-28 16:12:39 +000040def DirectiveE500mc : SubtargetFeature<"", "DarwinDirective",
41 "PPC::DIR_E500mc", "">;
Eric Christopher47d372f2016-06-23 01:33:38 +000042def DirectiveE5500 : SubtargetFeature<"", "DarwinDirective",
Hal Finkel742b5352012-08-28 16:12:39 +000043 "PPC::DIR_E5500", "">;
Bill Schmidt52742c22013-02-01 22:59:51 +000044def DirectivePwr3: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR3", "">;
45def DirectivePwr4: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR4", "">;
46def DirectivePwr5: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR5", "">;
Eric Christopher47d372f2016-06-23 01:33:38 +000047def DirectivePwr5x
48 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR5X", "">;
Hal Finkelf2b9c382012-06-11 15:43:08 +000049def DirectivePwr6: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6", "">;
Eric Christopher47d372f2016-06-23 01:33:38 +000050def DirectivePwr6x
51 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6X", "">;
Hal Finkelf2b9c382012-06-11 15:43:08 +000052def DirectivePwr7: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR7", "">;
Will Schmidt970ff642014-06-26 13:36:19 +000053def DirectivePwr8: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR8", "">;
Nemanja Ivanovic6e29baf2016-05-09 18:54:58 +000054def DirectivePwr9: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR9", "">;
Jim Laskey59e7a772006-12-12 20:57:08 +000055
Chris Lattnera35f3062006-06-16 17:34:12 +000056def Feature64Bit : SubtargetFeature<"64bit","Has64BitSupport", "true",
Chris Lattner0d4923b2005-10-23 05:28:51 +000057 "Enable 64-bit instructions">;
Hal Finkela9321052016-10-02 02:10:20 +000058def FeatureHardFloat : SubtargetFeature<"hard-float", "HasHardFloat", "true",
59 "Enable floating-point instructions">;
Chris Lattnera35f3062006-06-16 17:34:12 +000060def Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true",
61 "Enable 64-bit registers usage for ppc32 [beta]">;
Hal Finkel940ab932014-02-28 00:27:01 +000062def FeatureCRBits : SubtargetFeature<"crbits", "UseCRBits", "true",
63 "Use condition-register bits individually">;
Justin Hibbitsd52990c2018-07-18 04:25:10 +000064def FeatureFPU : SubtargetFeature<"fpu","HasFPU","true",
65 "Enable classic FPU instructions",
66 [FeatureHardFloat]>;
Evan Chengd98701c2006-01-27 08:09:42 +000067def FeatureAltivec : SubtargetFeature<"altivec","HasAltivec", "true",
Hal Finkela9321052016-10-02 02:10:20 +000068 "Enable Altivec instructions",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000069 [FeatureFPU]>;
Joerg Sonnenberger39f095a2014-08-07 12:18:21 +000070def FeatureSPE : SubtargetFeature<"spe","HasSPE", "true",
Hal Finkela9321052016-10-02 02:10:20 +000071 "Enable SPE instructions",
72 [FeatureHardFloat]>;
Hal Finkelbfd3d082012-06-11 19:57:01 +000073def FeatureMFOCRF : SubtargetFeature<"mfocrf","HasMFOCRF", "true",
74 "Enable the MFOCRF instruction">;
Evan Chengd98701c2006-01-27 08:09:42 +000075def FeatureFSqrt : SubtargetFeature<"fsqrt","HasFSQRT", "true",
Hal Finkela9321052016-10-02 02:10:20 +000076 "Enable the fsqrt instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000077 [FeatureFPU]>;
Hal Finkeldbc78e12013-08-19 05:01:02 +000078def FeatureFCPSGN : SubtargetFeature<"fcpsgn", "HasFCPSGN", "true",
Hal Finkela9321052016-10-02 02:10:20 +000079 "Enable the fcpsgn instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000080 [FeatureFPU]>;
Hal Finkel2e103312013-04-03 04:01:11 +000081def FeatureFRE : SubtargetFeature<"fre", "HasFRE", "true",
Hal Finkela9321052016-10-02 02:10:20 +000082 "Enable the fre instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000083 [FeatureFPU]>;
Hal Finkel2e103312013-04-03 04:01:11 +000084def FeatureFRES : SubtargetFeature<"fres", "HasFRES", "true",
Hal Finkela9321052016-10-02 02:10:20 +000085 "Enable the fres instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000086 [FeatureFPU]>;
Hal Finkel2e103312013-04-03 04:01:11 +000087def FeatureFRSQRTE : SubtargetFeature<"frsqrte", "HasFRSQRTE", "true",
Hal Finkela9321052016-10-02 02:10:20 +000088 "Enable the frsqrte instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000089 [FeatureFPU]>;
Hal Finkel2e103312013-04-03 04:01:11 +000090def FeatureFRSQRTES : SubtargetFeature<"frsqrtes", "HasFRSQRTES", "true",
Hal Finkela9321052016-10-02 02:10:20 +000091 "Enable the frsqrtes instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000092 [FeatureFPU]>;
Hal Finkel2e103312013-04-03 04:01:11 +000093def FeatureRecipPrec : SubtargetFeature<"recipprec", "HasRecipPrec", "true",
94 "Assume higher precision reciprocal estimates">;
Chris Lattnerb9f35f02006-02-28 07:08:22 +000095def FeatureSTFIWX : SubtargetFeature<"stfiwx","HasSTFIWX", "true",
Hal Finkela9321052016-10-02 02:10:20 +000096 "Enable the stfiwx instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000097 [FeatureFPU]>;
Hal Finkelbeb296b2013-03-31 10:12:51 +000098def FeatureLFIWAX : SubtargetFeature<"lfiwax","HasLFIWAX", "true",
Hal Finkela9321052016-10-02 02:10:20 +000099 "Enable the lfiwax instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +0000100 [FeatureFPU]>;
Hal Finkelc20a08d2013-03-29 08:57:48 +0000101def FeatureFPRND : SubtargetFeature<"fprnd", "HasFPRND", "true",
Hal Finkela9321052016-10-02 02:10:20 +0000102 "Enable the fri[mnpz] instructions",
Justin Hibbitsd52990c2018-07-18 04:25:10 +0000103 [FeatureFPU]>;
Hal Finkelf6d45f22013-04-01 17:52:07 +0000104def FeatureFPCVT : SubtargetFeature<"fpcvt", "HasFPCVT", "true",
Hal Finkela9321052016-10-02 02:10:20 +0000105 "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions",
Justin Hibbitsd52990c2018-07-18 04:25:10 +0000106 [FeatureFPU]>;
Hal Finkel460e94d2012-06-22 23:10:08 +0000107def FeatureISEL : SubtargetFeature<"isel","HasISEL", "true",
108 "Enable the isel instruction">;
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000109def FeatureBPERMD : SubtargetFeature<"bpermd", "HasBPERMD", "true",
110 "Enable the bpermd instruction">;
111def FeatureExtDiv : SubtargetFeature<"extdiv", "HasExtDiv", "true",
112 "Enable extended divide instructions">;
Hal Finkel31d29562013-03-28 19:25:55 +0000113def FeatureLDBRX : SubtargetFeature<"ldbrx","HasLDBRX", "true",
114 "Enable the ldbrx instruction">;
Hal Finkel4edc66b2015-01-03 01:16:37 +0000115def FeatureCMPB : SubtargetFeature<"cmpb", "HasCMPB", "true",
116 "Enable the cmpb instruction">;
Bill Schmidt082cfc02015-01-14 20:17:10 +0000117def FeatureICBT : SubtargetFeature<"icbt","HasICBT", "true",
118 "Enable icbt instruction">;
Hal Finkel6fa56972011-10-17 04:03:49 +0000119def FeatureBookE : SubtargetFeature<"booke", "IsBookE", "true",
Bill Schmidt082cfc02015-01-14 20:17:10 +0000120 "Enable Book E instructions",
121 [FeatureICBT]>;
Hal Finkelfe3368c2014-10-02 22:34:22 +0000122def FeatureMSYNC : SubtargetFeature<"msync", "HasOnlyMSYNC", "true",
123 "Has only the msync instruction instead of sync",
124 [FeatureBookE]>;
Joerg Sonnenberger6ae087a2014-08-07 12:31:28 +0000125def FeatureE500 : SubtargetFeature<"e500", "IsE500", "true",
Joerg Sonnenberger0b2ebcb2014-08-04 15:47:38 +0000126 "Enable E500/E500mc instructions">;
Strahinja Petrovic06cf6a62018-03-27 11:23:53 +0000127def FeatureSecurePlt : SubtargetFeature<"secure-plt","SecurePlt", "true",
128 "Enable secure plt mode">;
Joerg Sonnenberger0b2ebcb2014-08-04 15:47:38 +0000129def FeaturePPC4xx : SubtargetFeature<"ppc4xx", "IsPPC4xx", "true",
130 "Enable PPC 4xx instructions">;
Joerg Sonnenberger74052102014-08-04 17:07:41 +0000131def FeaturePPC6xx : SubtargetFeature<"ppc6xx", "IsPPC6xx", "true",
132 "Enable PPC 6xx instructions">;
Hal Finkelefb305e2013-01-30 21:17:42 +0000133def FeatureQPX : SubtargetFeature<"qpx","HasQPX", "true",
Hal Finkela9321052016-10-02 02:10:20 +0000134 "Enable QPX instructions",
Justin Hibbitsd52990c2018-07-18 04:25:10 +0000135 [FeatureFPU]>;
Eric Christopher081efcc2013-10-16 20:38:58 +0000136def FeatureVSX : SubtargetFeature<"vsx","HasVSX", "true",
Hal Finkel27774d92014-03-13 07:58:58 +0000137 "Enable VSX instructions",
138 [FeatureAltivec]>;
Bill Schmidtfe88b182015-02-03 21:58:23 +0000139def FeatureP8Altivec : SubtargetFeature<"power8-altivec", "HasP8Altivec", "true",
140 "Enable POWER8 Altivec instructions",
141 [FeatureAltivec]>;
Nemanja Ivanovice8effe12015-03-04 20:44:33 +0000142def FeatureP8Crypto : SubtargetFeature<"crypto", "HasP8Crypto", "true",
Nemanja Ivanovic0adf26b2015-03-10 20:51:07 +0000143 "Enable POWER8 Crypto instructions",
144 [FeatureP8Altivec]>;
NAKAMURA Takumicc4487e2014-12-09 01:03:27 +0000145def FeatureP8Vector : SubtargetFeature<"power8-vector", "HasP8Vector", "true",
146 "Enable POWER8 vector instructions",
Bill Schmidtfe88b182015-02-03 21:58:23 +0000147 [FeatureVSX, FeatureP8Altivec]>;
Nemanja Ivanovicc38b5312015-04-11 10:40:42 +0000148def FeatureDirectMove :
149 SubtargetFeature<"direct-move", "HasDirectMove", "true",
150 "Enable Power8 direct move instructions",
151 [FeatureVSX]>;
Nemanja Ivanovic0adf26b2015-03-10 20:51:07 +0000152def FeaturePartwordAtomic : SubtargetFeature<"partword-atomics",
153 "HasPartwordAtomics", "true",
154 "Enable l[bh]arx and st[bh]cx.">;
Hal Finkele2ab0f12015-01-15 21:17:34 +0000155def FeatureInvariantFunctionDescriptors :
156 SubtargetFeature<"invariant-function-descriptors",
157 "HasInvariantFunctionDescriptors", "true",
158 "Assume function descriptors are invariant">;
Hal Finkelb074a602016-08-30 00:59:23 +0000159def FeatureLongCall : SubtargetFeature<"longcall", "UseLongCalls", "true",
160 "Always use indirect calls">;
Kit Barton535e69d2015-03-25 19:36:23 +0000161def FeatureHTM : SubtargetFeature<"htm", "HasHTM", "true",
162 "Enable Hardware Transactional Memory instructions">;
Kit Barton4f79f962015-06-16 16:01:15 +0000163def FeatureMFTB : SubtargetFeature<"", "FeatureMFTB", "true",
164 "Implement mftb using the mfspr instruction">;
Eric Christopher25bf4a82015-11-20 22:38:20 +0000165def FeatureFusion : SubtargetFeature<"fusion", "HasFusion", "true",
166 "Target supports add/load integer fusion.">;
Nemanja Ivanovicb033f672015-12-15 12:19:34 +0000167def FeatureFloat128 :
168 SubtargetFeature<"float128", "HasFloat128", "true",
169 "Enable the __float128 data type for IEEE-754R Binary128.",
170 [FeatureVSX]>;
Hal Finkelfa7057a2016-03-29 01:36:01 +0000171def FeaturePOPCNTD : SubtargetFeature<"popcntd","HasPOPCNTD",
172 "POPCNTD_Fast",
173 "Enable the popcnt[dw] instructions">;
Hal Finkel7059d412016-03-28 17:52:08 +0000174// Note that for the a2/a2q processor models we should not use popcnt[dw] by
175// default. These processors do support the instructions, but they're
176// microcoded, and the software emulation is about twice as fast.
Hal Finkelfa7057a2016-03-29 01:36:01 +0000177def FeatureSlowPOPCNTD : SubtargetFeature<"slow-popcntd","HasPOPCNTD",
178 "POPCNTD_Slow",
179 "Has slow popcnt[dw] instructions">;
180
181def DeprecatedDST : SubtargetFeature<"", "DeprecatedDST", "true",
182 "Treat vector data stream cache control instructions as deprecated">;
Hal Finkel7059d412016-03-28 17:52:08 +0000183
Nemanja Ivanovica621a7f2016-03-31 15:26:37 +0000184def FeatureISA3_0 : SubtargetFeature<"isa-v30-instructions", "IsISA3_0",
185 "true",
186 "Enable instructions added in ISA 3.0.">;
Nemanja Ivanovic87bcae32016-04-13 18:51:18 +0000187def FeatureP9Altivec : SubtargetFeature<"power9-altivec", "HasP9Altivec", "true",
188 "Enable POWER9 Altivec instructions",
189 [FeatureISA3_0, FeatureP8Altivec]>;
190def FeatureP9Vector : SubtargetFeature<"power9-vector", "HasP9Vector", "true",
191 "Enable POWER9 vector instructions",
192 [FeatureISA3_0, FeatureP8Vector,
193 FeatureP9Altivec]>;
Nemanja Ivanovica621a7f2016-03-31 15:26:37 +0000194
Eric Christopher47d372f2016-06-23 01:33:38 +0000195// Since new processors generally contain a superset of features of those that
196// came before them, the idea is to make implementations of new processors
197// less error prone and easier to read.
198// Namely:
199// list<SubtargetFeature> Power8FeatureList = ...
200// list<SubtargetFeature> FutureProcessorSpecificFeatureList =
201// [ features that Power8 does not support ]
202// list<SubtargetFeature> FutureProcessorFeatureList =
203// !listconcat(Power8FeatureList, FutureProcessorSpecificFeatureList)
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000204
Eric Christopher47d372f2016-06-23 01:33:38 +0000205// Makes it explicit and obvious what is new in FutureProcesor vs. Power8 as
206// well as providing a single point of definition if the feature set will be
207// used elsewhere.
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000208def ProcessorFeatures {
209 list<SubtargetFeature> Power7FeatureList =
210 [DirectivePwr7, FeatureAltivec, FeatureVSX,
211 FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE,
212 FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
213 FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX,
214 FeatureFPRND, FeatureFPCVT, FeatureISEL,
215 FeaturePOPCNTD, FeatureCMPB, FeatureLDBRX,
Hal Finkel58f5f9c2015-04-11 13:40:36 +0000216 Feature64Bit /*, Feature64BitRegs */,
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000217 FeatureBPERMD, FeatureExtDiv,
Kit Barton4f79f962015-06-16 16:01:15 +0000218 FeatureMFTB, DeprecatedDST];
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000219 list<SubtargetFeature> Power8SpecificFeatures =
220 [DirectivePwr8, FeatureP8Altivec, FeatureP8Vector, FeatureP8Crypto,
Eric Christopher25bf4a82015-11-20 22:38:20 +0000221 FeatureHTM, FeatureDirectMove, FeatureICBT, FeaturePartwordAtomic,
222 FeatureFusion];
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000223 list<SubtargetFeature> Power8FeatureList =
224 !listconcat(Power7FeatureList, Power8SpecificFeatures);
Nemanja Ivanovic87bcae32016-04-13 18:51:18 +0000225 list<SubtargetFeature> Power9SpecificFeatures =
Nemanja Ivanovica103d102016-09-14 14:09:39 +0000226 [DirectivePwr9, FeatureP9Altivec, FeatureP9Vector, FeatureISA3_0];
Nemanja Ivanovic6e29baf2016-05-09 18:54:58 +0000227 list<SubtargetFeature> Power9FeatureList =
228 !listconcat(Power8FeatureList, Power9SpecificFeatures);
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000229}
230
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000231// Note: Future features to add when support is extended to more
232// recent ISA levels:
233//
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000234// DFP p6, p6x, p7 decimal floating-point instructions
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000235// POPCNTB p5 through p7 popcntb and related instructions
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000236
Jim Laskey74ab9962005-10-19 19:51:16 +0000237//===----------------------------------------------------------------------===//
Hal Finkel654d43b2013-04-12 02:18:09 +0000238// Classes used for relation maps.
239//===----------------------------------------------------------------------===//
240// RecFormRel - Filter class used to relate non-record-form instructions with
241// their record-form variants.
242class RecFormRel;
243
Hal Finkel25e04542014-03-25 18:55:11 +0000244// AltVSXFMARel - Filter class used to relate the primary addend-killing VSX
245// FMA instruction forms with their corresponding factor-killing forms.
246class AltVSXFMARel {
247 bit IsVSXFMAAlt = 0;
248}
249
Hal Finkel654d43b2013-04-12 02:18:09 +0000250//===----------------------------------------------------------------------===//
251// Relation Map Definitions.
252//===----------------------------------------------------------------------===//
253
254def getRecordFormOpcode : InstrMapping {
255 let FilterClass = "RecFormRel";
256 // Instructions with the same BaseName and Interpretation64Bit values
257 // form a row.
258 let RowFields = ["BaseName", "Interpretation64Bit"];
259 // Instructions with the same RC value form a column.
260 let ColFields = ["RC"];
261 // The key column are the non-record-form instructions.
262 let KeyCol = ["0"];
263 // Value columns RC=1
264 let ValueCols = [["1"]];
265}
266
267def getNonRecordFormOpcode : InstrMapping {
268 let FilterClass = "RecFormRel";
269 // Instructions with the same BaseName and Interpretation64Bit values
270 // form a row.
271 let RowFields = ["BaseName", "Interpretation64Bit"];
272 // Instructions with the same RC value form a column.
273 let ColFields = ["RC"];
274 // The key column are the record-form instructions.
275 let KeyCol = ["1"];
276 // Value columns are RC=0
277 let ValueCols = [["0"]];
278}
279
Hal Finkel25e04542014-03-25 18:55:11 +0000280def getAltVSXFMAOpcode : InstrMapping {
281 let FilterClass = "AltVSXFMARel";
282 // Instructions with the same BaseName and Interpretation64Bit values
283 // form a row.
284 let RowFields = ["BaseName"];
285 // Instructions with the same RC value form a column.
286 let ColFields = ["IsVSXFMAAlt"];
287 // The key column are the (default) addend-killing instructions.
288 let KeyCol = ["0"];
289 // Value columns IsVSXFMAAlt=1
290 let ValueCols = [["1"]];
291}
292
Hal Finkel654d43b2013-04-12 02:18:09 +0000293//===----------------------------------------------------------------------===//
Chris Lattnera389f0d2005-10-23 22:08:13 +0000294// Register File Description
295//===----------------------------------------------------------------------===//
296
297include "PPCRegisterInfo.td"
298include "PPCSchedule.td"
Chris Lattnera389f0d2005-10-23 22:08:13 +0000299
300//===----------------------------------------------------------------------===//
301// PowerPC processors supported.
Jim Laskey74ab9962005-10-19 19:51:16 +0000302//
303
Hal Finkela9321052016-10-02 02:10:20 +0000304def : Processor<"generic", G3Itineraries, [Directive32, FeatureHardFloat,
305 FeatureMFTB]>;
Hal Finkel5a7162f2013-11-29 06:32:17 +0000306def : ProcessorModel<"440", PPC440Model, [Directive440, FeatureISEL,
307 FeatureFRES, FeatureFRSQRTE,
Clement Courbeteee2e062018-11-09 13:15:32 +0000308 FeatureICBT, FeatureBookE,
Kit Barton4f79f962015-06-16 16:01:15 +0000309 FeatureMSYNC, FeatureMFTB]>;
Hal Finkel5a7162f2013-11-29 06:32:17 +0000310def : ProcessorModel<"450", PPC440Model, [Directive440, FeatureISEL,
311 FeatureFRES, FeatureFRSQRTE,
Clement Courbeteee2e062018-11-09 13:15:32 +0000312 FeatureICBT, FeatureBookE,
Kit Barton4f79f962015-06-16 16:01:15 +0000313 FeatureMSYNC, FeatureMFTB]>;
Justin Hibbitsd52990c2018-07-18 04:25:10 +0000314def : Processor<"601", G3Itineraries, [Directive601, FeatureFPU]>;
315def : Processor<"602", G3Itineraries, [Directive602, FeatureFPU,
Kit Barton4f79f962015-06-16 16:01:15 +0000316 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000317def : Processor<"603", G3Itineraries, [Directive603,
Kit Barton4f79f962015-06-16 16:01:15 +0000318 FeatureFRES, FeatureFRSQRTE,
319 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000320def : Processor<"603e", G3Itineraries, [Directive603,
Kit Barton4f79f962015-06-16 16:01:15 +0000321 FeatureFRES, FeatureFRSQRTE,
322 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000323def : Processor<"603ev", G3Itineraries, [Directive603,
Kit Barton4f79f962015-06-16 16:01:15 +0000324 FeatureFRES, FeatureFRSQRTE,
325 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000326def : Processor<"604", G3Itineraries, [Directive604,
Kit Barton4f79f962015-06-16 16:01:15 +0000327 FeatureFRES, FeatureFRSQRTE,
328 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000329def : Processor<"604e", G3Itineraries, [Directive604,
Kit Barton4f79f962015-06-16 16:01:15 +0000330 FeatureFRES, FeatureFRSQRTE,
331 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000332def : Processor<"620", G3Itineraries, [Directive620,
Kit Barton4f79f962015-06-16 16:01:15 +0000333 FeatureFRES, FeatureFRSQRTE,
334 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000335def : Processor<"750", G4Itineraries, [Directive750,
Kit Barton4f79f962015-06-16 16:01:15 +0000336 FeatureFRES, FeatureFRSQRTE,
337 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000338def : Processor<"g3", G3Itineraries, [Directive750,
Kit Barton4f79f962015-06-16 16:01:15 +0000339 FeatureFRES, FeatureFRSQRTE,
340 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000341def : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec,
Kit Barton4f79f962015-06-16 16:01:15 +0000342 FeatureFRES, FeatureFRSQRTE,
343 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000344def : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec,
Kit Barton4f79f962015-06-16 16:01:15 +0000345 FeatureFRES, FeatureFRSQRTE,
346 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000347def : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec,
Kit Barton4f79f962015-06-16 16:01:15 +0000348 FeatureFRES, FeatureFRSQRTE,
349 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000350def : Processor<"g4+", G4PlusItineraries, [Directive7400, FeatureAltivec,
Clement Courbeteee2e062018-11-09 13:15:32 +0000351 FeatureFRES, FeatureFRSQRTE,
Kit Barton4f79f962015-06-16 16:01:15 +0000352 FeatureMFTB]>;
Bill Schmidt279cabb2015-01-25 18:05:42 +0000353
Hal Finkel1a958cf2013-04-05 05:49:18 +0000354def : ProcessorModel<"970", G5Model,
Jim Laskey59e7a772006-12-12 20:57:08 +0000355 [Directive970, FeatureAltivec,
Hal Finkel2e103312013-04-03 04:01:11 +0000356 FeatureMFOCRF, FeatureFSqrt,
357 FeatureFRES, FeatureFRSQRTE, FeatureSTFIWX,
Kit Barton4f79f962015-06-16 16:01:15 +0000358 Feature64Bit /*, Feature64BitRegs */,
359 FeatureMFTB]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000360def : ProcessorModel<"g5", G5Model,
Jim Laskey59e7a772006-12-12 20:57:08 +0000361 [Directive970, FeatureAltivec,
Hal Finkelbfd3d082012-06-11 19:57:01 +0000362 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Hal Finkel2e103312013-04-03 04:01:11 +0000363 FeatureFRES, FeatureFRSQRTE,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000364 Feature64Bit /*, Feature64BitRegs */,
Kit Barton4f79f962015-06-16 16:01:15 +0000365 FeatureMFTB, DeprecatedDST]>;
Justin Hibbitsceb3cd92018-07-18 04:24:49 +0000366def : ProcessorModel<"e500", PPCE500Model,
367 [DirectiveE500,
368 FeatureICBT, FeatureBookE,
369 FeatureISEL, FeatureMFTB]>;
Hal Finkel742b5352012-08-28 16:12:39 +0000370def : ProcessorModel<"e500mc", PPCE500mcModel,
Hal Finkel005f8402015-11-25 10:14:31 +0000371 [DirectiveE500mc,
Clement Courbeteee2e062018-11-09 13:15:32 +0000372 FeatureSTFIWX, FeatureICBT, FeatureBookE,
Kit Barton4f79f962015-06-16 16:01:15 +0000373 FeatureISEL, FeatureMFTB]>;
Hal Finkel742b5352012-08-28 16:12:39 +0000374def : ProcessorModel<"e5500", PPCE5500Model,
375 [DirectiveE5500, FeatureMFOCRF, Feature64Bit,
Clement Courbeteee2e062018-11-09 13:15:32 +0000376 FeatureSTFIWX, FeatureICBT, FeatureBookE,
Kit Barton4f79f962015-06-16 16:01:15 +0000377 FeatureISEL, FeatureMFTB]>;
Hal Finkel5fde1b02013-04-05 05:34:08 +0000378def : ProcessorModel<"a2", PPCA2Model,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000379 [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000380 FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
Hal Finkel2e103312013-04-03 04:01:11 +0000381 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
382 FeatureSTFIWX, FeatureLFIWAX,
Hal Finkelf6d45f22013-04-01 17:52:07 +0000383 FeatureFPRND, FeatureFPCVT, FeatureISEL,
Hal Finkelfa7057a2016-03-29 01:36:01 +0000384 FeatureSlowPOPCNTD, FeatureCMPB, FeatureLDBRX,
Hal Finkel7059d412016-03-28 17:52:08 +0000385 Feature64Bit /*, Feature64BitRegs */, FeatureMFTB]>;
Hal Finkel5fde1b02013-04-05 05:34:08 +0000386def : ProcessorModel<"a2q", PPCA2Model,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000387 [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000388 FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
Hal Finkel2e103312013-04-03 04:01:11 +0000389 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
390 FeatureSTFIWX, FeatureLFIWAX,
Hal Finkelf6d45f22013-04-01 17:52:07 +0000391 FeatureFPRND, FeatureFPCVT, FeatureISEL,
Hal Finkelfa7057a2016-03-29 01:36:01 +0000392 FeatureSlowPOPCNTD, FeatureCMPB, FeatureLDBRX,
Hal Finkel7059d412016-03-28 17:52:08 +0000393 Feature64Bit /*, Feature64BitRegs */, FeatureQPX,
394 FeatureMFTB]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000395def : ProcessorModel<"pwr3", G5Model,
Hal Finkel2e103312013-04-03 04:01:11 +0000396 [DirectivePwr3, FeatureAltivec,
397 FeatureFRES, FeatureFRSQRTE, FeatureMFOCRF,
Bill Schmidt52742c22013-02-01 22:59:51 +0000398 FeatureSTFIWX, Feature64Bit]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000399def : ProcessorModel<"pwr4", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000400 [DirectivePwr4, FeatureAltivec, FeatureMFOCRF,
Hal Finkel2e103312013-04-03 04:01:11 +0000401 FeatureFSqrt, FeatureFRES, FeatureFRSQRTE,
Kit Barton4f79f962015-06-16 16:01:15 +0000402 FeatureSTFIWX, Feature64Bit, FeatureMFTB]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000403def : ProcessorModel<"pwr5", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000404 [DirectivePwr5, FeatureAltivec, FeatureMFOCRF,
Hal Finkel2e103312013-04-03 04:01:11 +0000405 FeatureFSqrt, FeatureFRE, FeatureFRES,
406 FeatureFRSQRTE, FeatureFRSQRTES,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000407 FeatureSTFIWX, Feature64Bit,
Kit Barton4f79f962015-06-16 16:01:15 +0000408 FeatureMFTB, DeprecatedDST]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000409def : ProcessorModel<"pwr5x", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000410 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
Hal Finkel2e103312013-04-03 04:01:11 +0000411 FeatureFSqrt, FeatureFRE, FeatureFRES,
412 FeatureFRSQRTE, FeatureFRSQRTES,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000413 FeatureSTFIWX, FeatureFPRND, Feature64Bit,
Kit Barton4f79f962015-06-16 16:01:15 +0000414 FeatureMFTB, DeprecatedDST]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000415def : ProcessorModel<"pwr6", G5Model,
Hal Finkelf2b9c382012-06-11 15:43:08 +0000416 [DirectivePwr6, FeatureAltivec,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000417 FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE,
Hal Finkel2e103312013-04-03 04:01:11 +0000418 FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
Hal Finkel4edc66b2015-01-03 01:16:37 +0000419 FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000420 FeatureFPRND, Feature64Bit /*, Feature64BitRegs */,
Kit Barton4f79f962015-06-16 16:01:15 +0000421 FeatureMFTB, DeprecatedDST]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000422def : ProcessorModel<"pwr6x", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000423 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000424 FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
Hal Finkel2e103312013-04-03 04:01:11 +0000425 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
Hal Finkel4edc66b2015-01-03 01:16:37 +0000426 FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000427 FeatureFPRND, Feature64Bit,
Kit Barton4f79f962015-06-16 16:01:15 +0000428 FeatureMFTB, DeprecatedDST]>;
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000429def : ProcessorModel<"pwr7", P7Model, ProcessorFeatures.Power7FeatureList>;
Bill Schmidt279cabb2015-01-25 18:05:42 +0000430def : ProcessorModel<"pwr8", P8Model, ProcessorFeatures.Power8FeatureList>;
Clement Courbeteee2e062018-11-09 13:15:32 +0000431def : ProcessorModel<"pwr9", P9Model, ProcessorFeatures.Power9FeatureList>;
Hal Finkela9321052016-10-02 02:10:20 +0000432def : Processor<"ppc", G3Itineraries, [Directive32, FeatureHardFloat,
433 FeatureMFTB]>;
434def : Processor<"ppc32", G3Itineraries, [Directive32, FeatureHardFloat,
435 FeatureMFTB]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000436def : ProcessorModel<"ppc64", G5Model,
Jim Laskey59e7a772006-12-12 20:57:08 +0000437 [Directive64, FeatureAltivec,
Hal Finkel7ac45922013-04-03 14:40:18 +0000438 FeatureMFOCRF, FeatureFSqrt, FeatureFRES,
439 FeatureFRSQRTE, FeatureSTFIWX,
Kit Barton4f79f962015-06-16 16:01:15 +0000440 Feature64Bit /*, Feature64BitRegs */,
441 FeatureMFTB]>;
Bill Schmidt279cabb2015-01-25 18:05:42 +0000442def : ProcessorModel<"ppc64le", P8Model, ProcessorFeatures.Power8FeatureList>;
Jim Laskey74ab9962005-10-19 19:51:16 +0000443
Chris Lattner4f2e4e02007-03-06 00:59:59 +0000444//===----------------------------------------------------------------------===//
445// Calling Conventions
446//===----------------------------------------------------------------------===//
447
448include "PPCCallingConv.td"
449
Chris Lattner51348c52006-03-12 09:13:49 +0000450def PPCInstrInfo : InstrInfo {
Chris Lattner51348c52006-03-12 09:13:49 +0000451 let isLittleEndianEncoding = 1;
Hal Finkel23453472013-12-19 16:13:01 +0000452
453 // FIXME: Unset this when no longer needed!
454 let decodePositionallyEncodedOperands = 1;
Hal Finkel5457bd02014-03-13 07:57:54 +0000455
456 let noNamedPositionallyEncodedOperands = 1;
Chris Lattner51348c52006-03-12 09:13:49 +0000457}
458
Ulrich Weigand640192d2013-05-03 19:49:39 +0000459def PPCAsmParser : AsmParser {
460 let ShouldEmitMatchRegisterName = 0;
461}
462
Ulrich Weigandc0944b52013-07-08 14:49:37 +0000463def PPCAsmParserVariant : AsmParserVariant {
464 int Variant = 0;
465
466 // We do not use hard coded registers in asm strings. However, some
467 // InstAlias definitions use immediate literals. Set RegisterPrefix
468 // so that those are not misinterpreted as registers.
469 string RegisterPrefix = "%";
Colin LeMahieu8a0453e2015-11-09 00:31:07 +0000470 string BreakCharacters = ".";
Ulrich Weigandc0944b52013-07-08 14:49:37 +0000471}
472
Chris Lattner0921e3b2005-10-14 23:37:35 +0000473def PPC : Target {
Chris Lattner51348c52006-03-12 09:13:49 +0000474 // Information about the instructions.
475 let InstructionSet = PPCInstrInfo;
Rafael Espindola50712a42013-12-02 04:55:42 +0000476
Ulrich Weigand640192d2013-05-03 19:49:39 +0000477 let AssemblyParsers = [PPCAsmParser];
Ulrich Weigandc0944b52013-07-08 14:49:37 +0000478 let AssemblyParserVariants = [PPCAsmParserVariant];
Geoff Berryf8bf2ec2018-02-23 18:25:08 +0000479 let AllowRegisterRenaming = 1;
Chris Lattner0921e3b2005-10-14 23:37:35 +0000480}
Clement Courbeteee2e062018-11-09 13:15:32 +0000481
482//===----------------------------------------------------------------------===//
483// Pfm Counters
484//===----------------------------------------------------------------------===//
485
486include "PPCPfmCounters.td"