Index: lib/Target/PowerPC/P9InstrResources.td =================================================================== --- /dev/null +++ lib/Target/PowerPC/P9InstrResources.td @@ -0,0 +1,796 @@ +// Some itinerary classes include instructions with different resource +// requirements. Resource definitions for those classes is defined at +// instruction level in this file. + + +def : InstRW<[P9_ALUE_2C, P9_ALUO_2C, IP_EXECE_1C, IP_EXECO_1C, + DISP_1C, DISP_1C], + (instrs + VADDCUW, + VADDUBM, + VADDUDM, + VADDUHM, + VADDUWM, + VAND, + VANDC, + VCMPEQUB, + VCMPEQUBo, + VCMPEQUD, + VCMPEQUDo, + VCMPEQUH, + VCMPEQUHo, + VCMPEQUW, + VCMPEQUWo, + VCMPGTSB, + VCMPGTSBo, + VCMPGTSD, + VCMPGTSDo, + VCMPGTSH, + VCMPGTSHo, + VCMPGTSW, + VCMPGTSWo, + VCMPGTUB, + VCMPGTUBo, + VCMPGTUD, + VCMPGTUDo, + VCMPGTUH, + VCMPGTUHo, + VCMPGTUW, + VCMPGTUWo, + VCMPNEB, + VCMPNEBo, + VCMPNEH, + VCMPNEHo, + VCMPNEW, + VCMPNEWo, + VCMPNEZB, + VCMPNEZBo, + VCMPNEZH, + VCMPNEZHo, + VCMPNEZW, + VCMPNEZWo, + VEQV, + VEXTSB2D, + VEXTSB2W, + VEXTSH2D, + VEXTSH2W, + VEXTSW2D, + VMRGEW, + VMRGOW, + VNAND, + VNEGD, + VNEGW, + VNOR, + VOR, + VORC, + VPOPCNTB, + VPOPCNTH, + VPOPCNTW, + VSEL, + VSUBCUW, + VSUBUBM, + VSUBUDM, + VSUBUHM, + VSUBUWM, + VXOR, + V_SET0B, + V_SET0H, + V_SET0, + XVABSDP, + XVABSSP, + XVCPSGNDP, + XVCPSGNSP, + XVIEXPDP, + XVNABSDP, + XVNABSSP, + XVNEGDP, + XVNEGSP, + XVXEXPDP, + XXLAND, + XXLANDC, + XXLEQV, + XXLNAND, + XXLNOR, + XXLOR, + XXLORf, + XXLORC, + XXLXOR, + XXSEL +)>; + +def : InstRW<[P9_ALU_2C, IP_EXEC_1C, DISP_1C, DISP_1C], + (instrs + XSABSQP, + XSCPSGNQP, + XSIEXPQP, + XSNABSQP, + XSNEGQP, + XSXEXPQP, + XSABSDP, + XSCPSGNDP, + XSIEXPDP, + XSNABSDP, + XSNEGDP, + XSXEXPDP +)>; + +def : InstRW<[P9_ALUE_3C, P9_ALUO_3C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C, DISP_1C], + (instrs + + VMINSB, + VMINSD, + VMINSH, + VMINSW, + VMINUB, + VMINUD, + VMINUH, + VMINUW, + VPOPCNTD, + VPRTYBD, + VPRTYBW, + VRLB, + VRLD, + VRLDMI, + VRLDNM, + VRLH, + VRLW, + VRLWMI, + VRLWNM, + VSHASIGMAD, + VSHASIGMAW, + VSLB, + VSLD, + VSLH, + VSLW, + VSRAB, + VSRAD, + VSRAH, + VSRAW, + VSRB, + VSRD, + VSRH, + VSRW, + VSUBSBS, + VSUBSHS, + VSUBSWS, + VSUBUBS, + VSUBUHS, + VSUBUWS, + XSCMPEQDP, + XSCMPEXPDP, + XSCMPGEDP, + XSCMPGTDP, + XSCMPODP, + XSCMPUDP, + XSCVSPDPN, + XSMAXCDP, + XSMAXDP, + XSMAXJDP, + XSMINCDP, + XSMINDP, + XSMINJDP, + XSTDIVDP, + XSTSQRTDP, + XSTSTDCDP, + XSTSTDCSP, + XSXSIGDP, + XVCMPEQDP, + XVCMPEQDPo, + XVCMPEQSP, + XVCMPEQSPo, + XVCMPGEDP, + XVCMPGEDPo, + XVCMPGESP, + XVCMPGESPo, + XVCMPGTDP, + XVCMPGTDPo, + XVCMPGTSP, + XVCMPGTSPo, + XVIEXPSP, + XVMAXDP, + XVMAXSP, + XVMINDP, + XVMINSP, + XVTDIVDP, + XVTDIVSP, + XVTSQRTDP, + XVTSQRTSP, + XVTSTDCDP, + XVTSTDCSP, + XVXEXPSP, + XVXSIGDP, + XVXSIGSP +)>; + +def : InstRW<[P9_ALUE_4C, P9_ALUO_4C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C, DISP_1C], + (instrs + // VABSDUB, + // VABSDUH, + // VABSDUW, + VADDSBS, + VADDSHS, + VADDSWS, + VADDUBS, + VADDUHS, + VADDUWS, + VAVGSB, + VAVGSH, + VAVGSW, + VAVGUB, + VAVGUH, + VAVGUW, + VBPERMD, + VCLZB, + VCLZD, + VCLZH, + VCLZW, + VCMPBFP, + VCMPBFPo, + VCMPGTFP, + VCMPGTFPo, + VCTZB, + VCTZD, + VCTZH, + VCTZW, + VMAXFP, + VMAXSB, + VMAXSD, + VMAXSH, + VMAXSW, + VMAXUB, + VMAXUD, + VMAXUH, + VMAXUW, + VMINFP, + VCMPEQFP, + VCMPEQFPo, + VCMPGEFP, + VCMPGEFPo +)>; + +def : InstRW<[P9_DPE_7C, P9_DPO_7C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C, DISP_1C], + (instrs + VADDFP, + VCTSXS, + VCTSXS_0, + VCTUXS, + VCTUXS_0, + VEXPTEFP, + VLOGEFP, + VMADDFP, + VMHADDSHS, + VNMSUBFP, + VREFP, + VRFIM, + VRFIN, + VRFIP, + VRFIZ, + VRSQRTEFP, + VSUBFP, + XVADDDP, + XVADDSP, + XVCVDPSP, + XVCVDPSXDS, + XVCVDPSXWS, + XVCVDPUXDS, + XVCVDPUXWS, + XVCVHPSP, + XVCVSPDP, + XVCVSPHP, + XVCVSPSXDS, + XVCVSPSXWS, + XVCVSPUXDS, + XVCVSPUXWS, + XVCVSXDDP, + XVCVSXDSP, + XVCVSXWDP, + XVCVSXWSP, + XVCVUXDDP, + XVCVUXDSP, + XVCVUXWDP, + XVCVUXWSP, + XVMADDADP, + XVMADDASP, + XVMADDMDP, + XVMADDMSP, + XVMSUBADP, + XVMSUBASP, + XVMSUBMDP, + XVMSUBMSP, + XVMULDP, + XVMULSP, + XVNMADDADP, + XVNMADDASP, + XVNMADDMDP, + XVNMADDMSP, + XVNMSUBADP, + XVNMSUBASP, + XVNMSUBMDP, + XVNMSUBMSP, + XVRDPI, + XVRDPIC, + XVRDPIM, + XVRDPIP, + XVRDPIZ, + XVREDP, + XVRESP, + XVRSPI, + XVRSPIC, + XVRSPIM, + XVRSPIP, + XVRSPIZ, + XVRSQRTEDP, + XVRSQRTESP, + XVSUBDP, + XVSUBSP, + VCFSX, + VCFSX_0, + VCFUX, + VCFUX_0, + VMHRADDSHS, + VMLADDUHM, + VMSUMMBM, + VMSUMSHM, + VMSUMSHS, + VMSUMUBM, + VMSUMUHM, + VMSUMUHS, + VMULESB, + VMULESH, + VMULESW, + VMULEUB, + VMULEUH, + VMULEUW, + VMULOSB, + VMULOSH, + VMULOSW, + VMULOUB, + VMULOUH, + VMULOUW, + VMULUWM, + VSUM2SWS, + VSUM4SBS, + VSUM4SHS, + VSUM4UBS, + VSUMSWS +)>; + +def : InstRW<[P9_DP_7C, IP_EXEC_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + XSMADDADP, + XSMADDASP, + XSMADDMDP, + XSMADDMSP, + XSMSUBADP, + XSMSUBASP, + XSMSUBMDP, + XSMSUBMSP, + XSMULDP, + XSMULSP, + XSNMADDADP, + XSNMADDASP, + XSNMADDMDP, + XSNMADDMSP, + XSNMSUBADP, + XSNMSUBASP, + XSNMSUBMDP, + XSNMSUBMSP +)>; + + +def : InstRW<[P9_DP_7C, IP_EXEC_1C, DISP_1C, DISP_1C], + (instrs + XSADDDP, + XSADDSP, + XSCVDPHP, + XSCVDPSP, + XSCVDPSXDS, + XSCVDPSXWS, + XSCVDPUXDS, + XSCVDPUXWS, + XSCVHPDP, + XSCVSPDP, + XSCVSXDDP, + XSCVSXDSP, + XSCVUXDDP, + XSCVUXDSP, + XSRDPI, + XSRDPIC, + XSRDPIM, + XSRDPIP, + XSRDPIZ, + XSREDP, + XSRESP, + //XSRSP, + XSRSQRTEDP, + XSRSQRTESP, + XSSUBDP, + XSSUBSP, + XSCVDPSPN +)>; + +def : InstRW<[P9_PM_3C, IP_EXECO_1C, IP_EXECE_1C, DISP_1C, DISP_1C], + (instrs + VBPERMQ, + VCLZLSBB, + VCTZLSBB, + VEXTRACTD, + VEXTRACTUB, + VEXTRACTUH, + VEXTRACTUW, + VEXTUBLX, + VEXTUBRX, + VEXTUHLX, + VEXTUHRX, + VEXTUWLX, + VEXTUWRX, + VGBBD, + VINSERTB, + VINSERTD, + VINSERTH, + VINSERTW, + VMRGHB, + VMRGHH, + VMRGHW, + VMRGLB, + VMRGLH, + VMRGLW, + VPERM, + VPERMR, + VPERMXOR, + VPKPX, + VPKSDSS, + VPKSDUS, + VPKSHSS, + VPKSHUS, + VPKSWSS, + VPKSWUS, + VPKUDUM, + VPKUDUS, + VPKUHUM, + VPKUHUS, + VPKUWUM, + VPKUWUS, + VPRTYBQ, + VSL, + VSLDOI, + VSLO, + VSLV, + VSPLTB, + VSPLTH, + VSPLTISB, + VSPLTISH, + VSPLTISW, + VSPLTW, + VSR, + VSRO, + VSRV, + VUPKHPX, + VUPKHSB, + VUPKHSH, + VUPKHSW, + VUPKLPX, + VUPKLSB, + VUPKLSH, + VUPKLSW, + XXBRD, + XXBRH, + XXBRQ, + XXBRW, + XXEXTRACTUW, + XXINSERTW, + XXMRGHW, + XXMRGLW, + XXPERM, + XXPERMR, + XXSLDWI, + XXSPLTIB, + XXSPLTW, + VADDCUQ, + VADDECUQ, + VADDEUQM, + VADDUQM, + VMUL10CUQ, + VMUL10ECUQ, + VMUL10EUQ, + VMUL10UQ, + VSUBCUQ, + VSUBECUQ, + VSUBEUQM, + VSUBUQM, + XSCMPEXPQP, + XSCMPOQP, + XSCMPUQP, + XSTSTDCQP, + XSXSIGQP +)>; + +def : InstRW<[P9_DFU_12C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C, DISP_1C], + (instrs + XSADDQP, + XSADDQPO, + XSCVDPQP, + XSCVQPDP, + XSCVQPDPO, + XSCVQPSDZ, + XSCVQPSWZ, + XSCVQPUDZ, + XSCVQPUWZ, + XSCVSDQP, + XSCVUDQP, + XSRQPI, + XSRQPXP, + XSSUBQP, + XSSUBQPO +)>; + +def : InstRW<[P9_DFU_24C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C, DISP_1C], + (instrs + XSMADDQP, + XSMADDQPO, + XSMSUBQP, + XSMSUBQPO, + XSMULQP, + XSMULQPO, + XSNMADDQP, + XSNMADDQPO, + XSNMSUBQP, + XSNMSUBQPO +)>; + +def : InstRW<[P9_DFU_58C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C, DISP_1C], + (instrs + XSDIVQP, + XSDIVQPO +)>; + +def : InstRW<[P9_DFU_76C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C, DISP_1C], + (instrs + XSSQRTQP, + XSSQRTQPO +)>; + +// Load Operation in IIC_LdStLFD + +def : InstRW<[P9_LS_5C, IP_AGEN_1C, DISP_1C, DISP_1C], + (instrs + LXSDX, + LXVD2X, + LXSIWZX, + LXV, + LXSD +)>; + +def : InstRW<[P9_LS_5C, IP_AGEN_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + LFIWZX, + LFDX, + LFD +)>; + +def : InstRW<[P9_LoadAndALUOp_7C, IP_AGEN_1C, IP_EXEC_1C, + DISP_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + LXSSPX, + LXSIWAX, + LXSSP +)>; + +def : InstRW<[P9_LoadAndALUOp_7C, IP_AGEN_1C, IP_EXEC_1C, + DISP_1C, DISP_1C, DISP_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + LFIWAX, + LFSX, + LFS +)>; + +def : InstRW<[P9_LoadAndPMOp_8C, IP_AGEN_1C, IP_EXEC_1C, DISP_1C, DISP_1C], + (instrs + LXVDSX, + LXVW4X +)>; + +// Store Operations in IIC_LdStSTFD. + +def : InstRW<[P9_LS_1C, IP_EXEC_1C, IP_AGEN_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + STFS, + STFD, + STFIWX, + STFSX, + STFDX, + STXSDX, + STXSSPX, + STXSIWX +)>; + +def : InstRW<[P9_LS_1C, IP_EXEC_1C, IP_EXEC_1C, IP_AGEN_1C, DISP_1C, DISP_1C], + (instrs + STXVD2X, + STXVW4X +)>; + + +// Divide Operations in IIC_IntDivW, IIC_IntDivD. + +def : InstRW<[P9_DIV_16C_8, IP_EXECE_1C, DISP_1C, DISP_1C], + (instrs + DIVW, + DIVWU +)>; + +def : InstRW<[P9_DIV_24C_8, IP_EXECE_1C, DISP_1C, DISP_1C], + (instrs + DIVWE, + DIVD, + DIVWEU, + DIVDU +)>; + +def : InstRW<[P9_DIV_40C_8, IP_EXECE_1C, DISP_1C, DISP_1C], + (instrs + DIVDE, + DIVDEU +)>; + +def : InstRW<[P9_IntDivAndALUOp_26C_8, IP_EXECE_1C, IP_EXEC_1C, + DISP_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + DIVWEo, + DIVWEUo +)>; + +def : InstRW<[P9_IntDivAndALUOp_42C_8, IP_EXECE_1C, IP_EXEC_1C, + DISP_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + DIVDEo, + DIVDEUo +)>; + +// Rotate Operations in IIC_IntRotateD, IIC_IntRotateDI +def : InstRW<[P9_ALU_2C, IP_EXEC_1C, DISP_1C, DISP_1C], + (instrs + SLD, + SRD, + SRAD, + SRADI, + RLDIC +)>; + +def : InstRW<[P9_ALU_2C, IP_EXEC_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + RLDCL, + RLDCR, + RLDIMI, + RLDICL, + RLDICR, + RLDICL_32_64 +)>; + +// CR access instructions in _BrMCR, IIC_BrMCRX. + +def : InstRW<[P9_ALU_2C, P9_ALU_2C, IP_EXEC_1C, IP_EXEC_1C, + DISP_1C, DISP_1C, DISP_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + MTOCRF, + MTOCRF8, + MTCRF, + MTCRF8 +)>; + +def : InstRW<[P9_ALU_5C, IP_EXEC_1C, DISP_1C, DISP_1C], + (instrs + MCRF, + MCRXRX +)>; + +def : InstRW<[P9_ALU_5C, P9_ALU_5C, IP_EXEC_1C, IP_EXEC_1C, + DISP_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + MCRFS +)>; + +// FP Div instructions in IIC_FPDivD and IIC_FPDivS. + +def : InstRW<[P9_DP_33C_8, IP_EXEC_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + FDIV, + XSDIVDP +)>; + +def : InstRW<[P9_DP_22C_5, IP_EXEC_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + FDIVS, + XSDIVSP +)>; + +def : InstRW<[P9_DP_24C_8, IP_EXECE_1C, IP_EXECO_1C, DISP_1C, DISP_1C], + (instrs + XVDIVSP +)>; + +def : InstRW<[P9_DP_33C_8, IP_EXECE_1C, IP_EXECO_1C, DISP_1C, DISP_1C], + (instrs + XVDIVDP +)>; + +// FP Instructions in IIC_FPGeneral, IIC_FPFused + +def : InstRW<[P9_DP_7C, IP_EXEC_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + FRSP, + FRIND, + FRINS, + FRIPD, + FRIPS, + FRIZD, + FRIZS, + FRIMD, + FRIMS, + FRE, + FRES, + FRSQRTE, + FRSQRTES, + FMADDS, + FMADD, + FMSUBS, + FMSUB, + FNMADDS, + FNMADD, + FNMSUBS, + FNMSUB, + FSELD, + FSELS, + FADDS, + FMULS, + FMUL, + FSUBS, + FCFID, + FCTID, + FCTIDZ, + FCFIDU, + FCFIDS, + FCFIDUS, + FCTIDUZ, + FCTIWUZ, + FCTIW, + FCTIWZ +)>; + +def : InstRW<[P9_DP_7C, IP_EXEC_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + FMR, + FABSD, + FABSS, + FNABSD, + FNABSS, + FNEGD, + FNEGS, + FCPSGND, + FCPSGNS +)>; + +def : InstRW<[P9_ALU_3C, IP_EXEC_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + FCMPUS, + FCMPUD +)>; + +// Load instructions in IIC_LdStLFDU and IIC_LdStLFDUX. + +def : InstRW<[P9_LoadAndALUOp_7C, P9_ALU_2C, + IP_AGEN_1C, IP_EXEC_1C, IP_EXEC_1C, + DISP_1C, DISP_1C, DISP_1C, DISP_1C, + DISP_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + LFSU, + LFSUX +)>; + +def : InstRW<[P9_LS_5C, P9_ALU_2C, IP_AGEN_1C, IP_EXEC_1C, + DISP_1C, DISP_1C, DISP_1C, DISP_1C, DISP_1C], + (instrs + LFDU, + LFDUX +)>; + Index: lib/Target/PowerPC/PPC.td =================================================================== --- lib/Target/PowerPC/PPC.td +++ lib/Target/PowerPC/PPC.td @@ -203,7 +203,7 @@ list Power8FeatureList = !listconcat(Power7FeatureList, Power8SpecificFeatures); list Power9SpecificFeatures = - [FeatureP9Altivec, FeatureP9Vector, FeatureISA3_0]; + [DirectivePwr9, FeatureP9Altivec, FeatureP9Vector, FeatureISA3_0]; list Power9FeatureList = !listconcat(Power8FeatureList, Power9SpecificFeatures); } @@ -276,7 +276,6 @@ include "PPCRegisterInfo.td" include "PPCSchedule.td" -include "PPCInstrInfo.td" //===----------------------------------------------------------------------===// // PowerPC processors supported. @@ -404,8 +403,7 @@ FeatureMFTB, DeprecatedDST]>; def : ProcessorModel<"pwr7", P7Model, ProcessorFeatures.Power7FeatureList>; def : ProcessorModel<"pwr8", P8Model, ProcessorFeatures.Power8FeatureList>; -// FIXME: Same as P8 until the POWER9 scheduling info is available -def : ProcessorModel<"pwr9", P8Model, ProcessorFeatures.Power9FeatureList>; +def : ProcessorModel<"pwr9", P9Model, ProcessorFeatures.Power9FeatureList>; def : Processor<"ppc", G3Itineraries, [Directive32, FeatureMFTB]>; def : ProcessorModel<"ppc64", G5Model, [Directive64, FeatureAltivec, Index: lib/Target/PowerPC/PPCSchedule.td =================================================================== --- lib/Target/PowerPC/PPCSchedule.td +++ lib/Target/PowerPC/PPCSchedule.td @@ -129,6 +129,7 @@ include "PPCScheduleG5.td" include "PPCScheduleP7.td" include "PPCScheduleP8.td" +include "PPCScheduleP9.td" include "PPCScheduleA2.td" include "PPCScheduleE500mc.td" include "PPCScheduleE5500.td" Index: lib/Target/PowerPC/PPCScheduleP9.td =================================================================== --- /dev/null +++ lib/Target/PowerPC/PPCScheduleP9.td @@ -0,0 +1,333 @@ +//===-- PPCScheduleP9.td - PPC P9 Scheduling Definitions ---*- tablegen -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the itinerary class data for the POWER8 processor. +// +//===----------------------------------------------------------------------===// +include "PPCInstrInfo.td" + +def P9Model : SchedMachineModel { + let IssueWidth = 8; + + let LoadLatency = 5; + + let MispredictPenalty = 16; + + // Try to make sure we have at least 10 dispatch groups in a loop. + let LoopMicroOpBufferSize = 60; + + let CompleteModel = 0; + +} + +let SchedModel = P9Model in { + + // ***************** Processor Resources ***************** + + //Dispatcher: + def DISPATCHER : ProcResource<12>; + + // Issue Ports + def IP_AGEN : ProcResource<4>; + def IP_EXEC : ProcResource<4>; + def IP_EXECE : ProcResource<2> { + //Even Exec Ports + let Super = IP_EXEC; + } + def IP_EXECO : ProcResource<2> { + //Odd Exec Ports + let Super = IP_EXEC; + } + + // Pipeline Groups + def ALU : ProcResource<4>; + def ALUE : ProcResource<2> { + //Even ALU pipelines + let Super = ALU; + } + def ALUO : ProcResource<2> { + //Odd ALU pipelines + let Super = ALU; + } + def DIV : ProcResource<2>; + def DP : ProcResource<4>; + def DPE : ProcResource<2> { + //Even DP pipelines + let Super = DP; + } + def DPO : ProcResource<2> { + //Odd DP pipelines + let Super = DP; + } + def LS : ProcResource<4>; + def PM : ProcResource<2>; + def DFU : ProcResource<1>; + + // ***************** SchedWriteRes Definitions ***************** + + //Dispatcher + def DISP_1C : SchedWriteRes<[DISPATCHER]> { + let NumMicroOps = 0; + let Latency = 1; + } + + // Issue Ports + def IP_AGEN_1C : SchedWriteRes<[IP_AGEN]> { + let NumMicroOps = 0; + let Latency = 1; + } + + def IP_EXEC_1C : SchedWriteRes<[IP_EXEC]> { + let NumMicroOps = 0; + let Latency = 1; + } + + def IP_EXECE_1C : SchedWriteRes<[IP_EXECE]> { + let NumMicroOps = 0; + let Latency = 1; + } + + def IP_EXECO_1C : SchedWriteRes<[IP_EXECO]> { + let NumMicroOps = 0; + let Latency = 1; + } + + //Pipeline Groups + def P9_ALU_2C : SchedWriteRes<[ALU]> { + let Latency = 2; + } + + def P9_ALUE_2C : SchedWriteRes<[ALUE]> { + let Latency = 2; + } + + def P9_ALUO_2C : SchedWriteRes<[ALUO]> { + let Latency = 2; + } + + def P9_ALU_3C : SchedWriteRes<[ALU]> { + let Latency = 3; + } + + def P9_ALUE_3C : SchedWriteRes<[ALUE]> { + let Latency = 3; + } + + def P9_ALUO_3C : SchedWriteRes<[ALUO]> { + let Latency = 3; + } + + def P9_ALU_4C : SchedWriteRes<[ALU]> { + let Latency = 4; + } + + def P9_ALUE_4C : SchedWriteRes<[ALUE]> { + let Latency = 4; + } + + def P9_ALUO_4C : SchedWriteRes<[ALUO]> { + let Latency = 4; + } + + def P9_ALU_5C : SchedWriteRes<[ALU]> { + let Latency = 5; + } + + def P9_ALU_6C : SchedWriteRes<[ALU]> { + let Latency = 6; + } + + def P9_DIV_16C_8 : SchedWriteRes<[DIV]> { + let ResourceCycles = [8]; + let Latency = 16; + } + + def P9_DIV_24C_8 : SchedWriteRes<[DIV]> { + let ResourceCycles = [8]; + let Latency = 24; + } + + def P9_DIV_40C_8 : SchedWriteRes<[DIV]> { + let ResourceCycles = [8]; + let Latency = 40; + } + + def P9_DP_2C : SchedWriteRes<[DP]> { + let Latency = 2; + } + + def P9_DP_5C : SchedWriteRes<[DP]> { + let Latency = 5; + } + + def P9_DP_7C : SchedWriteRes<[DP]> { + let Latency = 7; + } + + def P9_DPE_7C : SchedWriteRes<[DPE]> { + let Latency = 7; + } + + def P9_DPO_7C : SchedWriteRes<[DPO]> { + let Latency = 7; + } + + def P9_DP_22C_5 : SchedWriteRes<[DP]> { + let ResourceCycles = [5]; + let Latency = 22; + } + + def P9_DP_24C_8 : SchedWriteRes<[DP]> { + let ResourceCycles = [8]; + let Latency = 24; + } + + def P9_DP_26C_5 : SchedWriteRes<[DP]> { + let ResourceCycles = [5]; + let Latency = 22; + } + + def P9_DP_27C_7 : SchedWriteRes<[DP]> { + let ResourceCycles = [7]; + let Latency = 27; + } + + def P9_DP_33C_8 : SchedWriteRes<[DP]> { + let ResourceCycles = [8]; + let Latency = 33; + } + + def P9_DP_36C_10 : SchedWriteRes<[DP]> { + let ResourceCycles = [10]; + let Latency = 36; + } + + def P9_PM_3C : SchedWriteRes<[PM]> { + let Latency = 3; + } + + def P9_PM_7C : SchedWriteRes<[PM]> { + let Latency = 3; + } + + def P9_LS_1C : SchedWriteRes<[LS]> { + let Latency = 1; + } + + def P9_LS_4C : SchedWriteRes<[LS]> { + let Latency = 4; + } + + def P9_LS_5C : SchedWriteRes<[LS]> { + let Latency = 5; + } + + def P9_DFU_12C : SchedWriteRes<[DFU]> { + let Latency = 12; + } + + def P9_DFU_24C : SchedWriteRes<[DFU]> { + let Latency = 24; + let ResourceCycles = [12]; + } + + def P9_DFU_58C : SchedWriteRes<[DFU]> { + let Latency = 58; + let ResourceCycles = [44]; + } + + def P9_DFU_76C : SchedWriteRes<[DFU]> { + let Latency = 76; + let ResourceCycles = [62]; + } + // ***************** WriteSeq Definitions ***************** + + def P9_LoadAndALUOp_6C : WriteSequence<[P9_LS_4C, P9_ALU_2C]>; + def P9_LoadAndALUOp_7C : WriteSequence<[P9_LS_5C, P9_ALU_2C]>; + def P9_LoadAndPMOp_8C : WriteSequence<[P9_LS_5C, P9_PM_3C]>; + def P9_IntDivAndALUOp_26C_8 : WriteSequence<[P9_DIV_24C_8, P9_ALU_2C]>; + def P9_IntDivAndALUOp_42C_8 : WriteSequence<[P9_DIV_40C_8, P9_ALU_2C]>; + def P9_StoreAndALUOp_4C : WriteSequence<[P9_LS_1C, P9_ALU_3C]>; + def P9_ALUOpAndALUOp_4C : WriteSequence<[P9_ALU_2C, P9_ALU_2C]>; + + // ***************** Defining Itinerary Class Resources ***************** + + def : ItinRW<[P9_ALU_2C, IP_EXEC_1C, DISP_1C, DISP_1C], [IIC_IntSimple, + IIC_IntGeneral]>; + + def : ItinRW<[P9_ALU_2C, IP_EXEC_1C, DISP_1C, DISP_1C, DISP_1C], + [IIC_IntISEL, IIC_IntRotate, IIC_IntShift]>; + + def : ItinRW<[P9_ALU_2C, IP_EXEC_1C, DISP_1C, DISP_1C], [IIC_IntCompare]>; + + def : ItinRW<[P9_DP_5C, IP_EXEC_1C, DISP_1C, DISP_1C, DISP_1C], + [IIC_IntMulHW, IIC_IntMulHWU, IIC_IntMulLI]>; + + def : ItinRW<[P9_LS_5C, IP_EXEC_1C, DISP_1C, DISP_1C], + [IIC_LdStLoad, IIC_LdStLD]>; + + def : ItinRW<[P9_LS_4C, P9_ALU_2C, IP_EXEC_1C, IP_EXEC_1C, + DISP_1C, DISP_1C, DISP_1C, DISP_1C], + [IIC_LdStLoadUpd, IIC_LdStLDU]>; + + def : ItinRW<[P9_LS_4C, P9_ALU_2C, IP_EXECE_1C, IP_EXECO_1C, + DISP_1C, DISP_1C, DISP_1C, DISP_1C], + [IIC_LdStLoadUpdX, IIC_LdStLDUX]>; + + def : ItinRW<[P9_LS_1C, P9_ALU_2C, IP_EXEC_1C, IP_EXEC_1C, IP_AGEN_1C, + DISP_1C, DISP_1C, DISP_1C, DISP_1C, DISP_1C], + [IIC_LdStSTFDU]>; + + def : ItinRW<[P9_LoadAndALUOp_6C, + IP_AGEN_1C, IP_EXEC_1C, DISP_1C, DISP_1C, DISP_1C, DISP_1C], + [IIC_LdStLHA, IIC_LdStLWA]>; + + def : ItinRW<[P9_LoadAndALUOp_6C, P9_ALU_2C, + IP_AGEN_1C, IP_EXEC_1C, IP_EXEC_1C, + DISP_1C, DISP_1C, DISP_1C, DISP_1C, DISP_1C, DISP_1C], + [IIC_LdStLHAU, IIC_LdStLHAUX]>; + + // IIC_LdStLMW contains two microcoded insns. This is not accurate, but + // those insns are not used that much, if at all. + def : ItinRW<[P9_LS_4C, IP_EXEC_1C, DISP_1C, DISP_1C], + [IIC_LdStLWARX, IIC_LdStLDARX, IIC_LdStLMW]>; + + def : ItinRW<[P9_LS_1C, IP_EXEC_1C, IP_AGEN_1C, DISP_1C, DISP_1C, DISP_1C], + [IIC_LdStSTFD, IIC_LdStSTD, IIC_LdStStore]>; + + def : ItinRW<[P9_LS_1C, P9_ALU_2C, IP_EXEC_1C, IP_EXEC_1C, IP_AGEN_1C, + DISP_1C, DISP_1C, DISP_1C, DISP_1C, DISP_1C], + [IIC_LdStSTDU, IIC_LdStSTDUX]>; + + def : ItinRW<[P9_StoreAndALUOp_4C, IP_EXEC_1C, IP_EXEC_1C, IP_AGEN_1C, + DISP_1C, DISP_1C, DISP_1C, DISP_1C, DISP_1C], + [IIC_LdStSTDCX, IIC_LdStSTWCX]>; + + def : ItinRW<[P9_ALU_5C, IP_EXEC_1C, DISP_1C, DISP_1C, DISP_1C], + [IIC_BrCR, IIC_IntMTFSB0]>; + + def : ItinRW<[P9_ALUOpAndALUOp_4C, P9_ALU_2C, IP_EXEC_1C, IP_EXEC_1C, + IP_EXEC_1C, DISP_1C, DISP_1C, DISP_1C, DISP_1C, DISP_1C, DISP_1C, + DISP_1C, DISP_1C, DISP_1C], [IIC_SprMFCR, IIC_SprMFCRF]>; + + // This class should be broken down to instruction level, once some missing + // info is obtained. + def : ItinRW<[P9_LoadAndALUOp_6C, IP_EXEC_1C, IP_AGEN_1C, + DISP_1C, DISP_1C, DISP_1C], [IIC_SprMTSPR]>; + + def : ItinRW<[P9_DP_7C, IP_EXEC_1C, + DISP_1C, DISP_1C, DISP_1C], [IIC_FPGeneral, IIC_FPAddSub]>; + + def : ItinRW<[P9_DP_36C_10, IP_EXEC_1C], [IIC_FPSqrtD]>; + def : ItinRW<[P9_DP_26C_5, P9_DP_26C_5, IP_EXEC_1C, IP_EXEC_1C], [IIC_FPSqrtS]>; + + include "P9InstrResources.td" + +} + Index: lib/Target/PowerPC/PPCTargetMachine.h =================================================================== --- lib/Target/PowerPC/PPCTargetMachine.h +++ lib/Target/PowerPC/PPCTargetMachine.h @@ -56,6 +56,9 @@ const Triple &TT = getTargetTriple(); return (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le); }; + bool isPWR9() const { + return (Subtarget.getDarwinDirective() == PPC::DIR_PWR9); + }; }; /// PowerPC 32-bit target machine. Index: lib/Target/PowerPC/PPCTargetMachine.cpp =================================================================== --- lib/Target/PowerPC/PPCTargetMachine.cpp +++ lib/Target/PowerPC/PPCTargetMachine.cpp @@ -298,7 +298,10 @@ class PPCPassConfig : public TargetPassConfig { public: PPCPassConfig(PPCTargetMachine *TM, PassManagerBase &PM) - : TargetPassConfig(TM, PM) {} + : TargetPassConfig(TM, PM) { + if (TM->isPWR9() && TM->getOptLevel() != CodeGenOpt::None) + substitutePass(&PostRASchedulerID, &PostMachineSchedulerID); + } PPCTargetMachine &getPPCTargetMachine() const { return getTM();