blob: 8e94a2ae15e052a46fb3cccba4b031728b82d09e [file] [log] [blame]
Jia Liub22310f2012-02-18 12:03:15 +00001//===-- PPC.td - Describe the PowerPC Target Machine -------*- tablegen -*-===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Jia Liub22310f2012-02-18 12:03:15 +00006//
Chris Lattner0921e3b2005-10-14 23:37:35 +00007//===----------------------------------------------------------------------===//
8//
9// This is the top level entry point for the PowerPC target.
10//
11//===----------------------------------------------------------------------===//
12
13// Get the target-independent interfaces which we are implementing.
14//
Evan Cheng977e7be2008-11-24 07:34:46 +000015include "llvm/Target/Target.td"
Chris Lattner0921e3b2005-10-14 23:37:35 +000016
17//===----------------------------------------------------------------------===//
Jim Laskey13a19452005-10-22 08:04:24 +000018// PowerPC Subtarget features.
Jim Laskey74ab9962005-10-19 19:51:16 +000019//
Nemanja Ivanovicd384cd92015-03-04 17:09:12 +000020
Jim Laskey59e7a772006-12-12 20:57:08 +000021//===----------------------------------------------------------------------===//
22// CPU Directives //
23//===----------------------------------------------------------------------===//
24
Hal Finkel6fa56972011-10-17 04:03:49 +000025def Directive440 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_440", "">;
Jim Laskey59e7a772006-12-12 20:57:08 +000026def Directive601 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_601", "">;
27def Directive602 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_602", "">;
28def Directive603 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">;
29def Directive604 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">;
30def Directive620 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">;
31def Directive7400: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_7400", "">;
32def Directive750 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_750", "">;
33def Directive970 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_970", "">;
34def Directive32 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_32", "">;
35def Directive64 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_64", "">;
Hal Finkel9f9f8922012-04-01 19:22:40 +000036def DirectiveA2 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_A2", "">;
Justin Hibbitsceb3cd92018-07-18 04:24:49 +000037def DirectiveE500 : SubtargetFeature<"", "DarwinDirective",
38 "PPC::DIR_E500", "">;
Hal Finkel742b5352012-08-28 16:12:39 +000039def DirectiveE500mc : SubtargetFeature<"", "DarwinDirective",
40 "PPC::DIR_E500mc", "">;
Eric Christopher47d372f2016-06-23 01:33:38 +000041def DirectiveE5500 : SubtargetFeature<"", "DarwinDirective",
Hal Finkel742b5352012-08-28 16:12:39 +000042 "PPC::DIR_E5500", "">;
Bill Schmidt52742c22013-02-01 22:59:51 +000043def DirectivePwr3: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR3", "">;
44def DirectivePwr4: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR4", "">;
45def DirectivePwr5: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR5", "">;
Eric Christopher47d372f2016-06-23 01:33:38 +000046def DirectivePwr5x
47 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR5X", "">;
Hal Finkelf2b9c382012-06-11 15:43:08 +000048def DirectivePwr6: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6", "">;
Eric Christopher47d372f2016-06-23 01:33:38 +000049def DirectivePwr6x
50 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6X", "">;
Hal Finkelf2b9c382012-06-11 15:43:08 +000051def DirectivePwr7: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR7", "">;
Will Schmidt970ff642014-06-26 13:36:19 +000052def DirectivePwr8: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR8", "">;
Nemanja Ivanovic6e29baf2016-05-09 18:54:58 +000053def DirectivePwr9: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR9", "">;
Jim Laskey59e7a772006-12-12 20:57:08 +000054
Chris Lattnera35f3062006-06-16 17:34:12 +000055def Feature64Bit : SubtargetFeature<"64bit","Has64BitSupport", "true",
Chris Lattner0d4923b2005-10-23 05:28:51 +000056 "Enable 64-bit instructions">;
Hal Finkela9321052016-10-02 02:10:20 +000057def FeatureHardFloat : SubtargetFeature<"hard-float", "HasHardFloat", "true",
58 "Enable floating-point instructions">;
Chris Lattnera35f3062006-06-16 17:34:12 +000059def Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true",
60 "Enable 64-bit registers usage for ppc32 [beta]">;
Hal Finkel940ab932014-02-28 00:27:01 +000061def FeatureCRBits : SubtargetFeature<"crbits", "UseCRBits", "true",
62 "Use condition-register bits individually">;
Justin Hibbitsd52990c2018-07-18 04:25:10 +000063def FeatureFPU : SubtargetFeature<"fpu","HasFPU","true",
64 "Enable classic FPU instructions",
65 [FeatureHardFloat]>;
Evan Chengd98701c2006-01-27 08:09:42 +000066def FeatureAltivec : SubtargetFeature<"altivec","HasAltivec", "true",
Hal Finkela9321052016-10-02 02:10:20 +000067 "Enable Altivec instructions",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000068 [FeatureFPU]>;
Joerg Sonnenberger39f095a2014-08-07 12:18:21 +000069def FeatureSPE : SubtargetFeature<"spe","HasSPE", "true",
Hal Finkela9321052016-10-02 02:10:20 +000070 "Enable SPE instructions",
71 [FeatureHardFloat]>;
Hal Finkelbfd3d082012-06-11 19:57:01 +000072def FeatureMFOCRF : SubtargetFeature<"mfocrf","HasMFOCRF", "true",
73 "Enable the MFOCRF instruction">;
Evan Chengd98701c2006-01-27 08:09:42 +000074def FeatureFSqrt : SubtargetFeature<"fsqrt","HasFSQRT", "true",
Hal Finkela9321052016-10-02 02:10:20 +000075 "Enable the fsqrt instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000076 [FeatureFPU]>;
Hal Finkeldbc78e12013-08-19 05:01:02 +000077def FeatureFCPSGN : SubtargetFeature<"fcpsgn", "HasFCPSGN", "true",
Hal Finkela9321052016-10-02 02:10:20 +000078 "Enable the fcpsgn instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000079 [FeatureFPU]>;
Hal Finkel2e103312013-04-03 04:01:11 +000080def FeatureFRE : SubtargetFeature<"fre", "HasFRE", "true",
Hal Finkela9321052016-10-02 02:10:20 +000081 "Enable the fre instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000082 [FeatureFPU]>;
Hal Finkel2e103312013-04-03 04:01:11 +000083def FeatureFRES : SubtargetFeature<"fres", "HasFRES", "true",
Hal Finkela9321052016-10-02 02:10:20 +000084 "Enable the fres instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000085 [FeatureFPU]>;
Hal Finkel2e103312013-04-03 04:01:11 +000086def FeatureFRSQRTE : SubtargetFeature<"frsqrte", "HasFRSQRTE", "true",
Hal Finkela9321052016-10-02 02:10:20 +000087 "Enable the frsqrte instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000088 [FeatureFPU]>;
Hal Finkel2e103312013-04-03 04:01:11 +000089def FeatureFRSQRTES : SubtargetFeature<"frsqrtes", "HasFRSQRTES", "true",
Hal Finkela9321052016-10-02 02:10:20 +000090 "Enable the frsqrtes instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000091 [FeatureFPU]>;
Hal Finkel2e103312013-04-03 04:01:11 +000092def FeatureRecipPrec : SubtargetFeature<"recipprec", "HasRecipPrec", "true",
93 "Assume higher precision reciprocal estimates">;
Chris Lattnerb9f35f02006-02-28 07:08:22 +000094def FeatureSTFIWX : SubtargetFeature<"stfiwx","HasSTFIWX", "true",
Hal Finkela9321052016-10-02 02:10:20 +000095 "Enable the stfiwx instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000096 [FeatureFPU]>;
Hal Finkelbeb296b2013-03-31 10:12:51 +000097def FeatureLFIWAX : SubtargetFeature<"lfiwax","HasLFIWAX", "true",
Hal Finkela9321052016-10-02 02:10:20 +000098 "Enable the lfiwax instruction",
Justin Hibbitsd52990c2018-07-18 04:25:10 +000099 [FeatureFPU]>;
Hal Finkelc20a08d2013-03-29 08:57:48 +0000100def FeatureFPRND : SubtargetFeature<"fprnd", "HasFPRND", "true",
Hal Finkela9321052016-10-02 02:10:20 +0000101 "Enable the fri[mnpz] instructions",
Justin Hibbitsd52990c2018-07-18 04:25:10 +0000102 [FeatureFPU]>;
Hal Finkelf6d45f22013-04-01 17:52:07 +0000103def FeatureFPCVT : SubtargetFeature<"fpcvt", "HasFPCVT", "true",
Hal Finkela9321052016-10-02 02:10:20 +0000104 "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions",
Justin Hibbitsd52990c2018-07-18 04:25:10 +0000105 [FeatureFPU]>;
Hal Finkel460e94d2012-06-22 23:10:08 +0000106def FeatureISEL : SubtargetFeature<"isel","HasISEL", "true",
107 "Enable the isel instruction">;
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000108def FeatureBPERMD : SubtargetFeature<"bpermd", "HasBPERMD", "true",
109 "Enable the bpermd instruction">;
110def FeatureExtDiv : SubtargetFeature<"extdiv", "HasExtDiv", "true",
111 "Enable extended divide instructions">;
Hal Finkel31d29562013-03-28 19:25:55 +0000112def FeatureLDBRX : SubtargetFeature<"ldbrx","HasLDBRX", "true",
113 "Enable the ldbrx instruction">;
Hal Finkel4edc66b2015-01-03 01:16:37 +0000114def FeatureCMPB : SubtargetFeature<"cmpb", "HasCMPB", "true",
115 "Enable the cmpb instruction">;
Bill Schmidt082cfc02015-01-14 20:17:10 +0000116def FeatureICBT : SubtargetFeature<"icbt","HasICBT", "true",
117 "Enable icbt instruction">;
Hal Finkel6fa56972011-10-17 04:03:49 +0000118def FeatureBookE : SubtargetFeature<"booke", "IsBookE", "true",
Bill Schmidt082cfc02015-01-14 20:17:10 +0000119 "Enable Book E instructions",
120 [FeatureICBT]>;
Hal Finkelfe3368c2014-10-02 22:34:22 +0000121def FeatureMSYNC : SubtargetFeature<"msync", "HasOnlyMSYNC", "true",
122 "Has only the msync instruction instead of sync",
123 [FeatureBookE]>;
Joerg Sonnenberger6ae087a2014-08-07 12:31:28 +0000124def FeatureE500 : SubtargetFeature<"e500", "IsE500", "true",
Joerg Sonnenberger0b2ebcb2014-08-04 15:47:38 +0000125 "Enable E500/E500mc instructions">;
Strahinja Petrovic06cf6a62018-03-27 11:23:53 +0000126def FeatureSecurePlt : SubtargetFeature<"secure-plt","SecurePlt", "true",
127 "Enable secure plt mode">;
Joerg Sonnenberger0b2ebcb2014-08-04 15:47:38 +0000128def FeaturePPC4xx : SubtargetFeature<"ppc4xx", "IsPPC4xx", "true",
129 "Enable PPC 4xx instructions">;
Joerg Sonnenberger74052102014-08-04 17:07:41 +0000130def FeaturePPC6xx : SubtargetFeature<"ppc6xx", "IsPPC6xx", "true",
131 "Enable PPC 6xx instructions">;
Hal Finkelefb305e2013-01-30 21:17:42 +0000132def FeatureQPX : SubtargetFeature<"qpx","HasQPX", "true",
Hal Finkela9321052016-10-02 02:10:20 +0000133 "Enable QPX instructions",
Justin Hibbitsd52990c2018-07-18 04:25:10 +0000134 [FeatureFPU]>;
Eric Christopher081efcc2013-10-16 20:38:58 +0000135def FeatureVSX : SubtargetFeature<"vsx","HasVSX", "true",
Hal Finkel27774d92014-03-13 07:58:58 +0000136 "Enable VSX instructions",
137 [FeatureAltivec]>;
Nemanja Ivanovicb4f028f2019-05-07 13:48:03 +0000138def FeatureTwoConstNR :
139 SubtargetFeature<"two-const-nr", "NeedsTwoConstNR", "true",
140 "Requires two constant Newton-Raphson computation">;
Bill Schmidtfe88b182015-02-03 21:58:23 +0000141def FeatureP8Altivec : SubtargetFeature<"power8-altivec", "HasP8Altivec", "true",
142 "Enable POWER8 Altivec instructions",
143 [FeatureAltivec]>;
Nemanja Ivanovice8effe12015-03-04 20:44:33 +0000144def FeatureP8Crypto : SubtargetFeature<"crypto", "HasP8Crypto", "true",
Nemanja Ivanovic0adf26b2015-03-10 20:51:07 +0000145 "Enable POWER8 Crypto instructions",
146 [FeatureP8Altivec]>;
NAKAMURA Takumicc4487e2014-12-09 01:03:27 +0000147def FeatureP8Vector : SubtargetFeature<"power8-vector", "HasP8Vector", "true",
148 "Enable POWER8 vector instructions",
Bill Schmidtfe88b182015-02-03 21:58:23 +0000149 [FeatureVSX, FeatureP8Altivec]>;
Nemanja Ivanovicc38b5312015-04-11 10:40:42 +0000150def FeatureDirectMove :
151 SubtargetFeature<"direct-move", "HasDirectMove", "true",
152 "Enable Power8 direct move instructions",
153 [FeatureVSX]>;
Nemanja Ivanovic0adf26b2015-03-10 20:51:07 +0000154def FeaturePartwordAtomic : SubtargetFeature<"partword-atomics",
155 "HasPartwordAtomics", "true",
156 "Enable l[bh]arx and st[bh]cx.">;
Hal Finkele2ab0f12015-01-15 21:17:34 +0000157def FeatureInvariantFunctionDescriptors :
158 SubtargetFeature<"invariant-function-descriptors",
159 "HasInvariantFunctionDescriptors", "true",
160 "Assume function descriptors are invariant">;
Hal Finkelb074a602016-08-30 00:59:23 +0000161def FeatureLongCall : SubtargetFeature<"longcall", "UseLongCalls", "true",
162 "Always use indirect calls">;
Kit Barton535e69d2015-03-25 19:36:23 +0000163def FeatureHTM : SubtargetFeature<"htm", "HasHTM", "true",
164 "Enable Hardware Transactional Memory instructions">;
Kit Barton4f79f962015-06-16 16:01:15 +0000165def FeatureMFTB : SubtargetFeature<"", "FeatureMFTB", "true",
166 "Implement mftb using the mfspr instruction">;
QingShan Zhang5321dcd2019-03-27 03:50:16 +0000167def FeaturePPCPreRASched:
168 SubtargetFeature<"ppc-prera-sched", "UsePPCPreRASchedStrategy", "true",
169 "Use PowerPC pre-RA scheduling strategy">;
170def FeaturePPCPostRASched:
171 SubtargetFeature<"ppc-postra-sched", "UsePPCPostRASchedStrategy", "true",
172 "Use PowerPC post-RA scheduling strategy">;
Nemanja Ivanovicb033f672015-12-15 12:19:34 +0000173def FeatureFloat128 :
174 SubtargetFeature<"float128", "HasFloat128", "true",
175 "Enable the __float128 data type for IEEE-754R Binary128.",
176 [FeatureVSX]>;
Hal Finkelfa7057a2016-03-29 01:36:01 +0000177def FeaturePOPCNTD : SubtargetFeature<"popcntd","HasPOPCNTD",
178 "POPCNTD_Fast",
179 "Enable the popcnt[dw] instructions">;
Hal Finkel7059d412016-03-28 17:52:08 +0000180// Note that for the a2/a2q processor models we should not use popcnt[dw] by
181// default. These processors do support the instructions, but they're
182// microcoded, and the software emulation is about twice as fast.
Hal Finkelfa7057a2016-03-29 01:36:01 +0000183def FeatureSlowPOPCNTD : SubtargetFeature<"slow-popcntd","HasPOPCNTD",
184 "POPCNTD_Slow",
185 "Has slow popcnt[dw] instructions">;
186
187def DeprecatedDST : SubtargetFeature<"", "DeprecatedDST", "true",
188 "Treat vector data stream cache control instructions as deprecated">;
Hal Finkel7059d412016-03-28 17:52:08 +0000189
Nemanja Ivanovica621a7f2016-03-31 15:26:37 +0000190def FeatureISA3_0 : SubtargetFeature<"isa-v30-instructions", "IsISA3_0",
191 "true",
192 "Enable instructions added in ISA 3.0.">;
Nemanja Ivanovic87bcae32016-04-13 18:51:18 +0000193def FeatureP9Altivec : SubtargetFeature<"power9-altivec", "HasP9Altivec", "true",
194 "Enable POWER9 Altivec instructions",
195 [FeatureISA3_0, FeatureP8Altivec]>;
196def FeatureP9Vector : SubtargetFeature<"power9-vector", "HasP9Vector", "true",
197 "Enable POWER9 vector instructions",
198 [FeatureISA3_0, FeatureP8Vector,
199 FeatureP9Altivec]>;
Nemanja Ivanovic7d007dd2019-01-26 01:18:48 +0000200// A separate feature for this even though it is equivalent to P9Vector
201// because this is a feature of the implementation rather than the architecture
202// and may go away with future CPU's.
203def FeatureVectorsUseTwoUnits : SubtargetFeature<"vectors-use-two-units",
204 "VectorsUseTwoUnits",
205 "true",
206 "Vectors use two units">;
Nemanja Ivanovica621a7f2016-03-31 15:26:37 +0000207
Eric Christopher47d372f2016-06-23 01:33:38 +0000208// Since new processors generally contain a superset of features of those that
209// came before them, the idea is to make implementations of new processors
210// less error prone and easier to read.
211// Namely:
212// list<SubtargetFeature> Power8FeatureList = ...
213// list<SubtargetFeature> FutureProcessorSpecificFeatureList =
214// [ features that Power8 does not support ]
215// list<SubtargetFeature> FutureProcessorFeatureList =
216// !listconcat(Power8FeatureList, FutureProcessorSpecificFeatureList)
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000217
Eric Christopher47d372f2016-06-23 01:33:38 +0000218// Makes it explicit and obvious what is new in FutureProcesor vs. Power8 as
219// well as providing a single point of definition if the feature set will be
220// used elsewhere.
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000221def ProcessorFeatures {
222 list<SubtargetFeature> Power7FeatureList =
223 [DirectivePwr7, FeatureAltivec, FeatureVSX,
224 FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE,
225 FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
226 FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX,
227 FeatureFPRND, FeatureFPCVT, FeatureISEL,
228 FeaturePOPCNTD, FeatureCMPB, FeatureLDBRX,
Hal Finkel58f5f9c2015-04-11 13:40:36 +0000229 Feature64Bit /*, Feature64BitRegs */,
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000230 FeatureBPERMD, FeatureExtDiv,
Nemanja Ivanovicb4f028f2019-05-07 13:48:03 +0000231 FeatureMFTB, DeprecatedDST, FeatureTwoConstNR];
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000232 list<SubtargetFeature> Power8SpecificFeatures =
233 [DirectivePwr8, FeatureP8Altivec, FeatureP8Vector, FeatureP8Crypto,
Jinsong Jic627aa22019-06-27 19:35:11 +0000234 FeatureHTM, FeatureDirectMove, FeatureICBT, FeaturePartwordAtomic];
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000235 list<SubtargetFeature> Power8FeatureList =
236 !listconcat(Power7FeatureList, Power8SpecificFeatures);
Nemanja Ivanovic87bcae32016-04-13 18:51:18 +0000237 list<SubtargetFeature> Power9SpecificFeatures =
Nemanja Ivanovic7d007dd2019-01-26 01:18:48 +0000238 [DirectivePwr9, FeatureP9Altivec, FeatureP9Vector, FeatureISA3_0,
QingShan Zhang5321dcd2019-03-27 03:50:16 +0000239 FeatureVectorsUseTwoUnits, FeaturePPCPreRASched, FeaturePPCPostRASched];
Nemanja Ivanovic6e29baf2016-05-09 18:54:58 +0000240 list<SubtargetFeature> Power9FeatureList =
241 !listconcat(Power8FeatureList, Power9SpecificFeatures);
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000242}
243
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000244// Note: Future features to add when support is extended to more
245// recent ISA levels:
246//
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000247// DFP p6, p6x, p7 decimal floating-point instructions
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000248// POPCNTB p5 through p7 popcntb and related instructions
Bill Schmidtcc99a2f2013-02-01 23:10:09 +0000249
Jim Laskey74ab9962005-10-19 19:51:16 +0000250//===----------------------------------------------------------------------===//
Hal Finkel654d43b2013-04-12 02:18:09 +0000251// Classes used for relation maps.
252//===----------------------------------------------------------------------===//
253// RecFormRel - Filter class used to relate non-record-form instructions with
254// their record-form variants.
255class RecFormRel;
256
Hal Finkel25e04542014-03-25 18:55:11 +0000257// AltVSXFMARel - Filter class used to relate the primary addend-killing VSX
258// FMA instruction forms with their corresponding factor-killing forms.
259class AltVSXFMARel {
260 bit IsVSXFMAAlt = 0;
261}
262
Hal Finkel654d43b2013-04-12 02:18:09 +0000263//===----------------------------------------------------------------------===//
264// Relation Map Definitions.
265//===----------------------------------------------------------------------===//
266
267def getRecordFormOpcode : 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 non-record-form instructions.
275 let KeyCol = ["0"];
276 // Value columns RC=1
277 let ValueCols = [["1"]];
278}
279
280def getNonRecordFormOpcode : InstrMapping {
281 let FilterClass = "RecFormRel";
282 // Instructions with the same BaseName and Interpretation64Bit values
283 // form a row.
284 let RowFields = ["BaseName", "Interpretation64Bit"];
285 // Instructions with the same RC value form a column.
286 let ColFields = ["RC"];
287 // The key column are the record-form instructions.
288 let KeyCol = ["1"];
289 // Value columns are RC=0
290 let ValueCols = [["0"]];
291}
292
Hal Finkel25e04542014-03-25 18:55:11 +0000293def getAltVSXFMAOpcode : InstrMapping {
294 let FilterClass = "AltVSXFMARel";
Jinsong Ji8b1abe52019-06-20 21:36:06 +0000295 // Instructions with the same BaseName value form a row.
Hal Finkel25e04542014-03-25 18:55:11 +0000296 let RowFields = ["BaseName"];
Jinsong Ji8b1abe52019-06-20 21:36:06 +0000297 // Instructions with the same IsVSXFMAAlt value form a column.
Hal Finkel25e04542014-03-25 18:55:11 +0000298 let ColFields = ["IsVSXFMAAlt"];
299 // The key column are the (default) addend-killing instructions.
300 let KeyCol = ["0"];
301 // Value columns IsVSXFMAAlt=1
302 let ValueCols = [["1"]];
303}
304
Hal Finkel654d43b2013-04-12 02:18:09 +0000305//===----------------------------------------------------------------------===//
Chris Lattnera389f0d2005-10-23 22:08:13 +0000306// Register File Description
307//===----------------------------------------------------------------------===//
308
309include "PPCRegisterInfo.td"
310include "PPCSchedule.td"
Chris Lattnera389f0d2005-10-23 22:08:13 +0000311
312//===----------------------------------------------------------------------===//
313// PowerPC processors supported.
Jim Laskey74ab9962005-10-19 19:51:16 +0000314//
315
Hal Finkela9321052016-10-02 02:10:20 +0000316def : Processor<"generic", G3Itineraries, [Directive32, FeatureHardFloat,
317 FeatureMFTB]>;
Hal Finkel5a7162f2013-11-29 06:32:17 +0000318def : ProcessorModel<"440", PPC440Model, [Directive440, FeatureISEL,
319 FeatureFRES, FeatureFRSQRTE,
Clement Courbeteee2e062018-11-09 13:15:32 +0000320 FeatureICBT, FeatureBookE,
Kit Barton4f79f962015-06-16 16:01:15 +0000321 FeatureMSYNC, FeatureMFTB]>;
Hal Finkel5a7162f2013-11-29 06:32:17 +0000322def : ProcessorModel<"450", PPC440Model, [Directive440, FeatureISEL,
323 FeatureFRES, FeatureFRSQRTE,
Clement Courbeteee2e062018-11-09 13:15:32 +0000324 FeatureICBT, FeatureBookE,
Kit Barton4f79f962015-06-16 16:01:15 +0000325 FeatureMSYNC, FeatureMFTB]>;
Justin Hibbitsd52990c2018-07-18 04:25:10 +0000326def : Processor<"601", G3Itineraries, [Directive601, FeatureFPU]>;
327def : Processor<"602", G3Itineraries, [Directive602, FeatureFPU,
Kit Barton4f79f962015-06-16 16:01:15 +0000328 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000329def : Processor<"603", G3Itineraries, [Directive603,
Kit Barton4f79f962015-06-16 16:01:15 +0000330 FeatureFRES, FeatureFRSQRTE,
331 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000332def : Processor<"603e", G3Itineraries, [Directive603,
Kit Barton4f79f962015-06-16 16:01:15 +0000333 FeatureFRES, FeatureFRSQRTE,
334 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000335def : Processor<"603ev", G3Itineraries, [Directive603,
Kit Barton4f79f962015-06-16 16:01:15 +0000336 FeatureFRES, FeatureFRSQRTE,
337 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000338def : Processor<"604", G3Itineraries, [Directive604,
Kit Barton4f79f962015-06-16 16:01:15 +0000339 FeatureFRES, FeatureFRSQRTE,
340 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000341def : Processor<"604e", G3Itineraries, [Directive604,
Kit Barton4f79f962015-06-16 16:01:15 +0000342 FeatureFRES, FeatureFRSQRTE,
343 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000344def : Processor<"620", G3Itineraries, [Directive620,
Kit Barton4f79f962015-06-16 16:01:15 +0000345 FeatureFRES, FeatureFRSQRTE,
346 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000347def : Processor<"750", G4Itineraries, [Directive750,
Kit Barton4f79f962015-06-16 16:01:15 +0000348 FeatureFRES, FeatureFRSQRTE,
349 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000350def : Processor<"g3", G3Itineraries, [Directive750,
Kit Barton4f79f962015-06-16 16:01:15 +0000351 FeatureFRES, FeatureFRSQRTE,
352 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000353def : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec,
Kit Barton4f79f962015-06-16 16:01:15 +0000354 FeatureFRES, FeatureFRSQRTE,
355 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000356def : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec,
Kit Barton4f79f962015-06-16 16:01:15 +0000357 FeatureFRES, FeatureFRSQRTE,
358 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000359def : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec,
Kit Barton4f79f962015-06-16 16:01:15 +0000360 FeatureFRES, FeatureFRSQRTE,
361 FeatureMFTB]>;
Hal Finkel2e103312013-04-03 04:01:11 +0000362def : Processor<"g4+", G4PlusItineraries, [Directive7400, FeatureAltivec,
Clement Courbeteee2e062018-11-09 13:15:32 +0000363 FeatureFRES, FeatureFRSQRTE,
Kit Barton4f79f962015-06-16 16:01:15 +0000364 FeatureMFTB]>;
Bill Schmidt279cabb2015-01-25 18:05:42 +0000365
Hal Finkel1a958cf2013-04-05 05:49:18 +0000366def : ProcessorModel<"970", G5Model,
Jim Laskey59e7a772006-12-12 20:57:08 +0000367 [Directive970, FeatureAltivec,
Hal Finkel2e103312013-04-03 04:01:11 +0000368 FeatureMFOCRF, FeatureFSqrt,
369 FeatureFRES, FeatureFRSQRTE, FeatureSTFIWX,
Kit Barton4f79f962015-06-16 16:01:15 +0000370 Feature64Bit /*, Feature64BitRegs */,
371 FeatureMFTB]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000372def : ProcessorModel<"g5", G5Model,
Jim Laskey59e7a772006-12-12 20:57:08 +0000373 [Directive970, FeatureAltivec,
Hal Finkelbfd3d082012-06-11 19:57:01 +0000374 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Hal Finkel2e103312013-04-03 04:01:11 +0000375 FeatureFRES, FeatureFRSQRTE,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000376 Feature64Bit /*, Feature64BitRegs */,
Kit Barton4f79f962015-06-16 16:01:15 +0000377 FeatureMFTB, DeprecatedDST]>;
Justin Hibbitsceb3cd92018-07-18 04:24:49 +0000378def : ProcessorModel<"e500", PPCE500Model,
379 [DirectiveE500,
380 FeatureICBT, FeatureBookE,
381 FeatureISEL, FeatureMFTB]>;
Hal Finkel742b5352012-08-28 16:12:39 +0000382def : ProcessorModel<"e500mc", PPCE500mcModel,
Hal Finkel005f8402015-11-25 10:14:31 +0000383 [DirectiveE500mc,
Clement Courbeteee2e062018-11-09 13:15:32 +0000384 FeatureSTFIWX, FeatureICBT, FeatureBookE,
Kit Barton4f79f962015-06-16 16:01:15 +0000385 FeatureISEL, FeatureMFTB]>;
Hal Finkel742b5352012-08-28 16:12:39 +0000386def : ProcessorModel<"e5500", PPCE5500Model,
387 [DirectiveE5500, FeatureMFOCRF, Feature64Bit,
Clement Courbeteee2e062018-11-09 13:15:32 +0000388 FeatureSTFIWX, FeatureICBT, FeatureBookE,
Kit Barton4f79f962015-06-16 16:01:15 +0000389 FeatureISEL, FeatureMFTB]>;
Hal Finkel5fde1b02013-04-05 05:34:08 +0000390def : ProcessorModel<"a2", PPCA2Model,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000391 [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000392 FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
Hal Finkel2e103312013-04-03 04:01:11 +0000393 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
394 FeatureSTFIWX, FeatureLFIWAX,
Hal Finkelf6d45f22013-04-01 17:52:07 +0000395 FeatureFPRND, FeatureFPCVT, FeatureISEL,
Hal Finkelfa7057a2016-03-29 01:36:01 +0000396 FeatureSlowPOPCNTD, FeatureCMPB, FeatureLDBRX,
Hal Finkel7059d412016-03-28 17:52:08 +0000397 Feature64Bit /*, Feature64BitRegs */, FeatureMFTB]>;
Hal Finkel5fde1b02013-04-05 05:34:08 +0000398def : ProcessorModel<"a2q", PPCA2Model,
Bill Schmidt082cfc02015-01-14 20:17:10 +0000399 [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000400 FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
Hal Finkel2e103312013-04-03 04:01:11 +0000401 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
402 FeatureSTFIWX, FeatureLFIWAX,
Hal Finkelf6d45f22013-04-01 17:52:07 +0000403 FeatureFPRND, FeatureFPCVT, FeatureISEL,
Hal Finkelfa7057a2016-03-29 01:36:01 +0000404 FeatureSlowPOPCNTD, FeatureCMPB, FeatureLDBRX,
Hal Finkel7059d412016-03-28 17:52:08 +0000405 Feature64Bit /*, Feature64BitRegs */, FeatureQPX,
406 FeatureMFTB]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000407def : ProcessorModel<"pwr3", G5Model,
Hal Finkel2e103312013-04-03 04:01:11 +0000408 [DirectivePwr3, FeatureAltivec,
409 FeatureFRES, FeatureFRSQRTE, FeatureMFOCRF,
Bill Schmidt52742c22013-02-01 22:59:51 +0000410 FeatureSTFIWX, Feature64Bit]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000411def : ProcessorModel<"pwr4", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000412 [DirectivePwr4, FeatureAltivec, FeatureMFOCRF,
Hal Finkel2e103312013-04-03 04:01:11 +0000413 FeatureFSqrt, FeatureFRES, FeatureFRSQRTE,
Kit Barton4f79f962015-06-16 16:01:15 +0000414 FeatureSTFIWX, Feature64Bit, FeatureMFTB]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000415def : ProcessorModel<"pwr5", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000416 [DirectivePwr5, FeatureAltivec, FeatureMFOCRF,
Hal Finkel2e103312013-04-03 04:01:11 +0000417 FeatureFSqrt, FeatureFRE, FeatureFRES,
418 FeatureFRSQRTE, FeatureFRSQRTES,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000419 FeatureSTFIWX, Feature64Bit,
Kit Barton4f79f962015-06-16 16:01:15 +0000420 FeatureMFTB, DeprecatedDST]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000421def : ProcessorModel<"pwr5x", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000422 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
Hal Finkel2e103312013-04-03 04:01:11 +0000423 FeatureFSqrt, FeatureFRE, FeatureFRES,
424 FeatureFRSQRTE, FeatureFRSQRTES,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000425 FeatureSTFIWX, FeatureFPRND, Feature64Bit,
Kit Barton4f79f962015-06-16 16:01:15 +0000426 FeatureMFTB, DeprecatedDST]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000427def : ProcessorModel<"pwr6", G5Model,
Hal Finkelf2b9c382012-06-11 15:43:08 +0000428 [DirectivePwr6, FeatureAltivec,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000429 FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE,
Hal Finkel2e103312013-04-03 04:01:11 +0000430 FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
Hal Finkel4edc66b2015-01-03 01:16:37 +0000431 FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000432 FeatureFPRND, Feature64Bit /*, Feature64BitRegs */,
Kit Barton4f79f962015-06-16 16:01:15 +0000433 FeatureMFTB, DeprecatedDST]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000434def : ProcessorModel<"pwr6x", G5Model,
Bill Schmidt52742c22013-02-01 22:59:51 +0000435 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
Hal Finkeldbc78e12013-08-19 05:01:02 +0000436 FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES,
Hal Finkel2e103312013-04-03 04:01:11 +0000437 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
Hal Finkel4edc66b2015-01-03 01:16:37 +0000438 FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB,
Hal Finkel0096dbd2013-09-12 14:40:06 +0000439 FeatureFPRND, Feature64Bit,
Kit Barton4f79f962015-06-16 16:01:15 +0000440 FeatureMFTB, DeprecatedDST]>;
Nemanja Ivanovicc0904792015-04-09 23:54:37 +0000441def : ProcessorModel<"pwr7", P7Model, ProcessorFeatures.Power7FeatureList>;
Bill Schmidt279cabb2015-01-25 18:05:42 +0000442def : ProcessorModel<"pwr8", P8Model, ProcessorFeatures.Power8FeatureList>;
Clement Courbeteee2e062018-11-09 13:15:32 +0000443def : ProcessorModel<"pwr9", P9Model, ProcessorFeatures.Power9FeatureList>;
Hal Finkela9321052016-10-02 02:10:20 +0000444def : Processor<"ppc", G3Itineraries, [Directive32, FeatureHardFloat,
445 FeatureMFTB]>;
446def : Processor<"ppc32", G3Itineraries, [Directive32, FeatureHardFloat,
447 FeatureMFTB]>;
Hal Finkel1a958cf2013-04-05 05:49:18 +0000448def : ProcessorModel<"ppc64", G5Model,
Jim Laskey59e7a772006-12-12 20:57:08 +0000449 [Directive64, FeatureAltivec,
Hal Finkel7ac45922013-04-03 14:40:18 +0000450 FeatureMFOCRF, FeatureFSqrt, FeatureFRES,
451 FeatureFRSQRTE, FeatureSTFIWX,
Kit Barton4f79f962015-06-16 16:01:15 +0000452 Feature64Bit /*, Feature64BitRegs */,
453 FeatureMFTB]>;
Bill Schmidt279cabb2015-01-25 18:05:42 +0000454def : ProcessorModel<"ppc64le", P8Model, ProcessorFeatures.Power8FeatureList>;
Jim Laskey74ab9962005-10-19 19:51:16 +0000455
Chris Lattner4f2e4e02007-03-06 00:59:59 +0000456//===----------------------------------------------------------------------===//
457// Calling Conventions
458//===----------------------------------------------------------------------===//
459
460include "PPCCallingConv.td"
461
Chris Lattner51348c52006-03-12 09:13:49 +0000462def PPCInstrInfo : InstrInfo {
Chris Lattner51348c52006-03-12 09:13:49 +0000463 let isLittleEndianEncoding = 1;
Hal Finkel23453472013-12-19 16:13:01 +0000464
465 // FIXME: Unset this when no longer needed!
466 let decodePositionallyEncodedOperands = 1;
Hal Finkel5457bd02014-03-13 07:57:54 +0000467
468 let noNamedPositionallyEncodedOperands = 1;
Chris Lattner51348c52006-03-12 09:13:49 +0000469}
470
Ulrich Weigand640192d2013-05-03 19:49:39 +0000471def PPCAsmParser : AsmParser {
472 let ShouldEmitMatchRegisterName = 0;
473}
474
Ulrich Weigandc0944b52013-07-08 14:49:37 +0000475def PPCAsmParserVariant : AsmParserVariant {
476 int Variant = 0;
477
478 // We do not use hard coded registers in asm strings. However, some
479 // InstAlias definitions use immediate literals. Set RegisterPrefix
480 // so that those are not misinterpreted as registers.
481 string RegisterPrefix = "%";
Colin LeMahieu8a0453e2015-11-09 00:31:07 +0000482 string BreakCharacters = ".";
Ulrich Weigandc0944b52013-07-08 14:49:37 +0000483}
484
Chris Lattner0921e3b2005-10-14 23:37:35 +0000485def PPC : Target {
Chris Lattner51348c52006-03-12 09:13:49 +0000486 // Information about the instructions.
487 let InstructionSet = PPCInstrInfo;
Rafael Espindola50712a42013-12-02 04:55:42 +0000488
Ulrich Weigand640192d2013-05-03 19:49:39 +0000489 let AssemblyParsers = [PPCAsmParser];
Ulrich Weigandc0944b52013-07-08 14:49:37 +0000490 let AssemblyParserVariants = [PPCAsmParserVariant];
Geoff Berryf8bf2ec2018-02-23 18:25:08 +0000491 let AllowRegisterRenaming = 1;
Chris Lattner0921e3b2005-10-14 23:37:35 +0000492}
Clement Courbeteee2e062018-11-09 13:15:32 +0000493
494//===----------------------------------------------------------------------===//
495// Pfm Counters
496//===----------------------------------------------------------------------===//
497
498include "PPCPfmCounters.td"