table 193 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. rscid = "$Header$"
  6. /********************************
  7. * *
  8. * 68000, 68010 and 68020 *
  9. * back end table *
  10. * *
  11. ********************************/
  12. #include "whichone.h"
  13. #if TBL68881 && ! TBL68020
  14. Something very wrong here!
  15. #endif
  16. #if WORD_SIZE!=2 && WORD_SIZE!=4
  17. Something very wrong here!
  18. #endif
  19. /* #define FANCY_MODES 1
  20. /* On the M68020, there are some real fancy addressing modes.
  21. Their use makes the code a bit shorter, but also much slower.
  22. The FANCY_MODES #define enables the use of these addressing
  23. modes.
  24. */
  25. #define small(x) ((x)>=1 && (x)<=8)
  26. #define directadd(x) (small(x) || (x)>128)
  27. #define directsub(x) (directadd(0-x))
  28. #define nicesize(x) ((x)==1||(x)==2||(x)==4||(x)==8)
  29. #define low8(x) ((x) & 0377)
  30. #define low16(x) ((x) & 0177777)
  31. #define in_1(x) ((x)>=0-128 && (x)<128)
  32. #define in_2(x) ((x)>=0-32768 && (x)<32768)
  33. EM_WSIZE = WORD_SIZE
  34. EM_PSIZE = 4
  35. EM_BSIZE = 8
  36. SL = 8
  37. TIMEFACTOR = 1/2
  38. PROPERTIES
  39. D_REG /* data registers */
  40. A_REG(4) /* address registers */
  41. DD_REG /* allocatable D_REG, may not be a register variable */
  42. AA_REG(4) /* allocatable A_REG, may not be a register variable */
  43. RD_REG /* data register, register var */
  44. RA_REG(4) /* address register, register var */
  45. #if WORD_SIZE==2
  46. D_REG4(4) /* data register, 4 bytes */
  47. DD_REG4(4) /* allocatable D_REG, 4 bytes */
  48. #else
  49. #define D_REG4 D_REG
  50. #define DD_REG4 DD_REG
  51. #endif
  52. #if TBL68881
  53. FS_REG(4) /* floating point register */
  54. FD_REG(8) /* double floating point register */
  55. #endif
  56. REGISTERS
  57. d0, d1, d2 :D_REG, DD_REG.
  58. d3, d4, d5, d6, d7 :D_REG, RD_REG regvar.
  59. #if WORD_SIZE==2
  60. dl0("d0")=d0, dl1("d1")=d1, dl2("d2")=d2 :D_REG4, DD_REG4.
  61. #else
  62. #define dl0 d0
  63. #define dl1 d1
  64. #define dl2 d2
  65. #endif
  66. a0, a1 :A_REG, AA_REG.
  67. a2, a3, a4, a5 :A_REG, RA_REG regvar(reg_pointer).
  68. lb ("a6"), sp :A_REG. /* localbase and stack pointer */
  69. #if TBL68881
  70. F0 ("fp0"), F1 ("fp1"), F2 ("fp2"), F3 ("fp3"), F4 ("fp4"), F5 ("fp5"),
  71. F6 ("fp6"), F7 ("fp7") :FS_REG.
  72. fp0=F0,fp1=F1,fp2=F2,fp3=F3,fp4=F4,fp5=F5,fp6=F6,fp7=F7
  73. :FD_REG.
  74. #endif
  75. TOKENS
  76. /* Not all addressing modes available on the MC68020 are used in this
  77. * table. E.g (Dn), data register indirect is not used. Compared to
  78. * (An), address register indirect, (Dn) requires two more bytes and
  79. * several more clock cycles. Using (Dn) is even more expensive in
  80. * time than first moving Dn to an address register An, and then using
  81. * (An). For this kind of reasons several addressing modes are
  82. * not used in this table.
  83. *
  84. * Cost in bytes may sometimes be incorrect. Several effective addresses
  85. * use displacements that can occupy either 2 or 4 bytes. These are not
  86. * considered different TOKENS in this table.
  87. *
  88. * Data registers are the only registers used as index registers in this
  89. * table; address registers are only used to hold addresses.
  90. *
  91. * For the m68k2 and m68k4 table: the MC68000 and MC68010 have two
  92. * modes that use displacements (offsets) of limited size:
  93. * - offset(A_REG, Index_reg), where offset is only 8 bits, and
  94. * - offset(A_REG), where offset can only be 16 bits.
  95. * To make sure that no output is given with offsets too large, two
  96. * extra tokens are declared: t_regAregXcon and t_regAcon. These are
  97. * used as addresses to these modes. Whenever the displacements become
  98. * too large, they are transformed into different tokens.
  99. *
  100. * Sometimes some TOKENS are used with displacements (offsets) of 0.
  101. * It would have been possible to provide separate TOKENS for these, in
  102. * case the assembler doesn't handle zero offsets optimally. This
  103. * however would mean a very large amount of extra TOKENS and SETS for
  104. * a very small profit in code bytes, so we won't do that.
  105. *
  106. * To prevent the TOKENS list from getting too unreadable, #ifdefs are
  107. * used to form three parts:
  108. * (i) the common part;
  109. * (ii) the m68k2 and m68k4 part;
  110. * (iii) the m68020 part;
  111. */
  112. /* Part (i) */
  113. zero_const = {INT num;} WORD_SIZE cost(0,0) "#" num .
  114. small_const = {INT num;} WORD_SIZE cost(0,0) "#" num .
  115. bconst = {INT num;} WORD_SIZE cost(0,0) "#" num .
  116. const = {INT num;} WORD_SIZE cost(4,4) "#" num .
  117. #if WORD_SIZE==2
  118. /* ??? "string+const */
  119. zero_const4 = {INT num;} 4 cost(0,0) "#" num .
  120. small_const4 = {INT num;} 4 cost(0,0) "#" num .
  121. bconst4 = {INT num;} 4 cost(0,0) "#" num .
  122. const4 = {ADDR num;} 4 cost(4,4) "#" num .
  123. #endif
  124. indirect4 = {A_REG reg;} 4 cost(0,4) "(" reg ")" .
  125. post_inc4 = {A_REG reg;} 4 cost(0,4) "(" reg ")+" .
  126. pre_dec4 = {A_REG reg;} 4 cost(0,5) "-(" reg ")" .
  127. dreg4 = {D_REG4 reg;} 4 cost(0,0) reg .
  128. areg = {A_REG reg;} 4 cost(0,0) reg .
  129. dreg2 = {D_REG reg;} WORD_SIZE cost(0,0) reg .
  130. indirect2 = {A_REG reg;} WORD_SIZE cost(0,4) "(" reg ")" .
  131. post_inc2 = {A_REG reg;} WORD_SIZE cost(0,4) "(" reg ")+" .
  132. pre_dec2 = {A_REG reg;} WORD_SIZE cost(0,5) "-(" reg ")" .
  133. dreg1 = {D_REG reg;} WORD_SIZE cost(0,0) reg .
  134. indirect1 = {A_REG reg;} WORD_SIZE cost(0,4) "(" reg ")" .
  135. post_inc1 = {A_REG reg;} WORD_SIZE cost(0,4) "(" reg ")+" .
  136. pre_dec1 = {A_REG reg;} WORD_SIZE cost(0,5) "-(" reg ")" .
  137. ext_addr = {ADDR bd;} 4 cost(4,5) "#" bd .
  138. llabel = {ADDR bd;} 4 cost(2,0) bd .
  139. slabel = {ADDR bd;} 4 cost(0,0) bd .
  140. /* check this out */
  141. extend1 = {D_REG reg;} WORD_SIZE cost(0,0) reg .
  142. #if WORD_SIZE==2
  143. extend1_4 = {D_REG4 reg;} 4 cost(0,0) reg .
  144. #else
  145. #define extend1_4 extend1
  146. #endif
  147. extend2 = {D_REG4 reg;} 4 cost(0,0) reg .
  148. #ifndef TBL68020
  149. /* Part (ii) */
  150. absolute4 = {ADDR bd;} 4 cost(4,8) bd .
  151. offsetted4 = {A_REG reg; INT bd;} 4 cost(2,6) bd "(" reg ")" .
  152. index_off4 = {A_REG reg; D_REG4 xreg; INT sc; INT bd;} 4 cost(2,7)
  153. bd "(" reg "," xreg ".l)" .
  154. absolute2 = {ADDR bd;} WORD_SIZE cost(4,6) bd .
  155. offsetted2 = {A_REG reg; INT bd;} WORD_SIZE cost(2,4) bd "(" reg ")" .
  156. index_off2 = {A_REG reg; D_REG4 xreg; INT sc; INT bd;} WORD_SIZE cost(2,5)
  157. bd "(" reg "," xreg ".l)" .
  158. absolute1 = {ADDR bd;} WORD_SIZE cost(4,6) bd .
  159. offsetted1 = {A_REG reg; INT bd;} WORD_SIZE cost(2,4) bd "(" reg ")" .
  160. index_off1 = {A_REG reg; D_REG4 xreg; INT sc; INT bd;} WORD_SIZE cost(2,5)
  161. bd "(" reg "," xreg ".l)" .
  162. LOCAL = {INT bd;} WORD_SIZE cost(2,6) bd "(a6)" .
  163. #if WORD_SIZE==2
  164. /* pointers may go into DLOCAL's */
  165. DLOCAL = {INT bd;} 4 cost(2,6) bd "(a6)" .
  166. #endif
  167. local_addr = {INT bd;} 4 cost(2,6) bd "(a6)" .
  168. regAcon = {A_REG reg; INT bd;} 4 cost(2,6) bd "(" reg ")" .
  169. regAregXcon = {A_REG reg; D_REG4 xreg; INT sc; INT bd;} 4 cost(2,8)
  170. bd "(" reg "," xreg ".l)" .
  171. /* note: in the m68k[24] version %sc always equals 1 */
  172. t_regAregXcon = {A_REG reg; D_REG4 xreg; INT sc; INT bd;} 4 cost(2,8) .
  173. t_regAcon = {A_REG reg; INT bd;} 4 cost(2,6) .
  174. #else TBL68020
  175. /* Part (iii) */
  176. absolute4 = {ADDR bd;} 4 cost(4,7) "(" bd ")" .
  177. offsetted4 = {A_REG reg; INT bd;} 4 cost(2,6) "(" bd "," reg ")" .
  178. index_off4 = {A_REG reg; D_REG4 xreg; INT sc; INT bd;} 4 cost(4,9)
  179. "(" bd "," reg "," xreg ".l*" sc ")" .
  180. abs_index4 = {INT sc; D_REG4 xreg; ADDR bd;} 4 cost(6,9)
  181. "(" bd "," xreg ".l*" sc ")" .
  182. OFF_off4 = {A_REG reg; INT bd; ADDR od;} 4 cost(6,19)
  183. "([" bd "," reg "]," od ")" .
  184. OFF_indoff4 = {A_REG reg; D_REG4 xreg; INT sc; INT bd; ADDR od;} 4 cost(6,19)
  185. "([" bd "," reg "]," xreg ".l*" sc "," od ")" .
  186. INDOFF_off4 = {A_REG reg; D_REG4 xreg; INT sc; INT bd; ADDR od;} 4 cost(6,19)
  187. "([" bd "," reg "," xreg ".l*" sc "]," od ")" .
  188. ABS_off4 = {ADDR bd; ADDR od;} 4 cost(8,22) "([" bd "]," od ")" .
  189. ABS_indoff4 = {INT sc; D_REG4 xreg; ADDR bd; ADDR od;} 4 cost(8,22)
  190. "([" bd "]," xreg ".l*" sc "," od ")" .
  191. ABSIND_off4 = {INT sc; D_REG4 xreg; ADDR bd; ADDR od;} 4 cost(8,22)
  192. "([" bd "," xreg ".l*" sc "]," od ")" .
  193. absolute2 = {ADDR bd;} WORD_SIZE cost(4,7) "(" bd ")" .
  194. offsetted2 = {A_REG reg; INT bd;} WORD_SIZE cost(2,6) "(" bd "," reg ")" .
  195. index_off2 = {A_REG reg; D_REG4 xreg; INT sc; INT bd;} WORD_SIZE cost(4,9)
  196. "(" bd "," reg "," xreg ".l*" sc ")" .
  197. abs_index2 = {INT sc; D_REG4 xreg; ADDR bd;} WORD_SIZE cost(6,9)
  198. "(" bd "," xreg ".l*" sc ")" .
  199. OFF_off2 = {A_REG reg; INT bd; ADDR od;} WORD_SIZE cost(6,19)
  200. "([" bd "," reg "]," od ")" .
  201. OFF_indoff2 = {A_REG reg; D_REG4 xreg; INT sc; INT bd; ADDR od;} WORD_SIZE cost(6,19)
  202. "([" bd "," reg "]," xreg ".l*" sc "," od ")" .
  203. INDOFF_off2 = {A_REG reg; D_REG4 xreg; INT sc; INT bd; ADDR od;} WORD_SIZE cost(6,19)
  204. "([" bd "," reg "," xreg ".l*" sc "]," od ")" .
  205. ABS_off2 = {ADDR bd; ADDR od;} WORD_SIZE cost(8,22) "([" bd "]," od ")" .
  206. ABS_indoff2 = {INT sc; D_REG4 xreg; ADDR bd; ADDR od;} WORD_SIZE cost(8,22)
  207. "([" bd "]," xreg ".l*" sc "," od ")" .
  208. ABSIND_off2 = {INT sc; D_REG4 xreg; ADDR bd; ADDR od;} WORD_SIZE cost(8,22)
  209. "([" bd "," xreg ".l*" sc "]," od ")" .
  210. absolute1 = {ADDR bd;} WORD_SIZE cost(4,7) "(" bd ")" .
  211. offsetted1 = {A_REG reg; INT bd;} WORD_SIZE cost(2,6) "(" bd "," reg ")" .
  212. index_off1 = {A_REG reg; D_REG4 xreg; INT sc; INT bd;} WORD_SIZE cost(4,9)
  213. "(" bd "," reg "," xreg ".l*" sc ")" .
  214. abs_index1 = {INT sc; D_REG4 xreg; ADDR bd;} WORD_SIZE cost(6,9)
  215. "(" bd "," xreg ".l*" sc ")" .
  216. OFF_off1 = {A_REG reg; INT bd; ADDR od;} WORD_SIZE cost(6,19)
  217. "([" bd "," reg "]," od ")" .
  218. OFF_indoff1 = {A_REG reg; D_REG4 xreg; INT sc; INT bd; ADDR od;} WORD_SIZE cost(6,19)
  219. "([" bd "," reg "]," xreg ".l*" sc "," od ")" .
  220. INDOFF_off1 = {A_REG reg; D_REG4 xreg; INT sc; INT bd; ADDR od;} WORD_SIZE cost(6,19)
  221. "([" bd "," reg "," xreg ".l*" sc "]," od ")" .
  222. ABS_off1 = {ADDR bd; ADDR od;} WORD_SIZE cost(8,22) "([" bd "]," od ")" .
  223. ABS_indoff1 = {INT sc; D_REG4 xreg; ADDR bd; ADDR od;} WORD_SIZE cost(8,22)
  224. "([" bd "]," xreg ".l*" sc "," od ")" .
  225. ABSIND_off1 = {INT sc; D_REG4 xreg; ADDR bd; ADDR od;} WORD_SIZE cost(8,22)
  226. "([" bd "," xreg ".l*" sc "]," od ")" .
  227. LOCAL = {INT bd;} WORD_SIZE cost(2,6) "(" bd ",a6)" .
  228. #if WORD_SIZE==2
  229. /* pointers may go into DLOCAL's */
  230. DLOCAL = {INT bd;} 4 cost(2,6) "(" bd ",a6)" .
  231. #endif
  232. ILOCAL = {INT bd;} WORD_SIZE cost(4,16) "([" bd ",a6])" .
  233. /* check this out !!! ??? */
  234. local_addr = {INT bd;} 4 cost(2,3) "(" bd ",a6)" .
  235. regAcon = {A_REG reg; INT bd;} 4 cost(2,3) "(" bd "," reg ")" .
  236. regAregXcon = {A_REG reg; D_REG4 xreg; INT sc; INT bd;} 4 cost(2,7)
  237. "(" bd "," reg "," xreg ".l*" sc ")" .
  238. off_con = {A_REG reg; INT bd; ADDR od;} 4 cost(6,18)
  239. "([" bd "," reg "]," od ")".
  240. off_regXcon = {A_REG reg; D_REG4 xreg; INT sc; INT bd; ADDR od;} 4 cost(6,18)
  241. "([" bd "," reg "]," xreg ".l*" sc "," od ")" .
  242. indoff_con = {A_REG reg; D_REG4 xreg; INT sc; INT bd; ADDR od;} 4 cost(6,18)
  243. "([" bd "," reg "," xreg ".l*" sc "]," od ")" .
  244. abs_con = {ADDR bd; ADDR od;} 4 cost(8,21) "([" bd "]," od ")" .
  245. abs_regXcon = {INT sc; D_REG4 xreg; ADDR bd; ADDR od;} 4 cost(8,21)
  246. "([" bd "]," xreg ".l*" sc "," od ")" .
  247. absind_con = {INT sc; D_REG4 xreg; ADDR bd; ADDR od;} 4 cost(8,21)
  248. "([" bd "," xreg ".l*" sc "]," od ")" .
  249. ext_regX = {INT sc; D_REG4 xreg; ADDR bd;} 4 cost(6,15)
  250. "(" bd "," xreg ".l*" sc ")" .
  251. regX = {INT sc; D_REG4 xreg;} 4 cost(2,7) "(" xreg ".l*" sc ")" .
  252. DREG_pair = {D_REG4 reg1; D_REG4 reg2;} 8 cost(2,0) reg1 ":" reg2 .
  253. #define t_regAregXcon regAregXcon
  254. #define t_regAcon regAcon
  255. #endif TBL68020
  256. #if WORD_SIZE!=2
  257. #define DLOCAL LOCAL
  258. #endif
  259. SETS
  260. /* The SETS list cannot be kept as 'readable' as the TOKENS
  261. * list because cgg is one pass.
  262. * We makes use of the fact that sets are indeed sets. Thus
  263. * D_REG + D_REG4 == D_REG, when the wordsize is 4.
  264. */
  265. sconsts = small_const + bconst .
  266. consts = const + sconsts + zero_const.
  267. #if WORD_SIZE!=2
  268. #define small_const4 small_const
  269. #define zero_const4 zero_const
  270. #define bconst4 bconst
  271. #define const4 const
  272. #define sconsts4 sconsts
  273. #define consts4 consts
  274. #else
  275. sconsts4 = small_const4 + bconst4 .
  276. consts4 = const4 + sconsts4 + zero_const4.
  277. #endif
  278. #ifndef TBL68020
  279. /* A m68k2/m68k4 part */
  280. data4 = D_REG4 + DLOCAL + consts4 + post_inc4 + pre_dec4 +
  281. indirect4 + offsetted4 + index_off4 + absolute4 +
  282. ext_addr + dreg4 .
  283. memory4 = data4 - D_REG4 - dreg4 .
  284. control4 = indirect4 + offsetted4 + index_off4 + absolute4 +
  285. DLOCAL.
  286. alterable4 = data4 + A_REG - consts4 - ext_addr .
  287. any4 = data4 + A_REG . /* all four above together */
  288. #if WORD_SIZE==2
  289. data2 = D_REG + LOCAL + dreg2 + post_inc2 + pre_dec2 +
  290. indirect2 + offsetted2 + index_off2 + absolute2 +
  291. consts .
  292. memory2 = data2 - D_REG - dreg2 .
  293. control2 = indirect2 + offsetted2 + index_off2 + absolute2 + LOCAL.
  294. #else
  295. data2 = dreg2 + post_inc2 + pre_dec2 + indirect2 +
  296. offsetted2 + index_off2 + absolute2 + consts .
  297. memory2 = data2 - dreg2 .
  298. control2 = indirect2 + offsetted2 + index_off2 + absolute2 .
  299. #endif
  300. alterable2 = data2 + D_REG - consts .
  301. any2 = data2 + D_REG .
  302. data1 = dreg1 + post_inc1 + pre_dec1 + indirect1 +
  303. offsetted1 + index_off1 + absolute1 + consts .
  304. memory1 = data1 - dreg1 .
  305. control1 = indirect1 + offsetted1 + index_off1 + absolute1 .
  306. alterable1 = data1 + D_REG - consts .
  307. any1 = data1 + D_REG .
  308. #else TBL68020
  309. data4 = D_REG4 + indirect4 + post_inc4 + pre_dec4 + index_off4 +
  310. offsetted4 + OFF_off4 + OFF_indoff4 +
  311. INDOFF_off4 + dreg4 +
  312. ABS_off4 + ABS_indoff4 + ABSIND_off4 +
  313. absolute4 + abs_index4 + consts4 + ext_addr +
  314. DLOCAL
  315. #if WORD_SIZE!=2
  316. + ILOCAL
  317. #endif
  318. .
  319. memory4 = data4 - D_REG4 - dreg4 .
  320. control4 = memory4 - (post_inc4 + pre_dec4 + consts4 + ext_addr).
  321. alterable4 = data4 + A_REG - consts - ext_addr .
  322. any4 = data4 + A_REG . /* all four above together */
  323. #if WORD_SIZE==2
  324. data2 = D_REG + LOCAL+ ILOCAL+
  325. dreg2 + indirect2 + post_inc2 + pre_dec2 + index_off2 +
  326. offsetted2 + OFF_off2 + OFF_indoff2 +
  327. INDOFF_off2 +
  328. ABS_off2 + ABS_indoff2 + ABSIND_off2 +
  329. absolute2 + abs_index2 + consts .
  330. memory2 = data2 - D_REG - dreg2 .
  331. #else
  332. data2 = dreg2 + indirect2 + post_inc2 + pre_dec2 + index_off2 +
  333. offsetted2 + OFF_off2 + OFF_indoff2 +
  334. INDOFF_off2 +
  335. ABS_off2 + ABS_indoff2 + ABSIND_off2 +
  336. absolute2 + abs_index2 + consts .
  337. memory2 = data2 - dreg2 .
  338. #endif
  339. control2 = memory2 - (post_inc2 + pre_dec2 + consts ) .
  340. alterable2 = data2 + D_REG - consts .
  341. any2 = data2 + D_REG. /* all four above together */
  342. data1 = dreg1 + indirect1 + post_inc1 + pre_dec1 + index_off1 +
  343. offsetted1 + OFF_off1 + OFF_indoff1 +
  344. INDOFF_off1 +
  345. ABS_off1 + ABS_indoff1 + ABSIND_off1 +
  346. absolute1 + abs_index1 + consts .
  347. memory1 = data1 - dreg1 .
  348. control1 = memory1 - (post_inc1 + pre_dec1 + consts ) .
  349. alterable1 = data1 + D_REG - consts .
  350. any1 = data1 + D_REG. /* all four above together */
  351. #endif TBL68020
  352. /* This is a common part */
  353. #if WORD_SIZE==2
  354. any = any2 + any1 .
  355. /* absolute = absolute2 + absolute1 . */
  356. control = control2 + control1 .
  357. indirect = indirect2 + indirect1 .
  358. pre_post = pre_dec2 + pre_dec1 +
  359. post_inc2 + post_inc1 .
  360. offsetted = offsetted2 + offsetted1 .
  361. index_off = index_off2 + index_off1 .
  362. #else
  363. any = any4 + any2 + any1 .
  364. /* absolute = absolute4 + absolute2 + absolute1 . */
  365. control = control4 + control2 + control1 .
  366. indirect = indirect4 + indirect2 + indirect1 .
  367. pre_post = pre_dec4 + pre_dec2 + pre_dec1 +
  368. post_inc4 + post_inc2 + post_inc1 .
  369. offsetted = offsetted4 + offsetted2 + offsetted1 .
  370. index_off = index_off4 + index_off2 + index_off1 .
  371. #endif
  372. absolute = absolute4 + absolute2 + absolute1 .
  373. #ifndef TBL68020
  374. /* A m68k2/m68k4 part */
  375. regind_addr = regAcon + regAregXcon + t_regAcon + t_regAregXcon .
  376. address = ext_addr + local_addr + regAcon + regAregXcon .
  377. all_regind = indirect + offsetted + pre_post + index_off +
  378. regind_addr + areg .
  379. all_indir = all_regind .
  380. allexceptcon = ALL - ( D_REG + A_REG + consts + dreg2 + dreg1 +
  381. local_addr + ext_addr + regAcon + regAregXcon +
  382. t_regAcon + t_regAregXcon ) .
  383. use_index = index_off4 + index_off2 + index_off1 .
  384. #else TBL68020
  385. reg_memind4 = OFF_off4 + OFF_indoff4 + INDOFF_off4 .
  386. memind4 = reg_memind4 +
  387. ABS_off4 + ABS_indoff4 .
  388. reg_memind2 = OFF_off2 + OFF_indoff2 + INDOFF_off2 .
  389. memind2 = reg_memind2 +
  390. ABS_off2 + ABS_indoff2 .
  391. reg_memind1 = OFF_off1 + OFF_indoff1 + INDOFF_off1 .
  392. memind1 = reg_memind1 +
  393. ABS_off1 + ABS_indoff1 .
  394. reg_memind = reg_memind4 + reg_memind2 + reg_memind1 .
  395. memind = memind4 + memind2 + memind1 .
  396. regind_addr = regAcon + regAregXcon +
  397. off_con + off_regXcon +
  398. indoff_con .
  399. address = regind_addr +
  400. ext_addr + local_addr +
  401. abs_con + abs_regXcon +
  402. absind_con +
  403. ext_regX .
  404. all_regind = indirect + offsetted + index_off + pre_post +
  405. reg_memind + regind_addr + areg .
  406. all_indir = all_regind + memind + ILOCAL .
  407. allexceptcon = ALL - ( D_REG + A_REG + consts + dreg2 + dreg1 +
  408. local_addr + ext_addr + regAcon + regAregXcon + ext_regX ) .
  409. use_index4 = index_off4 + abs_index4 +
  410. OFF_indoff4 + INDOFF_off4 +
  411. ABS_indoff4 + ABSIND_off4 .
  412. use_index2 = index_off2 + abs_index2 +
  413. OFF_indoff2 + INDOFF_off2 +
  414. ABS_indoff2 + ABSIND_off2 .
  415. use_index1 = index_off1 + abs_index1 +
  416. OFF_indoff1 + INDOFF_off1 +
  417. ABS_indoff1 + ABSIND_off1 .
  418. use_indaddr = regAregXcon +
  419. off_regXcon + indoff_con +
  420. abs_regXcon + absind_con +
  421. ext_regX .
  422. use_index = use_index4 + use_index2 + use_index1 + use_indaddr + regX .
  423. #endif TBL68020
  424. /* A common part */
  425. posextern = absolute + all_indir .
  426. #if WORD_SIZE==2
  427. genreg2 = D_REG .
  428. #define genreg genreg2
  429. #else
  430. #define genreg genreg4
  431. #endif
  432. genreg4 = D_REG4 + A_REG.
  433. label = llabel + slabel .
  434. immediate4 = consts4 + ext_addr .
  435. #if WORD_SIZE==2
  436. immediate2 = consts .
  437. #endif
  438. conreg4 = D_REG4 + immediate4 .
  439. conreg2 = dreg2 + consts + D_REG .
  440. conreg1 = dreg1 + consts + D_REG .
  441. #if WORD_SIZE==2
  442. conreg = conreg1 + conreg2 .
  443. #else
  444. conreg = conreg1 + conreg2 + conreg4 .
  445. #endif
  446. shconreg = D_REG + small_const .
  447. datalt4 = data4 * alterable4 .
  448. datalt2 = data2 * alterable2 .
  449. datalt1 = data1 * alterable1 .
  450. datalt = datalt4 + datalt2 + datalt1 .
  451. memalt4 = memory4 * alterable4 .
  452. memalt2 = memory2 * alterable2 .
  453. memalt1 = memory1 * alterable1 .
  454. #ifndef TBL68020
  455. /* A m68k2/m68k4 part */
  456. imm_cmp4 = alterable4 - A_REG .
  457. imm_cmp2 = alterable2 + D_REG .
  458. imm_cmp1 = datalt1 + D_REG .
  459. test_set4 = datalt4 + extend2 + extend1_4 .
  460. #if WORD_SIZE==2
  461. test_set2 = datalt2 + extend1 .
  462. #else
  463. test_set2 = datalt2 .
  464. #endif
  465. test_set1 = datalt1 .
  466. #else TBL68020
  467. imm_cmp4 = any4 - immediate4 - A_REG .
  468. imm_cmp2 = any2 - consts .
  469. imm_cmp1 = any1 - consts .
  470. test_set4 = any4 - immediate4 + extend2 + extend1_4 .
  471. #if WORD_SIZE==2
  472. test_set2 = data2 + extend1 - immediate2 .
  473. #else
  474. test_set2 = data2 - consts .
  475. #endif
  476. test_set1 = data1 - consts .
  477. #endif TBL68020
  478. test_set = test_set4 + test_set2 + test_set1 .
  479. #ifndef TBL68020
  480. t_address = address + t_regAregXcon + t_regAcon .
  481. #else TBL68020
  482. #define t_address address
  483. #endif TBL68020
  484. #if TBL68881
  485. freg = FD_REG + FS_REG .
  486. store4 = any4 + FS_REG .
  487. #else
  488. store4 = any4 .
  489. #endif
  490. #if WORD_SIZE==2
  491. dups2 = genreg2 .
  492. #endif
  493. dups4 = genreg4 .
  494. #include "instrmacs.h"
  495. INSTRUCTIONS
  496. /* Since the 68000 , the 68010 and the 68020 instruction sets are rather
  497. * extensive, especially because e.g. 'add.l' and 'add.w' are
  498. * considered different instructions, only those instructions are
  499. * listed here that are used in the rest of this table.
  500. *
  501. * Instruction timing cost cannot be accurately given, nor the timing
  502. * cost for getting operands. Detailed information about this can be
  503. * found in the "MC68020 User's Manual", section 9, about instruction
  504. * timing. The cost used in this table are 'worst case' cost, as
  505. * mentioned in section 9 of the user's manual. Furthermore, the
  506. * timing information for the 68k[24] and the 68020 differ, which
  507. * means that the 68k[24] will not always have the best code
  508. * possible.
  509. *
  510. * The first few instructions had to be added because register
  511. * variables are used. The LOCALs below are register variables.
  512. * One may not conclude that these operations are also allowed
  513. * on LOCALs that are not register variables.
  514. * The cost have been adapted, but are not accurate; when 'real'
  515. * LOCALs are used the cost are very inaccurate.
  516. */
  517. add_i ADD_I any_int:ro, LOCAL:rw:cc cost(0,0).
  518. sub_i SUB_I any_int:ro, LOCAL:rw:cc cost(0,0).
  519. lea address:ro, DLOCAL:wo cost(0,0).
  520. sh "illegal" shconreg+LOCAL:ro, LOCAL:rw:cc cost(0,0).
  521. xxx "illegal" data4:ro, LOCAL:rw:cc cost(0,0).
  522. xxx "illegal" LOCAL:ro, alterable4:rw:cc cost(0,0).
  523. #if WORD_SIZE==2
  524. /* divs_w "divs.w" data2:ro, LOCAL:rw:cc cost(0,56). */
  525. /* divu_w "divu.w" data2:ro, LOCAL:rw:cc cost(0,44). */
  526. muls_w "muls.w" data2:ro, LOCAL:rw:cc cost(0,28).
  527. mulu_w "mulu.w" data2:ro, LOCAL:rw:cc cost(0,28).
  528. #endif
  529. #if TBL68020 && WORD_SIZE!=2
  530. divs_l "divs.l" data4:ro, LOCAL:rw:cc cost(0,90).
  531. divu_l "divu.l" data4:ro, LOCAL:rw:cc cost(0,78).
  532. muls_l "muls.l" data4:ro, LOCAL:rw:cc cost(0,44).
  533. mulu_l "mulu.l" data4:ro, LOCAL:rw:cc cost(0,44).
  534. #endif TBL68020
  535. #if WORD_SIZE==2
  536. add_l "add.l" any4:ro, D_REG4:rw:cc cost(2,3).
  537. #else
  538. add_l "add.l" any4:ro, D_REG+LOCAL:rw:cc cost(2,3).
  539. #endif
  540. add_l "add.l" any4:ro, A_REG+DLOCAL+areg:rw cost(2,3).
  541. add_l "add.l" conreg4:ro, alterable4:rw:cc cost(2,6).
  542. #if WORD_SIZE==2
  543. add_w "add.w" any2:ro, D_REG+LOCAL:rw:cc cost(2,3).
  544. add_w "add.w" conreg2:ro, alterable2:rw:cc cost(2,6).
  545. #endif
  546. and_l "and.l" data4:ro, D_REG4:rw:cc cost(2,3).
  547. and_l "and.l" D_REG4:ro, memalt4:rw:cc cost(2,6).
  548. and_l "and.l" consts4:ro, datalt4:rw:cc cost(2,6).
  549. #if WORD_SIZE==2
  550. and_w "and.w" data2:ro, D_REG:rw:cc cost(2,3).
  551. and_w "and.w" D_REG:ro, memalt2:rw:cc cost(2,6).
  552. and_w "and.w" consts:ro, datalt2:rw:cc cost(2,6).
  553. #endif
  554. asl_l "asl.l" shconreg:ro, D_REG4:rw:cc cost(2,5).
  555. asl "asl #1," memalt2:rw:cc cost(2,4).
  556. asr_l "asr.l" shconreg:ro, D_REG4:rw:cc cost(2,4).
  557. asr "asr #1," memalt2:rw:cc cost(2,4).
  558. #if WORD_SIZE==2
  559. asl_w "asl.w" shconreg:ro, D_REG:rw:cc cost(2,5).
  560. asr_w "asr.w" shconreg:ro, D_REG:rw:cc cost(2,4).
  561. #endif
  562. bclr const:ro, D_REG:rw kills:cc cost(2,4).
  563. bra label cost(2,5).
  564. bcc label cost(2,5).
  565. bcs label cost(2,5).
  566. beq label cost(2,5).
  567. bge label cost(2,5).
  568. bgt label cost(2,5).
  569. bhi label cost(2,5).
  570. ble label cost(2,5).
  571. bls label cost(2,5).
  572. blt label cost(2,5).
  573. bmi label cost(2,5).
  574. bne label cost(2,5).
  575. bpl label cost(2,5).
  576. bvc label cost(2,5).
  577. bvs label cost(2,5).
  578. bset conreg2:ro, D_REG+D_REG4:rw kills :cc cost(2,4).
  579. btst conreg2:ro, any1:rw kills :cc cost(2,3).
  580. /* Check dreg[21] for m68020 and m68k2 */
  581. clr_l "clr.l" D_REG4+dreg4:wo:cc cost(2,3).
  582. clr_l "clr.l" memalt4:wo:cc cost(2,6).
  583. clr_w "clr.w" D_REG+dreg2:wo:cc cost(2,2).
  584. clr_w "clr.w" memalt2:wo:cc cost(2,4).
  585. clr_b "clr.b" D_REG+dreg1:wo:cc cost(2,2).
  586. clr_b "clr.b" memalt1:wo:cc cost(2,4).
  587. cmp_l "cmp.l" any4:ro, genreg4:ro kills :cc cost(2,3).
  588. cmp_l "cmp.l" post_inc4:ro, post_inc4:ro kills :cc cost(2,2).
  589. cmp_l "cmp.l" immediate4:ro, imm_cmp4:ro kills :cc cost(2,2).
  590. #if WORD_SIZE==2
  591. cmp_w "cmp.w" any2+extend2:ro, D_REG+dreg2+extend2:ro kills :cc cost(2,2).
  592. #else
  593. cmp_w "cmp.w" any2+extend2:ro, dreg2+extend2:ro kills :cc cost(2,2).
  594. #endif
  595. cmp_w "cmp.w" post_inc2:ro, post_inc2:ro kills :cc cost(2,2).
  596. cmp_w "cmp.w" consts:ro, imm_cmp2:ro kills :cc cost(2,2).
  597. cmp_b "cmp.b" any1+extend1+extend1_4:ro, dreg1+extend1+extend1_4:ro kills :cc cost(2,3).
  598. cmp_b "cmp.b" post_inc1:ro, post_inc1:ro kills :cc cost(2,2).
  599. cmp_b "cmp.b" consts:ro, imm_cmp1:ro kills :cc cost(2,2).
  600. dbf D_REG4:rw, label cost(2,5).
  601. eor_l "eor.l" conreg4:ro, datalt4:rw:cc cost(2,6).
  602. #if WORD_SIZE==2
  603. eor_w "eor.w" conreg2:ro, datalt2:rw:cc cost(2,4).
  604. #endif
  605. /* in the next two instructions: LOCAL only allowed if register var */
  606. ext_l "ext.l" D_REG+LOCAL+D_REG4:rw:cc cost(2,2).
  607. ext_w "ext.w" D_REG+LOCAL+D_REG4:rw:cc cost(2,2).
  608. jmp address+control4 cost(2,0).
  609. jsr address+control4 kills :cc d0 d1 d2 a0 a1 cost(2,3).
  610. lea address+control4:ro, A_REG+areg:wo cost(2,0).
  611. /*
  612. lsl_l "lsl.l" shconreg:ro, D_REG:rw:cc cost(2,4).
  613. lsl "lsl #1," memalt2:rw:cc cost(2,4).
  614. */
  615. lsr_l "lsr.l" shconreg:ro, D_REG4:rw:cc cost(2,4).
  616. #if WORD_SIZE==2
  617. lsr_w "lsr.w" shconreg:ro, D_REG:rw:cc cost(2,4).
  618. #endif
  619. lsr "lsr #1," memalt2:rw:cc cost(2,4).
  620. /* move_l does not set the condition codes if the destination is an
  621. address register!
  622. */
  623. move_l "move.l" any4:ro, A_REG+areg:wo cost(2,2).
  624. move_l "move.l" any4:ro, alterable4+dreg4-(areg+A_REG):wo:cc cost(2,2).
  625. #if WORD_SIZE==2
  626. move_l "move.l" sconsts:ro, D_REG+dreg2:wo:cc cost(2,2).
  627. /*
  628. move_l "move.l" any2:ro, alterable4+dreg4-(areg+A_REG):wo:cc cost(2,2).
  629. */
  630. move_w "move.w" any2:ro, alterable2+dreg2:wo:cc cost(2,2).
  631. move_b "move.b" any1:ro, alterable1+dreg2:wo:cc cost(2,2).
  632. #else
  633. move_w "move.w" any2:ro, alterable2+dreg4:wo:cc cost(2,2).
  634. move_b "move.b" any1:ro, alterable1+dreg4:wo:cc cost(2,2).
  635. #endif
  636. neg_b "neg.b" D_REG:rw:cc cost(2,3).
  637. neg_w "neg.w" D_REG:rw:cc cost(2,3).
  638. neg_l "neg.l" D_REG4:rw:cc cost(2,3).
  639. neg_l "neg.l" memory4:rw:cc cost(2,6).
  640. #if WORD_SIZE==2
  641. neg_w "neg.w" memory2:rw:cc cost(2,6).
  642. #endif
  643. not_l "not.l" D_REG4:rw:cc cost(2,3).
  644. not_l "not.l" memory4:rw:cc cost(2,6).
  645. #if WORD_SIZE==2
  646. not_w "not.w" D_REG:rw:cc cost(2,3).
  647. not_w "not.w" memory2:rw:cc cost(2,6).
  648. #endif
  649. or_l "or.l" data4:ro, D_REG4:rw:cc cost(2,3).
  650. or_l "or.l" D_REG4:ro, memalt4:rw:cc cost(2,6).
  651. or_l "or.l" consts4:ro, datalt4:rw:cc cost(2,6).
  652. #if WORD_SIZE==2
  653. or_w "or.w" data2:ro, D_REG:rw:cc cost(2,3).
  654. or_w "or.w" D_REG:ro, memalt2:rw:cc cost(2,6).
  655. or_w "or.w" consts:ro, datalt2:rw:cc cost(2,6).
  656. #endif
  657. rol_l "rol.l" shconreg:ro, D_REG4:rw:cc cost(2,4).
  658. rol "rol #1," memalt2:rw:cc cost(2,4).
  659. ror_l "ror.l" shconreg:ro, D_REG4:rw:cc cost(2,4).
  660. ror "ror #1," memalt2:rw:cc cost(2,4).
  661. #if WORD_SIZE==2
  662. rol_w "rol.w" shconreg:ro, D_REG:rw:cc cost(2,4).
  663. ror_w "ror.w" shconreg:ro, D_REG:rw:cc cost(2,4).
  664. #endif
  665. roxl "roxl #1," memalt2:rw:cc cost(2,4).
  666. roxr "roxr #1," memalt2:rw:cc cost(2,4).
  667. sne datalt1:rw cost(2,3).
  668. sub_l "sub.l" any4:ro, D_REG4:rw:cc cost(2,3).
  669. sub_l "sub.l" any4+areg:ro, A_REG+areg:rw cost(2,3).
  670. sub_l "sub.l" conreg4:ro, alterable4:rw:cc cost(2,6).
  671. #if WORD_SIZE==2
  672. sub_w "sub.w" any2:ro, D_REG+LOCAL:rw:cc cost(2,3).
  673. sub_w "sub.w" conreg2:ro, alterable2:rw:cc cost(2,6).
  674. /* On a swap, we only want the lower part of D_REG, so don't set cc */
  675. swap D_REG:rw kills :cc cost(2,2).
  676. #endif
  677. tst_l "tst.l" test_set4:ro:cc cost(2,3).
  678. tst_w "tst.w" test_set2+extend2:ro:cc cost(2,3).
  679. tst_b "tst.b" test_set1+extend1+extend1_4:ro:cc cost(2,3).
  680. unlk A_REG cost(2,6).
  681. bxx "illegal" label cost(2,5).
  682. sxx "illegal" any_int:wo cost(2,5).
  683. #if WORD_SIZE==2
  684. s4xx "illegal" any4:wo cost(2,5).
  685. xxx "illegal" any4+any2:ro, any4+any2:rw:cc cost(2,3).
  686. bit "illegal" control4+control2:rw:cc cost(2,6).
  687. #else
  688. xxx "illegal" any4:ro, any4:rw:cc cost(2,3).
  689. bit "illegal" control4:rw:cc cost(2,6).
  690. #endif
  691. sh "illegal" shconreg:ro, D_REG:rw:cc cost(2,4).
  692. shw "illegal" control2:rw:cc cost(2,4).
  693. #if WORD_SIZE==2
  694. divs_w "divs.w" data2:ro, D_REG:rw:cc cost(0,56).
  695. divu_w "divu.w" data2:ro, D_REG:rw:cc cost(0,44).
  696. muls_w "muls.w" data2:ro, D_REG:rw:cc cost(0,28).
  697. mulu_w "mulu.w" data2:ro, D_REG:rw:cc cost(0,28).
  698. #endif
  699. #ifdef TBL68020
  700. cmp2_l "cmp2.l" address+control4:ro, genreg4:ro kills :cc cost(2,18).
  701. divs_l "divs.l" data4:ro, D_REG4:rw:cc cost(2,90).
  702. divu_l "divu.l" data4:ro, D_REG4:rw:cc cost(2,78).
  703. divsl_l "divsl.l" data4:ro, DREG_pair:rw kills :cc cost(2,90).
  704. divul_l "divul.l" data4:ro, DREG_pair:rw kills :cc cost(2,78).
  705. pea address+control4+regX cost(2,4).
  706. #if WORD_SIZE==2
  707. cmp2_w "cmp2.w" address+control2:ro, genreg2:ro kills :cc cost(2,18).
  708. extb_l "extb.l" extend1_4+D_REG4:rw:cc cost(2,4).
  709. muls_l "muls.l" data4:ro, D_REG4:rw:cc cost(2,44).
  710. mulu_l "mulu.l" data4:ro, D_REG4:rw:cc cost(2,44).
  711. #else
  712. /* in the next instruction: LOCAL only allowed if register var */
  713. extb_l "extb.l" extend1_4+D_REG+LOCAL:rw:cc cost(2,4).
  714. muls_l "muls.l" data4:ro, D_REG+LOCAL:rw:cc cost(2,44).
  715. mulu_l "mulu.l" data4:ro, D_REG+LOCAL:rw:cc cost(2,44).
  716. #endif
  717. #else TBL68020
  718. pea address+control4 cost(2,4).
  719. #endif TBL68020
  720. /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  721. * Extra pseudo instruction; it just kills a D_REG;
  722. * it is necessary with long divides where remainders are important;
  723. * see also: 'pat rmi' and 'pat rmu'
  724. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
  725. killreg "! kill" D_REG+D_REG4+A_REG:wo cost(0,0).
  726. killcc "! killcc" kills :cc cost(0,0).
  727. #if TBL68881
  728. /* These descriptions are not very accurate, because we have no
  729. other 8-byte objects in the table.
  730. */
  731. fmove_s "fmove.s" data4:ro, freg:wo cost(4,100).
  732. fmove_s "fmove.s" freg:ro, data4:wo cost(4,100).
  733. fmove_d "fmove.d" freg:ro, data4:wo cost(4,100).
  734. fmove_d "fmove.d" data4:ro, freg:ro cost(4,100).
  735. fmove_l "fmove.l" freg:ro, D_REG:wo cost(4,100).
  736. fmove_l "fmove.l" data4:ro, freg:wo cost(4,100).
  737. fmove freg:ro,freg:wo cost(4,100).
  738. fadd_s "fadd.s" data4:ro, freg:rw cost(4,100).
  739. fadd_d "fadd.d" data4:ro, freg:rw cost(4,100).
  740. fsub_s "fsub.s" data4:ro, freg:rw cost(4,100).
  741. fsub_d "fsub.d" data4:ro, freg:rw cost(4,100).
  742. fsub freg:ro, freg:rw cost(4,100).
  743. fmul freg:ro, freg:rw cost(4,100).
  744. fmul_s "fmul.s" data4:ro, freg:rw cost(4,100).
  745. fmul_d "fmul.d" data4:ro, freg:rw cost(4,100).
  746. fdiv freg:ro, freg:rw cost(4,100).
  747. fdiv_s "fdiv.s" data4:ro, freg:rw cost(4,100).
  748. fdiv_d "fdiv.d" data4:ro, freg:rw cost(4,100).
  749. fcmp freg:ro, freg:ro cost(4,100).
  750. fbeq label:ro cost(4,4).
  751. fblt label:ro cost(4,4).
  752. fmovecr const:ro, freg:rw cost(4,100).
  753. fabs freg:rw cost(4,100).
  754. fneg freg:rw cost(4,100).
  755. fgetman freg:rw cost(4,100).
  756. fintrz freg:ro, freg:wo cost(4,100).
  757. fgetexp freg:ro, freg:wo cost(4,100).
  758. fsub_l "fsub.l" const:ro, freg:rw cost(4,100).
  759. #endif
  760. MOVES
  761. from consts %num==0 to D_REG4+dreg4
  762. gen clr_l %2
  763. #if WORD_SIZE==2
  764. from zero_const4 %num==0 to A_REG+areg
  765. gen sub_l %2,%2
  766. from zero_const4 %num==0 to D_REG4+dreg4
  767. gen clr_l %2
  768. #endif
  769. from consts %num==0 to A_REG+areg
  770. gen sub_l %2,%2
  771. #if WORD_SIZE==2
  772. from consts %num==0 to D_REG+dreg2
  773. gen clr_w %2
  774. from sconsts to D_REG+dreg2
  775. gen move_l %1,%2 /* uses moveq */
  776. from consts to D_REG4+dreg4
  777. gen move_l {const4, %1.num},%2
  778. #endif
  779. #if WORD_SIZE==2
  780. from sconsts4+zero_const4 %num==0 to memalt4
  781. #else
  782. from consts %num==0 to memalt4
  783. #endif
  784. gen clr_l %2
  785. from consts %num==0 to memalt2
  786. gen clr_w %2
  787. from consts %num==0 to memalt1
  788. gen clr_b %2
  789. from consts to memalt1
  790. gen move_b {const, low8(%1.num)}, %2
  791. #if WORD_SIZE!=2
  792. from consts to memalt2
  793. gen move_w {const, low16(%1.num)}, %2
  794. #endif
  795. from regAcon %bd==0 to A_REG+areg
  796. gen move_l %1.reg, %2
  797. #ifndef TBL68020
  798. from t_regAregXcon sfit(%bd, 8) to A_REG+areg
  799. gen lea {regAregXcon, %1.reg, %1.xreg, 1, %1.bd}, %2
  800. from t_regAregXcon to A_REG+areg
  801. gen lea {regAregXcon, %1.reg, %1.xreg, 1, 0}, %2
  802. add_l {const4, %1.bd}, %2
  803. from t_regAcon sfit(%bd, 16) to A_REG+areg
  804. gen lea {regAcon, %1.reg, %1.bd}, %2
  805. from t_regAcon to A_REG+areg
  806. gen move_l %1.reg, %2
  807. add_l {const4, %1.bd}, %2
  808. #endif TBL68020
  809. from address - ext_addr to A_REG+areg
  810. gen lea %1, %2
  811. #if WORD_SIZE==2
  812. from ext_addr to A_REG+areg
  813. gen lea {absolute4, %1.bd}, %2
  814. #endif
  815. from any4 to areg+A_REG
  816. gen move_l %1, %2
  817. from any4 to alterable4-(areg+A_REG)
  818. gen move_l %1, %2
  819. from any2 to alterable2
  820. gen move_w %1, %2
  821. from any1 to alterable1
  822. gen move_b %1, %2
  823. #if WORD_SIZE!=2
  824. from any4-sconsts4 to A_REG+areg
  825. gen move_l %1, %2
  826. from any2 to dreg4
  827. gen clr_l %2
  828. move_w %1, %2
  829. #endif
  830. from any1 to dreg_int
  831. gen clr_i %2
  832. move_b %1, %2
  833. #if WORD_SIZE==2
  834. from any1 to dreg2
  835. gen clr_w %2
  836. move_b %1, %2
  837. #endif
  838. #if TBL68881
  839. from data4 to FS_REG
  840. gen fmove_s %1, %2
  841. from FS_REG to datalt4
  842. gen fmove_s %1, %2
  843. #endif
  844. TESTS
  845. /* For the 68020 and m68k4, the extend1_4 will be extend1 */
  846. to test test_set4-(extend2+extend1+extend1_4)
  847. gen tst_l %1
  848. to test test_set2+extend2
  849. gen tst_w %1
  850. to test test_set1+extend1+extend1_4
  851. gen tst_b %1
  852. STACKINGRULES
  853. #if WORD_SIZE!=2
  854. from consts %num==0 to STACK
  855. gen clr_l {pre_dec4, sp}
  856. #else
  857. from zero_const4 to STACK
  858. gen clr_l {pre_dec4, sp}
  859. from consts %num==0 to STACK
  860. gen clr_w {pre_dec2, sp}
  861. #endif
  862. #ifndef TBL68020
  863. from t_regAregXcon sfit(%bd, 8) to STACK
  864. gen pea {regAregXcon, %1.reg, %1.xreg, 1, %1.bd}
  865. from t_regAregXcon to STACK
  866. gen pea {regAregXcon, %1.reg, %1.xreg, 1, 0}
  867. add_l {const4, %1.bd}, {indirect4, sp}
  868. from t_regAcon sfit(%bd, 16) to STACK
  869. gen pea {regAcon, %1.reg, %1.bd}
  870. from t_regAcon to STACK
  871. gen move_l %1.reg, {pre_dec4, sp}
  872. add_l {const4, %1.bd}, {indirect4, sp}
  873. #endif TBL68020
  874. from A_REG to STACK
  875. gen pea {indirect4, %1}
  876. from address - ext_addr to STACK
  877. gen pea %1
  878. from ext_addr to STACK
  879. gen pea {absolute4, %1.bd}
  880. #if WORD_SIZE!=2
  881. from consts to STACK
  882. gen pea {absolute4, %1.num}
  883. #else
  884. from sconsts4 to STACK
  885. gen pea {absolute4, %1.num}
  886. from const4 to STACK
  887. gen pea {absolute4, %1.num}
  888. #endif
  889. from any4 to STACK
  890. gen move_l %1, {pre_dec4, sp}
  891. #if WORD_SIZE!=2
  892. from any2 to STACK
  893. uses DD_REG
  894. gen clr_l %a
  895. move_w %1, {dreg2, %a}
  896. move_l %a, {pre_dec4, sp}
  897. from any2 to STACK
  898. gen clr_l {pre_dec4, sp}
  899. move_w %1, {offsetted2, sp, 2}
  900. #else
  901. from any2 to STACK
  902. gen move_w %1, {pre_dec2, sp}
  903. #endif
  904. from data1 to STACK
  905. uses DD_REG
  906. #if WORD_SIZE!=2
  907. gen clr_l %a
  908. move_b %1, {dreg1, %a}
  909. move_l %a, {pre_dec4, sp}
  910. #else
  911. gen clr_w %a
  912. move_b %1, {dreg1, %a}
  913. move_w %a, {pre_dec2, sp}
  914. #endif
  915. from data1 to STACK
  916. #if WORD_SIZE!=2
  917. gen clr_l {pre_dec4, sp}
  918. move_b %1, {offsetted1, sp, 3}
  919. #else
  920. gen clr_w {pre_dec2, sp}
  921. move_b %1, {offsetted1, sp, 1}
  922. #endif
  923. from extend2 to STACK
  924. gen ext_l %1.reg
  925. move_l %1.reg,{pre_dec4, sp}
  926. from extend1_4 to STACK
  927. #ifdef TBL68020
  928. gen extb_l %1.reg
  929. #else
  930. gen ext_w %1.reg
  931. ext_l %1.reg
  932. #endif
  933. move_l %1.reg,{pre_dec4, sp}
  934. #if WORD_SIZE==2
  935. from extend1 to STACK
  936. gen ext_w %1.reg
  937. move_w %1.reg,{pre_dec2, sp}
  938. #endif
  939. #ifdef TBL68020
  940. from regX to STACK
  941. gen pea %1
  942. #endif TBL68020
  943. /* This last stackingrule is never used: whenever regX is put on
  944. * the fakestack, some em-instuctions are left that remove it
  945. * immediately. However cgg complained about not having a
  946. * stackingrule for regX, so here it is
  947. */
  948. #if TBL68881
  949. from FS_REG to STACK
  950. gen fmove_s %1,{pre_dec4,sp}
  951. from FD_REG to STACK
  952. gen fmove_d %1,{pre_dec4,sp}
  953. #endif
  954. COERCIONS
  955. from STACK
  956. uses DD_REG4
  957. gen move_l {post_inc4, sp}, %a
  958. yields %a
  959. #if WORD_SIZE==2
  960. from STACK
  961. uses DD_REG
  962. gen move_w {post_inc2,sp}, %a
  963. yields %a
  964. #endif
  965. from STACK
  966. uses AA_REG
  967. gen move_l {post_inc4, sp}, %a
  968. yields %a
  969. #ifdef TBL68881
  970. from STACK
  971. uses FS_REG
  972. gen fmove_s {post_inc4, sp}, %a
  973. yields %a
  974. from STACK
  975. uses FD_REG
  976. gen fmove_d {post_inc4, sp}, %a
  977. yields %a
  978. #endif
  979. #ifndef TBL68020
  980. from t_regAregXcon sfit(%bd, 8)
  981. yields {regAregXcon, %1.reg, %1.xreg, 1, %1.bd}
  982. from t_regAregXcon
  983. uses AA_REG=%1.reg
  984. gen add_l {const4, %1.bd}, %a
  985. yields {regAregXcon, %a, %1.xreg, 1, 0}
  986. /*
  987. * The following coercions are necessary because the code generator
  988. * must be able to make the token from the real stack, otherwise the
  989. * coercion will not be made. Unfortunatly, inside a coercion, we are only
  990. * allowed to allocate 1 register, which means that there is no way to make
  991. * a regAregXcon from the stack, which, in its turn, means that the other
  992. * coercions will not be taken.
  993. *
  994. /*from STACK
  995. uses AA_REG, DD_REG4 = {zero_const4, 0}
  996. gen move_l {post_inc4, sp}, %a
  997. yields {regAregXcon, %a, %b, 1, 0}
  998. */
  999. from STACK
  1000. uses AA_REG
  1001. gen move_l {post_inc4, sp}, %a
  1002. yields {regAcon, %a, 0}
  1003. from t_regAcon sfit(%bd, 16)
  1004. yields {regAcon, %1.reg, %1.bd}
  1005. from t_regAcon
  1006. uses reusing %1, AA_REG=%1.reg
  1007. gen add_l {const4, %1.bd}, %a
  1008. yields %a
  1009. #endif TBL68020
  1010. #if WORD_SIZE==2
  1011. from regAregXcon %bd==0 && %sc==1
  1012. uses reusing %1, AA_REG = %1.reg
  1013. gen add_l {dreg4,%1.xreg},%a
  1014. yields %a
  1015. from regAregXcon %sc==1
  1016. uses reusing %1, AA_REG = %1.reg
  1017. gen add_l {dreg4, %1.xreg}, %a
  1018. yields {regAcon, %a, %1.bd}
  1019. #endif
  1020. #if WORD_SIZE==2
  1021. from sconsts
  1022. uses DD_REG4={const4, %1.num} /* uses moveq */
  1023. yields %a.1
  1024. #endif
  1025. #if WORD_SIZE==2
  1026. from any2
  1027. uses reusing %1, DD_REG = %1 yields %a
  1028. #endif
  1029. from any4
  1030. uses reusing %1, DD_REG4 = %1
  1031. yields %a
  1032. from any4
  1033. uses reusing %1, AA_REG = %1
  1034. yields %a
  1035. from t_address
  1036. uses reusing %1, AA_REG = %1
  1037. yields %a
  1038. #if TBL68881
  1039. from data4
  1040. uses reusing %1, FS_REG = %1
  1041. yields %a
  1042. #endif
  1043. from memory2
  1044. uses DD_REG
  1045. #if WORD_SIZE!=2
  1046. = {zero_const, 0}
  1047. #endif
  1048. gen move_w %1, %a yields %a
  1049. from memory1
  1050. uses DD_REG = {zero_const, 0}
  1051. gen move_b %1, %a yields %a
  1052. from memory2
  1053. uses DD_REG
  1054. gen move_w %1, %a yields {dreg2, %a}
  1055. from memory1
  1056. uses DD_REG
  1057. gen move_b %1, %a yields {dreg1, %a}
  1058. from extend2
  1059. gen ext_l %1.reg yields %1.reg
  1060. #if WORD_SIZE==2
  1061. from extend1
  1062. gen ext_w %1.reg yields %1.reg
  1063. #endif
  1064. from extend1_4
  1065. #ifdef TBL68020
  1066. gen extb_l %1.reg
  1067. #else
  1068. gen ext_w %1.reg
  1069. ext_l %1.reg
  1070. #endif
  1071. yields %1.reg
  1072. PATTERNS
  1073. /********************************
  1074. * First some longer patterns *
  1075. ********************************/
  1076. pat lol sbi stl $1==$3 && $2==WORD_SIZE && inreg($1)==reg_any
  1077. with any_int
  1078. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1079. gen sub_i %1, {LOCAL, $1}
  1080. neg_i {LOCAL, $1}
  1081. pat lol sbi stl $1==$3 && $2==WORD_SIZE && inreg($1)!=reg_pointer
  1082. with conreg_int-bconst
  1083. kills all_indir, LOCAL %bd==$1
  1084. gen sub_i %1, {LOCAL, $1}
  1085. neg_i {LOCAL, $1}
  1086. pat lol sbu stl $1==$3 && $2==WORD_SIZE
  1087. leaving lol $1 sbi WORD_SIZE stl $1
  1088. pat lil sbi sil $1==$3 && $2==WORD_SIZE && inreg($1)==reg_pointer
  1089. with conreg_int-bconst
  1090. kills allexceptcon
  1091. gen sub_i %1, {indirect_int, regvar($1, reg_pointer)}
  1092. neg_i {indirect_int, regvar($1, reg_pointer)}
  1093. pat lil sbi sil $1==$3 && $2==WORD_SIZE && inreg($1)!=reg_any
  1094. with conreg_int-bconst
  1095. kills allexceptcon
  1096. uses AA_REG = {DLOCAL, $1}
  1097. gen sub_i %1, {indirect_int, %a}
  1098. neg_i {indirect_int, %a}
  1099. pat lil sbu sil $1==$3 && $2==WORD_SIZE
  1100. leaving lil $1 sbi WORD_SIZE sil $1
  1101. proc lolrbitstl example lol ngi stl
  1102. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1103. gen bit* {LOCAL, $1}
  1104. pat lol ngi stl $1==$3 && $2==WORD_SIZE && inreg($1)==reg_any
  1105. call lolrbitstl(NEG_I)
  1106. pat lol com stl $1==$3 && $2==WORD_SIZE && inreg($1)==reg_any
  1107. call lolrbitstl(NOT_I)
  1108. proc lolbitstl example lol ngi stl
  1109. kills all_indir, LOCAL %bd==$1
  1110. gen bit* {LOCAL, $1}
  1111. pat lol ngi stl $1==$3 && $2==WORD_SIZE call lolbitstl(NEG_I)
  1112. pat lol com stl $1==$3 && $2==WORD_SIZE call lolbitstl(NOT_I)
  1113. #if WORD_SIZE==2
  1114. proc ldlbitsdl example ldl ngi sdl
  1115. kills all_indir, DLOCAL %bd==$1
  1116. gen bit* {DLOCAL, $1}
  1117. pat ldl ngi sdl $1==$3 && $2==4 call ldlbitsdl("neg.l")
  1118. pat ldl com sdl $1==$3 && $2==4 call ldlbitsdl("not.l")
  1119. #endif
  1120. proc loebitste example loe ngi ste
  1121. kills posextern
  1122. gen bit* {absolute_int, $1}
  1123. pat loe ngi ste $1==$3 && $2==WORD_SIZE call loebitste(NEG_I)
  1124. pat loe com ste $1==$3 && $2==WORD_SIZE call loebitste(NOT_I)
  1125. #if WORD_SIZE==2
  1126. proc ldebitsde example lde ngi sde
  1127. kills posextern
  1128. gen bit* {absolute4, $1}
  1129. pat lde ngi sde $1==$3 && $2==4 call ldebitsde("neg.l")
  1130. pat lde com sde $1==$3 && $2==4 call ldebitsde("not.l")
  1131. #endif
  1132. proc lilrbitsil example lil ngi sil
  1133. kills allexceptcon
  1134. gen bit* {indirect_int, regvar($1, reg_pointer)}
  1135. pat lil ngi sil $1==$3 && $2==WORD_SIZE && inreg($1)==reg_pointer
  1136. call lilrbitsil(NEG_I)
  1137. pat lil com sil $1==$3 && $2==WORD_SIZE && inreg($1)==reg_pointer
  1138. call lilrbitsil(NOT_I)
  1139. pat lil dec sil $1==$3 && inreg($1)==reg_pointer
  1140. call lilrbitsil(DEC)
  1141. pat lil inc sil $1==$3 && inreg($1)==reg_pointer
  1142. call lilrbitsil(INC)
  1143. proc lilbitsil example lil ngi sil
  1144. kills allexceptcon
  1145. #if TBL68020
  1146. gen bit* {ILOCAL, $1}
  1147. #else
  1148. uses AA_REG = {DLOCAL, $1}
  1149. gen bit* {indirect_int, %a}
  1150. #endif
  1151. pat lil ngi sil $1==$3 && $2==WORD_SIZE && inreg($1)!=reg_any
  1152. call lilbitsil(NEG_I)
  1153. pat lil com sil $1==$3 && $2==WORD_SIZE && inreg($1)!=reg_any
  1154. call lilbitsil(NOT_I)
  1155. pat lil dec sil $1==$3 && inreg($1)!=reg_any
  1156. call lilbitsil(DEC)
  1157. pat lil inc sil $1==$3 && inreg($1)!=reg_any
  1158. call lilbitsil(INC)
  1159. proc lolcshstl example lol loc sli stl
  1160. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1161. gen sh* {small_const, $2}, {LOCAL, $1}
  1162. pat lol loc sli stl $1==$4 && small($2) && $3==WORD_SIZE && inreg($1)==reg_any
  1163. call lolcshstl(ASL_I)
  1164. pat lol loc sri stl $1==$4 && small($2) && $3==WORD_SIZE && inreg($1)==reg_any
  1165. call lolcshstl(ASR_I)
  1166. pat lol loc slu stl $1==$4 && small($2) && $3==WORD_SIZE && inreg($1)==reg_any
  1167. call lolcshstl(ASL_I)
  1168. pat lol loc sru stl $1==$4 && small($2) && $3==WORD_SIZE && inreg($1)==reg_any
  1169. call lolcshstl(LSR_I)
  1170. pat lol loc rol stl $1==$4 && small($2) && $3==WORD_SIZE && inreg($1)==reg_any
  1171. call lolcshstl(ROL_I)
  1172. pat lol loc ror stl $1==$4 && small($2) && $3==WORD_SIZE && inreg($1)==reg_any
  1173. call lolcshstl(ROR_I)
  1174. proc lolrshstl example lol lol sli stl
  1175. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1176. gen sh* {LOCAL, $2}, {LOCAL, $1}
  1177. pat lol lol sli stl $1==$4 && inreg($1)==reg_any && $3==WORD_SIZE
  1178. && inreg($2)==reg_any
  1179. call lolrshstl(ASL_I)
  1180. pat lol lol slu stl $1==$4 && inreg($1)==reg_any && $3==WORD_SIZE
  1181. && inreg($2)==reg_any
  1182. call lolrshstl(ASL_I)
  1183. pat lol lol sri stl $1==$4 && inreg($1)==reg_any && $3==WORD_SIZE
  1184. && inreg($2)==reg_any
  1185. call lolrshstl(ASR_I)
  1186. pat lol lol sru stl $1==$4 && inreg($1)==reg_any && $3==WORD_SIZE
  1187. && inreg($2)==reg_any
  1188. call lolrshstl(LSR_I)
  1189. pat lol lol rol stl $1==$4 && inreg($2)==reg_any && $3==WORD_SIZE
  1190. && inreg($1)==reg_any
  1191. call lolrshstl(ROL_I)
  1192. pat lol lol ror stl $1==$4 && inreg($2)==reg_any && $3==WORD_SIZE
  1193. && inreg($1)==reg_any
  1194. call lolrshstl(ROR_I)
  1195. #if WORD_SIZE!=2
  1196. proc lil1shlsil example lil loc sli sil /* only left */
  1197. kills allexceptcon
  1198. gen shw* {offsetted2, regvar($1, reg_pointer), 2}
  1199. roxl {indirect2, regvar($1, reg_pointer)}
  1200. pat lil loc sli sil $1==$4 && $2==1 && $3==WORD_SIZE && inreg($1)==reg_pointer
  1201. call lil1shlsil("asl #1,")
  1202. pat lil loc slu sil $1==$4 && $2==1 && $3==WORD_SIZE && inreg($1)==reg_pointer
  1203. call lil1shlsil("asl #1,")
  1204. proc lil1shrsil example lil loc sli sil /* only right */
  1205. kills allexceptcon
  1206. gen shw* {indirect2, regvar($1, reg_pointer)}
  1207. roxr {offsetted2, regvar($1, reg_pointer), 2}
  1208. pat lil loc sri sil $1==$4 && $2==1 && $3==WORD_SIZE && inreg($1)==reg_pointer
  1209. call lil1shrsil("asr #1,")
  1210. pat lil loc sru sil $1==$4 && $2==1 && $3==WORD_SIZE && inreg($1)==reg_pointer
  1211. call lil1shrsil("lsr #1,")
  1212. #endif
  1213. pat LLP lof inc LLP stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
  1214. kills allexceptcon
  1215. gen add_i {const, 1}, {offsetted_int, regvar($1, reg_pointer), $2}
  1216. pat LLP lof dec LLP stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
  1217. kills allexceptcon
  1218. gen sub_i {const, 1}, {offsetted_int, regvar($1, reg_pointer), $2}
  1219. /* the patterns with adp should use add_l */
  1220. pat LLP LFP adp LLP SFP $1==$4 && $2==$5 && inreg($1)==reg_pointer
  1221. kills allexceptcon
  1222. gen add_l {const4, $3}, {offsetted4, regvar($1, reg_pointer), $2}
  1223. pat LEP LFP adp LEP SFP $1==$4 && $2==$5
  1224. kills allexceptcon
  1225. #if TBL68020 && FANCY_MODES
  1226. gen add_l {const4, $3}, {ABS_off4, $1, $2}
  1227. #else
  1228. uses AA_REG={absolute4, $1}
  1229. gen add_l {const4, $3}, {offsetted4, %a, $2}
  1230. #endif
  1231. pat LEP loi adp LEP sti $1==$4 && $2==4 && $5==4
  1232. kills allexceptcon
  1233. #if TBL68020 && FANCY_MODES
  1234. gen add_l {const4, $3}, {ABS_off4, $1, 0}
  1235. #else
  1236. uses AA_REG={absolute4, $1}
  1237. gen add_l {const4, $3}, {indirect4, %a}
  1238. #endif
  1239. #if WORD_SIZE!=2
  1240. pat lil lof adp lil stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
  1241. kills allexceptcon
  1242. #if TBL68020 && FANCY_MODES
  1243. gen add_l {const4, $3}, {OFF_off4, regvar($1, reg_pointer), 0, $2}
  1244. #else
  1245. uses AA_REG={indirect4, regvar($1, reg_pointer)}
  1246. gen add_l {const4, $3}, {offsetted4, %a, $2}
  1247. #endif
  1248. pat lil loi adp lil sti $1==$4 && $2==4 && $5==4 && inreg($1)==reg_pointer
  1249. kills allexceptcon
  1250. #if TBL68020 && FANCY_MODES
  1251. gen add_l {const4, $3}, {OFF_off4, regvar($1, reg_pointer), 0, 0}
  1252. #else
  1253. uses AA_REG={indirect4, regvar($1, reg_pointer)}
  1254. gen add_l {const4, $3}, {indirect4, %a}
  1255. #endif
  1256. #endif /* WORD_SIZE==2 */
  1257. pat lol inl $1==$2 && inreg($1)==reg_any
  1258. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1259. uses DD_REG = {LOCAL, $1}
  1260. gen add_i {const, 1}, {LOCAL, $1}
  1261. killreg %a
  1262. yields %a
  1263. pat lol del $1==$2 && inreg($1)==reg_any
  1264. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1265. uses DD_REG = {LOCAL, $1}
  1266. gen sub_i {const, 1}, {LOCAL, $1}
  1267. killreg %a
  1268. yields %a
  1269. /* the following rules are for unsigneds, since del and inl work on ints */
  1270. pat lol loc lol adu stl $1==$3 && $3==$5 && $4==WORD_SIZE && inreg($1)==reg_any
  1271. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1272. uses DD_REG = {LOCAL, $1}
  1273. gen add_i {const, $2}, {LOCAL, $1}
  1274. killreg %a
  1275. yields %a
  1276. pat lol loc lol adu stl $1==$3 && $3==$5 && $4==WORD_SIZE
  1277. kills all_indir, LOCAL %bd==$1
  1278. uses DD_REG = {LOCAL, $1}
  1279. gen add_i {const, $2}, {LOCAL, $1}
  1280. killreg %a
  1281. yields %a
  1282. pat lol lol loc sbu stl $1==$2 && $2==$5 && $4==WORD_SIZE && inreg($1)==reg_any
  1283. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1284. uses DD_REG = {LOCAL, $1}
  1285. gen sub_i {const, $3}, {LOCAL, $1}
  1286. killreg %a
  1287. yields %a
  1288. pat lol lol loc sbu stl $1==$2 && $2==$5 && $4==WORD_SIZE
  1289. kills all_indir, LOCAL %bd==$1
  1290. uses DD_REG = {LOCAL, $1}
  1291. gen sub_i {const, $3}, {LOCAL, $1}
  1292. killreg %a
  1293. yields %a
  1294. pat loe loc loe adu ste $1==$3 && $3==$5 && $4==WORD_SIZE
  1295. kills posextern
  1296. uses DD_REG = {absolute_int, $1}
  1297. gen add_i {const,$2}, {absolute_int, $1}
  1298. killreg %a
  1299. yields %a
  1300. pat loe loe loc sbu ste $1==$2 && $2==$5 && $4==WORD_SIZE
  1301. kills posextern
  1302. uses DD_REG = {absolute_int, $1}
  1303. gen sub_i {const,$3}, {absolute_int, $1}
  1304. killreg %a
  1305. yields %a
  1306. pat lil loc lil adu sil $1==$3 && $3==$5 && $4==WORD_SIZE
  1307. && inreg($1)==reg_pointer
  1308. kills allexceptcon
  1309. uses DD_REG = {indirect_int, regvar($1, reg_pointer)}
  1310. gen add_i {const, $2}, {indirect_int, regvar($1, reg_pointer)}
  1311. killreg %a
  1312. yields %a
  1313. pat lil lil loc sbu sil $1==$2 && $2==$5 && $4==WORD_SIZE
  1314. && inreg($1)==reg_pointer
  1315. kills allexceptcon
  1316. uses DD_REG = {indirect_int, regvar($1, reg_pointer)}
  1317. gen sub_i {const, $3}, {indirect_int, regvar($1, reg_pointer)}
  1318. killreg %a
  1319. yields %a
  1320. proc lolxxstl example lol and stl
  1321. with data_int-bconst
  1322. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1323. gen xxx* %1, {LOCAL, $1}
  1324. pat lol adi stl $1==$3 && $2==WORD_SIZE && inreg($1)==reg_any
  1325. call lolxxstl(ADD_I)
  1326. pat lol adu stl $1==$3 && $2==WORD_SIZE && inreg($1)==reg_any
  1327. call lolxxstl(ADD_I)
  1328. pat lol and stl $1==$3 && $2==WORD_SIZE && inreg($1)==reg_any
  1329. call lolxxstl(AND_I)
  1330. pat lol ior stl $1==$3 && $2==WORD_SIZE && inreg($1)==reg_any
  1331. call lolxxstl(OR_I)
  1332. pat lol xor stl $1==$3 && $2==WORD_SIZE && inreg($1)==reg_any
  1333. with conreg_int-bconst
  1334. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1335. gen eor_i %1, {LOCAL, $1}
  1336. #if TBL68020 || WORD_SIZE==2
  1337. pat lol mli stl $1==$3 && $2==WORD_SIZE && inreg($1)==reg_any
  1338. with data_int
  1339. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1340. gen muls_i %1, {LOCAL, $1}
  1341. pat lol mlu stl $1==$3 && $2==WORD_SIZE && inreg($1)==reg_any
  1342. with data_int
  1343. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1344. gen mulu_i %1, {LOCAL, $1}
  1345. #endif TBL68020
  1346. proc lolxxxstl example lol adi stl
  1347. with conreg_int-bconst
  1348. kills all_indir, LOCAL %bd==$1
  1349. gen xxx* %1, {LOCAL, $1}
  1350. pat lol adi stl $1==$3 && $2==WORD_SIZE call lolxxxstl(ADD_I)
  1351. pat lol adu stl $1==$3 && $2==WORD_SIZE call lolxxxstl(ADD_I)
  1352. pat lol and stl $1==$3 && $2==WORD_SIZE && inreg($1)!=reg_pointer
  1353. call lolxxxstl(AND_I)
  1354. pat lol ior stl $1==$3 && $2==WORD_SIZE && inreg($1)!=reg_pointer
  1355. call lolxxxstl(OR_I)
  1356. pat lol xor stl $1==$3 && $2==WORD_SIZE && inreg($1)!=reg_pointer
  1357. call lolxxxstl(EOR_I)
  1358. #if WORD_SIZE==2
  1359. proc ldlxxxsdl example lol adi stl
  1360. with conreg4-bconst4
  1361. kills all_indir, DLOCAL %bd==$1
  1362. gen xxx* %1, {DLOCAL, $1}
  1363. pat ldl adi sdl $1==$3 && $2==4 call ldlxxxsdl("add.l")
  1364. pat ldl adu sdl $1==$3 && $2==4 call ldlxxxsdl("add.l")
  1365. pat ldl and sdl $1==$3 && $2==4 && inreg($1)!=reg_pointer
  1366. call ldlxxxsdl("and.l")
  1367. pat ldl ior sdl $1==$3 && $2==4 && inreg($1)!=reg_pointer
  1368. call ldlxxxsdl("or.l")
  1369. pat ldl xor sdl $1==$3 && $2==4 && inreg($1)!=reg_pointer
  1370. call ldlxxxsdl("eor.l")
  1371. #endif
  1372. proc lilxxsil example lil and sil
  1373. with conreg_int-bconst
  1374. kills allexceptcon
  1375. gen xxx* %1, {indirect_int, regvar($1, reg_pointer)}
  1376. pat lil adi sil $1==$3 && $2==WORD_SIZE && inreg($1)==reg_pointer
  1377. call lilxxsil(ADD_I)
  1378. pat lil adu sil $1==$3 && $2==WORD_SIZE && inreg($1)==reg_pointer
  1379. call lilxxsil(ADD_I)
  1380. pat lil and sil $1==$3 && $2==WORD_SIZE && inreg($1)==reg_pointer
  1381. call lilxxsil(AND_I)
  1382. pat lil ior sil $1==$3 && $2==WORD_SIZE && inreg($1)==reg_pointer
  1383. call lilxxsil(OR_I)
  1384. pat lil xor sil $1==$3 && $2==WORD_SIZE && inreg($1)==reg_pointer
  1385. call lilxxsil(EOR_I)
  1386. #if WORD_SIZE!=2
  1387. pat lil ads sil $1==$3 && $2==4 && inreg($1)==reg_pointer
  1388. call lilxxsil("add.l")
  1389. #endif
  1390. proc lilxxxsil example lil adi sil
  1391. with conreg_int-bconst
  1392. kills allexceptcon
  1393. #if TBL68020
  1394. gen xxx* %1, {ILOCAL, $1}
  1395. #else
  1396. uses AA_REG = {DLOCAL, $1}
  1397. gen xxx* %1, {indirect_int, %a}
  1398. #endif
  1399. pat lil adi sil $1==$3 && $2==WORD_SIZE && inreg($1)!=reg_any
  1400. call lilxxxsil(ADD_I)
  1401. pat lil adu sil $1==$3 && $2==WORD_SIZE && inreg($1)!=reg_any
  1402. call lilxxxsil(ADD_I)
  1403. pat lil and sil $1==$3 && $2==WORD_SIZE && inreg($1)!=reg_any
  1404. call lilxxxsil(AND_I)
  1405. pat lil ior sil $1==$3 && $2==WORD_SIZE && inreg($1)!=reg_any
  1406. call lilxxxsil(OR_I)
  1407. pat lil xor sil $1==$3 && $2==WORD_SIZE && inreg($1)!=reg_any
  1408. call lilxxxsil(EOR_I)
  1409. #if WORD_SIZE!=2
  1410. pat lil ads sil $1==$3 && $2==4 && inreg($1)!=reg_any
  1411. call lilxxxsil("add.l")
  1412. #endif
  1413. proc loexxxste example loe adi ste
  1414. with conreg_int-bconst
  1415. kills posextern
  1416. gen xxx* %1, {absolute_int, $1}
  1417. pat loe adi ste $1==$3 && $2==WORD_SIZE call loexxxste(ADD_I)
  1418. pat loe adu ste $1==$3 && $2==WORD_SIZE call loexxxste(ADD_I)
  1419. pat loe and ste $1==$3 && $2==WORD_SIZE call loexxxste(AND_I)
  1420. pat loe ior ste $1==$3 && $2==WORD_SIZE call loexxxste(OR_I)
  1421. pat loe xor ste $1==$3 && $2==WORD_SIZE call loexxxste(EOR_I)
  1422. #if WORD_SIZE!=2
  1423. pat loe ads ste $1==$3 && $2==4 call loexxxste("add.l")
  1424. #endif
  1425. #if WORD_SIZE==2
  1426. proc ldexxxsde example lde adi sde
  1427. with conreg4-bconst4
  1428. kills posextern
  1429. gen xxx* %1, {absolute4, $1}
  1430. pat lde adi sde $1==$3 && $2==4 call ldexxxsde("add.l")
  1431. pat lde adu sde $1==$3 && $2==4 call ldexxxsde("add.l")
  1432. pat lde and sde $1==$3 && $2==4 call ldexxxsde("and.l")
  1433. pat lde ior sde $1==$3 && $2==4 call ldexxxsde("or.l")
  1434. pat lde xor sde $1==$3 && $2==4 call ldexxxsde("eor.l")
  1435. #endif
  1436. proc lollilxxxstl example lol lil adi stl
  1437. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1438. gen xxx* {indirect_int, regvar($2, reg_pointer)}, {LOCAL, $1}
  1439. pat lol lil adi stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1440. && inreg($2)==reg_pointer
  1441. call lollilxxxstl(ADD_I)
  1442. pat lol lil adu stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1443. && inreg($2)==reg_pointer
  1444. call lollilxxxstl(ADD_I)
  1445. pat lol lil sbi stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1446. && inreg($2)==reg_pointer
  1447. call lollilxxxstl(SUB_I)
  1448. pat lol lil sbu stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1449. && inreg($2)==reg_pointer
  1450. call lollilxxxstl(SUB_I)
  1451. pat lol lil and stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1452. && inreg($2)==reg_pointer
  1453. call lollilxxxstl(AND_I)
  1454. pat lol lil ior stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1455. && inreg($2)==reg_pointer
  1456. call lollilxxxstl(OR_I)
  1457. proc lollfixxxstl example lol LLP lof adi stl
  1458. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1459. gen xxx* {offsetted_int, regvar($2, reg_pointer), $3}, {LOCAL, $1}
  1460. pat lol LLP lof adi stl $1==$5 && $4==WORD_SIZE && inreg($1)==reg_any
  1461. && inreg($2)==reg_pointer
  1462. call lollfixxxstl(ADD_I)
  1463. pat lol LLP lof adu stl $1==$5 && $4==WORD_SIZE && inreg($1)==reg_any
  1464. && inreg($2)==reg_pointer
  1465. call lollfixxxstl(ADD_I)
  1466. pat lol LLP lof sbi stl $1==$5 && $4==WORD_SIZE && inreg($1)==reg_any
  1467. && inreg($2)==reg_pointer
  1468. call lollfixxxstl(SUB_I)
  1469. pat lol LLP lof sbu stl $1==$5 && $4==WORD_SIZE && inreg($1)==reg_any
  1470. && inreg($2)==reg_pointer
  1471. call lollfixxxstl(SUB_I)
  1472. pat lol LLP lof and stl $1==$5 && $4==WORD_SIZE && inreg($1)==reg_any
  1473. && inreg($2)==reg_pointer
  1474. call lollfixxxstl(AND_I)
  1475. pat lol LLP lof ior stl $1==$5 && $4==WORD_SIZE && inreg($1)==reg_any
  1476. && inreg($2)==reg_pointer
  1477. call lollfixxxstl(OR_I)
  1478. proc lolfrxlolf example LLP lof and LLP stf
  1479. with conreg_int-bconst
  1480. kills allexceptcon
  1481. gen xxx* %1, {offsetted_int, regvar($1, reg_pointer), $2}
  1482. pat LLP lof adi LLP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1483. && inreg($1)==reg_pointer
  1484. call lolfrxlolf(ADD_I)
  1485. pat LLP lof adu LLP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1486. && inreg($1)==reg_pointer
  1487. call lolfrxlolf(ADD_I)
  1488. pat LLP lof and LLP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1489. && inreg($1)==reg_pointer
  1490. call lolfrxlolf(AND_I)
  1491. pat LLP lof ior LLP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1492. && inreg($1)==reg_pointer
  1493. call lolfrxlolf(OR_I)
  1494. pat LLP lof xor LLP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1495. && inreg($1)==reg_pointer
  1496. call lolfrxlolf(EOR_I)
  1497. #if WORD_SIZE!=2
  1498. pat LLP lof ads LLP stf $1==$4 && $2==$5 && $3==4
  1499. && inreg($1)==reg_pointer
  1500. call lolfrxlolf("add.l")
  1501. #endif
  1502. proc lolfxxlolf example LLP lof and LLP stf
  1503. with conreg_int-bconst
  1504. kills allexceptcon
  1505. #if TBL68020 && FANCY_MODES
  1506. gen xxx* %1, {OFF_off_int, lb, $1, $2}
  1507. #else
  1508. uses AA_REG={DLOCAL, $1}
  1509. gen xxx* %1, {offsetted_int, %a, $2}
  1510. #endif
  1511. pat LLP lof adi LLP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1512. call lolfxxlolf(ADD_I)
  1513. pat LLP lof adu LLP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1514. call lolfxxlolf(ADD_I)
  1515. pat LLP lof and LLP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1516. call lolfxxlolf(AND_I)
  1517. pat LLP lof ior LLP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1518. call lolfxxlolf(OR_I)
  1519. pat LLP lof xor LLP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1520. call lolfxxlolf(EOR_I)
  1521. #if WORD_SIZE!=2
  1522. pat LLP lof ads LLP stf $1==$4 && $2==$5 && $3==4
  1523. call lolfxxlolf("add.l")
  1524. #endif
  1525. #if WORD_SIZE!=2
  1526. proc lilfxxlilf example lil lof and lil stf
  1527. with conreg_int-bconst
  1528. kills allexceptcon
  1529. #if TBL68020 && FANCY_MODES
  1530. gen xxx* %1, {OFF_off4, regvar($1, reg_pointer), 0, $2}
  1531. #else
  1532. uses AA_REG={indirect4, regvar($1, reg_pointer)}
  1533. gen xxx* %1, {offsetted_int, %a, $2}
  1534. #endif
  1535. pat lil lof adi lil stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
  1536. call lilfxxlilf("add.l")
  1537. pat lil lof adu lil stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
  1538. call lilfxxlilf("add.l")
  1539. pat lil lof and lil stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
  1540. call lilfxxlilf("and.l")
  1541. pat lil lof ior lil stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
  1542. call lilfxxlilf("or.l")
  1543. pat lil lof xor lil stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
  1544. call lilfxxlilf("eor.l")
  1545. pat lil lof ads lil stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
  1546. call lilfxxlilf("add.l")
  1547. #endif
  1548. proc lefxxxsef example loe lof and loe stf
  1549. with conreg_int-bconst
  1550. kills allexceptcon
  1551. #if TBL68020 && FANCY_MODES
  1552. gen xxx* %1, {ABS_off_int, $1, $2}
  1553. #else
  1554. uses AA_REG={absolute4, $1}
  1555. gen xxx* %1, {offsetted_int, %a, $2}
  1556. #endif
  1557. pat LEP lof adi LEP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1558. call lefxxxsef(ADD_I)
  1559. pat LEP lof adu LEP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1560. call lefxxxsef(ADD_I)
  1561. pat LEP lof and LEP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1562. call lefxxxsef(AND_I)
  1563. pat LEP lof ior LEP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1564. call lefxxxsef(OR_I)
  1565. pat LEP lof xor LEP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1566. call lefxxxsef(EOR_I)
  1567. #if WORD_SIZE!=2
  1568. pat LEP lof ads LEP stf $1==$4 && $2==$5 && $3==4
  1569. call lefxxxsef("add.l")
  1570. #endif
  1571. /* lil gets a word, not necessarily a pointer */
  1572. #if WORD_SIZE!=2
  1573. proc lilixxlili example lil loi and lil sti
  1574. with conreg_int-bconst
  1575. kills allexceptcon
  1576. #if TBL68020 && FANCY_MODES
  1577. gen xxx* %1, {OFF_off4, regvar($1, reg_pointer), 0, 0}
  1578. #else
  1579. uses AA_REG={indirect4, regvar($1, reg_pointer)}
  1580. gen xxx* %1, {indirect4, %a}
  1581. #endif
  1582. pat lil loi adi lil sti $1==$4 && $2==$3 && $2==$5 && $2==4
  1583. && inreg($1)==reg_pointer
  1584. call lilixxlili("add.l")
  1585. pat lil loi adu lil sti $1==$4 && $2==$3 && $2==$5 && $2==4
  1586. && inreg($1)==reg_pointer
  1587. call lilixxlili("add.l")
  1588. pat lil loi and lil sti $1==$4 && $2==$3 && $2==$5 && $2==4
  1589. && inreg($1)==reg_pointer
  1590. call lilixxlili("and.l")
  1591. pat lil loi ior lil sti $1==$4 && $2==$3 && $2==$5 && $2==4
  1592. && inreg($1)==reg_pointer
  1593. call lilixxlili("or.l")
  1594. pat lil loi xor lil sti $1==$4 && $2==$3 && $2==$5 && $2==4
  1595. && inreg($1)==reg_pointer
  1596. call lilixxlili("eor.l")
  1597. pat lil loi ads lil sti $1==$4 && $2==$3 && $2==$5 && $3==4
  1598. && inreg($1)==reg_pointer
  1599. call lilixxlili("add.l")
  1600. #endif
  1601. proc leixxxsei example loe loi and loe sti
  1602. with conreg_int-bconst
  1603. kills allexceptcon
  1604. #if TBL68020 && FANCY_MODES
  1605. gen xxx* %1, {ABS_off_int, $1, 0}
  1606. #else
  1607. uses AA_REG={absolute4, $1}
  1608. gen xxx* %1, {indirect_int, %a}
  1609. #endif
  1610. pat LEP loi adi LEP sti $1==$4 && $2==$3 && $2==$5 && $2==WORD_SIZE
  1611. call leixxxsei(ADD_I)
  1612. pat LEP loi adu LEP sti $1==$4 && $2==$3 && $2==$5 && $2==WORD_SIZE
  1613. call leixxxsei(ADD_I)
  1614. pat LEP loi and LEP sti $1==$4 && $2==$3 && $2==$5 && $2==WORD_SIZE
  1615. call leixxxsei(AND_I)
  1616. pat LEP loi ior LEP sti $1==$4 && $2==$3 && $2==$5 && $2==WORD_SIZE
  1617. call leixxxsei(OR_I)
  1618. pat LEP loi xor LEP sti $1==$4 && $2==$3 && $2==$5 && $2==WORD_SIZE
  1619. call leixxxsei(EOR_I)
  1620. #if WORD_SIZE!=2
  1621. pat LEP loi ads LEP sti $1==$4 && $2==$3 && $2==$5 && $2==4
  1622. call leixxxsei("add.l")
  1623. #endif
  1624. proc lofruxxsof example LLP lof inc LLP stf
  1625. kills allexceptcon
  1626. gen bit* {offsetted_int, regvar($1, reg_pointer), $2}
  1627. pat LLP lof inc LLP stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
  1628. call lofruxxsof(INC)
  1629. pat LLP lof dec LLP stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
  1630. call lofruxxsof(DEC)
  1631. pat LLP lof ngi LLP stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
  1632. && $3==WORD_SIZE
  1633. call lofruxxsof(NEG_I)
  1634. pat LLP lof com LLP stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
  1635. && $3==WORD_SIZE
  1636. call lofruxxsof(NOT_I)
  1637. proc lofuxxsof example LLP lof inc LLP stf
  1638. kills allexceptcon
  1639. #if TBL68020 && FANCY_MODES
  1640. gen bit* {OFF_off_int, lb, $1, $2}
  1641. #else
  1642. uses AA_REG={DLOCAL,$1}
  1643. gen bit* {offsetted_int,%a,$2}
  1644. #endif
  1645. pat LLP lof inc LLP stf $1==$4 && $2==$5
  1646. call lofuxxsof(INC)
  1647. pat LLP lof dec LLP stf $1==$4 && $2==$5
  1648. call lofuxxsof(DEC)
  1649. pat LLP lof ngi LLP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1650. call lofuxxsof(NEG_I)
  1651. pat LLP lof com LLP stf $1==$4 && $2==$5 && $3==WORD_SIZE
  1652. call lofuxxsof(NOT_I)
  1653. #if WORD_SIZE!=2
  1654. proc lifuxxsif example lil lof inc lil stf
  1655. kills allexceptcon
  1656. #if TBL68020 && FANCY_MODES
  1657. gen bit* {OFF_off4, regvar($1, reg_pointer), 0, $2}
  1658. #else
  1659. uses AA_REG={indirect4, regvar($1, reg_pointer)}
  1660. gen bit* {offsetted4,%a,$2}
  1661. #endif
  1662. pat lil lof inc lil stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
  1663. call lifuxxsif("add.l #1,")
  1664. pat lil lof dec lil stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
  1665. call lifuxxsif("sub.l #1,")
  1666. pat lil lof ngi lil stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
  1667. call lifuxxsif("neg.l")
  1668. pat lil lof com lil stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
  1669. call lifuxxsif("not.l")
  1670. #endif
  1671. #if WORD_SIZE!=2
  1672. proc liiuxxsii example lil loi inc lil sti
  1673. kills allexceptcon
  1674. #if TBL68020 && FANCY_MODES
  1675. gen bit* {OFF_off4, regvar($1, reg_pointer), 0, 0}
  1676. #else
  1677. uses AA_REG={indirect4, regvar($1, reg_pointer)}
  1678. gen bit* {indirect4, %a}
  1679. #endif
  1680. pat lil loi inc lil sti $1==$4 && $2==4 && $5==4 && inreg($1)==reg_pointer
  1681. call liiuxxsii("add.l #1,")
  1682. pat lil loi dec lil sti $1==$4 && $2==4 && $5==4 && inreg($1)==reg_pointer
  1683. call liiuxxsii("sub.l #1,")
  1684. pat lil loi ngi lil sti $1==$4 && $2==4 && $5==4 && $3==4 && inreg($1)==reg_pointer
  1685. call liiuxxsii("neg.l")
  1686. pat lil loi com lil sti $1==$4 && $2==4 && $5==4 && $3==4 && inreg($1)==reg_pointer
  1687. call liiuxxsii("not.l")
  1688. #endif
  1689. proc lefuxxsef example loe lof inc loe stf
  1690. kills allexceptcon
  1691. #if TBL68020 && FANCY_MODES
  1692. gen bit* {ABS_off_int, $1, $2}
  1693. #else
  1694. uses AA_REG={absolute4, $1}
  1695. gen bit* {offsetted_int, %a, $2}
  1696. #endif
  1697. pat LEP lof inc LEP stf $1==$4 && $2==$5
  1698. call lefuxxsef(INC)
  1699. pat LEP lof dec LEP stf $1==$4 && $2==$5
  1700. call lefuxxsef(DEC)
  1701. pat LEP lof ngi LEP stf $1==$4 && $2==$5 && $3==4
  1702. call lefuxxsef(NEG_I)
  1703. pat LEP lof com LEP stf $1==$4 && $2==$5 && $3==4
  1704. call lefuxxsef(NOT_I)
  1705. proc leiuxxsei example loe loi inc loe sti
  1706. kills allexceptcon
  1707. #if TBL68020 && FANCY_MODES
  1708. gen bit* {ABS_off_int, $1, 0}
  1709. #else
  1710. uses AA_REG={absolute4, $1}
  1711. gen bit* {indirect_int, %a}
  1712. #endif
  1713. pat LEP loi inc LEP sti $1==$4 && $2==$5 && $2==WORD_SIZE
  1714. call leiuxxsei(INC)
  1715. pat LEP loi dec LEP sti $1==$4 && $2==$5 && $2==WORD_SIZE
  1716. call leiuxxsei(DEC)
  1717. pat LEP loi ngi LEP sti $1==$4 && $2==$3 && $2==$5 && $2==WORD_SIZE
  1718. call leiuxxsei(NEG_I)
  1719. pat LEP loi com LEP sti $1==$4 && $2==$3 && 2==$5 && $2==WORD_SIZE
  1720. call leiuxxsei(NOT_I)
  1721. proc lolcxxstl example lol loc and stl
  1722. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1723. gen xxx* {const, $2}, {LOCAL, $1}
  1724. /*
  1725. pat lol loc adi stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1726. call lolcxxstl(ADD_I)
  1727. pat lol loc adu stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1728. call lolcxxstl(ADD_I)
  1729. peephole optimizer replaces these
  1730. */
  1731. pat lol loc sbi stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1732. call lolcxxstl(SUB_I)
  1733. pat lol loc sbu stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1734. call lolcxxstl(SUB_I)
  1735. /*
  1736. pat lol loc and stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1737. call lolcxxstl(AND_I)
  1738. pat lol loc ior stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1739. call lolcxxstl(OR_I)
  1740. pat lol loc xor stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1741. call lolcxxstl(EOR_I)
  1742. peephole optimizer replaces these
  1743. */
  1744. #if TBL68020 || WORDSIZE==2
  1745. #if WORD_SIZE==4
  1746. pat lol loc dvi stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1747. call lolcxxstl(DIVS_I)
  1748. pat lol loc dvu stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1749. call lolcxxstl(DIVU_I)
  1750. #endif
  1751. pat lol loc mli stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1752. call lolcxxstl(MULS_I)
  1753. pat lol loc mlu stl $1==$4 && $3==WORD_SIZE && inreg($1)==reg_any
  1754. call lolcxxstl(MULU_I)
  1755. #endif
  1756. proc lolcxxxstl example lol loc adi stl
  1757. kills all_indir, LOCAL %bd==$1
  1758. gen xxx* {const, $2}, {LOCAL, $1}
  1759. /*
  1760. pat lol loc adi stl $1==$4 && $3==WORD_SIZE call lolcxxxstl(ADD_I)
  1761. pat lol loc adu stl $1==$4 && $3==WORD_SIZE call lolcxxxstl(ADD_I)
  1762. peephole optimizer replaces these
  1763. */
  1764. pat lol loc sbi stl $1==$4 && $3==WORD_SIZE call lolcxxxstl(SUB_I)
  1765. pat lol loc sbu stl $1==$4 && $3==WORD_SIZE call lolcxxxstl(SUB_I)
  1766. /*
  1767. pat lol loc and stl $1==$4 && $3==WORD_SIZE && inreg($1)!=reg_pointer
  1768. call lolcxxxstl(AND_I)
  1769. pat lol loc ior stl $1==$4 && $3==WORD_SIZE && inreg($1)!=reg_pointer
  1770. call lolcxxxstl(OR_I)
  1771. pat lol loc xor stl $1==$4 && $3==WORD_SIZE && inreg($1)!=reg_pointer
  1772. call lolcxxxstl(EOR_I)
  1773. peephole optimizer replaces these
  1774. */
  1775. #if WORD_SIZE==2
  1776. proc ldlcxxxsdl example ldl ldc adi sdl
  1777. kills all_indir, DLOCAL %bd==$1
  1778. gen xxx* {const4, $2}, {DLOCAL, $1}
  1779. pat ldl ldc sbi sdl $1==$4 && $3==4 call ldlcxxxsdl("sub.l")
  1780. pat ldl ldc sbu sdl $1==$4 && $3==4 call ldlcxxxsdl("sub.l")
  1781. #endif
  1782. proc lilcxxsil example lil loc and sil
  1783. kills allexceptcon
  1784. gen xxx* {const, $2}, {indirect_int, regvar($1, reg_pointer)}
  1785. pat lil loc adi sil $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer
  1786. call lilcxxsil(ADD_I)
  1787. pat lil loc adu sil $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer
  1788. call lilcxxsil(ADD_I)
  1789. pat lil loc sbi sil $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer
  1790. call lilcxxsil(SUB_I)
  1791. pat lil loc sbu sil $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer
  1792. call lilcxxsil(SUB_I)
  1793. pat lil loc and sil $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer
  1794. call lilcxxsil(AND_I)
  1795. pat lil loc ior sil $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer
  1796. call lilcxxsil(OR_I)
  1797. pat lil loc xor sil $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer
  1798. call lilcxxsil(EOR_I)
  1799. proc lilcxxxsil example lil loc adi sil
  1800. kills allexceptcon
  1801. #if TBL68020
  1802. gen xxx* {const, $2}, {ILOCAL, $1}
  1803. #else
  1804. uses AA_REG = {DLOCAL, $1}
  1805. gen xxx* {const, $2}, {indirect_int, %a}
  1806. #endif
  1807. pat lil loc adi sil $1==$4 && $3==WORD_SIZE && inreg($1)!=reg_any
  1808. call lilcxxxsil(ADD_I)
  1809. pat lil loc adu sil $1==$4 && $3==WORD_SIZE && inreg($1)!=reg_any
  1810. call lilcxxxsil(ADD_I)
  1811. pat lil loc sbi sil $1==$4 && $3==WORD_SIZE && inreg($1)!=reg_any
  1812. call lilcxxxsil(SUB_I)
  1813. pat lil loc sbu sil $1==$4 && $3==WORD_SIZE && inreg($1)!=reg_any
  1814. call lilcxxxsil(SUB_I)
  1815. pat lil loc and sil $1==$4 && $3==WORD_SIZE && inreg($1)!=reg_any
  1816. call lilcxxxsil(AND_I)
  1817. pat lil loc ior sil $1==$4 && $3==WORD_SIZE && inreg($1)!=reg_any
  1818. call lilcxxxsil(OR_I)
  1819. pat lil loc xor sil $1==$4 && $3==WORD_SIZE && inreg($1)!=reg_any
  1820. call lilcxxxsil(EOR_I)
  1821. proc loecxxxste example loe loc adi ste
  1822. kills posextern
  1823. gen xxx* {const, $2}, {absolute4, $1}
  1824. /*
  1825. pat loe loc adi ste $1==$4 && $3==WORD_SIZE call loecxxxste(ADD_I)
  1826. pat loe loc adu ste $1==$4 && $3==WORD_SIZE call loecxxxste(ADD_I)
  1827. peephole optimizer replaces these
  1828. */
  1829. pat loe loc sbi ste $1==$4 && $3==WORD_SIZE call loecxxxste(SUB_I)
  1830. pat loe loc sbu ste $1==$4 && $3==WORD_SIZE call loecxxxste(SUB_I)
  1831. /*
  1832. pat loe loc and ste $1==$4 && $3==WORD_SIZE call loecxxxste(AND_I)
  1833. pat loe loc ior ste $1==$4 && $3==WORD_SIZE call loecxxxste(OR_I)
  1834. pat loe loc xor ste $1==$4 && $3==WORD_SIZE call loecxxxste(EOR_I)
  1835. peephole optimizer replaces these
  1836. */
  1837. proc lolrxxstl example lol lol and stl
  1838. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  1839. gen xxx* {LOCAL, $2}, {LOCAL, $1}
  1840. /*
  1841. pat lol lol adi stl $1==$4 && $3==WORD_SIZE
  1842. && inreg($1)==reg_any && inreg($2)==reg_any
  1843. call lolrxxstl(ADD_I)
  1844. pat lol lol adu stl $1==$4 && $3==WORD_SIZE
  1845. && inreg($1)==reg_any && inreg($2)==reg_any
  1846. call lolrxxstl(ADD_I)
  1847. peephole optimizer replaces these
  1848. */
  1849. pat lol lol sbi stl $1==$4 && $3==WORD_SIZE
  1850. && inreg($1)==reg_any && inreg($2)==reg_any
  1851. call lolrxxstl(SUB_I)
  1852. pat lol lol sbu stl $1==$4 && $3==WORD_SIZE
  1853. && inreg($1)==reg_any && inreg($2)==reg_any
  1854. call lolrxxstl(SUB_I)
  1855. /*
  1856. pat lol lol and stl $1==$4 && $3==WORD_SIZE
  1857. && inreg($1)==reg_any && inreg($2)==reg_any
  1858. call lolrxxstl(AND_I)
  1859. pat lol lol ior stl $1==$4 && $3==WORD_SIZE
  1860. && inreg($1)==reg_any && inreg($2)==reg_any
  1861. call lolrxxstl(OR_I)
  1862. pat lol lol xor stl $1==$4 && $3==WORD_SIZE
  1863. && inreg($1)==reg_any && inreg($2)==reg_any
  1864. call lolrxxstl(EOR_I)
  1865. peephole optimizer replaces these
  1866. */
  1867. proc lolrxxxstl example lol lol adi stl
  1868. kills all_indir, LOCAL %bd==$1
  1869. gen xxx* {LOCAL, $2}, {LOCAL, $1}
  1870. /*
  1871. pat lol lol adi stl $1==$4 && $3==WORD_SIZE && inreg($2)==reg_any
  1872. call lolrxxxstl(ADD_I)
  1873. pat lol lol adu stl $1==$4 && $3==WORD_SIZE && inreg($2)==reg_any
  1874. call lolrxxxstl(ADD_I)
  1875. peephole optimizer replaces these
  1876. */
  1877. #if WORD_SIZE!=2
  1878. pat lol lol ads stl $1==$4 && $3==4 && inreg($2)==reg_any
  1879. call lolrxxxstl("add.l")
  1880. #endif
  1881. pat lol lol sbi stl $1==$4 && $3==WORD_SIZE && inreg($2)==reg_any
  1882. call lolrxxxstl(SUB_I)
  1883. pat lol lol sbu stl $1==$4 && $3==WORD_SIZE && inreg($2)==reg_any
  1884. call lolrxxxstl(SUB_I)
  1885. /*
  1886. pat lol lol and stl $1==$4 && $3==WORD_SIZE && inreg($2)==reg_any && inreg($1)!=reg_pointer
  1887. call lolrxxxstl(AND_I)
  1888. pat lol lol ior stl $1==$4 && $3==WORD_SIZE && inreg($2)==reg_any &&
  1889. inreg($1)!=reg_pointer
  1890. call lolrxxxstl(OR_I)
  1891. pat lol lol xor stl $1==$4 && $3==WORD_SIZE && inreg($2)==reg_any &&
  1892. inreg($1)!=reg_pointer
  1893. call lolrxxxstl(EOR_I)
  1894. peephole optimizer replaces these
  1895. */
  1896. proc lilrxxsil example lil lol and sil
  1897. kills allexceptcon
  1898. gen xxx* {LOCAL, $2}, {indirect_int, regvar($1, reg_pointer)}
  1899. pat lil lol adi sil $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer &&
  1900. inreg($2)==reg_any
  1901. call lilrxxsil(ADD_I)
  1902. pat lil lol adu sil $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer &&
  1903. inreg($2)==reg_any
  1904. call lilrxxsil(ADD_I)
  1905. pat lil lol sbi sil $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer &&
  1906. inreg($2)==reg_any
  1907. call lilrxxsil(SUB_I)
  1908. pat lil lol sbu sil $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer &&
  1909. inreg($2)==reg_any
  1910. call lilrxxsil(SUB_I)
  1911. pat lil lol and sil $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer &&
  1912. inreg($2)==reg_any
  1913. call lilrxxsil(AND_I)
  1914. pat lil lol ior sil $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer &&
  1915. inreg($2)==reg_any
  1916. call lilrxxsil(OR_I)
  1917. pat lil lol xor sil $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer &&
  1918. inreg($2)==reg_any
  1919. call lilrxxsil(EOR_I)
  1920. #if WORD_SIZE!=2
  1921. pat lil lol ads sil $1==$4 && $3==4 && inreg($1)==reg_pointer &&
  1922. inreg($2)==reg_any
  1923. call lilrxxsil("add.l")
  1924. #endif
  1925. proc lilrxxxsil example lil lol adi sil
  1926. kills allexceptcon
  1927. #if TBL68020
  1928. gen xxx* {LOCAL, $2}, {ILOCAL, $1}
  1929. #else
  1930. uses AA_REG = {DLOCAL, $1}
  1931. gen xxx* {LOCAL, $2}, {indirect_int, %a}
  1932. #endif
  1933. pat lil lol adi sil $1==$4 && $3==WORD_SIZE
  1934. && inreg($2)==reg_any && inreg($1)!=reg_any
  1935. call lilrxxxsil(ADD_I)
  1936. pat lil lol adu sil $1==$4 && $3==WORD_SIZE
  1937. && inreg($2)==reg_any && inreg($1)!=reg_any
  1938. call lilrxxxsil(ADD_I)
  1939. pat lil lol sbi sil $1==$4 && $3==WORD_SIZE
  1940. && inreg($2)==reg_any && inreg($1)!=reg_any
  1941. call lilrxxxsil(SUB_I)
  1942. pat lil lol sbu sil $1==$4 && $3==WORD_SIZE
  1943. && inreg($2)==reg_any && inreg($1)!=reg_any
  1944. call lilrxxxsil(SUB_I)
  1945. pat lil lol and sil $1==$4 && $3==WORD_SIZE
  1946. && inreg($2)==reg_any && inreg($1)!=reg_any
  1947. call lilrxxxsil(AND_I)
  1948. pat lil lol ior sil $1==$4 && $3==WORD_SIZE
  1949. && inreg($2)==reg_any && inreg($1)!=reg_any
  1950. call lilrxxxsil(OR_I)
  1951. pat lil lol xor sil $1==$4 && $3==WORD_SIZE
  1952. && inreg($2)==reg_any && inreg($1)!=reg_any
  1953. call lilrxxxsil(EOR_I)
  1954. #if WORD_SIZE!=2
  1955. pat lil lol ads sil $1==$4 && $3==4 && inreg($2)==reg_any && inreg($1)!=reg_any
  1956. call lilrxxxsil("add.l")
  1957. #endif
  1958. proc loerxxxste example loe lol adi ste
  1959. kills posextern
  1960. gen xxx* {LOCAL, $2}, {absolute_int, $1}
  1961. pat loe lol adi ste $1==$4 && $3==WORD_SIZE && inreg($2)==reg_any
  1962. call loerxxxste(ADD_I)
  1963. pat loe lol adu ste $1==$4 && $3==WORD_SIZE && inreg($2)==reg_any
  1964. call loerxxxste(ADD_I)
  1965. pat loe lol sbi ste $1==$4 && $3==WORD_SIZE && inreg($2)==reg_any
  1966. call loerxxxste(SUB_I)
  1967. pat loe lol sbu ste $1==$4 && $3==WORD_SIZE && inreg($2)==reg_any
  1968. call loerxxxste(SUB_I)
  1969. pat loe lol and ste $1==$4 && $3==WORD_SIZE && inreg($2)==reg_any
  1970. call loerxxxste(AND_I)
  1971. pat loe lol ior ste $1==$4 && $3==WORD_SIZE && inreg($2)==reg_any
  1972. call loerxxxste(OR_I)
  1973. pat loe lol xor ste $1==$4 && $3==WORD_SIZE && inreg($2)==reg_any
  1974. call loerxxxste(EOR_I)
  1975. #if WORD_SIZE!=2
  1976. pat loe lol ads ste $1==$4 && $3==4 && inreg($2)==reg_any
  1977. call loerxxxste("add.l")
  1978. #endif
  1979. proc xxxstl example adi stl
  1980. with any_int-RD_REG-dreg_int any-RD_REG-dreg_int
  1981. kills regvar($2, reg_any), use_index %xreg==regvar($2, reg_any)
  1982. gen move %2,{dreg_int, regvar($2)}
  1983. xxx* %1,{LOCAL,$2}
  1984. with exact any_int-RD_REG-dreg_int STACK
  1985. kills regvar($2, reg_any), use_index %xreg==regvar($2, reg_any)
  1986. gen move_i {post_inc_int, sp}, {dreg_int, regvar($2)}
  1987. xxx* %1,{LOCAL,$2}
  1988. pat adi stl $1==WORD_SIZE && inreg($2)==reg_any call xxxstl(ADD_I)
  1989. pat adu stl $1==WORD_SIZE && inreg($2)==reg_any call xxxstl(ADD_I)
  1990. pat sbi stl $1==WORD_SIZE && inreg($2)==reg_any call xxxstl(SUB_I)
  1991. pat sbu stl $1==WORD_SIZE && inreg($2)==reg_any call xxxstl(SUB_I)
  1992. pat and stl $1==WORD_SIZE && inreg($2)==reg_any call xxxstl(AND_I)
  1993. pat ior stl $1==WORD_SIZE && inreg($2)==reg_any call xxxstl(OR_I)
  1994. pat xor stl $1==WORD_SIZE && inreg($2)==reg_any
  1995. with D_REG any_int
  1996. kills regvar($2, reg_any), use_index %xreg==regvar($2, reg_any)
  1997. gen move %2,{dreg_int, regvar($2)}
  1998. eor_i %1,{dreg_int, regvar($2)}
  1999. pat ads SLP $1==4 && inreg($2)==reg_pointer
  2000. with any4-areg-RA_REG any4+address-areg-RA_REG
  2001. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2002. gen move %2,{areg,regvar($2,reg_pointer)}
  2003. add_l %1,{areg,regvar($2,reg_pointer)}
  2004. #ifdef TBL68020
  2005. with regX any4+address-areg-RA_REG
  2006. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2007. gen move %2,{areg,regvar($2,reg_pointer)}
  2008. move {regAregXcon, regvar($2,reg_pointer), %1.xreg, %1.sc, 0},{areg,regvar($2,reg_pointer)}
  2009. with exact regX STACK
  2010. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2011. gen move_l {post_inc4, sp},{areg,regvar($2,reg_pointer)}
  2012. move {regAregXcon, regvar($2,reg_pointer), %1.xreg, %1.sc, 0},{areg,regvar($2,reg_pointer)}
  2013. with exact regX regAcon
  2014. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2015. gen move {regAregXcon, %2.reg, %1.xreg, %1.sc, %2.bd},{areg,regvar($2,reg_pointer)}
  2016. with exact regX local_addr
  2017. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2018. gen move {regAregXcon, lb, %1.xreg, %1.sc, %2.bd},{areg,regvar($2,reg_pointer)}
  2019. #ifdef FANCY_MODES
  2020. with exact regX indirect4
  2021. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2022. gen move {off_regXcon, %2.reg, %1.xreg,%1.sc,0,0},{areg,regvar($2,reg_pointer)}
  2023. with exact regX offsetted4
  2024. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2025. gen move {off_regXcon, %2.reg, %1.xreg, %1.sc, %2.bd, 0},{areg,regvar($2,reg_pointer)}
  2026. with exact regX LOCAL
  2027. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2028. gen move {off_regXcon, lb, %1.xreg, %1.sc, %2.bd, 0},{areg,regvar($2,reg_pointer)}
  2029. with exact regX off_con
  2030. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2031. gen move {off_regXcon, %2.reg, %1.xreg,%1.sc,%2.bd,%2.od},{areg,regvar($2,reg_pointer)}
  2032. with exact regX ext_addr
  2033. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2034. gen move{ext_regX, %1.sc, %1.xreg, %2.bd},{areg,regvar($2,reg_pointer)}
  2035. with exact regX absolute4
  2036. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2037. gen move {abs_regXcon, %1.sc, %1.xreg, %2.bd, 0},{areg,regvar($2,reg_pointer)}
  2038. with exact regX abs_con
  2039. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2040. gen move {abs_regXcon, %1.sc, %1.xreg, %2.bd, %2.od},{areg,regvar($2,reg_pointer)}
  2041. with exact indirect4 ext_addr
  2042. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2043. gen move {off_con, %1.reg, 0, %2.bd},{areg,regvar($2,reg_pointer)}
  2044. with exact offsetted4 ext_addr
  2045. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2046. gen move {off_con, %1.reg, %1.bd, %2.bd},{areg,regvar($2,reg_pointer)}
  2047. with exact LOCAL ext_addr
  2048. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2049. gen move {off_con, lb, %1.bd, %2.bd},{areg,regvar($2,reg_pointer)}
  2050. with exact index_off4 ext_addr
  2051. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2052. gen move {indoff_con, %1.reg, %1.xreg, %1.sc,%1.bd,%2.bd},{areg,regvar($2,reg_pointer)}
  2053. with exact absolute4 ext_addr
  2054. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2055. gen move {abs_con, %1.bd, %2.bd},{areg,regvar($2,reg_pointer)}
  2056. with exact abs_index4 ext_addr
  2057. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2058. gen move {absind_con, %1.sc, %1.xreg, %1.bd, %2.bd},{areg,regvar($2,reg_pointer)}
  2059. with exact indirect4 ext_regX
  2060. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2061. gen move {off_regXcon, %1.reg, %2.xreg, %2.sc, 0, %2.bd},{areg,regvar($2,reg_pointer)}
  2062. with exact offsetted4 ext_regX
  2063. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2064. gen move {off_regXcon, %1.reg, %2.xreg,%2.sc,%1.bd,%2.bd},{areg,regvar($2,reg_pointer)}
  2065. with exact LOCAL ext_regX
  2066. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2067. gen move {off_regXcon, lb, %2.xreg, %2.sc, %1.bd, %2.bd},{areg,regvar($2,reg_pointer)}
  2068. with exact absolute4 ext_regX
  2069. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2070. gen move {abs_regXcon, %2.sc, %2.xreg, %1.bd, %2.bd},{areg,regvar($2,reg_pointer)}
  2071. #endif /* FANCY_MODES */
  2072. #endif /* TBL68020 */
  2073. proc xxxdupstl example adi dup stl
  2074. with any_int-RD_REG-dreg_int any-RD_REG-dreg_int
  2075. kills regvar($3, reg_any), use_index %xreg==regvar($3, reg_any)
  2076. gen move %2,{dreg_int, regvar($3)}
  2077. xxx* %1,{LOCAL,$3} yields {LOCAL, $3}
  2078. with exact any_int-RD_REG-dreg_int STACK
  2079. kills regvar($3, reg_any), use_index %xreg==regvar($3, reg_any)
  2080. gen move_i {post_inc_int, sp}, {dreg_int, regvar($3)}
  2081. xxx* %1,{LOCAL,$3} yields {LOCAL, $3}
  2082. pat adi dup stl $1==$2 && $2==WORD_SIZE && inreg($3)==reg_any
  2083. call xxxdupstl(ADD_I)
  2084. pat adu dup stl $1==$2 && $2==WORD_SIZE && inreg($3)==reg_any
  2085. call xxxdupstl(ADD_I)
  2086. pat sbi dup stl $1==$2 && $2==WORD_SIZE && inreg($3)==reg_any
  2087. call xxxdupstl(SUB_I)
  2088. pat sbu dup stl $1==$2 && $2==WORD_SIZE && inreg($3)==reg_any
  2089. call xxxdupstl(SUB_I)
  2090. pat and dup stl $1==$2 && $2==WORD_SIZE && inreg($3)==reg_any
  2091. call xxxdupstl(AND_I)
  2092. pat ior dup stl $1==$2 && $2==WORD_SIZE && inreg($3)==reg_any
  2093. call xxxdupstl(OR_I)
  2094. /*
  2095. pat xor dup stl $1==$2 && $2==WORD_SIZE && inreg($3)==reg_any
  2096. call xxxdupstl(EOR_I)
  2097. incorrect for eor.l !!!
  2098. */
  2099. pat dup stl $1==WORD_SIZE && inreg($2)==reg_any
  2100. with any_int
  2101. kills regvar($2, reg_any), use_index %xreg==regvar($2, reg_any)
  2102. gen move %1,{dreg_int, regvar($2,reg_any)}
  2103. yields {LOCAL, $2}
  2104. pat dup stl $1==4 && inreg($2)==reg_pointer
  2105. with any4
  2106. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2107. gen move_l %1,{areg, regvar($2, reg_pointer)}
  2108. yields {DLOCAL, $2}
  2109. pat dup LLP sti LLP adp SLP zne $1==WORD_SIZE && inreg($2)==reg_pointer &&
  2110. $2==$4 && $2==$6 && $3==1 && $5==1
  2111. with any1
  2112. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2113. gen move_b %1,{post_inc1, regvar($2,reg_pointer)}
  2114. bne {llabel, $7}
  2115. pat dup LLP sti LLP adp SLP zeq $1==WORD_SIZE && inreg($2)==reg_pointer &&
  2116. $2==$4 && $2==$6 && $3==1 && $5==1
  2117. with any1
  2118. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2119. gen move_b %1,{post_inc1, regvar($2,reg_pointer)}
  2120. beq {llabel, $7}
  2121. /* Normally, LLP sti wth word size will be optimized to sil */
  2122. pat dup LLP sti LLP adp SLP zne $1==WORD_SIZE && inreg($2)==reg_pointer &&
  2123. $2==$4 && $2==$6 && $3==2 && $5==2
  2124. with any2
  2125. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2126. gen move_w %1,{post_inc2, regvar($2,reg_pointer)}
  2127. bne {llabel, $7}
  2128. pat dup LLP sti LLP adp SLP zeq $1==WORD_SIZE && inreg($2)==reg_pointer &&
  2129. $2==$4 && $2==$6 && $3==2 && $5==2
  2130. with any2
  2131. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2132. gen move_w %1,{post_inc2, regvar($2,reg_pointer)}
  2133. beq {llabel, $7}
  2134. #if WORD_SIZE!=2
  2135. /* m68k2 can't do zne/zeq on 4-byte */
  2136. pat dup LLP sti LLP adp SLP zne $1==4 && inreg($2)==reg_pointer &&
  2137. $2==$4 && $2==$6 && $3==4 && $5==4
  2138. with any4
  2139. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2140. gen move_l %1,{post_inc4, regvar($2,reg_pointer)}
  2141. bne {llabel, $7}
  2142. pat dup LLP sti LLP adp SLP zeq $1==4 && inreg($2)==reg_pointer &&
  2143. $2==$4 && $2==$6 && $3==4 && $5==4
  2144. with any4
  2145. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2146. gen move_l %1,{post_inc4, regvar($2,reg_pointer)}
  2147. beq {llabel, $7}
  2148. #endif
  2149. pat dup sil LLP adp SLP zne $1==WORD_SIZE && inreg($2)==reg_pointer &&
  2150. $2==$3 && $3==$5 && $4==WORD_SIZE
  2151. with any_int
  2152. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2153. gen move_i %1,{post_inc_int, regvar($2, reg_pointer)}
  2154. bne {llabel, $6}
  2155. pat dup sil LLP adp SLP zeq $1==WORD_SIZE && inreg($2)==reg_pointer &&
  2156. $2==$3 && $3==$5 && $4==WORD_SIZE
  2157. with any_int
  2158. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2159. gen move_i %1,{post_inc_int, regvar($2, reg_pointer)}
  2160. beq {llabel, $6}
  2161. pat sil lil LLP adp SLP zne $1==$2 && $2==$3 && $3==$5 && $4==WORD_SIZE
  2162. && inreg($1)==reg_pointer
  2163. with any_int
  2164. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2165. gen move_i %1,{post_inc_int, regvar($1,reg_pointer)}
  2166. bne {llabel, $6}
  2167. pat sil lil LLP adp SLP zeq $1==$2 && $2==$3 && $3==$5 && $4==WORD_SIZE
  2168. && inreg($1)==reg_pointer
  2169. with any_int
  2170. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2171. gen move_i %1,{post_inc_int, regvar($1,reg_pointer)}
  2172. beq {llabel, $6}
  2173. pat dup LLP adp SLP LLP sti zne $1==WORD_SIZE && inreg($2)==reg_pointer &&
  2174. $2==$4 && $4==$5 && $6==1 && $4==(0-1)
  2175. with any1
  2176. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2177. gen move_b %1,{pre_dec1, regvar($2,reg_pointer)}
  2178. bne {llabel, $7}
  2179. pat dup LLP adp SLP LLP sti zeq $1==WORD_SIZE && inreg($2)==reg_pointer &&
  2180. $2==$4 && $4==$5 && $6==1 && $4==(0-1)
  2181. with any1
  2182. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2183. gen move_b %1,{pre_dec1, regvar($2,reg_pointer)}
  2184. beq {llabel, $7}
  2185. #if WORD_SIZE!=2
  2186. pat dup LLP adp SLP LLP sti zne $1==WORD_SIZE && inreg($2)==reg_pointer &&
  2187. $2==$4 && $4==$5 && $6==2 && $4==(0-2)
  2188. with any2
  2189. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2190. gen move_w %1,{pre_dec2, regvar($2,reg_pointer)}
  2191. bne {llabel, $7}
  2192. pat dup LLP adp SLP LLP sti zeq $1==WORD_SIZE && inreg($2)==reg_pointer &&
  2193. $2==$4 && $4==$5 && $6==2 && $4==(0-2)
  2194. with any2
  2195. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2196. gen move_w %1,{pre_dec2, regvar($2,reg_pointer)}
  2197. beq {llabel, $7}
  2198. #endif
  2199. #if WORD_SIZE!=2
  2200. pat dup lol adp stl lol sti zne $1==4 && inreg($2)==reg_pointer &&
  2201. $2==$4 && $4==$5 && $6==4 && $4==(0-4)
  2202. with any4
  2203. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2204. gen move_l %1,{pre_dec4, regvar($2,reg_pointer)}
  2205. bne {llabel, $7}
  2206. pat dup lol adp stl lol sti zeq $1==4 && inreg($2)==reg_pointer &&
  2207. $2==$4 && $4==$5 && $6==4 && $4==(0-4)
  2208. with any4
  2209. kills regvar($2, reg_pointer), all_regind %reg==regvar($2, reg_pointer)
  2210. gen move_l %1,{pre_dec4, regvar($2,reg_pointer)}
  2211. beq {llabel, $7}
  2212. #endif
  2213. pat LLP ads SLP $1==$3 && $2==4 && inreg($1)==reg_pointer
  2214. with data4-sconsts
  2215. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2216. gen add_l %1, {DLOCAL, $1}
  2217. pat lil lil inc sil $1==$2 && $1==$4 && inreg($1)==reg_pointer
  2218. kills allexceptcon
  2219. uses DD_REG = {indirect_int, regvar($1, reg_pointer)}
  2220. gen add_i {const, 1}, {indirect_int, regvar($1, reg_pointer)}
  2221. killreg %a
  2222. yields %a
  2223. pat lil lil dec sil $1==$2 && $1==$4 && inreg($1)==reg_pointer
  2224. kills allexceptcon
  2225. uses DD_REG = {indirect_int, regvar($1, reg_pointer)}
  2226. gen sub_i {const, 1}, {indirect_int, regvar($1, reg_pointer)}
  2227. killreg %a
  2228. yields %a
  2229. pat LLP LFP dup adp LLP SFP sti $3==4 && $1==$5 && $2==$6 && inreg($1)==reg_pointer && $7 <= 4
  2230. with conreg
  2231. kills allexceptcon
  2232. uses AA_REG = {offsetted4, regvar($1, reg_pointer), $2}
  2233. gen add_l {const4, $4}, {offsetted4, regvar($1, reg_pointer), $2}
  2234. killreg %a
  2235. yields %1 %a leaving sti $7
  2236. pat LLP LFP dup adp LLP SFP $3==4 && $1==$5 && $2==$6 && inreg($1)==reg_pointer
  2237. kills allexceptcon
  2238. uses AA_REG = {offsetted4, regvar($1, reg_pointer), $2}
  2239. gen add_l {const4, $4}, {offsetted4, regvar($1, reg_pointer), $2}
  2240. killreg %a
  2241. yields %a
  2242. pat LLP LFP dup adp LLP SFP sti $3==4 && $1==$5 && $2==$6 && $7 <= 4
  2243. with conreg
  2244. kills allexceptcon
  2245. uses AA_REG = {DLOCAL, $1}, AA_REG
  2246. gen move_l {offsetted4, %a, $2}, %b
  2247. add_l {const4, $4}, {offsetted4, %a, $2}
  2248. yields %1 %b leaving sti $7
  2249. pat LLP LFP dup adp LLP SFP $3==4 && $1==$5 && $2==$6
  2250. kills allexceptcon
  2251. uses AA_REG = {DLOCAL, $1}, AA_REG
  2252. gen move_l {offsetted4, %a, $2}, %b
  2253. add_l {const4, $4}, {offsetted4, %a, $2}
  2254. yields %b
  2255. pat LEP LFP dup adp LEP SFP sti $3==4 && $1==$5 && $2==$6 && $7 <= 4
  2256. with conreg
  2257. kills allexceptcon
  2258. uses AA_REG = {absolute4, $1}, AA_REG
  2259. gen move_l {offsetted4, %a, $2}, %b
  2260. add_l {const4, $4}, {offsetted4, %a, $2}
  2261. yields %1 %b leaving sti $7
  2262. pat LEP LFP dup adp LEP SFP $3==4 && $1==$5 && $2==$6
  2263. kills allexceptcon
  2264. uses AA_REG = {absolute4, $1}, AA_REG
  2265. gen move_l {offsetted4, %a, $2}, %b
  2266. add_l {const4, $4}, {offsetted4, %a, $2}
  2267. yields %b
  2268. #if WORD_SIZE!=2
  2269. pat lil lof dup adp lil stf sti $3==4 && $1==$5 && $2==$6 && inreg($1)==reg_pointer && $7 <= 4
  2270. with conreg
  2271. kills allexceptcon
  2272. uses AA_REG = {indirect4, regvar($1, reg_pointer)}, AA_REG
  2273. gen move_l {offsetted4, %a, $2}, %b
  2274. add_l {const4, $4}, {offsetted4, %a, $2}
  2275. yields %1 %b leaving sti $7
  2276. pat lil lof dup adp lil stf $3==4 && $1==$5 && $2==$6 && inreg($1)==reg_pointer
  2277. kills allexceptcon
  2278. uses AA_REG = {indirect4, regvar($1, reg_pointer)}, AA_REG
  2279. gen move_l {offsetted4, %a, $2}, %b
  2280. add_l {const4, $4}, {offsetted4, %a, $2}
  2281. yields %b
  2282. #endif /* WORD_SIZE==2 */
  2283. pat LEP loi dup adp LEP sti sti $3==4 && $1==$5 && $2==4 && $6==4 && $7 <= 4
  2284. with conreg
  2285. kills allexceptcon
  2286. uses AA_REG = {absolute4, $1}, AA_REG
  2287. gen move_l {indirect4, %a}, %b
  2288. add_l {const4, $4}, {indirect4, %a}
  2289. yields %1 %b leaving sti $7
  2290. pat LEP loi dup adp LEP sti $3==4 && $1==$5 && $2==4 && $6==4
  2291. kills allexceptcon
  2292. uses AA_REG = {absolute4, $1}, AA_REG
  2293. gen move_l {indirect4, %a}, %b
  2294. add_l {const4, $4}, {indirect4, %a}
  2295. yields %b
  2296. #if WORD_SIZE!=2
  2297. pat lil loi dup adp lil sti sti $3==4 && $1==$5 && $2==4 && $6==4 && $7 <= 4
  2298. with conreg
  2299. kills allexceptcon
  2300. uses AA_REG = {indirect4, regvar($1, reg_pointer)}, AA_REG
  2301. gen move_l {indirect4, %a}, %b
  2302. add_l {const4, $4}, {indirect4, %a}
  2303. yields %1 %b leaving sti $7
  2304. pat lil loi dup adp lil sti $3==4 && $1==$5 && $2==4 && $6==4
  2305. kills allexceptcon
  2306. uses AA_REG = {indirect4, regvar($1, reg_pointer)}, AA_REG
  2307. gen move_l {indirect4, %a}, %b
  2308. add_l {const4, $4}, {indirect4, %a}
  2309. yields %b
  2310. #endif
  2311. pat LLP LLP adp SLP lae cmp $1==$2 && $2==$4 && inreg($1)==reg_pointer && $3 < 0
  2312. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2313. gen sub_l {const4,0-$3},{DLOCAL,$1}
  2314. yields {DLOCAL,$1} {ext_addr, $5+$3}
  2315. leaving cmu 4
  2316. pat LLP LLP adp SLP lae cmp $1==$2 && $2==$4 && inreg($1)==reg_pointer && $3 > 0
  2317. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2318. gen add_l {const4,$3},{DLOCAL,$1}
  2319. yields {DLOCAL,$1} {ext_addr, $5+$3}
  2320. leaving cmu 4
  2321. pat LLP LLP adp SLP loi $1==$2 && $1==$4 && $3==4 && $5==4 &&
  2322. inreg($1)==reg_pointer
  2323. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2324. yields {post_inc4, regvar($1, reg_pointer)}
  2325. pat LLP LLP adp SLP loi $1==$2 && $1==$4 && $3==$5 && inreg($1)==reg_pointer
  2326. leaving LLP $1 loi $5 LLP $2 adp $3 SLP $4
  2327. pat LLP loi LLP adp SLP $1==$3 && $1==$5 && $2==1 && $4==1 &&
  2328. inreg($1)==reg_pointer
  2329. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2330. yields {post_inc1, regvar($1, reg_pointer)}
  2331. /* Normally, LLP loi will be optimized to lil */
  2332. pat LLP loi LLP adp SLP $1==$3 && $1==$5 && $2==2 && $4==2 &&
  2333. inreg($1)==reg_pointer
  2334. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2335. yields {post_inc2, regvar($1, reg_pointer)}
  2336. pat LLP loi LLP adp SLP $1==$3 && $1==$5 && $2==4 && $4==4 &&
  2337. inreg($1)==reg_pointer
  2338. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2339. yields {post_inc4, regvar($1, reg_pointer)}
  2340. pat lil LLP adp SLP $1==$2 && $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer
  2341. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2342. yields {post_inc_int, regvar($1, reg_pointer)}
  2343. pat LLP LLP adp SLP sti $1==$2 && $1==$4 && $3==$5 && inreg($1)==reg_pointer
  2344. leaving LLP $1 sti $5 LLP $2 adp $3 SLP $4
  2345. pat LLP sti LLP adp SLP $1==$3 && $1==$5 && $2==1 && $4==1 &&
  2346. inreg($1)==reg_pointer
  2347. with any1
  2348. kills allexceptcon, regvar($1, reg_pointer)
  2349. gen move %1, {post_inc1, regvar($1, reg_pointer)}
  2350. /* Normally, LLP sti will ve optimzed into sil */
  2351. pat LLP sti LLP adp SLP $1==$3 && $1==$5 && $2==2 && $4==2 &&
  2352. inreg($1)==reg_pointer
  2353. with any2
  2354. kills allexceptcon, regvar($1, reg_pointer)
  2355. gen move %1, {post_inc2, regvar($1, reg_pointer)}
  2356. pat LLP sti LLP adp SLP $1==$3 && $1==$5 && $2==4 && $4==4 &&
  2357. inreg($1)==reg_pointer
  2358. with any4
  2359. kills allexceptcon, regvar($1, reg_pointer)
  2360. gen move %1, {post_inc4, regvar($1, reg_pointer)}
  2361. pat LLP LLP adp SLP sti $1==$2 && $1==$4 && $3==WORD_SIZE && $5==WORD_SIZE &&
  2362. inreg($1)==reg_pointer
  2363. with any_int-sconsts
  2364. kills allexceptcon, regvar($1, reg_pointer)
  2365. gen move %1, {post_inc_int, regvar($1, reg_pointer)}
  2366. pat sil LLP adp SLP $1==$2 && $1==$4 && $3==WORD_SIZE && inreg($1)==reg_pointer
  2367. with any_int-sconsts
  2368. kills allexceptcon, regvar($1, reg_pointer)
  2369. gen move %1, {post_inc_int, regvar($1, reg_pointer)}
  2370. pat LLP adp SLP LLP loi $1==$3 && $1==$4 && $2==0-1 && $5==1 &&
  2371. inreg($1)==reg_pointer
  2372. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2373. yields {pre_dec1, regvar($1, reg_pointer)}
  2374. /* Normally, LLP loi will be optimized to lil */
  2375. pat LLP adp SLP LLP loi $1==$3 && $1==$4 && $2==0-2 && $5==2 &&
  2376. inreg($1)==reg_pointer
  2377. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2378. yields {pre_dec2, regvar($1, reg_pointer)}
  2379. pat LLP adp SLP LLP loi $1==$3 && $1==$4 && $2==0-4 && $5==4 &&
  2380. inreg($1)==reg_pointer
  2381. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2382. yields {pre_dec4, regvar($1, reg_pointer)}
  2383. pat LLP adp SLP lil $1==$3 && $1==$4 && $2==0-WORD_SIZE &&
  2384. inreg($1)==reg_pointer
  2385. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2386. yields {pre_dec_int, regvar($1, reg_pointer)}
  2387. pat LLP adp SLP LLP sti $1==$3 && $1==$4 && $2==0-1 && $5==1 &&
  2388. inreg($1)==reg_pointer
  2389. with any1
  2390. kills allexceptcon, regvar($1, reg_pointer)
  2391. gen move %1, {pre_dec1, regvar($1, reg_pointer)}
  2392. #if WORD_SIZE!=2
  2393. pat LLP adp SLP LLP sti $1==$3 && $1==$4 && $2==0-2 && $5==2 &&
  2394. inreg($1)==reg_pointer
  2395. with any2
  2396. kills allexceptcon, regvar($1, reg_pointer)
  2397. gen move %1, {pre_dec2, regvar($1, reg_pointer)}
  2398. #else
  2399. pat LLP adp SLP LLP sti $1==$3 && $1==$4 && $2==0-4 && $5==4 &&
  2400. inreg($1)==reg_pointer
  2401. with any4
  2402. kills allexceptcon, regvar($1, reg_pointer)
  2403. gen move %1, {pre_dec4, regvar($1, reg_pointer)}
  2404. #endif
  2405. pat LLP adp SLP sil $1==$3 && $1==$4 && $2==0-WORD_SIZE &&
  2406. inreg($1)==reg_pointer
  2407. with any_int-sconsts
  2408. kills allexceptcon, regvar($1, reg_pointer)
  2409. gen move %1, {pre_dec_int, regvar($1, reg_pointer)}
  2410. pat LLP LLP adp SLP $1==$2 && $1==$4 && inreg($1)==reg_pointer && directadd($3)
  2411. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2412. uses AA_REG = {DLOCAL, $1}
  2413. gen add_l {const4, $3}, {DLOCAL, $1}
  2414. killreg %a
  2415. yields %a
  2416. pat LLP LLP adp SLP $1==$2 && $1==$4 && inreg($1)==reg_pointer && directsub($3)
  2417. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2418. uses AA_REG = {DLOCAL, $1}
  2419. gen sub_l {const4, 0-$3}, {DLOCAL, $1}
  2420. killreg %a
  2421. yields %a
  2422. pat LLP LLP adp SLP $1==$2 && $1==$4 && inreg($1)==reg_pointer
  2423. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2424. uses AA_REG = {DLOCAL, $1}, DD_REG4 = {const4, $3}
  2425. gen add_l %b, {DLOCAL, $1}
  2426. killreg %a
  2427. yields %a
  2428. pat LLP LLP adp SLP $1==$2 && $1==$4 && directadd($3)
  2429. kills all_indir, DLOCAL %bd==$1
  2430. uses AA_REG = {DLOCAL, $1}
  2431. gen add_l {const4, $3}, {DLOCAL, $1}
  2432. killreg %a
  2433. yields %a
  2434. pat LLP LLP adp SLP $1==$2 && $1==$4 && directsub($3)
  2435. kills all_indir, DLOCAL %bd==$1
  2436. uses AA_REG = {DLOCAL, $1}
  2437. gen sub_l {const4, 0-$3}, {DLOCAL, $1}
  2438. killreg %a
  2439. yields %a
  2440. pat LLP LLP adp SLP $1==$2 && $1==$4
  2441. kills all_indir, DLOCAL %bd==$1
  2442. uses AA_REG = {DLOCAL, $1}, DD_REG4 = {const4, $3}
  2443. gen add_l %b, {DLOCAL, $1}
  2444. killreg %a
  2445. yields %a
  2446. pat LLP adp SLP $1==$3 && inreg($1)==reg_pointer && directadd($2)
  2447. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2448. gen add_l {const4, $2}, {DLOCAL, $1}
  2449. pat LLP adp SLP $1==$3 && inreg($1)==reg_pointer && directsub($2)
  2450. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2451. gen sub_l {const4, 0-$2}, {DLOCAL, $1}
  2452. pat LLP adp SLP $1==$3 && inreg($1)==reg_pointer
  2453. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2454. uses DD_REG4 = {const4, $2}
  2455. gen add_l %a, {DLOCAL, $1}
  2456. pat LLP adp SLP $1==$3 && directadd($2)
  2457. kills all_indir, DLOCAL %bd==$1
  2458. gen add_l {const4, $2}, {DLOCAL, $1}
  2459. pat LLP adp SLP $1==$3 && directsub($2)
  2460. kills all_indir, DLOCAL %bd==$1
  2461. gen sub_l {const4, 0-$2}, {DLOCAL, $1}
  2462. pat LLP adp SLP $1==$3
  2463. kills all_indir, DLOCAL %bd==$1
  2464. uses DD_REG4 = {const4, $2}
  2465. gen add_l %a, {DLOCAL, $1}
  2466. #if WORD_SIZE!=2
  2467. pat lil lil adp sil sti $1==$2 && $1==$4 && inreg($1)==reg_pointer && $5<=4
  2468. with conreg
  2469. kills allexceptcon
  2470. uses AA_REG = {indirect4, regvar($1, reg_pointer)}
  2471. gen add_l {const, $3}, {indirect4, regvar($1, reg_pointer)}
  2472. killreg %a
  2473. yields %1 %a leaving sti $5
  2474. pat lil lil adp sil $1==$2 && $1==$4 && inreg($1)==reg_pointer
  2475. kills allexceptcon
  2476. uses AA_REG = {indirect4, regvar($1, reg_pointer)}
  2477. gen add_l {const, $3}, {indirect4, regvar($1, reg_pointer)}
  2478. killreg %a
  2479. yields %a
  2480. pat lil lil adp sil $1==$2 && $1==$4
  2481. kills allexceptcon
  2482. uses AA_REG, AA_REG = {LOCAL, $1}
  2483. gen move {indirect4, %b}, %a
  2484. add_l {const, $3}, {indirect4, %b}
  2485. killreg %a
  2486. yields %a
  2487. pat lil adp sil $1==$3 && inreg($1)==reg_pointer
  2488. kills allexceptcon
  2489. gen add_l {const, $2}, {indirect4, regvar($1, reg_pointer)}
  2490. pat lil adp sil $1==$3 && inreg($1)!=reg_any
  2491. kills allexceptcon
  2492. #if TBL68020 /* WORD_SIZE==4 */
  2493. gen add_l {const, $2}, {ILOCAL,$1}
  2494. #else
  2495. uses AA_REG = {LOCAL, $1}
  2496. gen add_l {const, $2}, {indirect4, %a}
  2497. #endif
  2498. #endif /* WORD_SIZE==2 */
  2499. pat LEP LEP adp SEP $1==$2 && $1==$4
  2500. kills posextern
  2501. uses AA_REG = {absolute4, $1}
  2502. gen add_l {const4, $3}, {absolute4, $1}
  2503. killreg %a
  2504. yields %a
  2505. pat LEP adp SEP $1==$3
  2506. kills posextern
  2507. gen add_l {const4, $2}, {absolute4, $1}
  2508. pat loc and $1==255 && $2==WORD_SIZE
  2509. #if WORD_SIZE==2
  2510. with exact absolute_int yields {absolute1,%1.bd+1}
  2511. with exact offsetted_int yields {offsetted1,%1.reg,%1.bd+1}
  2512. with exact LOCAL yields {offsetted1,lb,%1.bd+1}
  2513. #else
  2514. with exact absolute_int yields {absolute1,%1.bd+3}
  2515. with exact offsetted_int yields {offsetted1,%1.reg,%1.bd+3}
  2516. with exact LOCAL yields {offsetted1,lb,%1.bd+3}
  2517. #endif
  2518. with yields {const, $1} leaving and WORD_SIZE
  2519. /************************************************
  2520. * Group 1: load instructions *
  2521. ************************************************/
  2522. pat loc $1==0 yields {zero_const, $1}
  2523. pat loc small($1) yields {small_const, $1}
  2524. pat loc in_1($1) yields {bconst, $1}
  2525. pat loc yields {const, $1}
  2526. #if WORD_SIZE!=2
  2527. pat ldc leaving loc 18 trp
  2528. #else
  2529. pat ldc highw($1)==0 && loww($1)==0 yields {zero_const4, 0}
  2530. pat ldc highw($1)==0 && small(loww($1)) yields {small_const4, loww($1)}
  2531. pat ldc highw($1)==0 && in_1(loww($1)) yields {bconst4, loww($1)}
  2532. pat ldc yields {const4, $1}
  2533. #endif
  2534. pat LLP inreg($1)==reg_pointer
  2535. kills pre_post %reg==regvar($1, reg_pointer)
  2536. yields {DLOCAL, $1}
  2537. pat lol yields {LOCAL, $1}
  2538. #if WORD_SIZE!=2
  2539. pat ldl leaving lol $1+4 lol $1
  2540. #else
  2541. pat ldl yields {DLOCAL, $1}
  2542. #endif
  2543. pat loe yields {absolute_int, $1}
  2544. pat loe loe $1==$2 leaving loe $1 dup WORD_SIZE
  2545. /* replace ste loe by dup ste, but not if followed by a test ... */
  2546. proc steloezxx example ste loe zne
  2547. with any_int-sconsts
  2548. kills posextern
  2549. gen move_i %1, {absolute_int, $1}
  2550. bxx* {llabel, $3}
  2551. with exact STACK
  2552. kills posextern
  2553. gen move_i {post_inc_int, sp}, {absolute_int, $1}
  2554. bxx* {llabel, $3}
  2555. pat ste loe zlt $1==$2 call steloezxx("blt")
  2556. pat ste loe zle $1==$2 call steloezxx("ble")
  2557. pat ste loe zeq $1==$2 call steloezxx("beq")
  2558. pat ste loe zne $1==$2 call steloezxx("bne")
  2559. pat ste loe zge $1==$2 call steloezxx("bge")
  2560. pat ste loe zgt $1==$2 call steloezxx("bgt")
  2561. pat ste loe $1==$2 leaving dup WORD_SIZE ste $1
  2562. pat lil inreg($1)==reg_pointer
  2563. kills pre_post %reg==regvar($1, reg_pointer)
  2564. yields {indirect_int, regvar($1, reg_pointer)}
  2565. #if WORD_SIZE==4
  2566. pat lil inreg($1)==reg_any
  2567. uses AA_REG = {DLOCAL, $1}
  2568. yields {indirect_int, %a}
  2569. #endif
  2570. pat lil
  2571. #if TBL68020
  2572. yields {ILOCAL, $1}
  2573. #else
  2574. uses AA_REG = {DLOCAL, $1}
  2575. yields {indirect_int, %a}
  2576. #endif
  2577. /* When using the 'offsetted' intructions regAregXcon cannot be used
  2578. * for the m68k[24]; there is no way of knowing about the size of
  2579. * %1.bd+$1, because expressions are not allowed in stack patterns, and
  2580. * this may lead to outputting too large displacements. With regAcon
  2581. * the chance that this will happen is very slim, because it can
  2582. * have displacements of 16 bits. Besides, leaving out regAcon here
  2583. * would make it very hard to handle this instruction efficiently.
  2584. */
  2585. pat lof
  2586. with A_REG yields {offsetted_int, %1, $1}
  2587. with exact local_addr yields {LOCAL, %1.bd+$1}
  2588. with exact ext_addr yields {absolute_int, %1.bd+$1}
  2589. #ifndef TBL68020
  2590. with regAcon yields {offsetted_int, %1.reg, %1.bd+$1}
  2591. #else TBL68020
  2592. with exact regAcon yields {offsetted_int, %1.reg, %1.bd+$1}
  2593. with exact regAregXcon yields {index_off_int, %1.reg, %1.xreg, %1.sc, %1.bd+$1}
  2594. #ifdef FANCY_MODES
  2595. with exact offsetted4 yields {OFF_off_int, %1.reg, %1.bd, $1}
  2596. with exact indirect yields {OFF_off_int, %1.reg, 0, $1}
  2597. with exact DLOCAL yields {OFF_off_int, lb, %1.bd, $1}
  2598. with exact off_con yields {OFF_off_int, %1.reg, %1.bd, %1.od+$1}
  2599. with exact index_off4 yields {INDOFF_off_int, %1.reg, %1.xreg, %1.sc, %1.bd, $1}
  2600. with exact indoff_con yields {INDOFF_off_int,
  2601. %1.reg, %1.xreg, %1.sc, %1.bd, %1.od+$1}
  2602. with exact off_regXcon yields {OFF_indoff_int,
  2603. %1.reg, %1.xreg, %1.sc, %1.bd, %1.od+$1}
  2604. with exact absolute4 yields {ABS_off_int, %1.bd, $1}
  2605. with exact abs_con yields {ABS_off_int, %1.bd, %1.od+$1}
  2606. with exact abs_regXcon yields {ABS_indoff_int, %1.sc, %1.xreg, %1.bd, %1.od+$1}
  2607. with exact abs_index4 yields {ABSIND_off_int, %1.sc, %1.xreg, %1.bd, $1}
  2608. with exact absind_con yields {ABSIND_off_int, %1.sc, %1.xreg, %1.bd, %1.od+$1}
  2609. with exact ext_regX yields {abs_index_int, %1.sc, %1.xreg, %1.bd+$1}
  2610. #endif /* FANCY_MODES */
  2611. #endif /* TBL68020 */
  2612. pat lal yields {local_addr, $1}
  2613. pat lae yields {ext_addr, $1}
  2614. pat lxl $1==0 yields lb
  2615. pat lxl $1==1 yields {DLOCAL, SL}
  2616. pat lxl $1==2
  2617. #if TBL68020 && FANCY_MODES
  2618. yields {OFF_off4, lb, SL, SL}
  2619. #else
  2620. uses AA_REG = {DLOCAL, SL}
  2621. yields {offsetted4, %a, SL}
  2622. #endif
  2623. pat lxl $1==3
  2624. #if TBL68020 && FANCY_MODES
  2625. uses AA_REG = {OFF_off4, lb, SL, SL}
  2626. #else
  2627. uses AA_REG = {DLOCAL, SL}
  2628. gen move_l {offsetted4, %a, SL}, %a
  2629. #endif
  2630. yields {offsetted4, %a, SL}
  2631. pat lxl $1>3
  2632. uses AA_REG = {DLOCAL, SL},
  2633. DD_REG4 = {const, $1-2}
  2634. gen 1:
  2635. move_l {offsetted4, %a, SL} ,%a
  2636. dbf %b, {slabel, 1b}
  2637. yields %a
  2638. pat lxa $1==0 yields {local_addr, SL}
  2639. pat lxa $1==1
  2640. #if TBL68020 && FANCY_MODES
  2641. yields {off_con, lb, SL, SL}
  2642. #else
  2643. uses AA_REG = {DLOCAL, SL}
  2644. yields {regAcon, %a, SL}
  2645. #endif
  2646. pat lxa $1==2
  2647. #if TBL68020 && FANCY_MODES
  2648. uses AA_REG = {OFF_off4, lb, SL, SL}
  2649. #else
  2650. uses AA_REG = {DLOCAL, SL}
  2651. gen move_l {offsetted4, %a, SL}, %a
  2652. #endif
  2653. yields {regAcon, %a, SL}
  2654. pat lxa $1>2
  2655. uses AA_REG = {DLOCAL, SL},
  2656. DD_REG4 = {const, $1-2}
  2657. gen 1:
  2658. move_l {offsetted4, %a, SL} ,%a
  2659. dbf %b, {slabel, 1b}
  2660. yields {regAcon, %a, SL}
  2661. pat loi $1==1
  2662. with A_REG yields {indirect1, %1}
  2663. with exact local_addr yields {offsetted1, lb, %1.bd}
  2664. with exact ext_addr yields {absolute1, %1.bd}
  2665. #ifndef TBL68020
  2666. with regAcon yields {offsetted1, %1.reg, %1.bd}
  2667. with regAregXcon yields {index_off1, %1.reg, %1.xreg, %1.sc, %1.bd}
  2668. #else TBL68020
  2669. with exact regAcon yields {offsetted1, %1.reg, %1.bd}
  2670. with exact regAregXcon yields {index_off1, %1.reg, %1.xreg, %1.sc, %1.bd}
  2671. #ifdef FANCY_MODES
  2672. with exact indirect4 yields {OFF_off1, %1.reg, 0, 0}
  2673. with exact offsetted4 yields {OFF_off1, %1.reg, %1.bd, 0}
  2674. with exact LOCAL yields {OFF_off1, lb, %1.bd, 0}
  2675. with exact off_con yields {OFF_off1, %1.reg, %1.bd, %1.od}
  2676. with exact index_off4 yields {INDOFF_off1, %1.reg, %1.xreg, %1.sc, %1.bd, 0}
  2677. with exact indoff_con yields {INDOFF_off1,
  2678. %1.reg, %1.xreg, %1.sc, %1.bd, %1.od}
  2679. with exact off_regXcon yields {OFF_indoff1,
  2680. %1.reg, %1.xreg, %1.sc, %1.bd, %1.od}
  2681. with exact absolute4 yields {ABS_off1, %1.bd, 0}
  2682. with exact abs_con yields {ABS_off1, %1.bd, %1.od}
  2683. with exact abs_regXcon yields {ABS_indoff1, %1.sc, %1.xreg, %1.bd, %1.od}
  2684. with exact abs_index4 yields {ABSIND_off1, %1.sc, %1.xreg, %1.bd, 0}
  2685. with exact absind_con yields {ABSIND_off1, %1.sc, %1.xreg, %1.bd, %1.od}
  2686. with exact ext_regX yields {abs_index1, %1.sc, %1.xreg, %1.bd}
  2687. #endif /* FANCY_MODES */
  2688. #endif /* TBL68020 */
  2689. pat loi $1==2
  2690. with A_REG yields {indirect2, %1}
  2691. #if WORD_SIZE!=2
  2692. with exact local_addr yields {offsetted2, lb, %1.bd}
  2693. #else
  2694. with exact local_addr yields {LOCAL, %1.bd}
  2695. #endif
  2696. with exact ext_addr yields {absolute2, %1.bd}
  2697. #ifndef TBL68020
  2698. with regAcon yields {offsetted2, %1.reg, %1.bd}
  2699. with regAregXcon yields {index_off2, %1.reg, %1.xreg, %1.sc, %1.bd}
  2700. #else TBL68020
  2701. with exact regAcon yields {offsetted2, %1.reg, %1.bd}
  2702. with exact regAregXcon yields {index_off2, %1.reg, %1.xreg, %1.sc, %1.bd}
  2703. #if WORD_SIZE==2
  2704. with exact DLOCAL yields {ILOCAL, %1.bd}
  2705. #endif
  2706. #ifdef FANCY_MODES
  2707. with exact indirect4 yields {OFF_off2, %1.reg, 0, 0}
  2708. with exact offsetted4 yields {OFF_off2, %1.reg, %1.bd, 0}
  2709. with exact LOCAL yields {OFF_off2, lb, %1.bd, 0}
  2710. with exact off_con yields {OFF_off2, %1.reg, %1.bd, %1.od}
  2711. with exact index_off4 yields {INDOFF_off2, %1.reg, %1.xreg, %1.sc, %1.bd, 0}
  2712. with exact indoff_con yields {INDOFF_off2,
  2713. %1.reg, %1.xreg, %1.sc, %1.bd, %1.od}
  2714. with exact off_regXcon yields {OFF_indoff2,
  2715. %1.reg, %1.xreg, %1.sc, %1.bd, %1.od}
  2716. with exact absolute4 yields {ABS_off2, %1.bd, 0}
  2717. with exact abs_con yields {ABS_off2, %1.bd, %1.od}
  2718. with exact abs_regXcon yields {ABS_indoff2, %1.sc, %1.xreg, %1.bd, %1.od}
  2719. with exact abs_index4 yields {ABSIND_off2, %1.sc, %1.xreg, %1.bd, 0}
  2720. with exact absind_con yields {ABSIND_off2, %1.sc, %1.xreg, %1.bd, %1.od}
  2721. with exact ext_regX yields {abs_index2, %1.sc, %1.xreg, %1.bd}
  2722. #endif /* FANCY_MODES */
  2723. #endif /* TBL68020 */
  2724. pat loi $1==4
  2725. with A_REG yields {indirect4, %1}
  2726. with exact local_addr yields {DLOCAL, %1.bd}
  2727. with exact ext_addr yields {absolute4, %1.bd}
  2728. #ifndef TBL68020
  2729. with regAcon yields {offsetted4, %1.reg, %1.bd}
  2730. with regAregXcon yields {index_off4, %1.reg, %1.xreg, %1.sc, %1.bd}
  2731. #else TBL68020
  2732. with exact regAcon yields {offsetted4, %1.reg, %1.bd}
  2733. with exact regAregXcon yields {index_off4, %1.reg, %1.xreg, %1.sc, %1.bd}
  2734. #if WORD_SIZE==4
  2735. with exact LOCAL yields {ILOCAL, %1.bd}
  2736. #endif
  2737. #ifdef FANCY_MODES
  2738. with exact indirect4 yields {OFF_off4, %1.reg, 0, 0}
  2739. with exact offsetted4 yields {OFF_off4, %1.reg, %1.bd, 0}
  2740. with exact off_con yields {OFF_off4, %1.reg, %1.bd, %1.od}
  2741. with exact index_off4 yields {INDOFF_off4, %1.reg, %1.xreg, %1.sc, %1.bd, 0}
  2742. with exact indoff_con yields {INDOFF_off4,
  2743. %1.reg, %1.xreg, %1.sc, %1.bd, %1.od}
  2744. with exact off_regXcon yields {OFF_indoff4,
  2745. %1.reg, %1.xreg, %1.sc, %1.bd, %1.od}
  2746. with exact absolute4 yields {ABS_off4, %1.bd, 0}
  2747. with exact abs_con yields {ABS_off4, %1.bd, %1.od}
  2748. with exact abs_regXcon yields {ABS_indoff4, %1.sc, %1.xreg, %1.bd, %1.od}
  2749. with exact abs_index4 yields {ABSIND_off4, %1.sc, %1.xreg, %1.bd, 0}
  2750. with exact absind_con yields {ABSIND_off4, %1.sc, %1.xreg, %1.bd, %1.od}
  2751. with exact ext_regX yields {abs_index4, %1.sc, %1.xreg, %1.bd}
  2752. #endif /* FANCY_MODES */
  2753. #endif /* TBL68020 */
  2754. #if WORD_SIZE==2
  2755. pat loi $1==6
  2756. with AA_REG
  2757. yields {offsetted2, %1, 4} {indirect4, %1}
  2758. with exact local_addr
  2759. yields {offsetted2, lb, %1.bd+4} {offsetted4, lb, %1.bd}
  2760. with exact ext_addr
  2761. yields {absolute2, %1.bd + 4} {absolute4, %1.bd}
  2762. #endif
  2763. pat loi $1==8
  2764. #if WORD_SIZE!=2
  2765. leaving ldf 0
  2766. #else
  2767. with AA_REG
  2768. yields {offsetted4, %1, 4} {indirect4, %1}
  2769. with exact local_addr
  2770. yields {offsetted4, lb, %1.bd+4} {offsetted4, lb, %1.bd}
  2771. with exact ext_addr
  2772. yields {absolute4, %1.bd + 4} {absolute4, %1.bd}
  2773. #endif
  2774. #if WORD_SIZE==4
  2775. pat loi $1==3*WORD_SIZE
  2776. with AA_REG STACK
  2777. kills ALL
  2778. uses DD_REG4={const,$1}
  2779. gen add_l %a, %1
  2780. move_i {pre_dec_int, %1},{pre_dec_int, sp}
  2781. move_i {pre_dec_int, %1},{pre_dec_int, sp}
  2782. move_i {pre_dec_int, %1},{pre_dec_int, sp}
  2783. pat loi $1==4*WORD_SIZE
  2784. with AA_REG STACK
  2785. kills ALL
  2786. uses DD_REG4={const4,$1}
  2787. gen add_l %a, %1
  2788. move_i {pre_dec_int, %1},{pre_dec_int, sp}
  2789. move_i {pre_dec_int, %1},{pre_dec_int, sp}
  2790. move_i {pre_dec_int, %1},{pre_dec_int, sp}
  2791. move_i {pre_dec_int, %1},{pre_dec_int, sp}
  2792. #endif
  2793. pat loi $1>4*WORD_SIZE && $1/WORD_SIZE <= 65536
  2794. with AA_REG STACK
  2795. kills ALL
  2796. uses DD_REG4 = {const, $1/WORD_SIZE -1}
  2797. gen add_l {const4, $1}, %1
  2798. 1:
  2799. move_i {pre_dec_int, %1}, {pre_dec_int, sp}
  2800. dbf %a, {slabel, 1b}
  2801. pat loi
  2802. with STACK
  2803. kills ALL
  2804. gen move_i {const,$1},{pre_dec_int, sp}
  2805. jsr {absolute4, ".los"}
  2806. pat los $1==WORD_SIZE
  2807. with STACK
  2808. kills ALL
  2809. gen jsr {absolute4, ".los"}
  2810. pat lde
  2811. #if WORD_SIZE==2
  2812. yields {absolute4, $1}
  2813. #else
  2814. yields {absolute4, $1+4}
  2815. {absolute4, $1}
  2816. #endif
  2817. pat ldf
  2818. #if WORD_SIZE==2
  2819. with A_REG yields {offsetted4, %1, $1}
  2820. with exact local_addr yields {DLOCAL, %1.bd+$1}
  2821. with regAcon yields {offsetted4, %1.reg, %1.bd+$1}
  2822. #else
  2823. with A_REG yields {offsetted4, %1, $1+4}
  2824. {offsetted4, %1, $1}
  2825. with exact local_addr yields {LOCAL, %1.bd+$1+4}
  2826. {LOCAL, %1.bd+$1}
  2827. with regAcon yields {offsetted4, %1.reg, %1.bd+$1+4}
  2828. {offsetted4, %1.reg, %1.bd+$1}
  2829. #endif
  2830. pat lpi yields {ext_addr, $1}
  2831. /************************************************
  2832. * Group 2: store instructions *
  2833. ************************************************/
  2834. pat stl inreg($1)==reg_any
  2835. with exact memory1-consts
  2836. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  2837. gen clr_i {LOCAL, $1}
  2838. move_b %1, {dreg1, regvar($1,reg_any)}
  2839. #if WORD_SIZE==2
  2840. with any2
  2841. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  2842. gen move %1, {LOCAL, $1}
  2843. #else
  2844. with exact memory2-consts
  2845. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  2846. gen clr_i {LOCAL, $1}
  2847. move_w %1, {dreg2, regvar($1,reg_any)}
  2848. with store4
  2849. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  2850. gen move %1, {LOCAL, $1}
  2851. #endif
  2852. with exact STACK
  2853. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  2854. gen move_i {post_inc_int, sp}, {LOCAL, $1}
  2855. pat SLP inreg($1)==reg_pointer
  2856. with any4
  2857. #if WORD_SIZE!=2
  2858. -sconsts4
  2859. #endif
  2860. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2861. gen move %1, {areg, regvar($1, reg_pointer)}
  2862. with exact ext_addr
  2863. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2864. gen move_l %1, {areg, regvar($1, reg_pointer)}
  2865. with address-ext_addr
  2866. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2867. gen lea %1, {areg, regvar($1, reg_pointer)}
  2868. with exact STACK
  2869. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  2870. gen move_l {post_inc4, sp}, {areg, regvar($1, reg_pointer)}
  2871. pat stl
  2872. with store_int-sconsts
  2873. kills all_indir, LOCAL %bd==$1
  2874. gen move %1, {LOCAL, $1}
  2875. with exact STACK
  2876. kills all_indir, LOCAL %bd==$1
  2877. gen move_i {post_inc_int,sp}, {LOCAL, $1}
  2878. pat ste
  2879. with store_int-sconsts
  2880. kills posextern
  2881. gen move %1, {absolute_int, $1}
  2882. with exact STACK
  2883. kills posextern
  2884. gen move_i {post_inc_int, sp}, {absolute_int, $1}
  2885. pat sil inreg($1)==reg_pointer
  2886. with store_int-sconsts
  2887. kills allexceptcon
  2888. gen move %1, {indirect_int, regvar($1, reg_pointer)}
  2889. with exact STACK
  2890. kills allexceptcon
  2891. gen move_i {post_inc_int, sp}, {indirect_int, regvar($1, reg_pointer)}
  2892. #if WORD_SIZE==4
  2893. pat sil inreg($1)==reg_any
  2894. with store_int-sconsts
  2895. kills allexceptcon
  2896. uses AA_REG = {DLOCAL, $1}
  2897. gen move %1, {indirect_int, %a}
  2898. with exact STACK
  2899. kills allexceptcon
  2900. uses AA_REG = {DLOCAL, $1}
  2901. gen move_i {post_inc_int, sp}, {indirect_int, %a}
  2902. #endif
  2903. pat sil
  2904. #if TBL68020
  2905. with store_int-sconsts
  2906. kills allexceptcon
  2907. gen move %1, {ILOCAL, $1}
  2908. with exact STACK
  2909. kills allexceptcon
  2910. gen move_i {post_inc_int, sp}, {ILOCAL, $1}
  2911. #else
  2912. with store_int-sconsts
  2913. kills allexceptcon
  2914. uses AA_REG = {DLOCAL, $1}
  2915. gen move %1, {indirect_int, %a}
  2916. with exact STACK
  2917. kills allexceptcon
  2918. uses AA_REG = {DLOCAL, $1}
  2919. gen move_i {post_inc_int, sp}, {indirect_int, %a}
  2920. #endif
  2921. pat stf
  2922. with A_REG store_int-sconsts
  2923. kills allexceptcon
  2924. gen move %2, {offsetted_int, %1, $1}
  2925. with exact any4 STACK
  2926. kills allexceptcon
  2927. uses AA_REG = %1
  2928. gen move_i {post_inc_int, sp}, {offsetted_int, %a, $1}
  2929. with exact STACK
  2930. kills allexceptcon
  2931. uses AA_REG
  2932. gen move_l {post_inc4, sp}, %a
  2933. move_i {post_inc_int, sp}, {offsetted_int, %a, $1}
  2934. with exact local_addr store_int
  2935. kills allexceptcon
  2936. gen move %2, {LOCAL, %1.bd+$1}
  2937. with exact ext_addr store_int
  2938. kills allexceptcon
  2939. gen move %2, {absolute_int, %1.bd+$1}
  2940. #if TBL68000
  2941. #if WORD_SIZE==4
  2942. with regAcon store_int
  2943. kills allexceptcon
  2944. gen move %2, {offsetted_int, %1.reg, %1.bd+$1}
  2945. #endif
  2946. #else TBL68020
  2947. with exact regAcon store_int
  2948. kills allexceptcon
  2949. gen move %2, {offsetted_int, %1.reg, %1.bd+$1}
  2950. with exact regAregXcon store_int
  2951. kills allexceptcon
  2952. gen move %2, {index_off_int, %1.reg, %1.xreg, %1.sc, %1.bd+$1}
  2953. #ifdef FANCY_MODES
  2954. with exact indirect4 store_int
  2955. kills allexceptcon
  2956. gen move %2, {OFF_off_int, %1.reg, 0, $1}
  2957. with exact offsetted4 store_int
  2958. kills allexceptcon
  2959. gen move %2, {OFF_off_int, %1.reg, %1.bd, $1}
  2960. with exact DLOCAL store_int
  2961. kills allexceptcon
  2962. gen move %2, {OFF_off_int, lb, %1.bd, $1}
  2963. with exact off_con store_int
  2964. kills allexceptcon
  2965. gen move %2, {OFF_off_int, %1.reg, %1.bd, %1.od+$1}
  2966. with exact index_off4 store_int
  2967. kills allexceptcon
  2968. gen move %2, {INDOFF_off_int, %1.reg, %1.xreg, %1.sc, %1.bd, $1}
  2969. with exact indoff_con store_int
  2970. kills allexceptcon
  2971. gen move %2, {INDOFF_off_int, %1.reg, %1.xreg, %1.sc, %1.bd, %1.od+$1}
  2972. with exact off_regXcon store_int
  2973. kills allexceptcon
  2974. gen move %2, {OFF_indoff_int, %1.reg, %1.xreg, %1.sc, %1.bd, %1.od+$1}
  2975. with exact absolute4 store_int
  2976. kills allexceptcon
  2977. gen move %2, {ABS_off_int, %1.bd, $1}
  2978. with exact abs_con store_int
  2979. kills allexceptcon
  2980. gen move %2, {ABS_off_int, %1.bd, %1.od+$1}
  2981. with exact abs_regXcon store_int
  2982. kills allexceptcon
  2983. gen move %2, {ABS_indoff_int, %1.sc, %1.xreg, %1.bd, %1.od+$1}
  2984. with exact abs_index4 store_int
  2985. kills allexceptcon
  2986. gen move %2, {ABSIND_off_int, %1.sc, %1.xreg, %1.bd, $1}
  2987. with exact absind_con store_int
  2988. kills allexceptcon
  2989. gen move %2, {ABSIND_off_int, %1.sc, %1.xreg, %1.bd, %1.od+$1}
  2990. with exact ext_regX store_int
  2991. kills allexceptcon
  2992. gen move %2, {abs_index_int, %1.sc, %1.xreg, %1.bd+$1}
  2993. #endif /* FANCY_MODES */
  2994. #endif TBL68020
  2995. pat sti $1==1
  2996. with A_REG any1
  2997. kills allexceptcon
  2998. gen move %2, {indirect1, %1}
  2999. with local_addr any1
  3000. kills allexceptcon
  3001. gen move %2, {offsetted1, lb, %1.bd}
  3002. with exact ext_addr any1
  3003. kills allexceptcon
  3004. gen move %2, {absolute1, %1.bd}
  3005. #ifndef TBL68020
  3006. with regAcon any1
  3007. kills allexceptcon
  3008. gen move %2, {offsetted1, %1.reg, %1.bd}
  3009. with regAregXcon any1
  3010. kills allexceptcon
  3011. gen move %2, {index_off1, %1.reg, %1.xreg, %1.sc, %1.bd}
  3012. #else TBL68020
  3013. with exact regAcon any1
  3014. kills allexceptcon
  3015. gen move %2, {offsetted1, %1.reg, %1.bd}
  3016. with exact regAregXcon any1
  3017. kills allexceptcon
  3018. gen move %2, {index_off1, %1.reg, %1.xreg, %1.sc, %1.bd}
  3019. #ifdef FANCY_MODES
  3020. with exact indirect4 any1
  3021. kills allexceptcon
  3022. gen move %2, {OFF_off1, %1.reg, 0, 0}
  3023. with exact offsetted4 any1
  3024. kills allexceptcon
  3025. gen move %2, {OFF_off1, %1.reg, %1.bd, 0}
  3026. with exact LOCAL any1
  3027. kills allexceptcon
  3028. gen move %2, {OFF_off1, lb, %1.bd, 0}
  3029. with exact off_con any1
  3030. kills allexceptcon
  3031. gen move %2, {OFF_off1, %1.reg, %1.bd, %1.od}
  3032. with exact index_off4 any1
  3033. kills allexceptcon
  3034. gen move %2, {INDOFF_off1, %1.reg, %1.xreg, %1.sc, %1.bd, 0}
  3035. with exact indoff_con any1
  3036. kills allexceptcon
  3037. gen move %2, {INDOFF_off1, %1.reg, %1.xreg, %1.sc, %1.bd, %1.od}
  3038. with exact off_regXcon any1
  3039. kills allexceptcon
  3040. gen move %2, {OFF_indoff1, %1.reg, %1.xreg, %1.sc, %1.bd, %1.od}
  3041. with exact absolute4 any1
  3042. kills allexceptcon
  3043. gen move %2, {ABS_off1, %1.bd, 0}
  3044. with exact abs_con any1
  3045. kills allexceptcon
  3046. gen move %2, {ABS_off1, %1.bd, %1.od}
  3047. with exact abs_regXcon any1
  3048. kills allexceptcon
  3049. gen move %2, {ABS_indoff1, %1.sc, %1.xreg, %1.bd, %1.od}
  3050. with exact abs_index4 any1
  3051. kills allexceptcon
  3052. gen move %2, {ABSIND_off1, %1.sc, %1.xreg, %1.bd, 0}
  3053. with exact absind_con any1
  3054. kills allexceptcon
  3055. gen move %2, {ABSIND_off1, %1.sc, %1.xreg, %1.bd, %1.od}
  3056. with exact ext_regX any1
  3057. kills allexceptcon
  3058. gen move %2, {abs_index1, %1.sc, %1.xreg, %1.bd}
  3059. #endif /* FANCY_MODES */
  3060. #endif TBL68020
  3061. pat sti $1==2
  3062. with A_REG any2
  3063. kills allexceptcon
  3064. gen move %2, {indirect2, %1}
  3065. with local_addr any2
  3066. kills allexceptcon
  3067. gen move %2, {offsetted2, lb, %1.bd}
  3068. with exact ext_addr any2
  3069. kills allexceptcon
  3070. gen move %2, {absolute2, %1.bd}
  3071. #ifndef TBL68020
  3072. with regAcon any2
  3073. kills allexceptcon
  3074. gen move %2, {offsetted2, %1.reg, %1.bd}
  3075. with regAregXcon any2
  3076. kills allexceptcon
  3077. gen move %2, {index_off2, %1.reg, %1.xreg, %1.sc, %1.bd}
  3078. #else TBL68020
  3079. with exact regAcon any2
  3080. kills allexceptcon
  3081. gen move %2, {offsetted2, %1.reg, %1.bd}
  3082. with exact regAregXcon any2
  3083. kills allexceptcon
  3084. gen move %2, {index_off2, %1.reg, %1.xreg, %1.sc, %1.bd}
  3085. #if WORD_SIZE==2
  3086. with exact DLOCAL any2
  3087. kills allexceptcon
  3088. gen move %2, {ILOCAL, %1.bd}
  3089. #endif
  3090. #ifdef FANCY_MODES
  3091. with exact indirect4 any2
  3092. kills allexceptcon
  3093. gen move %2, {OFF_off2, %1.reg, 0, 0}
  3094. with exact offsetted4 any2
  3095. kills allexceptcon
  3096. gen move %2, {OFF_off2, %1.reg, %1.bd, 0}
  3097. with exact LOCAL any2
  3098. kills allexceptcon
  3099. gen move %2, {OFF_off2, lb, %1.bd, 0}
  3100. with exact off_con any2
  3101. kills allexceptcon
  3102. gen move %2, {OFF_off2, %1.reg, %1.bd, %1.od}
  3103. with exact index_off4 any2
  3104. kills allexceptcon
  3105. gen move %2, {INDOFF_off2, %1.reg, %1.xreg, %1.sc, %1.bd, 0}
  3106. with exact indoff_con any2
  3107. kills allexceptcon
  3108. gen move %2, {INDOFF_off2, %1.reg, %1.xreg, %1.sc, %1.bd, %1.od}
  3109. with exact off_regXcon any2
  3110. kills allexceptcon
  3111. gen move %2, {OFF_indoff2, %1.reg, %1.xreg, %1.sc, %1.bd, %1.od}
  3112. with exact absolute4 any2
  3113. kills allexceptcon
  3114. gen move %2, {ABS_off2, %1.bd, 0}
  3115. with exact abs_con any2
  3116. kills allexceptcon
  3117. gen move %2, {ABS_off2, %1.bd, %1.od}
  3118. with exact abs_regXcon any2
  3119. kills allexceptcon
  3120. gen move %2, {ABS_indoff2, %1.sc, %1.xreg, %1.bd, %1.od}
  3121. with exact abs_index4 any2
  3122. kills allexceptcon
  3123. gen move %2, {ABSIND_off2, %1.sc, %1.xreg, %1.bd, 0}
  3124. with exact absind_con any2
  3125. kills allexceptcon
  3126. gen move %2, {ABSIND_off2, %1.sc, %1.xreg, %1.bd, %1.od}
  3127. with exact ext_regX any2
  3128. kills allexceptcon
  3129. gen move %2, {abs_index2, %1.sc, %1.xreg, %1.bd}
  3130. #endif /* FANCY_MODES */
  3131. #endif TBL68020
  3132. pat sti $1==4
  3133. with A_REG store4-sconsts4
  3134. kills allexceptcon
  3135. gen move %2, {indirect4, %1}
  3136. with exact any4 STACK
  3137. kills allexceptcon
  3138. uses AA_REG = %1
  3139. gen move_l {post_inc4, sp}, {indirect4, %a}
  3140. with exact STACK
  3141. kills allexceptcon
  3142. uses AA_REG
  3143. gen move_l {post_inc4, sp}, %a
  3144. move_l {post_inc4, sp}, {indirect4, %a}
  3145. with exact local_addr store4
  3146. kills allexceptcon
  3147. gen move %2, {DLOCAL, %1.bd}
  3148. with exact ext_addr store4
  3149. kills allexceptcon
  3150. gen move %2, {absolute4, %1.bd}
  3151. #ifndef TBL68020
  3152. with regAcon store4-sconsts4
  3153. kills allexceptcon
  3154. gen move %2, {offsetted4, %1.reg, %1.bd}
  3155. with regAregXcon store4-sconsts4
  3156. kills allexceptcon
  3157. gen move %2, {index_off4, %1.reg, %1.xreg, %1.sc, %1.bd}
  3158. #else TBL68020
  3159. with exact regAcon store4
  3160. kills allexceptcon
  3161. gen move %2, {offsetted4, %1.reg, %1.bd}
  3162. with exact regAregXcon store4
  3163. kills allexceptcon
  3164. gen move %2, {index_off4, %1.reg, %1.xreg, %1.sc, %1.bd}
  3165. #if WORD_SIZE==4
  3166. with exact LOCAL store4
  3167. kills allexceptcon
  3168. gen move %2, {ILOCAL, %1.bd}
  3169. #endif
  3170. #ifdef FANCY_MODES
  3171. with exact indirect4 store4
  3172. kills allexceptcon
  3173. gen move %2, {OFF_off4, %1.reg, 0, 0}
  3174. with exact offsetted4 store4
  3175. kills allexceptcon
  3176. gen move %2, {OFF_off4, %1.reg, %1.bd, 0}
  3177. with exact off_con store4
  3178. kills allexceptcon
  3179. gen move %2, {OFF_off4, %1.reg, %1.bd, %1.od}
  3180. with exact index_off4 store4
  3181. kills allexceptcon
  3182. gen move %2, {INDOFF_off4, %1.reg, %1.xreg, %1.sc, %1.bd, 0}
  3183. with exact indoff_con store4
  3184. kills allexceptcon
  3185. gen move %2, {INDOFF_off4, %1.reg, %1.xreg, %1.sc, %1.bd, %1.od}
  3186. with exact off_regXcon store4
  3187. kills allexceptcon
  3188. gen move %2, {OFF_indoff4, %1.reg, %1.xreg, %1.sc, %1.bd, %1.od}
  3189. with exact absolute4 store4
  3190. kills allexceptcon
  3191. gen move %2, {ABS_off4, %1.bd, 0}
  3192. with exact abs_con store4
  3193. kills allexceptcon
  3194. gen move %2, {ABS_off4, %1.bd, %1.od}
  3195. with exact abs_regXcon store4
  3196. kills allexceptcon
  3197. gen move %2, {ABS_indoff4, %1.sc, %1.xreg, %1.bd, %1.od}
  3198. with exact abs_index4 store4
  3199. kills allexceptcon
  3200. gen move %2, {ABSIND_off4, %1.sc, %1.xreg, %1.bd, 0}
  3201. with exact absind_con store4
  3202. kills allexceptcon
  3203. gen move %2, {ABSIND_off4, %1.sc, %1.xreg, %1.bd, %1.od}
  3204. with exact ext_regX store4
  3205. kills allexceptcon
  3206. gen move %2, {abs_index4, %1.sc, %1.xreg, %1.bd}
  3207. #endif /* FANCY_MODES */
  3208. #endif TBL68020
  3209. #if WORD_SIZE==2
  3210. pat sti $1==6
  3211. with A_REG any4 any2
  3212. kills ALL
  3213. gen move %2, {indirect4, %1}
  3214. move %3, {offsetted2, %1, 4}
  3215. with AA_REG any4 any2
  3216. kills ALL
  3217. gen move %2, {post_inc4, %1}
  3218. move %3, {post_inc2, %1}
  3219. with exact A_REG STACK
  3220. kills ALL
  3221. gen move_l {post_inc4, sp}, {indirect4, %1}
  3222. move_w {post_inc2, sp}, {offsetted2, %1, 4}
  3223. with exact AA_REG STACK
  3224. kills ALL
  3225. gen move_l {post_inc4, sp}, {post_inc4, %1}
  3226. move_w {post_inc2, sp}, {post_inc2, %1}
  3227. #endif
  3228. pat sti $1==8
  3229. #if WORD_SIZE!=2
  3230. leaving sdf 0
  3231. #else
  3232. with AA_REG any4-pre_post any4-pre_post
  3233. kills ALL
  3234. gen move_l %2,{indirect4, %1}
  3235. move_l %3,{offsetted4, %1, 4}
  3236. with exact local_addr any4-pre_post any4-pre_post
  3237. kills ALL
  3238. gen move_l %2,{offsetted4, lb, %1.bd}
  3239. move_l %3,{offsetted4, lb, %1.bd+4}
  3240. with exact ext_addr any4-pre_post any4-pre_post
  3241. kills ALL
  3242. gen move_l %2,{absolute4, %1.bd}
  3243. move_l %3,{absolute4, %1.bd+4}
  3244. #endif
  3245. #if WORD_SIZE==4
  3246. pat sti $1==3*WORD_SIZE
  3247. with AA_REG STACK
  3248. kills ALL
  3249. gen move_i {post_inc_int, sp},{post_inc_int,%1}
  3250. move_i {post_inc_int, sp},{post_inc_int,%1}
  3251. move_i {post_inc_int, sp},{post_inc_int,%1}
  3252. pat sti $1==4*WORD_SIZE
  3253. with AA_REG STACK
  3254. kills ALL
  3255. gen move_i {post_inc_int, sp},{post_inc_int,%1}
  3256. move_i {post_inc_int, sp},{post_inc_int,%1}
  3257. move_i {post_inc_int, sp},{post_inc_int,%1}
  3258. move_i {post_inc_int, sp},{post_inc_int,%1}
  3259. #endif
  3260. pat sti $1>4*WORD_SIZE && $1/WORD_SIZE <= 65536
  3261. with AA_REG STACK
  3262. kills ALL
  3263. uses DD_REG4 = {const, $1/WORD_SIZE -1}
  3264. gen 1:
  3265. move_i {post_inc_int, sp}, {post_inc_int, %1}
  3266. dbf %a, {slabel, 1b}
  3267. pat sti
  3268. with STACK
  3269. kills ALL
  3270. gen move_i {const, $1}, {pre_dec_int, sp}
  3271. jsr {absolute4, ".sts"}
  3272. pat sts $1==WORD_SIZE
  3273. with STACK
  3274. kills ALL
  3275. gen jsr {absolute4, ".sts"}
  3276. #if WORD_SIZE==2
  3277. pat sdl
  3278. with store4-sconsts4
  3279. kills all_indir, DLOCAL %bd==$1
  3280. gen move %1, {DLOCAL, $1}
  3281. with exact STACK
  3282. kills all_indir, DLOCAL %bd==$1
  3283. gen move_l {post_inc4,sp}, {DLOCAL, $1}
  3284. #else
  3285. pat sdl
  3286. with any4-sconsts any4-sconsts
  3287. kills all_indir, LOCAL %bd==$1
  3288. gen move %1, {LOCAL, $1}
  3289. move %2, {LOCAL, $1+4}
  3290. #if TBL68881
  3291. with exact FD_REG
  3292. kills all_indir, LOCAL %bd==$1
  3293. gen fmove_d %1, {LOCAL, $1}
  3294. #endif
  3295. with exact STACK
  3296. kills all_indir, LOCAL %bd==$1
  3297. gen move_l {post_inc4, sp}, {LOCAL,$1}
  3298. move_l {post_inc4, sp}, {LOCAL,$1+4}
  3299. #endif /* WORD_SIZE==2 */
  3300. pat sde
  3301. #if WORD_SIZE==2
  3302. with any4-sconsts4
  3303. kills posextern
  3304. gen move_l %1, {absolute4, $1}
  3305. with exact STACK
  3306. kills posextern
  3307. gen move_l {post_inc4, sp}, {absolute4, $1}
  3308. #else
  3309. with any4-sconsts any4-sconsts
  3310. kills posextern
  3311. gen move %1, {absolute4, $1}
  3312. move %2, {absolute4, $1+4}
  3313. #if TBL68881
  3314. with exact FD_REG
  3315. kills posextern
  3316. gen fmove_d %1, {absolute4, $1}
  3317. #endif
  3318. with exact STACK
  3319. kills posextern
  3320. gen move_l {post_inc4, sp}, {absolute4,$1}
  3321. move_l {post_inc4, sp}, {absolute4,$1+4}
  3322. #endif
  3323. pat sdf
  3324. #if WORD_SIZE==2
  3325. with A_REG any4-sconsts4
  3326. kills allexceptcon
  3327. gen move_l %2, {offsetted4, %1, $1}
  3328. with exact A_REG STACK
  3329. kills allexceptcon
  3330. gen move_l {post_inc4, sp}, {offsetted4, %1, $1}
  3331. #else
  3332. with A_REG any4-sconsts any4-sconsts
  3333. kills allexceptcon
  3334. gen move %2, {offsetted4, %1, $1}
  3335. move %3, {offsetted4, %1, $1+4}
  3336. with exact local_addr any4 any4
  3337. kills allexceptcon
  3338. gen move %2, {LOCAL, %1.bd+$1}
  3339. move %3, {LOCAL, %1.bd+$1+4}
  3340. with regAcon any4-sconsts any4-sconsts
  3341. kills allexceptcon
  3342. gen move %2, {offsetted4, %1.reg, %1.bd+$1}
  3343. move %3, {offsetted4, %1.reg, %1.bd+$1+4}
  3344. #endif
  3345. /************************************************
  3346. * Group 3: integer arithmetic. *
  3347. ************************************************/
  3348. #if WORD_SIZE==2
  3349. pat adi $1==2
  3350. with any2-bconst DD_REG
  3351. gen add_w %1, %2 yields %2
  3352. with DD_REG any2-DD_REG-bconst
  3353. gen add_w %2, %1 yields %1
  3354. with exact any2 STACK
  3355. uses reusing %1,DD_REG=%1
  3356. gen add_w {post_inc2, sp}, %a
  3357. yields %a
  3358. #endif
  3359. pat adi $1==4
  3360. with any4-bconst4 DD_REG4
  3361. gen add_l %1, %2 yields %2
  3362. with DD_REG4 any4-DD_REG4-bconst4
  3363. gen add_l %2, %1 yields %1
  3364. with exact any4 STACK
  3365. uses reusing %1,DD_REG4=%1
  3366. gen add_l {post_inc4, sp}, %a
  3367. yields %a
  3368. #if WORD_SIZE==2
  3369. pat sbi $1==2
  3370. with any2-bconst DD_REG
  3371. gen sub_w %1, %2 yields %2
  3372. with DD_REG any2-DD_REG-bconst
  3373. gen sub_w %2, %1
  3374. neg_w %1 yields %1
  3375. with exact any2 STACK
  3376. uses reusing %1,DD_REG=%1
  3377. gen sub_w {post_inc2, sp}, %a
  3378. neg_w %a yields %a
  3379. #endif
  3380. pat sbi $1==4
  3381. with any4-bconst4 DD_REG4
  3382. gen sub_l %1, %2 yields %2
  3383. with DD_REG4 any4-DD_REG4-bconst4
  3384. gen sub_l %2, %1
  3385. neg_l %1 yields %1
  3386. with exact any4 STACK
  3387. uses reusing %1,DD_REG4=%1
  3388. gen sub_l {post_inc4, sp}, %a
  3389. neg_l %a yields %a
  3390. with any4-bconst4 AA_REG
  3391. gen sub_l %1, %2 yields %2
  3392. #if WORD_SIZE==2
  3393. pat loc loc cii ldc mli $1==2 && $2==4 && highw($4)==0 && loww($4)>0 && $5==4
  3394. with any2-pre_post
  3395. uses reusing %1, DD_REG4
  3396. gen move %1, %a.1
  3397. muls_w {const, loww($4)}, %a.1
  3398. yields %a
  3399. pat mli $1==2
  3400. with any2-pre_post any2-pre_post
  3401. uses reusing %2,DD_REG = %2
  3402. gen muls_w %1, %a yields %a
  3403. #endif
  3404. pat mli $1==4
  3405. #ifdef TBL68020
  3406. with data4 DD_REG4
  3407. gen muls_l %1, %2 yields %2
  3408. #else TBL68020
  3409. with STACK
  3410. kills ALL
  3411. gen jsr {absolute4, ".mli"}
  3412. yields dl1
  3413. #endif
  3414. #if WORD_SIZE==2
  3415. pat dvi $1==2
  3416. with data2-sconsts DD_REG
  3417. gen ext_l %2
  3418. divs_w %1, %2
  3419. yields %2
  3420. #endif
  3421. pat dvi $1==4
  3422. #ifdef TBL68020
  3423. with data4-sconsts4 DD_REG4
  3424. gen divs_l %1, %2 yields %2
  3425. #else TBL68020
  3426. with STACK
  3427. kills ALL
  3428. gen jsr {absolute4, ".dvi"}
  3429. yields dl1
  3430. #endif TBL68020
  3431. #if WORD_SIZE==2
  3432. pat rmi $1==2
  3433. with data2-sconsts DD_REG
  3434. gen ext_l %2
  3435. divs_w %1, %2
  3436. swap %2
  3437. killreg %2
  3438. yields %2
  3439. #endif
  3440. pat rmi $1==4
  3441. #ifdef TBL68020
  3442. with data4-sconsts4 DD_REG4
  3443. uses DD_REG4
  3444. gen divsl_l %1, {DREG_pair, %a, %2}
  3445. killreg %2
  3446. /* !!!! contents of %2 have changed: make this known to cg */
  3447. yields %a
  3448. #else TBL68020
  3449. with STACK
  3450. kills ALL
  3451. gen jsr {absolute4, ".dvi"}
  3452. yields dl2
  3453. #endif TBL68020
  3454. #if WORD_SIZE==2
  3455. pat ngi $1==2
  3456. with DD_REG
  3457. gen neg_w %1 yields %1
  3458. #endif
  3459. pat ngi $1==4
  3460. with DD_REG4
  3461. gen neg_l %1 yields %1
  3462. #if WORD_SIZE==2
  3463. pat sli $1==2
  3464. with shconreg DD_REG
  3465. gen asl_w %1, %2 yields %2
  3466. #endif
  3467. pat sli $1==4
  3468. with shconreg DD_REG4
  3469. gen asl_l %1, %2 yields %2
  3470. #if WORD_SIZE==2
  3471. pat sri $1==2
  3472. with shconreg DD_REG
  3473. gen asr_w %1, %2 yields %2
  3474. #endif
  3475. pat sri $1==4
  3476. with shconreg DD_REG4
  3477. gen asr_l %1, %2 yields %2
  3478. /************************************************
  3479. * Group 4: unsigned arithmetic. *
  3480. ************************************************/
  3481. pat adu leaving adi $1
  3482. pat sbu leaving sbi $1
  3483. #if WORD_SIZE==2
  3484. pat mlu $1==2
  3485. with any2-pre_post any2-pre_post
  3486. uses reusing %2,DD_REG = %2
  3487. gen mulu_w %1, %a yields %a
  3488. #endif
  3489. pat mlu $1==4
  3490. #ifdef TBL68020
  3491. with data4-sconsts4 DD_REG4
  3492. gen mulu_l %1, %2 yields %2
  3493. #else TBL68020
  3494. with STACK
  3495. kills ALL
  3496. gen jsr {absolute4, ".mlu"}
  3497. yields dl1
  3498. #endif TBL68020
  3499. #if WORD_SIZE==2
  3500. pat dvu $1==2
  3501. with data2-sconsts data2
  3502. uses DD_REG4 = {zero_const4,0}
  3503. gen move %2,%a.1
  3504. divu_w %1, %a.1 yields %a.1
  3505. #endif
  3506. pat dvu $1==4
  3507. #ifdef TBL68020
  3508. with data4-sconsts4 DD_REG4
  3509. gen divu_l %1, %2 yields %2
  3510. #else TBL68020
  3511. with STACK
  3512. kills ALL
  3513. gen jsr {absolute4, ".dvu"}
  3514. yields dl1
  3515. #endif TBL68020
  3516. #if WORD_SIZE==2
  3517. pat rmu $1==2
  3518. with data2-sconsts data2
  3519. uses DD_REG4 = {zero_const4, 0}
  3520. gen move %2,%a.1
  3521. divu_w %1, %a.1
  3522. swap %a.1
  3523. killreg %a
  3524. yields %a.1
  3525. #endif
  3526. pat rmu $1==4
  3527. #ifdef TBL68020
  3528. with data4-sconsts4 DD_REG4
  3529. uses DD_REG4
  3530. gen divul_l %1, {DREG_pair, %a, %2}
  3531. killreg %2
  3532. /* !!!! contents of %2 have changed: make this known to cg */
  3533. yields %a
  3534. #else TBL68020
  3535. with STACK
  3536. kills ALL
  3537. gen jsr {absolute4, ".dvu"}
  3538. yields dl0
  3539. #endif TBL68020
  3540. pat slu leaving sli $1
  3541. #if WORD_SIZE==2
  3542. pat sru $1==2
  3543. with shconreg DD_REG
  3544. gen lsr_w %1, %2 yields %2
  3545. #endif
  3546. pat sru $1==4
  3547. with shconreg DD_REG4
  3548. gen lsr_l %1, %2 yields %2
  3549. /************************************************
  3550. * Group 5: floating point arithmetic *
  3551. ************************************************/
  3552. /* Floating point stuff
  3553. * Arithmetic instructions
  3554. */
  3555. #if TBL68881
  3556. pat adf stl $1==4
  3557. with FS_REG STACK
  3558. gen fadd_s {post_inc4,sp},%1 yields %1 leaving stl $2
  3559. pat adf sdl $1==8
  3560. with FD_REG STACK
  3561. gen fadd_d {post_inc4,sp},%1 yields %1 leaving sdl $2
  3562. pat sbf stl $1==4
  3563. with FS_REG FS_REG STACK
  3564. gen fsub %1,%2 yields %2 leaving stl $2
  3565. pat sbf sdl $1==8
  3566. with FD_REG FD_REG STACK
  3567. gen fsub %1,%2 yields %2 leaving sdl $2
  3568. pat mlf stl $1==4
  3569. with FS_REG STACK
  3570. gen fmul_s {post_inc4,sp},%1 yields %1 leaving stl $2
  3571. pat mlf sdl $1==8
  3572. with FD_REG STACK
  3573. gen fmul_d {post_inc4,sp},%1 yields %1 leaving sdl $2
  3574. pat dvf stl $1==4
  3575. with FS_REG FS_REG STACK
  3576. gen fdiv %1,%2 yields %2 leaving stl $2
  3577. pat dvf sdl $1==8
  3578. with FD_REG FD_REG STACK
  3579. gen fdiv %1,%2 yields %2 leaving sdl $2
  3580. pat ngf stl $1==4
  3581. with FS_REG STACK
  3582. gen fneg %1 yields %1 leaving stl $2
  3583. pat ngf sdl $1==8
  3584. with FD_REG STACK
  3585. gen fneg %1 yields %1 leaving sdl $2
  3586. pat adf ste $1==4
  3587. with FS_REG STACK
  3588. gen fadd_s {post_inc4,sp},%1 yields %1 leaving ste $2
  3589. pat adf sde $1==8
  3590. with FD_REG STACK
  3591. gen fadd_d {post_inc4,sp},%1 yields %1 leaving sde $2
  3592. pat sbf ste $1==4
  3593. with FS_REG FS_REG STACK
  3594. gen fsub %1,%2 yields %2 leaving ste $2
  3595. pat sbf sde $1==8
  3596. with FD_REG FD_REG STACK
  3597. gen fsub %1,%2 yields %2 leaving sde $2
  3598. pat mlf ste $1==4
  3599. with FS_REG STACK
  3600. gen fmul_s {post_inc4,sp},%1 yields %1 leaving ste $2
  3601. pat mlf sde $1==8
  3602. with FD_REG STACK
  3603. gen fmul_d {post_inc4,sp},%1 yields %1 leaving sde $2
  3604. pat dvf ste $1==4
  3605. with FS_REG FS_REG STACK
  3606. gen fdiv %1,%2 yields %2 leaving ste $2
  3607. pat dvf sde $1==8
  3608. with FD_REG FD_REG STACK
  3609. gen fdiv %1,%2 yields %2 leaving sde $2
  3610. pat ngf ste $1==4
  3611. with FS_REG STACK
  3612. gen fneg %1 yields %1 leaving ste $2
  3613. pat ngf sde $1==8
  3614. with FD_REG STACK
  3615. gen fneg %1 yields %1 leaving sde $2
  3616. pat adf $1==4
  3617. with FS_REG STACK
  3618. gen fadd_s {indirect4,sp},%1
  3619. fmove_s %1,{indirect4,sp}
  3620. pat adf $1==8
  3621. with FD_REG STACK
  3622. gen fadd_d {indirect4,sp},%1
  3623. fmove_d %1,{indirect4,sp}
  3624. pat sbf $1==4
  3625. with FS_REG FS_REG STACK
  3626. gen fsub %1,%2
  3627. fmove_s %2,{pre_dec4,sp}
  3628. pat sbf $1==8
  3629. with FD_REG FD_REG STACK
  3630. gen fsub %1,%2
  3631. fmove_d %2,{pre_dec4,sp}
  3632. pat mlf $1==4
  3633. with FS_REG STACK
  3634. gen fmul_s {indirect4,sp},%1
  3635. fmove_s %1,{indirect4,sp}
  3636. pat mlf $1==8
  3637. with FD_REG STACK
  3638. gen fmul_d {indirect4,sp},%1
  3639. fmove_d %1,{indirect4,sp}
  3640. pat dvf $1==4
  3641. with FS_REG FS_REG STACK
  3642. gen fdiv %1,%2
  3643. fmove_s %2,{pre_dec4,sp}
  3644. pat dvf $1==8
  3645. with FD_REG FD_REG STACK
  3646. gen fdiv %1,%2
  3647. fmove_d %2,{pre_dec4,sp}
  3648. pat ngf $1==4
  3649. with FS_REG STACK
  3650. gen fneg %1
  3651. fmove_s %1,{pre_dec4,sp}
  3652. pat ngf $1==8
  3653. with FD_REG STACK
  3654. gen fneg %1
  3655. fmove_d %1,{pre_dec4,sp}
  3656. pat fif $1==4
  3657. with FS_REG FS_REG STACK
  3658. gen fmul %1,%2
  3659. fintrz %2,%1
  3660. fsub %1,%2
  3661. fmove_s %2,{pre_dec4,sp}
  3662. fmove_s %1,{pre_dec4,sp}
  3663. pat fif $1==8
  3664. with FD_REG FD_REG STACK
  3665. gen fmul %1,%2
  3666. fintrz %2,%1
  3667. fsub %1,%2
  3668. fmove_d %2,{pre_dec4,sp}
  3669. fmove_d %1,{pre_dec4,sp}
  3670. #else
  3671. pat adf $1==4 leaving cal ".adf4" asp 4
  3672. pat adf $1==8 leaving cal ".adf8" asp 8
  3673. pat sbf $1==4 leaving cal ".sbf4" asp 4
  3674. pat sbf $1==8 leaving cal ".sbf8" asp 8
  3675. pat mlf $1==4 leaving cal ".mlf4" asp 4
  3676. pat mlf $1==8 leaving cal ".mlf8" asp 8
  3677. pat dvf $1==4 leaving cal ".dvf4" asp 4
  3678. pat dvf $1==8 leaving cal ".dvf8" asp 8
  3679. pat ngf $1==4 leaving cal ".ngf4"
  3680. pat ngf $1==8 leaving cal ".ngf8"
  3681. pat fif $1==4 leaving lor 1 cal ".fif4" asp 4
  3682. pat fif $1==8 leaving lor 1 cal ".fif8" asp 4
  3683. #endif
  3684. #if WORD_SIZE==2
  3685. pat fef $1==4 leaving lor 1 adp 0-2 cal ".fef4" asp 2
  3686. pat fef $1==8 leaving lor 1 adp 0-2 cal ".fef8" asp 2
  3687. #else
  3688. pat fef $1==4 leaving lor 1 adp 0-4 cal ".fef4"
  3689. pat fef $1==8 leaving lor 1 adp 0-4 cal ".fef8"
  3690. #endif
  3691. /************************************************
  3692. * Group 6: pointer arithmetic *
  3693. ************************************************/
  3694. pat adp $1==0 /* skip; array instructions might 'leave' this */
  3695. pat adp
  3696. with A_REG yields {t_regAcon, %1, $1}
  3697. with exact local_addr yields {local_addr, %1.bd+$1}
  3698. with exact ext_addr yields {ext_addr, %1.bd+$1}
  3699. with exact regAcon + t_regAcon
  3700. yields {t_regAcon, %1.reg, %1.bd+$1}
  3701. with exact regAregXcon + t_regAregXcon
  3702. yields {t_regAregXcon,%1.reg, %1.xreg, %1.sc, %1.bd+$1}
  3703. #if TBL68020 && FANCY_MODES
  3704. with exact indirect4 yields {off_con, %1.reg, 0, $1}
  3705. with exact LOCAL yields {off_con, lb, %1.bd, $1}
  3706. with exact offsetted4 yields {off_con, %1.reg, %1.bd, $1}
  3707. with exact off_con yields {off_con, %1.reg, %1.bd, %1.od+$1}
  3708. with exact index_off4 yields {indoff_con, %1.reg, %1.xreg, %1.sc, %1.bd, $1}
  3709. with exact indoff_con yields {indoff_con,
  3710. %1.reg, %1.xreg, %1.sc, %1.bd, %1.od+$1}
  3711. with exact off_regXcon yields {off_regXcon,
  3712. %1.reg, %1.xreg, %1.sc, %1.bd, %1.od+$1}
  3713. with exact absolute4 yields {abs_con, %1.bd, $1}
  3714. with exact abs_con yields {abs_con, %1.bd, %1.od+$1}
  3715. with exact abs_regXcon yields {abs_regXcon, %1.sc, %1.xreg, %1.bd, %1.od+$1}
  3716. with exact abs_index4 yields {absind_con, %1.sc, %1.xreg, %1.bd, $1}
  3717. with exact absind_con yields {absind_con, %1.sc, %1.xreg, %1.bd, %1.od+$1}
  3718. with exact ext_regX yields {ext_regX, %1.sc, %1.xreg, %1.bd+$1}
  3719. #endif
  3720. pat ads cmp $1==4
  3721. with DD_REG4 any4
  3722. gen add_l %2, %1 yields %1 leaving cmu 4
  3723. with any4 DD_REG4
  3724. gen add_l %1, %2 yields %2 leaving cmu 4
  3725. #ifdef TBL68020
  3726. with regX AA_REG
  3727. gen move {regAregXcon, %2, %1.xreg, %1.sc, 0},%2
  3728. yields %2 leaving cmu 4
  3729. #endif
  3730. #if WORD_SIZE!=2
  3731. pat ads bne $1==4
  3732. with DD_REG4 any4
  3733. gen add_l %2, %1 yields %1 leaving bne $2
  3734. with any4 DD_REG4
  3735. gen add_l %1, %2 yields %2 leaving bne $2
  3736. #ifdef TBL68020
  3737. with regX AA_REG
  3738. gen move {regAregXcon, %2, %1.xreg, %1.sc, 0},%2
  3739. yields %2 leaving bne $2
  3740. #endif
  3741. pat ads beq $1==4
  3742. with DD_REG4 any4
  3743. gen add_l %2, %1 yields %1 leaving beq $2
  3744. with any4 DD_REG4
  3745. gen add_l %1, %2 yields %2 leaving beq $2
  3746. #ifdef TBL68020
  3747. with regX AA_REG
  3748. gen move {regAregXcon, %2, %1.xreg, %1.sc, 0},%2
  3749. yields %2 leaving beq $2
  3750. #endif
  3751. pat ads LEP bne $1==4
  3752. with DD_REG4 any4
  3753. gen add_l %2, %1 yields %1 leaving LEP $2 bne $3
  3754. with any4 DD_REG4
  3755. gen add_l %1, %2 yields %2 leaving LEP $2 bne $3
  3756. #ifdef TBL68020
  3757. with regX AA_REG
  3758. gen move {regAregXcon, %2, %1.xreg, %1.sc, 0},%2
  3759. yields %2 leaving loe $2 bne $3
  3760. #endif
  3761. pat ads LEP beq $1==4
  3762. with DD_REG4 any4
  3763. gen add_l %2, %1 yields %1 leaving LEP $2 beq $3
  3764. with any4 DD_REG4
  3765. gen add_l %1, %2 yields %2 leaving LEP $2 beq $3
  3766. #ifdef TBL68020
  3767. with regX AA_REG
  3768. gen move {regAregXcon, %2, %1.xreg, %1.sc, 0},%2
  3769. yields %2 leaving loe $2 beq $3
  3770. #endif
  3771. pat ads LEP cmp $1==4
  3772. with DD_REG4 any4
  3773. gen add_l %2, %1 yields %1 leaving LEP $2 cmu 4
  3774. with any4 DD_REG4
  3775. gen add_l %1, %2 yields %2 leaving LEP $2 cmu 4
  3776. #ifdef TBL68020
  3777. with regX AA_REG
  3778. gen move {regAregXcon, %2, %1.xreg, %1.sc, 0},%2
  3779. yields %2 leaving LEP $2 cmu 4
  3780. #endif
  3781. pat ads lae bne $1==4
  3782. with DD_REG4 any4
  3783. gen add_l %2, %1 yields %1 leaving lae $2 bne $3
  3784. with any4 DD_REG4
  3785. gen add_l %1, %2 yields %2 leaving lae $2 bne $3
  3786. #ifdef TBL68020
  3787. with regX AA_REG
  3788. gen move {regAregXcon, %2, %1.xreg, %1.sc, 0},%2
  3789. yields %2 leaving lae $2 bne $3
  3790. #endif
  3791. pat ads lae beq $1==4
  3792. with DD_REG4 any4
  3793. gen add_l %2, %1 yields %1 leaving lae $2 beq $3
  3794. with any4 DD_REG4
  3795. gen add_l %1, %2 yields %2 leaving lae $2 beq $3
  3796. #ifdef TBL68020
  3797. with regX AA_REG
  3798. gen move {regAregXcon, %2, %1.xreg, %1.sc, 0},%2
  3799. yields %2 leaving lae $2 beq $3
  3800. #endif
  3801. #endif /* WORD_SIZE==2 */
  3802. pat ads lae cmp $1==4
  3803. with DD_REG4 any4
  3804. gen add_l %2, %1 yields %1 leaving lae $2 cmu 4
  3805. with any4 DD_REG4
  3806. gen add_l %1, %2 yields %2 leaving lae $2 cmu 4
  3807. #ifdef TBL68020
  3808. with regX AA_REG
  3809. gen move {regAregXcon, %2, %1.xreg, %1.sc, 0},%2
  3810. yields %2 leaving lae $2 cmu 4
  3811. #endif
  3812. #if WORD_SIZE!=2
  3813. pat ads lal bne $1==4
  3814. with DD_REG4 any4
  3815. gen add_l %2, %1 yields %1 leaving lal $2 bne $3
  3816. with any4 DD_REG4
  3817. gen add_l %1, %2 yields %2 leaving lal $2 bne $3
  3818. #ifdef TBL68020
  3819. with regX AA_REG
  3820. gen move {regAregXcon, %2, %1.xreg, %1.sc, 0},%2
  3821. yields %2 leaving lal $2 bne $3
  3822. #endif
  3823. pat ads lal beq $1==4
  3824. with DD_REG4 any4
  3825. gen add_l %2, %1 yields %1 leaving lal $2 beq $3
  3826. with any4 DD_REG4
  3827. gen add_l %1, %2 yields %2 leaving lal $2 beq $3
  3828. #ifdef TBL68020
  3829. with regX AA_REG
  3830. gen move {regAregXcon, %2, %1.xreg, %1.sc, 0},%2
  3831. yields %2 leaving lal $2 beq $3
  3832. #endif
  3833. pat ads lal cmp $1==4
  3834. with DD_REG4 any4
  3835. gen add_l %2, %1 yields %1 leaving lal $2 cmu 4
  3836. with any4 DD_REG4
  3837. gen add_l %1, %2 yields %2 leaving lal $2 cmu 4
  3838. #ifdef TBL68020
  3839. with regX AA_REG
  3840. gen move {regAregXcon, %2, %1.xreg, %1.sc, 0},%2
  3841. yields %2 leaving lal $2 cmu 4
  3842. #endif
  3843. pat ads LLP bne $1==4
  3844. with DD_REG4 any4
  3845. gen add_l %2, %1 yields %1 leaving LLP $2 bne $3
  3846. with any4 DD_REG4
  3847. gen add_l %1, %2 yields %2 leaving LLP $2 bne $3
  3848. #ifdef TBL68020
  3849. with regX AA_REG
  3850. gen move {regAregXcon, %2, %1.xreg, %1.sc, 0},%2
  3851. yields %2 leaving lol $2 bne $3
  3852. #endif
  3853. pat ads LLP beq $1==4
  3854. with DD_REG4 any4
  3855. gen add_l %2, %1 yields %1 leaving LLP $2 beq $3
  3856. with any4 DD_REG4
  3857. gen add_l %1, %2 yields %2 leaving LLP $2 beq $3
  3858. #ifdef TBL68020
  3859. with regX AA_REG
  3860. gen move {regAregXcon, %2, %1.xreg, %1.sc, 0},%2
  3861. yields %2 leaving lol $2 beq $3
  3862. #endif
  3863. #endif /* WORD_SIZE==2 */
  3864. pat ads LLP cmp $1==4
  3865. with DD_REG4 any4
  3866. gen add_l %2, %1 yields %1 leaving LLP $2 cmu 4
  3867. with any4 DD_REG4
  3868. gen add_l %1, %2 yields %2 leaving LLP $2 cmu 4
  3869. #ifdef TBL68020
  3870. with regX AA_REG
  3871. gen move {regAregXcon, %2, %1.xreg, %1.sc, 0},%2
  3872. yields %2 leaving lol $2 cmu 4
  3873. #endif
  3874. #if WORD_SIZE==2
  3875. pat ads $1==2
  3876. leaving loc 2 loc 4 cii ads 4
  3877. #endif
  3878. pat ads $1==4
  3879. with D_REG4 A_REG yields {regAregXcon, %2, %1, 1, 0}
  3880. with D_REG4 regAcon + t_regAcon
  3881. yields {t_regAregXcon, %2.reg, %1, 1, %2.bd}
  3882. with D_REG4 local_addr yields {t_regAregXcon, lb, %1, 1, %2.bd}
  3883. with any4 AA_REG
  3884. gen add_l %1, %2 yields %2
  3885. #ifdef TBL68020
  3886. with D_REG4 yields {regX, 1, %1}
  3887. leaving ads 4
  3888. with regX A_REG yields {regAregXcon, %2, %1.xreg, %1.sc, 0}
  3889. with exact regX regAcon yields {regAregXcon, %2.reg, %1.xreg, %1.sc, %2.bd}
  3890. with exact regX local_addr
  3891. yields {regAregXcon, lb, %1.xreg, %1.sc, %2.bd}
  3892. #ifdef FANCY_MODES
  3893. with exact regX indirect4
  3894. yields {off_regXcon, %2.reg, %1.xreg,%1.sc,0,0}
  3895. with exact regX offsetted4
  3896. yields {off_regXcon, %2.reg, %1.xreg, %1.sc, %2.bd, 0}
  3897. with exact regX DLOCAL yields {off_regXcon, lb, %1.xreg, %1.sc, %2.bd, 0}
  3898. with exact regX off_con yields {off_regXcon, %2.reg, %1.xreg,%1.sc,%2.bd,%2.od}
  3899. with exact regX ext_addr
  3900. yields {ext_regX, %1.sc, %1.xreg, %2.bd}
  3901. with exact regX absolute4
  3902. yields {abs_regXcon, %1.sc, %1.xreg, %2.bd, 0}
  3903. with exact regX abs_con yields {abs_regXcon, %1.sc, %1.xreg, %2.bd, %2.od}
  3904. with exact indirect4 ext_addr
  3905. yields {off_con, %1.reg, 0, %2.bd}
  3906. with exact offsetted4 ext_addr
  3907. yields {off_con, %1.reg, %1.bd, %2.bd}
  3908. with exact LOCAL ext_addr
  3909. yields {off_con, lb, %1.bd, %2.bd}
  3910. with exact index_off4 ext_addr
  3911. yields {indoff_con, %1.reg, %1.xreg, %1.sc,%1.bd,%2.bd}
  3912. with exact absolute4 ext_addr
  3913. yields {abs_con, %1.bd, %2.bd}
  3914. with exact abs_index4 ext_addr
  3915. yields {absind_con, %1.sc, %1.xreg, %1.bd, %2.bd}
  3916. with exact indirect4 ext_regX
  3917. yields {off_regXcon, %1.reg, %2.xreg, %2.sc, 0, %2.bd}
  3918. with exact offsetted4 ext_regX
  3919. yields {off_regXcon, %1.reg, %2.xreg,%2.sc,%1.bd,%2.bd}
  3920. with exact LOCAL ext_regX
  3921. yields {off_regXcon, lb, %2.xreg, %2.sc, %1.bd, %2.bd}
  3922. with exact absolute4 ext_regX
  3923. yields {abs_regXcon, %2.sc, %2.xreg, %1.bd, %2.bd}
  3924. #endif /* FANCY_MODES */
  3925. #endif TBL68020
  3926. /* I WOULD ALSO LIKE THIS:
  3927. * pat ads
  3928. * with const leaving adp %1.num
  3929. * BUT THAT DOESN'T WORK.
  3930. */
  3931. #if WORD_SIZE==2
  3932. pat sbs $1==2
  3933. leaving sbs 4 loc 4 loc 2 cii
  3934. #endif
  3935. pat sbs $1==4 leaving sbi 4
  3936. /* regX type OK ??? */
  3937. #ifdef TBL68020
  3938. pat loc slu $2==4 leaving loc $1 sli 4
  3939. pat loc sli ads $1==1 && $2==4 && $3==4
  3940. with D_REG4 yields {regX, 2, %1}
  3941. leaving ads 4
  3942. pat loc sli ads $1==2 && $2==4 && $3==4
  3943. with D_REG4 yields {regX, 4, %1}
  3944. leaving ads 4
  3945. pat loc sli ads $1==3 && $2==4 && $3==4
  3946. with D_REG4 yields {regX, 8, %1}
  3947. leaving ads 4
  3948. #else
  3949. pat loc sli $1==1 && $2==WORD_SIZE
  3950. with DD_REG
  3951. gen add_i %1, %1 yields %1
  3952. #if WORD_SIZE==2
  3953. pat loc sli $1==1 && $2==4
  3954. with DD_REG4
  3955. gen add_l %1, %1 yields %1
  3956. #endif
  3957. #endif TBL68020
  3958. /************************************************
  3959. * Group 7: increment / decrement / zero *
  3960. ************************************************/
  3961. pat inc leaving loc 1 adi WORD_SIZE
  3962. pat inl inreg($1)==reg_any
  3963. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  3964. gen add_i {const, 1}, {LOCAL, $1}
  3965. pat inl
  3966. kills all_indir, LOCAL %bd==$1
  3967. gen add_i {const, 1}, {LOCAL, $1}
  3968. pat lol inl $1==$2
  3969. kills all_indir, LOCAL %bd==$1
  3970. uses DD_REG = {LOCAL, $1}
  3971. gen add_i {const, 1}, {LOCAL, $1}
  3972. killreg %a
  3973. yields %a
  3974. pat ine
  3975. kills posextern
  3976. gen add_i {const, 1}, {absolute_int, $1}
  3977. pat dec leaving loc 1 sbi WORD_SIZE
  3978. pat del inreg($1)==reg_any
  3979. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  3980. gen sub_i {const, 1}, {LOCAL, $1}
  3981. pat del
  3982. kills all_indir, LOCAL %bd==$1
  3983. gen sub_i {const, 1}, {LOCAL, $1}
  3984. pat lol del $1==$2
  3985. kills all_indir, LOCAL %bd==$1
  3986. uses DD_REG = {LOCAL, $1}
  3987. gen sub_i {const, 1}, {LOCAL, $1}
  3988. killreg %a
  3989. yields %a
  3990. pat dee
  3991. kills posextern
  3992. gen sub_i {const, 1}, {absolute_int, $1}
  3993. pat zrl inreg($1)==reg_any
  3994. kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
  3995. gen clr_i {LOCAL, $1}
  3996. pat zrl inreg($1)==reg_pointer
  3997. kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
  3998. gen move {const4,0}, {areg, regvar($1, reg_pointer)}
  3999. pat zrl
  4000. kills all_indir, LOCAL %bd==$1
  4001. gen clr_i {LOCAL, $1}
  4002. pat zrl lol $1==$2 && inreg($1) < 0
  4003. kills all_indir, LOCAL %bd==$1
  4004. gen clr_i {LOCAL, $1} yields {zero_const, 0}
  4005. pat zre
  4006. kills posextern
  4007. gen clr_i {absolute_int, $1}
  4008. pat zre loe $1==$2
  4009. kills posextern
  4010. gen clr_i {absolute_int, $1} yields {zero_const, 0}
  4011. pat zer $1==4 yields {zero_const4, 0}
  4012. #if WORD_SIZE==2
  4013. pat zer $1==6 yields {zero_const, 0} {zero_const, 0} {zero_const, 0}
  4014. #else
  4015. pat zer $1==8 yields {zero_const, 0} {zero_const, 0}
  4016. pat zer $1==12 yields {zero_const, 0} {zero_const, 0} {zero_const, 0}
  4017. #endif
  4018. pat zer $1/WORD_SIZE <= 65536
  4019. with STACK
  4020. uses DD_REG4 = {const, $1/WORD_SIZE -1}
  4021. gen 1:
  4022. clr_i {pre_dec_int, sp}
  4023. dbf %a, {slabel, 1b}
  4024. pat zer
  4025. with STACK
  4026. uses DD_REG4 = {const, $1/WORD_SIZE}
  4027. gen 1:
  4028. clr_i {pre_dec_int, sp}
  4029. sub_l {const4,1}, %a
  4030. bne {slabel, 1b}
  4031. /************************************************
  4032. * Group 8: convert instructions *
  4033. ************************************************/
  4034. pat cii
  4035. with STACK
  4036. kills ALL
  4037. gen jsr {absolute4, ".cii"}
  4038. #if WORD_SIZE==2
  4039. /* No sign-extension, though this is probably not what you may want.
  4040. * This will teach compiler writers not to convert between unsigneds and
  4041. * integers of a different size.
  4042. */
  4043. pat loc loc ciu $1==2 && $2==4
  4044. with zero_const
  4045. yields {zero_const4, 0}
  4046. with any
  4047. uses DD_REG4 = {zero_const4, 0}
  4048. gen move %1,%a.1
  4049. yields %a
  4050. pat loc loc ciu $1==4 && $2==2
  4051. with zero_const4
  4052. yields {zero_const, 0}
  4053. with any4
  4054. uses reusing %1, DD_REG4 = %1
  4055. yields %a.1
  4056. pat loc loc cui $1==2 && $2==4
  4057. with any2
  4058. uses DD_REG4={zero_const4,0}
  4059. gen move %1,%a.1 yields %a
  4060. pat loc loc cui $1==4 && $2==2
  4061. with DD_REG4
  4062. yields %1.1
  4063. pat loc loc cuu $1==2 && $2==4
  4064. with any2
  4065. uses reusing %1,DD_REG4
  4066. gen move %1,%a.1
  4067. and_l {const4,65535}, %a yields %a
  4068. with any2
  4069. uses DD_REG4={zero_const4,0}
  4070. gen move %1,%a.1 yields %a
  4071. pat loc loc cuu $1==4 && $2==2
  4072. with DD_REG4
  4073. yields %1.1
  4074. #endif
  4075. pat cuu
  4076. with STACK
  4077. kills ALL
  4078. gen jsr {absolute4, ".cuu"}
  4079. pat ciu leaving cuu
  4080. pat cui leaving cuu
  4081. #if TBL68881
  4082. pat loc loc cif $1==4 && $2==4
  4083. with data4 STACK
  4084. uses FS_REG
  4085. gen fmove_l %1,%a
  4086. fmove_s %a,{pre_dec4,sp}
  4087. pat loc loc cif $1==4 && $2==8
  4088. with data4 STACK
  4089. uses FD_REG
  4090. gen fmove_l %1,%a
  4091. fmove_d %a,{pre_dec4,sp}
  4092. pat loc loc cuf $1==4 && $2==4
  4093. with D_REG STACK
  4094. uses FS_REG
  4095. gen fmove_l %1,%a
  4096. tst_l %1
  4097. bge {slabel, 1f}
  4098. fsub_l {const,0-2147483648},%a
  4099. fsub_l {const,0-2147483648},%a
  4100. 1:
  4101. fmove_s %a,{pre_dec4,sp}
  4102. pat loc loc cuf $1==4 && $2==8
  4103. with D_REG STACK
  4104. uses FD_REG
  4105. gen fmove_l %1,%a
  4106. tst_l %1
  4107. bge {slabel, 1f}
  4108. fsub_l {const,0-2147483648},%a
  4109. fsub_l {const,0-2147483648},%a
  4110. 1:
  4111. fmove_d %a,{pre_dec4,sp}
  4112. pat loc loc cfi $1==4 && $2==4
  4113. with FS_REG
  4114. uses D_REG
  4115. gen fintrz %1,%1
  4116. fmove_l %1,%a yields %a
  4117. pat loc loc cfi $1==8 && $2==4
  4118. with FD_REG
  4119. uses D_REG
  4120. gen fintrz %1,%1
  4121. fmove_l %1,%a yields %a
  4122. pat loc loc cfu $1==4 && $2==4
  4123. with FS_REG
  4124. uses D_REG
  4125. gen fabs %1
  4126. fintrz %1,%1
  4127. fmove_l %1,%a yields %a
  4128. pat loc loc cfu $1==8 && $2==4
  4129. with FD_REG
  4130. uses D_REG
  4131. gen fabs %1
  4132. fintrz %1,%1
  4133. fmove_l %1,%a yields %a
  4134. pat loc loc cff $1==4 && $2==8
  4135. with FS_REG STACK
  4136. gen fmove_d %1,{pre_dec4,sp}
  4137. pat loc loc cff $1==8 && $2==4
  4138. with FD_REG STACK
  4139. gen fmove_s %1,{pre_dec4,sp}
  4140. #else
  4141. /*
  4142. * Floating point stuff
  4143. * Conversion
  4144. */
  4145. #if WORD_SIZE==2
  4146. /* The patterns need some room on the stack first */
  4147. pat loc loc cif $1==2 && $2==4 leaving loc $1 cal ".cif4"
  4148. pat loc loc cif $1==2 && $2==8
  4149. with any2
  4150. kills ALL
  4151. gen clr_l {pre_dec4, sp}
  4152. move_w %1,{pre_dec2, sp} leaving loc $1 cal ".cif8"
  4153. pat loc loc cif $1==4 && $2==4 leaving loc $1 cal ".cif4" asp 2
  4154. pat loc loc cif $1==4 && $2==8
  4155. with any4
  4156. kills ALL
  4157. gen clr_w {pre_dec2, sp}
  4158. move_l %1,{pre_dec4, sp} leaving loc $1 cal ".cif8"
  4159. pat loc loc cuf $1==2 && $2==4 leaving loc $1 cal ".cuf4"
  4160. pat loc loc cuf $1==2 && $2==8
  4161. with any2
  4162. kills ALL
  4163. gen clr_l {pre_dec4, sp}
  4164. move_w %1,{pre_dec2, sp} leaving loc $1 cal ".cuf8"
  4165. pat loc loc cuf $1==4 && $2==4 leaving loc $1 cal ".cuf4" asp 2
  4166. pat loc loc cuf $1==4 && $2==8
  4167. with any4
  4168. kills ALL
  4169. gen clr_w {pre_dec2, sp}
  4170. move_l %1,{pre_dec4, sp} leaving loc $1 cal ".cuf8"
  4171. pat loc loc cfi $1==4 && ($2==2 || $2==4)
  4172. leaving loc $1 loc $2 cal ".cfi" asp 8-$2
  4173. pat loc loc cfi $1==8 && ($2==2 || $2==4)
  4174. leaving loc $1 loc $2 cal ".cfi" asp 12-$2
  4175. pat loc loc cfu $1==4 && ($2==2 || $2==4)
  4176. leaving loc $1 loc $2 cal ".cfu" asp 8-$2
  4177. pat loc loc cfu $1==8 && ($2==2 || $2==4)
  4178. leaving loc $1 loc $2 cal ".cfu" asp 12-$2
  4179. #else
  4180. pat loc loc cif $1==4 && $2==4 leaving loc 4 cal ".cif4" asp 4
  4181. pat loc loc cif $1==4 && $2==8 leaving loc 4 cal ".cif8"
  4182. pat loc loc cuf $1==4 && $2==4 leaving loc 4 cal ".cuf4" asp 4
  4183. pat loc loc cuf $1==4 && $2==8 leaving loc 4 cal ".cuf8"
  4184. pat loc loc cfi leaving loc $1 loc $2 cal ".cfi" asp $1+4
  4185. pat loc loc cfu leaving loc $1 loc $2 cal ".cfu" asp $1+4
  4186. #endif
  4187. pat loc loc cff $1==8 && $2==4 leaving cal ".cff4" asp 4
  4188. pat loc loc cff $1==4 && $2==8
  4189. leaving zer 4 exg 4 cal ".cff8"
  4190. #endif /* TBL68881 */
  4191. /************************************************
  4192. * Group 9: logical instructions *
  4193. ************************************************/
  4194. #if WORD_SIZE==2
  4195. proc log2w
  4196. with datalt4+consts4-sconsts4 DD_REG4
  4197. gen xxx* %1, %2 yields %2
  4198. with DD_REG4 datalt4+consts4-sconsts4
  4199. gen xxx* %2, %1 yields %1
  4200. with exact any4 STACK
  4201. uses reusing %1,DD_REG4=%1
  4202. gen xxx* {post_inc4, sp}, %a yields %a
  4203. #endif
  4204. proc logw
  4205. with datalt_int+consts-sconsts DD_REG
  4206. gen xxx* %1, %2 yields %2
  4207. with DD_REG datalt_int+consts-sconsts
  4208. gen xxx* %2, %1 yields %1
  4209. with exact any_int STACK
  4210. uses reusing %1,DD_REG=%1
  4211. gen xxx* {post_inc_int, sp}, %a yields %a
  4212. proc logdef example and
  4213. with STACK
  4214. uses DD_REG4 = {const, $1/WORD_SIZE -1},
  4215. AA_REG,
  4216. DD_REG
  4217. gen
  4218. lea {regAcon, sp, $1}, %b
  4219. 1:
  4220. move_i {post_inc_int, sp}, %c
  4221. xxx* %c, {post_inc_int, %b}
  4222. dbf %a, {slabel, 1b}
  4223. proc logndef
  4224. with DD_REG4 STACK
  4225. uses AA_REG,
  4226. DD_REG
  4227. gen
  4228. lea {regAregXcon, sp, %1, 1, 0},%a
  4229. #if WORD_SIZE==2
  4230. asr_l {small_const, 1}, %1
  4231. #else
  4232. asr_l {small_const, 2}, %1
  4233. #endif
  4234. 1:
  4235. move_i {post_inc_int, sp}, %b
  4236. xxx* %b, {post_inc_int, %a}
  4237. sub_l {const4,1}, %1
  4238. bne {slabel, 1b}
  4239. proc logbdef example and
  4240. with STACK
  4241. uses AA_REG,
  4242. DD_REG,
  4243. DD_REG4
  4244. gen
  4245. move_l {const4,$1/WORD_SIZE}, %c
  4246. lea {regAregXcon, sp, %c, 1, 0},%a
  4247. 1:
  4248. move_i {post_inc_int, sp}, %b
  4249. xxx* %b, {post_inc_int, %a}
  4250. sub_l {const4,1}, %c
  4251. bne {slabel, 1b}
  4252. pat and $1==WORD_SIZE call logw(AND_I)
  4253. #if WORD_SIZE==2
  4254. pat and $1==2*WORD_SIZE call log2w("and.l")
  4255. #endif
  4256. pat and $1>4 && $1/WORD_SIZE<=65536 call logdef(AND_I)
  4257. pat and defined($1) call logbdef(AND_I)
  4258. pat and !defined($1) call logndef(AND_I)
  4259. pat ior $1==WORD_SIZE call logw(OR_I)
  4260. #if WORD_SIZE==2
  4261. pat ior $1==2*WORD_SIZE call log2w("or.l")
  4262. #endif
  4263. pat ior $1>2 && $1/WORD_SIZE<=65536 call logdef(OR_I)
  4264. pat ior defined($1) call logbdef(OR_I)
  4265. pat ior !defined($1) call logndef(OR_I)
  4266. #if WORD_SIZE==2
  4267. pat xor $1==2
  4268. with DD_REG conreg2-bconst
  4269. gen eor_w %2, %1 yields %1
  4270. #endif
  4271. pat xor $1==4
  4272. with DD_REG4 conreg4-bconst4
  4273. gen eor_l %2, %1 yields %1
  4274. pat xor $1>4 && $1/WORD_SIZE<=65536 call logdef(EOR_I)
  4275. pat xor defined($1) call logbdef(EOR_I)
  4276. pat xor !defined($1) call logndef(EOR_I)
  4277. #if WORD_SIZE==2
  4278. pat com $1==2
  4279. with DD_REG
  4280. gen not_w %1 yields %1
  4281. #endif
  4282. pat com $1==4
  4283. with DD_REG4
  4284. gen not_l %1 yields %1
  4285. pat com $1==8
  4286. with DD_REG4 DD_REG4
  4287. gen not_l %1
  4288. not_l %2 yields %2 %1
  4289. pat com $1>8 && $1/WORD_SIZE<=65536
  4290. with STACK
  4291. uses AA_REG,
  4292. DD_REG4 = {const, $1/WORD_SIZE -1}
  4293. gen move_l sp, %a
  4294. 1:
  4295. not_i {post_inc_int, %a}
  4296. dbf %b, {slabel, 1b}
  4297. pat com defined($1)
  4298. with STACK
  4299. uses AA_REG,
  4300. DD_REG4 = {const, $1/WORD_SIZE}
  4301. gen move_l sp, %a
  4302. 1:
  4303. not_i {post_inc_int, %a}
  4304. sub_l {const4, 1}, %b
  4305. bne {slabel, 1b}
  4306. pat com !defined($1)
  4307. with DD_REG4 STACK
  4308. uses AA_REG
  4309. gen move_l sp, %a
  4310. #if WORD_SIZE==2
  4311. asr_l {small_const, 1}, %1
  4312. #else
  4313. asr_l {small_const, 2}, %1
  4314. #endif
  4315. 1:
  4316. not_i {post_inc_int, %a}
  4317. sub_l {const4, 1}, %1
  4318. bne {slabel, 1b}
  4319. #if WORD_SIZE==2
  4320. pat rol $1==2
  4321. with shconreg DD_REG
  4322. gen rol_w %1, %2 yields %2
  4323. #endif
  4324. pat rol $1==4
  4325. with shconreg DD_REG4
  4326. gen rol_l %1, %2 yields %2
  4327. #if WORD_SIZE==2
  4328. pat ror $1==2
  4329. with shconreg DD_REG
  4330. gen ror_w %1, %2 yields %2
  4331. #endif
  4332. pat ror $1==4
  4333. with shconreg DD_REG4
  4334. gen ror_l %1, %2 yields %2
  4335. /************************************************
  4336. * Group 10: sets *
  4337. ************************************************/
  4338. #if WORD_SIZE==2
  4339. pat inn $1==4
  4340. with conreg2 DD_REG4
  4341. gen btst %1, %2.1
  4342. sne {dreg1, %2.1}
  4343. and_l {const4, 1}, %2
  4344. yields %2.1
  4345. #endif
  4346. pat inn $1==WORD_SIZE
  4347. with conreg2 DD_REG
  4348. gen btst %1, %2
  4349. sne {dreg1, %2}
  4350. and_i {const, 1}, %2
  4351. yields %2
  4352. /* The interface for the .inn differ for m68k2 and m68k4. */
  4353. /* ??? Work out a cleaner interface, that is similar for all tables */
  4354. #if WORD_SIZE==2
  4355. pat inn defined($1)
  4356. with STACK
  4357. kills ALL
  4358. gen move {const, $1}, d0
  4359. jsr {absolute4, ".inn"}
  4360. killreg d0
  4361. yields d0
  4362. pat inn !defined($1)
  4363. with any_int STACK
  4364. kills ALL
  4365. gen move %1, d0
  4366. jsr {absolute4, ".inn"}
  4367. killreg d0
  4368. yields d0
  4369. #else
  4370. pat inn defined($1)
  4371. with any_int STACK
  4372. kills ALL
  4373. gen move %1, d0
  4374. move {const, $1}, d1
  4375. jsr {absolute4, ".inn"}
  4376. killreg d0
  4377. yields d0
  4378. pat inn !defined($1)
  4379. with any_int any_int STACK
  4380. kills ALL
  4381. gen move %2, d0
  4382. move %1, d1
  4383. jsr {absolute4, ".inn"}
  4384. killreg d0
  4385. yields d0
  4386. #endif /* WORD_SIZE==2 */
  4387. pat loc inn $2==WORD_SIZE && small($1)
  4388. with DD_REG
  4389. gen asr_i {small_const, $1}, %1
  4390. and_i {const, 1}, %1
  4391. yields %1
  4392. #if WORD_SIZE==2
  4393. pat set $1==2
  4394. with conreg2
  4395. uses DD_REG = {zero_const, 0}
  4396. gen bset %1, %a yields %a
  4397. #endif
  4398. pat set $1==4
  4399. with conreg2
  4400. uses DD_REG4 = {zero_const4, 0}
  4401. gen bset %1, %a yields %a
  4402. #if WORD_SIZE==2
  4403. pat set $1>4
  4404. with any_int STACK
  4405. kills ALL
  4406. gen move {const, $1}, d0
  4407. jsr {absolute4, ".set"}
  4408. pat set !defined($1)
  4409. with any_int STACK
  4410. kills ALL
  4411. gen move %1, d0
  4412. jsr {absolute4, ".set"}
  4413. #else
  4414. pat set $1>4
  4415. with any_int STACK
  4416. kills ALL
  4417. gen move %1, d0
  4418. move {const, $1}, d1
  4419. jsr {absolute4, ".set"}
  4420. pat set !defined($1)
  4421. with any_int any_int STACK
  4422. kills ALL
  4423. gen move %2, d0
  4424. move %1, d1
  4425. jsr {absolute4, ".set"}
  4426. #endif /* WORD_SIZE==2 */
  4427. /************************************************
  4428. * Group 11: arrays *
  4429. ************************************************/
  4430. /* ??? interface */
  4431. #if WORD_SIZE==2
  4432. pat lar defined($1) && $1 == WORD_SIZE
  4433. with STACK
  4434. kills ALL
  4435. gen jsr {absolute4, ".lar"}
  4436. pat sar defined($1) && $1 == WORD_SIZE
  4437. with STACK
  4438. kills ALL
  4439. gen jsr {absolute4, ".sar"}
  4440. pat aar defined($1) && $1 == WORD_SIZE
  4441. with STACK
  4442. kills ALL
  4443. gen jsr {absolute4, ".aar"}
  4444. #else
  4445. pat lar defined($1)
  4446. with STACK
  4447. kills ALL
  4448. gen move {const, $1}, d0
  4449. jsr {absolute4, ".lar"}
  4450. pat lar !defined($1)
  4451. with any_int STACK
  4452. kills ALL
  4453. gen move %1, d0
  4454. jsr {absolute4, ".lar"}
  4455. pat sar defined($1)
  4456. with STACK
  4457. kills ALL
  4458. gen move {const, $1}, d0
  4459. jsr {absolute4, ".sar"}
  4460. pat sar !defined($1)
  4461. with any_int STACK
  4462. kills ALL
  4463. gen move %1, d0
  4464. jsr {absolute4, ".sar"}
  4465. pat aar defined($1)
  4466. with STACK
  4467. kills ALL
  4468. gen move {const, $1}, d0
  4469. jsr {absolute4, ".aar"}
  4470. yields a0
  4471. pat aar !defined($1)
  4472. with any_int STACK
  4473. kills ALL
  4474. gen move %1, d0
  4475. jsr {absolute4, ".aar"}
  4476. yields a0
  4477. #if ARR_OPT
  4478. pat lae lar $2==4 && nicesize(rom($1,3))
  4479. leaving lae $1 aar 4 loi rom($1, 3)
  4480. pat lae sar $2==4 && nicesize(rom($1,3))
  4481. leaving lae $1 aar 4 sti rom($1, 3)
  4482. pat lae aar $2==4 && rom($1,3)==1
  4483. leaving ads 4 adp 0-rom($1,1)
  4484. #ifdef TBL68020
  4485. pat lae aar $2==4 && nicesize(rom($1,3))
  4486. with D_REG yields {regX, rom($1,3), %1}
  4487. leaving ads 4 adp rom($1,3)*(0-rom($1,1))
  4488. #else TBL68020
  4489. pat lae aar $2==4 && rom($1,3)==2
  4490. with DD_REG
  4491. gen asl_l {small_const, 1}, %1
  4492. yields %1
  4493. leaving ads 4 adp (0 - rom($1,1))<<1
  4494. pat lae aar $2==4 && rom($1,3)==4
  4495. with DD_REG
  4496. gen asl_l {small_const, 2}, %1
  4497. yields %1
  4498. leaving ads 4 adp (0 - rom($1,1))<<2
  4499. pat lae aar $2==4 && rom($1,3)==8
  4500. with DD_REG
  4501. gen asl_l {small_const, 3}, %1
  4502. yields %1
  4503. leaving ads 4 adp (0 - rom($1,1))<<3
  4504. #endif TBL68020
  4505. #endif /* ARR_OPT */
  4506. #endif /* WORD_SIZE!=2 */
  4507. /* I WOULD ALSO LIKE THESE:
  4508. * pat lae aar $2==4 && defined(rom($1,3))
  4509. * with const leaving adp rom($1,3)*(%1.num-rom($1,1))
  4510. * pat lae lar $2==4 && defined(rom($1,3))
  4511. * with const leaving adp rom($1,3)*(%1.num-rom($1,1))
  4512. * loi rom($1,3)
  4513. * pat lae sar $2==4 && defined(rom($1,3))
  4514. * with const leaving adp rom($1,3)*(%1.num-rom($1,1))
  4515. * sti rom($1,3)
  4516. * BUT THEY DON'T WORK.
  4517. */
  4518. /************************************************
  4519. * Group 12: compare instructions *
  4520. ************************************************/
  4521. #if WORD_SIZE==2
  4522. pat cmi defined($1) && $1==2
  4523. with any2 DD_REG
  4524. uses DD_REG = {zero_const, 0}
  4525. gen cmp_w %1,%2
  4526. beq {slabel,2f}
  4527. bgt {slabel,1f}
  4528. add_w {small_const, 1},%a
  4529. bra {slabel,2f}
  4530. 1:
  4531. sub_w {small_const, 1},%a
  4532. 2:
  4533. yields %a
  4534. pat cmi defined($1) && $1==4
  4535. with STACK
  4536. gen jsr {absolute4, ".cmi"} yields d1
  4537. #else
  4538. /* pat cmi $1==4 leaving sbi 4
  4539. WRONG !!
  4540. */
  4541. pat cmi defined($1)
  4542. with STACK
  4543. kills ALL
  4544. gen move {const, $1}, d0
  4545. jsr {absolute4, ".cmi"}
  4546. yields d0
  4547. pat cmi !defined($1)
  4548. with any_int STACK
  4549. kills ALL
  4550. gen move %1, d0
  4551. jsr {absolute4, ".cmi"}
  4552. yields d0
  4553. #endif
  4554. /* pat cmu $1==4 leaving sbi 4
  4555. WRONG !!
  4556. */
  4557. #if WORD_SIZE==2
  4558. pat cmu defined($1)
  4559. with STACK
  4560. gen move {const, $1},d0
  4561. jsr {absolute4, ".cmu"}
  4562. pat cmu !defined($1)
  4563. with any STACK
  4564. gen move %1,d0
  4565. jsr {absolute4, ".cmu"}
  4566. #else
  4567. pat cmu defined($1)
  4568. with STACK
  4569. kills ALL
  4570. gen move {const, $1}, d0
  4571. jsr {absolute4, ".cmu"}
  4572. yields d0
  4573. pat cmu !defined($1)
  4574. with any_int STACK
  4575. kills ALL
  4576. gen move %1, d0
  4577. jsr {absolute4, ".cmu"}
  4578. yields d0
  4579. #endif /* WORD_SIZE==2 */
  4580. #if WORD_SIZE==2
  4581. pat cms $1==2 leaving cmi 2
  4582. pat cms $1==4 leaving cmi 4
  4583. #else
  4584. pat cms $1==4 leaving cmi 4
  4585. #endif
  4586. pat cms defined($1)
  4587. with STACK
  4588. kills ALL
  4589. gen move {const, $1}, d0
  4590. jsr {absolute4, ".cms"}
  4591. yields d0
  4592. pat cms !defined($1)
  4593. with any_int STACK
  4594. kills ALL
  4595. gen move %1, d0
  4596. jsr {absolute4, ".cms"}
  4597. yields d0
  4598. pat cmp leaving cmu 4
  4599. #ifndef XXXXX
  4600. proc txx
  4601. with test_set_int
  4602. uses reusing %1,DD_REG
  4603. gen test %1
  4604. bxx[1] {slabel,1f}
  4605. clr_i %a
  4606. bra {slabel,2f}
  4607. 1:
  4608. move_i {small_const,1},%a
  4609. 2:
  4610. yields %a
  4611. #if WORD_SIZE==2
  4612. with test_set1
  4613. #else
  4614. with test_set1 + test_set2
  4615. #endif
  4616. uses reusing %1,DD_REG
  4617. gen test %1
  4618. bxx[2] {slabel,1f}
  4619. clr_i %a
  4620. bra {slabel,2f}
  4621. 1:
  4622. move_i {small_const,1},%a
  4623. 2:
  4624. yields %a
  4625. /* for some branches, we need to get rid of the overflow bit first.
  4626. The easiest way to do this is to just test ....
  4627. */
  4628. proc txx_ouch
  4629. with test_set_int
  4630. uses reusing %1,DD_REG
  4631. gen killcc.
  4632. test %1
  4633. bxx[1] {slabel,1f}
  4634. clr_i %a
  4635. bra {slabel,2f}
  4636. 1:
  4637. move_i {small_const,1},%a
  4638. 2:
  4639. yields %a
  4640. #if WORD_SIZE==2
  4641. with test_set1
  4642. #else
  4643. with test_set1 + test_set2
  4644. #endif
  4645. uses reusing %1,DD_REG
  4646. gen test %1
  4647. bxx[2] {slabel,1f}
  4648. clr_i %a
  4649. bra {slabel,2f}
  4650. 1:
  4651. move_i {small_const,1},%a
  4652. 2:
  4653. yields %a
  4654. pat tlt call txx("bmi", "bcs")
  4655. pat tle call txx_ouch("ble", "bls")
  4656. pat teq call txx("beq", "beq")
  4657. pat tne call txx("bne", "bne")
  4658. pat tge call txx("bpl", "bcc")
  4659. pat tgt call txx_ouch("bgt", "bhi")
  4660. #else
  4661. proc txx
  4662. with test_set_int
  4663. uses reusing %1,DD_REG
  4664. gen test %1
  4665. sxx[1] %a
  4666. neg_b %a
  4667. yields {extend1, %a}
  4668. #if WORD_SIZE==2
  4669. with test_set1
  4670. #else
  4671. with test_set1 + test_set2
  4672. #endif
  4673. uses reusing %1,DD_REG
  4674. gen test %1
  4675. sxx[2] %a
  4676. neg_b %a
  4677. yields {extend1, %a}
  4678. pat tlt call txx("smi", "scs")
  4679. pat tle call txx("sle", "sls")
  4680. pat teq call txx("seq", "seq")
  4681. pat tne call txx("sne", "sne")
  4682. pat tge call txx("spl", "scc")
  4683. pat tgt call txx("sgt", "shi")
  4684. #endif
  4685. /*
  4686. * Floating point
  4687. * Comparision
  4688. */
  4689. #if TBL68881
  4690. pat cmf $1==4
  4691. with FS_REG FS_REG
  4692. uses D_REG={const,0}
  4693. gen fcmp %1,%2
  4694. fbeq {slabel,2f}
  4695. fblt {slabel,1f}
  4696. add_l {const,1},%a
  4697. bra {slabel,2f}
  4698. 1:
  4699. sub_l {const,1},%a
  4700. 2: yields %a
  4701. pat cmf $1==8
  4702. with FD_REG FD_REG
  4703. uses D_REG={const,0}
  4704. gen fcmp %1,%2
  4705. fbeq {slabel,2f}
  4706. fblt {slabel,1f}
  4707. add_l {const,1},%a
  4708. bra {slabel,2f}
  4709. 1:
  4710. sub_l {const,1},%a
  4711. 2: yields %a
  4712. #else
  4713. pat cmf $1==4 leaving cal ".cmf4" asp 8 lfr WORD_SIZE
  4714. pat cmf $1==8 leaving cal ".cmf8" asp 16 lfr WORD_SIZE
  4715. #endif
  4716. /*
  4717. * Floating Point
  4718. * Zero Constants
  4719. */
  4720. pat zrf leaving zer $1
  4721. /************************************************
  4722. * Group 13: branch instructions *
  4723. ************************************************/
  4724. #if WORD_SIZE==2
  4725. pat lab topeltsize($1)==4 && !fallthrough($1)
  4726. kills ALL
  4727. gen labeldef $1 yields dl0
  4728. pat lab topeltsize($1)==4 && fallthrough($1)
  4729. with any4 STACK
  4730. kills ALL
  4731. gen move %1, dl0
  4732. killreg dl0
  4733. labeldef $1 yields dl0
  4734. #endif
  4735. pat lab topeltsize($1)==WORD_SIZE && !fallthrough($1)
  4736. kills ALL
  4737. gen labeldef $1 yields d0
  4738. pat lab topeltsize($1)==WORD_SIZE && fallthrough($1)
  4739. with any_int STACK
  4740. kills ALL
  4741. gen move %1,d0
  4742. killreg d0
  4743. labeldef $1 yields d0
  4744. pat lab
  4745. with STACK
  4746. kills ALL
  4747. gen labeldef $1
  4748. #if WORD_SIZE==2
  4749. pat bra topeltsize($1)==4
  4750. with any4 STACK
  4751. gen move %1,dl0
  4752. bra {llabel, $1}
  4753. #endif
  4754. pat bra topeltsize($1)==WORD_SIZE
  4755. with any_int STACK
  4756. gen move %1,d0
  4757. bra {llabel, $1}
  4758. pat bra
  4759. with STACK
  4760. gen bra {llabel, $1}
  4761. proc brxx example beq
  4762. with exact extend1 extend1
  4763. kills ALL
  4764. gen cmp_b %1,%2
  4765. bxx[1] {llabel, $1}
  4766. #if WORD_SIZE!=2
  4767. with exact extend2 extend2
  4768. kills ALL
  4769. gen cmp_w %1,%2
  4770. bxx[1] {llabel, $1}
  4771. #endif
  4772. with exact sconsts any_int
  4773. kills ALL
  4774. uses DD_REG=%1
  4775. gen cmp_i %2, %a
  4776. bxx[2] {llabel, $1}
  4777. with exact any_int sconsts
  4778. kills ALL
  4779. uses DD_REG=%2
  4780. gen cmp_i %1, %a
  4781. bxx[1] {llabel, $1}
  4782. with any_int-sconsts genreg STACK
  4783. gen cmp_i %1, %2
  4784. bxx[1] {llabel, $1}
  4785. with genreg any_int-sconsts STACK
  4786. gen cmp_i %2, %1
  4787. bxx[2] {llabel, $1}
  4788. with exact immediate_int-sconsts imm_cmp_int
  4789. kills ALL
  4790. gen cmp_i %1, %2
  4791. bxx[1] {llabel, $1}
  4792. with exact imm_cmp_int immediate_int-sconsts
  4793. kills ALL
  4794. gen cmp_i %2, %1
  4795. bxx[2] {llabel, $1}
  4796. with exact immediate_int-sconsts STACK
  4797. gen cmp_i %1, {post_inc_int, sp}
  4798. bxx[1] {llabel, $1}
  4799. with exact any_int STACK
  4800. uses reusing %1,DD_REG=%1
  4801. gen cmp_i {post_inc_int, sp}, %a
  4802. bxx[2] {llabel, $1}
  4803. with exact STACK
  4804. uses DD_REG
  4805. gen move_i {post_inc_int, sp},%a
  4806. cmp_i {post_inc_int, sp},%a
  4807. bxx[2] {llabel, $1}
  4808. #if WORD_SIZE==4
  4809. with exact post_inc4 post_inc4
  4810. gen cmp_l %1,%2
  4811. bxx[1] {llabel, $1}
  4812. #endif
  4813. with exact post_inc2 post_inc2
  4814. gen cmp_w %1,%2
  4815. bxx[1] {llabel, $1}
  4816. with exact post_inc1 post_inc1
  4817. gen cmp_b %1,%2
  4818. bxx[1] {llabel, $1}
  4819. pat blt call brxx("blt","bgt")
  4820. pat ble call brxx("ble","bge")
  4821. pat beq call brxx("beq","beq")
  4822. pat bne call brxx("bne","bne")
  4823. pat bge call brxx("bge","ble")
  4824. pat bgt call brxx("bgt","blt")
  4825. proc zxx example zeq
  4826. with test_set_int STACK
  4827. gen test %1
  4828. bxx[1] {llabel, $1}
  4829. #if WORD_SIZE==2
  4830. with test_set1 STACK
  4831. #else
  4832. with test_set1 + test_set2 STACK
  4833. #endif
  4834. gen test %1
  4835. bxx[2] {llabel, $1}
  4836. with exact STACK
  4837. gen tst_i {post_inc_int, sp}
  4838. bxx[1] {llabel, $1}
  4839. /* for some branches, we need to get rid of the overflow bit first.
  4840. The easiest way to do this is to just test ....
  4841. */
  4842. proc zxx_ouch example zeq
  4843. with test_set_int STACK
  4844. gen killcc.
  4845. test %1
  4846. bxx[1] {llabel, $1}
  4847. #if WORD_SIZE==2
  4848. with test_set1 STACK
  4849. #else
  4850. with test_set1 + test_set2 STACK
  4851. #endif
  4852. gen test %1
  4853. bxx[2] {llabel, $1}
  4854. with exact STACK
  4855. gen tst_i {post_inc_int, sp}
  4856. bxx[1] {llabel, $1}
  4857. pat zlt call zxx("bmi", "bcs")
  4858. pat zle call zxx_ouch("ble", "bls")
  4859. pat zeq call zxx("beq", "beq")
  4860. pat zne call zxx("bne", "bne")
  4861. pat zge call zxx("bpl", "bcc")
  4862. pat zgt call zxx_ouch("bgt", "bhi")
  4863. /************************************************
  4864. * Group 14: procedure calls instructions *
  4865. ************************************************/
  4866. pat cai
  4867. with exact ext_addr
  4868. kills ALL
  4869. gen jsr {absolute4, %1.bd}
  4870. with A_REG STACK
  4871. kills ALL
  4872. gen jsr {indirect4, %1}
  4873. with STACK
  4874. kills ALL
  4875. uses AA_REG = {post_inc4, sp}
  4876. gen jsr {indirect4, %a}
  4877. with address STACK
  4878. kills ALL
  4879. gen jsr %1
  4880. pat cal
  4881. with STACK
  4882. kills ALL
  4883. gen jsr {absolute4, $1}
  4884. #if WORD_SIZE==2
  4885. pat lfr $1==2 yields d0
  4886. pat lfr $1==4 yields dl0
  4887. pat lfr $1==8 yields dl1 dl0
  4888. #else
  4889. pat lfr $1==4 yields d0
  4890. pat lfr $1==8 yields d1 d0
  4891. #endif
  4892. pat ret $1==0
  4893. gen return
  4894. pat asp ret $2==0
  4895. gen return
  4896. #if WORD_SIZE==2
  4897. pat ret $1==2
  4898. with any2
  4899. gen move %1, d0
  4900. return
  4901. with exact STACK
  4902. gen move_w {post_inc2, sp}, d0
  4903. return
  4904. #endif
  4905. pat ret $1==4
  4906. with any4
  4907. gen move %1, dl0
  4908. return
  4909. with exact STACK
  4910. gen move_l {post_inc4, sp}, dl0
  4911. return
  4912. pat ret $1==8
  4913. with any4 any4
  4914. gen move %1, dl0
  4915. move %2, dl1
  4916. return
  4917. with exact any4 STACK
  4918. gen move %1, dl0
  4919. move_l {post_inc4, sp}, dl1
  4920. return
  4921. with exact STACK
  4922. gen move_l {post_inc4, sp}, dl0
  4923. move_l {post_inc4, sp}, dl1
  4924. return
  4925. /************************************************
  4926. * Group 15: miscellaneous instructions *
  4927. ************************************************/
  4928. #if WORD_SIZE==2
  4929. pat asp $1==2
  4930. with any2-pre_post
  4931. with STACK
  4932. gen add_l {const4, $1}, sp
  4933. #endif
  4934. pat asp $1==4
  4935. #if WORD_SIZE==2
  4936. with any-pre_post any-pre_post
  4937. #endif
  4938. with any4-pre_post
  4939. with STACK
  4940. gen add_l {const4, $1}, sp
  4941. #if WORD_SIZE==2
  4942. pat asp $1==6
  4943. with any4-pre_post any-pre_post
  4944. with any-pre_post any4-pre_post
  4945. with any-pre_post any-pre_post any-pre_post
  4946. with STACK
  4947. gen add_l {const4, $1}, sp
  4948. #endif
  4949. pat asp $1==8
  4950. with any4-pre_post any4-pre_post
  4951. with STACK
  4952. gen add_l {const4, $1}, sp
  4953. pat asp
  4954. with STACK
  4955. gen lea {regAcon, sp, $1}, sp
  4956. /* ??? DD_REG$ ??? */
  4957. #if WORD_SIZE==2
  4958. pat ass $1==2
  4959. with any2 STACK
  4960. uses reusing %1,DD_REG4
  4961. gen move %1,%a.1
  4962. ext_l %a.1
  4963. add_l %a, sp
  4964. #endif
  4965. pat ass $1==4
  4966. with any4 STACK
  4967. gen add_l %1, sp
  4968. #if WORD_SIZE==2
  4969. pat blm $1==2
  4970. with A_REG A_REG
  4971. kills allexceptcon
  4972. gen move_w {indirect2, %2}, {indirect2, %1}
  4973. #endif
  4974. pat blm $1==4
  4975. with A_REG A_REG
  4976. kills allexceptcon
  4977. gen move_l {indirect4, %2}, {indirect4, %1}
  4978. #if WORD_SIZE==2
  4979. pat blm $1==6
  4980. with A_REG A_REG
  4981. kills allexceptcon
  4982. gen move_l {indirect4, %2}, {indirect4, %1}
  4983. move_w {offsetted2, %2, 4}, {offsetted2, %1, 4}
  4984. #endif
  4985. pat blm $1==8
  4986. with A_REG A_REG
  4987. kills allexceptcon
  4988. gen move_l {indirect4, %2}, {indirect4, %1}
  4989. move_l {offsetted4, %2, 4}, {offsetted4, %1, 4}
  4990. pat blm $1>2*WORD_SIZE && $1/WORD_SIZE <= 65536
  4991. with AA_REG AA_REG
  4992. kills ALL
  4993. uses DD_REG4={const, $1/WORD_SIZE -1}
  4994. gen 1:
  4995. move_i {post_inc_int, %2}, {post_inc_int, %1}
  4996. dbf %a, {slabel, 1b}
  4997. pat blm
  4998. with AA_REG AA_REG
  4999. kills ALL
  5000. uses DD_REG4={const,$1/WORD_SIZE}
  5001. gen 1:
  5002. move_i {post_inc_int, %2}, {post_inc_int, %1}
  5003. sub_l {const4, 1}, %a
  5004. bne {slabel, 1b}
  5005. #if WORD_SIZE==2
  5006. pat bls $1==2
  5007. with DD_REG AA_REG AA_REG
  5008. kills ALL
  5009. gen asr_w {small_const, 1}, %1
  5010. beq {slabel, 2f}
  5011. 1:
  5012. move_w {post_inc2, %3}, {post_inc2, %2}
  5013. sub_w {const, 1}, %1
  5014. bne {slabel, 1b}
  5015. 2:
  5016. #endif
  5017. pat bls $1==4
  5018. with DD_REG4 AA_REG AA_REG
  5019. kills ALL
  5020. gen
  5021. #if WORD_SIZE==2
  5022. asr_l {small_const, 1}, %1
  5023. #else
  5024. asr_l {small_const, 2}, %1
  5025. #endif
  5026. beq {slabel, 2f}
  5027. 1:
  5028. move_i {post_inc_int, %3}, {post_inc_int, %2}
  5029. sub_l {const4, 1}, %1
  5030. bne {slabel, 1b}
  5031. 2:
  5032. #if WORD_SIZE==2
  5033. pat csa $1==2
  5034. #if TBL68020
  5035. with any4 D_REG+LOCAL+const+ILOCAL+absolute2 STACK
  5036. #else
  5037. with any4 D_REG+LOCAL+const+absolute2 STACK
  5038. #endif
  5039. gen move %1,a0
  5040. move %2,d0
  5041. jmp {absolute4, ".csa2"}
  5042. #endif
  5043. pat csa $1==4
  5044. #if TBL68020 && WORD_SIZE==4
  5045. with any4 D_REG4+DLOCAL+const4+ILOCAL+absolute4 STACK
  5046. #else
  5047. with any4 D_REG4+DLOCAL+const4+absolute4 STACK
  5048. #endif
  5049. gen move %1,a0
  5050. move %2,dl0
  5051. jmp {absolute4, ".csa4"}
  5052. #if WORD_SIZE==2
  5053. pat csb $1==2
  5054. #if TBL68020
  5055. with any4 D_REG+LOCAL+const+ILOCAL+absolute2 STACK
  5056. #else
  5057. with any4 D_REG+LOCAL+const+absolute2 STACK
  5058. #endif
  5059. gen move %1,a0
  5060. move %2,d0
  5061. jmp {absolute4, ".csb2"}
  5062. #endif
  5063. pat csb $1==4
  5064. #if TBL68020 && WORD_SIZE==4
  5065. with any4 D_REG4+DLOCAL+const4+ILOCAL+absolute4 STACK
  5066. #else
  5067. with any4 D_REG4+DLOCAL+const4+absolute4 STACK
  5068. #endif
  5069. gen move %1,a0
  5070. move %2,dl0
  5071. jmp {absolute4, ".csb4"}
  5072. pat dch leaving loi 4
  5073. #if WORD_SIZE==2
  5074. pat dup $1==2
  5075. with dups2 yields %1 %1
  5076. #endif
  5077. pat dup $1==4
  5078. #if WORD_SIZE==2
  5079. with dups2 dups2 yields %2 %1 %2 %1
  5080. #endif
  5081. with dups4 yields %1 %1
  5082. pat dup $1==8
  5083. with dups4 dups4 yields %2 %1 %2 %1
  5084. pat dup $1>2*WORD_SIZE && $1/WORD_SIZE<=65536
  5085. with STACK
  5086. uses DD_REG4 = {const, $1/WORD_SIZE -1}
  5087. gen 1:
  5088. move_i {offsetted_int, sp, $1 -WORD_SIZE}, {pre_dec_int, sp}
  5089. dbf %a, {slabel, 1b}
  5090. pat dup
  5091. with STACK
  5092. uses DD_REG4 = {const, $1/WORD_SIZE}
  5093. gen 1:
  5094. move_i {offsetted_int, sp, $1 -WORD_SIZE}, {pre_dec_int, sp}
  5095. sub_l {const4, 1}, %a
  5096. bne {slabel, 1b}
  5097. #if WORD_SIZE==2
  5098. pat dus $1==2
  5099. with any2 STACK
  5100. uses DD_REG4 = {zero_const4, 0}, AA_REG
  5101. gen
  5102. move_w %1, %a.1
  5103. lea {regAregXcon, sp, %a, 1, 0}, %b
  5104. asr_l {small_const, 1}, %a
  5105. beq {slabel, 2f}
  5106. 1:
  5107. move_w {pre_dec2, %b}, {pre_dec2, sp}
  5108. sub_l {const4, 1}, %a
  5109. bne {slabel, 1b}
  5110. 2:
  5111. #endif
  5112. pat dus $1==4
  5113. with DD_REG4 STACK
  5114. uses AA_REG
  5115. gen
  5116. lea {regAregXcon, sp, %1, 1, 0}, %a
  5117. #if WORD_SIZE==2
  5118. asr_l {small_const, 1}, %1
  5119. #else
  5120. asr_l {small_const, 2}, %1
  5121. #endif
  5122. beq {slabel, 2f}
  5123. 1:
  5124. move_i {pre_dec_int, %a}, {pre_dec_int, sp}
  5125. sub_l {const4, 1}, %1
  5126. bne {slabel, 1b}
  5127. 2:
  5128. #if WORD_SIZE==2
  5129. pat exg $1==2
  5130. with any2 any2 yields %1 %2
  5131. #endif
  5132. pat exg $1==4
  5133. with any4 any4 yields %1 %2
  5134. pat exg defined($1)
  5135. with STACK
  5136. kills ALL
  5137. gen move {const, $1}, d0
  5138. jsr {absolute4, ".exg"}
  5139. pat exg !defined($1)
  5140. with any_int STACK
  5141. kills ALL
  5142. gen move %1, d0
  5143. jsr {absolute4, ".exg"}
  5144. pat fil
  5145. gen move_l {ext_addr, $1}, {absolute4, ".filn"}
  5146. pat gto
  5147. with STACK
  5148. uses AA_REG = {ext_addr, $1}
  5149. gen move_l {offsetted4, %a, 8}, lb
  5150. move_l {offsetted4, %a, 4}, sp
  5151. #if TBL68020 && FANCY_MODES
  5152. jmp {OFF_off4, %a, 0, 0}
  5153. #else
  5154. move_l {indirect4, %a}, %a
  5155. jmp {indirect4, %a}
  5156. #endif
  5157. pat lim yields {absolute_int, ".trpim"}
  5158. pat lin
  5159. kills posextern
  5160. gen move_i {const, $1}, {absolute_int, ".lino"}
  5161. pat lni
  5162. kills posextern
  5163. gen add_i {const, 1}, {absolute_int, ".lino"}
  5164. pat lor $1==0 yields lb
  5165. pat lor $1==1
  5166. with STACK
  5167. uses AA_REG = sp yields %a
  5168. pat lor $1==2 yields {absolute4, ".reghp"}
  5169. pat lpb leaving adp 8
  5170. pat mon
  5171. with STACK
  5172. kills ALL
  5173. gen jsr {absolute4, ".mon"}
  5174. /* used by the ANSI-compiler to indicate volatile */
  5175. pat nop
  5176. with STACK
  5177. kills ALL
  5178. /* gen jsr {absolute4, ".nop"} */
  5179. #if WORD_SIZE==2
  5180. #ifdef TBL68020
  5181. pat rck $1==2
  5182. with ext_addr D_REG
  5183. gen cmp2_w {absolute2, %1.bd}, %2
  5184. bcc {slabel, 1f}
  5185. move_w {small_const, 1}, {pre_dec2, sp} /* push constant 1 == ERANGE */
  5186. jsr {absolute4, ".trp"}
  5187. 1: yields %2
  5188. with address-ext_addr D_REG
  5189. gen cmp2_w %1, %2
  5190. bcc {slabel, 1f}
  5191. move_w {small_const, 1}, {pre_dec2, sp} /* push constant 1 == ERANGE */
  5192. jsr {absolute4, ".trp"}
  5193. 1: yields %2
  5194. with A_REG D_REG
  5195. gen cmp2_w {indirect2, %1}, %2
  5196. bcc {slabel, 1f}
  5197. move_w {small_const, 1}, {pre_dec2, sp} /* push constant 1 == ERANGE */
  5198. jsr {absolute4, ".trp"}
  5199. 1: yields %2
  5200. #else
  5201. with STACK
  5202. kills ALL
  5203. gen jsr {absolute4, ".rck"}
  5204. #endif
  5205. #endif /* WORD_SIZE==2 */
  5206. #if WORD_SIZE==4 || TBL68020
  5207. pat rck $1==4
  5208. #ifdef TBL68020
  5209. with ext_addr D_REG4
  5210. gen cmp2_l {absolute4, %1.bd}, %2
  5211. bcc {slabel, 1f}
  5212. pea {absolute4, 1} /* push constant 1 == ERANGE */
  5213. jsr {absolute4, ".trp"}
  5214. 1: yields %2
  5215. with address-ext_addr D_REG4
  5216. gen cmp2_l %1, %2
  5217. bcc {slabel, 1f}
  5218. pea {absolute4, 1} /* push constant 1 == ERANGE */
  5219. jsr {absolute4, ".trp"}
  5220. 1: yields %2
  5221. with A_REG D_REG4
  5222. gen cmp2_l {indirect4, %1}, %2
  5223. bcc {slabel, 1f}
  5224. pea {absolute4, 1} /* push constant 1 == ERANGE */
  5225. jsr {absolute4, ".trp"}
  5226. 1: yields %2
  5227. #else TBL68020
  5228. with STACK
  5229. kills ALL
  5230. gen jsr {absolute4, ".rck"}
  5231. #endif TBL68020
  5232. #endif /* WORD_SIZE==4 || TBL68020 */
  5233. pat rtt leaving ret 0
  5234. pat sig
  5235. with any4
  5236. kills posextern
  5237. uses AA_REG
  5238. gen move_l {absolute4, ".trppc"}, %a
  5239. move_l %1, {absolute4, ".trppc"}
  5240. yields %a
  5241. pat sim
  5242. with any_int
  5243. kills posextern
  5244. gen move_i %1, {absolute_int, ".trpim"}
  5245. pat str $1==0
  5246. with any4 STACK
  5247. kills ALL
  5248. gen move_l %1, lb
  5249. pat str $1==1
  5250. with any4 STACK
  5251. gen move_l %1, sp
  5252. pat str $1==2
  5253. with STACK
  5254. kills ALL
  5255. gen jsr {absolute4, ".strhp"}
  5256. pat trp
  5257. with STACK
  5258. kills ALL
  5259. gen jsr {absolute4, ".trp"}
  5260. /************************************************
  5261. * more rules for long EM-patterns *
  5262. ************************************************/
  5263. pat loe ine $1==$2
  5264. kills posextern
  5265. uses DD_REG = {absolute_int, $1}
  5266. gen add_i {const,1}, {absolute_int, $1}
  5267. killreg %a
  5268. yields %a
  5269. pat loe dee $1==$2
  5270. kills posextern
  5271. uses DD_REG = {absolute_int, $1}
  5272. gen sub_i {const,1}, {absolute_int, $1}
  5273. killreg %a
  5274. yields %a
  5275. proc llol1shstl example lol loc sli stl /* only left */
  5276. kills all_indir, DLOCAL %bd==$1
  5277. gen shw* {offsetted2, lb, $1+2}
  5278. roxl {offsetted2, lb, $1}
  5279. proc lloe1shste example loe loc sli ste /* only left */
  5280. kills posextern
  5281. gen shw* {absolute2, $1+2}
  5282. roxl {absolute2, $1}
  5283. proc llil1shsil example lil loc sli sil /* only left */
  5284. kills allexceptcon
  5285. #if TBL68020 && FANCY_MODES
  5286. gen shw* {OFF_off2, lb, $1, 2}
  5287. roxl {OFF_off2, lb, $1, 0}
  5288. #else
  5289. uses AA_REG = {DLOCAL, $1}
  5290. gen shw* {offsetted2, %a, 2}
  5291. roxl {indirect2, %a}
  5292. #endif
  5293. proc rlol1shstl example lol loc sri stl /* only right */
  5294. kills all_indir, DLOCAL %bd==$1
  5295. gen shw* {offsetted2, lb, $1}
  5296. roxr {offsetted2, lb, $1+2}
  5297. proc rloe1shste example loe loc sri ste /* only right */
  5298. kills posextern
  5299. gen shw* {absolute2, $1}
  5300. roxr {absolute2, $1+2}
  5301. proc rlil1shsil example lil loc sri sil /* only right */
  5302. kills allexceptcon
  5303. #if TBL68020 && FANCY_MODES
  5304. gen shw* {OFF_off2, lb, $1, 0}
  5305. roxr {OFF_off2, lb, $1, 2}
  5306. #else
  5307. uses AA_REG = {DLOCAL, $1}
  5308. gen shw* {indirect2, %a}
  5309. roxr {offsetted2, %a, 2}
  5310. #endif
  5311. pat lol loc sli stl $1==$4 && $2==1 && $3==4 call llol1shstl("asl #1,")
  5312. pat loe loc sli ste $1==$4 && $2==1 && $3==4 call lloe1shste("asl #1,")
  5313. pat lil loc sli sil $1==$4 && $2==1 && $3==4 call llil1shsil("asl #1,")
  5314. pat lol loc sri stl $1==$4 && $2==1 && $3==4 call rlol1shstl("asr #1,")
  5315. pat loe loc sri ste $1==$4 && $2==1 && $3==4 call rloe1shste("asr #1,")
  5316. pat lil loc sri sil $1==$4 && $2==1 && $3==4 call rlil1shsil("asr #1,")
  5317. pat lol loc slu stl $1==$4 && $2==1 && $3==4 call llol1shstl("asl #1,")
  5318. pat loe loc slu ste $1==$4 && $2==1 && $3==4 call lloe1shste("asl #1,")
  5319. pat lil loc slu sil $1==$4 && $2==1 && $3==4 call llil1shsil("asl #1,")
  5320. pat lol loc sru stl $1==$4 && $2==1 && $3==4 call rlol1shstl("lsr #1,")
  5321. pat loe loc sru ste $1==$4 && $2==1 && $3==4 call rloe1shste("lsr #1,")
  5322. pat lil loc sru sil $1==$4 && $2==1 && $3==4 call rlil1shsil("lsr #1,")
  5323. proc txxand
  5324. with test_set_int DD_REG
  5325. gen test %1
  5326. bxx[1] {slabel, 1f}
  5327. bclr {const,0}, %2
  5328. 1: yields %2
  5329. #if WORD_SIZE==2
  5330. with test_set1 DD_REG
  5331. #else
  5332. with test_set1 + test_set2 DD_REG
  5333. #endif
  5334. gen test %1
  5335. bxx[2] {slabel, 1f}
  5336. bclr {const,0}, %2
  5337. 1: yields %2
  5338. proc txxior
  5339. with test_set_int DD_REG
  5340. gen test %1
  5341. bxx[1] {slabel, 1f}
  5342. bset {zero_const, 0}, %2
  5343. 1: yields %2
  5344. #if WORD_SIZE==2
  5345. with test_set1 DD_REG
  5346. #else
  5347. with test_set1 + test_set2 DD_REG
  5348. #endif
  5349. gen test %1
  5350. bxx[2] {slabel, 1f}
  5351. bset {zero_const, 0}, %2
  5352. 1: yields %2
  5353. proc txxand_ouch
  5354. with test_set_int DD_REG
  5355. gen killcc.
  5356. test %1
  5357. bxx[1] {slabel, 1f}
  5358. bclr {const,0}, %2
  5359. 1: yields %2
  5360. #if WORD_SIZE==2
  5361. with test_set1 DD_REG
  5362. #else
  5363. with test_set1 + test_set2 DD_REG
  5364. #endif
  5365. gen test %1
  5366. bxx[2] {slabel, 1f}
  5367. bclr {const,0}, %2
  5368. 1: yields %2
  5369. proc txxior_ouch
  5370. with test_set_int DD_REG
  5371. gen killcc.
  5372. test %1
  5373. bxx[1] {slabel, 1f}
  5374. bset {zero_const, 0}, %2
  5375. 1: yields %2
  5376. #if WORD_SIZE==2
  5377. with test_set1 DD_REG
  5378. #else
  5379. with test_set1 + test_set2 DD_REG
  5380. #endif
  5381. gen test %1
  5382. bxx[2] {slabel, 1f}
  5383. bset {zero_const, 0}, %2
  5384. 1: yields %2
  5385. pat tlt and $2==WORD_SIZE call txxand("bmi", "bcs")
  5386. pat tle and $2==WORD_SIZE call txxand_ouch("ble", "bls")
  5387. pat teq and $2==WORD_SIZE call txxand("beq", "beq")
  5388. pat tne and $2==WORD_SIZE call txxand("bne", "bne")
  5389. pat tge and $2==WORD_SIZE call txxand("bpl", "bcc")
  5390. pat tgt and $2==WORD_SIZE call txxand_ouch("bgt", "bhi")
  5391. pat tlt ior $2==WORD_SIZE call txxior("bpl", "bcc")
  5392. pat tle ior $2==WORD_SIZE call txxior_ouch("bgt", "bhi")
  5393. pat teq ior $2==WORD_SIZE call txxior("bne", "bne")
  5394. pat tne ior $2==WORD_SIZE call txxior("beq", "beq")
  5395. pat tge ior $2==WORD_SIZE call txxior("bmi", "bcs")
  5396. pat tgt ior $2==WORD_SIZE call txxior_ouch("ble", "bls")
  5397. proc cmxtxxand
  5398. with exact extend1 extend1 DD_REG
  5399. gen cmp_b %2, %1
  5400. bxx[2] {llabel,1f}
  5401. bclr {const,0}, %3
  5402. 1: yields %3
  5403. with exact extend2 extend2 DD_REG
  5404. gen cmp_w %2, %1
  5405. bxx[2] {llabel,1f}
  5406. bclr {const,0}, %3
  5407. 1: yields %3
  5408. with exact sconsts any_int DD_REG
  5409. uses DD_REG=%1
  5410. gen cmp_i %2, %a
  5411. bxx[2] {slabel, 1f}
  5412. bclr {const,0}, %3
  5413. 1: yields %3
  5414. with exact any_int sconsts DD_REG
  5415. uses DD_REG=%2
  5416. gen cmp_i %1, %a
  5417. bxx[1] {slabel, 1f}
  5418. bclr {const,0}, %3
  5419. 1: yields %3
  5420. with any_int-sconsts genreg DD_REG
  5421. gen cmp_i %1, %2
  5422. bxx[1] {slabel, 1f}
  5423. bclr {const,0}, %3
  5424. 1: yields %3
  5425. with genreg any_int-sconsts DD_REG
  5426. gen cmp_i %2, %1
  5427. bxx[2] {slabel, 1f}
  5428. bclr {const,0}, %3
  5429. 1: yields %3
  5430. with exact immediate_int-sconsts imm_cmp_int DD_REG
  5431. gen cmp_i %1, %2
  5432. bxx[1] {slabel, 1f}
  5433. bclr {const,0}, %3
  5434. 1: yields %3
  5435. with exact imm_cmp_int immediate_int-sconsts DD_REG
  5436. gen cmp_i %2, %1
  5437. bxx[2] {slabel, 1f}
  5438. bclr {const,0}, %3
  5439. 1: yields %3
  5440. proc cmxtxxior
  5441. with exact extend1 extend1 DD_REG
  5442. gen cmp_b %2, %1
  5443. bxx[2] {llabel,1f}
  5444. bset {zero_const, 0}, %3
  5445. 1: yields %3
  5446. with exact extend2 extend2 DD_REG
  5447. gen cmp_w %2, %1
  5448. bxx[2] {llabel,1f}
  5449. bset {zero_const, 0}, %3
  5450. 1: yields %3
  5451. with exact sconsts any_int DD_REG
  5452. uses DD_REG=%1
  5453. gen cmp_i %2, %a
  5454. bxx[2] {slabel, 1f}
  5455. bset {zero_const, 0}, %3
  5456. 1: yields %3
  5457. with exact any_int sconsts DD_REG
  5458. uses DD_REG=%2
  5459. gen cmp_i %1, %a
  5460. bxx[1] {slabel, 1f}
  5461. bset {zero_const, 0}, %3
  5462. 1: yields %3
  5463. with any_int-sconsts genreg DD_REG
  5464. gen cmp_i %1, %2
  5465. bxx[1] {slabel, 1f}
  5466. bset {zero_const, 0}, %3
  5467. 1: yields %3
  5468. with genreg any_int-sconsts DD_REG
  5469. gen cmp_i %2, %1
  5470. bxx[2] {slabel, 1f}
  5471. bset {zero_const, 0}, %3
  5472. 1: yields %3
  5473. with exact immediate_int-sconsts imm_cmp_int DD_REG
  5474. gen cmp_i %1, %2
  5475. bxx[1] {slabel, 1f}
  5476. bset {zero_const, 0}, %3
  5477. 1: yields %3
  5478. with exact imm_cmp_int immediate_int-sconsts DD_REG
  5479. gen cmp_i %2, %1
  5480. bxx[2] {slabel, 1f}
  5481. bset {zero_const, 0}, %3
  5482. 1: yields %3
  5483. proc cmxtxx
  5484. with exact sconsts any_int
  5485. uses DD_REG=%1
  5486. gen cmp_i %2, %a
  5487. sxx[2] %a
  5488. neg_b %a
  5489. yields {extend1, %a}
  5490. with exact any_int sconsts
  5491. uses DD_REG=%2
  5492. gen cmp_i %1, %a
  5493. sxx[1] %a
  5494. neg_b %a
  5495. yields {extend1, %a}
  5496. with any_int-sconsts genreg
  5497. uses reusing %1,reusing %2,DD_REG
  5498. gen cmp_i %1, %2
  5499. sxx[1] %a
  5500. neg_b %a
  5501. yields {extend1, %a}
  5502. with genreg any_int-sconsts
  5503. uses reusing %1,reusing %2,DD_REG
  5504. gen cmp_i %2, %1
  5505. sxx[2] %a
  5506. neg_b %a
  5507. yields {extend1, %a}
  5508. with exact extend1 extend1
  5509. uses reusing %1,reusing %2,DD_REG
  5510. gen cmp_b %2, %1
  5511. sxx[2] %a
  5512. neg_b %a
  5513. yields {extend1, %a}
  5514. with exact extend2 extend2
  5515. uses reusing %1,reusing %2,DD_REG
  5516. gen cmp_w %2, %1
  5517. sxx[2] %a
  5518. neg_b %a
  5519. yields {extend1, %a}
  5520. with exact immediate_int-sconsts imm_cmp_int
  5521. uses reusing %2,DD_REG
  5522. gen cmp_i %1, %2
  5523. sxx[1] %a
  5524. neg_b %a
  5525. yields {extend1, %a}
  5526. with exact imm_cmp_int immediate_int-sconsts
  5527. uses reusing %1,DD_REG
  5528. gen cmp_i %2, %1
  5529. sxx[2] %a
  5530. neg_b %a
  5531. yields {extend1, %a}
  5532. with exact immediate_int-sconsts STACK
  5533. uses DD_REG
  5534. gen cmp_i %1, {post_inc_int, sp}
  5535. sxx[1] %a
  5536. neg_b %a
  5537. yields {extend1, %a}
  5538. with exact any_int STACK
  5539. uses reusing %1,DD_REG=%1
  5540. gen cmp_i {post_inc_int, sp}, %a
  5541. sxx[2] %a
  5542. neg_b %a
  5543. yields {extend1, %a}
  5544. with exact STACK
  5545. uses DD_REG
  5546. gen move_i {post_inc_int, sp},%a
  5547. cmp_i {post_inc_int, sp},%a
  5548. sxx[2] %a
  5549. neg_b %a
  5550. yields {extend1, %a}
  5551. pat cmi tlt and $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxand("blt","bgt")
  5552. pat cmi tle and $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxand("ble","bge")
  5553. pat cmi teq and $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxand("beq","beq")
  5554. pat cmi tne and $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxand("bne","bne")
  5555. pat cmi tge and $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxand("bge","ble")
  5556. pat cmi tgt and $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxand("bgt","blt")
  5557. pat cmu tlt and $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxand("bcs","bhi")
  5558. pat cmu tle and $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxand("bls","bcc")
  5559. pat cmu teq and $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxand("beq","beq")
  5560. pat cmu tne and $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxand("bne","bne")
  5561. pat cmu tge and $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxand("bcc","bls")
  5562. pat cmu tgt and $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxand("bhi","bcs")
  5563. pat cmi tlt ior $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxior("bge","ble")
  5564. pat cmi tle ior $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxior("bgt","blt")
  5565. pat cmi teq ior $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxior("bne","bne")
  5566. pat cmi tne ior $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxior("beq","beq")
  5567. pat cmi tge ior $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxior("blt","bgt")
  5568. pat cmi tgt ior $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxior("ble","bge")
  5569. pat cmu tlt ior $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxior("bcc","bls")
  5570. pat cmu tle ior $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxior("bhi","bcs")
  5571. pat cmu teq ior $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxior("bne","bne")
  5572. pat cmu tne ior $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxior("beq","beq")
  5573. pat cmu tge ior $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxior("bcs","bhi")
  5574. pat cmu tgt ior $1==WORD_SIZE && $3==WORD_SIZE call cmxtxxior("bls","bcc")
  5575. pat cmi tlt $1==WORD_SIZE call cmxtxx("slt","sgt")
  5576. pat cmi tle $1==WORD_SIZE call cmxtxx("sle","sge")
  5577. pat cmi teq $1==WORD_SIZE call cmxtxx("seq","seq")
  5578. pat cmi tne $1==WORD_SIZE call cmxtxx("sne","sne")
  5579. pat cmi tge $1==WORD_SIZE call cmxtxx("sge","sle")
  5580. pat cmi tgt $1==WORD_SIZE call cmxtxx("sgt","slt")
  5581. pat cmu tlt $1==WORD_SIZE call cmxtxx("scs","shi")
  5582. pat cmu tle $1==WORD_SIZE call cmxtxx("sls","scc")
  5583. pat cmu teq $1==WORD_SIZE call cmxtxx("seq","seq")
  5584. pat cmu tne $1==WORD_SIZE call cmxtxx("sne","sne")
  5585. pat cmu tge $1==WORD_SIZE call cmxtxx("scc","sls")
  5586. pat cmu tgt $1==WORD_SIZE call cmxtxx("shi","scs")
  5587. proc cmuzxx example cmu zlt
  5588. with exact sconsts any_int
  5589. kills ALL
  5590. uses DD_REG=%1
  5591. gen cmp_i %2, %a
  5592. bxx[2] {llabel, $2}
  5593. with exact any_int sconsts
  5594. kills ALL
  5595. uses DD_REG=%2
  5596. gen cmp_i %1, %a
  5597. bxx[1] {llabel, $2}
  5598. with any_int-sconsts genreg STACK
  5599. gen cmp_i %1, %2
  5600. bxx[1] {llabel, $2}
  5601. with genreg any_int-sconsts STACK
  5602. gen cmp_i %2, %1
  5603. bxx[2] {llabel, $2}
  5604. with exact immediate_int-sconsts imm_cmp_int
  5605. kills ALL
  5606. gen cmp_i %1, %2
  5607. bxx[1] {llabel, $2}
  5608. with exact imm_cmp_int immediate_int-sconsts
  5609. kills ALL
  5610. gen cmp_i %2, %1
  5611. bxx[2] {llabel, $2}
  5612. with exact immediate_int-sconsts STACK
  5613. gen cmp_i %1, {post_inc_int, sp}
  5614. bxx[1] {llabel, $2}
  5615. with exact any_int STACK
  5616. uses reusing %1, DD_REG=%1
  5617. gen cmp_i {post_inc_int, sp}, %a
  5618. bxx[2] {llabel, $2}
  5619. with exact STACK
  5620. uses DD_REG
  5621. gen move_i {post_inc_int, sp},%a
  5622. cmp_i {post_inc_int, sp},%a
  5623. bxx[2] {llabel, $2}
  5624. with data2-sconsts dreg2 STACK
  5625. gen cmp_w %1, %2
  5626. bxx[1] {llabel, $2}
  5627. with dreg2 data2-conreg2-sconsts STACK
  5628. gen cmp_w %2, %1
  5629. bxx[2] {llabel, $2}
  5630. with data1 dreg1 STACK
  5631. gen cmp_b %1, %2
  5632. bxx[1] {llabel, $2}
  5633. with dreg1 data1-conreg1 STACK
  5634. gen cmp_b %2, %1
  5635. bxx[2] {llabel, $2}
  5636. pat cmu zlt $1==WORD_SIZE call cmuzxx("bcs","bhi")
  5637. pat cmu zle $1==WORD_SIZE call cmuzxx("bls","bcc")
  5638. pat cmu zeq $1==WORD_SIZE call cmuzxx("beq","beq")
  5639. pat cmu zne $1==WORD_SIZE call cmuzxx("bne","bne")
  5640. pat cmu zge $1==WORD_SIZE call cmuzxx("bcc","bls")
  5641. pat cmu zgt $1==WORD_SIZE call cmuzxx("bhi","bcs")
  5642. #if TBL68881
  5643. proc cmf4zxx example cmf zlt
  5644. with FS_REG FS_REG
  5645. gen fcmp %1,%2
  5646. bxx* {llabel, $2}
  5647. pat cmf zlt $1==4 call cmf4zxx("fblt")
  5648. pat cmf zle $1==4 call cmf4zxx("fble")
  5649. pat cmf zne $1==4 call cmf4zxx("fbne")
  5650. pat cmf zeq $1==4 call cmf4zxx("fbeq")
  5651. pat cmf zge $1==4 call cmf4zxx("fbge")
  5652. pat cmf zgt $1==4 call cmf4zxx("fbgt")
  5653. proc cmf8zxx example cmf zlt
  5654. with FD_REG FD_REG
  5655. gen fcmp %1,%2
  5656. bxx* {llabel, $2}
  5657. pat cmf zlt $1==8 call cmf8zxx("fblt")
  5658. pat cmf zle $1==8 call cmf8zxx("fble")
  5659. pat cmf zne $1==8 call cmf8zxx("fbne")
  5660. pat cmf zeq $1==8 call cmf8zxx("fbeq")
  5661. pat cmf zge $1==8 call cmf8zxx("fbge")
  5662. pat cmf zgt $1==8 call cmf8zxx("fbgt")
  5663. #endif
  5664. proc loc1locciibxx example loc loc cii bne
  5665. with any1 extend1 STACK
  5666. gen cmp_b %1,%2
  5667. bxx[1] {llabel, $4}
  5668. with any1 any_int STACK
  5669. uses reusing %1, DD_REG = %1
  5670. #if TBL68020 && WORD_SIZE==4
  5671. gen extb_l %a
  5672. #else
  5673. gen ext_w %a
  5674. #if WORD_SIZE==4
  5675. ext_l %a
  5676. #endif
  5677. #endif
  5678. cmp_i %2,%a
  5679. bxx[2] {llabel, $4}
  5680. pat loc loc cii blt $1==1 && $2==EM_WSIZE call loc1locciibxx("blt","bgt")
  5681. pat loc loc cii ble $1==1 && $2==EM_WSIZE call loc1locciibxx("ble","bge")
  5682. pat loc loc cii bne $1==1 && $2==EM_WSIZE call loc1locciibxx("bne","bne")
  5683. pat loc loc cii beq $1==1 && $2==EM_WSIZE call loc1locciibxx("beq","beq")
  5684. pat loc loc cii bge $1==1 && $2==EM_WSIZE call loc1locciibxx("bge","ble")
  5685. pat loc loc cii bgt $1==1 && $2==EM_WSIZE call loc1locciibxx("bgt","blt")
  5686. #if WORD_SIZE==4
  5687. proc loc2locciibxx example loc loc cii bne
  5688. with any2 extend2 STACK
  5689. gen cmp_w %1,%2
  5690. bxx[1] {llabel, $4}
  5691. with any2 any4 STACK
  5692. uses reusing %1, DD_REG = %1
  5693. gen ext_l %a
  5694. cmp_l %2,%a
  5695. bxx[2] {llabel, $4}
  5696. pat loc loc cii blt $1==2 && $2==EM_WSIZE call loc2locciibxx("blt","bgt")
  5697. pat loc loc cii blt $1==2 && $2==EM_WSIZE call loc2locciibxx("blt","bgt")
  5698. pat loc loc cii ble $1==2 && $2==EM_WSIZE call loc2locciibxx("ble","bge")
  5699. pat loc loc cii bne $1==2 && $2==EM_WSIZE call loc2locciibxx("bne","bne")
  5700. pat loc loc cii beq $1==2 && $2==EM_WSIZE call loc2locciibxx("beq","beq")
  5701. pat loc loc cii bge $1==2 && $2==EM_WSIZE call loc2locciibxx("bge","ble")
  5702. pat loc loc cii bgt $1==2 && $2==EM_WSIZE call loc2locciibxx("bgt","blt")
  5703. #endif
  5704. proc bxx1_in example loc loc cii loc bne
  5705. with imm_cmp1 STACK
  5706. gen cmp_b {const, low8($4)}, %1
  5707. bxx* {llabel, $5}
  5708. #if WORD_SIZE!=2
  5709. proc bxx2_in example loc loc cii loc bne
  5710. with imm_cmp2 STACK
  5711. gen cmp_w {const, low16($4)}, %1
  5712. bxx* {llabel, $5}
  5713. #endif
  5714. proc bxx1_small example loc bne
  5715. with imm_cmp1-D_REG STACK
  5716. gen cmp_b {const, $1}, %1
  5717. bxx[1] {llabel, $2}
  5718. with imm_cmp2-D_REG STACK
  5719. gen cmp_w {const, $1}, %1
  5720. bxx[1] {llabel, $2}
  5721. with data_int STACK
  5722. uses DD_REG = {small_const, $1} /* uses moveq */
  5723. gen cmp_i %1,%a
  5724. bxx[2] {llabel, $2}
  5725. #if WORD_SIZE!=2
  5726. proc bxx2_small example loc bne
  5727. with imm_cmp2-D_REG STACK
  5728. gen cmp_w {const, $1}, %1
  5729. bxx[1] {llabel, $2}
  5730. with imm_cmp4 STACK
  5731. gen cmp_l {const, $1}, %1
  5732. bxx[2] {llabel, $2}
  5733. #endif
  5734. proc zxx1_in example loc loc cii zne
  5735. with test_set1 STACK
  5736. gen test %1
  5737. bxx* {llabel, $4}
  5738. with D_REG STACK
  5739. gen test {dreg1, %1}
  5740. bxx* {llabel, $4}
  5741. #if WORD_SIZE!=2
  5742. proc zxx2_in example loc loc cii zne
  5743. with test_set2 STACK
  5744. gen test %1
  5745. bxx* {llabel, $4}
  5746. with D_REG STACK
  5747. gen test {dreg2, %1}
  5748. bxx* {llabel, $4}
  5749. #endif
  5750. pat loc loc cii zlt $1==1 && $2==WORD_SIZE call zxx1_in("blt")
  5751. pat loc loc cii zle $1==1 && $2==WORD_SIZE call zxx1_in("ble")
  5752. pat loc loc cii zne $1==1 && $2==WORD_SIZE call zxx1_in("bne")
  5753. pat loc loc cii zeq $1==1 && $2==WORD_SIZE call zxx1_in("beq")
  5754. pat loc loc cii zge $1==1 && $2==WORD_SIZE call zxx1_in("bge")
  5755. pat loc loc cii zgt $1==1 && $2==WORD_SIZE call zxx1_in("bgt")
  5756. #if WORD_SIZE!=2
  5757. pat loc loc cii zlt $1==2 && $2==4 call zxx2_in("blt")
  5758. pat loc loc cii zle $1==2 && $2==4 call zxx2_in("ble")
  5759. pat loc loc cii zne $1==2 && $2==4 call zxx2_in("bne")
  5760. pat loc loc cii zeq $1==2 && $2==4 call zxx2_in("beq")
  5761. pat loc loc cii zge $1==2 && $2==4 call zxx2_in("bge")
  5762. pat loc loc cii zgt $1==2 && $2==4 call zxx2_in("bgt")
  5763. #endif
  5764. pat loc loc cii loc blt $1==1 && $2==WORD_SIZE && in_1($4) call bxx1_in("blt")
  5765. pat loc loc cii loc ble $1==1 && $2==WORD_SIZE && in_1($4) call bxx1_in("ble")
  5766. pat loc loc cii loc beq $1==1 && $2==WORD_SIZE && in_1($4) call bxx1_in("beq")
  5767. pat loc loc cii loc bne $1==1 && $2==WORD_SIZE && in_1($4) call bxx1_in("bne")
  5768. pat loc loc cii loc bge $1==1 && $2==WORD_SIZE && in_1($4) call bxx1_in("bge")
  5769. pat loc loc cii loc bgt $1==1 && $2==WORD_SIZE && in_1($4) call bxx1_in("bgt")
  5770. #if WORD_SIZE!=2
  5771. pat loc loc cii loc blt $1==2 && $2==4 && in_2($4) call bxx2_in("blt")
  5772. pat loc loc cii loc ble $1==2 && $2==4 && in_2($4) call bxx2_in("ble")
  5773. pat loc loc cii loc beq $1==2 && $2==4 && in_2($4) call bxx2_in("beq")
  5774. pat loc loc cii loc bne $1==2 && $2==4 && in_2($4) call bxx2_in("bne")
  5775. pat loc loc cii loc bge $1==2 && $2==4 && in_2($4) call bxx2_in("bge")
  5776. pat loc loc cii loc bgt $1==2 && $2==4 && in_2($4) call bxx2_in("bgt")
  5777. #endif
  5778. /* the second instruction for bxx1_small is the other way around! */
  5779. pat loc blt $1>=0 && $1<128 call bxx1_small("bcs", "bgt")
  5780. pat loc ble $1>=0 && $1<128 call bxx1_small("bls", "bge")
  5781. pat loc beq $1>=0 && $1<128 call bxx1_small("beq", "beq")
  5782. pat loc bne $1>=0 && $1<128 call bxx1_small("bne", "bne")
  5783. pat loc bge $1>=0 && $1<128 call bxx1_small("bcc", "ble")
  5784. pat loc bgt $1>=0 && $1<128 call bxx1_small("bhi", "blt")
  5785. #if WORD_SIZE!=2
  5786. pat loc blt $1>=128 && $1<32768 call bxx2_small("bcs", "blt")
  5787. pat loc ble $1>=128 && $1<32768 call bxx2_small("bls", "ble")
  5788. pat loc beq $1>=128 && $1<32768 call bxx2_small("beq", "beq")
  5789. pat loc bne $1>=128 && $1<32768 call bxx2_small("bne", "bne")
  5790. pat loc bge $1>=128 && $1<32768 call bxx2_small("bcc", "bge")
  5791. pat loc bgt $1>=128 && $1<32768 call bxx2_small("bhi", "bgt")
  5792. #endif
  5793. pat loc loc cii lal sti $1 <= WORD_SIZE && $1>=$5 && $2==WORD_SIZE
  5794. leaving lal $4 sti $5
  5795. pat loc loc cii lol sti $1 <= WORD_SIZE && $1>=$5 && $2==WORD_SIZE
  5796. leaving lol $4 sti $5
  5797. pat loc loc cii lil sti $1 <= WORD_SIZE && $1>=$5 && $2==WORD_SIZE
  5798. leaving lil $4 sti $5
  5799. pat loc loc cii LLP lof sti $1 <= WORD_SIZE && $1>=$6 && $2==WORD_SIZE
  5800. leaving LLP $4 lof $5 sti $6
  5801. pat loc loc cii lae sti $1 <= WORD_SIZE && $1>=$5 && $2==WORD_SIZE
  5802. leaving lae $4 sti $5
  5803. pat loc loc cii loe sti $1 <= WORD_SIZE && $1>=$5 && $2==WORD_SIZE
  5804. leaving loe $4 sti $5
  5805. pat loc loc cii stl $1==1 && $2==WORD_SIZE && inreg($4)==reg_any
  5806. with memory1+DD_REG
  5807. kills regvar($4, reg_any), use_index %xreg==regvar($4, reg_any)
  5808. gen move_b %1, {dreg1, regvar($4,reg_any)}
  5809. #if WORD_SIZE==2
  5810. ext_w {LOCAL,$4}
  5811. #else
  5812. #ifdef TBL68020
  5813. extb_l {LOCAL,$4}
  5814. #else TBL68020
  5815. ext_w {LOCAL,$4}
  5816. ext_l {LOCAL,$4}
  5817. #endif TBL68020
  5818. #endif
  5819. pat loc loc cii $1==2 && $2==4
  5820. #if WORD_SIZE==2
  5821. with D_REG
  5822. uses reusing %1, DD_REG4
  5823. gen move %1,%a.1 yields {extend2, %a}
  5824. with exact extend1
  5825. uses reusing %1,DD_REG4
  5826. gen move %1.reg,%a.1 yields {extend1_4, %a}
  5827. with exact memory2
  5828. uses reusing %1,DD_REG4
  5829. gen move %1, %a.1 yields {extend2, %a}
  5830. #else
  5831. with DD_REG yields {extend2, %1}
  5832. with exact memory2
  5833. uses reusing %1,DD_REG=%1
  5834. yields {extend2, %a}
  5835. #endif
  5836. pat loc loc cii $1==1 && $2==WORD_SIZE
  5837. with DD_REG yields {extend1, %1}
  5838. with exact memory1
  5839. uses reusing %1,DD_REG = %1
  5840. yields {extend1, %a}
  5841. #if WORD_SIZE==2
  5842. pat loc loc cii $1==1 && $2==4
  5843. with DD_REG
  5844. uses reusing %1, DD_REG4
  5845. gen move %1, %a.1
  5846. yields {extend1_4, %a}
  5847. with exact memory1
  5848. uses reusing %1,DD_REG4
  5849. gen move %1,%a.1 yields {extend1_4, %a}
  5850. #endif
  5851. pat loc loc ciu $1==$2 /* skip this */
  5852. pat loc loc cui $1==$2 /* skip this */
  5853. /* The following rules should be handled by the peephole optimizer, I think */
  5854. #if WORD_SIZE==2
  5855. pat ldc dvu highw($1)==0 && loww($1)==2 && $2==4 leaving loc 1 sru 4
  5856. pat ldc dvu highw($1)==0 && loww($1)==4 && $2==4 leaving loc 2 sru 4
  5857. pat ldc dvu highw($1)==0 && loww($1)==8 && $2==4 leaving loc 3 sru 4
  5858. pat ldc dvu highw($1)==0 && loww($1)==16 && $2==4 leaving loc 4 sru 4
  5859. pat ldc dvu highw($1)==0 && loww($1)==32 && $2==4 leaving loc 5 sru 4
  5860. pat ldc dvu highw($1)==0 && loww($1)==64 && $2==4 leaving loc 6 sru 4
  5861. pat ldc dvu highw($1)==0 && loww($1)==128 && $2==4 leaving loc 7 sru 4
  5862. pat ldc dvu highw($1)==0 && loww($1)==256 && $2==4 leaving loc 8 sru 4
  5863. #endif
  5864. pat loc dvu $1==2 && $2==WORD_SIZE leaving loc 1 sru WORD_SIZE
  5865. pat loc dvu $1==4 && $2==WORD_SIZE leaving loc 2 sru WORD_SIZE
  5866. pat loc dvu $1==8 && $2==WORD_SIZE leaving loc 3 sru WORD_SIZE
  5867. pat loc dvu $1==16 && $2==WORD_SIZE leaving loc 4 sru WORD_SIZE
  5868. pat loc dvu $1==32 && $2==WORD_SIZE leaving loc 5 sru WORD_SIZE
  5869. pat loc dvu $1==64 && $2==WORD_SIZE leaving loc 6 sru WORD_SIZE
  5870. pat loc dvu $1==128 && $2==WORD_SIZE leaving loc 7 sru WORD_SIZE
  5871. pat loc dvu $1==256 && $2==WORD_SIZE leaving loc 8 sru WORD_SIZE
  5872. #if WORD_SIZE==2
  5873. pat ldc dvi highw($1)==0 && loww($1)==2 && $2==4
  5874. with DD_REG4
  5875. gen test %1
  5876. bpl {slabel,1f}
  5877. add_l {const4,loww($1)-1},%1
  5878. 1: yields %1 leaving loc 1 sri 4
  5879. pat ldc dvi highw($1)==0 && loww($1)==4 && $2==4
  5880. with DD_REG4
  5881. gen test %1
  5882. bpl {slabel,1f}
  5883. add_l {const4,loww($1)-1},%1
  5884. 1: yields %1 leaving loc 2 sri 4
  5885. pat ldc dvi highw($1)==0 && loww($1)==8 && $2==4
  5886. with DD_REG4
  5887. gen test %1
  5888. bpl {slabel,1f}
  5889. add_l {const4,loww($1)-1},%1
  5890. 1: yields %1 leaving loc 3 sri 4
  5891. pat ldc dvi highw($1)==0 && loww($1)==16 && $2==4
  5892. with DD_REG4
  5893. gen test %1
  5894. bpl {slabel,1f}
  5895. add_l {const4,loww($1)-1},%1
  5896. 1: yields %1 leaving loc 4 sri 4
  5897. pat ldc dvi highw($1)==0 && loww($1)==32 && $2==4
  5898. with DD_REG4
  5899. gen test %1
  5900. bpl {slabel,1f}
  5901. add_l {const4,loww($1)-1},%1
  5902. 1: yields %1 leaving loc 5 sri 4
  5903. pat ldc dvi highw($1)==0 && loww($1)==64 && $2==4
  5904. with DD_REG4
  5905. gen test %1
  5906. bpl {slabel,1f}
  5907. add_l {const4,loww($1)-1},%1
  5908. 1: yields %1 leaving loc 6 sri 4
  5909. pat ldc dvi highw($1)==0 && loww($1)==128 && $2==4
  5910. with DD_REG4
  5911. gen test %1
  5912. bpl {slabel,1f}
  5913. add_l {const4,loww($1)-1},%1
  5914. 1: yields %1 leaving loc 7 sri 4
  5915. pat ldc dvi highw($1)==0 && loww($1)==256 && $2==4
  5916. with DD_REG4
  5917. gen test %1
  5918. bpl {slabel,1f}
  5919. add_l {const4,loww($1)-1},%1
  5920. 1: yields %1 leaving loc 8 sri 4
  5921. #endif /* WORD_SIZE==2 */
  5922. pat loc dvi $1==2 && $2==WORD_SIZE
  5923. with DD_REG
  5924. gen test %1
  5925. bpl {slabel,1f}
  5926. add_i {const,$1-1},%1
  5927. 1: yields %1 leaving loc 1 sri WORD_SIZE
  5928. pat loc dvi $1==4 && $2==WORD_SIZE
  5929. with DD_REG
  5930. gen test %1
  5931. bpl {slabel,1f}
  5932. add_i {const,$1-1},%1
  5933. 1: yields %1 leaving loc 2 sri WORD_SIZE
  5934. pat loc dvi $1==8 && $2==WORD_SIZE
  5935. with DD_REG
  5936. gen test %1
  5937. bpl {slabel,1f}
  5938. add_i {const,$1-1},%1
  5939. 1: yields %1 leaving loc 3 sri WORD_SIZE
  5940. pat loc dvi $1==16 && $2==WORD_SIZE
  5941. with DD_REG
  5942. gen test %1
  5943. bpl {slabel,1f}
  5944. add_i {const,$1-1},%1
  5945. 1: yields %1 leaving loc 4 sri WORD_SIZE
  5946. pat loc dvi $1==32 && $2==WORD_SIZE
  5947. with DD_REG
  5948. gen test %1
  5949. bpl {slabel,1f}
  5950. add_i {const,$1-1},%1
  5951. 1: yields %1 leaving loc 5 sri WORD_SIZE
  5952. pat loc dvi $1==64 && $2==WORD_SIZE
  5953. with DD_REG
  5954. gen test %1
  5955. bpl {slabel,1f}
  5956. add_i {const,$1-1},%1
  5957. 1: yields %1 leaving loc 6 sri WORD_SIZE
  5958. pat loc dvi $1==128 && $2==WORD_SIZE
  5959. with DD_REG
  5960. gen test %1
  5961. bpl {slabel,1f}
  5962. add_i {const,$1-1},%1
  5963. 1: yields %1 leaving loc 7 sri WORD_SIZE
  5964. pat loc dvi $1==256 && $2==WORD_SIZE
  5965. with DD_REG
  5966. gen test %1
  5967. bpl {slabel,1f}
  5968. add_i {const,$1-1},%1
  5969. 1: yields %1 leaving loc 8 sri WORD_SIZE
  5970. /* The rest is all 2-bytes stuff */
  5971. #if WORD_SIZE==2
  5972. pat loc loc cii $1==4 && $2==2
  5973. with D_REG4
  5974. yields %1.1
  5975. with any2-pre_post any2-pre_post
  5976. yields %2
  5977. proc cmqtxx
  5978. with exact sconsts4 any4
  5979. uses DD_REG4=%1
  5980. gen cmp_l %2, %a
  5981. s4xx[2] %a
  5982. neg_b %a.1
  5983. yields {extend1, %a.1}
  5984. with exact any4 sconsts4
  5985. uses DD_REG4=%2
  5986. gen cmp_l %1, %a
  5987. s4xx[1] %a
  5988. neg_b %a.1
  5989. yields {extend1, %a.1}
  5990. with any4-sconsts4 genreg4
  5991. uses reusing %1,reusing %2,DD_REG4
  5992. gen cmp_l %1, %2
  5993. s4xx[1] %a
  5994. neg_b %a.1
  5995. yields {extend1, %a.1}
  5996. with genreg4 any4-sconsts4
  5997. uses reusing %1,reusing %2,DD_REG4
  5998. gen cmp_l %2, %1
  5999. s4xx[2] %a
  6000. neg_b %a.1
  6001. yields {extend1, %a.1}
  6002. with exact extend1_4 extend1_4
  6003. uses reusing %1,reusing %2,DD_REG4
  6004. gen cmp_b %2, %1
  6005. s4xx[2] %a
  6006. neg_b %a.1
  6007. yields {extend1, %a.1}
  6008. with exact extend2 extend2
  6009. uses reusing %1,reusing %2,DD_REG4
  6010. gen cmp_w %2, %1
  6011. s4xx[2] %a
  6012. neg_b %a.1
  6013. yields {extend1, %a.1}
  6014. with exact immediate4-sconsts4 imm_cmp4
  6015. uses reusing %2,DD_REG4
  6016. gen cmp_l %1, %2
  6017. s4xx[1] %a
  6018. neg_b %a.1
  6019. yields {extend1, %a.1}
  6020. with exact imm_cmp4 immediate4-sconsts4
  6021. uses reusing %1,DD_REG4
  6022. gen cmp_l %2, %1
  6023. s4xx[2] %a
  6024. neg_b %a.1
  6025. yields {extend1, %a.1}
  6026. with exact immediate4-sconsts4 STACK
  6027. uses DD_REG4
  6028. gen cmp_l %1, {post_inc4, sp}
  6029. s4xx[1] %a
  6030. neg_b %a.1
  6031. yields {extend1, %a.1}
  6032. with exact any4 STACK
  6033. uses reusing %1,DD_REG4=%1
  6034. gen cmp_l {post_inc4, sp}, %a
  6035. s4xx[2] %a
  6036. neg_b %a.1
  6037. yields {extend1, %a.1}
  6038. with exact STACK
  6039. uses DD_REG4
  6040. gen move_l {post_inc4, sp},%a
  6041. cmp_l {post_inc4, sp},%a
  6042. s4xx[2] %a
  6043. neg_b %a.1
  6044. yields {extend1, %a.1}
  6045. pat cmi tlt $1==4 call cmqtxx("slt","sgt")
  6046. pat cmi tle $1==4 call cmqtxx("sle","sge")
  6047. pat cmi teq $1==4 call cmqtxx("seq","seq")
  6048. pat cmi tne $1==4 call cmqtxx("sne","sne")
  6049. pat cmi tge $1==4 call cmqtxx("sge","sle")
  6050. pat cmi tgt $1==4 call cmqtxx("sgt","slt")
  6051. pat cmu tlt $1==4 call cmqtxx("scs","shi")
  6052. pat cmu tle $1==4 call cmqtxx("sls","scc")
  6053. pat cmu teq $1==4 call cmqtxx("seq","seq")
  6054. pat cmu tne $1==4 call cmqtxx("sne","sne")
  6055. pat cmu tge $1==4 call cmqtxx("scc","sls")
  6056. pat cmu tgt $1==4 call cmqtxx("shi","scs")
  6057. proc cmqzxx example cmu zlt
  6058. with zero_const4 test_set4 STACK
  6059. /* kills ALL */
  6060. gen test %2
  6061. bxx[1] {llabel, $2}
  6062. with exact sconsts4-zero_const4 any4
  6063. kills ALL
  6064. uses DD_REG4=%1
  6065. gen cmp_l %2, %a
  6066. bxx[2] {llabel, $2}
  6067. with exact any4 sconsts4
  6068. kills ALL
  6069. uses DD_REG4=%2
  6070. gen cmp_l %1, %a
  6071. bxx[1] {llabel, $2}
  6072. with any4-sconsts4-zero_const4 genreg4 STACK
  6073. gen cmp_l %1, %2
  6074. bxx[1] {llabel, $2}
  6075. with genreg4 any4-sconsts4-zero_const4 STACK
  6076. gen cmp_l %2, %1
  6077. bxx[2] {llabel, $2}
  6078. with exact immediate4-sconsts4-zero_const4 imm_cmp4
  6079. kills ALL
  6080. gen cmp_l %1, %2
  6081. bxx[1] {llabel, $2}
  6082. with exact imm_cmp4 immediate4-sconsts4-zero_const4
  6083. kills ALL
  6084. gen cmp_l %2, %1
  6085. bxx[2] {llabel, $2}
  6086. with exact immediate4-sconsts4-zero_const4 STACK
  6087. gen cmp_l %1, {post_inc4, sp}
  6088. bxx[1] {llabel, $2}
  6089. with exact any4 STACK
  6090. uses reusing %1, DD_REG4=%1
  6091. gen cmp_l {post_inc4, sp}, %a
  6092. bxx[2] {llabel, $2}
  6093. with exact STACK
  6094. uses DD_REG4
  6095. gen move_l {post_inc4, sp},%a
  6096. cmp_l {post_inc4, sp},%a
  6097. bxx[2] {llabel, $2}
  6098. with data2-sconsts dreg2 STACK
  6099. gen cmp_w %1, %2
  6100. bxx[1] {llabel, $2}
  6101. with dreg2 data2-conreg2-sconsts STACK
  6102. gen cmp_w %2, %1
  6103. bxx[2] {llabel, $2}
  6104. with data1 dreg1 STACK
  6105. gen cmp_b %1, %2
  6106. bxx[1] {llabel, $2}
  6107. with dreg1 data1-conreg1 STACK
  6108. gen cmp_b %2, %1
  6109. bxx[2] {llabel, $2}
  6110. pat cmi zlt $1==4 call cmqzxx("blt","bgt")
  6111. pat cmi zle $1==4 call cmqzxx("ble","bge")
  6112. pat cmi zeq $1==4 call cmqzxx("beq","beq")
  6113. pat cmi zne $1==4 call cmqzxx("bne","bne")
  6114. pat cmi zge $1==4 call cmqzxx("bge","ble")
  6115. pat cmi zgt $1==4 call cmqzxx("bgt","blt")
  6116. pat cms zeq $1==4 call cmqzxx("beq","beq")
  6117. pat cms zne $1==4 call cmqzxx("bne","bne")
  6118. pat cmu zlt $1==4 call cmqzxx("bcs","bhi")
  6119. pat cmu zle $1==4 call cmqzxx("bls","bcc")
  6120. pat cmu zeq $1==4 call cmqzxx("beq","beq")
  6121. pat cmu zne $1==4 call cmqzxx("bne","bne")
  6122. pat cmu zge $1==4 call cmqzxx("bcc","bls")
  6123. pat cmu zgt $1==4 call cmqzxx("bhi","bcs")
  6124. pat ldc cms zeq loww($1)==0 && highw($1)==0 && $2==4
  6125. with test_set4 STACK
  6126. gen test %1
  6127. beq {llabel, $3}
  6128. pat ldc cms zne loww($1)==0 && highw($1)==0 && $2==4
  6129. with test_set4 STACK
  6130. gen test %1
  6131. bne {llabel, $3}
  6132. #endif