1//===-- PPC.td - Describe the PowerPC Target Machine -------*- tablegen -*-===// 2// 3// 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 6// 7//===----------------------------------------------------------------------===// 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// 15include "llvm/Target/Target.td" 16 17//===----------------------------------------------------------------------===// 18// PowerPC Subtarget features. 19// 20 21//===----------------------------------------------------------------------===// 22// CPU Directives // 23//===----------------------------------------------------------------------===// 24 25def Directive440 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_440", "">; 26def Directive601 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_601", "">; 27def Directive602 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_602", "">; 28def Directive603 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_603", "">; 29def Directive604 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_603", "">; 30def Directive620 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_603", "">; 31def Directive7400: SubtargetFeature<"", "CPUDirective", "PPC::DIR_7400", "">; 32def Directive750 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_750", "">; 33def Directive970 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_970", "">; 34def Directive32 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_32", "">; 35def Directive64 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_64", "">; 36def DirectiveA2 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_A2", "">; 37def DirectiveE500 : SubtargetFeature<"", "CPUDirective", 38 "PPC::DIR_E500", "">; 39def DirectiveE500mc : SubtargetFeature<"", "CPUDirective", 40 "PPC::DIR_E500mc", "">; 41def DirectiveE5500 : SubtargetFeature<"", "CPUDirective", 42 "PPC::DIR_E5500", "">; 43def DirectivePwr3: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR3", "">; 44def DirectivePwr4: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR4", "">; 45def DirectivePwr5: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR5", "">; 46def DirectivePwr5x 47 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR5X", "">; 48def DirectivePwr6: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR6", "">; 49def DirectivePwr6x 50 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR6X", "">; 51def DirectivePwr7: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR7", "">; 52def DirectivePwr8: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR8", "">; 53def DirectivePwr9: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR9", "">; 54def DirectivePwr10: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR10", "">; 55def DirectivePwrFuture 56 : SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR_FUTURE", "">; 57 58def Feature64Bit : SubtargetFeature<"64bit","Has64BitSupport", "true", 59 "Enable 64-bit instructions">; 60def FeatureHardFloat : SubtargetFeature<"hard-float", "HasHardFloat", "true", 61 "Enable floating-point instructions">; 62def Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true", 63 "Enable 64-bit registers usage for ppc32 [beta]">; 64def FeatureCRBits : SubtargetFeature<"crbits", "UseCRBits", "true", 65 "Use condition-register bits individually">; 66def FeatureFPU : SubtargetFeature<"fpu","HasFPU","true", 67 "Enable classic FPU instructions", 68 [FeatureHardFloat]>; 69def FeatureAltivec : SubtargetFeature<"altivec","HasAltivec", "true", 70 "Enable Altivec instructions", 71 [FeatureFPU]>; 72def FeatureSPE : SubtargetFeature<"spe","HasSPE", "true", 73 "Enable SPE instructions", 74 [FeatureHardFloat]>; 75def FeatureMFOCRF : SubtargetFeature<"mfocrf","HasMFOCRF", "true", 76 "Enable the MFOCRF instruction">; 77def FeatureFSqrt : SubtargetFeature<"fsqrt","HasFSQRT", "true", 78 "Enable the fsqrt instruction", 79 [FeatureFPU]>; 80def FeatureFCPSGN : SubtargetFeature<"fcpsgn", "HasFCPSGN", "true", 81 "Enable the fcpsgn instruction", 82 [FeatureFPU]>; 83def FeatureFRE : SubtargetFeature<"fre", "HasFRE", "true", 84 "Enable the fre instruction", 85 [FeatureFPU]>; 86def FeatureFRES : SubtargetFeature<"fres", "HasFRES", "true", 87 "Enable the fres instruction", 88 [FeatureFPU]>; 89def FeatureFRSQRTE : SubtargetFeature<"frsqrte", "HasFRSQRTE", "true", 90 "Enable the frsqrte instruction", 91 [FeatureFPU]>; 92def FeatureFRSQRTES : SubtargetFeature<"frsqrtes", "HasFRSQRTES", "true", 93 "Enable the frsqrtes instruction", 94 [FeatureFPU]>; 95def FeatureRecipPrec : SubtargetFeature<"recipprec", "HasRecipPrec", "true", 96 "Assume higher precision reciprocal estimates">; 97def FeatureSTFIWX : SubtargetFeature<"stfiwx","HasSTFIWX", "true", 98 "Enable the stfiwx instruction", 99 [FeatureFPU]>; 100def FeatureLFIWAX : SubtargetFeature<"lfiwax","HasLFIWAX", "true", 101 "Enable the lfiwax instruction", 102 [FeatureFPU]>; 103def FeatureFPRND : SubtargetFeature<"fprnd", "HasFPRND", "true", 104 "Enable the fri[mnpz] instructions", 105 [FeatureFPU]>; 106def FeatureFPCVT : SubtargetFeature<"fpcvt", "HasFPCVT", "true", 107 "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions", 108 [FeatureFPU]>; 109def FeatureISEL : SubtargetFeature<"isel","HasISEL", "true", 110 "Enable the isel instruction">; 111def FeatureBPERMD : SubtargetFeature<"bpermd", "HasBPERMD", "true", 112 "Enable the bpermd instruction">; 113def FeatureExtDiv : SubtargetFeature<"extdiv", "HasExtDiv", "true", 114 "Enable extended divide instructions">; 115def FeatureLDBRX : SubtargetFeature<"ldbrx","HasLDBRX", "true", 116 "Enable the ldbrx instruction">; 117def FeatureCMPB : SubtargetFeature<"cmpb", "HasCMPB", "true", 118 "Enable the cmpb instruction">; 119def FeatureICBT : SubtargetFeature<"icbt","HasICBT", "true", 120 "Enable icbt instruction">; 121def FeatureBookE : SubtargetFeature<"booke", "IsBookE", "true", 122 "Enable Book E instructions", 123 [FeatureICBT]>; 124def FeatureMSYNC : SubtargetFeature<"msync", "HasOnlyMSYNC", "true", 125 "Has only the msync instruction instead of sync", 126 [FeatureBookE]>; 127def FeatureE500 : SubtargetFeature<"e500", "IsE500", "true", 128 "Enable E500/E500mc instructions">; 129def FeatureSecurePlt : SubtargetFeature<"secure-plt","SecurePlt", "true", 130 "Enable secure plt mode">; 131def FeaturePPC4xx : SubtargetFeature<"ppc4xx", "IsPPC4xx", "true", 132 "Enable PPC 4xx instructions">; 133def FeaturePPC6xx : SubtargetFeature<"ppc6xx", "IsPPC6xx", "true", 134 "Enable PPC 6xx instructions">; 135def FeatureVSX : SubtargetFeature<"vsx","HasVSX", "true", 136 "Enable VSX instructions", 137 [FeatureAltivec]>; 138def FeatureTwoConstNR : 139 SubtargetFeature<"two-const-nr", "NeedsTwoConstNR", "true", 140 "Requires two constant Newton-Raphson computation">; 141def FeatureP8Altivec : SubtargetFeature<"power8-altivec", "HasP8Altivec", "true", 142 "Enable POWER8 Altivec instructions", 143 [FeatureAltivec]>; 144def FeatureP8Crypto : SubtargetFeature<"crypto", "HasP8Crypto", "true", 145 "Enable POWER8 Crypto instructions", 146 [FeatureP8Altivec]>; 147def FeatureP8Vector : SubtargetFeature<"power8-vector", "HasP8Vector", "true", 148 "Enable POWER8 vector instructions", 149 [FeatureVSX, FeatureP8Altivec]>; 150def FeatureDirectMove : 151 SubtargetFeature<"direct-move", "HasDirectMove", "true", 152 "Enable Power8 direct move instructions", 153 [FeatureVSX]>; 154def FeaturePartwordAtomic : SubtargetFeature<"partword-atomics", 155 "HasPartwordAtomics", "true", 156 "Enable l[bh]arx and st[bh]cx.">; 157def FeatureInvariantFunctionDescriptors : 158 SubtargetFeature<"invariant-function-descriptors", 159 "HasInvariantFunctionDescriptors", "true", 160 "Assume function descriptors are invariant">; 161def FeatureLongCall : SubtargetFeature<"longcall", "UseLongCalls", "true", 162 "Always use indirect calls">; 163def FeatureHTM : SubtargetFeature<"htm", "HasHTM", "true", 164 "Enable Hardware Transactional Memory instructions">; 165def FeatureMFTB : SubtargetFeature<"", "FeatureMFTB", "true", 166 "Implement mftb using the mfspr instruction">; 167def FeatureFusion : SubtargetFeature<"fusion", "HasFusion", "true", 168 "Target supports instruction fusion">; 169def FeatureAddiLoadFusion : SubtargetFeature<"fuse-addi-load", 170 "HasAddiLoadFusion", "true", 171 "Power8 Addi-Load fusion", 172 [FeatureFusion]>; 173def FeatureAddisLoadFusion : SubtargetFeature<"fuse-addis-load", 174 "HasAddisLoadFusion", "true", 175 "Power8 Addis-Load fusion", 176 [FeatureFusion]>; 177def FeatureUnalignedFloats : 178 SubtargetFeature<"allow-unaligned-fp-access", "AllowsUnalignedFPAccess", 179 "true", "CPU does not trap on unaligned FP access">; 180def FeaturePPCPreRASched: 181 SubtargetFeature<"ppc-prera-sched", "UsePPCPreRASchedStrategy", "true", 182 "Use PowerPC pre-RA scheduling strategy">; 183def FeaturePPCPostRASched: 184 SubtargetFeature<"ppc-postra-sched", "UsePPCPostRASchedStrategy", "true", 185 "Use PowerPC post-RA scheduling strategy">; 186def FeatureFloat128 : 187 SubtargetFeature<"float128", "HasFloat128", "true", 188 "Enable the __float128 data type for IEEE-754R Binary128.", 189 [FeatureVSX]>; 190def FeaturePOPCNTD : SubtargetFeature<"popcntd","HasPOPCNTD", 191 "POPCNTD_Fast", 192 "Enable the popcnt[dw] instructions">; 193// Note that for the a2 processor models we should not use popcnt[dw] by 194// default. These processors do support the instructions, but they're 195// microcoded, and the software emulation is about twice as fast. 196def FeatureSlowPOPCNTD : SubtargetFeature<"slow-popcntd","HasPOPCNTD", 197 "POPCNTD_Slow", 198 "Has slow popcnt[dw] instructions">; 199 200def DeprecatedDST : SubtargetFeature<"", "DeprecatedDST", "true", 201 "Treat vector data stream cache control instructions as deprecated">; 202 203def FeatureISA3_0 : SubtargetFeature<"isa-v30-instructions", "IsISA3_0", 204 "true", 205 "Enable instructions in ISA 3.0.">; 206def FeatureISA3_1 : SubtargetFeature<"isa-v31-instructions", "IsISA3_1", 207 "true", 208 "Enable instructions in ISA 3.1.", 209 [FeatureISA3_0]>; 210def FeatureP9Altivec : SubtargetFeature<"power9-altivec", "HasP9Altivec", "true", 211 "Enable POWER9 Altivec instructions", 212 [FeatureISA3_0, FeatureP8Altivec]>; 213def FeatureP9Vector : SubtargetFeature<"power9-vector", "HasP9Vector", "true", 214 "Enable POWER9 vector instructions", 215 [FeatureISA3_0, FeatureP8Vector, 216 FeatureP9Altivec]>; 217def FeatureP10Vector : SubtargetFeature<"power10-vector", "HasP10Vector", 218 "true", 219 "Enable POWER10 vector instructions", 220 [FeatureISA3_1, FeatureP9Vector]>; 221// A separate feature for this even though it is equivalent to P9Vector 222// because this is a feature of the implementation rather than the architecture 223// and may go away with future CPU's. 224def FeatureVectorsUseTwoUnits : SubtargetFeature<"vectors-use-two-units", 225 "VectorsUseTwoUnits", 226 "true", 227 "Vectors use two units">; 228def FeaturePrefixInstrs : SubtargetFeature<"prefix-instrs", "HasPrefixInstrs", 229 "true", 230 "Enable prefixed instructions", 231 [FeatureISA3_0, FeatureP8Vector, 232 FeatureP9Altivec]>; 233def FeaturePCRelativeMemops : 234 SubtargetFeature<"pcrelative-memops", "HasPCRelativeMemops", "true", 235 "Enable PC relative Memory Ops", 236 [FeatureISA3_0]>; 237def FeaturePairedVectorMemops: 238 SubtargetFeature<"paired-vector-memops", "PairedVectorMemops", "true", 239 "32Byte load and store instructions", 240 [FeatureISA3_0]>; 241def FeatureMMA : SubtargetFeature<"mma", "HasMMA", "true", 242 "Enable MMA instructions", 243 [FeatureP8Vector, FeatureP9Altivec, 244 FeaturePairedVectorMemops]>; 245 246def FeaturePredictableSelectIsExpensive : 247 SubtargetFeature<"predictable-select-expensive", 248 "PredictableSelectIsExpensive", 249 "true", 250 "Prefer likely predicted branches over selects">; 251 252// Since new processors generally contain a superset of features of those that 253// came before them, the idea is to make implementations of new processors 254// less error prone and easier to read. 255// Namely: 256// list<SubtargetFeature> P8InheritableFeatures = ... 257// list<SubtargetFeature> FutureProcessorAddtionalFeatures = 258// [ features that Power8 does not support but inheritable ] 259// list<SubtargetFeature> FutureProcessorSpecificFeatures = 260// [ features that Power8 does not support and not inheritable ] 261// list<SubtargetFeature> FutureProcessorInheritableFeatures = 262// !listconcat(P8InheritableFeatures, FutureProcessorAddtionalFeatures) 263// list<SubtargetFeature> FutureProcessorFeatures = 264// !listconcat(FutureProcessorInheritableFeatures, 265// FutureProcessorSpecificFeatures) 266 267// Makes it explicit and obvious what is new in FutureProcessor vs. Power8 as 268// well as providing a single point of definition if the feature set will be 269// used elsewhere. 270def ProcessorFeatures { 271 // Power7 272 list<SubtargetFeature> P7InheritableFeatures = [DirectivePwr7, 273 FeatureAltivec, 274 FeatureVSX, 275 FeatureMFOCRF, 276 FeatureFCPSGN, 277 FeatureFSqrt, 278 FeatureFRE, 279 FeatureFRES, 280 FeatureFRSQRTE, 281 FeatureFRSQRTES, 282 FeatureRecipPrec, 283 FeatureSTFIWX, 284 FeatureLFIWAX, 285 FeatureFPRND, 286 FeatureFPCVT, 287 FeatureISEL, 288 FeaturePOPCNTD, 289 FeatureCMPB, 290 FeatureLDBRX, 291 Feature64Bit, 292 /* Feature64BitRegs, */ 293 FeatureBPERMD, 294 FeatureExtDiv, 295 FeatureMFTB, 296 DeprecatedDST, 297 FeatureTwoConstNR, 298 FeatureUnalignedFloats]; 299 list<SubtargetFeature> P7SpecificFeatures = []; 300 list<SubtargetFeature> P7Features = 301 !listconcat(P7InheritableFeatures, P7SpecificFeatures); 302 303 // Power8 304 list<SubtargetFeature> P8AdditionalFeatures = 305 [DirectivePwr8, 306 FeatureP8Altivec, 307 FeatureP8Vector, 308 FeatureP8Crypto, 309 FeatureHTM, 310 FeatureDirectMove, 311 FeatureICBT, 312 FeaturePartwordAtomic, 313 FeaturePredictableSelectIsExpensive 314 ]; 315 316 list<SubtargetFeature> P8SpecificFeatures = [FeatureAddiLoadFusion, 317 FeatureAddisLoadFusion]; 318 list<SubtargetFeature> P8InheritableFeatures = 319 !listconcat(P7InheritableFeatures, P8AdditionalFeatures); 320 list<SubtargetFeature> P8Features = 321 !listconcat(P8InheritableFeatures, P8SpecificFeatures); 322 323 // Power9 324 list<SubtargetFeature> P9AdditionalFeatures = 325 [DirectivePwr9, 326 FeatureP9Altivec, 327 FeatureP9Vector, 328 FeatureISA3_0, 329 FeaturePredictableSelectIsExpensive 330 ]; 331 332 // Some features are unique to Power9 and there is no reason to assume 333 // they will be part of any future CPUs. One example is the narrower 334 // dispatch for vector operations than scalar ones. For the time being, 335 // this list also includes scheduling-related features since we do not have 336 // enough info to create custom scheduling strategies for future CPUs. 337 list<SubtargetFeature> P9SpecificFeatures = [FeatureVectorsUseTwoUnits, 338 FeaturePPCPreRASched, 339 FeaturePPCPostRASched]; 340 list<SubtargetFeature> P9InheritableFeatures = 341 !listconcat(P8InheritableFeatures, P9AdditionalFeatures); 342 list<SubtargetFeature> P9Features = 343 !listconcat(P9InheritableFeatures, P9SpecificFeatures); 344 345 // Power10 346 // For P10 CPU we assume that all of the existing features from Power9 347 // still exist with the exception of those we know are Power9 specific. 348 list<SubtargetFeature> P10AdditionalFeatures = 349 [DirectivePwr10, FeatureISA3_1, FeaturePrefixInstrs, 350 FeaturePCRelativeMemops, FeatureP10Vector, FeatureMMA, 351 FeaturePairedVectorMemops]; 352 list<SubtargetFeature> P10SpecificFeatures = []; 353 list<SubtargetFeature> P10InheritableFeatures = 354 !listconcat(P9InheritableFeatures, P10AdditionalFeatures); 355 list<SubtargetFeature> P10Features = 356 !listconcat(P10InheritableFeatures, P10SpecificFeatures); 357 358 // Future 359 // For future CPU we assume that all of the existing features from Power10 360 // still exist with the exception of those we know are Power10 specific. 361 list<SubtargetFeature> FutureAdditionalFeatures = []; 362 list<SubtargetFeature> FutureSpecificFeatures = []; 363 list<SubtargetFeature> FutureInheritableFeatures = 364 !listconcat(P10InheritableFeatures, FutureAdditionalFeatures); 365 list<SubtargetFeature> FutureFeatures = 366 !listconcat(FutureInheritableFeatures, FutureSpecificFeatures); 367} 368 369// Note: Future features to add when support is extended to more 370// recent ISA levels: 371// 372// DFP p6, p6x, p7 decimal floating-point instructions 373// POPCNTB p5 through p7 popcntb and related instructions 374 375//===----------------------------------------------------------------------===// 376// Classes used for relation maps. 377//===----------------------------------------------------------------------===// 378// RecFormRel - Filter class used to relate non-record-form instructions with 379// their record-form variants. 380class RecFormRel; 381 382// AltVSXFMARel - Filter class used to relate the primary addend-killing VSX 383// FMA instruction forms with their corresponding factor-killing forms. 384class AltVSXFMARel { 385 bit IsVSXFMAAlt = 0; 386} 387 388//===----------------------------------------------------------------------===// 389// Relation Map Definitions. 390//===----------------------------------------------------------------------===// 391 392def getRecordFormOpcode : InstrMapping { 393 let FilterClass = "RecFormRel"; 394 // Instructions with the same BaseName and Interpretation64Bit values 395 // form a row. 396 let RowFields = ["BaseName", "Interpretation64Bit"]; 397 // Instructions with the same RC value form a column. 398 let ColFields = ["RC"]; 399 // The key column are the non-record-form instructions. 400 let KeyCol = ["0"]; 401 // Value columns RC=1 402 let ValueCols = [["1"]]; 403} 404 405def getNonRecordFormOpcode : InstrMapping { 406 let FilterClass = "RecFormRel"; 407 // Instructions with the same BaseName and Interpretation64Bit values 408 // form a row. 409 let RowFields = ["BaseName", "Interpretation64Bit"]; 410 // Instructions with the same RC value form a column. 411 let ColFields = ["RC"]; 412 // The key column are the record-form instructions. 413 let KeyCol = ["1"]; 414 // Value columns are RC=0 415 let ValueCols = [["0"]]; 416} 417 418def getAltVSXFMAOpcode : InstrMapping { 419 let FilterClass = "AltVSXFMARel"; 420 // Instructions with the same BaseName value form a row. 421 let RowFields = ["BaseName"]; 422 // Instructions with the same IsVSXFMAAlt value form a column. 423 let ColFields = ["IsVSXFMAAlt"]; 424 // The key column are the (default) addend-killing instructions. 425 let KeyCol = ["0"]; 426 // Value columns IsVSXFMAAlt=1 427 let ValueCols = [["1"]]; 428} 429 430//===----------------------------------------------------------------------===// 431// Register File Description 432//===----------------------------------------------------------------------===// 433 434include "PPCRegisterInfo.td" 435include "PPCSchedule.td" 436 437//===----------------------------------------------------------------------===// 438// PowerPC processors supported. 439// 440 441def : Processor<"generic", G3Itineraries, [Directive32, FeatureHardFloat, 442 FeatureMFTB]>; 443def : ProcessorModel<"440", PPC440Model, [Directive440, FeatureISEL, 444 FeatureFRES, FeatureFRSQRTE, 445 FeatureICBT, FeatureBookE, 446 FeatureMSYNC, FeatureMFTB]>; 447def : ProcessorModel<"450", PPC440Model, [Directive440, FeatureISEL, 448 FeatureFRES, FeatureFRSQRTE, 449 FeatureICBT, FeatureBookE, 450 FeatureMSYNC, FeatureMFTB]>; 451def : Processor<"601", G3Itineraries, [Directive601, FeatureFPU]>; 452def : Processor<"602", G3Itineraries, [Directive602, FeatureFPU, 453 FeatureMFTB]>; 454def : Processor<"603", G3Itineraries, [Directive603, 455 FeatureFRES, FeatureFRSQRTE, 456 FeatureMFTB]>; 457def : Processor<"603e", G3Itineraries, [Directive603, 458 FeatureFRES, FeatureFRSQRTE, 459 FeatureMFTB]>; 460def : Processor<"603ev", G3Itineraries, [Directive603, 461 FeatureFRES, FeatureFRSQRTE, 462 FeatureMFTB]>; 463def : Processor<"604", G3Itineraries, [Directive604, 464 FeatureFRES, FeatureFRSQRTE, 465 FeatureMFTB]>; 466def : Processor<"604e", G3Itineraries, [Directive604, 467 FeatureFRES, FeatureFRSQRTE, 468 FeatureMFTB]>; 469def : Processor<"620", G3Itineraries, [Directive620, 470 FeatureFRES, FeatureFRSQRTE, 471 FeatureMFTB]>; 472def : Processor<"750", G4Itineraries, [Directive750, 473 FeatureFRES, FeatureFRSQRTE, 474 FeatureMFTB]>; 475def : Processor<"g3", G3Itineraries, [Directive750, 476 FeatureFRES, FeatureFRSQRTE, 477 FeatureMFTB]>; 478def : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec, 479 FeatureFRES, FeatureFRSQRTE, 480 FeatureMFTB]>; 481def : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec, 482 FeatureFRES, FeatureFRSQRTE, 483 FeatureMFTB]>; 484def : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec, 485 FeatureFRES, FeatureFRSQRTE, 486 FeatureMFTB]>; 487def : Processor<"g4+", G4PlusItineraries, [Directive7400, FeatureAltivec, 488 FeatureFRES, FeatureFRSQRTE, 489 FeatureMFTB]>; 490 491def : ProcessorModel<"970", G5Model, 492 [Directive970, FeatureAltivec, 493 FeatureMFOCRF, FeatureFSqrt, 494 FeatureFRES, FeatureFRSQRTE, FeatureSTFIWX, 495 Feature64Bit /*, Feature64BitRegs */, 496 FeatureMFTB]>; 497def : ProcessorModel<"g5", G5Model, 498 [Directive970, FeatureAltivec, 499 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX, 500 FeatureFRES, FeatureFRSQRTE, 501 Feature64Bit /*, Feature64BitRegs */, 502 FeatureMFTB, DeprecatedDST]>; 503def : ProcessorModel<"e500", PPCE500Model, 504 [DirectiveE500, 505 FeatureICBT, FeatureBookE, 506 FeatureISEL, FeatureMFTB, FeatureMSYNC, FeatureSPE]>; 507def : ProcessorModel<"e500mc", PPCE500mcModel, 508 [DirectiveE500mc, 509 FeatureSTFIWX, FeatureICBT, FeatureBookE, 510 FeatureISEL, FeatureMFTB]>; 511def : ProcessorModel<"e5500", PPCE5500Model, 512 [DirectiveE5500, FeatureMFOCRF, Feature64Bit, 513 FeatureSTFIWX, FeatureICBT, FeatureBookE, 514 FeatureISEL, FeatureMFTB]>; 515def : ProcessorModel<"a2", PPCA2Model, 516 [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF, 517 FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES, 518 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec, 519 FeatureSTFIWX, FeatureLFIWAX, 520 FeatureFPRND, FeatureFPCVT, FeatureISEL, 521 FeatureSlowPOPCNTD, FeatureCMPB, FeatureLDBRX, 522 Feature64Bit /*, Feature64BitRegs */, FeatureMFTB]>; 523def : ProcessorModel<"pwr3", G5Model, 524 [DirectivePwr3, FeatureAltivec, 525 FeatureFRES, FeatureFRSQRTE, FeatureMFOCRF, 526 FeatureSTFIWX, Feature64Bit]>; 527def : ProcessorModel<"pwr4", G5Model, 528 [DirectivePwr4, FeatureAltivec, FeatureMFOCRF, 529 FeatureFSqrt, FeatureFRES, FeatureFRSQRTE, 530 FeatureSTFIWX, Feature64Bit, FeatureMFTB]>; 531def : ProcessorModel<"pwr5", G5Model, 532 [DirectivePwr5, FeatureAltivec, FeatureMFOCRF, 533 FeatureFSqrt, FeatureFRE, FeatureFRES, 534 FeatureFRSQRTE, FeatureFRSQRTES, 535 FeatureSTFIWX, Feature64Bit, 536 FeatureMFTB, DeprecatedDST]>; 537def : ProcessorModel<"pwr5x", G5Model, 538 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF, 539 FeatureFSqrt, FeatureFRE, FeatureFRES, 540 FeatureFRSQRTE, FeatureFRSQRTES, 541 FeatureSTFIWX, FeatureFPRND, Feature64Bit, 542 FeatureMFTB, DeprecatedDST]>; 543def : ProcessorModel<"pwr6", G5Model, 544 [DirectivePwr6, FeatureAltivec, 545 FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE, 546 FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES, 547 FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB, 548 FeatureFPRND, Feature64Bit /*, Feature64BitRegs */, 549 FeatureMFTB, DeprecatedDST]>; 550def : ProcessorModel<"pwr6x", G5Model, 551 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF, 552 FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES, 553 FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec, 554 FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB, 555 FeatureFPRND, Feature64Bit, 556 FeatureMFTB, DeprecatedDST]>; 557def : ProcessorModel<"pwr7", P7Model, ProcessorFeatures.P7Features>; 558def : ProcessorModel<"pwr8", P8Model, ProcessorFeatures.P8Features>; 559def : ProcessorModel<"pwr9", P9Model, ProcessorFeatures.P9Features>; 560// No scheduler model yet. 561def : ProcessorModel<"pwr10", NoSchedModel, ProcessorFeatures.P10Features>; 562// No scheduler model for future CPU. 563def : ProcessorModel<"future", NoSchedModel, 564 ProcessorFeatures.FutureFeatures>; 565def : Processor<"ppc", G3Itineraries, [Directive32, FeatureHardFloat, 566 FeatureMFTB]>; 567def : Processor<"ppc32", G3Itineraries, [Directive32, FeatureHardFloat, 568 FeatureMFTB]>; 569def : ProcessorModel<"ppc64", G5Model, 570 [Directive64, FeatureAltivec, 571 FeatureMFOCRF, FeatureFSqrt, FeatureFRES, 572 FeatureFRSQRTE, FeatureSTFIWX, 573 Feature64Bit /*, Feature64BitRegs */, 574 FeatureMFTB]>; 575def : ProcessorModel<"ppc64le", P8Model, ProcessorFeatures.P8Features>; 576 577//===----------------------------------------------------------------------===// 578// Calling Conventions 579//===----------------------------------------------------------------------===// 580 581include "PPCCallingConv.td" 582 583def PPCInstrInfo : InstrInfo { 584 let isLittleEndianEncoding = 1; 585 586 // FIXME: Unset this when no longer needed! 587 let decodePositionallyEncodedOperands = 1; 588 589 let noNamedPositionallyEncodedOperands = 1; 590} 591 592def PPCAsmParser : AsmParser { 593 let ShouldEmitMatchRegisterName = 0; 594} 595 596def PPCAsmParserVariant : AsmParserVariant { 597 int Variant = 0; 598 599 // We do not use hard coded registers in asm strings. However, some 600 // InstAlias definitions use immediate literals. Set RegisterPrefix 601 // so that those are not misinterpreted as registers. 602 string RegisterPrefix = "%"; 603 string BreakCharacters = "."; 604} 605 606def PPC : Target { 607 // Information about the instructions. 608 let InstructionSet = PPCInstrInfo; 609 610 let AssemblyParsers = [PPCAsmParser]; 611 let AssemblyParserVariants = [PPCAsmParserVariant]; 612 let AllowRegisterRenaming = 1; 613} 614 615//===----------------------------------------------------------------------===// 616// Pfm Counters 617//===----------------------------------------------------------------------===// 618 619include "PPCPfmCounters.td" 620