blob: 98869eaa17fa010d0c7d5d22f6ef4943f23ae0e4 [file] [log] [blame]
Jia Liu31d157a2012-02-18 12:03:15 +00001//===-- PPC.td - Describe the PowerPC Target Machine -------*- tablegen -*-===//
2//
Chris Lattner4c7b43b2005-10-14 23:37:35 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-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 Liu31d157a2012-02-18 12:03:15 +00007//
Chris Lattner4c7b43b2005-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 Cheng027fdbe2008-11-24 07:34:46 +000016include "llvm/Target/Target.td"
Chris Lattner4c7b43b2005-10-14 23:37:35 +000017
18//===----------------------------------------------------------------------===//
Jim Laskey5476b9b2005-10-22 08:04:24 +000019// PowerPC Subtarget features.
Jim Laskey53842142005-10-19 19:51:16 +000020//
21
Jim Laskeyc35010d2006-12-12 20:57:08 +000022//===----------------------------------------------------------------------===//
23// CPU Directives //
24//===----------------------------------------------------------------------===//
25
Hal Finkelc6d08f12011-10-17 04:03:49 +000026def Directive440 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_440", "">;
Jim Laskeyc35010d2006-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 Finkel4d989ac2012-04-01 19:22:40 +000037def DirectiveA2 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_A2", "">;
Hal Finkel621b77a2012-08-28 16:12:39 +000038def DirectiveE500mc : SubtargetFeature<"", "DarwinDirective",
39 "PPC::DIR_E500mc", "">;
40def DirectiveE5500 : SubtargetFeature<"", "DarwinDirective",
41 "PPC::DIR_E5500", "">;
Bill Schmidtcdc3b742013-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 Finkel622382f2012-06-11 15:43:08 +000046def DirectivePwr6: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6", "">;
Bill Schmidtcdc3b742013-02-01 22:59:51 +000047def DirectivePwr6x: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6X", "">;
Hal Finkel622382f2012-06-11 15:43:08 +000048def DirectivePwr7: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR7", "">;
Jim Laskeyc35010d2006-12-12 20:57:08 +000049
Chris Lattnera7a58542006-06-16 17:34:12 +000050def Feature64Bit : SubtargetFeature<"64bit","Has64BitSupport", "true",
Chris Lattner2e1f8232005-10-23 05:28:51 +000051 "Enable 64-bit instructions">;
Chris Lattnera7a58542006-06-16 17:34:12 +000052def Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true",
53 "Enable 64-bit registers usage for ppc32 [beta]">;
Evan Cheng19c95502006-01-27 08:09:42 +000054def FeatureAltivec : SubtargetFeature<"altivec","HasAltivec", "true",
Chris Lattner2e1f8232005-10-23 05:28:51 +000055 "Enable Altivec instructions">;
Hal Finkelbd5cafd2012-06-11 19:57:01 +000056def FeatureMFOCRF : SubtargetFeature<"mfocrf","HasMFOCRF", "true",
57 "Enable the MFOCRF instruction">;
Evan Cheng19c95502006-01-27 08:09:42 +000058def FeatureFSqrt : SubtargetFeature<"fsqrt","HasFSQRT", "true",
Hal Finkel8ee53e22011-10-14 18:54:13 +000059 "Enable the fsqrt instruction">;
Hal Finkel827307b2013-04-03 04:01:11 +000060def FeatureFRE : SubtargetFeature<"fre", "HasFRE", "true",
61 "Enable the fre instruction">;
62def FeatureFRES : SubtargetFeature<"fres", "HasFRES", "true",
63 "Enable the fres instruction">;
64def FeatureFRSQRTE : SubtargetFeature<"frsqrte", "HasFRSQRTE", "true",
65 "Enable the frsqrte instruction">;
66def FeatureFRSQRTES : SubtargetFeature<"frsqrtes", "HasFRSQRTES", "true",
67 "Enable the frsqrtes instruction">;
68def FeatureRecipPrec : SubtargetFeature<"recipprec", "HasRecipPrec", "true",
69 "Assume higher precision reciprocal estimates">;
Chris Lattnerbf751e22006-02-28 07:08:22 +000070def FeatureSTFIWX : SubtargetFeature<"stfiwx","HasSTFIWX", "true",
Hal Finkel8ee53e22011-10-14 18:54:13 +000071 "Enable the stfiwx instruction">;
Hal Finkel8049ab12013-03-31 10:12:51 +000072def FeatureLFIWAX : SubtargetFeature<"lfiwax","HasLFIWAX", "true",
73 "Enable the lfiwax instruction">;
Hal Finkelf5d5c432013-03-29 08:57:48 +000074def FeatureFPRND : SubtargetFeature<"fprnd", "HasFPRND", "true",
75 "Enable the fri[mnpz] instructions">;
Hal Finkel46479192013-04-01 17:52:07 +000076def FeatureFPCVT : SubtargetFeature<"fpcvt", "HasFPCVT", "true",
77 "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions">;
Hal Finkel009f7af2012-06-22 23:10:08 +000078def FeatureISEL : SubtargetFeature<"isel","HasISEL", "true",
79 "Enable the isel instruction">;
Hal Finkelc53ab4d2013-03-28 13:29:47 +000080def FeaturePOPCNTD : SubtargetFeature<"popcntd","HasPOPCNTD", "true",
81 "Enable the popcnt[dw] instructions">;
Hal Finkelefdd4672013-03-28 19:25:55 +000082def FeatureLDBRX : SubtargetFeature<"ldbrx","HasLDBRX", "true",
83 "Enable the ldbrx instruction">;
Hal Finkelc6d08f12011-10-17 04:03:49 +000084def FeatureBookE : SubtargetFeature<"booke", "IsBookE", "true",
85 "Enable Book E instructions">;
Hal Finkel5bb16fd2013-01-30 21:17:42 +000086def FeatureQPX : SubtargetFeature<"qpx","HasQPX", "true",
87 "Enable QPX instructions">;
Jim Laskey53842142005-10-19 19:51:16 +000088
Bill Schmidtdbc86b92013-02-01 23:10:09 +000089// Note: Future features to add when support is extended to more
90// recent ISA levels:
91//
92// CMPB p6, p6x, p7 cmpb
93// DFP p6, p6x, p7 decimal floating-point instructions
Bill Schmidtdbc86b92013-02-01 23:10:09 +000094// FRE p5 through p7 fre (vs. fres, available since p3)
95// FRSQRTES p5 through p7 frsqrtes (vs. frsqrte, available since p3)
Bill Schmidtdbc86b92013-02-01 23:10:09 +000096// POPCNTB p5 through p7 popcntb and related instructions
Bill Schmidtdbc86b92013-02-01 23:10:09 +000097// RECIP_PREC p6, p6x, p7 higher precision reciprocal estimates
98// VSX p7 vector-scalar instruction set
99
Jim Laskey53842142005-10-19 19:51:16 +0000100//===----------------------------------------------------------------------===//
Chris Lattnerc8d28892005-10-23 22:08:13 +0000101// Register File Description
102//===----------------------------------------------------------------------===//
103
104include "PPCRegisterInfo.td"
105include "PPCSchedule.td"
106include "PPCInstrInfo.td"
107
108//===----------------------------------------------------------------------===//
109// PowerPC processors supported.
Jim Laskey53842142005-10-19 19:51:16 +0000110//
111
Jim Laskeyc35010d2006-12-12 20:57:08 +0000112def : Processor<"generic", G3Itineraries, [Directive32]>;
Hal Finkel009f7af2012-06-22 23:10:08 +0000113def : Processor<"440", PPC440Itineraries, [Directive440, FeatureISEL,
Hal Finkel827307b2013-04-03 04:01:11 +0000114 FeatureFRES, FeatureFRSQRTE,
Hal Finkel009f7af2012-06-22 23:10:08 +0000115 FeatureBookE]>;
116def : Processor<"450", PPC440Itineraries, [Directive440, FeatureISEL,
Hal Finkel827307b2013-04-03 04:01:11 +0000117 FeatureFRES, FeatureFRSQRTE,
Hal Finkel009f7af2012-06-22 23:10:08 +0000118 FeatureBookE]>;
Jim Laskeyc35010d2006-12-12 20:57:08 +0000119def : Processor<"601", G3Itineraries, [Directive601]>;
120def : Processor<"602", G3Itineraries, [Directive602]>;
Hal Finkel827307b2013-04-03 04:01:11 +0000121def : Processor<"603", G3Itineraries, [Directive603,
122 FeatureFRES, FeatureFRSQRTE]>;
123def : Processor<"603e", G3Itineraries, [Directive603,
124 FeatureFRES, FeatureFRSQRTE]>;
125def : Processor<"603ev", G3Itineraries, [Directive603,
126 FeatureFRES, FeatureFRSQRTE]>;
127def : Processor<"604", G3Itineraries, [Directive604,
128 FeatureFRES, FeatureFRSQRTE]>;
129def : Processor<"604e", G3Itineraries, [Directive604,
130 FeatureFRES, FeatureFRSQRTE]>;
131def : Processor<"620", G3Itineraries, [Directive620,
132 FeatureFRES, FeatureFRSQRTE]>;
133def : Processor<"750", G4Itineraries, [Directive750,
134 FeatureFRES, FeatureFRSQRTE]>;
135def : Processor<"g3", G3Itineraries, [Directive750,
136 FeatureFRES, FeatureFRSQRTE]>;
137def : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec,
138 FeatureFRES, FeatureFRSQRTE]>;
139def : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec,
140 FeatureFRES, FeatureFRSQRTE]>;
141def : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec,
142 FeatureFRES, FeatureFRSQRTE]>;
143def : Processor<"g4+", G4PlusItineraries, [Directive7400, FeatureAltivec,
144 FeatureFRES, FeatureFRSQRTE]>;
Jim Laskey53842142005-10-19 19:51:16 +0000145def : Processor<"970", G5Itineraries,
Jim Laskeyc35010d2006-12-12 20:57:08 +0000146 [Directive970, FeatureAltivec,
Hal Finkel827307b2013-04-03 04:01:11 +0000147 FeatureMFOCRF, FeatureFSqrt,
148 FeatureFRES, FeatureFRSQRTE, FeatureSTFIWX,
Jim Laskey5476b9b2005-10-22 08:04:24 +0000149 Feature64Bit /*, Feature64BitRegs */]>;
Jim Laskey53842142005-10-19 19:51:16 +0000150def : Processor<"g5", G5Itineraries,
Jim Laskeyc35010d2006-12-12 20:57:08 +0000151 [Directive970, FeatureAltivec,
Hal Finkelbd5cafd2012-06-11 19:57:01 +0000152 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Hal Finkel827307b2013-04-03 04:01:11 +0000153 FeatureFRES, FeatureFRSQRTE,
Jim Laskeyc35010d2006-12-12 20:57:08 +0000154 Feature64Bit /*, Feature64BitRegs */]>;
Hal Finkel621b77a2012-08-28 16:12:39 +0000155def : ProcessorModel<"e500mc", PPCE500mcModel,
156 [DirectiveE500mc, FeatureMFOCRF,
157 FeatureSTFIWX, FeatureBookE, FeatureISEL]>;
158def : ProcessorModel<"e5500", PPCE5500Model,
159 [DirectiveE5500, FeatureMFOCRF, Feature64Bit,
160 FeatureSTFIWX, FeatureBookE, FeatureISEL]>;
Hal Finkelefdd4672013-03-28 19:25:55 +0000161def : Processor<"a2", PPCA2Itineraries,
162 [DirectiveA2, FeatureBookE, FeatureMFOCRF,
Hal Finkel827307b2013-04-03 04:01:11 +0000163 FeatureFSqrt, FeatureFRE, FeatureFRES,
164 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
165 FeatureSTFIWX, FeatureLFIWAX,
Hal Finkel46479192013-04-01 17:52:07 +0000166 FeatureFPRND, FeatureFPCVT, FeatureISEL,
167 FeaturePOPCNTD, FeatureLDBRX, Feature64Bit
168 /*, Feature64BitRegs */]>;
Hal Finkelefdd4672013-03-28 19:25:55 +0000169def : Processor<"a2q", PPCA2Itineraries,
170 [DirectiveA2, FeatureBookE, FeatureMFOCRF,
Hal Finkel827307b2013-04-03 04:01:11 +0000171 FeatureFSqrt, FeatureFRE, FeatureFRES,
172 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
173 FeatureSTFIWX, FeatureLFIWAX,
Hal Finkel46479192013-04-01 17:52:07 +0000174 FeatureFPRND, FeatureFPCVT, FeatureISEL,
175 FeaturePOPCNTD, FeatureLDBRX, Feature64Bit
176 /*, Feature64BitRegs */, FeatureQPX]>;
Bill Schmidtcdc3b742013-02-01 22:59:51 +0000177def : Processor<"pwr3", G5Itineraries,
Hal Finkel827307b2013-04-03 04:01:11 +0000178 [DirectivePwr3, FeatureAltivec,
179 FeatureFRES, FeatureFRSQRTE, FeatureMFOCRF,
Bill Schmidtcdc3b742013-02-01 22:59:51 +0000180 FeatureSTFIWX, Feature64Bit]>;
181def : Processor<"pwr4", G5Itineraries,
182 [DirectivePwr4, FeatureAltivec, FeatureMFOCRF,
Hal Finkel827307b2013-04-03 04:01:11 +0000183 FeatureFSqrt, FeatureFRES, FeatureFRSQRTE,
184 FeatureSTFIWX, Feature64Bit]>;
Bill Schmidtcdc3b742013-02-01 22:59:51 +0000185def : Processor<"pwr5", G5Itineraries,
186 [DirectivePwr5, FeatureAltivec, FeatureMFOCRF,
Hal Finkel827307b2013-04-03 04:01:11 +0000187 FeatureFSqrt, FeatureFRE, FeatureFRES,
188 FeatureFRSQRTE, FeatureFRSQRTES,
189 FeatureSTFIWX, Feature64Bit]>;
Bill Schmidtcdc3b742013-02-01 22:59:51 +0000190def : Processor<"pwr5x", G5Itineraries,
191 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
Hal Finkel827307b2013-04-03 04:01:11 +0000192 FeatureFSqrt, FeatureFRE, FeatureFRES,
193 FeatureFRSQRTE, FeatureFRSQRTES,
194 FeatureSTFIWX, FeatureFPRND, Feature64Bit]>;
Hal Finkel622382f2012-06-11 15:43:08 +0000195def : Processor<"pwr6", G5Itineraries,
196 [DirectivePwr6, FeatureAltivec,
Hal Finkel827307b2013-04-03 04:01:11 +0000197 FeatureMFOCRF, FeatureFSqrt, FeatureFRE,
198 FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
199 FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX,
200 FeatureFPRND, Feature64Bit /*, Feature64BitRegs */]>;
Bill Schmidtcdc3b742013-02-01 22:59:51 +0000201def : Processor<"pwr6x", G5Itineraries,
202 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
Hal Finkel827307b2013-04-03 04:01:11 +0000203 FeatureFSqrt, FeatureFRE, FeatureFRES,
204 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec,
205 FeatureSTFIWX, FeatureLFIWAX,
Hal Finkel8049ab12013-03-31 10:12:51 +0000206 FeatureFPRND, Feature64Bit]>;
Hal Finkel622382f2012-06-11 15:43:08 +0000207def : Processor<"pwr7", G5Itineraries,
208 [DirectivePwr7, FeatureAltivec,
Hal Finkel827307b2013-04-03 04:01:11 +0000209 FeatureMFOCRF, FeatureFSqrt, FeatureFRE,
210 FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES,
211 FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX,
212 FeatureFPRND, FeatureFPCVT, FeatureISEL,
213 FeaturePOPCNTD, FeatureLDBRX,
Hal Finkel46479192013-04-01 17:52:07 +0000214 Feature64Bit /*, Feature64BitRegs */]>;
Jim Laskeyc35010d2006-12-12 20:57:08 +0000215def : Processor<"ppc", G3Itineraries, [Directive32]>;
216def : Processor<"ppc64", G5Itineraries,
217 [Directive64, FeatureAltivec,
Hal Finkelbd5cafd2012-06-11 19:57:01 +0000218 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Jim Laskey5476b9b2005-10-22 08:04:24 +0000219 Feature64Bit /*, Feature64BitRegs */]>;
Jim Laskey53842142005-10-19 19:51:16 +0000220
221
Chris Lattnerb9a7bea2007-03-06 00:59:59 +0000222//===----------------------------------------------------------------------===//
223// Calling Conventions
224//===----------------------------------------------------------------------===//
225
226include "PPCCallingConv.td"
227
Chris Lattner88d211f2006-03-12 09:13:49 +0000228def PPCInstrInfo : InstrInfo {
Chris Lattner88d211f2006-03-12 09:13:49 +0000229 let isLittleEndianEncoding = 1;
230}
231
Chris Lattner84a04ad2010-11-15 03:53:53 +0000232def PPCAsmWriter : AsmWriter {
233 string AsmWriterClassName = "InstPrinter";
234 bit isMCAsmWriter = 1;
235}
Chris Lattner88d211f2006-03-12 09:13:49 +0000236
Chris Lattner4c7b43b2005-10-14 23:37:35 +0000237def PPC : Target {
Chris Lattner88d211f2006-03-12 09:13:49 +0000238 // Information about the instructions.
239 let InstructionSet = PPCInstrInfo;
Chris Lattner84a04ad2010-11-15 03:53:53 +0000240
241 let AssemblyWriters = [PPCAsmWriter];
Chris Lattner4c7b43b2005-10-14 23:37:35 +0000242}