blob: 602e33cd290af8891ec5e3249eb24dfee6d74c08 [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">;
Chris Lattnerbf751e22006-02-28 07:08:22 +000060def FeatureSTFIWX : SubtargetFeature<"stfiwx","HasSTFIWX", "true",
Hal Finkel8ee53e22011-10-14 18:54:13 +000061 "Enable the stfiwx instruction">;
Hal Finkel8049ab12013-03-31 10:12:51 +000062def FeatureLFIWAX : SubtargetFeature<"lfiwax","HasLFIWAX", "true",
63 "Enable the lfiwax instruction">;
Hal Finkelf5d5c432013-03-29 08:57:48 +000064def FeatureFPRND : SubtargetFeature<"fprnd", "HasFPRND", "true",
65 "Enable the fri[mnpz] instructions">;
Hal Finkel009f7af2012-06-22 23:10:08 +000066def FeatureISEL : SubtargetFeature<"isel","HasISEL", "true",
67 "Enable the isel instruction">;
Hal Finkelc53ab4d2013-03-28 13:29:47 +000068def FeaturePOPCNTD : SubtargetFeature<"popcntd","HasPOPCNTD", "true",
69 "Enable the popcnt[dw] instructions">;
Hal Finkelefdd4672013-03-28 19:25:55 +000070def FeatureLDBRX : SubtargetFeature<"ldbrx","HasLDBRX", "true",
71 "Enable the ldbrx instruction">;
Hal Finkelc6d08f12011-10-17 04:03:49 +000072def FeatureBookE : SubtargetFeature<"booke", "IsBookE", "true",
73 "Enable Book E instructions">;
Hal Finkel5bb16fd2013-01-30 21:17:42 +000074def FeatureQPX : SubtargetFeature<"qpx","HasQPX", "true",
75 "Enable QPX instructions">;
Jim Laskey53842142005-10-19 19:51:16 +000076
Bill Schmidtdbc86b92013-02-01 23:10:09 +000077// Note: Future features to add when support is extended to more
78// recent ISA levels:
79//
80// CMPB p6, p6x, p7 cmpb
81// DFP p6, p6x, p7 decimal floating-point instructions
82// FLT_CVT p7 fcfids, fcfidu, fcfidus, fcfiduz, fctiwuz
Bill Schmidtdbc86b92013-02-01 23:10:09 +000083// FRE p5 through p7 fre (vs. fres, available since p3)
84// FRSQRTES p5 through p7 frsqrtes (vs. frsqrte, available since p3)
Bill Schmidtdbc86b92013-02-01 23:10:09 +000085// LFIWZX p7 lfiwzx
86// POPCNTB p5 through p7 popcntb and related instructions
Bill Schmidtdbc86b92013-02-01 23:10:09 +000087// RECIP_PREC p6, p6x, p7 higher precision reciprocal estimates
88// VSX p7 vector-scalar instruction set
89
Jim Laskey53842142005-10-19 19:51:16 +000090//===----------------------------------------------------------------------===//
Chris Lattnerc8d28892005-10-23 22:08:13 +000091// Register File Description
92//===----------------------------------------------------------------------===//
93
94include "PPCRegisterInfo.td"
95include "PPCSchedule.td"
96include "PPCInstrInfo.td"
97
98//===----------------------------------------------------------------------===//
99// PowerPC processors supported.
Jim Laskey53842142005-10-19 19:51:16 +0000100//
101
Jim Laskeyc35010d2006-12-12 20:57:08 +0000102def : Processor<"generic", G3Itineraries, [Directive32]>;
Hal Finkel009f7af2012-06-22 23:10:08 +0000103def : Processor<"440", PPC440Itineraries, [Directive440, FeatureISEL,
104 FeatureBookE]>;
105def : Processor<"450", PPC440Itineraries, [Directive440, FeatureISEL,
106 FeatureBookE]>;
Jim Laskeyc35010d2006-12-12 20:57:08 +0000107def : Processor<"601", G3Itineraries, [Directive601]>;
108def : Processor<"602", G3Itineraries, [Directive602]>;
109def : Processor<"603", G3Itineraries, [Directive603]>;
110def : Processor<"603e", G3Itineraries, [Directive603]>;
111def : Processor<"603ev", G3Itineraries, [Directive603]>;
112def : Processor<"604", G3Itineraries, [Directive604]>;
113def : Processor<"604e", G3Itineraries, [Directive604]>;
114def : Processor<"620", G3Itineraries, [Directive620]>;
Hal Finkel6670c822012-06-12 16:39:23 +0000115def : Processor<"750", G4Itineraries, [Directive750]>;
116def : Processor<"g3", G3Itineraries, [Directive750]>;
Jim Laskeyc35010d2006-12-12 20:57:08 +0000117def : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec]>;
118def : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec]>;
119def : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec]>;
Hal Finkel6670c822012-06-12 16:39:23 +0000120def : Processor<"g4+", G4PlusItineraries, [Directive7400, FeatureAltivec]>;
Jim Laskey53842142005-10-19 19:51:16 +0000121def : Processor<"970", G5Itineraries,
Jim Laskeyc35010d2006-12-12 20:57:08 +0000122 [Directive970, FeatureAltivec,
Hal Finkelbd5cafd2012-06-11 19:57:01 +0000123 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Jim Laskey5476b9b2005-10-22 08:04:24 +0000124 Feature64Bit /*, Feature64BitRegs */]>;
Jim Laskey53842142005-10-19 19:51:16 +0000125def : Processor<"g5", G5Itineraries,
Jim Laskeyc35010d2006-12-12 20:57:08 +0000126 [Directive970, FeatureAltivec,
Hal Finkelbd5cafd2012-06-11 19:57:01 +0000127 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Jim Laskeyc35010d2006-12-12 20:57:08 +0000128 Feature64Bit /*, Feature64BitRegs */]>;
Hal Finkel621b77a2012-08-28 16:12:39 +0000129def : ProcessorModel<"e500mc", PPCE500mcModel,
130 [DirectiveE500mc, FeatureMFOCRF,
131 FeatureSTFIWX, FeatureBookE, FeatureISEL]>;
132def : ProcessorModel<"e5500", PPCE5500Model,
133 [DirectiveE5500, FeatureMFOCRF, Feature64Bit,
134 FeatureSTFIWX, FeatureBookE, FeatureISEL]>;
Hal Finkelefdd4672013-03-28 19:25:55 +0000135def : Processor<"a2", PPCA2Itineraries,
136 [DirectiveA2, FeatureBookE, FeatureMFOCRF,
Hal Finkel8049ab12013-03-31 10:12:51 +0000137 FeatureFSqrt, FeatureSTFIWX, FeatureLFIWAX,
138 FeatureFPRND, FeatureISEL, FeaturePOPCNTD,
139 FeatureLDBRX, Feature64Bit /*, Feature64BitRegs */]>;
Hal Finkelefdd4672013-03-28 19:25:55 +0000140def : Processor<"a2q", PPCA2Itineraries,
141 [DirectiveA2, FeatureBookE, FeatureMFOCRF,
Hal Finkel8049ab12013-03-31 10:12:51 +0000142 FeatureFSqrt, FeatureSTFIWX, FeatureLFIWAX,
143 FeatureFPRND, FeatureISEL, FeaturePOPCNTD,
144 FeatureLDBRX, Feature64Bit /*, Feature64BitRegs */,
145 FeatureQPX]>;
Bill Schmidtcdc3b742013-02-01 22:59:51 +0000146def : Processor<"pwr3", G5Itineraries,
147 [DirectivePwr3, FeatureAltivec, FeatureMFOCRF,
148 FeatureSTFIWX, Feature64Bit]>;
149def : Processor<"pwr4", G5Itineraries,
150 [DirectivePwr4, FeatureAltivec, FeatureMFOCRF,
151 FeatureFSqrt, FeatureSTFIWX, Feature64Bit]>;
152def : Processor<"pwr5", G5Itineraries,
153 [DirectivePwr5, FeatureAltivec, FeatureMFOCRF,
154 FeatureFSqrt, FeatureSTFIWX, Feature64Bit]>;
155def : Processor<"pwr5x", G5Itineraries,
156 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
Hal Finkelf5d5c432013-03-29 08:57:48 +0000157 FeatureFSqrt, FeatureSTFIWX, FeatureFPRND,
158 Feature64Bit]>;
Hal Finkel622382f2012-06-11 15:43:08 +0000159def : Processor<"pwr6", G5Itineraries,
160 [DirectivePwr6, FeatureAltivec,
Hal Finkelbd5cafd2012-06-11 19:57:01 +0000161 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Hal Finkel8049ab12013-03-31 10:12:51 +0000162 FeatureLFIWAX, FeatureFPRND, Feature64Bit
163 /*, Feature64BitRegs */]>;
Bill Schmidtcdc3b742013-02-01 22:59:51 +0000164def : Processor<"pwr6x", G5Itineraries,
165 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF,
Hal Finkel8049ab12013-03-31 10:12:51 +0000166 FeatureFSqrt, FeatureSTFIWX, FeatureLFIWAX,
167 FeatureFPRND, Feature64Bit]>;
Hal Finkel622382f2012-06-11 15:43:08 +0000168def : Processor<"pwr7", G5Itineraries,
169 [DirectivePwr7, FeatureAltivec,
Hal Finkelbd5cafd2012-06-11 19:57:01 +0000170 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Hal Finkel8049ab12013-03-31 10:12:51 +0000171 FeatureLFIWAX, FeatureFPRND, FeatureISEL,
172 FeaturePOPCNTD, FeatureLDBRX, Feature64Bit
173 /*, Feature64BitRegs */]>;
Jim Laskeyc35010d2006-12-12 20:57:08 +0000174def : Processor<"ppc", G3Itineraries, [Directive32]>;
175def : Processor<"ppc64", G5Itineraries,
176 [Directive64, FeatureAltivec,
Hal Finkelbd5cafd2012-06-11 19:57:01 +0000177 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Jim Laskey5476b9b2005-10-22 08:04:24 +0000178 Feature64Bit /*, Feature64BitRegs */]>;
Jim Laskey53842142005-10-19 19:51:16 +0000179
180
Chris Lattnerb9a7bea2007-03-06 00:59:59 +0000181//===----------------------------------------------------------------------===//
182// Calling Conventions
183//===----------------------------------------------------------------------===//
184
185include "PPCCallingConv.td"
186
Chris Lattner88d211f2006-03-12 09:13:49 +0000187def PPCInstrInfo : InstrInfo {
Chris Lattner88d211f2006-03-12 09:13:49 +0000188 let isLittleEndianEncoding = 1;
189}
190
Chris Lattner84a04ad2010-11-15 03:53:53 +0000191def PPCAsmWriter : AsmWriter {
192 string AsmWriterClassName = "InstPrinter";
193 bit isMCAsmWriter = 1;
194}
Chris Lattner88d211f2006-03-12 09:13:49 +0000195
Chris Lattner4c7b43b2005-10-14 23:37:35 +0000196def PPC : Target {
Chris Lattner88d211f2006-03-12 09:13:49 +0000197 // Information about the instructions.
198 let InstructionSet = PPCInstrInfo;
Chris Lattner84a04ad2010-11-15 03:53:53 +0000199
200 let AssemblyWriters = [PPCAsmWriter];
Chris Lattner4c7b43b2005-10-14 23:37:35 +0000201}