S/390: Add IBM z13 pipeline description

This patch adds proper support for the -mtune=z13 option by adding a
z13 pipeline description.  As started with zEC12 we mostly make use of
the sched reorder hooks to implement a grouping strategy.  However,
this time we also keep an eye at the instruction mix provided in the
out of order window to allow the hardware to exploit the different
units.

gcc/ChangeLog:

	* config/s390/2827.md: Rename ooo_* insn attributes to zEC12_*.
	* config/s390/2964.md: New file.
	* config/s390/s390.c (s390_get_sched_attrmask): Use the right set
	of insn grouping attributes depending on the CPU level.
	(s390_get_unit_mask): New function.
	(s390_sched_score): Remove the OOO from the scheduling macros.
	Add loop to calculate a score for the instruction mix.
	(s390_sched_reorder): Likewise plus improve debug output.
	(s390_sched_variable_issue): Rename macros as above.  Calculate
	the unit distances after actually scheduling an insn.  Improve
	debug output.
	(s390_sched_init): Clear last_scheduled_unit_distance array.
	* config/s390/s390.md: Include 2964.md.

From-SVN: r233548
This commit is contained in:
Andreas Krebbel 2016-02-19 10:27:12 +00:00 committed by Andreas Krebbel
parent efc2340b5f
commit 239020213a
5 changed files with 451 additions and 68 deletions

View File

@ -1,3 +1,19 @@
2016-02-19 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config/s390/2827.md: Rename ooo_* insn attributes to zEC12_*.
* config/s390/2964.md: New file.
* config/s390/s390.c (s390_get_sched_attrmask): Use the right set
of insn grouping attributes depending on the CPU level.
(s390_get_unit_mask): New function.
(s390_sched_score): Remove the OOO from the scheduling macros.
Add loop to calculate a score for the instruction mix.
(s390_sched_reorder): Likewise plus improve debug output.
(s390_sched_variable_issue): Rename macros as above. Calculate
the unit distances after actually scheduling an insn. Improve
debug output.
(s390_sched_init): Clear last_scheduled_unit_distance array.
* config/s390/s390.md: Include 2964.md.
2016-02-18 Jakub Jelinek <jakub@redhat.com>
PR target/69671

View File

