10b57cec5SDimitry Andric//===-- PPC.td - Describe the PowerPC Target Machine -------*- tablegen -*-===// 20b57cec5SDimitry Andric// 30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric// 70b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric// 90b57cec5SDimitry Andric// This is the top level entry point for the PowerPC target. 100b57cec5SDimitry Andric// 110b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric// Get the target-independent interfaces which we are implementing. 140b57cec5SDimitry Andric// 150b57cec5SDimitry Andricinclude "llvm/Target/Target.td" 160b57cec5SDimitry Andric 170b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 180b57cec5SDimitry Andric// PowerPC Subtarget features. 190b57cec5SDimitry Andric// 200b57cec5SDimitry Andric 210b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 220b57cec5SDimitry Andric// CPU Directives // 230b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 240b57cec5SDimitry Andric 250b57cec5SDimitry Andricdef Directive440 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_440", "">; 260b57cec5SDimitry Andricdef Directive601 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_601", "">; 270b57cec5SDimitry Andricdef Directive602 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_602", "">; 280b57cec5SDimitry Andricdef Directive603 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">; 290b57cec5SDimitry Andricdef Directive604 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">; 300b57cec5SDimitry Andricdef Directive620 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">; 310b57cec5SDimitry Andricdef Directive7400: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_7400", "">; 320b57cec5SDimitry Andricdef Directive750 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_750", "">; 330b57cec5SDimitry Andricdef Directive970 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_970", "">; 340b57cec5SDimitry Andricdef Directive32 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_32", "">; 350b57cec5SDimitry Andricdef Directive64 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_64", "">; 360b57cec5SDimitry Andricdef DirectiveA2 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_A2", "">; 370b57cec5SDimitry Andricdef DirectiveE500 : SubtargetFeature<"", "DarwinDirective", 380b57cec5SDimitry Andric "PPC::DIR_E500", "">; 390b57cec5SDimitry Andricdef DirectiveE500mc : SubtargetFeature<"", "DarwinDirective", 400b57cec5SDimitry Andric "PPC::DIR_E500mc", "">; 410b57cec5SDimitry Andricdef DirectiveE5500 : SubtargetFeature<"", "DarwinDirective", 420b57cec5SDimitry Andric "PPC::DIR_E5500", "">; 430b57cec5SDimitry Andricdef DirectivePwr3: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR3", "">; 440b57cec5SDimitry Andricdef DirectivePwr4: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR4", "">; 450b57cec5SDimitry Andricdef DirectivePwr5: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR5", "">; 460b57cec5SDimitry Andricdef DirectivePwr5x 470b57cec5SDimitry Andric : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR5X", "">; 480b57cec5SDimitry Andricdef DirectivePwr6: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6", "">; 490b57cec5SDimitry Andricdef DirectivePwr6x 500b57cec5SDimitry Andric : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6X", "">; 510b57cec5SDimitry Andricdef DirectivePwr7: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR7", "">; 520b57cec5SDimitry Andricdef DirectivePwr8: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR8", "">; 530b57cec5SDimitry Andricdef DirectivePwr9: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR9", "">; 540b57cec5SDimitry Andric 550b57cec5SDimitry Andricdef Feature64Bit : SubtargetFeature<"64bit","Has64BitSupport", "true", 560b57cec5SDimitry Andric "Enable 64-bit instructions">; 570b57cec5SDimitry Andricdef FeatureHardFloat : SubtargetFeature<"hard-float", "HasHardFloat", "true", 580b57cec5SDimitry Andric "Enable floating-point instructions">; 590b57cec5SDimitry Andricdef Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true", 600b57cec5SDimitry Andric "Enable 64-bit registers usage for ppc32 [beta]">; 610b57cec5SDimitry Andricdef FeatureCRBits : SubtargetFeature<"crbits", "UseCRBits", "true", 620b57cec5SDimitry Andric "Use condition-register bits individually">; 630b57cec5SDimitry Andricdef FeatureFPU : SubtargetFeature<"fpu","HasFPU","true", 640b57cec5SDimitry Andric "Enable classic FPU instructions", 650b57cec5SDimitry Andric [FeatureHardFloat]>; 660b57cec5SDimitry Andricdef FeatureAltivec : SubtargetFeature<"altivec","HasAltivec", "true", 670b57cec5SDimitry Andric "Enable Altivec instructions", 680b57cec5SDimitry Andric [FeatureFPU]>; 690b57cec5SDimitry Andricdef FeatureSPE : SubtargetFeature<"spe","HasSPE", "true", 700b57cec5SDimitry Andric "Enable SPE instructions", 710b57cec5SDimitry Andric [FeatureHardFloat]>; 720b57cec5SDimitry Andricdef FeatureMFOCRF : SubtargetFeature<"mfocrf","HasMFOCRF", "true", 730b57cec5SDimitry Andric "Enable the MFOCRF instruction">; 740b57cec5SDimitry Andricdef FeatureFSqrt : SubtargetFeature<"fsqrt","HasFSQRT", "true", 750b57cec5SDimitry Andric "Enable the fsqrt instruction", 760b57cec5SDimitry Andric [FeatureFPU]>; 770b57cec5SDimitry Andricdef FeatureFCPSGN : SubtargetFeature<"fcpsgn", "HasFCPSGN", "true", 780b57cec5SDimitry Andric "Enable the fcpsgn instruction", 790b57cec5SDimitry Andric [FeatureFPU]>; 800b57cec5SDimitry Andricdef FeatureFRE : SubtargetFeature<"fre", "HasFRE", "true", 810b57cec5SDimitry Andric "Enable the fre instruction", 820b57cec5SDimitry Andric [FeatureFPU]>; 830b57cec5SDimitry Andricdef FeatureFRES : SubtargetFeature<"fres", "HasFRES", "true", 840b57cec5SDimitry Andric "Enable the fres instruction", 850b57cec5SDimitry Andric [FeatureFPU]>; 860b57cec5SDimitry Andricdef FeatureFRSQRTE : SubtargetFeature<"frsqrte", "HasFRSQRTE", "true", 870b57cec5SDimitry Andric "Enable the frsqrte instruction", 880b57cec5SDimitry Andric [FeatureFPU]>; 890b57cec5SDimitry Andricdef FeatureFRSQRTES : SubtargetFeature<"frsqrtes", "HasFRSQRTES", "true", 900b57cec5SDimitry Andric "Enable the frsqrtes instruction", 910b57cec5SDimitry Andric [FeatureFPU]>; 920b57cec5SDimitry Andricdef FeatureRecipPrec : SubtargetFeature<"recipprec", "HasRecipPrec", "true", 930b57cec5SDimitry Andric "Assume higher precision reciprocal estimates">; 940b57cec5SDimitry Andricdef FeatureSTFIWX : SubtargetFeature<"stfiwx","HasSTFIWX", "true", 950b57cec5SDimitry Andric "Enable the stfiwx instruction", 960b57cec5SDimitry Andric [FeatureFPU]>; 970b57cec5SDimitry Andricdef FeatureLFIWAX : SubtargetFeature<"lfiwax","HasLFIWAX", "true", 980b57cec5SDimitry Andric "Enable the lfiwax instruction", 990b57cec5SDimitry Andric [FeatureFPU]>; 1000b57cec5SDimitry Andricdef FeatureFPRND : SubtargetFeature<"fprnd", "HasFPRND", "true", 1010b57cec5SDimitry Andric "Enable the fri[mnpz] instructions", 1020b57cec5SDimitry Andric [FeatureFPU]>; 1030b57cec5SDimitry Andricdef FeatureFPCVT : SubtargetFeature<"fpcvt", "HasFPCVT", "true", 1040b57cec5SDimitry Andric "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions", 1050b57cec5SDimitry Andric [FeatureFPU]>; 1060b57cec5SDimitry Andricdef FeatureISEL : SubtargetFeature<"isel","HasISEL", "true", 1070b57cec5SDimitry Andric "Enable the isel instruction">; 1080b57cec5SDimitry Andricdef FeatureBPERMD : SubtargetFeature<"bpermd", "HasBPERMD", "true", 1090b57cec5SDimitry Andric "Enable the bpermd instruction">; 1100b57cec5SDimitry Andricdef FeatureExtDiv : SubtargetFeature<"extdiv", "HasExtDiv", "true", 1110b57cec5SDimitry Andric "Enable extended divide instructions">; 1120b57cec5SDimitry Andricdef FeatureLDBRX : SubtargetFeature<"ldbrx","HasLDBRX", "true", 1130b57cec5SDimitry Andric "Enable the ldbrx instruction">; 1140b57cec5SDimitry Andricdef FeatureCMPB : SubtargetFeature<"cmpb", "HasCMPB", "true", 1150b57cec5SDimitry Andric "Enable the cmpb instruction">; 1160b57cec5SDimitry Andricdef FeatureICBT : SubtargetFeature<"icbt","HasICBT", "true", 1170b57cec5SDimitry Andric "Enable icbt instruction">; 1180b57cec5SDimitry Andricdef FeatureBookE : SubtargetFeature<"booke", "IsBookE", "true", 1190b57cec5SDimitry Andric "Enable Book E instructions", 1200b57cec5SDimitry Andric [FeatureICBT]>; 1210b57cec5SDimitry Andricdef FeatureMSYNC : SubtargetFeature<"msync", "HasOnlyMSYNC", "true", 1220b57cec5SDimitry Andric "Has only the msync instruction instead of sync", 1230b57cec5SDimitry Andric [FeatureBookE]>; 1240b57cec5SDimitry Andricdef FeatureE500 : SubtargetFeature<"e500", "IsE500", "true", 1250b57cec5SDimitry Andric "Enable E500/E500mc instructions">; 1260b57cec5SDimitry Andricdef FeatureSecurePlt : SubtargetFeature<"secure-plt","SecurePlt", "true", 1270b57cec5SDimitry Andric "Enable secure plt mode">; 1280b57cec5SDimitry Andricdef FeaturePPC4xx : SubtargetFeature<"ppc4xx", "IsPPC4xx", "true", 1290b57cec5SDimitry Andric "Enable PPC 4xx instructions">; 1300b57cec5SDimitry Andricdef FeaturePPC6xx : SubtargetFeature<"ppc6xx", "IsPPC6xx", "true", 1310b57cec5SDimitry Andric "Enable PPC 6xx instructions">; 1320b57cec5SDimitry Andricdef FeatureQPX : SubtargetFeature<"qpx","HasQPX", "true", 1330b57cec5SDimitry Andric "Enable QPX instructions", 1340b57cec5SDimitry Andric [FeatureFPU]>; 1350b57cec5SDimitry Andricdef FeatureVSX : SubtargetFeature<"vsx","HasVSX", "true", 1360b57cec5SDimitry Andric "Enable VSX instructions", 1370b57cec5SDimitry Andric [FeatureAltivec]>; 1380b57cec5SDimitry Andricdef FeatureTwoConstNR : 1390b57cec5SDimitry Andric SubtargetFeature<"two-const-nr", "NeedsTwoConstNR", "true", 1400b57cec5SDimitry Andric "Requires two constant Newton-Raphson computation">; 1410b57cec5SDimitry Andricdef FeatureP8Altivec : SubtargetFeature<"power8-altivec", "HasP8Altivec", "true", 1420b57cec5SDimitry Andric "Enable POWER8 Altivec instructions", 1430b57cec5SDimitry Andric [FeatureAltivec]>; 1440b57cec5SDimitry Andricdef FeatureP8Crypto : SubtargetFeature<"crypto", "HasP8Crypto", "true", 1450b57cec5SDimitry Andric "Enable POWER8 Crypto instructions", 1460b57cec5SDimitry Andric [FeatureP8Altivec]>; 1470b57cec5SDimitry Andricdef FeatureP8Vector : SubtargetFeature<"power8-vector", "HasP8Vector", "true", 1480b57cec5SDimitry Andric "Enable POWER8 vector instructions", 1490b57cec5SDimitry Andric [FeatureVSX, FeatureP8Altivec]>; 1500b57cec5SDimitry Andricdef FeatureDirectMove : 1510b57cec5SDimitry Andric SubtargetFeature<"direct-move", "HasDirectMove", "true", 1520b57cec5SDimitry Andric "Enable Power8 direct move instructions", 1530b57cec5SDimitry Andric [FeatureVSX]>; 1540b57cec5SDimitry Andricdef FeaturePartwordAtomic : SubtargetFeature<"partword-atomics", 1550b57cec5SDimitry Andric "HasPartwordAtomics", "true", 1560b57cec5SDimitry Andric "Enable l[bh]arx and st[bh]cx.">; 1570b57cec5SDimitry Andricdef FeatureInvariantFunctionDescriptors : 1580b57cec5SDimitry Andric SubtargetFeature<"invariant-function-descriptors", 1590b57cec5SDimitry Andric "HasInvariantFunctionDescriptors", "true", 1600b57cec5SDimitry Andric "Assume function descriptors are invariant">; 1610b57cec5SDimitry Andricdef FeatureLongCall : SubtargetFeature<"longcall", "UseLongCalls", "true", 1620b57cec5SDimitry Andric "Always use indirect calls">; 1630b57cec5SDimitry Andricdef FeatureHTM : SubtargetFeature<"htm", "HasHTM", "true", 1640b57cec5SDimitry Andric "Enable Hardware Transactional Memory instructions">; 1650b57cec5SDimitry Andricdef FeatureMFTB : SubtargetFeature<"", "FeatureMFTB", "true", 1660b57cec5SDimitry Andric "Implement mftb using the mfspr instruction">; 1670b57cec5SDimitry Andricdef FeaturePPCPreRASched: 1680b57cec5SDimitry Andric SubtargetFeature<"ppc-prera-sched", "UsePPCPreRASchedStrategy", "true", 1690b57cec5SDimitry Andric "Use PowerPC pre-RA scheduling strategy">; 1700b57cec5SDimitry Andricdef FeaturePPCPostRASched: 1710b57cec5SDimitry Andric SubtargetFeature<"ppc-postra-sched", "UsePPCPostRASchedStrategy", "true", 1720b57cec5SDimitry Andric "Use PowerPC post-RA scheduling strategy">; 1730b57cec5SDimitry Andricdef FeatureFloat128 : 1740b57cec5SDimitry Andric SubtargetFeature<"float128", "HasFloat128", "true", 1750b57cec5SDimitry Andric "Enable the __float128 data type for IEEE-754R Binary128.", 1760b57cec5SDimitry Andric [FeatureVSX]>; 1770b57cec5SDimitry Andricdef FeaturePOPCNTD : SubtargetFeature<"popcntd","HasPOPCNTD", 1780b57cec5SDimitry Andric "POPCNTD_Fast", 1790b57cec5SDimitry Andric "Enable the popcnt[dw] instructions">; 1800b57cec5SDimitry Andric// Note that for the a2/a2q processor models we should not use popcnt[dw] by 1810b57cec5SDimitry Andric// default. These processors do support the instructions, but they're 1820b57cec5SDimitry Andric// microcoded, and the software emulation is about twice as fast. 1830b57cec5SDimitry Andricdef FeatureSlowPOPCNTD : SubtargetFeature<"slow-popcntd","HasPOPCNTD", 1840b57cec5SDimitry Andric "POPCNTD_Slow", 1850b57cec5SDimitry Andric "Has slow popcnt[dw] instructions">; 1860b57cec5SDimitry Andric 1870b57cec5SDimitry Andricdef DeprecatedDST : SubtargetFeature<"", "DeprecatedDST", "true", 1880b57cec5SDimitry Andric "Treat vector data stream cache control instructions as deprecated">; 1890b57cec5SDimitry Andric 1900b57cec5SDimitry Andricdef FeatureISA3_0 : SubtargetFeature<"isa-v30-instructions", "IsISA3_0", 1910b57cec5SDimitry Andric "true", 1920b57cec5SDimitry Andric "Enable instructions added in ISA 3.0.">; 1930b57cec5SDimitry Andricdef FeatureP9Altivec : SubtargetFeature<"power9-altivec", "HasP9Altivec", "true", 1940b57cec5SDimitry Andric "Enable POWER9 Altivec instructions", 1950b57cec5SDimitry Andric [FeatureISA3_0, FeatureP8Altivec]>; 1960b57cec5SDimitry Andricdef FeatureP9Vector : SubtargetFeature<"power9-vector", "HasP9Vector", "true", 1970b57cec5SDimitry Andric "Enable POWER9 vector instructions", 1980b57cec5SDimitry Andric [FeatureISA3_0, FeatureP8Vector, 1990b57cec5SDimitry Andric FeatureP9Altivec]>; 2000b57cec5SDimitry Andric// A separate feature for this even though it is equivalent to P9Vector 2010b57cec5SDimitry Andric// because this is a feature of the implementation rather than the architecture 2020b57cec5SDimitry Andric// and may go away with future CPU's. 2030b57cec5SDimitry Andricdef FeatureVectorsUseTwoUnits : SubtargetFeature<"vectors-use-two-units", 2040b57cec5SDimitry Andric "VectorsUseTwoUnits", 2050b57cec5SDimitry Andric "true", 2060b57cec5SDimitry Andric "Vectors use two units">; 2070b57cec5SDimitry Andric 2080b57cec5SDimitry Andric// Since new processors generally contain a superset of features of those that 2090b57cec5SDimitry Andric// came before them, the idea is to make implementations of new processors 2100b57cec5SDimitry Andric// less error prone and easier to read. 2110b57cec5SDimitry Andric// Namely: 2120b57cec5SDimitry Andric// list<SubtargetFeature> Power8FeatureList = ... 2130b57cec5SDimitry Andric// list<SubtargetFeature> FutureProcessorSpecificFeatureList = 2140b57cec5SDimitry Andric// [ features that Power8 does not support ] 2150b57cec5SDimitry Andric// list<SubtargetFeature> FutureProcessorFeatureList = 2160b57cec5SDimitry Andric// !listconcat(Power8FeatureList, FutureProcessorSpecificFeatureList) 2170b57cec5SDimitry Andric 2180b57cec5SDimitry Andric// Makes it explicit and obvious what is new in FutureProcesor vs. Power8 as 2190b57cec5SDimitry Andric// well as providing a single point of definition if the feature set will be 2200b57cec5SDimitry Andric// used elsewhere. 2210b57cec5SDimitry Andricdef ProcessorFeatures { 2220b57cec5SDimitry Andric list<SubtargetFeature> Power7FeatureList = 2230b57cec5SDimitry Andric [DirectivePwr7, FeatureAltivec, FeatureVSX, 2240b57cec5SDimitry Andric FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE, 2250b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES, 2260b57cec5SDimitry Andric FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX, 2270b57cec5SDimitry Andric FeatureFPRND, FeatureFPCVT, FeatureISEL, 2280b57cec5SDimitry Andric FeaturePOPCNTD, FeatureCMPB, FeatureLDBRX, 2290b57cec5SDimitry Andric Feature64Bit /*, Feature64BitRegs */, 2300b57cec5SDimitry Andric FeatureBPERMD, FeatureExtDiv, 2310b57cec5SDimitry Andric FeatureMFTB, DeprecatedDST, FeatureTwoConstNR]; 2320b57cec5SDimitry Andric list<SubtargetFeature> Power8SpecificFeatures = 2330b57cec5SDimitry Andric [DirectivePwr8, FeatureP8Altivec, FeatureP8Vector, FeatureP8Crypto, 2340b57cec5SDimitry Andric FeatureHTM, FeatureDirectMove, FeatureICBT, FeaturePartwordAtomic]; 2350b57cec5SDimitry Andric list<SubtargetFeature> Power8FeatureList = 2360b57cec5SDimitry Andric !listconcat(Power7FeatureList, Power8SpecificFeatures); 2370b57cec5SDimitry Andric list<SubtargetFeature> Power9SpecificFeatures = 2380b57cec5SDimitry Andric [DirectivePwr9, FeatureP9Altivec, FeatureP9Vector, FeatureISA3_0, 2390b57cec5SDimitry Andric FeatureVectorsUseTwoUnits, FeaturePPCPreRASched, FeaturePPCPostRASched]; 2400b57cec5SDimitry Andric list<SubtargetFeature> Power9FeatureList = 2410b57cec5SDimitry Andric !listconcat(Power8FeatureList, Power9SpecificFeatures); 2420b57cec5SDimitry Andric} 2430b57cec5SDimitry Andric 2440b57cec5SDimitry Andric// Note: Future features to add when support is extended to more 2450b57cec5SDimitry Andric// recent ISA levels: 2460b57cec5SDimitry Andric// 2470b57cec5SDimitry Andric// DFP p6, p6x, p7 decimal floating-point instructions 2480b57cec5SDimitry Andric// POPCNTB p5 through p7 popcntb and related instructions 2490b57cec5SDimitry Andric 2500b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 2510b57cec5SDimitry Andric// Classes used for relation maps. 2520b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 2530b57cec5SDimitry Andric// RecFormRel - Filter class used to relate non-record-form instructions with 2540b57cec5SDimitry Andric// their record-form variants. 2550b57cec5SDimitry Andricclass RecFormRel; 2560b57cec5SDimitry Andric 2570b57cec5SDimitry Andric// AltVSXFMARel - Filter class used to relate the primary addend-killing VSX 2580b57cec5SDimitry Andric// FMA instruction forms with their corresponding factor-killing forms. 2590b57cec5SDimitry Andricclass AltVSXFMARel { 2600b57cec5SDimitry Andric bit IsVSXFMAAlt = 0; 2610b57cec5SDimitry Andric} 2620b57cec5SDimitry Andric 2630b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 2640b57cec5SDimitry Andric// Relation Map Definitions. 2650b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 2660b57cec5SDimitry Andric 2670b57cec5SDimitry Andricdef getRecordFormOpcode : InstrMapping { 2680b57cec5SDimitry Andric let FilterClass = "RecFormRel"; 2690b57cec5SDimitry Andric // Instructions with the same BaseName and Interpretation64Bit values 2700b57cec5SDimitry Andric // form a row. 2710b57cec5SDimitry Andric let RowFields = ["BaseName", "Interpretation64Bit"]; 2720b57cec5SDimitry Andric // Instructions with the same RC value form a column. 2730b57cec5SDimitry Andric let ColFields = ["RC"]; 2740b57cec5SDimitry Andric // The key column are the non-record-form instructions. 2750b57cec5SDimitry Andric let KeyCol = ["0"]; 2760b57cec5SDimitry Andric // Value columns RC=1 2770b57cec5SDimitry Andric let ValueCols = [["1"]]; 2780b57cec5SDimitry Andric} 2790b57cec5SDimitry Andric 2800b57cec5SDimitry Andricdef getNonRecordFormOpcode : InstrMapping { 2810b57cec5SDimitry Andric let FilterClass = "RecFormRel"; 2820b57cec5SDimitry Andric // Instructions with the same BaseName and Interpretation64Bit values 2830b57cec5SDimitry Andric // form a row. 2840b57cec5SDimitry Andric let RowFields = ["BaseName", "Interpretation64Bit"]; 2850b57cec5SDimitry Andric // Instructions with the same RC value form a column. 2860b57cec5SDimitry Andric let ColFields = ["RC"]; 2870b57cec5SDimitry Andric // The key column are the record-form instructions. 2880b57cec5SDimitry Andric let KeyCol = ["1"]; 2890b57cec5SDimitry Andric // Value columns are RC=0 2900b57cec5SDimitry Andric let ValueCols = [["0"]]; 2910b57cec5SDimitry Andric} 2920b57cec5SDimitry Andric 2930b57cec5SDimitry Andricdef getAltVSXFMAOpcode : InstrMapping { 2940b57cec5SDimitry Andric let FilterClass = "AltVSXFMARel"; 2950b57cec5SDimitry Andric // Instructions with the same BaseName value form a row. 2960b57cec5SDimitry Andric let RowFields = ["BaseName"]; 2970b57cec5SDimitry Andric // Instructions with the same IsVSXFMAAlt value form a column. 2980b57cec5SDimitry Andric let ColFields = ["IsVSXFMAAlt"]; 2990b57cec5SDimitry Andric // The key column are the (default) addend-killing instructions. 3000b57cec5SDimitry Andric let KeyCol = ["0"]; 3010b57cec5SDimitry Andric // Value columns IsVSXFMAAlt=1 3020b57cec5SDimitry Andric let ValueCols = [["1"]]; 3030b57cec5SDimitry Andric} 3040b57cec5SDimitry Andric 3050b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 3060b57cec5SDimitry Andric// Register File Description 3070b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 3080b57cec5SDimitry Andric 3090b57cec5SDimitry Andricinclude "PPCRegisterInfo.td" 3100b57cec5SDimitry Andricinclude "PPCSchedule.td" 3110b57cec5SDimitry Andric 3120b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 3130b57cec5SDimitry Andric// PowerPC processors supported. 3140b57cec5SDimitry Andric// 3150b57cec5SDimitry Andric 3160b57cec5SDimitry Andricdef : Processor<"generic", G3Itineraries, [Directive32, FeatureHardFloat, 3170b57cec5SDimitry Andric FeatureMFTB]>; 3180b57cec5SDimitry Andricdef : ProcessorModel<"440", PPC440Model, [Directive440, FeatureISEL, 3190b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, 3200b57cec5SDimitry Andric FeatureICBT, FeatureBookE, 3210b57cec5SDimitry Andric FeatureMSYNC, FeatureMFTB]>; 3220b57cec5SDimitry Andricdef : ProcessorModel<"450", PPC440Model, [Directive440, FeatureISEL, 3230b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, 3240b57cec5SDimitry Andric FeatureICBT, FeatureBookE, 3250b57cec5SDimitry Andric FeatureMSYNC, FeatureMFTB]>; 3260b57cec5SDimitry Andricdef : Processor<"601", G3Itineraries, [Directive601, FeatureFPU]>; 3270b57cec5SDimitry Andricdef : Processor<"602", G3Itineraries, [Directive602, FeatureFPU, 3280b57cec5SDimitry Andric FeatureMFTB]>; 3290b57cec5SDimitry Andricdef : Processor<"603", G3Itineraries, [Directive603, 3300b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, 3310b57cec5SDimitry Andric FeatureMFTB]>; 3320b57cec5SDimitry Andricdef : Processor<"603e", G3Itineraries, [Directive603, 3330b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, 3340b57cec5SDimitry Andric FeatureMFTB]>; 3350b57cec5SDimitry Andricdef : Processor<"603ev", G3Itineraries, [Directive603, 3360b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, 3370b57cec5SDimitry Andric FeatureMFTB]>; 3380b57cec5SDimitry Andricdef : Processor<"604", G3Itineraries, [Directive604, 3390b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, 3400b57cec5SDimitry Andric FeatureMFTB]>; 3410b57cec5SDimitry Andricdef : Processor<"604e", G3Itineraries, [Directive604, 3420b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, 3430b57cec5SDimitry Andric FeatureMFTB]>; 3440b57cec5SDimitry Andricdef : Processor<"620", G3Itineraries, [Directive620, 3450b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, 3460b57cec5SDimitry Andric FeatureMFTB]>; 3470b57cec5SDimitry Andricdef : Processor<"750", G4Itineraries, [Directive750, 3480b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, 3490b57cec5SDimitry Andric FeatureMFTB]>; 3500b57cec5SDimitry Andricdef : Processor<"g3", G3Itineraries, [Directive750, 3510b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, 3520b57cec5SDimitry Andric FeatureMFTB]>; 3530b57cec5SDimitry Andricdef : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec, 3540b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, 3550b57cec5SDimitry Andric FeatureMFTB]>; 3560b57cec5SDimitry Andricdef : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec, 3570b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, 3580b57cec5SDimitry Andric FeatureMFTB]>; 3590b57cec5SDimitry Andricdef : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec, 3600b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, 3610b57cec5SDimitry Andric FeatureMFTB]>; 3620b57cec5SDimitry Andricdef : Processor<"g4+", G4PlusItineraries, [Directive7400, FeatureAltivec, 3630b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, 3640b57cec5SDimitry Andric FeatureMFTB]>; 3650b57cec5SDimitry Andric 3660b57cec5SDimitry Andricdef : ProcessorModel<"970", G5Model, 3670b57cec5SDimitry Andric [Directive970, FeatureAltivec, 3680b57cec5SDimitry Andric FeatureMFOCRF, FeatureFSqrt, 3690b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, FeatureSTFIWX, 3700b57cec5SDimitry Andric Feature64Bit /*, Feature64BitRegs */, 3710b57cec5SDimitry Andric FeatureMFTB]>; 3720b57cec5SDimitry Andricdef : ProcessorModel<"g5", G5Model, 3730b57cec5SDimitry Andric [Directive970, FeatureAltivec, 3740b57cec5SDimitry Andric FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX, 3750b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, 3760b57cec5SDimitry Andric Feature64Bit /*, Feature64BitRegs */, 3770b57cec5SDimitry Andric FeatureMFTB, DeprecatedDST]>; 3780b57cec5SDimitry Andricdef : ProcessorModel<"e500", PPCE500Model, 3790b57cec5SDimitry Andric [DirectiveE500, 3800b57cec5SDimitry Andric FeatureICBT, FeatureBookE, 381*f8e1cfadSDimitry Andric FeatureISEL, FeatureMFTB, FeatureSPE]>; 3820b57cec5SDimitry Andricdef : ProcessorModel<"e500mc", PPCE500mcModel, 3830b57cec5SDimitry Andric [DirectiveE500mc, 3840b57cec5SDimitry Andric FeatureSTFIWX, FeatureICBT, FeatureBookE, 3850b57cec5SDimitry Andric FeatureISEL, FeatureMFTB]>; 3860b57cec5SDimitry Andricdef : ProcessorModel<"e5500", PPCE5500Model, 3870b57cec5SDimitry Andric [DirectiveE5500, FeatureMFOCRF, Feature64Bit, 3880b57cec5SDimitry Andric FeatureSTFIWX, FeatureICBT, FeatureBookE, 3890b57cec5SDimitry Andric FeatureISEL, FeatureMFTB]>; 3900b57cec5SDimitry Andricdef : ProcessorModel<"a2", PPCA2Model, 3910b57cec5SDimitry Andric [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF, 3920b57cec5SDimitry Andric FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES, 3930b57cec5SDimitry Andric FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec, 3940b57cec5SDimitry Andric FeatureSTFIWX, FeatureLFIWAX, 3950b57cec5SDimitry Andric FeatureFPRND, FeatureFPCVT, FeatureISEL, 3960b57cec5SDimitry Andric FeatureSlowPOPCNTD, FeatureCMPB, FeatureLDBRX, 3970b57cec5SDimitry Andric Feature64Bit /*, Feature64BitRegs */, FeatureMFTB]>; 3980b57cec5SDimitry Andricdef : ProcessorModel<"a2q", PPCA2Model, 3990b57cec5SDimitry Andric [DirectiveA2, FeatureICBT, FeatureBookE, FeatureMFOCRF, 4000b57cec5SDimitry Andric FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES, 4010b57cec5SDimitry Andric FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec, 4020b57cec5SDimitry Andric FeatureSTFIWX, FeatureLFIWAX, 4030b57cec5SDimitry Andric FeatureFPRND, FeatureFPCVT, FeatureISEL, 4040b57cec5SDimitry Andric FeatureSlowPOPCNTD, FeatureCMPB, FeatureLDBRX, 4050b57cec5SDimitry Andric Feature64Bit /*, Feature64BitRegs */, FeatureQPX, 4060b57cec5SDimitry Andric FeatureMFTB]>; 4070b57cec5SDimitry Andricdef : ProcessorModel<"pwr3", G5Model, 4080b57cec5SDimitry Andric [DirectivePwr3, FeatureAltivec, 4090b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, FeatureMFOCRF, 4100b57cec5SDimitry Andric FeatureSTFIWX, Feature64Bit]>; 4110b57cec5SDimitry Andricdef : ProcessorModel<"pwr4", G5Model, 4120b57cec5SDimitry Andric [DirectivePwr4, FeatureAltivec, FeatureMFOCRF, 4130b57cec5SDimitry Andric FeatureFSqrt, FeatureFRES, FeatureFRSQRTE, 4140b57cec5SDimitry Andric FeatureSTFIWX, Feature64Bit, FeatureMFTB]>; 4150b57cec5SDimitry Andricdef : ProcessorModel<"pwr5", G5Model, 4160b57cec5SDimitry Andric [DirectivePwr5, FeatureAltivec, FeatureMFOCRF, 4170b57cec5SDimitry Andric FeatureFSqrt, FeatureFRE, FeatureFRES, 4180b57cec5SDimitry Andric FeatureFRSQRTE, FeatureFRSQRTES, 4190b57cec5SDimitry Andric FeatureSTFIWX, Feature64Bit, 4200b57cec5SDimitry Andric FeatureMFTB, DeprecatedDST]>; 4210b57cec5SDimitry Andricdef : ProcessorModel<"pwr5x", G5Model, 4220b57cec5SDimitry Andric [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF, 4230b57cec5SDimitry Andric FeatureFSqrt, FeatureFRE, FeatureFRES, 4240b57cec5SDimitry Andric FeatureFRSQRTE, FeatureFRSQRTES, 4250b57cec5SDimitry Andric FeatureSTFIWX, FeatureFPRND, Feature64Bit, 4260b57cec5SDimitry Andric FeatureMFTB, DeprecatedDST]>; 4270b57cec5SDimitry Andricdef : ProcessorModel<"pwr6", G5Model, 4280b57cec5SDimitry Andric [DirectivePwr6, FeatureAltivec, 4290b57cec5SDimitry Andric FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE, 4300b57cec5SDimitry Andric FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES, 4310b57cec5SDimitry Andric FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB, 4320b57cec5SDimitry Andric FeatureFPRND, Feature64Bit /*, Feature64BitRegs */, 4330b57cec5SDimitry Andric FeatureMFTB, DeprecatedDST]>; 4340b57cec5SDimitry Andricdef : ProcessorModel<"pwr6x", G5Model, 4350b57cec5SDimitry Andric [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF, 4360b57cec5SDimitry Andric FeatureFCPSGN, FeatureFSqrt, FeatureFRE, FeatureFRES, 4370b57cec5SDimitry Andric FeatureFRSQRTE, FeatureFRSQRTES, FeatureRecipPrec, 4380b57cec5SDimitry Andric FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB, 4390b57cec5SDimitry Andric FeatureFPRND, Feature64Bit, 4400b57cec5SDimitry Andric FeatureMFTB, DeprecatedDST]>; 4410b57cec5SDimitry Andricdef : ProcessorModel<"pwr7", P7Model, ProcessorFeatures.Power7FeatureList>; 4420b57cec5SDimitry Andricdef : ProcessorModel<"pwr8", P8Model, ProcessorFeatures.Power8FeatureList>; 4430b57cec5SDimitry Andricdef : ProcessorModel<"pwr9", P9Model, ProcessorFeatures.Power9FeatureList>; 4440b57cec5SDimitry Andricdef : Processor<"ppc", G3Itineraries, [Directive32, FeatureHardFloat, 4450b57cec5SDimitry Andric FeatureMFTB]>; 4460b57cec5SDimitry Andricdef : Processor<"ppc32", G3Itineraries, [Directive32, FeatureHardFloat, 4470b57cec5SDimitry Andric FeatureMFTB]>; 4480b57cec5SDimitry Andricdef : ProcessorModel<"ppc64", G5Model, 4490b57cec5SDimitry Andric [Directive64, FeatureAltivec, 4500b57cec5SDimitry Andric FeatureMFOCRF, FeatureFSqrt, FeatureFRES, 4510b57cec5SDimitry Andric FeatureFRSQRTE, FeatureSTFIWX, 4520b57cec5SDimitry Andric Feature64Bit /*, Feature64BitRegs */, 4530b57cec5SDimitry Andric FeatureMFTB]>; 4540b57cec5SDimitry Andricdef : ProcessorModel<"ppc64le", P8Model, ProcessorFeatures.Power8FeatureList>; 4550b57cec5SDimitry Andric 4560b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 4570b57cec5SDimitry Andric// Calling Conventions 4580b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 4590b57cec5SDimitry Andric 4600b57cec5SDimitry Andricinclude "PPCCallingConv.td" 4610b57cec5SDimitry Andric 4620b57cec5SDimitry Andricdef PPCInstrInfo : InstrInfo { 4630b57cec5SDimitry Andric let isLittleEndianEncoding = 1; 4640b57cec5SDimitry Andric 4650b57cec5SDimitry Andric // FIXME: Unset this when no longer needed! 4660b57cec5SDimitry Andric let decodePositionallyEncodedOperands = 1; 4670b57cec5SDimitry Andric 4680b57cec5SDimitry Andric let noNamedPositionallyEncodedOperands = 1; 4690b57cec5SDimitry Andric} 4700b57cec5SDimitry Andric 4710b57cec5SDimitry Andricdef PPCAsmParser : AsmParser { 4720b57cec5SDimitry Andric let ShouldEmitMatchRegisterName = 0; 4730b57cec5SDimitry Andric} 4740b57cec5SDimitry Andric 4750b57cec5SDimitry Andricdef PPCAsmParserVariant : AsmParserVariant { 4760b57cec5SDimitry Andric int Variant = 0; 4770b57cec5SDimitry Andric 4780b57cec5SDimitry Andric // We do not use hard coded registers in asm strings. However, some 4790b57cec5SDimitry Andric // InstAlias definitions use immediate literals. Set RegisterPrefix 4800b57cec5SDimitry Andric // so that those are not misinterpreted as registers. 4810b57cec5SDimitry Andric string RegisterPrefix = "%"; 4820b57cec5SDimitry Andric string BreakCharacters = "."; 4830b57cec5SDimitry Andric} 4840b57cec5SDimitry Andric 4850b57cec5SDimitry Andricdef PPC : Target { 4860b57cec5SDimitry Andric // Information about the instructions. 4870b57cec5SDimitry Andric let InstructionSet = PPCInstrInfo; 4880b57cec5SDimitry Andric 4890b57cec5SDimitry Andric let AssemblyParsers = [PPCAsmParser]; 4900b57cec5SDimitry Andric let AssemblyParserVariants = [PPCAsmParserVariant]; 4910b57cec5SDimitry Andric let AllowRegisterRenaming = 1; 4920b57cec5SDimitry Andric} 4930b57cec5SDimitry Andric 4940b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 4950b57cec5SDimitry Andric// Pfm Counters 4960b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 4970b57cec5SDimitry Andric 4980b57cec5SDimitry Andricinclude "PPCPfmCounters.td" 499