@ -18,20 +18,19 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
(define_attr "ooo_cracked" ""
(define_attr "zEC12_cracked" ""
(cond [(eq_attr "mnemonic" "cgdbr,clfxtr,cdgtr,celfbr,cxgtr,clfebr,clc,lngfr,cs,cfxbr,xc,clfdbr,basr,ex,cxlgtr,clfdtr,srdl,lpgfr,cdlgbr,cgxtr,cxlftr,nc,cxftr,cdfbr,clfxbr,cdftr,clgxbr,cgdtr,cxlgbr,mvc,clgdtr,cegbr,cfebr,cdlftr,sldl,cdlgtr,csg,chhsi,clgebr,cxgbr,cxfbr,cdlfbr,cgebr,lzxr,oc,cdgbr,brasl,cgxbr,cxlfbr,clgxtr,exrl,cfdbr,celgbr,clgdbr,lxr,cpsdr,lcgfr,bras,srda,cefbr") (const_int 1)]
(const_int 0)))
(define_attr "ooo_expanded" ""
(define_attr "zEC12_expanded" ""
(cond [(eq_attr "mnemonic" "dlr,dsgr,d,dsgf,stam,dsgfr,dlgr,dsg,cds,dr,stm,mvc,dl,cdsg,stmy,dlg,stmg,lam") (const_int 1)]
(const_int 0)))
(define_attr "ooo_endgroup" ""
(define_attr "zEC12_endgroup" ""
(cond [(eq_attr "mnemonic" "ipm") (const_int 1)]
(const_int 0)))
(define_attr "ooo_groupalone" ""
(define_attr "zEC12_groupalone" ""
(cond [(eq_attr "mnemonic" "lnxbr,madb,ltxtr,clc,axtr,msebr,slbgr,xc,alcr,lpxbr,slbr,maebr,mlg,mfy,lxdtr,maeb,lxeb,nc,mxtr,sxtr,dxbr,alc,msdbr,ltxbr,lxdb,madbr,lxdbr,lxebr,mvc,m,mseb,mlr,mlgr,slb,tcxb,msdb,sqxbr,alcgr,oc,flogr,alcg,mxbr,dxtr,axbr,mr,sxbr,slbg,ml,lcxbr,bcr_flush") (const_int 1)]
(const_int 0)))

232
gcc/config/s390/2964.md Normal file
View File

@ -0,0 +1,232 @@
;; Scheduling description for z13.
;; Copyright (C) 2016 Free Software Foundation, Inc.
;; Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com)
;; This file is part of GCC.
;; GCC is free software; you can redistribute it and/or modify it under
;; the terms of the GNU General Public License as published by the Free
;; Software Foundation; either version 3, or (at your option) any later
;; version.
;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
;; WARRANTY; without even the implied warranty of MERCHANTABILITY or
;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
;; for more details.
;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
; generator options: vector_ecycs=12 cracked_ecycs=6 scale_ecycs=5
(define_attr "z13_cracked" ""
(cond [(eq_attr "mnemonic" "celgbr,vscef,vsceg,exrl,clfebr,cefbr,chhsi,\
vgef,vgeg,cdlftr,lcgfr,cfdbr,cgdbr,lzxr,cfxbr,rnsbg,cgdtr,cegbr,rxsbg,ex,\
cgxtr,clfxtr,cdlgtr,brasl,efpc,cfebr,tbeginc,celfbr,clgxbr,vsteb,vsteh,\
clfdtr,cdfbr,lngfr,clgebr,stpq,cs,lpgfr,cdlgbr,lpq,cdgtr,d,cgxbr,cdftr,\
rosbg,clgdbr,cdgbr,bras,tbegin,clfdbr,cdlfbr,cgebr,clfxbr,lxr,csy,csg,clgdtr,\
clgxtr") (const_int 1)]
(const_int 0)))
(define_attr "z13_expanded" ""
(cond [(eq_attr "mnemonic" "cxlftr,cdsg,cdsy,stam,lam,dsgf,lmg,cxlgtr,\
dl,cxftr,sldl,dsg,cxlfbr,cxgtr,stmg,stmy,stm,lm,cds,lmy,cxfbr,cxlgbr,srda,\
srdl,cxgbr,dlg") (const_int 1)]
(const_int 0)))
(define_attr "z13_groupalone" ""
(cond [(eq_attr "mnemonic" "mvc,dxbr,lxebr,axtr,cxtr,alcr,lxdb,lxeb,mxtr,\
mfy,cxbr,dsgr,lcxbr,slb,mr,dr,alc,slbr,maebr,mlgr,dsgfr,sxtr,tdcxt,tabort,\
msebr,lxdtr,ltxtr,slbg,ml,mxbr,maeb,oc,dxtr,msdb,sqxbr,mseb,xc,m,clc,mlg,\
mlr,fixbra,alcgr,nc,sfpc,dlgr,fixbr,slbgr,fixtr,lpxbr,axbr,lxdbr,ltxbr,\
tcxb,dlr,lnxbr,sxbr,flogr,alcg,tend,madb,bcr_flush") (const_int 1)]
(const_int 0)))
(define_attr "z13_endgroup" ""
(cond [(eq_attr "mnemonic" "ipm") (const_int 1)]
(const_int 0)))
(define_attr "z13_unit_lsu" ""
(cond [(eq_attr "mnemonic" "vlbb,mvc,llgc,llc,llhrl,vl,llghrl,vlrepf,\
vlrepg,vlreph,lde,ldy,tabort,l,llh,ld,lg,ly,vlrepb,vllezb,vllezf,vllezg,\
vllezh,oc,xc,clc,lrl,ear,nc,lgrl,sfpc,llgf,llgfrl,llgh,llgt,lcbb,vll,sar") (const_int 1)]
(const_int 0)))
(define_attr "z13_unit_fxu" ""
(cond [(eq_attr "mnemonic" "s,lcgr,x,nop,oiy,ppa,ng,msy,sgrk,vstl,aghik,\
msgf,ipm,mvi,stocg,rll,srlg,cghsi,clgit,srlk,alrk,sg,sh,sl,st,sy,vst,ark,\
xgr,agsi,tm,nrk,shy,llhr,agf,alcr,slgfr,sr,clgrt,laa,lder,sgf,lan,llilf,\
llilh,ag,llill,lay,al,n,laxg,ar,ahi,sgr,ntstg,ay,stcy,nopr,mfy,ngrk,lbr,\
br,dsgr,stdy,ork,ldgr,lcr,cg,ch,lgfrl,cl,stoc,cr,agfr,stgrl,cy,alfi,xg,\
cgfi,xi,clfhsi,cgfr,xr,slb,mghi,clfi,slg,clhhsi,agfi,clfit,sly,mr,ldr,nihf,\
nihh,algfi,dr,nihl,algf,algfr,algr,clgf,clgr,clgt,aghi,alc,alg,locg,alr,\
locr,cghi,aly,alghsik,slbr,clgfrl,mhy,cit,nr,ny,xiy,mlgr,sthy,cly,dsgfr,\
rllg,cgit,lgb,lgf,clgrl,lgh,lrvgr,cliy,cgrl,lgr,slrk,clrt,icy,laog,og,agr,\
mvhi,lhrl,or,lhr,vlvgp,lhy,nilf,oy,nilh,nill,lcdfr,mviy,tmhh,tmhl,sthrl,\
ltgf,ltgr,srk,clghrl,ahy,vstef,vsteg,ah,vlgvb,llgcr,tmh,tml,clmy,slr,cfi,\
stc,std,ste,stg,sth,locgr,slbg,sty,tmlh,la,lb,mvghi,lh,risbgn,lrvg,lr,asi,\
lt,ahik,lrvr,cgf,cgh,cgr,clhrl,lzdr,tmll,mh,ml,vlvgb,ms,lrv,vlvgf,xgrk,\
vlvgg,llgfr,vlvgh,slfi,chi,chy,mhi,lzer,alhsik,ni,ltgfr,loc,icm,oi,cgfrl,\
agrk,lgat,oilh,llghr,lghrl,oill,xihf,lpgr,cgrt,clrl,sgfr,lpr,lgbr,strl,\
algrk,alsi,srak,slgf,a,b,c,slgr,m,o,algsi,icmh,srag,iilf,ogrk,clg,icmy,\
cli,clm,clr,clt,slgrk,mlg,lao,mlr,risbg,mvhhi,lat,etnd,lax,iihf,sra,alcgr,\
msgr,clghsi,stey,ngr,xilf,laag,oihf,oihh,oihl,ltg,ltr,niy,lgfi,dlgr,lgfr,\
slgfi,llcr,slbgr,chrl,lgdr,pfpo,lang,basr,sllg,sllk,lghi,lghr,vlgvf,vlgvg,\
vlgvh,vlr,chsi,lngr,cghrl,srl,lhi,oilf,crl,crt,afi,xrk,llgtr,llihf,llihh,\
llihl,dlr,msgfi,msgfr,msg,flogr,xy,msr,clgfi,clgfr,ogr,popcnt,alcg,lndfr,\
larl,sll,tmy,msfi,ic,lpdfr,tend,lnr") (const_int 1)]
(const_int 0)))
(define_attr "z13_unit_vfu" ""
(cond [(eq_attr "mnemonic" "seb,vcksm,vfadb,vleib,vchgs,vleif,vleig,vleih,\
vgbm,verimb,vone,verimf,verimg,verimh,dxbr,verllvb,lpebr,verllvf,verllvg,\
verllvh,vfeneb,wcdgb,vfenef,vfeneh,vchhs,vctzb,vctzf,vctzg,vctzh,vlcb,aeb,\
vlcf,vlcg,vlch,vfmsdb,vgfmab,ltebr,vgfmaf,vgfmag,vgfmah,vmaeh,vsb,vsf,vsg,\
vsh,vsl,vsq,lxebr,cdtr,fiebr,vupllb,vupllf,vupllh,vmrhb,madbr,vtm,vmrhf,\
vmrhg,vmrhh,axtr,fiebra,vleb,cxtr,vlef,vleg,vleh,vpkf,vpkg,vpkh,vmlob,vmlof,\
vmloh,lxdb,ldeb,mdtr,vceqfs,adb,wflndb,lxeb,vn,vo,vchlb,vx,mxtr,vchlf,vchlg,\
vchlh,vfcedbs,vfcedb,vceqgs,cxbr,msdbr,vcdgb,debr,vceqhs,meeb,lcxbr,vavglb,\
vavglf,vavglg,vavglh,wfcedbs,vmrlb,vmrlf,vmrlg,vmrlh,wfchedbs,vmxb,tcdb,\
vmahh,vsrlb,wcgdb,lcdbr,vistrbs,vrepb,wfmdb,vrepf,vrepg,vreph,ler,wcdlgb,\
ley,vistrb,vistrf,vistrh,tceb,wfsqdb,sqeb,vsumqf,vsumqg,vesrlb,vfeezbs,\
maebr,vesrlf,vesrlg,vesrlh,vmeb,vmef,vmeh,meebr,vflcdb,wfmadb,vperm,sxtr,\
vclzf,vgm,vgmb,vgmf,vgmg,vgmh,tdcxt,vzero,msebr,veslb,veslf,veslg,vfenezb,\
vfenezf,vfenezh,vistrfs,vchf,vchg,vchh,vmhb,vmhf,vmhh,cdb,veslvb,ledbr,\
veslvf,veslvg,veslvh,wclgdb,vfmdb,vmnlb,vmnlf,vmnlg,vmnlh,vclzb,vfeezfs,\
vclzg,vclzh,mdb,vmxlb,vmxlf,vmxlg,vmxlh,ltdtr,vsbcbiq,ceb,wfddb,sebr,vistrhs,\
lxdtr,lcebr,vab,vaf,vag,vah,ltxtr,vlpf,vlpg,vsegb,vaq,vsegf,vsegh,wfchdbs,\
sdtr,cdbr,vfeezhs,le,wldeb,vfmadb,vchlbs,vacccq,vmaleb,vsel,vmalef,vmaleh,\
vflndb,mdbr,vmlb,wflpdb,ldetr,vpksfs,vpksf,vpksg,vpksh,sqdb,mxbr,sqdbr,\
vmaeb,veslh,vmaef,vpklsf,vpklsg,vpklsh,verllb,vchb,ddtr,verllf,verllg,verllh,\
wfsdb,maeb,vclgdb,vftcidb,vpksgs,vmxf,vmxg,vmxh,fidbra,vmnb,vmnf,vmng,vfchedbs,\
lnebr,vfidb,dxtr,ddb,msdb,vmalhb,vfddb,vmalhf,vmalhh,vpkshs,vfsdb,sqxbr,\
vmalhw,ltdbr,vmob,vmof,vmoh,deb,vchlfs,mseb,vcdlgb,vlpb,wfmsdb,vlph,vmahb,\
vldeb,vmahf,vgfmb,fidbr,vfsqdb,aebr,wledb,vchlgs,vesravb,vfchdbs,cebr,vesravf,\
vesravg,vesravh,vcgdb,fixbra,vrepib,vrepif,vrepig,vrepih,tdcdt,vchlhs,vceqb,\
vscbib,vceqf,vceqg,vscbif,vscbig,vscbih,vmlhw,vscbiq,vuphb,vuphf,vuphh,\
vfchedb,tdcet,vslb,vpklsfs,adbr,sqebr,vfchdb,fixbr,vpklsgs,vsldb,vmleb,\
vmlef,vmleh,cpsdr,vmalb,vmalf,vavgb,vmlf,vavgf,vavgg,vavgh,vgfmf,vgfmg,\
vgfmh,fidtr,vpklshs,lndbr,vno,lpdbr,vacq,vledb,vchbs,vfeeb,vfeef,vfeeh,\
fixtr,vaccb,wfadb,vaccf,vaccg,vacch,vnot,vmalob,vaccq,vmalof,vmaloh,lpxbr,\
ledtr,vuplb,vuplf,axbr,lxdbr,ltxbr,vpopct,vpdi,vmlhb,vmlhf,vmlhh,sdbr,vnc,\
vsumb,vsrab,vsumh,vmaob,vmaof,vmaoh,vesrlvb,vesrlvf,vesrlvg,vesrlvh,tcxb,\
vceqbs,vceqh,lnxbr,sxbr,vesrab,wflcdb,vesraf,vesrag,vesrah,vflpdb,vmnh,\
vsbiq,adtr,vsra,vsrl,vuplhb,sdb,vuplhf,vuplhh,vsumgf,vsumgh,ldebr,vuplhw,\
vchfs,madb,ddbr") (const_int 1)]
(const_int 0)))
(define_insn_reservation "z13_0" 0
(and (eq_attr "cpu" "z13")
(eq_attr "mnemonic" "s,lcgr,x,nop,oiy,vlbb,ppa,ng,sgrk,vstl,aghik,\
mvc,ipm,llgc,mvi,stocg,rll,jg,srlg,cghsi,clgit,srlk,alrk,sg,sh,sl,st,sy,\
vst,ark,xgr,agsi,tm,nrk,shy,llhr,agf,alcr,slgfr,sr,clgrt,llc,laa,lder,sgf,\
lan,llhrl,llilf,llilh,ag,llill,lay,al,n,laxg,ar,ahi,sgr,ntstg,ay,stcy,vl,\
nopr,ngrk,lbr,br,stdy,ork,ldgr,lcr,cg,ch,llghrl,lgfrl,cl,stoc,cr,agfr,stgrl,\
cy,alfi,xg,cgfi,xi,vlrepf,vlrepg,vlreph,clfhsi,cgfr,xr,slb,mghi,clfi,slg,\
lde,clhhsi,agfi,clfit,sly,ldr,ldy,nihf,nihh,algfi,nihl,algf,algfr,algr,\
clgf,clgr,clgt,aghi,alc,alg,locg,alr,locr,cghi,aly,alghsik,slbr,clgfrl,\
mhy,cit,nr,ny,xiy,sthy,cly,rllg,cgit,lgb,lgf,clgrl,lgh,lrvgr,cliy,cgrl,\
lgr,slrk,clrt,icy,laog,og,agr,mvhi,lhrl,or,lhr,vlvgp,lhy,nilf,oy,nilh,tabort,\
nill,lcdfr,mviy,tmhh,tmhl,sthrl,ltgf,ltgr,srk,clghrl,ahy,vstef,vsteg,ah,\
vlgvb,llgcr,tmh,tml,clmy,slr,cfi,stc,std,ste,stg,sth,l,locgr,llh,slbg,sty,\
tmlh,la,lb,ld,mvghi,lg,lh,risbgn,lrvg,lr,asi,lt,ahik,ly,lrvr,vlrepb,vllezb,\
cgf,cgh,vllezf,vllezg,vllezh,cgr,clhrl,lzdr,tmll,mh,vlvgb,lrv,vlvgf,xgrk,\
vlvgg,llgfr,vlvgh,slfi,chi,chy,mhi,lzer,alhsik,ni,ltgfr,loc,icm,oc,oi,cgfrl,\
agrk,lgat,oilh,llghr,lghrl,oill,xihf,lpgr,cgrt,clrl,sgfr,lpr,lgbr,strl,\
algrk,alsi,srak,brcl,slgf,xc,a,b,c,slgr,j,o,algsi,icmh,srag,iilf,ogrk,clc,\
clg,icmy,cli,clm,clr,clt,slgrk,lrl,lao,risbg,mvhhi,lat,etnd,lax,iihf,sra,\
alcgr,clghsi,ear,nc,lgrl,stey,ngr,xilf,laag,oihf,oihh,oihl,ltg,ltr,niy,\
lgfi,sfpc,lgfr,slgfi,llcr,llgf,llgfrl,llgh,slbgr,llgt,chrl,lgdr,pfpo,lang,\
basr,lcbb,sllg,sllk,lghi,vll,lghr,vlgvf,vlgvg,vlgvh,vlr,chsi,lngr,cghrl,\
srl,sar,lhi,oilf,crl,crt,afi,xrk,llgtr,llihf,llihh,llihl,xy,clgfi,clgfr,\
ogr,popcnt,alcg,lndfr,larl,sll,tmy,ic,lpdfr,tend,lnr,bcr_flush")) "nothing")
(define_insn_reservation "z13_1" 1
(and (eq_attr "cpu" "z13")
(eq_attr "mnemonic" "celgbr,vscef,vsceg,msy,msgf,cxlftr,cdsg,cdsy,\
exrl,clfebr,cefbr,chhsi,stam,vgef,vgeg,cdlftr,lam,mfy,lcgfr,cfdbr,dsgf,\
cgdbr,lzxr,lmg,cfxbr,rnsbg,cxlgtr,mr,dl,cxftr,sldl,cgdtr,cegbr,rxsbg,ex,\
cgxtr,clfxtr,mlgr,cdlgtr,brasl,dsg,efpc,cfebr,tbeginc,celfbr,clgxbr,vsteb,\
vsteh,cxlfbr,clfdtr,cxgtr,stmg,stmy,stm,lm,cds,cdfbr,ml,ms,lngfr,clgebr,\
stpq,lmy,cs,lpgfr,cdlgbr,lpq,cxfbr,cxlgbr,cdgtr,d,m,mlg,mlr,cgxbr,cdftr,\
msgr,rosbg,clgdbr,cdgbr,srda,bras,srdl,tbegin,clfdbr,cdlfbr,cxgbr,cgebr,\
dlg,clfxbr,lxr,csy,msgfi,msgfr,msg,flogr,msr,csg,msfi,clgdtr,clgxtr")) "nothing")
(define_insn_reservation "z13_2" 2
(and (eq_attr "cpu" "z13")
(eq_attr "mnemonic" "seb,vcksm,vfadb,vleib,vchgs,vleif,vleig,vleih,\
vgbm,verimb,vone,verimf,verimg,verimh,verllvb,lpebr,verllvf,verllvg,verllvh,\
vfeneb,wcdgb,vfenef,vfeneh,vchhs,vctzb,vctzf,vctzg,vctzh,vlcb,aeb,vlcf,\
vlcg,vlch,vfmsdb,vgfmab,ltebr,vgfmaf,vgfmag,vgfmah,vmaeh,vsb,vsf,vsg,vsh,\
vsl,vsq,lxebr,cdtr,fiebr,vupllb,vupllf,vupllh,vmrhb,madbr,vtm,vmrhf,vmrhg,\
vmrhh,axtr,fiebra,vleb,cxtr,vlef,vleg,vleh,vpkf,vpkg,vpkh,vmlob,vmlof,vmloh,\
lxdb,ldeb,vceqfs,adb,wflndb,lxeb,vn,vo,vchlb,vx,vchlf,vchlg,vchlh,vfcedbs,\
vfcedb,vceqgs,cxbr,msdbr,vcdgb,vceqhs,meeb,lcxbr,vavglb,vavglf,vavglg,vavglh,\
wfcedbs,vmrlb,vmrlf,vmrlg,vmrlh,wfchedbs,vmxb,tcdb,vmahh,vsrlb,wcgdb,lcdbr,\
vistrbs,vrepb,wfmdb,vrepf,vrepg,vreph,ler,wcdlgb,ley,vistrb,vistrf,vistrh,\
tceb,vsumqf,vsumqg,vesrlb,vfeezbs,maebr,vesrlf,vesrlg,vesrlh,vmeb,vmef,\
vmeh,meebr,vflcdb,wfmadb,vperm,sxtr,vclzf,vgm,vgmb,vgmf,vgmg,vgmh,tdcxt,\
vzero,msebr,veslb,veslf,veslg,vfenezb,vfenezf,vfenezh,vistrfs,vchf,vchg,\
vchh,vmhb,vmhf,vmhh,cdb,veslvb,ledbr,veslvf,veslvg,veslvh,wclgdb,vfmdb,\
vmnlb,vmnlf,vmnlg,vmnlh,vclzb,vfeezfs,vclzg,vclzh,mdb,vmxlb,vmxlf,vmxlg,\
vmxlh,ltdtr,vsbcbiq,ceb,sebr,vistrhs,lxdtr,lcebr,vab,vaf,vag,vah,ltxtr,\
vlpf,vlpg,vsegb,vaq,vsegf,vsegh,wfchdbs,sdtr,cdbr,vfeezhs,le,wldeb,vfmadb,\
vchlbs,vacccq,vmaleb,vsel,vmalef,vmaleh,vflndb,mdbr,vmlb,wflpdb,ldetr,vpksfs,\
vpksf,vpksg,vpksh,vmaeb,veslh,vmaef,vpklsf,vpklsg,vpklsh,verllb,vchb,verllf,\
verllg,verllh,wfsdb,maeb,vclgdb,vftcidb,vpksgs,vmxf,vmxg,vmxh,fidbra,vmnb,\
vmnf,vmng,vfchedbs,lnebr,vfidb,msdb,vmalhb,vmalhf,vmalhh,vpkshs,vfsdb,vmalhw,\
ltdbr,vmob,vmof,vmoh,vchlfs,mseb,vcdlgb,vlpb,wfmsdb,vlph,vmahb,vldeb,vmahf,\
vgfmb,fidbr,aebr,wledb,vchlgs,vesravb,vfchdbs,cebr,vesravf,vesravg,vesravh,\
vcgdb,fixbra,vrepib,vrepif,vrepig,vrepih,tdcdt,vchlhs,vceqb,vscbib,vceqf,\
vceqg,vscbif,vscbig,vscbih,vmlhw,vscbiq,vuphb,vuphf,vuphh,vfchedb,tdcet,\
vslb,vpklsfs,adbr,vfchdb,fixbr,vpklsgs,vsldb,vmleb,vmlef,vmleh,cpsdr,vmalb,\
vmalf,vavgb,vmlf,vavgf,vavgg,vavgh,vgfmf,vgfmg,vgfmh,fidtr,vpklshs,lndbr,\
vno,lpdbr,vacq,vledb,vchbs,vfeeb,vfeef,vfeeh,fixtr,vaccb,wfadb,vaccf,vaccg,\
vacch,vnot,vmalob,vaccq,vmalof,vmaloh,lpxbr,vuplb,vuplf,axbr,lxdbr,ltxbr,\
vpopct,vpdi,vmlhb,vmlhf,vmlhh,sdbr,vnc,vsumb,vsrab,vsumh,vmaob,vmaof,vmaoh,\
vesrlvb,vesrlvf,vesrlvg,vesrlvh,tcxb,vceqbs,vceqh,lnxbr,sxbr,vesrab,wflcdb,\
vesraf,vesrag,vesrah,vflpdb,vmnh,vsbiq,adtr,vsra,vsrl,vuplhb,sdb,vuplhf,\
vuplhh,vsumgf,vsumgh,ldebr,vuplhw,vchfs,madb")) "nothing")
(define_insn_reservation "z13_3" 3
(and (eq_attr "cpu" "z13")
(eq_attr "mnemonic" "ledtr")) "nothing")
(define_insn_reservation "z13_4" 4
(and (eq_attr "cpu" "z13")
(eq_attr "mnemonic" "dr,mxbr,dlr")) "nothing")
(define_insn_reservation "z13_6" 6
(and (eq_attr "cpu" "z13")
(eq_attr "mnemonic" "debr,sqeb,deb,sqebr")) "nothing")
(define_insn_reservation "z13_7" 7
(and (eq_attr "cpu" "z13")
(eq_attr "mnemonic" "mdtr")) "nothing")
(define_insn_reservation "z13_8" 8
(and (eq_attr "cpu" "z13")
(eq_attr "mnemonic" "wfddb,ddb,vfddb,ddbr")) "nothing")
(define_insn_reservation "z13_9" 9
(and (eq_attr "cpu" "z13")
(eq_attr "mnemonic" "dsgr,wfsqdb,dsgfr,sqdb,sqdbr,vfsqdb")) "nothing")
(define_insn_reservation "z13_13" 13
(and (eq_attr "cpu" "z13")
(eq_attr "mnemonic" "mxtr,ddtr")) "nothing")
(define_insn_reservation "z13_16" 16
(and (eq_attr "cpu" "z13")
(eq_attr "mnemonic" "sqxbr")) "nothing")
(define_insn_reservation "z13_17" 17
(and (eq_attr "cpu" "z13")
(eq_attr "mnemonic" "dxtr")) "nothing")
(define_insn_reservation "z13_20" 20
(and (eq_attr "cpu" "z13")
(eq_attr "mnemonic" "dxbr,dlgr")) "nothing")

View File

@ -340,6 +340,19 @@ extern int reload_completed;
/* Kept up to date using the SCHED_VARIABLE_ISSUE hook. */
static rtx_insn *last_scheduled_insn;
#define MAX_SCHED_UNITS 3
static int last_scheduled_unit_distance[MAX_SCHED_UNITS];
/* The maximum score added for an instruction whose unit hasn't been
in use for MAX_SCHED_MIX_DISTANCE steps. Increase this value to
give instruction mix scheduling more priority over instruction
grouping. */
#define MAX_SCHED_MIX_SCORE 8
/* The maximum distance up to which individual scores will be
calculated. Everything beyond this gives MAX_SCHED_MIX_SCORE.
Increase this with the OOO windows size of the machine. */
#define MAX_SCHED_MIX_DISTANCE 100
/* Structure used to hold the components of a S/390 memory
address. A legitimate address on S/390 is of the general
@ -13560,27 +13573,66 @@ s390_z10_prevent_earlyload_conflicts (rtx_insn **ready, int *nready_p)
static int s390_sched_state;
#define S390_OOO_SCHED_STATE_NORMAL 3
#define S390_OOO_SCHED_STATE_CRACKED 4
#define S390_SCHED_STATE_NORMAL 3
#define S390_SCHED_STATE_CRACKED 4
#define S390_OOO_SCHED_ATTR_MASK_CRACKED 0x1
#define S390_OOO_SCHED_ATTR_MASK_EXPANDED 0x2
#define S390_OOO_SCHED_ATTR_MASK_ENDGROUP 0x4
#define S390_OOO_SCHED_ATTR_MASK_GROUPALONE 0x8
#define S390_SCHED_ATTR_MASK_CRACKED 0x1
#define S390_SCHED_ATTR_MASK_EXPANDED 0x2
#define S390_SCHED_ATTR_MASK_ENDGROUP 0x4
#define S390_SCHED_ATTR_MASK_GROUPALONE 0x8
static unsigned int
s390_get_sched_attrmask (rtx_insn *insn)
{
unsigned int mask = 0;
if (get_attr_ooo_cracked (insn))
mask |= S390_OOO_SCHED_ATTR_MASK_CRACKED;
if (get_attr_ooo_expanded (insn))
mask |= S390_OOO_SCHED_ATTR_MASK_EXPANDED;
if (get_attr_ooo_endgroup (insn))
mask |= S390_OOO_SCHED_ATTR_MASK_ENDGROUP;
if (get_attr_ooo_groupalone (insn))
mask |= S390_OOO_SCHED_ATTR_MASK_GROUPALONE;
switch (s390_tune)
{
case PROCESSOR_2827_ZEC12:
if (get_attr_zEC12_cracked (insn))
mask |= S390_SCHED_ATTR_MASK_CRACKED;
if (get_attr_zEC12_expanded (insn))
mask |= S390_SCHED_ATTR_MASK_EXPANDED;
if (get_attr_zEC12_endgroup (insn))
mask |= S390_SCHED_ATTR_MASK_ENDGROUP;
if (get_attr_zEC12_groupalone (insn))
mask |= S390_SCHED_ATTR_MASK_GROUPALONE;
break;
case PROCESSOR_2964_Z13:
if (get_attr_z13_cracked (insn))
mask |= S390_SCHED_ATTR_MASK_CRACKED;
if (get_attr_z13_expanded (insn))
mask |= S390_SCHED_ATTR_MASK_EXPANDED;
if (get_attr_z13_endgroup (insn))
mask |= S390_SCHED_ATTR_MASK_ENDGROUP;
if (get_attr_z13_groupalone (insn))
mask |= S390_SCHED_ATTR_MASK_GROUPALONE;
break;
default:
gcc_unreachable ();
}
return mask;
}
static unsigned int
s390_get_unit_mask (rtx_insn *insn, int *units)
{
unsigned int mask = 0;
switch (s390_tune)
{
case PROCESSOR_2964_Z13:
*units = 3;
if (get_attr_z13_unit_lsu (insn))
mask |= 1 << 0;
if (get_attr_z13_unit_fxu (insn))
mask |= 1 << 1;
if (get_attr_z13_unit_vfu (insn))
mask |= 1 << 2;
break;
default:
gcc_unreachable ();
}
return mask;
}
@ -13598,48 +13650,66 @@ s390_sched_score (rtx_insn *insn)
case 0:
/* Try to put insns into the first slot which would otherwise
break a group. */
if ((mask & S390_OOO_SCHED_ATTR_MASK_CRACKED) != 0
|| (mask & S390_OOO_SCHED_ATTR_MASK_EXPANDED) != 0)
if ((mask & S390_SCHED_ATTR_MASK_CRACKED) != 0
|| (mask & S390_SCHED_ATTR_MASK_EXPANDED) != 0)
score += 5;
if ((mask & S390_OOO_SCHED_ATTR_MASK_GROUPALONE) != 0)
if ((mask & S390_SCHED_ATTR_MASK_GROUPALONE) != 0)
score += 10;
case 1:
/* Prefer not cracked insns while trying to put together a
group. */
if ((mask & S390_OOO_SCHED_ATTR_MASK_CRACKED) == 0
&& (mask & S390_OOO_SCHED_ATTR_MASK_EXPANDED) == 0
&& (mask & S390_OOO_SCHED_ATTR_MASK_GROUPALONE) == 0)
if ((mask & S390_SCHED_ATTR_MASK_CRACKED) == 0
&& (mask & S390_SCHED_ATTR_MASK_EXPANDED) == 0
&& (mask & S390_SCHED_ATTR_MASK_GROUPALONE) == 0)
score += 10;
if ((mask & S390_OOO_SCHED_ATTR_MASK_ENDGROUP) == 0)
if ((mask & S390_SCHED_ATTR_MASK_ENDGROUP) == 0)
score += 5;
break;
case 2:
/* Prefer not cracked insns while trying to put together a
group. */
if ((mask & S390_OOO_SCHED_ATTR_MASK_CRACKED) == 0
&& (mask & S390_OOO_SCHED_ATTR_MASK_EXPANDED) == 0
&& (mask & S390_OOO_SCHED_ATTR_MASK_GROUPALONE) == 0)
if ((mask & S390_SCHED_ATTR_MASK_CRACKED) == 0
&& (mask & S390_SCHED_ATTR_MASK_EXPANDED) == 0
&& (mask & S390_SCHED_ATTR_MASK_GROUPALONE) == 0)
score += 10;
/* Prefer endgroup insns in the last slot. */
if ((mask & S390_OOO_SCHED_ATTR_MASK_ENDGROUP) != 0)
if ((mask & S390_SCHED_ATTR_MASK_ENDGROUP) != 0)
score += 10;
break;
case S390_OOO_SCHED_STATE_NORMAL:
case S390_SCHED_STATE_NORMAL:
/* Prefer not cracked insns if the last was not cracked. */
if ((mask & S390_OOO_SCHED_ATTR_MASK_CRACKED) == 0
&& (mask & S390_OOO_SCHED_ATTR_MASK_EXPANDED) == 0)
if ((mask & S390_SCHED_ATTR_MASK_CRACKED) == 0
&& (mask & S390_SCHED_ATTR_MASK_EXPANDED) == 0)
score += 5;
if ((mask & S390_OOO_SCHED_ATTR_MASK_GROUPALONE) != 0)
if ((mask & S390_SCHED_ATTR_MASK_GROUPALONE) != 0)
score += 10;
break;
case S390_OOO_SCHED_STATE_CRACKED:
case S390_SCHED_STATE_CRACKED:
/* Try to keep cracked insns together to prevent them from
interrupting groups. */
if ((mask & S390_OOO_SCHED_ATTR_MASK_CRACKED) != 0
|| (mask & S390_OOO_SCHED_ATTR_MASK_EXPANDED) != 0)
if ((mask & S390_SCHED_ATTR_MASK_CRACKED) != 0
|| (mask & S390_SCHED_ATTR_MASK_EXPANDED) != 0)
score += 5;
break;
}
if (s390_tune == PROCESSOR_2964_Z13)
{
int units, i;
unsigned unit_mask, m = 1;
unit_mask = s390_get_unit_mask (insn, &units);
gcc_assert (units <= MAX_SCHED_UNITS);
/* Add a score in range 0..MAX_SCHED_MIX_SCORE depending on how long
ago the last insn of this unit type got scheduled. This is
supposed to help providing a proper instruction mix to the
CPU. */
for (i = 0; i < units; i++, m <<= 1)
if (m & unit_mask)
score += (last_scheduled_unit_distance[i] * MAX_SCHED_MIX_SCORE /
MAX_SCHED_MIX_DISTANCE);
}
return score;
}
@ -13695,12 +13765,12 @@ s390_sched_reorder (FILE *file, int verbose,
if (verbose > 5)
fprintf (file,
"move insn %d to the top of list\n",
";;\t\tBACKEND: move insn %d to the top of list\n",
INSN_UID (ready[last_index]));
}
else if (verbose > 5)
fprintf (file,
"best insn %d already on top\n",
";;\t\tBACKEND: best insn %d already on top\n",
INSN_UID (ready[last_index]));
}
@ -13711,16 +13781,35 @@ s390_sched_reorder (FILE *file, int verbose,
for (i = last_index; i >= 0; i--)
{
if (recog_memoized (ready[i]) < 0)
unsigned int sched_mask;
rtx_insn *insn = ready[i];
if (recog_memoized (insn) < 0)
continue;
fprintf (file, "insn %d score: %d: ", INSN_UID (ready[i]),
s390_sched_score (ready[i]));
#define PRINT_OOO_ATTR(ATTR) fprintf (file, "%s ", get_attr_##ATTR (ready[i]) ? #ATTR : "!" #ATTR);
PRINT_OOO_ATTR (ooo_cracked);
PRINT_OOO_ATTR (ooo_expanded);
PRINT_OOO_ATTR (ooo_endgroup);
PRINT_OOO_ATTR (ooo_groupalone);
#undef PRINT_OOO_ATTR
sched_mask = s390_get_sched_attrmask (insn);
fprintf (file, ";;\t\tBACKEND: insn %d score: %d: ",
INSN_UID (insn),
s390_sched_score (insn));
#define PRINT_SCHED_ATTR(M, ATTR) fprintf (file, "%s ",\
((M) & sched_mask) ? #ATTR : "");
PRINT_SCHED_ATTR (S390_SCHED_ATTR_MASK_CRACKED, cracked);
PRINT_SCHED_ATTR (S390_SCHED_ATTR_MASK_EXPANDED, expanded);
PRINT_SCHED_ATTR (S390_SCHED_ATTR_MASK_ENDGROUP, endgroup);
PRINT_SCHED_ATTR (S390_SCHED_ATTR_MASK_GROUPALONE, groupalone);
#undef PRINT_SCHED_ATTR
if (s390_tune == PROCESSOR_2964_Z13)
{
unsigned int unit_mask, m = 1;
int units, j;
unit_mask = s390_get_unit_mask (insn, &units);
fprintf (file, "(units:");
for (j = 0; j < units; j++, m <<= 1)
if (m & unit_mask)
fprintf (file, " u%d", j);
fprintf (file, ")");
}
fprintf (file, "\n");
}
}
@ -13745,12 +13834,12 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
{
unsigned int mask = s390_get_sched_attrmask (insn);
if ((mask & S390_OOO_SCHED_ATTR_MASK_CRACKED) != 0
|| (mask & S390_OOO_SCHED_ATTR_MASK_EXPANDED) != 0)
s390_sched_state = S390_OOO_SCHED_STATE_CRACKED;
else if ((mask & S390_OOO_SCHED_ATTR_MASK_ENDGROUP) != 0
|| (mask & S390_OOO_SCHED_ATTR_MASK_GROUPALONE) != 0)
s390_sched_state = S390_OOO_SCHED_STATE_NORMAL;
if ((mask & S390_SCHED_ATTR_MASK_CRACKED) != 0
|| (mask & S390_SCHED_ATTR_MASK_EXPANDED) != 0)
s390_sched_state = S390_SCHED_STATE_CRACKED;
else if ((mask & S390_SCHED_ATTR_MASK_ENDGROUP) != 0
|| (mask & S390_SCHED_ATTR_MASK_GROUPALONE) != 0)
s390_sched_state = S390_SCHED_STATE_NORMAL;
else
{
/* Only normal insns are left (mask == 0). */
@ -13759,30 +13848,73 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
case 0:
case 1:
case 2:
case S390_OOO_SCHED_STATE_NORMAL:
if (s390_sched_state == S390_OOO_SCHED_STATE_NORMAL)
case S390_SCHED_STATE_NORMAL:
if (s390_sched_state == S390_SCHED_STATE_NORMAL)
s390_sched_state = 1;
else
s390_sched_state++;
break;
case S390_OOO_SCHED_STATE_CRACKED:
s390_sched_state = S390_OOO_SCHED_STATE_NORMAL;
case S390_SCHED_STATE_CRACKED:
s390_sched_state = S390_SCHED_STATE_NORMAL;
break;
}
}
if (s390_tune == PROCESSOR_2964_Z13)
{
int units, i;
unsigned unit_mask, m = 1;
unit_mask = s390_get_unit_mask (insn, &units);
gcc_assert (units <= MAX_SCHED_UNITS);
for (i = 0; i < units; i++, m <<= 1)
if (m & unit_mask)
last_scheduled_unit_distance[i] = 0;
else if (last_scheduled_unit_distance[i] < MAX_SCHED_MIX_DISTANCE)
last_scheduled_unit_distance[i]++;
}
if (verbose > 5)
{
fprintf (file, "insn %d: ", INSN_UID (insn));
#define PRINT_OOO_ATTR(ATTR) \
fprintf (file, "%s ", get_attr_##ATTR (insn) ? #ATTR : "");
PRINT_OOO_ATTR (ooo_cracked);
PRINT_OOO_ATTR (ooo_expanded);
PRINT_OOO_ATTR (ooo_endgroup);
PRINT_OOO_ATTR (ooo_groupalone);
#undef PRINT_OOO_ATTR
fprintf (file, "\n");
fprintf (file, "sched state: %d\n", s390_sched_state);
unsigned int sched_mask;
sched_mask = s390_get_sched_attrmask (insn);
fprintf (file, ";;\t\tBACKEND: insn %d: ", INSN_UID (insn));
#define PRINT_SCHED_ATTR(M, ATTR) fprintf (file, "%s ", ((M) & sched_mask) ? #ATTR : "");
PRINT_SCHED_ATTR (S390_SCHED_ATTR_MASK_CRACKED, cracked);
PRINT_SCHED_ATTR (S390_SCHED_ATTR_MASK_EXPANDED, expanded);
PRINT_SCHED_ATTR (S390_SCHED_ATTR_MASK_ENDGROUP, endgroup);
PRINT_SCHED_ATTR (S390_SCHED_ATTR_MASK_GROUPALONE, groupalone);
#undef PRINT_SCHED_ATTR
if (s390_tune == PROCESSOR_2964_Z13)
{
unsigned int unit_mask, m = 1;
int units, j;
unit_mask = s390_get_unit_mask (insn, &units);
fprintf (file, "(units:");
for (j = 0; j < units; j++, m <<= 1)
if (m & unit_mask)
fprintf (file, " %d", j);
fprintf (file, ")");
}
fprintf (file, " sched state: %d\n", s390_sched_state);
if (s390_tune == PROCESSOR_2964_Z13)
{
int units, j;
s390_get_unit_mask (insn, &units);
fprintf (file, ";;\t\tBACKEND: units unused for: ");
for (j = 0; j < units; j++)
fprintf (file, "%d:%d ", j, last_scheduled_unit_distance[j]);
fprintf (file, "\n");
}
}
}
@ -13799,6 +13931,7 @@ s390_sched_init (FILE *file ATTRIBUTE_UNUSED,
int max_ready ATTRIBUTE_UNUSED)
{
last_scheduled_insn = NULL;
memset (last_scheduled_unit_distance, 0, MAX_SCHED_UNITS * sizeof (int));
s390_sched_state = 0;
}

View File

@ -512,6 +512,9 @@
;; Pipeline description for zEC12
(include "2827.md")
;; Pipeline description for z13
(include "2964.md")
;; Predicates
(include "predicates.md")