frv.cpu 343 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804
  1. ; Fujitsu FRV opcode support, for GNU Binutils. -*- Scheme -*-
  2. ;
  3. ; Copyright 2000, 2001, 2003, 2004, 2007, 2009 Free Software Foundation, Inc.
  4. ;
  5. ; Contributed by Red Hat Inc; developed under contract from Fujitsu.
  6. ;
  7. ; This file is part of the GNU Binutils.
  8. ;
  9. ; This program is free software; you can redistribute it and/or modify
  10. ; it under the terms of the GNU General Public License as published by
  11. ; the Free Software Foundation; either version 3 of the License, or
  12. ; (at your option) any later version.
  13. ;
  14. ; This program is distributed in the hope that it will be useful,
  15. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ; GNU General Public License for more details.
  18. ;
  19. ; You should have received a copy of the GNU General Public License
  20. ; along with this program; if not, write to the Free Software
  21. ; Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  22. ; MA 02110-1301, USA.
  23. (include "simplify.inc")
  24. ; define-arch must appear first
  25. (define-arch
  26. (name frv) ; name of cpu architecture
  27. (comment "Fujitsu FRV")
  28. (insn-lsb0? #t)
  29. (machs frv fr550 fr500 fr450 fr400 tomcat simple)
  30. (isas frv)
  31. )
  32. (define-isa
  33. (name frv)
  34. (base-insn-bitsize 32)
  35. ; Initial bitnumbers to decode insns by.
  36. (decode-assist (24 23 22 21 20 19 18))
  37. (liw-insns 1) ; The frv fetches up to 1 insns at a time.
  38. (parallel-insns 8) ; The frv executes up to 8 insns at a time.
  39. )
  40. ; Cpu family definitions.
  41. ;
  42. (define-cpu
  43. ; cpu names must be distinct from the architecture name and machine names.
  44. ; The "b" suffix stands for "base" and is the convention.
  45. ; The "f" suffix stands for "family" and is the convention.
  46. (name frvbf)
  47. (comment "Fujitsu FRV base family")
  48. (endian big)
  49. (word-bitsize 32)
  50. )
  51. ; Generic FR-V machine. Supports the entire architecture
  52. (define-mach
  53. (name frv)
  54. (comment "Generic FRV cpu")
  55. (cpu frvbf)
  56. )
  57. (define-model
  58. (name frv) (comment "Generic FRV model") (attrs)
  59. (mach frv)
  60. (pipeline all "" () ((fetch) (decode) (execute) (writeback)))
  61. ; `state' is a list of variables for recording model state
  62. ; (state)
  63. (unit u-exec "Execution Unit" ()
  64. 1 1 ; issue done
  65. () ; state
  66. () ; inputs
  67. () ; outputs
  68. () ; profile action (default)
  69. )
  70. )
  71. ; FR550 machine
  72. (define-mach
  73. (name fr550)
  74. (comment "FR550 cpu")
  75. (cpu frvbf)
  76. )
  77. (define-model
  78. (name fr550) (comment "FR550 model") (attrs)
  79. (mach fr550)
  80. (pipeline all "" () ((fetch) (decode) (execute) (writeback)))
  81. ; `state' is a list of variables for recording model state
  82. (state
  83. ; State items
  84. ; These are all masks with each bit representing one register.
  85. (prev-fr-load DI) ; Previous use of FR register was target of a load
  86. (prev-fr-complex-1 DI) ; Previous use of FR register has variable latency
  87. (prev-fr-complex-2 DI) ; Previous use of FR register has variable latency
  88. (prev-ccr-complex DI) ; Previous use of CCR register has variable latency
  89. (prev-acc-mmac DI) ; Previous use of ACC register was a MMAC category
  90. (cur-fr-load DI) ; Current use of FR register was target of a load
  91. (cur-fr-complex-1 DI) ; Current use of FR register has variable latency
  92. (cur-fr-complex-2 DI) ; Current use of FR register has variable latency
  93. (cur-ccr-complex SI) ; Current use of CCR register has variable latency
  94. (cur-acc-mmac DI) ; Current use of ACC register was a MMAC category
  95. )
  96. ; Basic unit for instructions with no latency penalties
  97. (unit u-exec "Execution Unit" ()
  98. 1 1 ; issue done
  99. () ; state
  100. () ; inputs
  101. () ; outputs
  102. () ; profile action (default)
  103. )
  104. ; Basic integer insn unit
  105. (unit u-integer "Integer Unit" ()
  106. 1 1 ; issue done
  107. () ; state
  108. ((GRi INT -1) (GRj INT -1)) ; inputs
  109. ((GRk INT -1) (ICCi_1 INT -1)) ; outputs
  110. () ; profile action (default)
  111. )
  112. ; Integer multiplication unit
  113. (unit u-imul "Integer Multiplication Unit" ()
  114. 1 1 ; issue done
  115. () ; state
  116. ((GRi INT -1) (GRj INT -1)) ; inputs
  117. ((GRdoublek INT -1) (ICCi_1 INT -1)) ; outputs
  118. () ; profile action (default)
  119. )
  120. ; Integer division unit
  121. (unit u-idiv "Integer Division Unit" ()
  122. 1 1 ; issue done
  123. () ; state
  124. ((GRi INT -1) (GRj INT -1)) ; inputs
  125. ((GRk INT -1) (ICCi_1 INT -1)) ; outputs
  126. () ; profile action (default)
  127. )
  128. ; Branch unit
  129. (unit u-branch "Branch Unit" ()
  130. 1 1 ; issue done
  131. () ; state
  132. ((GRi INT -1) (GRj INT -1)
  133. (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs
  134. ((pc)) ; outputs
  135. () ; profile action (default)
  136. )
  137. ; Trap unit
  138. (unit u-trap "Trap Unit" ()
  139. 1 1 ; issue done
  140. () ; state
  141. ((GRi INT -1) (GRj INT -1)
  142. (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs
  143. () ; outputs
  144. () ; profile action (default)
  145. )
  146. ; Condition code check unit
  147. (unit u-check "Check Unit" ()
  148. 1 1 ; issue done
  149. () ; state
  150. ((ICCi_3 INT -1) (FCCi_3 INT -1)) ; inputs
  151. () ; outputs
  152. () ; profile action (default)
  153. )
  154. ; Float Arithmetic unit
  155. (unit u-float-arith "Float Arithmetic unit" ()
  156. 1 1 ; issue done
  157. () ; state
  158. ((FRi INT -1) (FRj INT -1) ; inputs
  159. (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs
  160. ((FRk INT -1) (FRdoublek INT -1)) ; outputs
  161. () ; profile action (default)
  162. )
  163. ; Float Dual Arithmetic unit
  164. (unit u-float-dual-arith "Float Arithmetic unit" ()
  165. ; This unit has a 2 cycle penalty -- see table 14-14 in the fr550 LSI
  166. 1 3 ; issue done
  167. () ; state
  168. ((FRi INT -1) (FRj INT -1) ; inputs
  169. (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs
  170. ((FRk INT -1) (FRdoublek INT -1)) ; outputs
  171. () ; profile action (default)
  172. )
  173. ; Float Div unit
  174. (unit u-float-div "Float Div unit" ()
  175. 1 1 ; issue done
  176. () ; state
  177. ((FRi INT -1) (FRj INT -1)) ; inputs
  178. ((FRk INT -1)) ; outputs
  179. () ; profile action (default)
  180. )
  181. ; Float Square Root unit
  182. (unit u-float-sqrt "Float Square Root unit" ()
  183. 1 1 ; issue done
  184. () ; state
  185. ((FRj INT -1) (FRdoublej INT -1)) ; inputs
  186. ((FRk INT -1) (FRdoublek INT -1)) ; outputs
  187. () ; profile action (default)
  188. )
  189. ; Float Compare unit
  190. (unit u-float-compare "Float Compare unit" ()
  191. 1 1 ; issue done
  192. () ; state
  193. ((FRi INT -1) (FRj INT -1)
  194. (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs
  195. ((FCCi_2 INT -1)) ; outputs
  196. () ; profile action (default)
  197. )
  198. ; Dual Float Compare unit
  199. (unit u-float-dual-compare "Float Dual Compare unit" ()
  200. ; This unit has a 2 cycle penalty -- see table 14-14 in the fr550 LSI
  201. 1 3 ; issue done
  202. () ; state
  203. ((FRi INT -1) (FRj INT -1)) ; inputs
  204. ((FCCi_2 INT -1)) ; outputs
  205. () ; profile action (default)
  206. )
  207. ; FR Move to GR unit
  208. (unit u-fr2gr "FR Move to GR Unit" ()
  209. 1 1 ; issue done
  210. () ; state
  211. ((FRintk INT -1)) ; inputs
  212. ((GRj INT -1)) ; outputs
  213. () ; profile action (default)
  214. )
  215. ; GR Move to FR unit
  216. (unit u-gr2fr "GR Move to FR Unit" ()
  217. 1 1 ; issue done
  218. () ; state
  219. ((GRj INT -1)) ; inputs
  220. ((FRintk INT -1)) ; outputs
  221. () ; profile action (default)
  222. )
  223. ; SPR Move to GR unit
  224. (unit u-spr2gr "SPR Move to GR Unit" ()
  225. 1 1 ; issue done
  226. () ; state
  227. ((spr INT -1)) ; inputs
  228. ((GRj INT -1)) ; outputs
  229. () ; profile action (default)
  230. )
  231. ; GR Move to SPR unit
  232. (unit u-gr2spr "GR Move to SPR Unit" ()
  233. 1 1 ; issue done
  234. () ; state
  235. ((GRj INT -1)) ; inputs
  236. ((spr INT -1)) ; outputs
  237. () ; profile action (default)
  238. )
  239. ; GR set half unit
  240. (unit u-set-hilo "GR Set Half" ()
  241. 1 1 ; issue done
  242. () ; state
  243. () ; inputs
  244. ((GRkhi INT -1) (GRklo INT -1)) ; outputs
  245. () ; profile action (default)
  246. )
  247. ; GR load unit
  248. (unit u-gr-load "GR Load Unit" ()
  249. 1 1 ; issue done
  250. () ; state
  251. ((GRi INT -1) (GRj INT -1)) ; inputs
  252. ((GRk INT -1) (GRdoublek INT -1)) ; outputs
  253. () ; profile action (default)
  254. )
  255. ; GR store unit
  256. (unit u-gr-store "GR Store Unit" ()
  257. 1 1 ; issue done
  258. () ; state
  259. ((GRi INT -1) (GRj INT -1) (GRk INT -1) (GRdoublek INT -1)) ; inputs
  260. () ; outputs
  261. () ; profile action (default)
  262. )
  263. ; FR load unit
  264. (unit u-fr-load "FR Load Unit" ()
  265. 1 1 ; issue done
  266. () ; state
  267. ((GRi INT -1) (GRj INT -1)) ; inputs
  268. ((FRintk INT -1) (FRdoublek INT -1)) ; outputs
  269. () ; profile action (default)
  270. )
  271. ; FR store unit
  272. (unit u-fr-store "FR Store Unit" ()
  273. 1 1 ; issue done
  274. () ; state
  275. ((GRi INT -1) (GRj INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; inputs
  276. () ; outputs
  277. () ; profile action (default)
  278. )
  279. ; Swap unit
  280. (unit u-swap "Swap Unit" ()
  281. 1 1 ; issue done
  282. () ; state
  283. ((GRi INT -1) (GRj INT -1)) ; inputs
  284. ((GRk INT -1)) ; outputs
  285. () ; profile action (default)
  286. )
  287. ; FR Move to FR unit
  288. (unit u-fr2fr "FR Move to FR Unit" ()
  289. 1 1 ; issue done
  290. () ; state
  291. ((FRi INT -1)) ; inputs
  292. ((FRk INT -1)) ; outputs
  293. () ; profile action (default)
  294. )
  295. ; Clrgr unit
  296. (unit u-clrgr "Clrgr Unit" ()
  297. 1 1 ; issue done
  298. () ; state
  299. ((GRk INT -1)) ; inputs
  300. () ; outputs
  301. () ; profile action (default)
  302. )
  303. ; Clrfr unit
  304. (unit u-clrfr "Clrfr Unit" ()
  305. 1 1 ; issue done
  306. () ; state
  307. ((FRk INT -1)) ; inputs
  308. () ; outputs
  309. () ; profile action (default)
  310. )
  311. ; Insn cache invalidate unit
  312. (unit u-ici "Insn cache invalidate unit" ()
  313. 1 1 ; issue done
  314. () ; state
  315. ((GRi INT -1) (GRj INT -1)) ; inputs
  316. () ; outputs
  317. () ; profile action (default)
  318. )
  319. ; Data cache invalidate unit
  320. (unit u-dci "Data cache invalidate unit" ()
  321. 1 1 ; issue done
  322. () ; state
  323. ((GRi INT -1) (GRj INT -1)) ; inputs
  324. () ; outputs
  325. () ; profile action (default)
  326. )
  327. ; Data cache flush unit
  328. (unit u-dcf "Data cache flush unit" ()
  329. 1 1 ; issue done
  330. () ; state
  331. ((GRi INT -1) (GRj INT -1)) ; inputs
  332. () ; outputs
  333. () ; profile action (default)
  334. )
  335. ; Insn cache preload unit
  336. (unit u-icpl "Insn cache preload unit" ()
  337. 1 1 ; issue done
  338. () ; state
  339. ((GRi INT -1) (GRj INT -1)) ; inputs
  340. () ; outputs
  341. () ; profile action (default)
  342. )
  343. ; Data cache preload unit
  344. (unit u-dcpl "Data cache preload unit" ()
  345. 1 1 ; issue done
  346. () ; state
  347. ((GRi INT -1) (GRj INT -1)) ; inputs
  348. () ; outputs
  349. () ; profile action (default)
  350. )
  351. ; Insn cache unlock unit
  352. (unit u-icul "Insn cache unlock unit" ()
  353. 1 1 ; issue done
  354. () ; state
  355. ((GRi INT -1) (GRj INT -1)) ; inputs
  356. () ; outputs
  357. () ; profile action (default)
  358. )
  359. ; Data cache unlock unit
  360. (unit u-dcul "Data cache unlock unit" ()
  361. 1 1 ; issue done
  362. () ; state
  363. ((GRi INT -1) (GRj INT -1)) ; inputs
  364. () ; outputs
  365. () ; profile action (default)
  366. )
  367. ; commit unit
  368. (unit u-commit "Commit Unit" ()
  369. 1 1 ; issue done
  370. () ; state
  371. ((GRk INT -1) (FRk INT -1)) ; inputs
  372. () ; outputs
  373. () ; profile action (default)
  374. )
  375. ; Float Conversion unit
  376. (unit u-float-convert "Float Conversion unit" ()
  377. 1 1 ; issue done
  378. () ; state
  379. ((FRj INT -1) (FRintj INT -1) (FRdoublej INT -1)) ; inputs
  380. ((FRk INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; outputs
  381. () ; profile action (default)
  382. )
  383. ; Media units
  384. (unit u-media "Media unit" ()
  385. 1 1 ; issue done
  386. () ; state
  387. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  388. ((FRintk INT -1)) ; outputs
  389. () ; profile action (default)
  390. )
  391. (unit u-media-quad "Media-quad unit" ()
  392. 1 1 ; issue done
  393. () ; state
  394. ((FRintieven INT -1) (FRintjeven INT -1)) ; inputs
  395. ((FRintkeven INT -1)) ; outputs
  396. () ; profile action (default)
  397. )
  398. (unit u-media-dual-expand "Media Dual Expand unit" ()
  399. 1 1 ; issue done
  400. () ; state
  401. ((FRinti INT -1)) ; inputs
  402. ((FRintkeven INT -1)) ; outputs
  403. () ; profile action (default)
  404. )
  405. (unit u-media-3-dual "Media-3-dual unit" ()
  406. 1 1 ; issue done
  407. () ; state
  408. ((FRinti INT -1)) ; inputs
  409. ((FRintk INT -1)) ; outputs
  410. () ; profile action (default)
  411. )
  412. (unit u-media-3-acc "Media unit for M-3 using ACC" ()
  413. 1 1 ; issue done
  414. () ; state
  415. ((FRintj INT -1) (ACC40Si INT -1)) ; inputs
  416. ((FRintk INT -1)) ; outputs
  417. () ; profile action (default)
  418. )
  419. (unit u-media-3-acc-dual "Media-3-acc-dual unit" ()
  420. 1 1 ; issue done
  421. () ; state
  422. ((ACC40Si INT -1)) ; inputs
  423. ((FRintkeven INT -1)) ; outputs
  424. () ; profile action (default)
  425. )
  426. (unit u-media-3-wtacc "Media-3-wtacc unit" ()
  427. 1 1 ; issue done
  428. () ; state
  429. ((FRinti INT -1) (ACC40Sk INT -1)) ; inputs
  430. () ; outputs
  431. () ; profile action (default)
  432. )
  433. (unit u-media-3-mclracc "Media-3-mclracc unit" ()
  434. 1 1 ; issue done
  435. () ; state
  436. () ; inputs
  437. () ; outputs
  438. () ; profile action (default)
  439. )
  440. (unit u-media-set "Media set" ()
  441. 1 1 ; issue done
  442. () ; state
  443. () ; inputs
  444. ((FRintk INT -1)) ; outputs
  445. () ; profile action (default)
  446. )
  447. (unit u-media-4 "Media-4 unit" ()
  448. 1 1 ; issue done
  449. () ; state
  450. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  451. ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs
  452. () ; profile action (default)
  453. )
  454. (unit u-media-4-acc "Media-4-acc unit" ()
  455. 1 1 ; issue done
  456. () ; state
  457. ((ACC40Si INT -1)) ; inputs
  458. ((ACC40Sk INT -1)) ; outputs
  459. () ; profile action (default)
  460. )
  461. (unit u-media-4-acc-dual "Media-4-acc-dual unit" ()
  462. 1 1 ; issue done
  463. () ; state
  464. ((ACC40Si INT -1)) ; inputs
  465. ((ACC40Sk INT -1)) ; outputs
  466. () ; profile action (default)
  467. )
  468. (unit u-media-4-add-sub "Media-4-add-sub unit" ()
  469. 1 1 ; issue done
  470. () ; state
  471. ((ACC40Si INT -1)) ; inputs
  472. ((ACC40Sk INT -1)) ; outputs
  473. () ; profile action (default)
  474. )
  475. (unit u-media-4-add-sub-dual "Media-4-add-sub-dual unit" ()
  476. 1 1 ; issue done
  477. () ; state
  478. ((ACC40Si INT -1)) ; inputs
  479. ((ACC40Sk INT -1)) ; outputs
  480. () ; profile action (default)
  481. )
  482. (unit u-media-4-quad "Media-4-quad unit" ()
  483. 1 1 ; issue done
  484. () ; state
  485. ((FRintieven INT -1) (FRintjeven INT -1)) ; inputs
  486. ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs
  487. () ; profile action (default)
  488. )
  489. )
  490. ; FR500 machine.
  491. (define-mach
  492. (name fr500)
  493. (comment "FR500 cpu")
  494. (cpu frvbf)
  495. )
  496. (define-model
  497. (name fr500) (comment "FR500 model") (attrs)
  498. (mach fr500)
  499. (pipeline all "" () ((fetch) (decode) (execute) (writeback)))
  500. ; `state' is a list of variables for recording model state
  501. (state
  502. ; State items
  503. ; These are all masks with each bit representing one register.
  504. (prev-fpop DI) ; Previous use of FR register was floating point insn
  505. (prev-media DI) ; Previous use of FR register was a media insn
  506. (prev-cc-complex DI) ; Previous use of ICC register was not simple
  507. (cur-fpop DI) ; Current use of FR register was floating point insn
  508. (cur-media DI) ; Current use of FR register was a media insn
  509. (cur-cc-complex DI) ; Current use of ICC register was not simple
  510. )
  511. ; Basic unit for instructions with no latency penalties
  512. (unit u-exec "Execution Unit" ()
  513. 1 1 ; issue done
  514. () ; state
  515. () ; inputs
  516. () ; outputs
  517. () ; profile action (default)
  518. )
  519. ; Basic integer insn unit
  520. (unit u-integer "Integer Unit" ()
  521. 1 1 ; issue done
  522. () ; state
  523. ((GRi INT -1) (GRj INT -1)) ; inputs
  524. ((GRk INT -1) (ICCi_1 INT -1)) ; outputs
  525. () ; profile action (default)
  526. )
  527. ; Integer multiplication unit
  528. (unit u-imul "Integer Multiplication Unit" ()
  529. 1 1 ; issue done
  530. () ; state
  531. ((GRi INT -1) (GRj INT -1)) ; inputs
  532. ((GRdoublek INT -1) (ICCi_1 INT -1)) ; outputs
  533. () ; profile action (default)
  534. )
  535. ; Integer division unit
  536. (unit u-idiv "Integer Division Unit" ()
  537. 1 1 ; issue done
  538. () ; state
  539. ((GRi INT -1) (GRj INT -1)) ; inputs
  540. ((GRk INT -1) (ICCi_1 INT -1)) ; outputs
  541. () ; profile action (default)
  542. )
  543. ; Branch unit
  544. (unit u-branch "Branch Unit" ()
  545. 1 1 ; issue done
  546. () ; state
  547. ((GRi INT -1) (GRj INT -1)
  548. (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs
  549. ((pc)) ; outputs
  550. () ; profile action (default)
  551. )
  552. ; Trap unit
  553. (unit u-trap "Trap Unit" ()
  554. 1 1 ; issue done
  555. () ; state
  556. ((GRi INT -1) (GRj INT -1)
  557. (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs
  558. () ; outputs
  559. () ; profile action (default)
  560. )
  561. ; Condition code check unit
  562. (unit u-check "Check Unit" ()
  563. 1 1 ; issue done
  564. () ; state
  565. ((ICCi_3 INT -1) (FCCi_3 INT -1)) ; inputs
  566. () ; outputs
  567. () ; profile action (default)
  568. )
  569. ; Clrgr unit
  570. (unit u-clrgr "Clrgr Unit" ()
  571. 1 1 ; issue done
  572. () ; state
  573. ((GRk INT -1)) ; inputs
  574. () ; outputs
  575. () ; profile action (default)
  576. )
  577. ; Clrfr unit
  578. (unit u-clrfr "Clrfr Unit" ()
  579. 1 1 ; issue done
  580. () ; state
  581. ((FRk INT -1)) ; inputs
  582. () ; outputs
  583. () ; profile action (default)
  584. )
  585. ; GR set half unit
  586. (unit u-set-hilo "GR Set Half" ()
  587. 1 1 ; issue done
  588. () ; state
  589. () ; inputs
  590. ((GRkhi INT -1) (GRklo INT -1)) ; outputs
  591. () ; profile action (default)
  592. )
  593. ; GR load unit -- TODO doesn't handle quad
  594. (unit u-gr-load "GR Load Unit" ()
  595. 1 1 ; issue done
  596. () ; state
  597. ((GRi INT -1) (GRj INT -1)) ; inputs
  598. ((GRk INT -1) (GRdoublek INT -1)) ; outputs
  599. () ; profile action (default)
  600. )
  601. ; GR store unit -- TODO doesn't handle quad
  602. (unit u-gr-store "GR Store Unit" ()
  603. 1 1 ; issue done
  604. () ; state
  605. ((GRi INT -1) (GRj INT -1) (GRk INT -1) (GRdoublek INT -1)) ; inputs
  606. () ; outputs
  607. () ; profile action (default)
  608. )
  609. ; GR recovering store unit -- TODO doesn't handle quad
  610. (unit u-gr-r-store "GR Recovering Store Unit" ()
  611. 1 1 ; issue done
  612. () ; state
  613. ((GRi INT -1) (GRj INT -1) (GRk INT -1) (GRdoublek INT -1)) ; inputs
  614. () ; outputs
  615. () ; profile action (default)
  616. )
  617. ; FR load unit -- TODO doesn't handle quad
  618. (unit u-fr-load "FR Load Unit" ()
  619. 1 1 ; issue done
  620. () ; state
  621. ((GRi INT -1) (GRj INT -1)) ; inputs
  622. ((FRintk INT -1) (FRdoublek INT -1)) ; outputs
  623. () ; profile action (default)
  624. )
  625. ; FR store unit -- TODO doesn't handle quad
  626. (unit u-fr-store "FR Store Unit" ()
  627. 1 1 ; issue done
  628. () ; state
  629. ((GRi INT -1) (GRj INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; inputs
  630. () ; outputs
  631. () ; profile action (default)
  632. )
  633. ; FR recovering store unit -- TODO doesn't handle quad
  634. (unit u-fr-r-store "FR Recovering Store Unit" ()
  635. 1 1 ; issue done
  636. () ; state
  637. ((GRi INT -1) (GRj INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; inputs
  638. () ; outputs
  639. () ; profile action (default)
  640. )
  641. ; Swap unit
  642. (unit u-swap "Swap Unit" ()
  643. 1 1 ; issue done
  644. () ; state
  645. ((GRi INT -1) (GRj INT -1)) ; inputs
  646. ((GRk INT -1)) ; outputs
  647. () ; profile action (default)
  648. )
  649. ; FR Move to FR unit
  650. (unit u-fr2fr "FR Move to FR Unit" ()
  651. 1 1 ; issue done
  652. () ; state
  653. ((FRi INT -1)) ; inputs
  654. ((FRk INT -1)) ; outputs
  655. () ; profile action (default)
  656. )
  657. ; FR Move to GR unit
  658. (unit u-fr2gr "FR Move to GR Unit" ()
  659. 1 1 ; issue done
  660. () ; state
  661. ((FRintk INT -1)) ; inputs
  662. ((GRj INT -1)) ; outputs
  663. () ; profile action (default)
  664. )
  665. ; SPR Move to GR unit
  666. (unit u-spr2gr "SPR Move to GR Unit" ()
  667. 1 1 ; issue done
  668. () ; state
  669. ((spr INT -1)) ; inputs
  670. ((GRj INT -1)) ; outputs
  671. () ; profile action (default)
  672. )
  673. ; GR Move to FR unit
  674. (unit u-gr2fr "GR Move to FR Unit" ()
  675. 1 1 ; issue done
  676. () ; state
  677. ((GRj INT -1)) ; inputs
  678. ((FRintk INT -1)) ; outputs
  679. () ; profile action (default)
  680. )
  681. ; GR Move to SPR unit
  682. (unit u-gr2spr "GR Move to SPR Unit" ()
  683. 1 1 ; issue done
  684. () ; state
  685. ((GRj INT -1)) ; inputs
  686. ((spr INT -1)) ; outputs
  687. () ; profile action (default)
  688. )
  689. ; Float Arithmetic unit
  690. (unit u-float-arith "Float Arithmetic unit" ()
  691. 1 1 ; issue done
  692. () ; state
  693. ((FRi INT -1) (FRj INT -1) ; inputs
  694. (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs
  695. ((FRk INT -1) (FRdoublek INT -1)) ; outputs
  696. () ; profile action (default)
  697. )
  698. ; Float Dual Arithmetic unit
  699. (unit u-float-dual-arith "Float Arithmetic unit" ()
  700. 1 1 ; issue done
  701. () ; state
  702. ((FRi INT -1) (FRj INT -1) ; inputs
  703. (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs
  704. ((FRk INT -1) (FRdoublek INT -1)) ; outputs
  705. () ; profile action (default)
  706. )
  707. ; Float Div unit
  708. (unit u-float-div "Float Div unit" ()
  709. 1 1 ; issue done
  710. () ; state
  711. ((FRi INT -1) (FRj INT -1)) ; inputs
  712. ((FRk INT -1)) ; outputs
  713. () ; profile action (default)
  714. )
  715. ; Float Square Root unit
  716. (unit u-float-sqrt "Float Square Root unit" ()
  717. 1 1 ; issue done
  718. () ; state
  719. ((FRj INT -1) (FRdoublej INT -1)) ; inputs
  720. ((FRk INT -1) (FRdoublek INT -1)) ; outputs
  721. () ; profile action (default)
  722. )
  723. ; Float Dual Square Root unit
  724. (unit u-float-dual-sqrt "Float Dual Square Root unit" ()
  725. 1 1 ; issue done
  726. () ; state
  727. ((FRj INT -1)) ; inputs
  728. ((FRk INT -1)) ; outputs
  729. () ; profile action (default)
  730. )
  731. ; Float Compare unit
  732. (unit u-float-compare "Float Compare unit" ()
  733. 1 1 ; issue done
  734. () ; state
  735. ((FRi INT -1) (FRj INT -1)
  736. (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs
  737. ((FCCi_2 INT -1)) ; outputs
  738. () ; profile action (default)
  739. )
  740. ; Dual Float Compare unit
  741. (unit u-float-dual-compare "Float Dual Compare unit" ()
  742. 1 1 ; issue done
  743. () ; state
  744. ((FRi INT -1) (FRj INT -1)) ; inputs
  745. ((FCCi_2 INT -1)) ; outputs
  746. () ; profile action (default)
  747. )
  748. ; Float Conversion unit
  749. (unit u-float-convert "Float Conversion unit" ()
  750. 1 1 ; issue done
  751. () ; state
  752. ((FRj INT -1) (FRintj INT -1) (FRdoublej INT -1)) ; inputs
  753. ((FRk INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; outputs
  754. () ; profile action (default)
  755. )
  756. ; Dual Float Conversion unit
  757. (unit u-float-dual-convert "Float Dual Conversion unit" ()
  758. 1 1 ; issue done
  759. () ; state
  760. ((FRj INT -1) (FRintj INT -1)) ; inputs
  761. ((FRk INT -1) (FRintk INT -1)) ; outputs
  762. () ; profile action (default)
  763. )
  764. ; Media unit
  765. (unit u-media "Media unit" ()
  766. 1 1 ; issue done
  767. () ; state
  768. ((FRinti INT -1) (FRintj INT -1) (ACC40Si INT -1) (ACCGi INT -1)) ; inputs
  769. ((FRintk INT -1) (ACC40Sk INT -1) (ACC40Uk INT -1) (ACCGk INT -1)) ; outputs
  770. () ; profile action (default)
  771. )
  772. ; Media Quad Arithmetic unit
  773. (unit u-media-quad-arith "Media Quad Arithmetic unit" ()
  774. 1 1 ; issue done
  775. () ; state
  776. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  777. ((FRintk INT -1)) ; outputs
  778. () ; profile action (default)
  779. )
  780. ; Media Dual Multiplication unit
  781. (unit u-media-dual-mul "Media Dual Multiplication unit" ()
  782. 1 1 ; issue done
  783. () ; state
  784. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  785. ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs
  786. () ; profile action (default)
  787. )
  788. ; Media Quad Multiplication unit
  789. (unit u-media-quad-mul "Media Quad Multiplication unit" ()
  790. 1 1 ; issue done
  791. () ; state
  792. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  793. ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs
  794. () ; profile action (default)
  795. )
  796. ; Media Quad Complex unit
  797. (unit u-media-quad-complex "Media Quad Complex unit" ()
  798. 1 1 ; issue done
  799. () ; state
  800. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  801. ((ACC40Sk INT -1)) ; outputs
  802. () ; profile action (default)
  803. )
  804. ; Media Dual Expand unit
  805. (unit u-media-dual-expand "Media Dual Expand unit" ()
  806. 1 1 ; issue done
  807. () ; state
  808. ((FRinti INT -1)) ; inputs
  809. ((FRintk INT -1)) ; outputs
  810. () ; profile action (default)
  811. )
  812. ; Media Dual Unpack unit
  813. (unit u-media-dual-unpack "Media Dual Unpack unit" ()
  814. 1 1 ; issue done
  815. () ; state
  816. ((FRinti INT -1)) ; inputs
  817. ((FRintk INT -1)) ; outputs
  818. () ; profile action (default)
  819. )
  820. ; Media Dual byte to half unit
  821. (unit u-media-dual-btoh "Media Byte to byte" ()
  822. 1 1 ; issue done
  823. () ; state
  824. ((FRintj INT -1)) ; inputs
  825. ((FRintk INT -1)) ; outputs
  826. () ; profile action (default)
  827. )
  828. ; Media Dual half to byte unit
  829. (unit u-media-dual-htob "Media Half to byte" ()
  830. 1 1 ; issue done
  831. () ; state
  832. ((FRintj INT -1)) ; inputs
  833. ((FRintk INT -1)) ; outputs
  834. () ; profile action (default)
  835. )
  836. ; Media Dual byte to half unit extended
  837. (unit u-media-dual-btohe "Media Byte to byte extended" ()
  838. 1 1 ; issue done
  839. () ; state
  840. ((FRintj INT -1)) ; inputs
  841. ((FRintk INT -1)) ; outputs
  842. () ; profile action (default)
  843. )
  844. ; Barrier unit
  845. (unit u-barrier "Barrier unit" ()
  846. 1 1 ; issue done
  847. () ; state
  848. () ; inputs
  849. () ; outputs
  850. () ; profile action (default)
  851. )
  852. ; Memory Barrier unit
  853. (unit u-membar "Memory Barrier unit" ()
  854. 1 1 ; issue done
  855. () ; state
  856. () ; inputs
  857. () ; outputs
  858. () ; profile action (default)
  859. )
  860. ; Insn cache invalidate unit
  861. (unit u-ici "Insn cache invalidate unit" ()
  862. 1 1 ; issue done
  863. () ; state
  864. ((GRi INT -1) (GRj INT -1)) ; inputs
  865. () ; outputs
  866. () ; profile action (default)
  867. )
  868. ; Data cache invalidate unit
  869. (unit u-dci "Data cache invalidate unit" ()
  870. 1 1 ; issue done
  871. () ; state
  872. ((GRi INT -1) (GRj INT -1)) ; inputs
  873. () ; outputs
  874. () ; profile action (default)
  875. )
  876. ; Data cache flush unit
  877. (unit u-dcf "Data cache flush unit" ()
  878. 1 1 ; issue done
  879. () ; state
  880. ((GRi INT -1) (GRj INT -1)) ; inputs
  881. () ; outputs
  882. () ; profile action (default)
  883. )
  884. ; Insn cache preload unit
  885. (unit u-icpl "Insn cache preload unit" ()
  886. 1 1 ; issue done
  887. () ; state
  888. ((GRi INT -1) (GRj INT -1)) ; inputs
  889. () ; outputs
  890. () ; profile action (default)
  891. )
  892. ; Data cache preload unit
  893. (unit u-dcpl "Data cache preload unit" ()
  894. 1 1 ; issue done
  895. () ; state
  896. ((GRi INT -1) (GRj INT -1)) ; inputs
  897. () ; outputs
  898. () ; profile action (default)
  899. )
  900. ; Insn cache unlock unit
  901. (unit u-icul "Insn cache unlock unit" ()
  902. 1 1 ; issue done
  903. () ; state
  904. ((GRi INT -1) (GRj INT -1)) ; inputs
  905. () ; outputs
  906. () ; profile action (default)
  907. )
  908. ; Data cache unlock unit
  909. (unit u-dcul "Data cache unlock unit" ()
  910. 1 1 ; issue done
  911. () ; state
  912. ((GRi INT -1) (GRj INT -1)) ; inputs
  913. () ; outputs
  914. () ; profile action (default)
  915. )
  916. ; commit unit
  917. (unit u-commit "Commit Unit" ()
  918. 1 1 ; issue done
  919. () ; state
  920. ((GRk INT -1) (FRk INT -1)) ; inputs
  921. () ; outputs
  922. () ; profile action (default)
  923. )
  924. )
  925. ; Tomcat machine. Early version of fr500 machine
  926. (define-mach
  927. (name tomcat)
  928. (comment "Tomcat -- early version of fr500")
  929. (cpu frvbf)
  930. )
  931. (define-model
  932. (name tomcat) (comment "Tomcat model") (attrs)
  933. (mach tomcat)
  934. (pipeline all "" () ((fetch) (decode) (execute) (writeback)))
  935. ; `state' is a list of variables for recording model state
  936. ; (state)
  937. (unit u-exec "Execution Unit" ()
  938. 1 1 ; issue done
  939. () ; state
  940. () ; inputs
  941. () ; outputs
  942. () ; profile action (default)
  943. )
  944. )
  945. ; FR400 machine
  946. (define-mach
  947. (name fr400)
  948. (comment "FR400 cpu")
  949. (cpu frvbf)
  950. )
  951. (define-model
  952. (name fr400) (comment "FR400 model") (attrs)
  953. (mach fr400)
  954. (pipeline all "" () ((fetch) (decode) (execute) (writeback)))
  955. ; `state' is a list of variables for recording model state
  956. (state
  957. ; State items
  958. ; These are all masks with each bit representing one register.
  959. (prev-fp-load DI) ; Previous use of FR register was floating point load
  960. (prev-fr-p4 DI) ; Previous use of FR register was media unit 4
  961. (prev-fr-p6 DI) ; Previous use of FR register was media unit 6
  962. (prev-acc-p2 DI) ; Previous use of ACC register was media unit 2
  963. (prev-acc-p4 DI) ; Previous use of ACC register was media unit 4
  964. (cur-fp-load DI) ; Current use of FR register is floating point load
  965. (cur-fr-p4 DI) ; Current use of FR register is media unit 4
  966. (cur-fr-p6 DI) ; Current use of FR register is media unit 6
  967. (cur-acc-p2 DI) ; Current use of ACC register is media unit 2
  968. (cur-acc-p4 DI) ; Current use of ACC register is media unit 4
  969. )
  970. (unit u-exec "Execution Unit" ()
  971. 1 1 ; issue done
  972. () ; state
  973. () ; inputs
  974. () ; outputs
  975. () ; profile action (default)
  976. )
  977. ; Basic integer insn unit
  978. (unit u-integer "Integer Unit" ()
  979. 1 1 ; issue done
  980. () ; state
  981. ((GRi INT -1) (GRj INT -1)) ; inputs
  982. ((GRk INT -1) (ICCi_1 INT -1)) ; outputs
  983. () ; profile action (default)
  984. )
  985. ; Integer multiplication unit
  986. (unit u-imul "Integer Multiplication Unit" ()
  987. 1 1 ; issue done
  988. () ; state
  989. ((GRi INT -1) (GRj INT -1)) ; inputs
  990. ((GRdoublek INT -1) (ICCi_1 INT -1)) ; outputs
  991. () ; profile action (default)
  992. )
  993. ; Integer division unit
  994. (unit u-idiv "Integer Division Unit" ()
  995. 1 1 ; issue done
  996. () ; state
  997. ((GRi INT -1) (GRj INT -1)) ; inputs
  998. ((GRk INT -1) (ICCi_1 INT -1)) ; outputs
  999. () ; profile action (default)
  1000. )
  1001. ; Branch unit
  1002. (unit u-branch "Branch Unit" ()
  1003. 1 1 ; issue done
  1004. () ; state
  1005. ((GRi INT -1) (GRj INT -1)
  1006. (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs
  1007. ((pc)) ; outputs
  1008. () ; profile action (default)
  1009. )
  1010. ; Trap unit
  1011. (unit u-trap "Trap Unit" ()
  1012. 1 1 ; issue done
  1013. () ; state
  1014. ((GRi INT -1) (GRj INT -1)
  1015. (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs
  1016. () ; outputs
  1017. () ; profile action (default)
  1018. )
  1019. ; Condition code check unit
  1020. (unit u-check "Check Unit" ()
  1021. 1 1 ; issue done
  1022. () ; state
  1023. ((ICCi_3 INT -1) (FCCi_3 INT -1)) ; inputs
  1024. () ; outputs
  1025. () ; profile action (default)
  1026. )
  1027. ; GR set half unit
  1028. (unit u-set-hilo "GR Set Half" ()
  1029. 1 1 ; issue done
  1030. () ; state
  1031. () ; inputs
  1032. ((GRkhi INT -1) (GRklo INT -1)) ; outputs
  1033. () ; profile action (default)
  1034. )
  1035. ; GR load unit -- TODO doesn't handle quad
  1036. (unit u-gr-load "GR Load Unit" ()
  1037. 1 1 ; issue done
  1038. () ; state
  1039. ((GRi INT -1) (GRj INT -1)) ; inputs
  1040. ((GRk INT -1) (GRdoublek INT -1)) ; outputs
  1041. () ; profile action (default)
  1042. )
  1043. ; GR store unit -- TODO doesn't handle quad
  1044. (unit u-gr-store "GR Store Unit" ()
  1045. 1 1 ; issue done
  1046. () ; state
  1047. ((GRi INT -1) (GRj INT -1) (GRk INT -1) (GRdoublek INT -1)) ; inputs
  1048. () ; outputs
  1049. () ; profile action (default)
  1050. )
  1051. ; FR load unit -- TODO doesn't handle quad
  1052. (unit u-fr-load "FR Load Unit" ()
  1053. 1 1 ; issue done
  1054. () ; state
  1055. ((GRi INT -1) (GRj INT -1)) ; inputs
  1056. ((FRintk INT -1) (FRdoublek INT -1)) ; outputs
  1057. () ; profile action (default)
  1058. )
  1059. ; FR store unit -- TODO doesn't handle quad
  1060. (unit u-fr-store "FR Store Unit" ()
  1061. 1 1 ; issue done
  1062. () ; state
  1063. ((GRi INT -1) (GRj INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; inputs
  1064. () ; outputs
  1065. () ; profile action (default)
  1066. )
  1067. ; Swap unit
  1068. (unit u-swap "Swap Unit" ()
  1069. 1 1 ; issue done
  1070. () ; state
  1071. ((GRi INT -1) (GRj INT -1)) ; inputs
  1072. ((GRk INT -1)) ; outputs
  1073. () ; profile action (default)
  1074. )
  1075. ; FR Move to GR unit
  1076. (unit u-fr2gr "FR Move to GR Unit" ()
  1077. 1 1 ; issue done
  1078. () ; state
  1079. ((FRintk INT -1)) ; inputs
  1080. ((GRj INT -1)) ; outputs
  1081. () ; profile action (default)
  1082. )
  1083. ; SPR Move to GR unit
  1084. (unit u-spr2gr "SPR Move to GR Unit" ()
  1085. 1 1 ; issue done
  1086. () ; state
  1087. ((spr INT -1)) ; inputs
  1088. ((GRj INT -1)) ; outputs
  1089. () ; profile action (default)
  1090. )
  1091. ; GR Move to FR unit
  1092. (unit u-gr2fr "GR Move to FR Unit" ()
  1093. 1 1 ; issue done
  1094. () ; state
  1095. ((GRj INT -1)) ; inputs
  1096. ((FRintk INT -1)) ; outputs
  1097. () ; profile action (default)
  1098. )
  1099. ; GR Move to SPR unit
  1100. (unit u-gr2spr "GR Move to SPR Unit" ()
  1101. 1 1 ; issue done
  1102. () ; state
  1103. ((GRj INT -1)) ; inputs
  1104. ((spr INT -1)) ; outputs
  1105. () ; profile action (default)
  1106. )
  1107. ; Media unit M1 -- see table 13-8 in the fr400 LSI
  1108. (unit u-media-1 "Media-1 unit" ()
  1109. 1 1 ; issue done
  1110. () ; state
  1111. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  1112. ((FRintk INT -1)) ; outputs
  1113. () ; profile action (default)
  1114. )
  1115. (unit u-media-1-quad "Media-1-quad unit" ()
  1116. 1 1 ; issue done
  1117. () ; state
  1118. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  1119. ((FRintk INT -1)) ; outputs
  1120. () ; profile action (default)
  1121. )
  1122. (unit u-media-hilo "Media-hilo unit -- a variation of the Media-1 unit" ()
  1123. 1 1 ; issue done
  1124. () ; state
  1125. () ; inputs
  1126. ((FRkhi INT -1) (FRklo INT -1)) ; outputs
  1127. () ; profile action (default)
  1128. )
  1129. ; Media unit M2 -- see table 13-8 in the fr400 LSI
  1130. (unit u-media-2 "Media-2 unit" ()
  1131. 1 1 ; issue done
  1132. () ; state
  1133. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  1134. ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs
  1135. () ; profile action (default)
  1136. )
  1137. (unit u-media-2-quad "Media-2-quad unit" ()
  1138. 1 1 ; issue done
  1139. () ; state
  1140. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  1141. ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs
  1142. () ; profile action (default)
  1143. )
  1144. (unit u-media-2-acc "Media-2-acc unit" ()
  1145. 1 1 ; issue done
  1146. () ; state
  1147. ((ACC40Si INT -1)) ; inputs
  1148. ((ACC40Sk INT -1)) ; outputs
  1149. () ; profile action (default)
  1150. )
  1151. (unit u-media-2-acc-dual "Media-2-acc-dual unit" ()
  1152. 1 1 ; issue done
  1153. () ; state
  1154. ((ACC40Si INT -1)) ; inputs
  1155. ((ACC40Sk INT -1)) ; outputs
  1156. () ; profile action (default)
  1157. )
  1158. (unit u-media-2-add-sub "Media-2-add-sub unit" ()
  1159. 1 1 ; issue done
  1160. () ; state
  1161. ((ACC40Si INT -1)) ; inputs
  1162. ((ACC40Sk INT -1)) ; outputs
  1163. () ; profile action (default)
  1164. )
  1165. (unit u-media-2-add-sub-dual "Media-2-add-sub-dual unit" ()
  1166. 1 1 ; issue done
  1167. () ; state
  1168. ((ACC40Si INT -1)) ; inputs
  1169. ((ACC40Sk INT -1)) ; outputs
  1170. () ; profile action (default)
  1171. )
  1172. ; Media unit M3 -- see table 13-8 in the fr400 LSI
  1173. (unit u-media-3 "Media-3 unit" ()
  1174. 1 1 ; issue done
  1175. () ; state
  1176. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  1177. ((FRintk INT -1)) ; outputs
  1178. () ; profile action (default)
  1179. )
  1180. (unit u-media-3-dual "Media-3-dual unit" ()
  1181. 1 1 ; issue done
  1182. () ; state
  1183. ((FRinti INT -1)) ; inputs
  1184. ((FRintk INT -1)) ; outputs
  1185. () ; profile action (default)
  1186. )
  1187. (unit u-media-3-quad "Media-3-quad unit" ()
  1188. 1 1 ; issue done
  1189. () ; state
  1190. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  1191. ((FRintk INT -1)) ; outputs
  1192. () ; profile action (default)
  1193. )
  1194. ; Media unit M4 -- see table 13-8 in the fr400 LSI
  1195. (unit u-media-4 "Media-4 unit" ()
  1196. 1 1 ; issue done
  1197. () ; state
  1198. ((ACC40Si INT -1) (FRintj INT -1)) ; inputs
  1199. ((ACC40Sk INT -1) (FRintk INT -1)) ; outputs
  1200. () ; profile action (default)
  1201. )
  1202. (unit u-media-4-accg "Media-4-accg unit" ()
  1203. 1 1 ; issue done
  1204. () ; state
  1205. ((ACCGi INT -1) (FRinti INT -1)) ; inputs
  1206. ((ACCGk INT -1) (FRintk INT -1)) ; outputs
  1207. () ; profile action (default)
  1208. )
  1209. (unit u-media-4-acc-dual "Media-4-acc-dual unit" ()
  1210. 1 1 ; issue done
  1211. () ; state
  1212. ((ACC40Si INT -1)) ; inputs
  1213. ((FRintk INT -1)) ; outputs
  1214. () ; profile action (default)
  1215. )
  1216. ; Media unit M6 -- see table 13-8 in the fr400 LSI
  1217. (unit u-media-6 "Media-6 unit" ()
  1218. 1 1 ; issue done
  1219. () ; state
  1220. ((FRinti INT -1)) ; inputs
  1221. ((FRintk INT -1)) ; outputs
  1222. () ; profile action (default)
  1223. )
  1224. ; Media unit M7 -- see table 13-8 in the fr400 LSI
  1225. (unit u-media-7 "Media-1 unit" ()
  1226. 1 1 ; issue done
  1227. () ; state
  1228. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  1229. ((FCCk INT -1)) ; outputs
  1230. () ; profile action (default)
  1231. )
  1232. ; Media Dual Expand unit
  1233. (unit u-media-dual-expand "Media Dual Expand unit" ()
  1234. 1 1 ; issue done
  1235. () ; state
  1236. ((FRinti INT -1)) ; inputs
  1237. ((FRintk INT -1)) ; outputs
  1238. () ; profile action (default)
  1239. )
  1240. ; Media Dual half to byte unit
  1241. (unit u-media-dual-htob "Media Half to byte" ()
  1242. 1 1 ; issue done
  1243. () ; state
  1244. ((FRintj INT -1)) ; inputs
  1245. ((FRintk INT -1)) ; outputs
  1246. () ; profile action (default)
  1247. )
  1248. ; Barrier unit
  1249. (unit u-barrier "Barrier unit" ()
  1250. 1 1 ; issue done
  1251. () ; state
  1252. () ; inputs
  1253. () ; outputs
  1254. () ; profile action (default)
  1255. )
  1256. ; Memory Barrier unit
  1257. (unit u-membar "Memory Barrier unit" ()
  1258. 1 1 ; issue done
  1259. () ; state
  1260. () ; inputs
  1261. () ; outputs
  1262. () ; profile action (default)
  1263. )
  1264. ; Insn cache invalidate unit
  1265. (unit u-ici "Insn cache invalidate unit" ()
  1266. 1 1 ; issue done
  1267. () ; state
  1268. ((GRi INT -1) (GRj INT -1)) ; inputs
  1269. () ; outputs
  1270. () ; profile action (default)
  1271. )
  1272. ; Data cache invalidate unit
  1273. (unit u-dci "Data cache invalidate unit" ()
  1274. 1 1 ; issue done
  1275. () ; state
  1276. ((GRi INT -1) (GRj INT -1)) ; inputs
  1277. () ; outputs
  1278. () ; profile action (default)
  1279. )
  1280. ; Data cache flush unit
  1281. (unit u-dcf "Data cache flush unit" ()
  1282. 1 1 ; issue done
  1283. () ; state
  1284. ((GRi INT -1) (GRj INT -1)) ; inputs
  1285. () ; outputs
  1286. () ; profile action (default)
  1287. )
  1288. ; Insn cache preload unit
  1289. (unit u-icpl "Insn cache preload unit" ()
  1290. 1 1 ; issue done
  1291. () ; state
  1292. ((GRi INT -1) (GRj INT -1)) ; inputs
  1293. () ; outputs
  1294. () ; profile action (default)
  1295. )
  1296. ; Data cache preload unit
  1297. (unit u-dcpl "Data cache preload unit" ()
  1298. 1 1 ; issue done
  1299. () ; state
  1300. ((GRi INT -1) (GRj INT -1)) ; inputs
  1301. () ; outputs
  1302. () ; profile action (default)
  1303. )
  1304. ; Insn cache unlock unit
  1305. (unit u-icul "Insn cache unlock unit" ()
  1306. 1 1 ; issue done
  1307. () ; state
  1308. ((GRi INT -1) (GRj INT -1)) ; inputs
  1309. () ; outputs
  1310. () ; profile action (default)
  1311. )
  1312. ; Data cache unlock unit
  1313. (unit u-dcul "Data cache unlock unit" ()
  1314. 1 1 ; issue done
  1315. () ; state
  1316. ((GRi INT -1) (GRj INT -1)) ; inputs
  1317. () ; outputs
  1318. () ; profile action (default)
  1319. )
  1320. )
  1321. ; FR450 machine
  1322. (define-mach
  1323. (name fr450)
  1324. (comment "FR450 cpu")
  1325. (cpu frvbf)
  1326. )
  1327. (define-model
  1328. (name fr450) (comment "FR450 model") (attrs)
  1329. (mach fr450)
  1330. (pipeline all "" () ((fetch) (decode) (execute) (writeback)))
  1331. ; `state' is a list of variables for recording model state
  1332. (state
  1333. ; State items
  1334. ; These are all masks with each bit representing one register.
  1335. (prev-fp-load DI) ; Previous use of FR register was floating point load
  1336. (prev-fr-p4 DI) ; Previous use of FR register was media unit 4
  1337. (prev-fr-p6 DI) ; Previous use of FR register was media unit 6
  1338. (prev-acc-p2 DI) ; Previous use of ACC register was media unit 2
  1339. (prev-acc-p4 DI) ; Previous use of ACC register was media unit 4
  1340. (cur-fp-load DI) ; Current use of FR register is floating point load
  1341. (cur-fr-p4 DI) ; Current use of FR register is media unit 4
  1342. (cur-fr-p6 DI) ; Current use of FR register is media unit 6
  1343. (cur-acc-p2 DI) ; Current use of ACC register is media unit 2
  1344. (cur-acc-p4 DI) ; Current use of ACC register is media unit 4
  1345. )
  1346. (unit u-exec "Execution Unit" ()
  1347. 1 1 ; issue done
  1348. () ; state
  1349. () ; inputs
  1350. () ; outputs
  1351. () ; profile action (default)
  1352. )
  1353. ; Basic integer insn unit
  1354. (unit u-integer "Integer Unit" ()
  1355. 1 1 ; issue done
  1356. () ; state
  1357. ((GRi INT -1) (GRj INT -1)) ; inputs
  1358. ((GRk INT -1) (ICCi_1 INT -1)) ; outputs
  1359. () ; profile action (default)
  1360. )
  1361. ; Integer multiplication unit
  1362. (unit u-imul "Integer Multiplication Unit" ()
  1363. 1 1 ; issue done
  1364. () ; state
  1365. ((GRi INT -1) (GRj INT -1)) ; inputs
  1366. ((GRdoublek INT -1) (ICCi_1 INT -1)) ; outputs
  1367. () ; profile action (default)
  1368. )
  1369. ; Integer division unit
  1370. (unit u-idiv "Integer Division Unit" ()
  1371. 1 1 ; issue done
  1372. () ; state
  1373. ((GRi INT -1) (GRj INT -1)) ; inputs
  1374. ((GRk INT -1) (ICCi_1 INT -1)) ; outputs
  1375. () ; profile action (default)
  1376. )
  1377. ; Branch unit
  1378. (unit u-branch "Branch Unit" ()
  1379. 1 1 ; issue done
  1380. () ; state
  1381. ((GRi INT -1) (GRj INT -1)
  1382. (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs
  1383. ((pc)) ; outputs
  1384. () ; profile action (default)
  1385. )
  1386. ; Trap unit
  1387. (unit u-trap "Trap Unit" ()
  1388. 1 1 ; issue done
  1389. () ; state
  1390. ((GRi INT -1) (GRj INT -1)
  1391. (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs
  1392. () ; outputs
  1393. () ; profile action (default)
  1394. )
  1395. ; Condition code check unit
  1396. (unit u-check "Check Unit" ()
  1397. 1 1 ; issue done
  1398. () ; state
  1399. ((ICCi_3 INT -1) (FCCi_3 INT -1)) ; inputs
  1400. () ; outputs
  1401. () ; profile action (default)
  1402. )
  1403. ; GR set half unit
  1404. (unit u-set-hilo "GR Set Half" ()
  1405. 1 1 ; issue done
  1406. () ; state
  1407. () ; inputs
  1408. ((GRkhi INT -1) (GRklo INT -1)) ; outputs
  1409. () ; profile action (default)
  1410. )
  1411. ; GR load unit -- TODO doesn't handle quad
  1412. (unit u-gr-load "GR Load Unit" ()
  1413. 1 1 ; issue done
  1414. () ; state
  1415. ((GRi INT -1) (GRj INT -1)) ; inputs
  1416. ((GRk INT -1) (GRdoublek INT -1)) ; outputs
  1417. () ; profile action (default)
  1418. )
  1419. ; GR store unit -- TODO doesn't handle quad
  1420. (unit u-gr-store "GR Store Unit" ()
  1421. 1 1 ; issue done
  1422. () ; state
  1423. ((GRi INT -1) (GRj INT -1) (GRk INT -1) (GRdoublek INT -1)) ; inputs
  1424. () ; outputs
  1425. () ; profile action (default)
  1426. )
  1427. ; FR load unit -- TODO doesn't handle quad
  1428. (unit u-fr-load "FR Load Unit" ()
  1429. 1 1 ; issue done
  1430. () ; state
  1431. ((GRi INT -1) (GRj INT -1)) ; inputs
  1432. ((FRintk INT -1) (FRdoublek INT -1)) ; outputs
  1433. () ; profile action (default)
  1434. )
  1435. ; FR store unit -- TODO doesn't handle quad
  1436. (unit u-fr-store "FR Store Unit" ()
  1437. 1 1 ; issue done
  1438. () ; state
  1439. ((GRi INT -1) (GRj INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; inputs
  1440. () ; outputs
  1441. () ; profile action (default)
  1442. )
  1443. ; Swap unit
  1444. (unit u-swap "Swap Unit" ()
  1445. 1 1 ; issue done
  1446. () ; state
  1447. ((GRi INT -1) (GRj INT -1)) ; inputs
  1448. ((GRk INT -1)) ; outputs
  1449. () ; profile action (default)
  1450. )
  1451. ; FR Move to GR unit
  1452. (unit u-fr2gr "FR Move to GR Unit" ()
  1453. 1 1 ; issue done
  1454. () ; state
  1455. ((FRintk INT -1)) ; inputs
  1456. ((GRj INT -1)) ; outputs
  1457. () ; profile action (default)
  1458. )
  1459. ; SPR Move to GR unit
  1460. (unit u-spr2gr "SPR Move to GR Unit" ()
  1461. 1 1 ; issue done
  1462. () ; state
  1463. ((spr INT -1)) ; inputs
  1464. ((GRj INT -1)) ; outputs
  1465. () ; profile action (default)
  1466. )
  1467. ; GR Move to FR unit
  1468. (unit u-gr2fr "GR Move to FR Unit" ()
  1469. 1 1 ; issue done
  1470. () ; state
  1471. ((GRj INT -1)) ; inputs
  1472. ((FRintk INT -1)) ; outputs
  1473. () ; profile action (default)
  1474. )
  1475. ; GR Move to SPR unit
  1476. (unit u-gr2spr "GR Move to SPR Unit" ()
  1477. 1 1 ; issue done
  1478. () ; state
  1479. ((GRj INT -1)) ; inputs
  1480. ((spr INT -1)) ; outputs
  1481. () ; profile action (default)
  1482. )
  1483. ; Media unit M1 -- see table 14-8 in the fr450 LSI
  1484. (unit u-media-1 "Media-1 unit" ()
  1485. 1 1 ; issue done
  1486. () ; state
  1487. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  1488. ((FRintk INT -1)) ; outputs
  1489. () ; profile action (default)
  1490. )
  1491. (unit u-media-1-quad "Media-1-quad unit" ()
  1492. 1 1 ; issue done
  1493. () ; state
  1494. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  1495. ((FRintk INT -1)) ; outputs
  1496. () ; profile action (default)
  1497. )
  1498. (unit u-media-hilo "Media-hilo unit -- a variation of the Media-1 unit" ()
  1499. 1 1 ; issue done
  1500. () ; state
  1501. () ; inputs
  1502. ((FRkhi INT -1) (FRklo INT -1)) ; outputs
  1503. () ; profile action (default)
  1504. )
  1505. ; Media unit M2 -- see table 14-8 in the fr450 LSI
  1506. (unit u-media-2 "Media-2 unit" ()
  1507. 1 1 ; issue done
  1508. () ; state
  1509. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  1510. ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs
  1511. () ; profile action (default)
  1512. )
  1513. (unit u-media-2-quad "Media-2-quad unit" ()
  1514. 1 1 ; issue done
  1515. () ; state
  1516. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  1517. ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs
  1518. () ; profile action (default)
  1519. )
  1520. (unit u-media-2-acc "Media-2-acc unit" ()
  1521. 1 1 ; issue done
  1522. () ; state
  1523. ((ACC40Si INT -1)) ; inputs
  1524. ((ACC40Sk INT -1)) ; outputs
  1525. () ; profile action (default)
  1526. )
  1527. (unit u-media-2-acc-dual "Media-2-acc-dual unit" ()
  1528. 1 1 ; issue done
  1529. () ; state
  1530. ((ACC40Si INT -1)) ; inputs
  1531. ((ACC40Sk INT -1)) ; outputs
  1532. () ; profile action (default)
  1533. )
  1534. (unit u-media-2-add-sub "Media-2-add-sub unit" ()
  1535. 1 1 ; issue done
  1536. () ; state
  1537. ((ACC40Si INT -1)) ; inputs
  1538. ((ACC40Sk INT -1)) ; outputs
  1539. () ; profile action (default)
  1540. )
  1541. (unit u-media-2-add-sub-dual "Media-2-add-sub-dual unit" ()
  1542. 1 1 ; issue done
  1543. () ; state
  1544. ((ACC40Si INT -1)) ; inputs
  1545. ((ACC40Sk INT -1)) ; outputs
  1546. () ; profile action (default)
  1547. )
  1548. ; Media unit M3 -- see table 14-8 in the fr450 LSI
  1549. (unit u-media-3 "Media-3 unit" ()
  1550. 1 1 ; issue done
  1551. () ; state
  1552. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  1553. ((FRintk INT -1)) ; outputs
  1554. () ; profile action (default)
  1555. )
  1556. (unit u-media-3-dual "Media-3-dual unit" ()
  1557. 1 1 ; issue done
  1558. () ; state
  1559. ((FRinti INT -1)) ; inputs
  1560. ((FRintk INT -1)) ; outputs
  1561. () ; profile action (default)
  1562. )
  1563. (unit u-media-3-quad "Media-3-quad unit" ()
  1564. 1 1 ; issue done
  1565. () ; state
  1566. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  1567. ((FRintk INT -1)) ; outputs
  1568. () ; profile action (default)
  1569. )
  1570. ; Media unit M4 -- see table 14-8 in the fr450 LSI
  1571. (unit u-media-4 "Media-4 unit" ()
  1572. 1 1 ; issue done
  1573. () ; state
  1574. ((ACC40Si INT -1) (FRintj INT -1)) ; inputs
  1575. ((ACC40Sk INT -1) (FRintk INT -1)) ; outputs
  1576. () ; profile action (default)
  1577. )
  1578. (unit u-media-4-accg "Media-4-accg unit" ()
  1579. 1 1 ; issue done
  1580. () ; state
  1581. ((ACCGi INT -1) (FRinti INT -1)) ; inputs
  1582. ((ACCGk INT -1) (FRintk INT -1)) ; outputs
  1583. () ; profile action (default)
  1584. )
  1585. (unit u-media-4-acc-dual "Media-4-acc-dual unit" ()
  1586. 1 1 ; issue done
  1587. () ; state
  1588. ((ACC40Si INT -1)) ; inputs
  1589. ((FRintk INT -1)) ; outputs
  1590. () ; profile action (default)
  1591. )
  1592. (unit u-media-4-mclracca "Media-4 unit for MCLRACC with #A=1" ()
  1593. 1 1 ; issue done
  1594. () ; state
  1595. () ; inputs
  1596. () ; outputs
  1597. () ; profile action (default)
  1598. )
  1599. ; Media unit M6 -- see table 14-8 in the fr450 LSI
  1600. (unit u-media-6 "Media-6 unit" ()
  1601. 1 1 ; issue done
  1602. () ; state
  1603. ((FRinti INT -1)) ; inputs
  1604. ((FRintk INT -1)) ; outputs
  1605. () ; profile action (default)
  1606. )
  1607. ; Media unit M7 -- see table 14-8 in the fr450 LSI
  1608. (unit u-media-7 "Media-1 unit" ()
  1609. 1 1 ; issue done
  1610. () ; state
  1611. ((FRinti INT -1) (FRintj INT -1)) ; inputs
  1612. ((FCCk INT -1)) ; outputs
  1613. () ; profile action (default)
  1614. )
  1615. ; Media Dual Expand unit
  1616. (unit u-media-dual-expand "Media Dual Expand unit" ()
  1617. 1 1 ; issue done
  1618. () ; state
  1619. ((FRinti INT -1)) ; inputs
  1620. ((FRintk INT -1)) ; outputs
  1621. () ; profile action (default)
  1622. )
  1623. ; Media Dual half to byte unit
  1624. (unit u-media-dual-htob "Media Half to byte" ()
  1625. 1 1 ; issue done
  1626. () ; state
  1627. ((FRintj INT -1)) ; inputs
  1628. ((FRintk INT -1)) ; outputs
  1629. () ; profile action (default)
  1630. )
  1631. ; Barrier unit
  1632. (unit u-barrier "Barrier unit" ()
  1633. 1 1 ; issue done
  1634. () ; state
  1635. () ; inputs
  1636. () ; outputs
  1637. () ; profile action (default)
  1638. )
  1639. ; Memory Barrier unit
  1640. (unit u-membar "Memory Barrier unit" ()
  1641. 1 1 ; issue done
  1642. () ; state
  1643. () ; inputs
  1644. () ; outputs
  1645. () ; profile action (default)
  1646. )
  1647. ; Insn cache invalidate unit
  1648. (unit u-ici "Insn cache invalidate unit" ()
  1649. 1 1 ; issue done
  1650. () ; state
  1651. ((GRi INT -1) (GRj INT -1)) ; inputs
  1652. () ; outputs
  1653. () ; profile action (default)
  1654. )
  1655. ; Data cache invalidate unit
  1656. (unit u-dci "Data cache invalidate unit" ()
  1657. 1 1 ; issue done
  1658. () ; state
  1659. ((GRi INT -1) (GRj INT -1)) ; inputs
  1660. () ; outputs
  1661. () ; profile action (default)
  1662. )
  1663. ; Data cache flush unit
  1664. (unit u-dcf "Data cache flush unit" ()
  1665. 1 1 ; issue done
  1666. () ; state
  1667. ((GRi INT -1) (GRj INT -1)) ; inputs
  1668. () ; outputs
  1669. () ; profile action (default)
  1670. )
  1671. ; Insn cache preload unit
  1672. (unit u-icpl "Insn cache preload unit" ()
  1673. 1 1 ; issue done
  1674. () ; state
  1675. ((GRi INT -1) (GRj INT -1)) ; inputs
  1676. () ; outputs
  1677. () ; profile action (default)
  1678. )
  1679. ; Data cache preload unit
  1680. (unit u-dcpl "Data cache preload unit" ()
  1681. 1 1 ; issue done
  1682. () ; state
  1683. ((GRi INT -1) (GRj INT -1)) ; inputs
  1684. () ; outputs
  1685. () ; profile action (default)
  1686. )
  1687. ; Insn cache unlock unit
  1688. (unit u-icul "Insn cache unlock unit" ()
  1689. 1 1 ; issue done
  1690. () ; state
  1691. ((GRi INT -1) (GRj INT -1)) ; inputs
  1692. () ; outputs
  1693. () ; profile action (default)
  1694. )
  1695. ; Data cache unlock unit
  1696. (unit u-dcul "Data cache unlock unit" ()
  1697. 1 1 ; issue done
  1698. () ; state
  1699. ((GRi INT -1) (GRj INT -1)) ; inputs
  1700. () ; outputs
  1701. () ; profile action (default)
  1702. )
  1703. )
  1704. ; Simple machine - single issue integer machine
  1705. (define-mach
  1706. (name simple)
  1707. (comment "Simple single issue integer cpu")
  1708. (cpu frvbf)
  1709. )
  1710. (define-model
  1711. (name simple) (comment "Simple model") (attrs)
  1712. (mach simple)
  1713. (pipeline all "" () ((fetch) (decode) (execute) (writeback)))
  1714. ; `state' is a list of variables for recording model state
  1715. (state)
  1716. (unit u-exec "Execution Unit" ()
  1717. 1 1 ; issue done
  1718. () ; state
  1719. () ; inputs
  1720. () ; outputs
  1721. () ; profile action (default)
  1722. )
  1723. )
  1724. ; The instruction fetch/execute cycle.
  1725. ;
  1726. ; This is how to fetch and decode an instruction.
  1727. ; Leave it out for now
  1728. ; (define-extract (const SI 0))
  1729. ; This is how to execute a decoded instruction.
  1730. ; Leave it out for now
  1731. ; (define-execute (const SI 0))
  1732. ; An attribute to describe which unit an insn runs in.
  1733. (define-attr
  1734. (for insn)
  1735. (type enum)
  1736. (name UNIT)
  1737. (comment "parallel execution pipeline selection")
  1738. ; The order of declaration is significant.
  1739. ; See the *_unit_mapping tables in frv.opc
  1740. ; Keep variations on the same unit together.
  1741. ; Keep the '01' variant immediately after the '1' variant in each unit.
  1742. ; Keep the 'ALL' variations immediately after the last numbered variant in each unit.
  1743. (values NIL
  1744. I0 I1 I01 I2 I3 IALL
  1745. FM0 FM1 FM01 FM2 FM3 FMALL FMLOW
  1746. B0 B1 B01
  1747. C
  1748. MULT-DIV ; multiply/division slotted differently on different machines
  1749. IACC ; iacc multiply slotted differently on different machines
  1750. LOAD ; loads slotted differently on different machines
  1751. STORE ; store slotted differently on different machines
  1752. SCAN ; scan, scani slotted differently on different machines
  1753. DCPL ; dcpl slotted differently on different machines
  1754. MDUALACC ; media dual acc slotted differently on different machines
  1755. MDCUTSSI ; mdcutssi insn slotted differently on different machines
  1756. MCLRACC-1; mclracc A==1 slotted differently on different machines
  1757. NUM_UNITS
  1758. )
  1759. )
  1760. ; Attributes to describe major categories of insns
  1761. (define-attr
  1762. (for insn)
  1763. (type enum)
  1764. (name FR400-MAJOR)
  1765. (comment "fr400 major insn categories")
  1766. ; The order of declaration is significant. Keep variations on the same major
  1767. ; together.
  1768. (values NONE
  1769. I-1 I-2 I-3 I-4 I-5
  1770. B-1 B-2 B-3 B-4 B-5 B-6
  1771. C-1 C-2
  1772. M-1 M-2
  1773. )
  1774. )
  1775. (define-attr
  1776. (for insn)
  1777. (type enum)
  1778. (name FR450-MAJOR)
  1779. (comment "fr450 major insn categories")
  1780. ; The order of declaration is significant. Keep variations on the same major
  1781. ; together.
  1782. (values NONE
  1783. I-1 I-2 I-3 I-4 I-5
  1784. B-1 B-2 B-3 B-4 B-5 B-6
  1785. C-1 C-2
  1786. M-1 M-2 M-3 M-4 M-5 M-6
  1787. )
  1788. )
  1789. (define-attr
  1790. (for insn)
  1791. (type enum)
  1792. (name FR500-MAJOR)
  1793. (comment "fr500 major insn categories")
  1794. ; The order of declaration is significant. Keep variations on the same major
  1795. ; together.
  1796. (values NONE
  1797. I-1 I-2 I-3 I-4 I-5 I-6
  1798. B-1 B-2 B-3 B-4 B-5 B-6
  1799. C-1 C-2
  1800. F-1 F-2 F-3 F-4 F-5 F-6 F-7 F-8
  1801. M-1 M-2 M-3 M-4 M-5 M-6 M-7 M-8
  1802. )
  1803. )
  1804. (define-attr
  1805. (for insn)
  1806. (type enum)
  1807. (name FR550-MAJOR)
  1808. (comment "fr550 major insn categories")
  1809. ; The order of declaration is significant. Keep variations on the same major
  1810. ; together.
  1811. (values NONE
  1812. I-1 I-2 I-3 I-4 I-5 I-6 I-7 I-8
  1813. B-1 B-2 B-3 B-4 B-5 B-6
  1814. C-1 C-2
  1815. F-1 F-2 F-3 F-4
  1816. M-1 M-2 M-3 M-4 M-5
  1817. )
  1818. )
  1819. ; Privileged insn
  1820. (define-attr
  1821. (for insn)
  1822. (type boolean)
  1823. (name PRIVILEGED)
  1824. (comment "insn only allowed in supervisor mode")
  1825. )
  1826. ; Non-Excepting insn
  1827. (define-attr
  1828. (for insn)
  1829. (type boolean)
  1830. (name NON-EXCEPTING)
  1831. (comment "non-excepting insn")
  1832. )
  1833. ; Conditional insn
  1834. (define-attr
  1835. (for insn)
  1836. (type boolean)
  1837. (name CONDITIONAL)
  1838. (comment "conditional insn")
  1839. )
  1840. ; insn accesses FR registers
  1841. (define-attr
  1842. (for insn)
  1843. (type boolean)
  1844. (name FR-ACCESS)
  1845. (comment "insn accesses FR registers")
  1846. )
  1847. ; insn preserves MSR.OVF
  1848. (define-attr
  1849. (for insn)
  1850. (type boolean)
  1851. (name PRESERVE-OVF)
  1852. (comment "Preserve value of MSR.OVF")
  1853. )
  1854. ; "Audio" instruction provided by the fr405 but not the original fr400 core.
  1855. (define-attr
  1856. (for insn)
  1857. (type boolean)
  1858. (name AUDIO)
  1859. (comment "Audio instruction added with FR405")
  1860. )
  1861. ; null attribute -- used as a place holder for where an attribue is required.
  1862. (define-attr
  1863. (for insn)
  1864. (type boolean)
  1865. (name NA)
  1866. (comment "placeholder attribute")
  1867. (attrs META) ; do not define in any generated file for now
  1868. )
  1869. ; IDOC attribute for instruction documentation.
  1870. (define-attr
  1871. (for insn)
  1872. (type enum)
  1873. (name IDOC)
  1874. (comment "insn kind for documentation")
  1875. (attrs META)
  1876. (values
  1877. (MEM - () "Memory")
  1878. (ALU - () "ALU")
  1879. (FPU - () "FPU")
  1880. (BR - () "Branch")
  1881. (PRIV - () "Priviledged")
  1882. (MISC - () "Miscellaneous")
  1883. )
  1884. )
  1885. ; Instruction fields.
  1886. ;
  1887. ; Attributes:
  1888. ; PCREL-ADDR: pc relative value (for reloc and disassembly purposes)
  1889. ; ABS-ADDR: absolute address (for reloc and disassembly purposes?)
  1890. ; RESERVED: bits are not used to decode insn, must be all 0
  1891. (dnf f-pack "packing bit" () 31 1)
  1892. (dnf f-op "primary opcode" () 24 7)
  1893. (dnf f-ope1 "extended opcode" () 11 6)
  1894. (dnf f-ope2 "extended opcode" () 9 4)
  1895. (dnf f-ope3 "extended opcode" () 15 3)
  1896. (dnf f-ope4 "extended opcode" () 7 2)
  1897. (dnf f-GRi "source register 1" () 17 6)
  1898. (dnf f-GRj "source register 2" () 5 6)
  1899. (dnf f-GRk "destination register" () 30 6)
  1900. (dnf f-FRi "source register 1" () 17 6)
  1901. (dnf f-FRj "source register 2" () 5 6)
  1902. (dnf f-FRk "destination register" () 30 6)
  1903. (dnf f-CPRi "source register 1" () 17 6)
  1904. (dnf f-CPRj "source register 2" () 5 6)
  1905. (dnf f-CPRk "destination register" () 30 6)
  1906. (dnf f-ACCGi "source register" () 17 6)
  1907. (dnf f-ACCGk "destination register" () 30 6)
  1908. (dnf f-ACC40Si "40 bit signed accumulator" () 17 6)
  1909. (dnf f-ACC40Ui "40 bit unsigned accumulator" () 17 6)
  1910. (dnf f-ACC40Sk "40 bit accumulator" () 30 6)
  1911. (dnf f-ACC40Uk "40 bit accumulator" () 30 6)
  1912. (dnf f-CRi "source register" () 14 3)
  1913. (dnf f-CRj "source register" () 2 3)
  1914. (dnf f-CRk "destination register" () 27 3)
  1915. (dnf f-CCi "condition register" () 11 3)
  1916. (df f-CRj_int "target cr for ck insns" () 26 2 UINT
  1917. ((value pc) (sub WI value 4))
  1918. ((value pc) (add WI value 4))
  1919. )
  1920. (dnf f-CRj_float "target cr for fck insns" () 26 2)
  1921. (dnf f-ICCi_1 "condition register" () 11 2)
  1922. (dnf f-ICCi_2 "condition register" () 26 2)
  1923. (dnf f-ICCi_3 "condition register" () 1 2)
  1924. (dnf f-FCCi_1 "condition register" () 11 2)
  1925. (dnf f-FCCi_2 "condition register" () 26 2)
  1926. (dnf f-FCCi_3 "condition register" () 1 2)
  1927. (dnf f-FCCk "condition register" () 26 2)
  1928. (dnf f-eir "exception insn register" () 17 6)
  1929. (df f-s10 "10 bit sign extended" () 9 10 INT #f #f)
  1930. (df f-s12 "12 bit sign extended" () 11 12 INT #f #f)
  1931. (df f-d12 "12 bit sign extended" () 11 12 INT #f #f)
  1932. (df f-u16 "16 bit unsigned" () 15 16 UINT #f #f)
  1933. (df f-s16 "16 bit sign extended" () 15 16 INT #f #f)
  1934. (df f-s6 "6 bit signed" () 5 6 INT #f #f)
  1935. (df f-s6_1 "6 bit signed" () 11 6 INT #f #f)
  1936. (df f-u6 "6 bit unsigned" () 5 6 UINT #f #f)
  1937. (df f-s5 "5 bit signed" () 4 5 INT #f #f)
  1938. (df f-u12-h "upper 6 bits of u12" () 17 6 INT #f #f)
  1939. (df f-u12-l "lower 6 bits of u12" () 5 6 UINT #f #f)
  1940. (dnmf f-u12 "12 bit signed immediate" () INT
  1941. (f-u12-h f-u12-l)
  1942. (sequence () ; insert
  1943. (set (ifield f-u12-h) (sra SI (ifield f-u12) 6))
  1944. (set (ifield f-u12-l) (and (ifield f-u12) #x3f))
  1945. )
  1946. (sequence () ; extract
  1947. (set (ifield f-u12) (or (sll (ifield f-u12-h) 6)
  1948. (ifield f-u12-l)))
  1949. )
  1950. )
  1951. (dnf f-int-cc "integer branch conditions" () 30 4)
  1952. (dnf f-flt-cc "floating branch conditions" () 30 4)
  1953. (df f-cond "conditional arithmetic" () 8 1 UINT #f #f)
  1954. (df f-ccond "lr branch condition" () 12 1 UINT #f #f)
  1955. (df f-hint "2 bit branch prediction hint" () 17 2 UINT #f #f)
  1956. (df f-LI "link indicator" () 25 1 UINT #f #f)
  1957. (df f-lock "cache lock indicator" () 25 1 UINT #f #f)
  1958. (df f-debug "debug mode indicator" () 25 1 UINT #f #f)
  1959. (df f-A "all accumulator bit" () 17 1 UINT #f #f)
  1960. (df f-ae "cache all entries indicator" () 25 1 UINT #f #f)
  1961. (dnf f-spr-h "upper 6 bits of spr" () 30 6)
  1962. (dnf f-spr-l "lower 6 bits of spr" () 17 6)
  1963. (dnmf f-spr "special purpose register" () UINT
  1964. (f-spr-h f-spr-l)
  1965. (sequence () ; insert
  1966. (set (ifield f-spr-h) (srl (ifield f-spr) (const 6)))
  1967. (set (ifield f-spr-l) (and (ifield f-spr) (const #x3f)))
  1968. )
  1969. (sequence () ; extract
  1970. (set (ifield f-spr) (or (sll (ifield f-spr-h) (const 6))
  1971. (ifield f-spr-l)))
  1972. )
  1973. )
  1974. (df f-label16 "18 bit pc relative signed offset" (PCREL-ADDR) 15 16 INT
  1975. ((value pc) (sra WI (sub WI value pc) (const 2)))
  1976. ((value pc) (add WI (sll WI value (const 2)) pc))
  1977. )
  1978. (df f-labelH6 "upper 6 bits of label24" () 30 6 INT #f #f)
  1979. (dnf f-labelL18 "lower 18 bits of label24" () 17 18)
  1980. (dnmf f-label24 "26 bit signed offset" (PCREL-ADDR) INT
  1981. (f-labelH6 f-labelL18)
  1982. ; insert
  1983. (sequence ()
  1984. (set (ifield f-labelH6)
  1985. (sra WI (sub (ifield f-label24) pc) (const 20)))
  1986. (set (ifield f-labelL18)
  1987. (and (srl (sub (ifield f-label24) pc) (const 2))
  1988. (const #x3ffff)))
  1989. )
  1990. ; extract
  1991. (sequence ()
  1992. (set (ifield f-label24)
  1993. (add (sll (or (sll (ifield f-labelH6) (const 18))
  1994. (ifield f-labelL18))
  1995. (const 2))
  1996. pc)))
  1997. )
  1998. (dnf f-LRAE "Load Real Address E flag" () 5 1)
  1999. (dnf f-LRAD "Load Real Address D flag" () 4 1)
  2000. (dnf f-LRAS "Load Real Address S flag" () 3 1)
  2001. (dnf f-TLBPRopx "TLB Probe operation number" () 28 3)
  2002. (dnf f-TLBPRL "TLB Probe L flag" () 25 1)
  2003. (dnf f-ICCi_1-null "null field" (RESERVED) 11 2)
  2004. (dnf f-ICCi_2-null "null field" (RESERVED) 26 2)
  2005. (dnf f-ICCi_3-null "null field" (RESERVED) 1 2)
  2006. (dnf f-FCCi_1-null "null field" (RESERVED) 11 2)
  2007. (dnf f-FCCi_2-null "null field" (RESERVED) 26 2)
  2008. (dnf f-FCCi_3-null "null field" (RESERVED) 1 2)
  2009. (dnf f-rs-null "null field" (RESERVED) 17 6)
  2010. (dnf f-GRi-null "null field" (RESERVED) 17 6)
  2011. (dnf f-GRj-null "null field" (RESERVED) 5 6)
  2012. (dnf f-GRk-null "null field" (RESERVED) 30 6)
  2013. (dnf f-FRi-null "null field" (RESERVED) 17 6)
  2014. (dnf f-FRj-null "null field" (RESERVED) 5 6)
  2015. (dnf f-ACCj-null "null field" (RESERVED) 5 6)
  2016. (dnf f-rd-null "null field" (RESERVED) 30 6)
  2017. (dnf f-cond-null "null field" (RESERVED) 30 4)
  2018. (dnf f-ccond-null "null field" (RESERVED) 12 1)
  2019. (dnf f-s12-null "null field" (RESERVED) 11 12)
  2020. (dnf f-label16-null "null field" (RESERVED) 15 16)
  2021. (dnf f-misc-null-1 "null field" (RESERVED) 30 5)
  2022. (dnf f-misc-null-2 "null field" (RESERVED) 11 6)
  2023. (dnf f-misc-null-3 "null field" (RESERVED) 11 4)
  2024. (dnf f-misc-null-4 "null field" (RESERVED) 17 2)
  2025. (dnf f-misc-null-5 "null field" (RESERVED) 17 16)
  2026. (dnf f-misc-null-6 "null field" (RESERVED) 30 3)
  2027. (dnf f-misc-null-7 "null field" (RESERVED) 17 3)
  2028. (dnf f-misc-null-8 "null field" (RESERVED) 5 3)
  2029. (dnf f-misc-null-9 "null field" (RESERVED) 5 4)
  2030. (dnf f-misc-null-10 "null field" (RESERVED) 16 5)
  2031. (dnf f-misc-null-11 "null field" (RESERVED) 5 1)
  2032. (dnf f-LRA-null "null field" (RESERVED) 2 3)
  2033. (dnf f-TLBPR-null "null field" (RESERVED) 30 2)
  2034. (dnf f-LI-off "null field" (RESERVED) 25 1)
  2035. (dnf f-LI-on "null field" (RESERVED) 25 1)
  2036. ; Relocation annotations.
  2037. (dsh h-reloc-ann "relocation annotation" () (register BI))
  2038. (dnf f-reloc-ann "relocation annotation" () 0 0)
  2039. (define-pmacro (dann xname xcomment xmode xparse xprint)
  2040. (define-operand
  2041. (name xname)
  2042. (comment xcomment)
  2043. (type h-reloc-ann)
  2044. (index f-reloc-ann)
  2045. (mode xmode)
  2046. (handlers (parse xparse) (print xprint))
  2047. )
  2048. )
  2049. ; Enums.
  2050. ; insn-op:
  2051. ; FIXME: should use die macro or some such
  2052. (define-normal-insn-enum insn-op "insn op enums" () OP_ f-op
  2053. (
  2054. "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F"
  2055. "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F"
  2056. "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E" "2F"
  2057. "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F"
  2058. "40" "41" "42" "43" "44" "45" "46" "47" "48" "49" "4A" "4B" "4C" "4D" "4E" "4F"
  2059. "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "5A" "5B" "5C" "5D" "5E" "5F"
  2060. "60" "61" "62" "63" "64" "65" "66" "67" "68" "69" "6A" "6B" "6C" "6D" "6E" "6F"
  2061. "70" "71" "72" "73" "74" "75" "76" "77" "78" "79" "7A" "7B" "7C" "7D" "7E" "7F"
  2062. )
  2063. )
  2064. (define-normal-insn-enum insn-ope1 "insn ope enums" () OPE1_ f-ope1
  2065. (
  2066. "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F"
  2067. "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F"
  2068. "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E" "2F"
  2069. "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F"
  2070. )
  2071. )
  2072. (define-normal-insn-enum insn-ope2 "insn ope enums" () OPE2_ f-ope2
  2073. (
  2074. "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F"
  2075. )
  2076. )
  2077. (define-normal-insn-enum insn-ope3 "insn ope enums" () OPE3_ f-ope3
  2078. (
  2079. "00" "01" "02" "03" "04" "05" "06" "07"
  2080. )
  2081. )
  2082. (define-normal-insn-enum insn-ope4 "insn ope enums" () OPE4_ f-ope4
  2083. (
  2084. "0" "1" "2" "3"
  2085. )
  2086. )
  2087. ; int-cc: integer branch conditions
  2088. ; FIXME: should use die macro or some such
  2089. (define-normal-insn-enum int-cc "integer branch cond enums" () ICC_ f-int-cc
  2090. (
  2091. "nev" "c" "v" "lt" "eq" "ls" "n" "le"
  2092. "ra" "nc" "nv" "ge" "ne" "hi" "p" "gt"
  2093. )
  2094. )
  2095. ; flt-cc: floating-point/media branch conditions
  2096. ; FIXME: should use die macro or some such
  2097. (define-normal-insn-enum flt-cc "float branch cond enums" () FCC_ f-flt-cc
  2098. ("nev" "u" "gt" "ug" "lt" "ul" "lg" "ne"
  2099. "eq" "ue" "ge" "uge" "le" "ule" "o" "ra")
  2100. )
  2101. ; Hardware pieces.
  2102. ; These entries list the elements of the raw hardware.
  2103. ; They're also used to provide tables and other elements of the assembly
  2104. ; language.
  2105. (dnh h-pc "program counter" (PC PROFILE) (pc) () () ())
  2106. ; The PSR. The individual fields are referenced more than the entire
  2107. ; register, so reference them directly. We can assemble the
  2108. ; entire register contents when necessary.
  2109. ;
  2110. (dsh h-psr_imple "PSR.IMPLE" () (register UQI))
  2111. (dsh h-psr_ver "PSR.VER" () (register UQI))
  2112. (dsh h-psr_ice "PSR.ICE bit" () (register BI))
  2113. (dsh h-psr_nem "PSR.NEM bit" () (register BI))
  2114. (dsh h-psr_cm "PSR.CM bit" () (register BI))
  2115. (dsh h-psr_be "PSR.BE bit" () (register BI))
  2116. (dsh h-psr_esr "PSR.ESR bit" () (register BI))
  2117. (dsh h-psr_ef "PSR.EF bit" () (register BI))
  2118. (dsh h-psr_em "PSR.EM bit" () (register BI))
  2119. (dsh h-psr_pil "PSR.PIL " () (register UQI))
  2120. (dsh h-psr_ps "PSR.PS bit" () (register BI))
  2121. (dsh h-psr_et "PSR.ET bit" () (register BI))
  2122. ; PSR.S requires special handling because the shadow registers (SR0-SR4) must
  2123. ; be switched with GR4-GR7 when changing from user to supervisor mode or
  2124. ; vice-versa.
  2125. (define-hardware
  2126. (name h-psr_s)
  2127. (comment "PSR.S bit")
  2128. (attrs)
  2129. (type register BI)
  2130. (get)
  2131. (set (newval) (c-call VOID "@cpu@_h_psr_s_set_handler" newval))
  2132. )
  2133. ; The TBR. The individual bits are referenced more than the entire
  2134. ; register, so reference them directly. We can assemble the
  2135. ; entire register contents when necessary.
  2136. ;
  2137. (dsh h-tbr_tba "TBR.TBA" () (register UWI))
  2138. (dsh h-tbr_tt "TBR.TT" () (register UQI))
  2139. ; The BPSR. The individual bits are referenced more than the entire
  2140. ; register, so reference them directly. We can assemble the
  2141. ; entire register contents when necessary.
  2142. ;
  2143. (dsh h-bpsr_bs "PSR.S bit" () (register BI))
  2144. (dsh h-bpsr_bet "PSR.ET bit" () (register BI))
  2145. ; General registers
  2146. ;
  2147. (define-keyword
  2148. (name gr-names)
  2149. (print-name h-gr)
  2150. (prefix "")
  2151. (values
  2152. (sp 1) (fp 2)
  2153. (gr0 0)(gr1 1)(gr2 2)(gr3 3)(gr4 4)(gr5 5)(gr6 6)(gr7 7)
  2154. (gr8 8)(gr9 9)(gr10 10)(gr11 11)(gr12 12)(gr13 13)(gr14 14)(gr15 15)
  2155. (gr16 16)(gr17 17)(gr18 18)(gr19 19)(gr20 20)(gr21 21)(gr22 22)(gr23 23)
  2156. (gr24 24)(gr25 25)(gr26 26)(gr27 27)(gr28 28)(gr29 29)(gr30 30)(gr31 31)
  2157. (gr32 32)(gr33 33)(gr34 34)(gr35 35)(gr36 36)(gr37 37)(gr38 38)(gr39 39)
  2158. (gr40 40)(gr41 41)(gr42 42)(gr43 43)(gr44 44)(gr45 45)(gr46 46)(gr47 47)
  2159. (gr48 48)(gr49 49)(gr50 50)(gr51 51)(gr52 52)(gr53 53)(gr54 54)(gr55 55)
  2160. (gr56 56)(gr57 57)(gr58 58)(gr59 59)(gr60 60)(gr61 61)(gr62 62)(gr63 63)
  2161. )
  2162. )
  2163. (define-hardware
  2164. (name h-gr)
  2165. (comment "general registers")
  2166. (attrs PROFILE)
  2167. (type register USI (64))
  2168. (indices extern-keyword gr-names)
  2169. (get (index) (c-call WI "@cpu@_h_gr_get_handler" index))
  2170. (set (index newval) (c-call VOID "@cpu@_h_gr_set_handler" index newval))
  2171. )
  2172. ; General Registers as double words
  2173. ; These registers are shadowed onto h-gr
  2174. (define-hardware
  2175. (name h-gr_double)
  2176. (comment "general registers as double words")
  2177. (attrs PROFILE VIRTUAL)
  2178. (type register DI (32))
  2179. ; FIXME: Need constraint to prohibit odd numbers.
  2180. (indices extern-keyword gr-names)
  2181. (get (index)
  2182. (c-call DI "@cpu@_h_gr_double_get_handler" index))
  2183. (set (index newval)
  2184. (c-call VOID "@cpu@_h_gr_double_set_handler" index newval))
  2185. )
  2186. ; General Registers as high and low half words
  2187. ; These registers are shadowed onto h-gr
  2188. (define-hardware
  2189. (name h-gr_hi)
  2190. (comment "general registers as high half word")
  2191. (attrs PROFILE VIRTUAL)
  2192. (type register UHI (64))
  2193. (indices extern-keyword gr-names)
  2194. (get (index) (c-call UHI "@cpu@_h_gr_hi_get_handler" index))
  2195. (set (index newval) (c-call VOID "@cpu@_h_gr_hi_set_handler" index newval))
  2196. )
  2197. (define-hardware
  2198. (name h-gr_lo)
  2199. (comment "general registers as low half word")
  2200. (attrs PROFILE VIRTUAL)
  2201. (type register UHI (64))
  2202. (indices extern-keyword gr-names)
  2203. (get (index) (c-call UHI "@cpu@_h_gr_lo_get_handler" index))
  2204. (set (index newval) (c-call VOID "@cpu@_h_gr_lo_set_handler" index newval))
  2205. )
  2206. ; Floating Point Registers
  2207. (define-keyword
  2208. (name fr-names)
  2209. (print-name h-fr)
  2210. (prefix "")
  2211. (values
  2212. (fr0 0)(fr1 1)(fr2 2)(fr3 3)(fr4 4)(fr5 5)(fr6 6)(fr7 7)
  2213. (fr8 8)(fr9 9)(fr10 10)(fr11 11)(fr12 12)(fr13 13)(fr14 14)(fr15 15)
  2214. (fr16 16)(fr17 17)(fr18 18)(fr19 19)(fr20 20)(fr21 21)(fr22 22)(fr23 23)
  2215. (fr24 24)(fr25 25)(fr26 26)(fr27 27)(fr28 28)(fr29 29)(fr30 30)(fr31 31)
  2216. (fr32 32)(fr33 33)(fr34 34)(fr35 35)(fr36 36)(fr37 37)(fr38 38)(fr39 39)
  2217. (fr40 40)(fr41 41)(fr42 42)(fr43 43)(fr44 44)(fr45 45)(fr46 46)(fr47 47)
  2218. (fr48 48)(fr49 49)(fr50 50)(fr51 51)(fr52 52)(fr53 53)(fr54 54)(fr55 55)
  2219. (fr56 56)(fr57 57)(fr58 58)(fr59 59)(fr60 60)(fr61 61)(fr62 62)(fr63 63)
  2220. )
  2221. )
  2222. (define-hardware
  2223. (name h-fr)
  2224. (comment "floating point registers")
  2225. (attrs PROFILE)
  2226. (type register SF (64))
  2227. (indices extern-keyword fr-names)
  2228. (get (index) (c-call SF "@cpu@_h_fr_get_handler" index))
  2229. (set (index newval) (c-call VOID "@cpu@_h_fr_set_handler" index newval))
  2230. )
  2231. ; Floating Point Registers as double precision
  2232. ; These registers are shadowed onto h-fr
  2233. (define-hardware
  2234. (name h-fr_double)
  2235. (comment "floating point registers as double precision")
  2236. (attrs PROFILE VIRTUAL)
  2237. (type register DF (32))
  2238. ; FIXME: Need constraint to prohibit odd numbers.
  2239. (indices extern-keyword fr-names)
  2240. (get (index)
  2241. (c-call DF "@cpu@_h_fr_double_get_handler" index))
  2242. (set (index newval)
  2243. (c-call VOID "@cpu@_h_fr_double_set_handler" index newval))
  2244. )
  2245. ; Floating Point Registers as integer words.
  2246. ; These registers are shadowed onto h-fr
  2247. (define-hardware
  2248. (name h-fr_int)
  2249. (comment "floating point registers as integers")
  2250. (attrs PROFILE VIRTUAL)
  2251. (type register USI (64))
  2252. (indices extern-keyword fr-names)
  2253. (get (index)
  2254. (c-call USI "@cpu@_h_fr_int_get_handler" index))
  2255. (set (index newval)
  2256. (c-call VOID "@cpu@_h_fr_int_set_handler" index newval))
  2257. )
  2258. ; Floating Point Registers as high and low half words
  2259. ; These registers are shadowed onto h-fr
  2260. (define-hardware
  2261. (name h-fr_hi)
  2262. (comment "floating point registers as unsigned high half word")
  2263. (attrs PROFILE VIRTUAL)
  2264. (type register UHI (64))
  2265. (indices extern-keyword fr-names)
  2266. (get (regno) (srl (reg h-fr_int regno) 16))
  2267. (set (regno newval) (set (reg h-fr_int regno)
  2268. (or (and (reg h-fr_int regno) #xffff)
  2269. (sll newval 16))))
  2270. )
  2271. (define-hardware
  2272. (name h-fr_lo)
  2273. (comment "floating point registers as unsigned low half word")
  2274. (attrs PROFILE VIRTUAL)
  2275. (type register UHI (64))
  2276. (indices extern-keyword fr-names)
  2277. (get (regno) (and (reg h-fr_int regno) #xffff))
  2278. (set (regno newval) (set (reg h-fr_int regno)
  2279. (or (and (reg h-fr_int regno) #xffff0000)
  2280. (and newval #xffff))))
  2281. )
  2282. ; Floating Point Registers as unsigned bytes
  2283. ; These registers are shadowed onto h-fr
  2284. (define-hardware
  2285. (name h-fr_0)
  2286. (comment "floating point registers as unsigned byte 0")
  2287. (attrs PROFILE VIRTUAL)
  2288. (type register UHI (64))
  2289. (indices extern-keyword fr-names)
  2290. (get (regno) (and (reg h-fr_int regno) #xff))
  2291. (set (regno newval)
  2292. (sequence ()
  2293. (if (gt USI newval #xff)
  2294. (set newval #xff))
  2295. (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #xffffff00)
  2296. newval))))
  2297. )
  2298. (define-hardware
  2299. (name h-fr_1)
  2300. (comment "floating point registers as unsigned byte 1")
  2301. (attrs PROFILE VIRTUAL)
  2302. (type register UHI (64))
  2303. (indices extern-keyword fr-names)
  2304. (get (regno) (and (srl (reg h-fr_int regno) 8) #xff))
  2305. (set (regno newval)
  2306. (sequence ()
  2307. (if (gt USI newval #xff)
  2308. (set newval #xff))
  2309. (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #xffff00ff)
  2310. (sll newval 8)))))
  2311. )
  2312. (define-hardware
  2313. (name h-fr_2)
  2314. (comment "floating point registers as unsigned byte 2")
  2315. (attrs PROFILE VIRTUAL)
  2316. (type register UHI (64))
  2317. (indices extern-keyword fr-names)
  2318. (get (regno) (and (srl (reg h-fr_int regno) 16) #xff))
  2319. (set (regno newval)
  2320. (sequence ()
  2321. (if (gt USI newval #xff)
  2322. (set newval #xff))
  2323. (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #xff00ffff)
  2324. (sll newval 16)))))
  2325. )
  2326. (define-hardware
  2327. (name h-fr_3)
  2328. (comment "floating point registers as unsigned byte 3")
  2329. (attrs PROFILE VIRTUAL)
  2330. (type register UHI (64))
  2331. (indices extern-keyword fr-names)
  2332. (get (regno) (and (srl (reg h-fr_int regno) 24) #xff))
  2333. (set (regno newval)
  2334. (sequence ()
  2335. (if (gt USI newval #xff)
  2336. (set newval #xff))
  2337. (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #x00ffffff)
  2338. (sll newval 24)))))
  2339. )
  2340. ; Coprocessor Registers
  2341. ;
  2342. (define-keyword
  2343. (name cpr-names)
  2344. (print-name h-cpr)
  2345. (prefix "")
  2346. (values
  2347. (cpr0 0)(cpr1 1)(cpr2 2)(cpr3 3)(cpr4 4)(cpr5 5)(cpr6 6)(cpr7 7)
  2348. (cpr8 8)(cpr9 9)(cpr10 10)(cpr11 11)(cpr12 12)(cpr13 13)(cpr14 14)(cpr15 15)
  2349. (cpr16 16)(cpr17 17)(cpr18 18)(cpr19 19)(cpr20 20)(cpr21 21)(cpr22 22)(cpr23 23)
  2350. (cpr24 24)(cpr25 25)(cpr26 26)(cpr27 27)(cpr28 28)(cpr29 29)(cpr30 30)(cpr31 31)
  2351. (cpr32 32)(cpr33 33)(cpr34 34)(cpr35 35)(cpr36 36)(cpr37 37)(cpr38 38)(cpr39 39)
  2352. (cpr40 40)(cpr41 41)(cpr42 42)(cpr43 43)(cpr44 44)(cpr45 45)(cpr46 46)(cpr47 47)
  2353. (cpr48 48)(cpr49 49)(cpr50 50)(cpr51 51)(cpr52 52)(cpr53 53)(cpr54 54)(cpr55 55)
  2354. (cpr56 56)(cpr57 57)(cpr58 58)(cpr59 59)(cpr60 60)(cpr61 61)(cpr62 62)(cpr63 63)
  2355. )
  2356. )
  2357. (define-hardware
  2358. (name h-cpr)
  2359. (comment "coprocessor registers")
  2360. (attrs PROFILE (MACH frv))
  2361. (type register WI (64))
  2362. (indices extern-keyword cpr-names)
  2363. )
  2364. ; Coprocessor Registers as double words
  2365. ; These registers are shadowed onto h-cpr
  2366. (define-hardware
  2367. (name h-cpr_double)
  2368. (comment "coprocessor registers as double words")
  2369. (attrs PROFILE VIRTUAL (MACH frv))
  2370. (type register DI (32))
  2371. ; FIXME: Need constraint to prohibit odd numbers.
  2372. (indices extern-keyword cpr-names)
  2373. (get (index)
  2374. (c-call DI "@cpu@_h_cpr_double_get_handler" index))
  2375. (set (index newval)
  2376. (c-call VOID "@cpu@_h_cpr_double_set_handler" index newval))
  2377. )
  2378. ; Special Purpose Registers
  2379. ;
  2380. (define-keyword
  2381. (name spr-names)
  2382. (print-name h-spr)
  2383. (prefix "")
  2384. (values
  2385. (psr 0) (pcsr 1) (bpcsr 2) (tbr 3) (bpsr 4)
  2386. (hsr0 16) (hsr1 17) (hsr2 18) (hsr3 19)
  2387. (hsr4 20) (hsr5 21) (hsr6 22) (hsr7 23)
  2388. (hsr8 24) (hsr9 25) (hsr10 26) (hsr11 27)
  2389. (hsr12 28) (hsr13 29) (hsr14 30) (hsr15 31)
  2390. (hsr16 32) (hsr17 33) (hsr18 34) (hsr19 35)
  2391. (hsr20 36) (hsr21 37) (hsr22 38) (hsr23 39)
  2392. (hsr24 40) (hsr25 41) (hsr26 42) (hsr27 43)
  2393. (hsr28 44) (hsr29 45) (hsr30 46) (hsr31 47)
  2394. (hsr32 48) (hsr33 49) (hsr34 50) (hsr35 51)
  2395. (hsr36 52) (hsr37 53) (hsr38 54) (hsr39 55)
  2396. (hsr40 56) (hsr41 57) (hsr42 58) (hsr43 59)
  2397. (hsr44 60) (hsr45 61) (hsr46 62) (hsr47 63)
  2398. (hsr48 64) (hsr49 65) (hsr50 66) (hsr51 67)
  2399. (hsr52 68) (hsr53 69) (hsr54 70) (hsr55 71)
  2400. (hsr56 72) (hsr57 73) (hsr58 74) (hsr59 75)
  2401. (hsr60 76) (hsr61 77) (hsr62 78) (hsr63 79)
  2402. (ccr 256) (cccr 263) (lr 272) (lcr 273) (iacc0h 280) (iacc0l 281) (isr 288)
  2403. (neear0 352) (neear1 353) (neear2 354) (neear3 355)
  2404. (neear4 356) (neear5 357) (neear6 358) (neear7 359)
  2405. (neear8 360) (neear9 361) (neear10 362) (neear11 363)
  2406. (neear12 364) (neear13 365) (neear14 366) (neear15 367)
  2407. (neear16 368) (neear17 369) (neear18 370) (neear19 371)
  2408. (neear20 372) (neear21 373) (neear22 374) (neear23 375)
  2409. (neear24 376) (neear25 377) (neear26 378) (neear27 379)
  2410. (neear28 380) (neear29 381) (neear30 382) (neear31 383)
  2411. (nesr0 384) (nesr1 385) (nesr2 386) (nesr3 387)
  2412. (nesr4 388) (nesr5 389) (nesr6 390) (nesr7 391)
  2413. (nesr8 392) (nesr9 393) (nesr10 394) (nesr11 395)
  2414. (nesr12 396) (nesr13 397) (nesr14 398) (nesr15 399)
  2415. (nesr16 400) (nesr17 401) (nesr18 402) (nesr19 403)
  2416. (nesr20 404) (nesr21 405) (nesr22 406) (nesr23 407)
  2417. (nesr24 408) (nesr25 409) (nesr26 410) (nesr27 411)
  2418. (nesr28 412) (nesr29 413) (nesr30 414) (nesr31 415)
  2419. (necr 416)
  2420. (gner0 432) (gner1 433)
  2421. (fner0 434) (fner1 435)
  2422. (epcr0 512) (epcr1 513) (epcr2 514) (epcr3 515)
  2423. (epcr4 516) (epcr5 517) (epcr6 518) (epcr7 519)
  2424. (epcr8 520) (epcr9 521) (epcr10 522) (epcr11 523)
  2425. (epcr12 524) (epcr13 525) (epcr14 526) (epcr15 527)
  2426. (epcr16 528) (epcr17 529) (epcr18 530) (epcr19 531)
  2427. (epcr20 532) (epcr21 533) (epcr22 534) (epcr23 535)
  2428. (epcr24 536) (epcr25 537) (epcr26 538) (epcr27 539)
  2429. (epcr28 540) (epcr29 541) (epcr30 542) (epcr31 543)
  2430. (epcr32 544) (epcr33 545) (epcr34 546) (epcr35 547)
  2431. (epcr36 548) (epcr37 549) (epcr38 550) (epcr39 551)
  2432. (epcr40 552) (epcr41 553) (epcr42 554) (epcr43 555)
  2433. (epcr44 556) (epcr45 557) (epcr46 558) (epcr47 559)
  2434. (epcr48 560) (epcr49 561) (epcr50 562) (epcr51 563)
  2435. (epcr52 564) (epcr53 565) (epcr54 566) (epcr55 567)
  2436. (epcr56 568) (epcr57 569) (epcr58 570) (epcr59 571)
  2437. (epcr60 572) (epcr61 573) (epcr62 574) (epcr63 575)
  2438. (esr0 576) (esr1 577) (esr2 578) (esr3 579)
  2439. (esr4 580) (esr5 581) (esr6 582) (esr7 583)
  2440. (esr8 584) (esr9 585) (esr10 586) (esr11 587)
  2441. (esr12 588) (esr13 589) (esr14 590) (esr15 591)
  2442. (esr16 592) (esr17 593) (esr18 594) (esr19 595)
  2443. (esr20 596) (esr21 597) (esr22 598) (esr23 599)
  2444. (esr24 600) (esr25 601) (esr26 602) (esr27 603)
  2445. (esr28 604) (esr29 605) (esr30 606) (esr31 607)
  2446. (esr32 608) (esr33 609) (esr34 610) (esr35 611)
  2447. (esr36 612) (esr37 613) (esr38 614) (esr39 615)
  2448. (esr40 616) (esr41 617) (esr42 618) (esr43 619)
  2449. (esr44 620) (esr45 621) (esr46 622) (esr47 623)
  2450. (esr48 624) (esr49 625) (esr50 626) (esr51 627)
  2451. (esr52 628) (esr53 629) (esr54 630) (esr55 631)
  2452. (esr56 632) (esr57 633) (esr58 634) (esr59 635)
  2453. (esr60 636) (esr61 637) (esr62 638) (esr63 639)
  2454. (eir0 640) (eir1 641) (eir2 642) (eir3 643)
  2455. (eir4 644) (eir5 645) (eir6 646) (eir7 647)
  2456. (eir8 648) (eir9 649) (eir10 650) (eir11 651)
  2457. (eir12 652) (eir13 653) (eir14 654) (eir15 655)
  2458. (eir16 656) (eir17 657) (eir18 658) (eir19 659)
  2459. (eir20 660) (eir21 661) (eir22 662) (eir23 663)
  2460. (eir24 664) (eir25 665) (eir26 666) (eir27 667)
  2461. (eir28 668) (eir29 669) (eir30 670) (eir31 671)
  2462. (esfr0 672) (esfr1 673)
  2463. (sr0 768) (sr1 769) (sr2 770) (sr3 771)
  2464. (scr0 832) (scr1 833) (scr2 834) (scr3 835)
  2465. (fsr0 1024) (fsr1 1025) (fsr2 1026) (fsr3 1027)
  2466. (fsr4 1028) (fsr5 1029) (fsr6 1030) (fsr7 1031)
  2467. (fsr8 1032) (fsr9 1033) (fsr10 1034) (fsr11 1035)
  2468. (fsr12 1036) (fsr13 1037) (fsr14 1038) (fsr15 1039)
  2469. (fsr16 1040) (fsr17 1041) (fsr18 1042) (fsr19 1043)
  2470. (fsr20 1044) (fsr21 1045) (fsr22 1046) (fsr23 1047)
  2471. (fsr24 1048) (fsr25 1049) (fsr26 1050) (fsr27 1051)
  2472. (fsr28 1052) (fsr29 1053) (fsr30 1054) (fsr31 1055)
  2473. (fsr32 1056) (fsr33 1057) (fsr34 1058) (fsr35 1059)
  2474. (fsr36 1060) (fsr37 1061) (fsr38 1062) (fsr39 1063)
  2475. (fsr40 1064) (fsr41 1065) (fsr42 1066) (fsr43 1067)
  2476. (fsr44 1068) (fsr45 1069) (fsr46 1070) (fsr47 1071)
  2477. (fsr48 1072) (fsr49 1073) (fsr50 1074) (fsr51 1075)
  2478. (fsr52 1076) (fsr53 1077) (fsr54 1078) (fsr55 1079)
  2479. (fsr56 1080) (fsr57 1081) (fsr58 1082) (fsr59 1083)
  2480. (fsr60 1084) (fsr61 1085) (fsr62 1086) (fsr63 1087)
  2481. ; FQ0-FQ31 are 64 bit registers.
  2482. ; These names allow access to the upper 32 bits of the FQ registers.
  2483. (fqop0 1088) (fqop1 1090) (fqop2 1092) (fqop3 1094)
  2484. (fqop4 1096) (fqop5 1098) (fqop6 1100) (fqop7 1102)
  2485. (fqop8 1104) (fqop9 1106) (fqop10 1108) (fqop11 1110)
  2486. (fqop12 1112) (fqop13 1114) (fqop14 1116) (fqop15 1118)
  2487. (fqop16 1120) (fqop17 1122) (fqop18 1124) (fqop19 1126)
  2488. (fqop20 1128) (fqop21 1130) (fqop22 1132) (fqop23 1134)
  2489. (fqop24 1136) (fqop25 1138) (fqop26 1140) (fqop27 1142)
  2490. (fqop28 1144) (fqop29 1146) (fqop30 1148) (fqop31 1150)
  2491. ; These names allow access to the lower 32 bits of the FQ registers.
  2492. (fqst0 1089) (fqst1 1091) (fqst2 1093) (fqst3 1095)
  2493. (fqst4 1097) (fqst5 1099) (fqst6 1101) (fqst7 1103)
  2494. (fqst8 1105) (fqst9 1107) (fqst10 1109) (fqst11 1111)
  2495. (fqst12 1113) (fqst13 1115) (fqst14 1117) (fqst15 1119)
  2496. (fqst16 1121) (fqst17 1123) (fqst18 1125) (fqst19 1127)
  2497. (fqst20 1129) (fqst21 1131) (fqst22 1133) (fqst23 1135)
  2498. (fqst24 1137) (fqst25 1139) (fqst26 1141) (fqst27 1143)
  2499. (fqst28 1145) (fqst29 1147) (fqst30 1149) (fqst31 1151)
  2500. ; These also access the lower 32 bits of the FQ registers.
  2501. ; These are not accessible as spr registers (see LSI appendix - section 13.4)
  2502. ; (fq0 1089) (fq1 1091) (fq2 1093) (fq3 1095)
  2503. ; (fq4 1097) (fq5 1099) (fq6 1101) (fq7 1103)
  2504. ; (fq8 1105) (fq9 1107) (fq10 1109) (fq11 1111)
  2505. ; (fq12 1113) (fq13 1115) (fq14 1117) (fq15 1119)
  2506. ; (fq16 1121) (fq17 1123) (fq18 1125) (fq19 1127)
  2507. ; (fq20 1129) (fq21 1131) (fq22 1133) (fq23 1135)
  2508. ; (fq24 1137) (fq25 1139) (fq26 1141) (fq27 1143)
  2509. ; (fq28 1145) (fq29 1147) (fq30 1149) (fq31 1151)
  2510. (mcilr0 1272) (mcilr1 1273)
  2511. (msr0 1280) (msr1 1281) (msr2 1282) (msr3 1283)
  2512. (msr4 1284) (msr5 1285) (msr6 1286) (msr7 1287)
  2513. (msr8 1288) (msr9 1289) (msr10 1290) (msr11 1291)
  2514. (msr12 1292) (msr13 1293) (msr14 1294) (msr15 1295)
  2515. (msr16 1296) (msr17 1297) (msr18 1298) (msr19 1299)
  2516. (msr20 1300) (msr21 1301) (msr22 1302) (msr23 1303)
  2517. (msr24 1304) (msr25 1305) (msr26 1306) (msr27 1307)
  2518. (msr28 1308) (msr29 1309) (msr30 1310) (msr31 1311)
  2519. (msr32 1312) (msr33 1313) (msr34 1314) (msr35 1315)
  2520. (msr36 1316) (msr37 1317) (msr38 1318) (msr39 1319)
  2521. (msr40 1320) (msr41 1321) (msr42 1322) (msr43 1323)
  2522. (msr44 1324) (msr45 1325) (msr46 1326) (msr47 1327)
  2523. (msr48 1328) (msr49 1329) (msr50 1330) (msr51 1331)
  2524. (msr52 1332) (msr53 1333) (msr54 1334) (msr55 1335)
  2525. (msr56 1336) (msr57 1337) (msr58 1338) (msr59 1339)
  2526. (msr60 1340) (msr61 1341) (msr62 1342) (msr63 1343)
  2527. ; MQ0-MQ31 are 64 bit registers.
  2528. ; These names allow access to the upper 32 bits of the MQ registers.
  2529. (mqop0 1344) (mqop1 1346) (mqop2 1348) (mqop3 1350)
  2530. (mqop4 1352) (mqop5 1354) (mqop6 1356) (mqop7 1358)
  2531. (mqop8 1360) (mqop9 1362) (mqop10 1364) (mqop11 1366)
  2532. (mqop12 1368) (mqop13 1370) (mqop14 1372) (mqop15 1374)
  2533. (mqop16 1376) (mqop17 1378) (mqop18 1380) (mqop19 1382)
  2534. (mqop20 1384) (mqop21 1386) (mqop22 1388) (mqop23 1390)
  2535. (mqop24 1392) (mqop25 1394) (mqop26 1396) (mqop27 1398)
  2536. (mqop28 1400) (mqop29 1402) (mqop30 1404) (mqop31 1406)
  2537. ; These names allow access to the lower 32 bits of the MQ registers.
  2538. (mqst0 1345) (mqst1 1347) (mqst2 1349) (mqst3 1351)
  2539. (mqst4 1353) (mqst5 1355) (mqst6 1357) (mqst7 1359)
  2540. (mqst8 1361) (mqst9 1363) (mqst10 1365) (mqst11 1367)
  2541. (mqst12 1369) (mqst13 1371) (mqst14 1373) (mqst15 1375)
  2542. (mqst16 1377) (mqst17 1379) (mqst18 1381) (mqst19 1383)
  2543. (mqst20 1385) (mqst21 1387) (mqst22 1389) (mqst23 1391)
  2544. (mqst24 1393) (mqst25 1395) (mqst26 1397) (mqst27 1399)
  2545. (mqst28 1401) (mqst29 1403) (mqst30 1405) (mqst31 1407)
  2546. ; These also access the lower 32 bits of the MQ registers.
  2547. ; These are not accessible as spr registers (see LSI appendix - section 13.4)
  2548. ; (mq0 1345) (mq1 1347) (mq2 1349) (mq3 1351)
  2549. ; (mq4 1353) (mq5 1355) (mq6 1357) (mq7 1359)
  2550. ; (mq8 1361) (mq9 1363) (mq10 1365) (mq11 1367)
  2551. ; (mq12 1369) (mq13 1371) (mq14 1373) (mq15 1375)
  2552. ; (mq16 1377) (mq17 1379) (mq18 1381) (mq19 1383)
  2553. ; (mq20 1385) (mq21 1387) (mq22 1389) (mq23 1391)
  2554. ; (mq24 1393) (mq25 1395) (mq26 1397) (mq27 1399)
  2555. ; (mq28 1401) (mq29 1403) (mq30 1405) (mq31 1407)
  2556. ; These are not accessible as spr registers (see LSI appendix - section 13.4)
  2557. ; (acc0 1408) (acc1 1409) (acc2 1410) (acc3 1411)
  2558. ; (acc4 1412) (acc5 1413) (acc6 1414) (acc7 1415)
  2559. ; (acc8 1416) (acc9 1417) (acc10 1418) (acc11 1419)
  2560. ; (acc12 1420) (acc13 1421) (acc14 1422) (acc15 1423)
  2561. ; (acc16 1424) (acc17 1425) (acc18 1426) (acc19 1427)
  2562. ; (acc20 1428) (acc21 1429) (acc22 1430) (acc23 1431)
  2563. ; (acc24 1432) (acc25 1433) (acc26 1434) (acc27 1435)
  2564. ; (acc28 1436) (acc29 1437) (acc30 1438) (acc31 1439)
  2565. ; (acc32 1440) (acc33 1441) (acc34 1442) (acc35 1443)
  2566. ; (acc36 1444) (acc37 1445) (acc38 1446) (acc39 1447)
  2567. ; (acc40 1448) (acc41 1449) (acc42 1450) (acc43 1451)
  2568. ; (acc44 1452) (acc45 1453) (acc46 1454) (acc47 1455)
  2569. ; (acc48 1456) (acc49 1457) (acc50 1458) (acc51 1459)
  2570. ; (acc52 1460) (acc53 1461) (acc54 1462) (acc55 1463)
  2571. ; (acc56 1464) (acc57 1465) (acc58 1466) (acc59 1467)
  2572. ; (acc60 1468) (acc61 1469) (acc62 1470) (acc63 1471)
  2573. ; (accg0 1472) (accg1 1473) (accg2 1474) (accg3 1475)
  2574. ; (accg4 1476) (accg5 1477) (accg6 1478) (accg7 1479)
  2575. ; (accg8 1480) (accg9 1481) (accg10 1482) (accg11 1483)
  2576. ; (accg12 1484) (accg13 1485) (accg14 1486) (accg15 1487)
  2577. ; (accg16 1488) (accg17 1489) (accg18 1490) (accg19 1491)
  2578. ; (accg20 1492) (accg21 1493) (accg22 1494) (accg23 1495)
  2579. ; (accg24 1496) (accg25 1497) (accg26 1498) (accg27 1499)
  2580. ; (accg28 1500) (accg29 1501) (accg30 1502) (accg31 1503)
  2581. ; (accg32 1504) (accg33 1505) (accg34 1506) (accg35 1507)
  2582. ; (accg36 1508) (accg37 1509) (accg38 1510) (accg39 1511)
  2583. ; (accg40 1512) (accg41 1513) (accg42 1514) (accg43 1515)
  2584. ; (accg44 1516) (accg45 1517) (accg46 1518) (accg47 1519)
  2585. ; (accg48 1520) (accg49 1521) (accg50 1522) (accg51 1523)
  2586. ; (accg52 1524) (accg53 1525) (accg54 1526) (accg55 1527)
  2587. ; (accg56 1528) (accg57 1529) (accg58 1530) (accg59 1531)
  2588. ; (accg60 1532) (accg61 1533) (accg62 1534) (accg63 1535)
  2589. (ear0 1536) (ear1 1537) (ear2 1538) (ear3 1539)
  2590. (ear4 1540) (ear5 1541) (ear6 1542) (ear7 1543)
  2591. (ear8 1544) (ear9 1545) (ear10 1546) (ear11 1547)
  2592. (ear12 1548) (ear13 1549) (ear14 1550) (ear15 1551)
  2593. (ear16 1552) (ear17 1553) (ear18 1554) (ear19 1555)
  2594. (ear20 1556) (ear21 1557) (ear22 1558) (ear23 1559)
  2595. (ear24 1560) (ear25 1561) (ear26 1562) (ear27 1563)
  2596. (ear28 1564) (ear29 1565) (ear30 1566) (ear31 1567)
  2597. (ear32 1568) (ear33 1569) (ear34 1570) (ear35 1571)
  2598. (ear36 1572) (ear37 1573) (ear38 1574) (ear39 1575)
  2599. (ear40 1576) (ear41 1577) (ear42 1578) (ear43 1579)
  2600. (ear44 1580) (ear45 1581) (ear46 1582) (ear47 1583)
  2601. (ear48 1584) (ear49 1585) (ear50 1586) (ear51 1587)
  2602. (ear52 1588) (ear53 1589) (ear54 1590) (ear55 1591)
  2603. (ear56 1592) (ear57 1593) (ear58 1594) (ear59 1595)
  2604. (ear60 1596) (ear61 1597) (ear62 1598) (ear63 1599)
  2605. (edr0 1600) (edr1 1601) (edr2 1602) (edr3 1603)
  2606. (edr4 1604) (edr5 1605) (edr6 1606) (edr7 1607)
  2607. (edr8 1608) (edr9 1609) (edr10 1610) (edr11 1611)
  2608. (edr12 1612) (edr13 1613) (edr14 1614) (edr15 1615)
  2609. (edr16 1616) (edr17 1617) (edr18 1618) (edr19 1619)
  2610. (edr20 1620) (edr21 1621) (edr22 1622) (edr23 1623)
  2611. (edr24 1624) (edr25 1625) (edr26 1626) (edr27 1627)
  2612. (edr28 1628) (edr29 1629) (edr30 1630) (edr31 1631)
  2613. (edr32 1632) (edr33 1636) (edr34 1634) (edr35 1635)
  2614. (edr36 1636) (edr37 1637) (edr38 1638) (edr39 1639)
  2615. (edr40 1640) (edr41 1641) (edr42 1642) (edr43 1643)
  2616. (edr44 1644) (edr45 1645) (edr46 1646) (edr47 1647)
  2617. (edr48 1648) (edr49 1649) (edr50 1650) (edr51 1651)
  2618. (edr52 1652) (edr53 1653) (edr54 1654) (edr55 1655)
  2619. (edr56 1656) (edr57 1657) (edr58 1658) (edr59 1659)
  2620. (edr60 1660) (edr61 1661) (edr62 1662) (edr63 1663)
  2621. (iamlr0 1664) (iamlr1 1665) (iamlr2 1666) (iamlr3 1667)
  2622. (iamlr4 1668) (iamlr5 1669) (iamlr6 1670) (iamlr7 1671)
  2623. (iamlr8 1672) (iamlr9 1673) (iamlr10 1674) (iamlr11 1675)
  2624. (iamlr12 1676) (iamlr13 1677) (iamlr14 1678) (iamlr15 1679)
  2625. (iamlr16 1680) (iamlr17 1681) (iamlr18 1682) (iamlr19 1683)
  2626. (iamlr20 1684) (iamlr21 1685) (iamlr22 1686) (iamlr23 1687)
  2627. (iamlr24 1688) (iamlr25 1689) (iamlr26 1690) (iamlr27 1691)
  2628. (iamlr28 1692) (iamlr29 1693) (iamlr30 1694) (iamlr31 1695)
  2629. (iamlr32 1696) (iamlr33 1697) (iamlr34 1698) (iamlr35 1699)
  2630. (iamlr36 1700) (iamlr37 1701) (iamlr38 1702) (iamlr39 1703)
  2631. (iamlr40 1704) (iamlr41 1705) (iamlr42 1706) (iamlr43 1707)
  2632. (iamlr44 1708) (iamlr45 1709) (iamlr46 1710) (iamlr47 1711)
  2633. (iamlr48 1712) (iamlr49 1713) (iamlr50 1714) (iamlr51 1715)
  2634. (iamlr52 1716) (iamlr53 1717) (iamlr54 1718) (iamlr55 1719)
  2635. (iamlr56 1720) (iamlr57 1721) (iamlr58 1722) (iamlr59 1723)
  2636. (iamlr60 1724) (iamlr61 1725) (iamlr62 1726) (iamlr63 1727)
  2637. (iampr0 1728) (iampr1 1729) (iampr2 1730) (iampr3 1731)
  2638. (iampr4 1732) (iampr5 1733) (iampr6 1734) (iampr7 1735)
  2639. (iampr8 1736) (iampr9 1737) (iampr10 1738) (iampr11 1739)
  2640. (iampr12 1740) (iampr13 1741) (iampr14 1742) (iampr15 1743)
  2641. (iampr16 1744) (iampr17 1745) (iampr18 1746) (iampr19 1747)
  2642. (iampr20 1748) (iampr21 1749) (iampr22 1750) (iampr23 1751)
  2643. (iampr24 1752) (iampr25 1753) (iampr26 1754) (iampr27 1755)
  2644. (iampr28 1756) (iampr29 1757) (iampr30 1758) (iampr31 1759)
  2645. (iampr32 1760) (iampr33 1761) (iampr34 1762) (iampr35 1763)
  2646. (iampr36 1764) (iampr37 1765) (iampr38 1766) (iampr39 1767)
  2647. (iampr40 1768) (iampr41 1769) (iampr42 1770) (iampr43 1771)
  2648. (iampr44 1772) (iampr45 1773) (iampr46 1774) (iampr47 1775)
  2649. (iampr48 1776) (iampr49 1777) (iampr50 1778) (iampr51 1779)
  2650. (iampr52 1780) (iampr53 1781) (iampr54 1782) (iampr55 1783)
  2651. (iampr56 1784) (iampr57 1785) (iampr58 1786) (iampr59 1787)
  2652. (iampr60 1788) (iampr61 1789) (iampr62 1790) (iampr63 1791)
  2653. (damlr0 1792) (damlr1 1793) (damlr2 1794) (damlr3 1795)
  2654. (damlr4 1796) (damlr5 1797) (damlr6 1798) (damlr7 1799)
  2655. (damlr8 1800) (damlr9 1801) (damlr10 1802) (damlr11 1803)
  2656. (damlr12 1804) (damlr13 1805) (damlr14 1806) (damlr15 1807)
  2657. (damlr16 1808) (damlr17 1809) (damlr18 1810) (damlr19 1811)
  2658. (damlr20 1812) (damlr21 1813) (damlr22 1814) (damlr23 1815)
  2659. (damlr24 1816) (damlr25 1817) (damlr26 1818) (damlr27 1819)
  2660. (damlr28 1820) (damlr29 1821) (damlr30 1822) (damlr31 1823)
  2661. (damlr32 1824) (damlr33 1825) (damlr34 1826) (damlr35 1827)
  2662. (damlr36 1828) (damlr37 1829) (damlr38 1830) (damlr39 1831)
  2663. (damlr40 1832) (damlr41 1833) (damlr42 1834) (damlr43 1835)
  2664. (damlr44 1836) (damlr45 1837) (damlr46 1838) (damlr47 1839)
  2665. (damlr48 1840) (damlr49 1841) (damlr50 1842) (damlr51 1843)
  2666. (damlr52 1844) (damlr53 1845) (damlr54 1846) (damlr55 1847)
  2667. (damlr56 1848) (damlr57 1849) (damlr58 1850) (damlr59 1851)
  2668. (damlr60 1852) (damlr61 1853) (damlr62 1854) (damlr63 1855)
  2669. (dampr0 1856) (dampr1 1857) (dampr2 1858) (dampr3 1859)
  2670. (dampr4 1860) (dampr5 1861) (dampr6 1862) (dampr7 1863)
  2671. (dampr8 1864) (dampr9 1865) (dampr10 1866) (dampr11 1867)
  2672. (dampr12 1868) (dampr13 1869) (dampr14 1870) (dampr15 1871)
  2673. (dampr16 1872) (dampr17 1873) (dampr18 1874) (dampr19 1875)
  2674. (dampr20 1876) (dampr21 1877) (dampr22 1878) (dampr23 1879)
  2675. (dampr24 1880) (dampr25 1881) (dampr26 1882) (dampr27 1883)
  2676. (dampr28 1884) (dampr29 1885) (dampr30 1886) (dampr31 1887)
  2677. (dampr32 1888) (dampr33 1889) (dampr34 1890) (dampr35 1891)
  2678. (dampr36 1892) (dampr37 1893) (dampr38 1894) (dampr39 1895)
  2679. (dampr40 1896) (dampr41 1897) (dampr42 1898) (dampr43 1899)
  2680. (dampr44 1900) (dampr45 1901) (dampr46 1902) (dampr47 1903)
  2681. (dampr48 1904) (dampr49 1905) (dampr50 1906) (dampr51 1907)
  2682. (dampr52 1908) (dampr53 1909) (dampr54 1910) (dampr55 1911)
  2683. (dampr56 1912) (dampr57 1913) (dampr58 1914) (dampr59 1915)
  2684. (dampr60 1916) (dampr61 1917) (dampr62 1918) (dampr63 1919)
  2685. (amcr 1920) (stbar 1921) (mmcr 1922)
  2686. (iamvr1 1925) (damvr1 1927)
  2687. (cxnr 1936) (ttbr 1937) (tplr 1938) (tppr 1939)
  2688. (tpxr 1940)
  2689. (timerh 1952) (timerl 1953) (timerd 1954)
  2690. (dcr 2048) (brr 2049) (nmar 2050) (btbr 2051)
  2691. (ibar0 2052) (ibar1 2053) (ibar2 2054) (ibar3 2055)
  2692. (dbar0 2056) (dbar1 2057) (dbar2 2058) (dbar3 2059)
  2693. (dbdr00 2060) (dbdr01 2061) (dbdr02 2062) (dbdr03 2063)
  2694. (dbdr10 2064) (dbdr11 2065) (dbdr12 2066) (dbdr13 2067)
  2695. (dbdr20 2068) (dbdr21 2069) (dbdr22 2070) (dbdr23 2071)
  2696. (dbdr30 2072) (dbdr31 2073) (dbdr32 2074) (dbdr33 2075)
  2697. (dbmr00 2076) (dbmr01 2077) (dbmr02 2078) (dbmr03 2079)
  2698. (dbmr10 2080) (dbmr11 2081) (dbmr12 2082) (dbmr13 2083)
  2699. (dbmr20 2084) (dbmr21 2085) (dbmr22 2086) (dbmr23 2087)
  2700. (dbmr30 2088) (dbmr31 2089) (dbmr32 2090) (dbmr33 2091)
  2701. (cpcfr 2304) (cpcr 2305) (cpsr 2306) (cptr 2307)
  2702. (cphsr0 2308) (cphsr1 2309) (cpesr0 2320) (cpesr1 2321)
  2703. (cpemr0 2322) (cpemr1 2323)
  2704. (iperr0 2324) (iperr1 2325) (ipjsr 2326) (ipjrr 2327)
  2705. (ipcsr0 2336) (ipcsr1 2337) (ipcwer0 2338) (ipcwer1 2339)
  2706. (ipcwr 2340)
  2707. (mbhsr 2352) (mbssr 2353) (mbrsr 2354) (mbsdr 2355)
  2708. (mbrdr 2356) (mbsmr 2357) (mbstr0 2359) (mbstr1 2360)
  2709. (slpr 2368) (sldr 2369) (slhsr 2370) (sltr 2371)
  2710. (slwr 2372)
  2711. (ihsr8 3848) (ihsr9 3849) (ihsr10 3850)
  2712. )
  2713. )
  2714. (define-hardware
  2715. (name h-spr)
  2716. (comment "special purpose registers")
  2717. (attrs PROFILE)
  2718. (type register UWI (4096))
  2719. (indices extern-keyword spr-names)
  2720. (get (index) (c-call UWI "@cpu@_h_spr_get_handler" index))
  2721. (set (index newval) (c-call VOID "@cpu@_h_spr_set_handler" index newval))
  2722. )
  2723. (define-pmacro (spr-pcsr) (reg h-spr 1))
  2724. (define-pmacro (spr-bpcsr) (reg h-spr 2))
  2725. (define-pmacro (spr-lr) (reg h-spr 272))
  2726. (define-pmacro (spr-lcr) (reg h-spr 273))
  2727. (define-pmacro (spr-iacc0h) (reg h-spr 280))
  2728. (define-pmacro (spr-iacc0l) (reg h-spr 281))
  2729. (define-pmacro (spr-sr0) (reg h-spr 768))
  2730. (define-pmacro (spr-sr1) (reg h-spr 769))
  2731. (define-pmacro (spr-sr2) (reg h-spr 770))
  2732. (define-pmacro (spr-sr3) (reg h-spr 771))
  2733. ; Accumulator guard. Actually a subset of the SPR registers, but those SPRs
  2734. ; are read-only in most insns. This hardware element is used by those insns
  2735. ; which have direct access (mwtaccg, mrdaccg).
  2736. (define-keyword
  2737. (name accg-names)
  2738. (print-name h-accg)
  2739. (prefix "")
  2740. (values
  2741. (accg0 0)(accg1 1)(accg2 2)(accg3 3)
  2742. (accg4 4)(accg5 5)(accg6 6)(accg7 7)
  2743. (accg8 8)(accg9 9)(accg10 10)(accg11 11)
  2744. (accg12 12)(accg13 13)(accg14 14)(accg15 15)
  2745. (accg16 16)(accg17 17)(accg18 18)(accg19 19)
  2746. (accg20 20)(accg21 21)(accg22 22)(accg23 23)
  2747. (accg24 24)(accg25 25)(accg26 26)(accg27 27)
  2748. (accg28 28)(accg29 29)(accg30 30)(accg31 31)
  2749. (accg32 32)(accg33 33)(accg34 34)(accg35 35)
  2750. (accg36 36)(accg37 37)(accg38 38)(accg39 39)
  2751. (accg40 40)(accg41 41)(accg42 42)(accg43 43)
  2752. (accg44 44)(accg45 45)(accg46 46)(accg47 47)
  2753. (accg48 48)(accg49 49)(accg50 50)(accg51 51)
  2754. (accg52 52)(accg53 53)(accg54 54)(accg55 55)
  2755. (accg56 56)(accg57 57)(accg58 58)(accg59 59)
  2756. (accg60 60)(accg61 61)(accg62 62)(accg63 63)
  2757. )
  2758. )
  2759. (define-hardware
  2760. (name h-accg)
  2761. (comment "accumulator guard")
  2762. (attrs PROFILE VIRTUAL)
  2763. (type register UWI (64))
  2764. (indices extern-keyword accg-names)
  2765. (get (index)
  2766. (and (reg h-spr (add index 1472)) #xff))
  2767. (set (index newval)
  2768. (set (raw-reg UWI h-spr (add index 1472)) (and newval #xff)))
  2769. )
  2770. ; 40 bit accumulator. Composed of ACCG and ACC registers concatenated, but
  2771. ; referenced more often as the composed 40 bits.
  2772. (define-keyword
  2773. (name acc-names)
  2774. (print-name h-acc40)
  2775. (prefix "")
  2776. (values
  2777. (acc0 0)(acc1 1)(acc2 2)(acc3 3)(acc4 4)(acc5 5)(acc6 6)(acc7 7)
  2778. (acc8 8)(acc9 9)(acc10 10)(acc11 11)(acc12 12)(acc13 13)(acc14 14)(acc15 15)
  2779. (acc16 16)(acc17 17)(acc18 18)(acc19 19)(acc20 20)(acc21 21)(acc22 22)(acc23 23)
  2780. (acc24 24)(acc25 25)(acc26 26)(acc27 27)(acc28 28)(acc29 29)(acc30 30)(acc31 31)
  2781. (acc32 32)(acc33 33)(acc34 34)(acc35 35)(acc36 36)(acc37 37)(acc38 38)(acc39 39)
  2782. (acc40 40)(acc41 41)(acc42 42)(acc43 43)(acc44 44)(acc45 45)(acc46 46)(acc47 47)
  2783. (acc48 48)(acc49 49)(acc50 50)(acc51 51)(acc52 52)(acc53 53)(acc54 54)(acc55 55)
  2784. (acc56 56)(acc57 57)(acc58 58)(acc59 59)(acc60 60)(acc61 61)(acc62 62)(acc63 63)
  2785. )
  2786. )
  2787. (define-hardware
  2788. (name h-acc40S)
  2789. (comment "40 bit signed accumulator")
  2790. (attrs PROFILE VIRTUAL)
  2791. (type register DI (64))
  2792. (indices extern-keyword acc-names)
  2793. ; The accumlator is made up of two 32 bit registers, accgi/acci.
  2794. ; We want to extract this as a combined 40 signed bits
  2795. (get (index)
  2796. (or DI
  2797. (sll DI (ext DI (trunc QI (reg h-spr (add index 1472))))
  2798. 32)
  2799. (zext DI (reg h-spr (add index 1408)))))
  2800. ; Bits 40-63 are not written. raw-reg is used to bypass read-only restrictions
  2801. ; on ACC and ACCG registers
  2802. (set (index newval)
  2803. (sequence ()
  2804. (c-call VOID "frv_check_spr_write_access" (add index 1408))
  2805. (set (raw-reg UWI h-spr
  2806. (add index 1472)) (and (srl newval 32) #xff))
  2807. (set (raw-reg UWI h-spr
  2808. (add index 1408)) (trunc USI newval))))
  2809. )
  2810. (define-hardware
  2811. (name h-acc40U)
  2812. (comment "40 bit unsigned accumulator")
  2813. (attrs PROFILE VIRTUAL)
  2814. (type register UDI (64))
  2815. (indices extern-keyword acc-names)
  2816. ; The accumlator is made up of two 32 bit registers, accgi/acci.
  2817. ; We want to extract this as a combined 40 unsigned bits
  2818. (get (index)
  2819. (or DI
  2820. (sll DI (zext DI (reg h-spr (add index 1472))) 32)
  2821. (zext DI (reg h-spr (add index 1408)))))
  2822. ; Bits 40-63 are not written. raw-reg is used to bypass read-only restrictions
  2823. ; on ACC and ACCG registers
  2824. (set (index newval)
  2825. (sequence ()
  2826. (c-call VOID "frv_check_spr_write_access" (add index 1408))
  2827. (set (raw-reg UWI h-spr
  2828. (add index 1472)) (and (srl newval 32) #xff))
  2829. (set (raw-reg UWI h-spr
  2830. (add index 1408)) (trunc USI newval))))
  2831. )
  2832. ; 64-bit signed accumulator. Composed of iacc0h and iacc0l registers
  2833. ; concatenated, but referenced more often as the composed 64 bits.
  2834. (define-keyword
  2835. ; This is totally hokey -- I have to have an index!
  2836. (name iacc0-names)
  2837. (print-name h-iacc0)
  2838. (prefix "")
  2839. (values (iacc0 0))
  2840. )
  2841. (define-hardware
  2842. (name h-iacc0)
  2843. (comment "64 bit signed accumulator")
  2844. (attrs PROFILE VIRTUAL (MACH fr400,fr450))
  2845. (type register DI (1))
  2846. (indices extern-keyword iacc0-names)
  2847. ; The single 64-bit integer accumulator is made up of two 32 bit
  2848. ; registers, iacc0h and iacc0l. We want to extract this as a
  2849. ; combined 64 signed bits.
  2850. (get (idx) (or DI (sll DI (ext DI (spr-iacc0h)) 32) (zext DI (spr-iacc0l))))
  2851. (set (idx newval)
  2852. (sequence ()
  2853. (set (spr-iacc0h) (trunc SI (srl newval 32)))
  2854. (set (spr-iacc0l) (trunc SI newval))))
  2855. )
  2856. ; Integer condition code registers (CCR)
  2857. ;
  2858. ; The individual sub registers bits of the CCR are referenced more often than
  2859. ; the entire register so set them directly. We can assemble the
  2860. ; entire register when necessary.
  2861. ;
  2862. (define-keyword
  2863. (name iccr-names)
  2864. (print-name h-iccr)
  2865. (prefix "")
  2866. (values (icc0 0) (icc1 1) (icc2 2) (icc3 3))
  2867. )
  2868. (define-hardware
  2869. (name h-iccr)
  2870. (comment "Integer condition code registers")
  2871. (attrs PROFILE)
  2872. (type register UQI (4))
  2873. (indices extern-keyword iccr-names)
  2874. )
  2875. ; Floating point condition code registers (CCR)
  2876. ;
  2877. ; The individual sub registers bits of the CCR are referenced more often than
  2878. ; the entire register so set them directly. We can assemble the
  2879. ; entire register when necessary.
  2880. ;
  2881. (define-keyword
  2882. (name fccr-names)
  2883. (print-name h-fccr)
  2884. (prefix "")
  2885. (values (fcc0 0) (fcc1 1) (fcc2 2) (fcc3 3))
  2886. )
  2887. (define-hardware
  2888. (name h-fccr)
  2889. (comment "Floating point condition code registers")
  2890. (attrs PROFILE)
  2891. (type register UQI (4))
  2892. (indices extern-keyword fccr-names)
  2893. )
  2894. ; C condition code registers (CCCR)
  2895. ;
  2896. (define-keyword
  2897. (name cccr-names)
  2898. (print-name h-cccr)
  2899. (prefix "")
  2900. (values (cc0 0) (cc1 1) (cc2 2) (cc3 3) (cc4 4) (cc5 5) (cc6 6) (cc7 7))
  2901. )
  2902. (define-hardware
  2903. (name h-cccr)
  2904. (comment "Condition code registers")
  2905. (attrs PROFILE)
  2906. (type register UQI (8))
  2907. (indices extern-keyword cccr-names)
  2908. )
  2909. ; Dummy hardware used to define packing bit on insns
  2910. ;
  2911. (define-hardware
  2912. (name h-pack)
  2913. (comment "Packing bit dummy hardware")
  2914. (type immediate (UINT 1))
  2915. (values keyword "" (("" 1) (".p" 0) (".P" 0)))
  2916. )
  2917. ; Dummy hardware used to define hint field for branches always taken
  2918. ;
  2919. (define-hardware
  2920. (name h-hint-taken)
  2921. (comment "Branch taken hint dummy hardware")
  2922. (type immediate (UINT 1))
  2923. ; The order of these is important. We want '2' to get written by default,
  2924. ; but we also want the docoder/disassembler to allow the values '0', '1' and
  2925. ; '3'.
  2926. (values keyword "" (("" 2) ("" 0) ("" 1) ("" 3)))
  2927. )
  2928. ; Dummy hardware used to define hint field for branches never taken
  2929. ;
  2930. (define-hardware
  2931. (name h-hint-not-taken)
  2932. (comment "Branch not taken hint dummy hardware")
  2933. (type immediate (UINT 1))
  2934. ; The order of these is important. We want '0' to get written by default,
  2935. ; but we also want the docoder/disassembler to allow the values '1', '2' and
  2936. ; '3'.
  2937. (values keyword "" (("" 0) ("" 1) ("" 2) ("" 3)))
  2938. )
  2939. ; Instruction Operands.
  2940. ; These entries provide a layer between the assembler and the raw hardware
  2941. ; description, and are used to refer to hardware elements in the semantic
  2942. ; code. Usually there's a bit of over-specification, but in more complicated
  2943. ; instruction sets there isn't.
  2944. ; FRV specific operand attributes:
  2945. (define-attr
  2946. (for operand)
  2947. (type boolean)
  2948. (name HASH-PREFIX)
  2949. (comment "immediates have an optional '#' prefix")
  2950. )
  2951. ; ??? Convention says this should be o-sr, but then the insn definitions
  2952. ; should refer to o-sr which is clumsy. The "o-" could be implicit, but
  2953. ; then it should be implicit for all the symbols here, but then there would
  2954. ; be confusion between (f-)simm8 and (h-)simm8.
  2955. ; So for now the rule is exactly as it appears here.
  2956. ; dnmop: define-normal-mode-operand: temporary, pending potential removal
  2957. ; of modes from h/w.
  2958. (define-pmacro (dnmop xname xcomment xattrs xtype xindex xmode)
  2959. (define-operand
  2960. (name xname)
  2961. (comment xcomment)
  2962. (.splice attrs (.unsplice xattrs))
  2963. (type xtype)
  2964. (index xindex)
  2965. (mode xmode)
  2966. )
  2967. )
  2968. ; dnpmop: define-normal-parsed-mode-operand: Normal mode operand with parse handler
  2969. (define-pmacro (dnpmop xname xcomment xattrs xtype xindex xmode xparse)
  2970. (define-operand
  2971. (name xname)
  2972. (comment xcomment)
  2973. (.splice attrs (.unsplice xattrs))
  2974. (type xtype)
  2975. (index xindex)
  2976. (mode xmode)
  2977. (handlers (parse xparse))
  2978. )
  2979. )
  2980. (dnop pack "packing bit" () h-pack f-pack)
  2981. (dnmop GRi "source register 1" () h-gr f-GRi SI)
  2982. (dnmop GRj "source register 2" () h-gr f-GRj SI)
  2983. (dnmop GRk "destination register" () h-gr f-GRk SI)
  2984. (dnmop GRkhi "destination register" () h-gr_hi f-GRk UHI)
  2985. (dnmop GRklo "destination register" () h-gr_lo f-GRk UHI)
  2986. (dnpmop GRdoublek "destination register" () h-gr_double f-GRk DI "even_register")
  2987. (dnmop ACC40Si "signed accumulator" () h-acc40S f-ACC40Si DI)
  2988. (dnmop ACC40Ui "unsigned accumulator" () h-acc40U f-ACC40Ui UDI)
  2989. (dnmop ACC40Sk "target accumulator" () h-acc40S f-ACC40Sk DI)
  2990. (dnmop ACC40Uk "target accumulator" () h-acc40U f-ACC40Uk UDI)
  2991. (dnmop ACCGi "source register" () h-accg f-ACCGi UWI)
  2992. (dnmop ACCGk "target register" () h-accg f-ACCGk UWI)
  2993. (dnmop CPRi "source register" ((MACH frv)) h-cpr f-CPRi SI)
  2994. (dnmop CPRj "source register" ((MACH frv)) h-cpr f-CPRj SI)
  2995. (dnmop CPRk "destination register" ((MACH frv)) h-cpr f-CPRk SI)
  2996. (dnpmop CPRdoublek "destination register" ((MACH frv)) h-cpr_double f-CPRk DI "even_register")
  2997. ; floating point operands
  2998. (dnmop FRinti "source register 1" () h-fr_int f-FRi SI)
  2999. (dnmop FRintj "source register 2" () h-fr_int f-FRj SI)
  3000. (dnmop FRintk "target register" () h-fr_int f-FRk SI)
  3001. (dnmop FRi "source register 1" () h-fr f-FRi SF)
  3002. (dnmop FRj "source register 2" () h-fr f-FRj SF)
  3003. (dnmop FRk "destination register" () h-fr f-FRk SF)
  3004. (dnmop FRkhi "destination register" () h-fr_hi f-FRk UHI)
  3005. (dnmop FRklo "destination register" () h-fr_lo f-FRk UHI)
  3006. (dnpmop FRdoublei "source register 1" () h-fr_double f-FRi DF "even_register")
  3007. (dnpmop FRdoublej "source register 2" () h-fr_double f-FRj DF "even_register")
  3008. (dnpmop FRdoublek "target register" () h-fr_double f-FRk DF "even_register")
  3009. (dnop CRi "source register 1" () h-cccr f-CRi)
  3010. (dnop CRj "source register 2" () h-cccr f-CRj)
  3011. (dnop CRj_int "destination register" () h-cccr f-CRj_int)
  3012. (dnop CRj_float "destination register" () h-cccr f-CRj_float)
  3013. (dnop CRk "destination register" () h-cccr f-CRk)
  3014. (dnop CCi "condition register" () h-cccr f-CCi)
  3015. (dnop ICCi_1 "condition register" () h-iccr f-ICCi_1)
  3016. (dnop ICCi_2 "condition register" () h-iccr f-ICCi_2)
  3017. (dnop ICCi_3 "condition register" () h-iccr f-ICCi_3)
  3018. (dnop FCCi_1 "condition register" () h-fccr f-FCCi_1)
  3019. (dnop FCCi_2 "condition register" () h-fccr f-FCCi_2)
  3020. (dnop FCCi_3 "condition register" () h-fccr f-FCCi_3)
  3021. (dnop FCCk "condition register" () h-fccr f-FCCk)
  3022. (dnop eir "exception insn reg" () h-uint f-eir)
  3023. (dnop s10 "10 bit signed immediate" (HASH-PREFIX) h-sint f-s10)
  3024. (dnop u16 "16 bit unsigned immediate" (HASH-PREFIX) h-uint f-u16)
  3025. (dnop s16 "16 bit signed immediate" (HASH-PREFIX) h-sint f-s16)
  3026. (dnop s6 "6 bit signed immediate" (HASH-PREFIX) h-sint f-s6)
  3027. (dnop s6_1 "6 bit signed immediate" (HASH-PREFIX) h-sint f-s6_1)
  3028. (dnop u6 "6 bit unsigned immediate" (HASH-PREFIX) h-uint f-u6)
  3029. (dnop s5 "5 bit signed immediate" (HASH-PREFIX) h-sint f-s5)
  3030. (dnop cond "conditional arithmetic" (HASH-PREFIX) h-uint f-cond)
  3031. (dnop ccond "lr branch condition" (HASH-PREFIX) h-uint f-ccond)
  3032. (dnop hint "2 bit branch predictor" (HASH-PREFIX) h-uint f-hint)
  3033. (dnop hint_taken "2 bit branch predictor" () h-hint-taken f-hint)
  3034. (dnop hint_not_taken "2 bit branch predictor" () h-hint-not-taken f-hint)
  3035. (dnop LI "link indicator" () h-uint f-LI)
  3036. (dnop lock "cache lock indicator" (HASH-PREFIX) h-uint f-lock)
  3037. (dnop debug "debug mode indicator" (HASH-PREFIX) h-uint f-debug)
  3038. (dnop ae "all entries indicator" (HASH-PREFIX) h-uint f-ae)
  3039. (dnop label16 "18 bit pc relative address" () h-iaddr f-label16)
  3040. (dnop LRAE "Load Real Address E flag" () h-uint f-LRAE)
  3041. (dnop LRAD "Load Real Address D flag" () h-uint f-LRAD)
  3042. (dnop LRAS "Load Real Address S flag" () h-uint f-LRAS)
  3043. (dnop TLBPRopx "TLB Probe operation number" () h-uint f-TLBPRopx)
  3044. (dnop TLBPRL "TLB Probe L flag" () h-uint f-TLBPRL)
  3045. (define-operand
  3046. (name A0)
  3047. (comment "A==0 operand of mclracc")
  3048. (attrs)
  3049. (type h-uint)
  3050. (index f-A)
  3051. (mode USI)
  3052. (handlers (parse "A0"))
  3053. )
  3054. (define-operand
  3055. (name A1)
  3056. (comment "A==1 operand of mclracc")
  3057. (attrs)
  3058. (type h-uint)
  3059. (index f-A)
  3060. (mode USI)
  3061. (handlers (parse "A1"))
  3062. )
  3063. (define-operand
  3064. (name FRintieven)
  3065. (comment "(even) source register 1")
  3066. (attrs)
  3067. (type h-fr_int)
  3068. (index f-FRi)
  3069. (mode SI)
  3070. (handlers (parse "even_register"))
  3071. )
  3072. (define-operand
  3073. (name FRintjeven)
  3074. (comment "(even) source register 2")
  3075. (attrs)
  3076. (type h-fr_int)
  3077. (index f-FRj)
  3078. (mode SI)
  3079. (handlers (parse "even_register"))
  3080. )
  3081. (define-operand
  3082. (name FRintkeven)
  3083. (comment "(even) target register")
  3084. (attrs)
  3085. (type h-fr_int)
  3086. (index f-FRk)
  3087. (mode SI)
  3088. (handlers (parse "even_register"))
  3089. )
  3090. (define-operand
  3091. (name d12)
  3092. (comment "12 bit signed immediate")
  3093. (attrs)
  3094. (type h-sint)
  3095. (index f-d12)
  3096. (handlers (parse "d12"))
  3097. )
  3098. (define-operand
  3099. (name s12)
  3100. (comment "12 bit signed immediate")
  3101. (attrs HASH-PREFIX)
  3102. (type h-sint)
  3103. (index f-d12)
  3104. (handlers (parse "s12"))
  3105. )
  3106. (define-operand
  3107. (name u12)
  3108. (comment "12 bit signed immediate")
  3109. (attrs HASH-PREFIX)
  3110. (type h-sint)
  3111. (index f-u12)
  3112. (handlers (parse "u12"))
  3113. )
  3114. (define-operand
  3115. (name spr)
  3116. (comment "special purpose register")
  3117. (attrs)
  3118. (type h-spr)
  3119. (index f-spr)
  3120. (handlers (parse "spr") (print "spr"))
  3121. )
  3122. (define-operand
  3123. (name ulo16)
  3124. (comment "16 bit unsigned immediate, for #lo()")
  3125. (attrs)
  3126. (type h-uint)
  3127. (index f-u16)
  3128. (handlers (parse "ulo16") (print "lo"))
  3129. )
  3130. (define-operand
  3131. (name slo16)
  3132. (comment "16 bit unsigned immediate, for #lo()")
  3133. (attrs)
  3134. (type h-sint)
  3135. (index f-s16)
  3136. (handlers (parse "uslo16") (print "lo"))
  3137. )
  3138. (define-operand
  3139. (name uhi16)
  3140. (comment "16 bit unsigned immediate, for #hi()")
  3141. (attrs)
  3142. (type h-uint)
  3143. (index f-u16)
  3144. (handlers (parse "uhi16") (print "hi"))
  3145. )
  3146. (define-operand
  3147. (name label24)
  3148. (comment "26 bit pc relative address")
  3149. (attrs)
  3150. (type h-iaddr)
  3151. (index f-label24)
  3152. (mode SI)
  3153. (handlers (parse "call_label"))
  3154. )
  3155. ; operands representing hardware
  3156. ;
  3157. (dnop psr_esr "PSR.ESR bit" (SEM-ONLY) h-psr_esr f-nil)
  3158. (dnop psr_s "PSR.S bit" (SEM-ONLY) h-psr_s f-nil)
  3159. (dnop psr_ps "PSR.PS bit" (SEM-ONLY) h-psr_ps f-nil)
  3160. (dnop psr_et "PSR.ET bit" (SEM-ONLY) h-psr_et f-nil)
  3161. (dnop bpsr_bs "BPSR.BS bit" (SEM-ONLY) h-bpsr_bs f-nil)
  3162. (dnop bpsr_bet "BPSR.BET bit" (SEM-ONLY) h-bpsr_bet f-nil)
  3163. (dnop tbr_tba "TBR.TBA" (SEM-ONLY) h-tbr_tba f-nil)
  3164. (dnop tbr_tt "TBR.TT" (SEM-ONLY) h-tbr_tt f-nil)
  3165. ; Null operands
  3166. ;
  3167. (define-pmacro (ICCi_1-null) (f-ICCi_1-null 0))
  3168. (define-pmacro (ICCi_2-null) (f-ICCi_2-null 0))
  3169. (define-pmacro (ICCi_3-null) (f-ICCi_3-null 0))
  3170. (define-pmacro (FCCi_1-null) (f-FCCi_1-null 0))
  3171. (define-pmacro (FCCi_2-null) (f-FCCi_2-null 0))
  3172. (define-pmacro (FCCi_3-null) (f-FCCi_3-null 0))
  3173. (define-pmacro (rs-null) (f-rs-null 0))
  3174. (define-pmacro (GRi-null) (f-GRi-null 0))
  3175. (define-pmacro (GRj-null) (f-GRj-null 0))
  3176. (define-pmacro (GRk-null) (f-GRk-null 0))
  3177. (define-pmacro (FRi-null) (f-FRi-null 0))
  3178. (define-pmacro (FRj-null) (f-FRj-null 0))
  3179. (define-pmacro (ACCj-null) (f-ACCj-null 0))
  3180. (define-pmacro (rd-null) (f-rd-null 0))
  3181. (define-pmacro (cond-null) (f-cond-null 0))
  3182. (define-pmacro (ccond-null) (f-ccond-null 0))
  3183. (define-pmacro (s12-null) (f-s12-null 0))
  3184. (define-pmacro (label16-null) (f-label16-null 0))
  3185. (define-pmacro (misc-null-1) (f-misc-null-1 0))
  3186. (define-pmacro (misc-null-2) (f-misc-null-2 0))
  3187. (define-pmacro (misc-null-3) (f-misc-null-3 0))
  3188. (define-pmacro (misc-null-4) (f-misc-null-4 0))
  3189. (define-pmacro (misc-null-5) (f-misc-null-5 0))
  3190. (define-pmacro (misc-null-6) (f-misc-null-6 0))
  3191. (define-pmacro (misc-null-7) (f-misc-null-7 0))
  3192. (define-pmacro (misc-null-8) (f-misc-null-8 0))
  3193. (define-pmacro (misc-null-9) (f-misc-null-9 0))
  3194. (define-pmacro (misc-null-10) (f-misc-null-10 0))
  3195. (define-pmacro (misc-null-11) (f-misc-null-11 0))
  3196. (define-pmacro (LRA-null) (f-LRA-null 0))
  3197. (define-pmacro (TLBPR-null) (f-TLBPR-null 0))
  3198. (define-pmacro (LI-on) (f-LI-on 1))
  3199. (define-pmacro (LI-off) (f-LI-off 0))
  3200. ; Instruction definitions.
  3201. ;
  3202. ; Notes:
  3203. ; - dni is short for "define-normal-instruction"
  3204. ; - Macros are used to represent each insn format. These should be used as much
  3205. ; as possible unless an insn has exceptional behaviour
  3206. ;
  3207. ; Commonly used Macros
  3208. ;
  3209. ; Specific registers
  3210. ;
  3211. ; Integer condition code manipulation
  3212. ;
  3213. (define-pmacro (set-z-and-n icc x)
  3214. (if (eq x 0)
  3215. (set icc (or (and icc #x7) #x4))
  3216. (if (lt x 0)
  3217. (set icc (or (and icc #xb) #x8))
  3218. (set icc (and icc #x3))))
  3219. )
  3220. (define-pmacro (set-n icc val)
  3221. (if (eq val 0)
  3222. (set icc (and icc #x7))
  3223. (set icc (or icc #x8)))
  3224. )
  3225. (define-pmacro (set-z icc val)
  3226. (if (eq val 0)
  3227. (set icc (and icc #xb))
  3228. (set icc (or icc #x4)))
  3229. )
  3230. (define-pmacro (set-v icc val)
  3231. (if (eq val 0)
  3232. (set icc (and icc #xd))
  3233. (set icc (or icc #x2)))
  3234. )
  3235. (define-pmacro (set-c icc val)
  3236. (if (eq val 0)
  3237. (set icc (and icc #xe))
  3238. (set icc (or icc #x1)))
  3239. )
  3240. (define-pmacro (nbit icc)
  3241. (trunc BI (srl (and icc #x8) 3))
  3242. )
  3243. (define-pmacro (zbit icc)
  3244. (trunc BI (srl (and icc #x4) 2))
  3245. )
  3246. (define-pmacro (vbit icc)
  3247. (trunc BI (srl (and icc #x2) 1))
  3248. )
  3249. (define-pmacro (cbit icc)
  3250. (trunc BI (and icc #x1))
  3251. )
  3252. (define-pmacro (ebit icc)
  3253. (trunc BI (srl (and icc #x8) 3))
  3254. )
  3255. (define-pmacro (lbit icc)
  3256. (trunc BI (srl (and icc #x4) 2))
  3257. )
  3258. (define-pmacro (gbit icc)
  3259. (trunc BI (srl (and icc #x2) 1))
  3260. )
  3261. (define-pmacro (ubit icc)
  3262. (trunc BI (and icc #x1))
  3263. )
  3264. ; FRV insns
  3265. ;
  3266. ;
  3267. ; Format: INT, Logic, Shift r-r
  3268. ;
  3269. (define-pmacro (int-logic-r-r name operation op ope comment)
  3270. (dni name
  3271. (comment)
  3272. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3273. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3274. (.str name "$pack $GRi,$GRj,$GRk")
  3275. (+ pack GRk op GRi (ICCi_1-null) ope GRj)
  3276. (set GRk (operation GRi GRj))
  3277. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3278. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3279. )
  3280. )
  3281. (int-logic-r-r add add OP_00 OPE2_00 "add reg/reg")
  3282. (int-logic-r-r sub sub OP_00 OPE2_04 "sub reg/reg")
  3283. (int-logic-r-r and and OP_01 OPE2_00 "and reg/reg")
  3284. (int-logic-r-r or or OP_01 OPE2_02 "or reg/reg")
  3285. (int-logic-r-r xor xor OP_01 OPE2_04 "xor reg/reg")
  3286. (dni not
  3287. ("not")
  3288. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3289. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3290. ("not$pack $GRj,$GRk")
  3291. (+ pack GRk OP_01 (rs-null) (ICCi_1-null) OPE2_06 GRj)
  3292. (set GRk (inv GRj))
  3293. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3294. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3295. )
  3296. (dni sdiv
  3297. "signed division"
  3298. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2)
  3299. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3300. "sdiv$pack $GRi,$GRj,$GRk"
  3301. (+ pack GRk OP_00 GRi (ICCi_1-null) OPE2_0E GRj)
  3302. (sequence ()
  3303. (c-call VOID "@cpu@_signed_integer_divide"
  3304. GRi GRj (index-of GRk) 0)
  3305. (clobber GRk))
  3306. ((fr400 (unit u-idiv)) (fr450 (unit u-idiv))
  3307. (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
  3308. )
  3309. (dni nsdiv
  3310. "non excepting signed division"
  3311. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
  3312. (MACH simple,tomcat,fr500,fr550,frv))
  3313. "nsdiv$pack $GRi,$GRj,$GRk"
  3314. (+ pack GRk OP_01 GRi (ICCi_1-null) OPE2_0E GRj)
  3315. (sequence ()
  3316. (c-call VOID "@cpu@_signed_integer_divide"
  3317. GRi GRj (index-of GRk) 1)
  3318. (clobber GRk))
  3319. ((fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
  3320. )
  3321. (dni udiv
  3322. "unsigned division reg/reg"
  3323. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2)
  3324. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3325. "udiv$pack $GRi,$GRj,$GRk"
  3326. (+ pack GRk OP_00 GRi (ICCi_1-null) OPE2_0F GRj)
  3327. (sequence ()
  3328. (c-call VOID "@cpu@_unsigned_integer_divide"
  3329. GRi GRj (index-of GRk) 0)
  3330. (clobber GRk))
  3331. ((fr400 (unit u-idiv)) (fr450 (unit u-idiv))
  3332. (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
  3333. )
  3334. (dni nudiv
  3335. "non excepting unsigned division"
  3336. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
  3337. (MACH simple,tomcat,fr500,fr550,frv))
  3338. "nudiv$pack $GRi,$GRj,$GRk"
  3339. (+ pack GRk OP_01 GRi (ICCi_1-null) OPE2_0F GRj)
  3340. (sequence ()
  3341. (c-call VOID "@cpu@_unsigned_integer_divide"
  3342. GRi GRj (index-of GRk) 1)
  3343. (clobber GRk))
  3344. ((fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
  3345. )
  3346. ; Multiplication
  3347. ;
  3348. (define-pmacro (multiply-r-r name signop op ope comment)
  3349. (dni name
  3350. (comment)
  3351. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2)
  3352. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3353. (.str name "$pack $GRi,$GRj,$GRdoublek")
  3354. (+ pack GRdoublek op GRi (ICCi_1-null) ope GRj)
  3355. (set GRdoublek (mul DI (signop DI GRi) (signop DI GRj)))
  3356. ((fr400 (unit u-imul)) (fr450 (unit u-imul))
  3357. (fr500 (unit u-imul)) (fr550 (unit u-imul)))
  3358. )
  3359. )
  3360. (multiply-r-r smul ext OP_00 OPE2_08 "signed multiply reg/reg")
  3361. (multiply-r-r umul zext OP_00 OPE2_0A "unsigned multiply reg/reg")
  3362. ; Multiplication with integer accumulator IACC
  3363. ;
  3364. (define-pmacro (iacc-set value)
  3365. (set (reg h-iacc0 0) value))
  3366. (define-pmacro (iacc-add value)
  3367. (set (reg h-iacc0 0)
  3368. (cond DI
  3369. ((andif (andif (gt value 0) (gt (reg h-iacc0 0) 0))
  3370. (lt (sub DI #x7fffffffffffffff value) (reg h-iacc0 0)))
  3371. ; Positive overflow
  3372. (const DI #x7fffffffffffffff))
  3373. ((andif (andif (lt value 0) (lt (reg h-iacc0 0) 0))
  3374. (gt (sub DI #x8000000000000000 value) (reg h-iacc0 0)))
  3375. ; Negative overflow
  3376. (const DI #x8000000000000000))
  3377. (else
  3378. (add DI (reg h-iacc0 0) value))))
  3379. )
  3380. (define-pmacro (iacc-sub value)
  3381. (set (reg h-iacc0 0)
  3382. (cond DI
  3383. ((andif (andif (lt value 0) (gt (reg h-iacc0 0) 0))
  3384. (lt (add DI #x7fffffffffffffff value) (reg h-iacc0 0)))
  3385. ; Positive overflow
  3386. (const DI #x7fffffffffffffff))
  3387. ((andif (andif (gt value 0) (lt (reg h-iacc0 0) 0))
  3388. (gt (add DI #x8000000000000000 value) (reg h-iacc0 0)))
  3389. ; Negative overflow
  3390. (const DI #x8000000000000000))
  3391. (else
  3392. (sub DI (reg h-iacc0 0) value))))
  3393. )
  3394. (define-pmacro (iacc-multiply-r-r name operation op ope comment)
  3395. (dni name
  3396. (comment)
  3397. ((UNIT IACC) (MACH fr400,fr450)
  3398. (FR400-MAJOR I-1) (FR450-MAJOR I-1) AUDIO)
  3399. (.str name "$pack $GRi,$GRj")
  3400. (+ pack (rd-null) op GRi ope GRj)
  3401. ((.sym iacc- operation) (mul DI (ext DI GRi) (ext DI GRj)))
  3402. ((fr400 (unit u-integer)) (fr450 (unit u-integer)))
  3403. )
  3404. )
  3405. (iacc-multiply-r-r smu set OP_46 OPE1_05 "Signed multiply reg/reg/iacc")
  3406. (iacc-multiply-r-r smass add OP_46 OPE1_06 "Signed multiply/add reg/reg/iacc")
  3407. (iacc-multiply-r-r smsss sub OP_46 OPE1_07 "Signed multiply/sub reg/reg/iacc")
  3408. (define-pmacro (int-shift-r-r name op ope comment)
  3409. (dni name
  3410. (comment)
  3411. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3412. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3413. (.str name "$pack $GRi,$GRj,$GRk")
  3414. (+ pack GRk op GRi (ICCi_1-null) ope GRj)
  3415. (set GRk (name GRi (and GRj #x1f)))
  3416. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3417. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3418. )
  3419. )
  3420. (int-shift-r-r sll OP_01 OPE2_08 "shift left logical reg/reg")
  3421. (int-shift-r-r srl OP_01 OPE2_0A "shift right logical reg/reg")
  3422. (int-shift-r-r sra OP_01 OPE2_0C "shift right arith reg/reg")
  3423. (dni slass
  3424. "shift left arith reg/reg with saturation"
  3425. ((UNIT IALL) (MACH fr400,fr450)
  3426. (FR400-MAJOR I-1) (FR450-MAJOR I-1) AUDIO)
  3427. "slass$pack $GRi,$GRj,$GRk"
  3428. (+ pack GRk OP_46 GRi OPE1_02 GRj)
  3429. (set GRk (c-call SI "@cpu@_shift_left_arith_saturate" GRi GRj))
  3430. ()
  3431. )
  3432. (dni scutss
  3433. "Integer accumulator cut with saturation"
  3434. ((UNIT I0) (MACH fr400,fr450)
  3435. (FR400-MAJOR I-1) (FR450-MAJOR I-1) AUDIO)
  3436. "scutss$pack $GRj,$GRk"
  3437. (+ pack GRk OP_46 (rs-null) OPE1_04 GRj)
  3438. (set GRk (c-call SI "@cpu@_iacc_cut" (reg h-iacc0 0) GRj))
  3439. ()
  3440. )
  3441. (define-pmacro (scan-semantics arg1 arg2 targ)
  3442. (sequence ((WI tmp1) (WI tmp2))
  3443. (set tmp1 arg1)
  3444. (set tmp2 (sra arg2 1))
  3445. (set targ (c-call WI "@cpu@_scan_result" (xor tmp1 tmp2))))
  3446. )
  3447. (dni scan
  3448. "scan"
  3449. ((UNIT SCAN) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3450. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3451. "scan$pack $GRi,$GRj,$GRk"
  3452. (+ pack GRk OP_0B GRi (ICCi_1-null) OPE2_00 GRj)
  3453. (scan-semantics GRi GRj GRk)
  3454. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3455. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3456. )
  3457. ; Format: conditional INT, Logic, Shift r-r
  3458. ;
  3459. (define-pmacro (conditional-int-logic name operation op ope comment)
  3460. (dni name
  3461. (comment)
  3462. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3463. (FR400-MAJOR I-1) (FR450-MAJOR I-1) CONDITIONAL)
  3464. (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
  3465. (+ pack GRk op GRi CCi cond ope GRj)
  3466. (if (eq CCi (or cond 2))
  3467. (set GRk (operation GRi GRj)))
  3468. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3469. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3470. )
  3471. )
  3472. (conditional-int-logic cadd add OP_58 OPE4_0 "conditional add")
  3473. (conditional-int-logic csub sub OP_58 OPE4_1 "conditional sub")
  3474. (conditional-int-logic cand and OP_5A OPE4_0 "conditional and")
  3475. (conditional-int-logic cor or OP_5A OPE4_1 "conditional or")
  3476. (conditional-int-logic cxor xor OP_5A OPE4_2 "conditional xor")
  3477. (dni cnot
  3478. "conditional not"
  3479. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3480. (FR400-MAJOR I-1) (FR450-MAJOR I-1) CONDITIONAL)
  3481. "cnot$pack $GRj,$GRk,$CCi,$cond"
  3482. (+ pack GRk OP_5A (rs-null) CCi cond OPE4_3 GRj)
  3483. (if (eq CCi (or cond 2))
  3484. (set GRk (inv GRj)))
  3485. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3486. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3487. )
  3488. (dni csmul
  3489. "conditional signed multiply"
  3490. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2)
  3491. (FR400-MAJOR I-1) (FR450-MAJOR I-1) CONDITIONAL)
  3492. "csmul$pack $GRi,$GRj,$GRdoublek,$CCi,$cond"
  3493. (+ pack GRdoublek OP_58 GRi CCi cond OPE4_2 GRj)
  3494. (if (eq CCi (or cond 2))
  3495. (set GRdoublek (mul DI (ext DI GRi) (ext DI GRj))))
  3496. ((fr400 (unit u-imul)) (fr450 (unit u-imul))
  3497. (fr500 (unit u-imul)) (fr550 (unit u-imul)))
  3498. )
  3499. (dni csdiv
  3500. "conditional signed division"
  3501. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2)
  3502. (FR400-MAJOR I-1) (FR450-MAJOR I-1) CONDITIONAL)
  3503. "csdiv$pack $GRi,$GRj,$GRk,$CCi,$cond"
  3504. (+ pack GRk OP_58 GRi CCi cond OPE4_3 GRj)
  3505. (if (eq CCi (or cond 2))
  3506. (sequence ()
  3507. (c-call VOID "@cpu@_signed_integer_divide"
  3508. GRi GRj (index-of GRk) 0)
  3509. (clobber GRk)))
  3510. ((fr400 (unit u-idiv)) (fr450 (unit u-idiv))
  3511. (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
  3512. )
  3513. (dni cudiv
  3514. "conditional unsigned division"
  3515. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2)
  3516. (FR400-MAJOR I-1) (FR450-MAJOR I-1) CONDITIONAL)
  3517. "cudiv$pack $GRi,$GRj,$GRk,$CCi,$cond"
  3518. (+ pack GRk OP_59 GRi CCi cond OPE4_3 GRj)
  3519. (if (eq CCi (or cond 2))
  3520. (sequence ()
  3521. (c-call VOID "@cpu@_unsigned_integer_divide"
  3522. GRi GRj (index-of GRk) 0)
  3523. (clobber GRk)))
  3524. ((fr400 (unit u-idiv)) (fr450 (unit u-idiv))
  3525. (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
  3526. )
  3527. (define-pmacro (conditional-shift name operation op ope comment)
  3528. (dni name
  3529. (comment)
  3530. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3531. (FR400-MAJOR I-1) (FR450-MAJOR I-1) CONDITIONAL)
  3532. (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
  3533. (+ pack GRk op GRi CCi cond ope GRj)
  3534. (if (eq CCi (or cond 2))
  3535. (set GRk (operation GRi (and GRj #x1f))))
  3536. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3537. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3538. )
  3539. )
  3540. (conditional-shift csll sll OP_5C OPE4_0 "conditional shift left logical")
  3541. (conditional-shift csrl srl OP_5C OPE4_1 "conditional shift right logical")
  3542. (conditional-shift csra sra OP_5C OPE4_2 "conditional shift right arith")
  3543. (dni cscan
  3544. "conditional scan"
  3545. ((UNIT SCAN) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3546. (FR400-MAJOR I-1) (FR450-MAJOR I-1) CONDITIONAL)
  3547. "cscan$pack $GRi,$GRj,$GRk,$CCi,$cond"
  3548. (+ pack GRk OP_65 GRi CCi cond OPE4_3 GRj)
  3549. (if (eq CCi (or cond 2))
  3550. (scan-semantics GRi GRj GRk))
  3551. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3552. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3553. )
  3554. ; Format: INT, Logic, Shift, cc r-r
  3555. ;
  3556. (define-pmacro (int-arith-cc-semantics operation icc)
  3557. (sequence ((BI tmp) (QI cc) (SI result))
  3558. (set cc icc)
  3559. (set tmp ((.sym operation -oflag) GRi GRj (const 0)))
  3560. (set-v cc tmp)
  3561. (set tmp ((.sym operation -cflag) GRi GRj (const 0)))
  3562. (set-c cc tmp)
  3563. (set result (operation GRi GRj))
  3564. (set-z-and-n cc result)
  3565. (set GRk result)
  3566. (set icc cc))
  3567. )
  3568. (define-pmacro (int-arith-cc-r-r name operation op ope comment)
  3569. (dni name
  3570. (comment)
  3571. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3572. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3573. (.str name "$pack $GRi,$GRj,$GRk,$ICCi_1")
  3574. (+ pack GRk op GRi ICCi_1 ope GRj)
  3575. (int-arith-cc-semantics operation ICCi_1)
  3576. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3577. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3578. )
  3579. )
  3580. (int-arith-cc-r-r addcc add OP_00 OPE2_01 "add reg/reg, set icc")
  3581. (int-arith-cc-r-r subcc sub OP_00 OPE2_05 "sub reg/reg, set icc")
  3582. (define-pmacro (int-logic-cc-semantics op icc)
  3583. (sequence ((SI tmp))
  3584. (set tmp (op GRi GRj))
  3585. (set GRk tmp)
  3586. (set-z-and-n icc tmp))
  3587. )
  3588. (define-pmacro (int-logic-cc-r-r name op ope comment)
  3589. (dni (.sym name cc)
  3590. (comment)
  3591. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3592. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3593. (.str (.sym name cc) "$pack $GRi,$GRj,$GRk,$ICCi_1")
  3594. (+ pack GRk op GRi ICCi_1 ope GRj)
  3595. (int-logic-cc-semantics name ICCi_1)
  3596. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3597. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3598. )
  3599. )
  3600. (int-logic-cc-r-r and OP_01 OPE2_01 "and reg/reg, set icc")
  3601. (int-logic-cc-r-r or OP_01 OPE2_03 "or reg/reg, set icc")
  3602. (int-logic-cc-r-r xor OP_01 OPE2_05 "xor reg/reg, set icc")
  3603. (define-pmacro (int-shift-cc-semantics op l-r icc)
  3604. (sequence ((WI shift) (SI tmp) (QI cc))
  3605. (set shift (and GRj #x1f))
  3606. (set cc (c-call QI (.str "@cpu@_set_icc_for_shift_" l-r)
  3607. GRi shift icc))
  3608. (set tmp (op GRi shift))
  3609. (set GRk tmp)
  3610. (set-z-and-n cc tmp)
  3611. (set icc cc))
  3612. )
  3613. (define-pmacro (int-shift-cc-r-r name l-r op ope comment)
  3614. (dni (.sym name cc)
  3615. (comment)
  3616. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3617. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3618. (.str (.sym name cc) "$pack $GRi,$GRj,$GRk,$ICCi_1")
  3619. (+ pack GRk op GRi ICCi_1 ope GRj)
  3620. (int-shift-cc-semantics name l-r ICCi_1)
  3621. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3622. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3623. )
  3624. )
  3625. (int-shift-cc-r-r sll left OP_01 OPE2_09 "shift left logical reg/reg,set icc")
  3626. (int-shift-cc-r-r srl right OP_01 OPE2_0B "shift right logical reg/reg,set icc")
  3627. (int-shift-cc-r-r sra right OP_01 OPE2_0D "shift right arith reg/reg,set icc")
  3628. (define-pmacro (multiply-cc-semantics signop arg1 arg2 targ icc)
  3629. (sequence ((DI tmp) (QI cc))
  3630. (set cc icc)
  3631. (set tmp (mul DI (signop DI arg1) (signop DI arg2)))
  3632. (set-n cc (srl DI tmp 63))
  3633. (set-z cc (eq tmp 0))
  3634. (set targ tmp)
  3635. (set icc cc))
  3636. )
  3637. (define-pmacro (multiply-cc-r-r name signop op ope comment)
  3638. (dni name
  3639. (comment)
  3640. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2)
  3641. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3642. (.str name "$pack $GRi,$GRj,$GRdoublek,$ICCi_1")
  3643. (+ pack GRdoublek op GRi ICCi_1 ope GRj)
  3644. (multiply-cc-semantics signop GRi GRj GRdoublek ICCi_1)
  3645. ((fr400 (unit u-imul)) (fr450 (unit u-imul))
  3646. (fr500 (unit u-imul)) (fr550 (unit u-imul)))
  3647. )
  3648. )
  3649. (multiply-cc-r-r smulcc ext OP_00 OPE2_09 "signed multiply reg/reg")
  3650. (multiply-cc-r-r umulcc zext OP_00 OPE2_0B "unsigned multiply reg/reg")
  3651. ; Format: conditional INT, Logic, Shift, cc r-r
  3652. ;
  3653. (define-pmacro (conditional-int-arith-cc name operation op ope comment)
  3654. (dni name
  3655. (comment)
  3656. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3657. (FR400-MAJOR I-1) (FR450-MAJOR I-1) CONDITIONAL)
  3658. (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
  3659. (+ pack GRk op GRi CCi cond ope GRj)
  3660. (if (eq CCi (or cond 2))
  3661. (int-arith-cc-semantics operation
  3662. (reg h-iccr (and (index-of CCi) 3))))
  3663. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3664. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3665. )
  3666. )
  3667. (conditional-int-arith-cc caddcc add OP_59 OPE4_0 "add, set icc")
  3668. (conditional-int-arith-cc csubcc sub OP_59 OPE4_1 "sub, set icc")
  3669. (dni csmulcc
  3670. "conditional signed multiply and set condition code"
  3671. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2)
  3672. (FR400-MAJOR I-1) (FR450-MAJOR I-1) CONDITIONAL)
  3673. "csmulcc$pack $GRi,$GRj,$GRdoublek,$CCi,$cond"
  3674. (+ pack GRdoublek OP_59 GRi CCi cond OPE4_2 GRj)
  3675. (if (eq CCi (or cond 2))
  3676. (multiply-cc-semantics ext GRi GRj GRdoublek
  3677. (reg h-iccr (and (index-of CCi) 3))))
  3678. ((fr400 (unit u-imul)) (fr450 (unit u-imul))
  3679. (fr500 (unit u-imul)) (fr550 (unit u-imul)))
  3680. )
  3681. (define-pmacro (conditional-int-logic-cc name operation op ope comment)
  3682. (dni name
  3683. (comment)
  3684. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3685. (FR400-MAJOR I-1) (FR450-MAJOR I-1) CONDITIONAL)
  3686. (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
  3687. (+ pack GRk op GRi CCi cond ope GRj)
  3688. (if (eq CCi (or cond 2))
  3689. (int-logic-cc-semantics operation
  3690. (reg h-iccr (and (index-of CCi) 3))))
  3691. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3692. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3693. )
  3694. )
  3695. (conditional-int-logic-cc candcc and OP_5B OPE4_0 "conditional and, set icc")
  3696. (conditional-int-logic-cc corcc or OP_5B OPE4_1 "conditional or , set icc")
  3697. (conditional-int-logic-cc cxorcc xor OP_5B OPE4_2 "conditional xor, set icc")
  3698. (define-pmacro (conditional-int-shift-cc name l-r op ope comment)
  3699. (dni (.sym c name cc)
  3700. (comment)
  3701. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3702. (FR400-MAJOR I-1) (FR450-MAJOR I-1) CONDITIONAL)
  3703. (.str (.sym c name cc) "$pack $GRi,$GRj,$GRk,$CCi,$cond")
  3704. (+ pack GRk op GRi CCi cond ope GRj)
  3705. (if (eq CCi (or cond 2))
  3706. (int-shift-cc-semantics name l-r
  3707. (reg h-iccr (and (index-of CCi) 3))))
  3708. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3709. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3710. )
  3711. )
  3712. (conditional-int-shift-cc sll left OP_5D OPE4_0 "shift left logical, set icc")
  3713. (conditional-int-shift-cc srl right OP_5D OPE4_1 "shift right logical, set icc")
  3714. (conditional-int-shift-cc sra right OP_5D OPE4_2 "shift right arith , set icc")
  3715. ; Add and subtract with carry
  3716. ;
  3717. (define-pmacro (int-arith-x-r-r name operation op ope comment)
  3718. (dni name
  3719. (comment)
  3720. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3721. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3722. (.str name "$pack $GRi,$GRj,$GRk,$ICCi_1")
  3723. (+ pack GRk op GRi ICCi_1 ope GRj)
  3724. (set GRk ((.sym operation c) GRi GRj (cbit ICCi_1)))
  3725. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3726. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3727. )
  3728. )
  3729. (int-arith-x-r-r addx add OP_00 OPE2_02 "Add reg/reg, with carry")
  3730. (int-arith-x-r-r subx sub OP_00 OPE2_06 "Sub reg/reg, with carry")
  3731. (define-pmacro (int-arith-x-cc-r-r name operation op ope comment)
  3732. (dni name
  3733. (comment)
  3734. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3735. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3736. (.str name "$pack $GRi,$GRj,$GRk,$ICCi_1")
  3737. (+ pack GRk op GRi ICCi_1 ope GRj)
  3738. (sequence ((WI tmp) (QI cc))
  3739. (set cc ICCi_1)
  3740. (set tmp ((.sym operation c) GRi GRj (cbit cc)))
  3741. (set-v cc ((.sym operation -oflag) GRi GRj (cbit cc)))
  3742. (set-c cc ((.sym operation -cflag) GRi GRj (cbit cc)))
  3743. (set-z-and-n cc tmp)
  3744. (set GRk tmp)
  3745. (set ICCi_1 cc))
  3746. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3747. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3748. )
  3749. )
  3750. (int-arith-x-cc-r-r addxcc add OP_00 OPE2_03 "Add reg/reg, use/set carry")
  3751. (int-arith-x-cc-r-r subxcc sub OP_00 OPE2_07 "Sub reg/reg, use/set carry")
  3752. ; Add and subtract with saturation
  3753. ;
  3754. (define-pmacro (int-arith-ss-r-r name operation op ope comment)
  3755. (dni name
  3756. (comment)
  3757. ((UNIT IALL) (MACH fr400,fr450)
  3758. (FR400-MAJOR I-1) (FR450-MAJOR I-1) AUDIO)
  3759. (.str name "$pack $GRi,$GRj,$GRk")
  3760. (+ pack GRk op GRi ope GRj)
  3761. (sequence ()
  3762. (set GRk (operation GRi GRj))
  3763. (if ((.sym operation -oflag) GRi GRj (const 0))
  3764. ; Overflow, saturate.
  3765. ; Sign of result will be
  3766. ; same as sign of first operand.
  3767. (set GRk
  3768. (cond SI
  3769. ((gt GRi 0) (const #x7fffffff))
  3770. ((lt GRi 0) (const #x80000000))
  3771. (else (const 0)))))
  3772. )
  3773. ((fr400 (unit u-integer)) (fr450 (unit u-integer)))
  3774. )
  3775. )
  3776. (int-arith-ss-r-r addss add OP_46 OPE1_00 "add reg/reg, with saturation")
  3777. (int-arith-ss-r-r subss sub OP_46 OPE1_01 "sub reg/reg, with saturation")
  3778. ; Format: INT, Logic, Shift r-simm
  3779. ;
  3780. (define-pmacro (int-logic-r-simm name operation op comment)
  3781. (dni name
  3782. (comment)
  3783. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3784. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3785. (.str name "$pack $GRi,$s12,$GRk")
  3786. (+ pack GRk op GRi s12)
  3787. (set GRk (operation GRi s12))
  3788. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3789. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3790. )
  3791. )
  3792. (int-logic-r-simm addi add OP_10 "add reg/immed")
  3793. (int-logic-r-simm subi sub OP_14 "sub reg/immed")
  3794. (int-logic-r-simm andi and OP_20 "and reg/immed")
  3795. (int-logic-r-simm ori or OP_22 "or reg/immed")
  3796. (int-logic-r-simm xori xor OP_24 "xor reg/immed")
  3797. (dni sdivi
  3798. "signed division reg/immed"
  3799. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2)
  3800. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3801. "sdivi$pack $GRi,$s12,$GRk"
  3802. (+ pack GRk OP_1E GRi s12)
  3803. (sequence ()
  3804. (c-call VOID "@cpu@_signed_integer_divide"
  3805. GRi s12 (index-of GRk) 0)
  3806. (clobber GRk))
  3807. ((fr400 (unit u-idiv)) (fr450 (unit u-idiv))
  3808. (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
  3809. )
  3810. (dni nsdivi
  3811. "non excepting signed division reg/immed"
  3812. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
  3813. (MACH simple,tomcat,fr500,fr550,frv))
  3814. "nsdivi$pack $GRi,$s12,$GRk"
  3815. (+ pack GRk OP_2E GRi s12)
  3816. (sequence ()
  3817. (c-call VOID "@cpu@_signed_integer_divide"
  3818. GRi s12 (index-of GRk) 1)
  3819. (clobber GRk))
  3820. ((fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
  3821. )
  3822. (dni udivi
  3823. "unsigned division reg/immed"
  3824. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2)
  3825. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3826. "udivi$pack $GRi,$s12,$GRk"
  3827. (+ pack GRk OP_1F GRi s12)
  3828. (sequence ()
  3829. (c-call VOID "@cpu@_unsigned_integer_divide"
  3830. GRi s12 (index-of GRk) 0)
  3831. (clobber GRk))
  3832. ((fr400 (unit u-idiv)) (fr450 (unit u-idiv))
  3833. (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
  3834. )
  3835. (dni nudivi
  3836. "non excepting unsigned division reg/immed"
  3837. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
  3838. (MACH simple,tomcat,fr500,fr550,frv))
  3839. "nudivi$pack $GRi,$s12,$GRk"
  3840. (+ pack GRk OP_2F GRi s12)
  3841. (sequence ()
  3842. (c-call VOID "@cpu@_unsigned_integer_divide"
  3843. GRi s12 (index-of GRk) 1)
  3844. (clobber GRk))
  3845. ((fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
  3846. )
  3847. (define-pmacro (multiply-r-simm name signop op comment)
  3848. (dni name
  3849. (comment)
  3850. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2)
  3851. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3852. (.str name "$pack $GRi,$s12,$GRdoublek")
  3853. (+ pack GRdoublek op GRi s12)
  3854. (set GRdoublek (mul DI (signop DI GRi) (signop DI s12)))
  3855. ((fr400 (unit u-imul)) (fr450 (unit u-imul))
  3856. (fr500 (unit u-imul)) (fr550 (unit u-imul)))
  3857. )
  3858. )
  3859. (multiply-r-simm smuli ext OP_18 "signed multiply reg/immed")
  3860. (multiply-r-simm umuli zext OP_1A "unsigned multiply reg/immed")
  3861. (define-pmacro (int-shift-r-simm name op comment)
  3862. (dni (.sym name i)
  3863. (comment)
  3864. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3865. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3866. (.str (.sym name i) "$pack $GRi,$s12,$GRk")
  3867. (+ pack GRk op GRi s12)
  3868. (set GRk (name GRi (and s12 #x1f)))
  3869. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3870. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3871. )
  3872. )
  3873. (int-shift-r-simm sll OP_28 "shift left logical reg/immed")
  3874. (int-shift-r-simm srl OP_2A "shift right logical reg/immed")
  3875. (int-shift-r-simm sra OP_2C "shift right arith reg/immed")
  3876. (dni scani
  3877. "scan immediate"
  3878. ((UNIT SCAN) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3879. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3880. "scani$pack $GRi,$s12,$GRk"
  3881. (+ pack GRk OP_47 GRi s12)
  3882. (scan-semantics GRi s12 GRk)
  3883. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3884. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3885. )
  3886. ; Format: INT, Logic, Shift cc r-simm
  3887. ;
  3888. (define-pmacro (int-arith-cc-r-simm name operation op comment)
  3889. (dni name
  3890. (comment)
  3891. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3892. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3893. (.str name "$pack $GRi,$s10,$GRk,$ICCi_1")
  3894. (+ pack GRk op GRi ICCi_1 s10)
  3895. (sequence ((BI tmp) (QI cc) (SI result))
  3896. (set cc ICCi_1)
  3897. (set tmp ((.sym operation -oflag) GRi s10 (const 0)))
  3898. (set-v cc tmp)
  3899. (set tmp ((.sym operation -cflag) GRi s10 (const 0)))
  3900. (set-c cc tmp)
  3901. (set result (operation GRi s10))
  3902. (set-z-and-n cc result)
  3903. (set GRk result)
  3904. (set ICCi_1 cc))
  3905. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3906. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3907. )
  3908. )
  3909. (int-arith-cc-r-simm addicc add OP_11 "add reg/immed, set icc")
  3910. (int-arith-cc-r-simm subicc sub OP_15 "sub reg/immed, set icc")
  3911. (define-pmacro (int-logic-cc-r-simm name op comment)
  3912. (dni (.sym name icc)
  3913. (comment)
  3914. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3915. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3916. (.str (.sym name icc) "$pack $GRi,$s10,$GRk,$ICCi_1")
  3917. (+ pack GRk op GRi ICCi_1 s10)
  3918. (sequence ((SI tmp))
  3919. (set tmp (name GRi s10))
  3920. (set GRk tmp)
  3921. (set-z-and-n ICCi_1 tmp))
  3922. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3923. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3924. )
  3925. )
  3926. (int-logic-cc-r-simm and OP_21 "and reg/immed, set icc")
  3927. (int-logic-cc-r-simm or OP_23 "or reg/immed, set icc")
  3928. (int-logic-cc-r-simm xor OP_25 "xor reg/immed, set icc")
  3929. (define-pmacro (multiply-cc-r-simm name signop op comment)
  3930. (dni name
  3931. (comment)
  3932. ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2)
  3933. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3934. (.str name "$pack $GRi,$s10,$GRdoublek,$ICCi_1")
  3935. (+ pack GRdoublek op GRi ICCi_1 s10)
  3936. (multiply-cc-semantics signop GRi s10 GRdoublek ICCi_1)
  3937. ((fr400 (unit u-imul)) (fr450 (unit u-imul))
  3938. (fr500 (unit u-imul)) (fr550 (unit u-imul)))
  3939. )
  3940. )
  3941. (multiply-cc-r-simm smulicc ext OP_19 "signed multiply reg/immed")
  3942. (multiply-cc-r-simm umulicc zext OP_1B "unsigned multiply reg/immed")
  3943. (define-pmacro (int-shift-cc-r-simm name l-r op comment)
  3944. (dni (.sym name icc)
  3945. (comment)
  3946. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3947. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3948. (.str (.sym name icc) "$pack $GRi,$s10,$GRk,$ICCi_1")
  3949. (+ pack GRk op GRi ICCi_1 s10)
  3950. (sequence ((WI shift) (SI tmp) (QI cc))
  3951. (set shift (and s10 #x1f))
  3952. (set cc (c-call QI (.str "@cpu@_set_icc_for_shift_" l-r)
  3953. GRi shift ICCi_1))
  3954. (set tmp (name GRi shift))
  3955. (set GRk tmp)
  3956. (set-z-and-n cc tmp)
  3957. (set ICCi_1 cc))
  3958. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3959. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3960. )
  3961. )
  3962. (int-shift-cc-r-simm sll left OP_29 "shift left logical reg/immed, set icc")
  3963. (int-shift-cc-r-simm srl right OP_2B "shift right logical reg/immed, set icc")
  3964. (int-shift-cc-r-simm sra right OP_2D "shift right arith reg/immed, set icc")
  3965. (define-pmacro (int-arith-x-r-simm name operation op comment)
  3966. (dni name
  3967. (comment)
  3968. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3969. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3970. (.str name "$pack $GRi,$s10,$GRk,$ICCi_1")
  3971. (+ pack GRk op GRi ICCi_1 s10)
  3972. (set GRk ((.sym operation c) GRi s10 (cbit ICCi_1)))
  3973. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3974. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3975. )
  3976. )
  3977. (int-arith-x-r-simm addxi add OP_12 "Add reg/immed, with carry")
  3978. (int-arith-x-r-simm subxi sub OP_16 "Sub reg/immed, with carry")
  3979. (define-pmacro (int-arith-x-cc-r-simm name operation op comment)
  3980. (dni name
  3981. (comment)
  3982. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  3983. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  3984. (.str name "$pack $GRi,$s10,$GRk,$ICCi_1")
  3985. (+ pack GRk op GRi ICCi_1 s10)
  3986. (sequence ((WI tmp) (QI cc))
  3987. (set cc ICCi_1)
  3988. (set tmp ((.sym operation c) GRi s10 (cbit cc)))
  3989. (set-v cc ((.sym operation -oflag) GRi s10 (cbit cc)))
  3990. (set-c cc ((.sym operation -cflag) GRi s10 (cbit cc)))
  3991. (set-z-and-n cc tmp)
  3992. (set GRk tmp)
  3993. (set ICCi_1 cc))
  3994. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  3995. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  3996. )
  3997. )
  3998. (int-arith-x-cc-r-simm addxicc add OP_13 "Add reg/immed, with carry")
  3999. (int-arith-x-cc-r-simm subxicc sub OP_17 "Sub reg/immed, with carry")
  4000. ; Byte compare insns
  4001. (dni cmpb
  4002. "Compare bytes"
  4003. ((UNIT IALL) (MACH fr400,fr450,fr550) (FR550-MAJOR I-1)
  4004. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  4005. "cmpb$pack $GRi,$GRj,$ICCi_1"
  4006. (+ pack (GRk-null) OP_00 GRi ICCi_1 OPE2_0C GRj)
  4007. (sequence ((QI cc))
  4008. (set-n cc (eq (and GRi #xff000000) (and GRj #xff000000)))
  4009. (set-z cc (eq (and GRi #x00ff0000) (and GRj #x00ff0000)))
  4010. (set-v cc (eq (and GRi #x0000ff00) (and GRj #x0000ff00)))
  4011. (set-c cc (eq (and GRi #x000000ff) (and GRj #x000000ff)))
  4012. (set ICCi_1 cc))
  4013. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  4014. (fr550 (unit u-integer)))
  4015. )
  4016. (dni cmpba
  4017. "OR of Compare bytes"
  4018. ((UNIT IALL) (MACH fr400,fr450,fr550) (FR550-MAJOR I-1)
  4019. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  4020. "cmpba$pack $GRi,$GRj,$ICCi_1"
  4021. (+ pack (GRk-null) OP_00 GRi ICCi_1 OPE2_0D GRj)
  4022. (sequence ((QI cc))
  4023. (set cc 0)
  4024. (set-c cc
  4025. (orif (eq (and GRi #xff000000) (and GRj #xff000000))
  4026. (orif (eq (and GRi #x00ff0000) (and GRj #x00ff0000))
  4027. (orif (eq (and GRi #x0000ff00)
  4028. (and GRj #x0000ff00))
  4029. (eq (and GRi #x000000ff)
  4030. (and GRj #x000000ff))))))
  4031. (set ICCi_1 cc))
  4032. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  4033. (fr550 (unit u-integer)))
  4034. )
  4035. ; Format: Load immediate
  4036. ;
  4037. (dni setlo
  4038. "set low order bits"
  4039. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  4040. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  4041. "setlo$pack $ulo16,$GRklo"
  4042. (+ pack GRk OP_3D (misc-null-4) u16)
  4043. (set GRklo u16)
  4044. ((fr400 (unit u-set-hilo)) (fr450 (unit u-set-hilo))
  4045. (fr500 (unit u-set-hilo)) (fr550 (unit u-set-hilo)))
  4046. )
  4047. (dni sethi
  4048. "set high order bits"
  4049. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  4050. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  4051. "sethi$pack $uhi16,$GRkhi"
  4052. (+ pack GRkhi OP_3E (misc-null-4) u16)
  4053. (set GRkhi u16)
  4054. ((fr400 (unit u-set-hilo)) (fr450 (unit u-set-hilo))
  4055. (fr500 (unit u-set-hilo)) (fr550 (unit u-set-hilo)))
  4056. )
  4057. (dni setlos
  4058. "set low order bits and extend sign"
  4059. ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1)
  4060. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  4061. "setlos$pack $slo16,$GRk"
  4062. (+ pack GRk OP_3F (misc-null-4) s16)
  4063. (set GRk s16)
  4064. ((fr400 (unit u-integer)) (fr450 (unit u-integer))
  4065. (fr500 (unit u-integer)) (fr550 (unit u-integer)))
  4066. )
  4067. (define-pmacro (load-gr-r name mode op ope comment ann)
  4068. (dni name
  4069. (comment)
  4070. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2)
  4071. (FR400-MAJOR I-2) (FR450-MAJOR I-2))
  4072. (.str name "$pack " ann "($GRi,$GRj),$GRk")
  4073. (+ pack GRk op GRi ope GRj)
  4074. (set GRk (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj)))
  4075. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4076. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4077. )
  4078. )
  4079. (dann ldann "ld annotation" SI "ld_annotation" "at")
  4080. (load-gr-r ldsb QI OP_02 OPE1_00 "Load signed byte" "@")
  4081. (load-gr-r ldub UQI OP_02 OPE1_01 "Load unsigned byte" "@")
  4082. (load-gr-r ldsh HI OP_02 OPE1_02 "Load signed half" "@")
  4083. (load-gr-r lduh UHI OP_02 OPE1_03 "Load unsigned half" "@")
  4084. (load-gr-r ld SI OP_02 OPE1_04 "Load word" "$ldann")
  4085. (define-pmacro (load-fr-r name mode op ope comment)
  4086. (dni name
  4087. (comment)
  4088. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2)
  4089. (FR400-MAJOR I-2) (FR450-MAJOR I-2) FR-ACCESS)
  4090. (.str name "$pack @($GRi,$GRj),$FRintk")
  4091. (+ pack FRintk op GRi ope GRj)
  4092. (set FRintk (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj)))
  4093. ((fr400 (unit u-fr-load)) (fr450 (unit u-fr-load))
  4094. (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4095. )
  4096. )
  4097. (load-fr-r ldbf UQI OP_02 OPE1_08 "Load byte float")
  4098. (load-fr-r ldhf UHI OP_02 OPE1_09 "Load half float")
  4099. (load-fr-r ldf SI OP_02 OPE1_0A "Load word float")
  4100. (define-pmacro (load-cpr-r name mode op ope reg attr comment)
  4101. (dni name
  4102. (comment)
  4103. ((UNIT LOAD) (FR500-MAJOR I-2) attr)
  4104. (.str name "$pack @($GRi,$GRj),$" reg "k")
  4105. (+ pack (.sym reg k) op GRi ope GRj)
  4106. (set (.sym reg k)
  4107. (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj)))
  4108. ()
  4109. )
  4110. )
  4111. (load-cpr-r ldc SI OP_02 OPE1_0D CPR (MACH frv) "Load coprocessor word")
  4112. ; These correspond to enumerators in frv-sim.h
  4113. (define-pmacro (ne-UQI-size) 0)
  4114. (define-pmacro (ne-QI-size) 1)
  4115. (define-pmacro (ne-UHI-size) 2)
  4116. (define-pmacro (ne-HI-size) 3)
  4117. (define-pmacro (ne-SI-size) 4)
  4118. (define-pmacro (ne-DI-size) 5)
  4119. (define-pmacro (ne-XI-size) 6)
  4120. (define-pmacro (ne-load-semantics base dispix targ idisp size is_float action)
  4121. (sequence ((BI do_op))
  4122. (set do_op
  4123. (c-call BI "@cpu@_check_non_excepting_load"
  4124. (index-of base) dispix (index-of targ)
  4125. idisp size is_float))
  4126. (if do_op action))
  4127. )
  4128. (define-pmacro (ne-load-gr-r name mode op ope size comment)
  4129. (dni name
  4130. (comment)
  4131. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING
  4132. (MACH simple,tomcat,fr500,fr550,frv))
  4133. (.str name "$pack @($GRi,$GRj),$GRk")
  4134. (+ pack GRk op GRi ope GRj)
  4135. (ne-load-semantics GRi (index-of GRj) GRk 0 size 0
  4136. (set GRk
  4137. (c-call mode (.str "@cpu@_read_mem_" mode)
  4138. pc (add GRi GRj))))
  4139. ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4140. )
  4141. )
  4142. (ne-load-gr-r nldsb QI OP_02 OPE1_20 (ne-QI-size) "Load signed byte")
  4143. (ne-load-gr-r nldub UQI OP_02 OPE1_21 (ne-UQI-size) "Load unsigned byte")
  4144. (ne-load-gr-r nldsh HI OP_02 OPE1_22 (ne-HI-size) "Load signed half")
  4145. (ne-load-gr-r nlduh UHI OP_02 OPE1_23 (ne-UHI-size) "Load unsigned half")
  4146. (ne-load-gr-r nld SI OP_02 OPE1_24 (ne-SI-size) "Load word")
  4147. (define-pmacro (ne-load-fr-r name mode op ope size comment)
  4148. (dni name
  4149. (comment)
  4150. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING FR-ACCESS
  4151. (MACH simple,tomcat,fr500,fr550,frv))
  4152. (.str name "$pack @($GRi,$GRj),$FRintk")
  4153. (+ pack FRintk op GRi ope GRj)
  4154. (ne-load-semantics GRi (index-of GRj) FRintk 0 size 1
  4155. (set FRintk
  4156. (c-call mode (.str "@cpu@_read_mem_" mode)
  4157. pc (add GRi GRj))))
  4158. ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4159. )
  4160. )
  4161. (ne-load-fr-r nldbf UQI OP_02 OPE1_28 (ne-UQI-size) "Load byte float")
  4162. (ne-load-fr-r nldhf UHI OP_02 OPE1_29 (ne-UHI-size) "Load half float")
  4163. (ne-load-fr-r nldf SI OP_02 OPE1_2A (ne-SI-size) "Load word float")
  4164. ; Semantics for a load-double insn
  4165. ;
  4166. (define-pmacro (load-double-semantics not_gr mode regtype address arg)
  4167. (if (orif not_gr (ne (index-of (.sym regtype doublek)) 0))
  4168. (sequence ()
  4169. (set address (add GRi arg))
  4170. (set (.sym regtype doublek)
  4171. (c-call mode (.str "@cpu@_read_mem_" mode) pc address))))
  4172. )
  4173. (define-pmacro (load-double-r-r
  4174. name not_gr mode op ope regtype attr profile comment ann)
  4175. (dni name
  4176. (comment)
  4177. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2)
  4178. (FR400-MAJOR I-2) (FR450-MAJOR I-2) attr)
  4179. (.str name "$pack " ann "($GRi,$GRj),$" regtype "doublek")
  4180. (+ pack (.sym regtype doublek) op GRi ope GRj)
  4181. (sequence ((WI address))
  4182. (load-double-semantics not_gr mode regtype address GRj))
  4183. profile
  4184. )
  4185. )
  4186. (dann lddann "ldd annotation" SI "ldd_annotation" "at")
  4187. (load-double-r-r ldd 0 DI OP_02 OPE1_05 GR NA
  4188. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4189. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4190. "Load double word" "$lddann")
  4191. (load-double-r-r lddf 1 DF OP_02 OPE1_0B FR FR-ACCESS
  4192. ((fr400 (unit u-fr-load)) (fr450 (unit u-fr-load))
  4193. (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4194. "Load double float" "@")
  4195. (load-double-r-r lddc 1 DI OP_02 OPE1_0E CPR (MACH frv) ()
  4196. "Load coprocessor double" "@")
  4197. (define-pmacro (ne-load-double-r-r
  4198. name not_gr mode op ope regtype size is_float attr profile
  4199. comment)
  4200. (dni name
  4201. (comment)
  4202. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING attr
  4203. (MACH simple,tomcat,fr500,fr550,frv))
  4204. (.str name "$pack @($GRi,$GRj),$" regtype "doublek")
  4205. (+ pack (.sym regtype doublek) op GRi ope GRj)
  4206. (sequence ((WI address))
  4207. (ne-load-semantics GRi (index-of GRj) (.sym regtype doublek)
  4208. 0 size is_float
  4209. (load-double-semantics not_gr mode
  4210. regtype
  4211. address GRj)))
  4212. profile
  4213. )
  4214. )
  4215. (ne-load-double-r-r nldd 0 DI OP_02 OPE1_25 GR (ne-DI-size) 0 NA
  4216. ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load double word")
  4217. (ne-load-double-r-r nlddf 1 DF OP_02 OPE1_2B FR (ne-DI-size) 1 FR-ACCESS
  4218. ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load double float")
  4219. ; Semantics for a load-quad insn
  4220. ;
  4221. (define-pmacro (load-quad-semantics regtype address arg)
  4222. (sequence ()
  4223. (set address (add GRi arg))
  4224. (c-call VOID (.str "@cpu@_load_quad_" regtype)
  4225. pc address (index-of (.sym regtype k))))
  4226. )
  4227. (define-pmacro (load-quad-r-r name op ope regtype attr profile comment)
  4228. (dni name
  4229. (comment)
  4230. ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) attr)
  4231. (.str name "$pack @($GRi,$GRj),$" regtype "k")
  4232. (+ pack (.sym regtype k) op GRi ope GRj)
  4233. (sequence ((WI address))
  4234. (load-quad-semantics regtype address GRj))
  4235. ; TODO regtype-k not referenced for profiling
  4236. profile
  4237. )
  4238. )
  4239. (load-quad-r-r ldq OP_02 OPE1_06 GR NA ((fr500 (unit u-gr-load)))
  4240. "Load quad word")
  4241. (load-quad-r-r ldqf OP_02 OPE1_0C FRint FR-ACCESS ((fr500 (unit u-fr-load)))
  4242. "Load quad float")
  4243. (load-quad-r-r ldqc OP_02 OPE1_0F CPR NA () "Load coprocessor quad")
  4244. (define-pmacro (ne-load-quad-r-r
  4245. name op ope regtype size is_float attr profile comment)
  4246. (dni name
  4247. (comment)
  4248. ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING attr)
  4249. (.str name "$pack @($GRi,$GRj),$" regtype "k")
  4250. (+ pack (.sym regtype k) op GRi ope GRj)
  4251. (sequence ((WI address))
  4252. (ne-load-semantics GRi (index-of GRj) (.sym regtype k)
  4253. 0 size is_float
  4254. (load-quad-semantics regtype address GRj)))
  4255. ; TODO regtype-k not referenced for profiling
  4256. profile
  4257. )
  4258. )
  4259. (ne-load-quad-r-r nldq OP_02 OPE1_26 GR (ne-XI-size) 0 NA
  4260. ((fr500 (unit u-gr-load))) "Load quad word")
  4261. (ne-load-quad-r-r nldqf OP_02 OPE1_2C FRint (ne-XI-size) 1 FR-ACCESS
  4262. ((fr500 (unit u-fr-load))) "Load quad float")
  4263. (define-pmacro (load-gr-u-semantics mode)
  4264. (sequence ((UWI address))
  4265. (set address (add GRi GRj))
  4266. (set GRk (c-call mode (.str "@cpu@_read_mem_" mode) pc address))
  4267. (if (ne (index-of GRi) (index-of GRk))
  4268. (sequence ()
  4269. (set GRi address)
  4270. (c-call VOID "@cpu@_force_update"))))
  4271. )
  4272. (define-pmacro (load-gr-u name mode op ope comment)
  4273. (dni name
  4274. (comment)
  4275. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2)
  4276. (FR400-MAJOR I-2) (FR450-MAJOR I-2))
  4277. (.str name "$pack @($GRi,$GRj),$GRk")
  4278. (+ pack GRk op GRi ope GRj)
  4279. (load-gr-u-semantics mode)
  4280. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4281. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4282. )
  4283. )
  4284. (load-gr-u ldsbu QI OP_02 OPE1_10 "Load signed byte, update index")
  4285. (load-gr-u ldubu UQI OP_02 OPE1_11 "Load unsigned byte, update index")
  4286. (load-gr-u ldshu HI OP_02 OPE1_12 "Load signed half, update index")
  4287. (load-gr-u lduhu UHI OP_02 OPE1_13 "Load unsigned half, update index")
  4288. (load-gr-u ldu SI OP_02 OPE1_14 "Load word, update index")
  4289. (define-pmacro (ne-load-gr-u name mode op ope size comment)
  4290. (dni name
  4291. (comment)
  4292. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING
  4293. (MACH simple,tomcat,fr500,fr550,frv))
  4294. (.str name "$pack @($GRi,$GRj),$GRk")
  4295. (+ pack GRk op GRi ope GRj)
  4296. (ne-load-semantics GRi (index-of GRj) GRk 0 size 0 (load-gr-u-semantics mode))
  4297. ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4298. )
  4299. )
  4300. (ne-load-gr-u nldsbu QI OP_02 OPE1_30 (ne-QI-size) "Load signed byte, update index")
  4301. (ne-load-gr-u nldubu UQI OP_02 OPE1_31 (ne-UQI-size) "Load unsigned byte, update index")
  4302. (ne-load-gr-u nldshu HI OP_02 OPE1_32 (ne-HI-size) "Load signed half, update index")
  4303. (ne-load-gr-u nlduhu UHI OP_02 OPE1_33 (ne-UHI-size) "Load unsigned half, update index")
  4304. (ne-load-gr-u nldu SI OP_02 OPE1_34 (ne-SI-size) "Load word, update index")
  4305. (define-pmacro (load-non-gr-u-semantics mode regtype)
  4306. (sequence ((UWI address))
  4307. (set address (add GRi GRj))
  4308. (set (.sym regtype k)
  4309. (c-call mode (.str "@cpu@_read_mem_" mode) pc address))
  4310. (set GRi address)
  4311. (c-call VOID "@cpu@_force_update"))
  4312. )
  4313. (define-pmacro (load-fr-u name mode op ope comment)
  4314. (dni name
  4315. (comment)
  4316. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2)
  4317. (FR400-MAJOR I-2) (FR450-MAJOR I-2) FR-ACCESS)
  4318. (.str name "$pack @($GRi,$GRj),$FRintk")
  4319. (+ pack FRintk op GRi ope GRj)
  4320. (load-non-gr-u-semantics mode FRint)
  4321. ((fr400 (unit u-fr-load)) (fr450 (unit u-fr-load))
  4322. (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4323. )
  4324. )
  4325. (load-fr-u ldbfu UQI OP_02 OPE1_18 "Load byte float, update index")
  4326. (load-fr-u ldhfu UHI OP_02 OPE1_19 "Load half float, update index")
  4327. (load-fr-u ldfu SI OP_02 OPE1_1A "Load word float, update index")
  4328. (define-pmacro (load-cpr-u name mode op ope comment)
  4329. (dni name
  4330. (comment)
  4331. ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv))
  4332. (.str name "$pack @($GRi,$GRj),$CPRk")
  4333. (+ pack CPRk op GRi ope GRj)
  4334. (load-non-gr-u-semantics mode CPR)
  4335. ()
  4336. )
  4337. )
  4338. (load-cpr-u ldcu SI OP_02 OPE1_1D "Load coprocessor word float,update index")
  4339. (define-pmacro (ne-load-non-gr-u name mode op ope regtype size comment)
  4340. (dni name
  4341. (comment)
  4342. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING FR-ACCESS
  4343. (MACH simple,tomcat,fr500,fr550,frv))
  4344. (.str name "$pack @($GRi,$GRj),$" regtype "k")
  4345. (+ pack (.sym regtype k) op GRi ope GRj)
  4346. (ne-load-semantics GRi (index-of GRj) (.sym regtype k) 0 size 1
  4347. (load-non-gr-u-semantics mode regtype))
  4348. ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4349. )
  4350. )
  4351. (ne-load-non-gr-u nldbfu UQI OP_02 OPE1_38 FRint (ne-UQI-size) "Load byte float, update index")
  4352. (ne-load-non-gr-u nldhfu UHI OP_02 OPE1_39 FRint (ne-UHI-size) "Load half float, update index")
  4353. (ne-load-non-gr-u nldfu SI OP_02 OPE1_3A FRint (ne-SI-size) "Load word float, update index")
  4354. (define-pmacro (load-double-gr-u-semantics)
  4355. (sequence ((WI address))
  4356. (load-double-semantics 0 DI GR address GRj)
  4357. (if (ne (index-of GRi) (index-of GRdoublek))
  4358. (sequence ()
  4359. (set GRi address)
  4360. (c-call VOID "@cpu@_force_update"))))
  4361. )
  4362. (define-pmacro (load-double-gr-u name op ope comment)
  4363. (dni name
  4364. (comment)
  4365. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2)
  4366. (FR400-MAJOR I-2) (FR450-MAJOR I-2))
  4367. (.str name "$pack @($GRi,$GRj),$GRdoublek")
  4368. (+ pack GRdoublek op GRi ope GRj)
  4369. (load-double-gr-u-semantics)
  4370. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4371. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4372. )
  4373. )
  4374. (load-double-gr-u lddu OP_02 OPE1_15 "Load double word, update index")
  4375. (define-pmacro (ne-load-double-gr-u name op ope size comment)
  4376. (dni name
  4377. (comment)
  4378. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING
  4379. (MACH simple,tomcat,fr500,fr550,frv))
  4380. (.str name "$pack @($GRi,$GRj),$GRdoublek")
  4381. (+ pack GRdoublek op GRi ope GRj)
  4382. (ne-load-semantics GRi (index-of GRj) GRdoublek 0 size 0
  4383. (load-double-gr-u-semantics))
  4384. ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4385. )
  4386. )
  4387. (ne-load-double-gr-u nlddu OP_02 OPE1_35 (ne-DI-size) "Load double word, update index")
  4388. (define-pmacro (load-double-non-gr-u-semantics mode regtype)
  4389. (sequence ((WI address))
  4390. (load-double-semantics 1 mode regtype address GRj)
  4391. (set GRi address)
  4392. (c-call VOID "@cpu@_force_update"))
  4393. )
  4394. (define-pmacro (load-double-non-gr-u
  4395. name mode op ope regtype attr profile comment)
  4396. (dni name
  4397. (comment)
  4398. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2)
  4399. (FR400-MAJOR I-2) (FR450-MAJOR I-2) attr)
  4400. (.str name "$pack @($GRi,$GRj),$" regtype "doublek")
  4401. (+ pack (.sym regtype doublek) op GRi ope GRj)
  4402. (load-double-non-gr-u-semantics mode regtype)
  4403. profile
  4404. )
  4405. )
  4406. (load-double-non-gr-u lddfu DF OP_02 OPE1_1B FR FR-ACCESS
  4407. ((fr400 (unit u-fr-load)) (fr450 (unit u-fr-load))
  4408. (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4409. "Load double float, update index")
  4410. (load-double-non-gr-u lddcu DI OP_02 OPE1_1E CPR (MACH frv)
  4411. () "Load coprocessor double float, update index")
  4412. (define-pmacro (ne-load-double-non-gr-u name mode op ope regtype size comment)
  4413. (dni name
  4414. (comment)
  4415. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING FR-ACCESS
  4416. (MACH simple,tomcat,fr500,fr550,frv))
  4417. (.str name "$pack @($GRi,$GRj),$" regtype "doublek")
  4418. (+ pack (.sym regtype doublek) op GRi ope GRj)
  4419. (ne-load-semantics GRi (index-of GRj) (.sym regtype doublek) 0 size 1
  4420. (load-double-non-gr-u-semantics mode regtype))
  4421. ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4422. )
  4423. )
  4424. (ne-load-double-non-gr-u nlddfu DF OP_02 OPE1_3B FR (ne-DI-size) "Load double float, update index")
  4425. (define-pmacro (load-quad-gr-u-semantics)
  4426. (sequence ((WI address))
  4427. (load-quad-semantics GR address GRj)
  4428. (if (ne (index-of GRi) (index-of GRk))
  4429. (sequence ()
  4430. (set GRi address)
  4431. (c-call VOID "@cpu@_force_update"))))
  4432. )
  4433. (define-pmacro (load-quad-gr-u name op ope comment)
  4434. (dni name
  4435. (comment)
  4436. ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv))
  4437. (.str name "$pack @($GRi,$GRj),$GRk")
  4438. (+ pack GRk op GRi ope GRj)
  4439. (load-quad-gr-u-semantics)
  4440. ; TODO - GRk not referenced here for profiling
  4441. ((fr500 (unit u-gr-load)))
  4442. )
  4443. )
  4444. (load-quad-gr-u ldqu OP_02 OPE1_16 "Load quad word, update index")
  4445. (define-pmacro (ne-load-quad-gr-u name op ope size comment)
  4446. (dni name
  4447. (comment)
  4448. ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING)
  4449. (.str name "$pack @($GRi,$GRj),$GRk")
  4450. (+ pack GRk op GRi ope GRj)
  4451. (ne-load-semantics GRi (index-of GRj) GRk 0 size 0
  4452. (load-quad-gr-u-semantics))
  4453. ; TODO - GRk not referenced here for profiling
  4454. ((fr500 (unit u-gr-load)))
  4455. )
  4456. )
  4457. (ne-load-quad-gr-u nldqu OP_02 OPE1_36 (ne-XI-size) "Load quad word, update index")
  4458. (define-pmacro (load-quad-non-gr-u-semantics regtype)
  4459. (sequence ((WI address))
  4460. (load-quad-semantics regtype address GRj)
  4461. (set GRi address)
  4462. (c-call VOID "@cpu@_force_update"))
  4463. )
  4464. (define-pmacro (load-quad-non-gr-u name op ope regtype attr profile comment)
  4465. (dni name
  4466. (comment)
  4467. ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) attr)
  4468. (.str name "$pack @($GRi,$GRj),$" regtype "k")
  4469. (+ pack (.sym regtype k) op GRi ope GRj)
  4470. (load-quad-non-gr-u-semantics regtype)
  4471. profile
  4472. )
  4473. )
  4474. (load-quad-non-gr-u ldqfu OP_02 OPE1_1C FRint FR-ACCESS
  4475. ((fr500 (unit u-fr-load))) "Load quad float, update index")
  4476. (load-quad-non-gr-u ldqcu OP_02 OPE1_1F CPR NA
  4477. () "Load coprocessor quad word, update index")
  4478. (define-pmacro (ne-load-quad-non-gr-u name op ope regtype size comment)
  4479. (dni name
  4480. (comment)
  4481. ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING FR-ACCESS)
  4482. (.str name "$pack @($GRi,$GRj),$" regtype "k")
  4483. (+ pack (.sym regtype k) op GRi ope GRj)
  4484. (ne-load-semantics GRi (index-of GRj) (.sym regtype k) 0 size 1
  4485. (load-quad-non-gr-u-semantics regtype))
  4486. ((fr500 (unit u-fr-load)))
  4487. )
  4488. )
  4489. (ne-load-quad-non-gr-u nldqfu OP_02 OPE1_3C FRint (ne-XI-size) "Load quad float,update index")
  4490. (define-pmacro (load-r-simm name mode op regtype attr profile comment)
  4491. (dni name
  4492. (comment)
  4493. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2)
  4494. (FR400-MAJOR I-2) (FR450-MAJOR I-2) attr)
  4495. (.str name "$pack @($GRi,$d12),$" regtype "k")
  4496. (+ pack (.sym regtype k) op GRi d12)
  4497. (set (.sym regtype k)
  4498. (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi d12)))
  4499. profile
  4500. )
  4501. )
  4502. (load-r-simm ldsbi QI OP_30 GR NA
  4503. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4504. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4505. "Load signed byte")
  4506. (load-r-simm ldshi HI OP_31 GR NA
  4507. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4508. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4509. "Load signed half")
  4510. (load-r-simm ldi SI OP_32 GR NA
  4511. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4512. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4513. "Load word")
  4514. (load-r-simm ldubi UQI OP_35 GR NA
  4515. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4516. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4517. "Load unsigned byte")
  4518. (load-r-simm lduhi UHI OP_36 GR NA
  4519. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4520. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4521. "Load unsigned half")
  4522. (load-r-simm ldbfi UQI OP_38 FRint FR-ACCESS
  4523. ((fr400 (unit u-fr-load)) (fr450 (unit u-fr-load))
  4524. (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4525. "Load byte float")
  4526. (load-r-simm ldhfi UHI OP_39 FRint FR-ACCESS
  4527. ((fr400 (unit u-fr-load)) (fr450 (unit u-fr-load))
  4528. (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4529. "Load half float")
  4530. (load-r-simm ldfi SI OP_3A FRint FR-ACCESS
  4531. ((fr400 (unit u-fr-load)) (fr450 (unit u-fr-load))
  4532. (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4533. "Load word float")
  4534. (define-pmacro (ne-load-r-simm
  4535. name mode op regtype size is_float attr profile comment)
  4536. (dni name
  4537. (comment)
  4538. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING attr
  4539. (MACH simple,tomcat,fr500,fr550,frv))
  4540. (.str name "$pack @($GRi,$d12),$" regtype "k")
  4541. (+ pack (.sym regtype k) op GRi d12)
  4542. (ne-load-semantics GRi -1 (.sym regtype k) d12 size is_float
  4543. (set (.sym regtype k)
  4544. (c-call mode (.str "@cpu@_read_mem_" mode)
  4545. pc (add GRi d12))))
  4546. profile
  4547. )
  4548. )
  4549. (ne-load-r-simm nldsbi QI OP_40 GR (ne-QI-size) 0 NA
  4550. ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load signed byte")
  4551. (ne-load-r-simm nldubi UQI OP_41 GR (ne-UQI-size) 0 NA
  4552. ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load unsigned byte")
  4553. (ne-load-r-simm nldshi HI OP_42 GR (ne-HI-size) 0 NA
  4554. ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load signed half")
  4555. (ne-load-r-simm nlduhi UHI OP_43 GR (ne-UHI-size) 0 NA
  4556. ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load unsigned half")
  4557. (ne-load-r-simm nldi SI OP_44 GR (ne-SI-size) 0 NA
  4558. ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load word")
  4559. (ne-load-r-simm nldbfi UQI OP_48 FRint (ne-UQI-size) 1 FR-ACCESS
  4560. ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load byte float")
  4561. (ne-load-r-simm nldhfi UHI OP_49 FRint (ne-UHI-size) 1 FR-ACCESS
  4562. ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load half float")
  4563. (ne-load-r-simm nldfi SI OP_4A FRint (ne-SI-size) 1 FR-ACCESS
  4564. ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load word float")
  4565. (define-pmacro (load-double-r-simm
  4566. name not_gr mode op regtype attr profile comment)
  4567. (dni name
  4568. (comment)
  4569. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2)
  4570. (FR400-MAJOR I-2) (FR450-MAJOR I-2) attr)
  4571. (.str name "$pack @($GRi,$d12),$" regtype "doublek")
  4572. (+ pack (.sym regtype doublek) op GRi d12)
  4573. (sequence ((WI address))
  4574. (load-double-semantics not_gr mode regtype address d12))
  4575. profile
  4576. )
  4577. )
  4578. (load-double-r-simm lddi 0 DI OP_33 GR NA
  4579. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4580. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4581. "Load double word")
  4582. (load-double-r-simm lddfi 1 DF OP_3B FR FR-ACCESS
  4583. ((fr400 (unit u-fr-load)) (fr450 (unit u-fr-load))
  4584. (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4585. "Load double float")
  4586. (define-pmacro (ne-load-double-r-simm
  4587. name not_gr mode op regtype size is_float attr profile comment)
  4588. (dni name
  4589. (comment)
  4590. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING attr
  4591. (MACH simple,tomcat,fr500,fr550,frv))
  4592. (.str name "$pack @($GRi,$d12),$" regtype "doublek")
  4593. (+ pack (.sym regtype doublek) op GRi d12)
  4594. (sequence ((WI address))
  4595. (ne-load-semantics GRi -1 (.sym regtype doublek)
  4596. d12 size is_float
  4597. (load-double-semantics not_gr mode
  4598. regtype
  4599. address d12)))
  4600. profile
  4601. )
  4602. )
  4603. (ne-load-double-r-simm nlddi 0 DI OP_45 GR (ne-DI-size) 0 NA
  4604. ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load double word")
  4605. (ne-load-double-r-simm nlddfi 1 DF OP_4B FR (ne-DI-size) 1 FR-ACCESS
  4606. ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load double float")
  4607. (define-pmacro (load-quad-r-simm name op regtype attr profile comment)
  4608. (dni name
  4609. (comment)
  4610. ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) attr)
  4611. (.str name "$pack @($GRi,$d12),$" regtype "k")
  4612. (+ pack (.sym regtype k) op GRi d12)
  4613. (sequence ((WI address))
  4614. (load-quad-semantics regtype address d12))
  4615. profile
  4616. )
  4617. )
  4618. (load-quad-r-simm ldqi OP_34 GR NA
  4619. ((fr500 (unit u-gr-load))) "Load quad word")
  4620. (load-quad-r-simm ldqfi OP_3C FRint FR-ACCESS
  4621. ((fr500 (unit u-fr-load))) "Load quad float")
  4622. (define-pmacro (ne-load-quad-r-simm
  4623. name op regtype size is_float attr profile comment)
  4624. (dni name
  4625. (comment)
  4626. ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING attr)
  4627. (.str name "$pack @($GRi,$d12),$" regtype "k")
  4628. (+ pack (.sym regtype k) op GRi d12)
  4629. (sequence ((WI address))
  4630. (ne-load-semantics GRi -1 (.sym regtype k) d12 size is_float
  4631. (load-quad-semantics regtype address d12)))
  4632. profile
  4633. )
  4634. )
  4635. (ne-load-quad-r-simm nldqfi OP_4C FRint (ne-XI-size) 1 FR-ACCESS
  4636. ((fr500 (unit u-fr-load))) "Load quad float")
  4637. (define-pmacro (store-r-r name mode op ope reg attr profile comment)
  4638. (dni name
  4639. (comment)
  4640. ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3)
  4641. (FR400-MAJOR I-3) (FR450-MAJOR I-3) attr)
  4642. (.str name "$pack $" reg "k,@($GRi,$GRj)")
  4643. (+ pack (.sym reg k) op GRi ope GRj)
  4644. (c-call VOID (.str "@cpu@_write_mem_" mode)
  4645. pc (add GRi GRj) (.sym reg k))
  4646. profile
  4647. )
  4648. )
  4649. (store-r-r stb QI OP_03 OPE1_00 GR NA
  4650. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  4651. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  4652. "Store unsigned byte")
  4653. (store-r-r sth HI OP_03 OPE1_01 GR NA
  4654. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  4655. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  4656. "Store unsigned half")
  4657. (store-r-r st SI OP_03 OPE1_02 GR NA
  4658. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  4659. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  4660. "Store word")
  4661. (store-r-r stbf QI OP_03 OPE1_08 FRint FR-ACCESS
  4662. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  4663. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  4664. "Store byte float")
  4665. (store-r-r sthf HI OP_03 OPE1_09 FRint FR-ACCESS
  4666. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  4667. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  4668. "Store half float")
  4669. (store-r-r stf SI OP_03 OPE1_0A FRint FR-ACCESS
  4670. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  4671. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  4672. "Store word float")
  4673. (store-r-r stc SI OP_03 OPE1_25 CPR (MACH frv) () "Store coprocessor word")
  4674. ; Semantics for a store-double insn
  4675. ;
  4676. (define-pmacro (store-double-semantics mode regtype address arg)
  4677. (sequence ()
  4678. (set address (add GRi arg))
  4679. (c-call VOID (.str "@cpu@_write_mem_" mode)
  4680. pc address (.sym regtype doublek)))
  4681. )
  4682. (define-pmacro (store-double-r-r name mode op ope regtype attr profile comment)
  4683. (dni name
  4684. (comment)
  4685. ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3)
  4686. (FR400-MAJOR I-3) (FR450-MAJOR I-3) attr)
  4687. (.str name "$pack $" regtype "doublek,@($GRi,$GRj)")
  4688. (+ pack (.sym regtype doublek) op GRi ope GRj)
  4689. (sequence ((WI address))
  4690. (store-double-semantics mode regtype address GRj))
  4691. profile
  4692. )
  4693. )
  4694. (store-double-r-r std DI OP_03 OPE1_03 GR NA
  4695. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  4696. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  4697. "Store double word")
  4698. (store-double-r-r stdf DF OP_03 OPE1_0B FR FR-ACCESS
  4699. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  4700. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  4701. "Store double float")
  4702. (store-double-r-r stdc DI OP_03 OPE1_26 CPR (MACH frv)
  4703. () "Store coprocessor double word")
  4704. ; Semantics for a store-quad insn
  4705. ;
  4706. (define-pmacro (store-quad-semantics regtype address arg)
  4707. (sequence ()
  4708. (set address (add GRi arg))
  4709. (c-call VOID (.str "@cpu@_store_quad_" regtype)
  4710. pc address (index-of (.sym regtype k))))
  4711. )
  4712. (define-pmacro (store-quad-r-r name op ope regtype attr profile comment)
  4713. (dni name
  4714. (comment)
  4715. ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
  4716. (.str name "$pack $" regtype "k,@($GRi,$GRj)")
  4717. (+ pack (.sym regtype k) op GRi ope GRj)
  4718. (sequence ((WI address))
  4719. (store-quad-semantics regtype address GRj))
  4720. profile
  4721. )
  4722. )
  4723. (store-quad-r-r stq OP_03 OPE1_04 GR NA
  4724. ((fr500 (unit u-gr-store))) "Store quad word")
  4725. (store-quad-r-r stqf OP_03 OPE1_0C FRint FR-ACCESS
  4726. ((fr500 (unit u-fr-store)))
  4727. "Store quad float")
  4728. (store-quad-r-r stqc OP_03 OPE1_27 CPR NA
  4729. () "Store coprocessor quad word")
  4730. (define-pmacro (store-r-r-u name mode op ope regtype attr profile comment)
  4731. (dni name
  4732. (comment)
  4733. ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3)
  4734. (FR400-MAJOR I-3) (FR450-MAJOR I-3) attr)
  4735. (.str name "$pack $" regtype "k,@($GRi,$GRj)")
  4736. (+ pack (.sym regtype k) op GRi ope GRj)
  4737. (sequence ((UWI address))
  4738. (set address (add GRi GRj))
  4739. (c-call VOID (.str "@cpu@_write_mem_" mode)
  4740. pc address (.sym regtype k))
  4741. (set GRi address))
  4742. profile
  4743. )
  4744. )
  4745. (store-r-r-u stbu QI OP_03 OPE1_10 GR NA
  4746. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  4747. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  4748. "Store unsigned byte, update index")
  4749. (store-r-r-u sthu HI OP_03 OPE1_11 GR NA
  4750. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  4751. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  4752. "Store unsigned half, update index")
  4753. (store-r-r-u stu WI OP_03 OPE1_12 GR NA
  4754. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  4755. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  4756. "Store word, update index")
  4757. (store-r-r-u stbfu QI OP_03 OPE1_18 FRint FR-ACCESS
  4758. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  4759. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  4760. "Store byte float, update index")
  4761. (store-r-r-u sthfu HI OP_03 OPE1_19 FRint FR-ACCESS
  4762. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  4763. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  4764. "Store half float, update index")
  4765. (store-r-r-u stfu SI OP_03 OPE1_1A FRint FR-ACCESS
  4766. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  4767. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  4768. "Store word float, update index")
  4769. (store-r-r-u stcu SI OP_03 OPE1_2D CPR (MACH frv) ()
  4770. "Store coprocessor word, update index")
  4771. (define-pmacro (store-double-r-r-u
  4772. name mode op ope regtype attr profile comment)
  4773. (dni name
  4774. (comment)
  4775. ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3)
  4776. (FR400-MAJOR I-3) (FR450-MAJOR I-3) attr)
  4777. (.str name "$pack $" regtype "doublek,@($GRi,$GRj)")
  4778. (+ pack (.sym regtype doublek) op GRi ope GRj)
  4779. (sequence ((WI address))
  4780. (store-double-semantics mode regtype address GRj)
  4781. (set GRi address))
  4782. profile
  4783. )
  4784. )
  4785. (store-double-r-r-u stdu DI OP_03 OPE1_13 GR NA
  4786. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  4787. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  4788. "Store double word, update index")
  4789. (store-double-r-r-u stdfu DF OP_03 OPE1_1B FR FR-ACCESS
  4790. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  4791. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  4792. "Store double float,update index")
  4793. (store-double-r-r-u stdcu DI OP_03 OPE1_2E CPR (MACH frv) ()
  4794. "Store coprocessor double word, update index")
  4795. (define-pmacro (store-quad-r-r-u name op ope regtype attr profile comment)
  4796. (dni name
  4797. (comment)
  4798. ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
  4799. (.str name "$pack $" regtype "k,@($GRi,$GRj)")
  4800. (+ pack (.sym regtype k) op GRi ope GRj)
  4801. (sequence ((WI address))
  4802. (store-quad-semantics regtype address GRj)
  4803. (set GRi address))
  4804. profile
  4805. )
  4806. )
  4807. (store-quad-r-r-u stqu OP_03 OPE1_14 GR NA
  4808. ((fr500 (unit u-gr-store)))
  4809. "Store quad word, update index")
  4810. (store-quad-r-r-u stqfu OP_03 OPE1_1C FRint FR-ACCESS
  4811. ((fr500 (unit u-fr-store)))
  4812. "Store quad float, update index")
  4813. (store-quad-r-r-u stqcu OP_03 OPE1_2F CPR NA ()
  4814. "Store coprocessor quad word, update index")
  4815. (define-pmacro (conditional-load name mode op ope regtype profile comment)
  4816. (dni name
  4817. (comment)
  4818. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2)
  4819. (FR400-MAJOR I-2) (FR450-MAJOR I-2) CONDITIONAL)
  4820. (.str name "$pack @($GRi,$GRj),$" regtype "k,$CCi,$cond")
  4821. (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
  4822. (if (eq CCi (or cond 2))
  4823. (set (.sym regtype k)
  4824. (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj))))
  4825. profile
  4826. )
  4827. )
  4828. (conditional-load cldsb QI OP_5E OPE4_0 GR
  4829. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4830. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4831. "Load signed byte")
  4832. (conditional-load cldub UQI OP_5E OPE4_1 GR
  4833. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4834. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4835. "Load unsigned byte")
  4836. (conditional-load cldsh HI OP_5E OPE4_2 GR
  4837. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4838. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4839. "Load signed half")
  4840. (conditional-load clduh UHI OP_5E OPE4_3 GR
  4841. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4842. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4843. "Load unsigned half")
  4844. (conditional-load cld SI OP_5F OPE4_0 GR
  4845. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4846. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4847. "Load word")
  4848. (conditional-load cldbf UQI OP_60 OPE4_0 FRint
  4849. ((fr400 (unit u-fr-load)) (fr450 (unit u-fr-load))
  4850. (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4851. "Load byte float")
  4852. (conditional-load cldhf UHI OP_60 OPE4_1 FRint
  4853. ((fr400 (unit u-fr-load)) (fr450 (unit u-fr-load))
  4854. (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4855. "Load half float")
  4856. (conditional-load cldf SI OP_60 OPE4_2 FRint
  4857. ((fr400 (unit u-fr-load)) (fr450 (unit u-fr-load))
  4858. (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4859. "Load word float")
  4860. (define-pmacro (conditional-load-double
  4861. name not_gr mode op ope regtype attr profile comment)
  4862. (dni name
  4863. (comment)
  4864. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2)
  4865. (FR400-MAJOR I-2) (FR450-MAJOR I-2) CONDITIONAL attr)
  4866. (.str name "$pack @($GRi,$GRj),$" regtype "doublek,$CCi,$cond")
  4867. (+ pack (.sym regtype doublek) op GRi CCi cond ope GRj)
  4868. (if (eq CCi (or cond 2))
  4869. (sequence ((WI address))
  4870. (load-double-semantics not_gr mode regtype address GRj)))
  4871. profile
  4872. )
  4873. )
  4874. (conditional-load-double cldd 0 DI OP_5F OPE4_1 GR NA
  4875. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4876. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4877. "Load double word")
  4878. (conditional-load-double clddf 1 DF OP_60 OPE4_3 FR FR-ACCESS
  4879. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4880. (fr500 (unit u-gr-load)) (fr550 (unit u-fr-load)))
  4881. "Load double float")
  4882. (dni cldq
  4883. "conditional load quad integer"
  4884. ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) CONDITIONAL)
  4885. "cldq$pack @($GRi,$GRj),$GRk,$CCi,$cond"
  4886. (+ pack GRk OP_5F GRi CCi cond OPE4_2 GRj)
  4887. (if (eq CCi (or cond 2))
  4888. (sequence ((WI address))
  4889. (load-quad-semantics GR address GRj)))
  4890. ((fr500 (unit u-gr-load)))
  4891. )
  4892. (define-pmacro (conditional-load-gr-u name mode op ope comment)
  4893. (dni name
  4894. (comment)
  4895. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2)
  4896. (FR400-MAJOR I-2) (FR450-MAJOR I-2) CONDITIONAL)
  4897. (.str name "$pack @($GRi,$GRj),$GRk,$CCi,$cond")
  4898. (+ pack GRk op GRi CCi cond ope GRj)
  4899. (if (eq CCi (or cond 2))
  4900. (sequence ((WI address))
  4901. (set address (add GRi GRj))
  4902. (set GRk
  4903. (c-call mode (.str "@cpu@_read_mem_" mode)
  4904. pc address))
  4905. (if (ne (index-of GRi) (index-of GRk))
  4906. (set GRi address))))
  4907. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4908. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4909. )
  4910. )
  4911. (conditional-load-gr-u cldsbu QI OP_61 OPE4_0 "Load signed byte, update")
  4912. (conditional-load-gr-u cldubu UQI OP_61 OPE4_1 "Load unsigned byte, update")
  4913. (conditional-load-gr-u cldshu HI OP_61 OPE4_2 "Load signed half, update")
  4914. (conditional-load-gr-u clduhu UHI OP_61 OPE4_3 "Load unsigned half, update")
  4915. (conditional-load-gr-u cldu SI OP_62 OPE4_0 "Load word, update")
  4916. (define-pmacro (conditional-load-non-gr-u name mode op ope regtype comment)
  4917. (dni name
  4918. (comment)
  4919. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2)
  4920. (FR400-MAJOR I-2) (FR450-MAJOR I-2) CONDITIONAL FR-ACCESS)
  4921. (.str name "$pack @($GRi,$GRj),$" regtype "k,$CCi,$cond")
  4922. (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
  4923. (if (eq CCi (or cond 2))
  4924. (sequence ((WI address))
  4925. (set address (add GRi GRj))
  4926. (set (.sym regtype k)
  4927. (c-call mode (.str "@cpu@_read_mem_" mode)
  4928. pc address))
  4929. (set GRi address)))
  4930. ((fr400 (unit u-fr-load)) (fr450 (unit u-fr-load))
  4931. (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4932. )
  4933. )
  4934. (conditional-load-non-gr-u cldbfu UQI OP_63 OPE4_0 FRint "Load byte float, update")
  4935. (conditional-load-non-gr-u cldhfu UHI OP_63 OPE4_1 FRint "Load half float, update")
  4936. (conditional-load-non-gr-u cldfu SI OP_63 OPE4_2 FRint "Load word float, update")
  4937. (dni clddu
  4938. "Load double word, update"
  4939. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2)
  4940. (FR400-MAJOR I-2) (FR450-MAJOR I-2) CONDITIONAL)
  4941. "clddu$pack @($GRi,$GRj),$GRdoublek,$CCi,$cond"
  4942. (+ pack GRdoublek OP_62 GRi CCi cond OPE4_1 GRj)
  4943. (if (eq CCi (or cond 2))
  4944. (sequence ((WI address))
  4945. (load-double-semantics 0 DI GR address GRj)
  4946. (if (ne (index-of GRi) (index-of GRdoublek))
  4947. (set GRi address))))
  4948. ((fr400 (unit u-gr-load)) (fr450 (unit u-gr-load))
  4949. (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
  4950. )
  4951. (dni clddfu
  4952. "Load double float, update"
  4953. ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2)
  4954. (FR400-MAJOR I-2) (FR450-MAJOR I-2) CONDITIONAL FR-ACCESS)
  4955. "clddfu$pack @($GRi,$GRj),$FRdoublek,$CCi,$cond"
  4956. (+ pack FRdoublek OP_63 GRi CCi cond OPE4_3 GRj)
  4957. (if (eq CCi (or cond 2))
  4958. (sequence ((WI address))
  4959. (load-double-semantics 1 DF FR address GRj)
  4960. (set GRi address)))
  4961. ((fr400 (unit u-fr-load)) (fr450 (unit u-fr-load))
  4962. (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
  4963. )
  4964. (dni cldqu
  4965. "conditional load quad integer and update index"
  4966. ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) CONDITIONAL)
  4967. "cldqu$pack @($GRi,$GRj),$GRk,$CCi,$cond"
  4968. (+ pack GRk OP_62 GRi CCi cond OPE4_2 GRj)
  4969. (if (eq CCi (or cond 2))
  4970. (sequence ((WI address))
  4971. (load-quad-semantics GR address GRj)
  4972. (if (ne (index-of GRi) (index-of GRk))
  4973. (set GRi address))))
  4974. ((fr500 (unit u-gr-load)))
  4975. )
  4976. (define-pmacro (conditional-store name mode op ope regtype profile comment)
  4977. (dni name
  4978. (comment)
  4979. ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3)
  4980. (FR400-MAJOR I-3) (FR450-MAJOR I-3) CONDITIONAL)
  4981. (.str name "$pack $" regtype "k,@($GRi,$GRj),$CCi,$cond")
  4982. (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
  4983. (if (eq CCi (or cond 2))
  4984. (c-call VOID (.str "@cpu@_write_mem_" mode)
  4985. pc (add GRi GRj) (.sym regtype k)))
  4986. profile
  4987. )
  4988. )
  4989. (conditional-store cstb QI OP_64 OPE4_0 GR
  4990. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  4991. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  4992. "Store unsigned byte")
  4993. (conditional-store csth HI OP_64 OPE4_1 GR
  4994. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  4995. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  4996. "Store unsigned half")
  4997. (conditional-store cst SI OP_64 OPE4_2 GR
  4998. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  4999. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  5000. "Store word")
  5001. (conditional-store cstbf QI OP_66 OPE4_0 FRint
  5002. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  5003. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  5004. "Store byte float")
  5005. (conditional-store csthf HI OP_66 OPE4_1 FRint
  5006. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  5007. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  5008. "Store half float")
  5009. (conditional-store cstf SI OP_66 OPE4_2 FRint
  5010. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  5011. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  5012. "Store word float")
  5013. (define-pmacro (conditional-store-double
  5014. name mode op ope regtype attr profile comment)
  5015. (dni name
  5016. (comment)
  5017. ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3)
  5018. (FR400-MAJOR I-3) (FR450-MAJOR I-3) CONDITIONAL attr)
  5019. (.str name "$pack $" regtype "doublek,@($GRi,$GRj),$CCi,$cond")
  5020. (+ pack (.sym regtype doublek) op GRi CCi cond ope GRj)
  5021. (if (eq CCi (or cond 2))
  5022. (sequence ((WI address))
  5023. (store-double-semantics mode regtype address GRj)))
  5024. profile
  5025. )
  5026. )
  5027. (conditional-store-double cstd DI OP_64 OPE4_3 GR NA
  5028. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  5029. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  5030. "Store double word")
  5031. (conditional-store-double cstdf DF OP_66 OPE4_3 FR FR-ACCESS
  5032. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  5033. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  5034. "Store double float")
  5035. (dni cstq
  5036. "conditionally store quad word"
  5037. ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) CONDITIONAL)
  5038. "cstq$pack $GRk,@($GRi,$GRj),$CCi,$cond"
  5039. (+ pack GRk OP_65 GRi CCi cond OPE4_0 GRj)
  5040. (if (eq CCi (or cond 2))
  5041. (sequence ((WI address))
  5042. (store-quad-semantics GR address GRj)))
  5043. ((fr500 (unit u-gr-store)))
  5044. )
  5045. (define-pmacro (conditional-store-u
  5046. name mode op ope regtype attr profile comment)
  5047. (dni name
  5048. (comment)
  5049. ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3)
  5050. (FR400-MAJOR I-3) (FR450-MAJOR I-3) CONDITIONAL attr)
  5051. (.str name "$pack $" regtype "k,@($GRi,$GRj),$CCi,$cond")
  5052. (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
  5053. (if (eq CCi (or cond 2))
  5054. (sequence ((WI address))
  5055. (set address (add GRi GRj))
  5056. (c-call VOID (.str "@cpu@_write_mem_" mode)
  5057. pc address (.sym regtype k))
  5058. (set GRi address)))
  5059. profile
  5060. )
  5061. )
  5062. (conditional-store-u cstbu QI OP_67 OPE4_0 GR NA
  5063. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  5064. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  5065. "Store unsigned byte, update index")
  5066. (conditional-store-u csthu HI OP_67 OPE4_1 GR NA
  5067. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  5068. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  5069. "Store unsigned half, update index")
  5070. (conditional-store-u cstu SI OP_67 OPE4_2 GR NA
  5071. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  5072. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  5073. "Store word, update index")
  5074. (conditional-store-u cstbfu QI OP_68 OPE4_0 FRint FR-ACCESS
  5075. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  5076. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  5077. "Store byte float, update index")
  5078. (conditional-store-u csthfu HI OP_68 OPE4_1 FRint FR-ACCESS
  5079. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  5080. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  5081. "Store half float, update index")
  5082. (conditional-store-u cstfu SI OP_68 OPE4_2 FRint FR-ACCESS
  5083. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  5084. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  5085. "Store word float, update index")
  5086. (define-pmacro (conditional-store-double-u
  5087. name mode op ope regtype attr profile comment)
  5088. (dni name
  5089. (comment)
  5090. ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3)
  5091. (FR400-MAJOR I-3) (FR450-MAJOR I-3) CONDITIONAL attr)
  5092. (.str name "$pack $" regtype "doublek,@($GRi,$GRj),$CCi,$cond")
  5093. (+ pack (.sym regtype doublek) op GRi CCi cond ope GRj)
  5094. (if (eq CCi (or cond 2))
  5095. (sequence ((WI address))
  5096. (store-double-semantics mode regtype address GRj)
  5097. (set GRi address)))
  5098. profile
  5099. )
  5100. )
  5101. (conditional-store-double-u cstdu DI OP_67 OPE4_3 GR NA
  5102. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  5103. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  5104. "Store double word, update index")
  5105. (conditional-store-double-u cstdfu DF OP_68 OPE4_3 FR FR-ACCESS
  5106. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  5107. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  5108. "Store double float, update index")
  5109. (define-pmacro (store-r-simm name mode op regtype attr profile comment)
  5110. (dni name
  5111. (comment)
  5112. ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3)
  5113. (FR400-MAJOR I-3) (FR450-MAJOR I-3) attr)
  5114. (.str name "$pack $" regtype "k,@($GRi,$d12)")
  5115. (+ pack (.sym regtype k) op GRi d12)
  5116. (c-call VOID (.str "@cpu@_write_mem_" mode)
  5117. pc (add GRi d12) (.sym regtype k))
  5118. profile
  5119. )
  5120. )
  5121. (store-r-simm stbi QI OP_50 GR NA
  5122. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  5123. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  5124. "Store unsigned byte")
  5125. (store-r-simm sthi HI OP_51 GR NA
  5126. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  5127. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  5128. "Store unsigned half")
  5129. (store-r-simm sti SI OP_52 GR NA
  5130. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  5131. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  5132. "Store word")
  5133. (store-r-simm stbfi QI OP_4E FRint FR-ACCESS
  5134. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  5135. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  5136. "Store byte float")
  5137. (store-r-simm sthfi HI OP_4F FRint FR-ACCESS
  5138. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  5139. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  5140. "Store half float")
  5141. (store-r-simm stfi SI OP_55 FRint FR-ACCESS
  5142. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  5143. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  5144. "Store word float")
  5145. (define-pmacro (store-double-r-simm name mode op regtype attr profile comment)
  5146. (dni name
  5147. (comment)
  5148. ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3)
  5149. (FR400-MAJOR I-3) (FR450-MAJOR I-3) attr)
  5150. (.str name "$pack $" regtype "doublek,@($GRi,$d12)")
  5151. (+ pack (.sym regtype doublek) op GRi d12)
  5152. (sequence ((WI address))
  5153. (store-double-semantics mode regtype address d12))
  5154. profile
  5155. )
  5156. )
  5157. (store-double-r-simm stdi DI OP_53 GR NA
  5158. ((fr400 (unit u-gr-store)) (fr450 (unit u-gr-store))
  5159. (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
  5160. "Store double word")
  5161. (store-double-r-simm stdfi DF OP_56 FR FR-ACCESS
  5162. ((fr400 (unit u-fr-store)) (fr450 (unit u-fr-store))
  5163. (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
  5164. "Store double float")
  5165. (define-pmacro (store-quad-r-simm name op regtype attr profile comment)
  5166. (dni name
  5167. (comment)
  5168. ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
  5169. (.str name "$pack $" regtype "k,@($GRi,$d12)")
  5170. (+ pack (.sym regtype k) op GRi d12)
  5171. (sequence ((WI address))
  5172. (store-quad-semantics regtype address d12))
  5173. profile
  5174. )
  5175. )
  5176. (store-quad-r-simm stqi OP_54 GR NA ((fr500 (unit u-gr-store)))
  5177. "Store quad word")
  5178. (store-quad-r-simm stqfi OP_57 FRint FR-ACCESS ()
  5179. "Store quad float")
  5180. (define-pmacro (swap-semantics base offset arg)
  5181. (sequence ((WI tmp) (WI address))
  5182. (set tmp arg)
  5183. (set address (add base offset))
  5184. (c-call VOID "@cpu@_check_swap_address" address)
  5185. (set arg (c-call WI "@cpu@_read_mem_WI" pc address))
  5186. (c-call VOID "@cpu@_write_mem_WI" pc address tmp))
  5187. )
  5188. (dni swap
  5189. "Swap contents of memory with GR"
  5190. ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2)
  5191. (FR400-MAJOR C-2) (FR450-MAJOR C-2))
  5192. "swap$pack @($GRi,$GRj),$GRk"
  5193. (+ pack GRk OP_03 GRi OPE1_05 GRj)
  5194. (swap-semantics GRi GRj GRk)
  5195. ((fr400 (unit u-swap)) (fr450 (unit u-swap))
  5196. (fr500 (unit u-swap)) (fr550 (unit u-swap)))
  5197. )
  5198. (dni "swapi"
  5199. "Swap contents of memory with GR"
  5200. ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2)
  5201. (FR400-MAJOR C-2) (FR450-MAJOR C-2))
  5202. ("swapi$pack @($GRi,$d12),$GRk")
  5203. (+ pack GRk OP_4D GRi d12)
  5204. (swap-semantics GRi d12 GRk)
  5205. ((fr400 (unit u-swap)) (fr450 (unit u-swap))
  5206. (fr500 (unit u-swap)) (fr550 (unit u-swap)))
  5207. )
  5208. (dni cswap
  5209. "Conditionally swap contents of memory with GR"
  5210. ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2)
  5211. (FR400-MAJOR C-2) (FR450-MAJOR C-2) CONDITIONAL)
  5212. "cswap$pack @($GRi,$GRj),$GRk,$CCi,$cond"
  5213. (+ pack GRk OP_65 GRi CCi cond OPE4_2 GRj)
  5214. (if (eq CCi (or cond 2))
  5215. (swap-semantics GRi GRj GRk))
  5216. ((fr400 (unit u-swap)) (fr450 (unit u-swap))
  5217. (fr500 (unit u-swap)) (fr550 (unit u-swap)))
  5218. )
  5219. (define-pmacro (register-transfer
  5220. name op ope reg_src reg_targ pipe attrs profile comment)
  5221. (dni name
  5222. (comment)
  5223. (.splice (UNIT pipe) (.unsplice attrs))
  5224. (.str name "$pack $" reg_src ",$" reg_targ)
  5225. (+ pack reg_targ op (rs-null) ope reg_src)
  5226. (set reg_targ reg_src)
  5227. profile
  5228. )
  5229. )
  5230. (register-transfer movgf OP_03 OPE1_15
  5231. GRj FRintk I0
  5232. ((FR500-MAJOR I-4) (FR550-MAJOR I-5)
  5233. (FR400-MAJOR I-4) (FR450-MAJOR I-4) FR-ACCESS)
  5234. ((fr400 (unit u-gr2fr)) (fr450 (unit u-gr2fr))
  5235. (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
  5236. "transfer gr to fr")
  5237. (register-transfer movfg OP_03 OPE1_0D
  5238. FRintk GRj I0
  5239. ((FR500-MAJOR I-4) (FR550-MAJOR I-5)
  5240. (FR400-MAJOR I-4) (FR450-MAJOR I-4) FR-ACCESS)
  5241. ((fr400 (unit u-fr2gr)) (fr450 (unit u-fr2gr))
  5242. (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
  5243. "transfer fr to gr")
  5244. (define-pmacro (nextreg hw r offset) (reg hw (add (index-of r) offset)))
  5245. (define-pmacro (register-transfer-double-from-gr-semantics cond)
  5246. (if cond
  5247. (if (eq (index-of GRj) 0)
  5248. (sequence ()
  5249. (set FRintk 0)
  5250. (set (nextreg h-fr_int FRintk 1) 0))
  5251. (sequence ()
  5252. (set FRintk GRj)
  5253. (set (nextreg h-fr_int FRintk 1) (nextreg h-gr GRj 1)))))
  5254. )
  5255. (dni movgfd
  5256. "move GR for FR double"
  5257. ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5)
  5258. (FR400-MAJOR I-4) (FR450-MAJOR I-4) FR-ACCESS)
  5259. "movgfd$pack $GRj,$FRintk"
  5260. (+ pack FRintk OP_03 (rs-null) OPE1_16 GRj)
  5261. (register-transfer-double-from-gr-semantics 1)
  5262. ; TODO -- doesn't handle second register in the pair
  5263. ((fr400 (unit u-gr2fr)) (fr450 (unit u-gr2fr))
  5264. (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
  5265. )
  5266. (define-pmacro (register-transfer-double-to-gr-semantics cond)
  5267. (if (andif (ne (index-of GRj) 0) cond)
  5268. (sequence ()
  5269. (set GRj FRintk)
  5270. (set (nextreg h-gr GRj 1) (nextreg h-fr_int FRintk 1))))
  5271. )
  5272. (dni movfgd
  5273. "move FR for GR double"
  5274. ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5)
  5275. (FR400-MAJOR I-4) (FR450-MAJOR I-4) FR-ACCESS)
  5276. "movfgd$pack $FRintk,$GRj"
  5277. (+ pack FRintk OP_03 (rs-null) OPE1_0E GRj)
  5278. (register-transfer-double-to-gr-semantics 1)
  5279. ; TODO -- doesn't handle second register in the pair
  5280. ((fr400 (unit u-fr2gr)) (fr450 (unit u-fr2gr))
  5281. (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
  5282. )
  5283. (dni movgfq
  5284. "move GR for FR quad"
  5285. ((UNIT I0) (FR500-MAJOR I-4) (MACH frv) FR-ACCESS)
  5286. "movgfq$pack $GRj,$FRintk"
  5287. (+ pack FRintk OP_03 (rs-null) OPE1_17 GRj)
  5288. (if (eq (index-of GRj) 0)
  5289. (sequence ()
  5290. (set FRintk 0)
  5291. (set (reg h-fr_int (add (index-of FRintk) 1)) 0)
  5292. (set (reg h-fr_int (add (index-of FRintk) 2)) 0)
  5293. (set (reg h-fr_int (add (index-of FRintk) 3)) 0))
  5294. (sequence ()
  5295. (set FRintk GRj)
  5296. (set (reg h-fr_int (add (index-of FRintk) 1))
  5297. (reg h-gr (add (index-of GRj) 1)))
  5298. (set (reg h-fr_int (add (index-of FRintk) 2))
  5299. (reg h-gr (add (index-of GRj) 2)))
  5300. (set (reg h-fr_int (add (index-of FRintk) 3))
  5301. (reg h-gr (add (index-of GRj) 3)))))
  5302. ()
  5303. )
  5304. (dni movfgq
  5305. "move FR for GR quad"
  5306. ((UNIT I0) (FR500-MAJOR I-4) (MACH frv) FR-ACCESS)
  5307. "movfgq$pack $FRintk,$GRj"
  5308. (+ pack FRintk OP_03 (rs-null) OPE1_0F GRj)
  5309. (if (ne (index-of GRj) 0)
  5310. (sequence ()
  5311. (set GRj FRintk)
  5312. (set (reg h-gr (add (index-of GRj) 1))
  5313. (reg h-fr_int (add (index-of FRintk) 1)))
  5314. (set (reg h-gr (add (index-of GRj) 2))
  5315. (reg h-fr_int (add (index-of FRintk) 2)))
  5316. (set (reg h-gr (add (index-of GRj) 3))
  5317. (reg h-fr_int (add (index-of FRintk) 3)))))
  5318. ()
  5319. )
  5320. (define-pmacro (conditional-register-transfer
  5321. name op ope reg_src reg_targ pipe attrs profile comment)
  5322. (dni name
  5323. (comment)
  5324. (.splice (UNIT pipe) CONDITIONAL FR-ACCESS (.unsplice attrs))
  5325. (.str name "$pack $" reg_src ",$" reg_targ ",$CCi,$cond")
  5326. (+ pack reg_targ op (rs-null) CCi cond ope reg_src)
  5327. (if (eq CCi (or cond 2))
  5328. (set reg_targ reg_src))
  5329. profile
  5330. )
  5331. )
  5332. (conditional-register-transfer cmovgf OP_69 OPE4_0 GRj FRintk I0
  5333. ((FR500-MAJOR I-4) (FR550-MAJOR I-5)
  5334. (FR400-MAJOR I-4) (FR450-MAJOR I-4))
  5335. ((fr400 (unit u-gr2fr)) (fr450 (unit u-gr2fr))
  5336. (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
  5337. "transfer gr to fr")
  5338. (conditional-register-transfer cmovfg OP_69 OPE4_2 FRintk GRj I0
  5339. ((FR500-MAJOR I-4) (FR550-MAJOR I-5)
  5340. (FR400-MAJOR I-4) (FR450-MAJOR I-4))
  5341. ((fr400 (unit u-fr2gr)) (fr450 (unit u-fr2gr))
  5342. (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
  5343. "transfer fr to gr")
  5344. (dni cmovgfd
  5345. "Conditional move GR to FR double"
  5346. ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5)
  5347. (FR400-MAJOR I-4) (FR450-MAJOR I-4) CONDITIONAL FR-ACCESS)
  5348. "cmovgfd$pack $GRj,$FRintk,$CCi,$cond"
  5349. (+ pack FRintk OP_69 (rs-null) CCi cond OPE4_1 GRj)
  5350. (register-transfer-double-from-gr-semantics (eq CCi (or cond 2)))
  5351. ; TODO -- doesn't handle extra registers in double
  5352. ((fr400 (unit u-gr2fr)) (fr450 (unit u-gr2fr))
  5353. (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
  5354. )
  5355. (dni cmovfgd
  5356. "Conditional move FR to GR double"
  5357. ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5)
  5358. (FR400-MAJOR I-4) (FR450-MAJOR I-4) CONDITIONAL FR-ACCESS)
  5359. "cmovfgd$pack $FRintk,$GRj,$CCi,$cond"
  5360. (+ pack FRintk OP_69 (rs-null) CCi cond OPE4_3 GRj)
  5361. (register-transfer-double-to-gr-semantics (eq CCi (or cond 2)))
  5362. ; TODO -- doesn't handle second register in the pair
  5363. ((fr400 (unit u-fr2gr)) (fr450 (unit u-fr2gr))
  5364. (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
  5365. )
  5366. (define-pmacro (register-transfer-spr
  5367. name op ope reg_src reg_targ unitname comment)
  5368. (dni name
  5369. (comment)
  5370. ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2)
  5371. (FR400-MAJOR C-2) (FR450-MAJOR C-2))
  5372. (.str name "$pack $" reg_src ",$" reg_targ)
  5373. (+ pack reg_targ op ope reg_src)
  5374. (set reg_targ reg_src)
  5375. ((fr400 (unit unitname)) (fr450 (unit unitname))
  5376. (fr500 (unit unitname)) (fr550 (unit unitname)))
  5377. )
  5378. )
  5379. (register-transfer-spr movgs OP_03 OPE1_06 GRj spr u-gr2spr "transfer gr->spr")
  5380. (register-transfer-spr movsg OP_03 OPE1_07 spr GRj u-spr2gr "transfer spr->gr")
  5381. ; Integer Branch Conditions
  5382. (define-pmacro (Inev cc) (const BI 0))
  5383. (define-pmacro (Ira cc) (const BI 1))
  5384. (define-pmacro (Ieq cc) ( zbit cc))
  5385. (define-pmacro (Ine cc) (not (zbit cc)))
  5386. (define-pmacro (Ile cc) ( orif (zbit cc) (xor (nbit cc) (vbit cc))))
  5387. (define-pmacro (Igt cc) (not (orif (zbit cc) (xor (nbit cc) (vbit cc)))))
  5388. (define-pmacro (Ilt cc) ( xor (nbit cc) (vbit cc)))
  5389. (define-pmacro (Ige cc) (not (xor (nbit cc) (vbit cc))))
  5390. (define-pmacro (Ils cc) ( orif (cbit cc) (zbit cc)))
  5391. (define-pmacro (Ihi cc) (not (orif (cbit cc) (zbit cc))))
  5392. (define-pmacro (Ic cc) ( cbit cc))
  5393. (define-pmacro (Inc cc) (not (cbit cc)))
  5394. (define-pmacro (In cc) ( nbit cc))
  5395. (define-pmacro (Ip cc) (not (nbit cc)))
  5396. (define-pmacro (Iv cc) ( vbit cc))
  5397. (define-pmacro (Inv cc) (not (vbit cc)))
  5398. ; Float Branch Conditions
  5399. (define-pmacro (Fnev cc) (const BI 0))
  5400. (define-pmacro (Fra cc) (const BI 1))
  5401. (define-pmacro (Fne cc) (orif (lbit cc) (orif (gbit cc) (ubit cc))))
  5402. (define-pmacro (Feq cc) (ebit cc))
  5403. (define-pmacro (Flg cc) (orif (lbit cc) (gbit cc)))
  5404. (define-pmacro (Fue cc) (orif (ebit cc) (ubit cc)))
  5405. (define-pmacro (Ful cc) (orif (lbit cc) (ubit cc)))
  5406. (define-pmacro (Fge cc) (orif (ebit cc) (gbit cc)))
  5407. (define-pmacro (Flt cc) (lbit cc))
  5408. (define-pmacro (Fuge cc) (orif (ebit cc) (orif (gbit cc) (ubit cc))))
  5409. (define-pmacro (Fug cc) (orif (gbit cc) (ubit cc)))
  5410. (define-pmacro (Fle cc) (orif (ebit cc) (lbit cc)))
  5411. (define-pmacro (Fgt cc) (gbit cc))
  5412. (define-pmacro (Fule cc) (orif (ebit cc) (orif (lbit cc) (ubit cc))))
  5413. (define-pmacro (Fu cc) (ubit cc))
  5414. (define-pmacro (Fo cc) (orif (ebit cc) (orif (lbit cc) (gbit cc))))
  5415. (define-pmacro (conditional-branch-i prefix cc op cond comment)
  5416. (dni (.sym prefix cc)
  5417. (comment)
  5418. ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1)
  5419. (FR400-MAJOR B-1) (FR450-MAJOR B-1))
  5420. (.str (.sym prefix cc) "$pack $ICCi_2,$hint,$label16")
  5421. (+ pack (.sym ICC_ cc) ICCi_2 op hint label16)
  5422. (sequence ()
  5423. (c-call VOID "@cpu@_model_branch" label16 hint)
  5424. (if (cond ICCi_2)
  5425. (set pc label16)))
  5426. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5427. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5428. )
  5429. )
  5430. (dni bra
  5431. "integer branch equal"
  5432. ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1)
  5433. (FR400-MAJOR B-1) (FR450-MAJOR B-1))
  5434. "bra$pack $hint_taken$label16"
  5435. (+ pack ICC_ra (ICCi_2-null) OP_06 hint_taken label16)
  5436. (sequence ()
  5437. (c-call VOID "@cpu@_model_branch" label16 hint_taken)
  5438. (set pc label16))
  5439. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5440. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5441. )
  5442. (dni bno
  5443. "integer branch never"
  5444. ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1)
  5445. (FR400-MAJOR B-1) (FR450-MAJOR B-1))
  5446. "bno$pack$hint_not_taken"
  5447. (+ pack ICC_nev (ICCi_2-null) OP_06 hint_not_taken (label16-null))
  5448. (c-call VOID "@cpu@_model_branch" label16 hint_not_taken)
  5449. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5450. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5451. )
  5452. (conditional-branch-i b eq OP_06 Ieq "integer branch equal")
  5453. (conditional-branch-i b ne OP_06 Ine "integer branch not equal")
  5454. (conditional-branch-i b le OP_06 Ile "integer branch less or equal")
  5455. (conditional-branch-i b gt OP_06 Igt "integer branch greater")
  5456. (conditional-branch-i b lt OP_06 Ilt "integer branch less")
  5457. (conditional-branch-i b ge OP_06 Ige "integer branch greater or equal")
  5458. (conditional-branch-i b ls OP_06 Ils "integer branch less or equal unsigned")
  5459. (conditional-branch-i b hi OP_06 Ihi "integer branch greater unsigned")
  5460. (conditional-branch-i b c OP_06 Ic "integer branch carry set")
  5461. (conditional-branch-i b nc OP_06 Inc "integer branch carry clear")
  5462. (conditional-branch-i b n OP_06 In "integer branch negative")
  5463. (conditional-branch-i b p OP_06 Ip "integer branch positive")
  5464. (conditional-branch-i b v OP_06 Iv "integer branch overflow set")
  5465. (conditional-branch-i b nv OP_06 Inv "integer branch overflow clear")
  5466. (define-pmacro (conditional-branch-f prefix cc op cond comment)
  5467. (dni (.sym prefix cc)
  5468. (comment)
  5469. ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1)
  5470. (FR400-MAJOR B-1) (FR450-MAJOR B-1) FR-ACCESS)
  5471. (.str (.sym prefix cc) "$pack $FCCi_2,$hint,$label16")
  5472. (+ pack (.sym FCC_ cc) FCCi_2 op hint label16)
  5473. (sequence ()
  5474. (c-call VOID "@cpu@_model_branch" label16 hint)
  5475. (if (cond FCCi_2) (set pc label16)))
  5476. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5477. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5478. )
  5479. )
  5480. (dni fbra
  5481. "float branch equal"
  5482. ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1)
  5483. (FR400-MAJOR B-1) (FR450-MAJOR B-1) FR-ACCESS)
  5484. "fbra$pack $hint_taken$label16"
  5485. (+ pack FCC_ra (FCCi_2-null) OP_07 hint_taken label16)
  5486. (sequence ()
  5487. (c-call VOID "@cpu@_model_branch" label16 hint_taken)
  5488. (set pc label16))
  5489. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5490. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5491. )
  5492. (dni fbno
  5493. "float branch never"
  5494. ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1)
  5495. (FR400-MAJOR B-1) (FR450-MAJOR B-1) FR-ACCESS)
  5496. "fbno$pack$hint_not_taken"
  5497. (+ pack FCC_nev (FCCi_2-null) OP_07 hint_not_taken (label16-null))
  5498. (c-call VOID "@cpu@_model_branch" label16 hint_not_taken)
  5499. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5500. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5501. )
  5502. (conditional-branch-f fb ne OP_07 Fne "float branch not equal")
  5503. (conditional-branch-f fb eq OP_07 Feq "float branch equal")
  5504. (conditional-branch-f fb lg OP_07 Flg "float branch less or greater")
  5505. (conditional-branch-f fb ue OP_07 Fue "float branch unordered or equal")
  5506. (conditional-branch-f fb ul OP_07 Ful "float branch unordered or less")
  5507. (conditional-branch-f fb ge OP_07 Fge "float branch greater or equal")
  5508. (conditional-branch-f fb lt OP_07 Flt "float branch less")
  5509. (conditional-branch-f fb uge OP_07 Fuge "float branch unordered, greater,equal")
  5510. (conditional-branch-f fb ug OP_07 Fug "float branch unordered or greater")
  5511. (conditional-branch-f fb le OP_07 Fle "float branch less or equal")
  5512. (conditional-branch-f fb gt OP_07 Fgt "float branch greater")
  5513. (conditional-branch-f fb ule OP_07 Fule "float branch unordered, less or equal")
  5514. (conditional-branch-f fb u OP_07 Fu "float branch unordered")
  5515. (conditional-branch-f fb o OP_07 Fo "float branch ordered")
  5516. (define-pmacro (ctrlr-branch-semantics cond ccond)
  5517. (sequence ((SI tmp))
  5518. (set tmp (sub (spr-lcr) 1))
  5519. (set (spr-lcr) tmp)
  5520. (if cond
  5521. (if (eq ccond 0)
  5522. (if (ne tmp 0)
  5523. (set pc (spr-lr)))
  5524. (if (eq tmp 0)
  5525. (set pc (spr-lr))))))
  5526. )
  5527. (dni bctrlr
  5528. "LCR conditional branch to lr"
  5529. ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2)
  5530. (FR400-MAJOR B-2) (FR450-MAJOR B-2))
  5531. ("bctrlr$pack $ccond,$hint")
  5532. (+ pack (cond-null) (ICCi_2-null) OP_0E hint OPE3_01 ccond (s12-null))
  5533. (sequence ()
  5534. (c-call VOID "@cpu@_model_branch" (spr-lr) hint)
  5535. (ctrlr-branch-semantics (const BI 1) ccond))
  5536. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5537. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5538. )
  5539. (define-pmacro (conditional-branch-cclr prefix cc i-f op ope cond attr comment)
  5540. (dni (.sym prefix cc lr)
  5541. (comment)
  5542. ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3)
  5543. (FR400-MAJOR B-3) (FR450-MAJOR B-3) attr)
  5544. (.str (.sym prefix cc lr) "$pack $" i-f "CCi_2,$hint")
  5545. (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op hint ope
  5546. (ccond-null) (s12-null))
  5547. (sequence ()
  5548. (c-call VOID "@cpu@_model_branch" (spr-lr) hint)
  5549. (if (cond (.sym i-f CCi_2)) (set pc (spr-lr))))
  5550. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5551. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5552. )
  5553. )
  5554. (dni bralr
  5555. "integer cclr branch always"
  5556. ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3)
  5557. (FR400-MAJOR B-3) (FR450-MAJOR B-3))
  5558. "bralr$pack$hint_taken"
  5559. (+ pack ICC_ra (ICCi_2-null) OP_0E hint_taken OPE3_02 (ccond-null) (s12-null))
  5560. (sequence ()
  5561. (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
  5562. (set pc (spr-lr)))
  5563. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5564. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5565. )
  5566. (dni bnolr
  5567. "integer cclr branch never"
  5568. ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3)
  5569. (FR400-MAJOR B-3) (FR450-MAJOR B-3))
  5570. "bnolr$pack$hint_not_taken"
  5571. (+ pack ICC_nev (ICCi_2-null) OP_0E hint_not_taken OPE3_02 (ccond-null) (s12-null))
  5572. (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
  5573. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5574. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5575. )
  5576. (conditional-branch-cclr b eq I OP_0E OPE3_02 Ieq NA "integer cclr branch equal")
  5577. (conditional-branch-cclr b ne I OP_0E OPE3_02 Ine NA "integer cclr branch not equal")
  5578. (conditional-branch-cclr b le I OP_0E OPE3_02 Ile NA "integer cclr branch less or equal")
  5579. (conditional-branch-cclr b gt I OP_0E OPE3_02 Igt NA "integer cclr branch greater")
  5580. (conditional-branch-cclr b lt I OP_0E OPE3_02 Ilt NA "integer cclr branch less")
  5581. (conditional-branch-cclr b ge I OP_0E OPE3_02 Ige NA "integer cclr branch greater or equal")
  5582. (conditional-branch-cclr b ls I OP_0E OPE3_02 Ils NA "integer cclr branch less or equal unsigned")
  5583. (conditional-branch-cclr b hi I OP_0E OPE3_02 Ihi NA "integer cclr branch greater unsigned")
  5584. (conditional-branch-cclr b c I OP_0E OPE3_02 Ic NA "integer cclr branch carry set")
  5585. (conditional-branch-cclr b nc I OP_0E OPE3_02 Inc NA "integer cclr branch carry clear")
  5586. (conditional-branch-cclr b n I OP_0E OPE3_02 In NA "integer cclr branch negative")
  5587. (conditional-branch-cclr b p I OP_0E OPE3_02 Ip NA "integer cclr branch positive")
  5588. (conditional-branch-cclr b v I OP_0E OPE3_02 Iv NA "integer cclr branch overflow set")
  5589. (conditional-branch-cclr b nv I OP_0E OPE3_02 Inv NA "integer cclr branch overflow clear")
  5590. (dni fbralr
  5591. "float cclr branch always"
  5592. ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3)
  5593. (FR400-MAJOR B-3) (FR450-MAJOR B-3) FR-ACCESS)
  5594. "fbralr$pack$hint_taken"
  5595. (+ pack FCC_ra (FCCi_2-null) OP_0E hint_taken OPE3_06 (ccond-null) (s12-null))
  5596. (sequence ()
  5597. (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
  5598. (set pc (spr-lr)))
  5599. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5600. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5601. )
  5602. (dni fbnolr
  5603. "float cclr branch never"
  5604. ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3)
  5605. (FR400-MAJOR B-3) (FR450-MAJOR B-3) FR-ACCESS)
  5606. "fbnolr$pack$hint_not_taken"
  5607. (+ pack FCC_nev (FCCi_2-null) OP_0E hint_not_taken OPE3_06 (ccond-null) (s12-null))
  5608. (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
  5609. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5610. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5611. )
  5612. (conditional-branch-cclr fb eq F OP_0E OPE3_06 Feq FR-ACCESS "float cclr branch equal")
  5613. (conditional-branch-cclr fb ne F OP_0E OPE3_06 Fne FR-ACCESS "float cclr branch not equal")
  5614. (conditional-branch-cclr fb lg F OP_0E OPE3_06 Flg FR-ACCESS "float branch less or greater")
  5615. (conditional-branch-cclr fb ue F OP_0E OPE3_06 Fue FR-ACCESS "float branch unordered or equal")
  5616. (conditional-branch-cclr fb ul F OP_0E OPE3_06 Ful FR-ACCESS "float branch unordered or less")
  5617. (conditional-branch-cclr fb ge F OP_0E OPE3_06 Fge FR-ACCESS "float branch greater or equal")
  5618. (conditional-branch-cclr fb lt F OP_0E OPE3_06 Flt FR-ACCESS "float branch less")
  5619. (conditional-branch-cclr fb uge F OP_0E OPE3_06 Fuge FR-ACCESS "float branch unordered, greater, equal")
  5620. (conditional-branch-cclr fb ug F OP_0E OPE3_06 Fug FR-ACCESS "float branch unordered or greater")
  5621. (conditional-branch-cclr fb le F OP_0E OPE3_06 Fle FR-ACCESS "float branch less or equal")
  5622. (conditional-branch-cclr fb gt F OP_0E OPE3_06 Fgt FR-ACCESS "float branch greater")
  5623. (conditional-branch-cclr fb ule F OP_0E OPE3_06 Fule FR-ACCESS "float branch unordered, less or equal")
  5624. (conditional-branch-cclr fb u F OP_0E OPE3_06 Fu FR-ACCESS "float branch unordered")
  5625. (conditional-branch-cclr fb o F OP_0E OPE3_06 Fo FR-ACCESS "float branch ordered")
  5626. (define-pmacro (conditional-branch-ctrlr prefix cc i-f op ope cond attr comment)
  5627. (dni (.sym prefix cc lr)
  5628. (comment)
  5629. ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2)
  5630. (FR400-MAJOR B-2) (FR450-MAJOR B-2) attr)
  5631. (.str (.sym prefix cc lr) "$pack $" i-f "CCi_2,$ccond,$hint")
  5632. (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op hint ope ccond (s12-null))
  5633. (sequence ()
  5634. (c-call VOID "@cpu@_model_branch" (spr-lr) hint)
  5635. (ctrlr-branch-semantics (cond (.sym i-f CCi_2)) ccond))
  5636. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5637. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5638. )
  5639. )
  5640. (dni bcralr
  5641. "integer ctrlr branch always"
  5642. ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2)
  5643. (FR400-MAJOR B-2) (FR450-MAJOR B-2))
  5644. "bcralr$pack $ccond$hint_taken"
  5645. (+ pack ICC_ra (ICCi_2-null) OP_0E hint_taken OPE3_03 ccond (s12-null))
  5646. (sequence ()
  5647. (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
  5648. (ctrlr-branch-semantics (const BI 1) ccond))
  5649. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5650. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5651. )
  5652. (dni bcnolr
  5653. "integer ctrlr branch never"
  5654. ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2)
  5655. (FR400-MAJOR B-2) (FR450-MAJOR B-2))
  5656. "bcnolr$pack$hint_not_taken"
  5657. (+ pack ICC_nev (ICCi_2-null) OP_0E hint_not_taken OPE3_03 (ccond-null) (s12-null))
  5658. (sequence ()
  5659. (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
  5660. (ctrlr-branch-semantics (const BI 0) ccond))
  5661. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5662. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5663. )
  5664. (conditional-branch-ctrlr bc eq I OP_0E OPE3_03 Ieq NA "integer ctrlr branch equal")
  5665. (conditional-branch-ctrlr bc ne I OP_0E OPE3_03 Ine NA "integer ctrlr branch not equal")
  5666. (conditional-branch-ctrlr bc le I OP_0E OPE3_03 Ile NA "integer ctrlr branch less equal")
  5667. (conditional-branch-ctrlr bc gt I OP_0E OPE3_03 Igt NA "integer ctrlr branch greater")
  5668. (conditional-branch-ctrlr bc lt I OP_0E OPE3_03 Ilt NA "integer ctrlr branch less")
  5669. (conditional-branch-ctrlr bc ge I OP_0E OPE3_03 Ige NA "integer ctrlr branch greater equal")
  5670. (conditional-branch-ctrlr bc ls I OP_0E OPE3_03 Ils NA "integer ctrlr branch less equal unsigned")
  5671. (conditional-branch-ctrlr bc hi I OP_0E OPE3_03 Ihi NA "integer ctrlr branch greater unsigned")
  5672. (conditional-branch-ctrlr bc c I OP_0E OPE3_03 Ic NA "integer ctrlr branch carry set")
  5673. (conditional-branch-ctrlr bc nc I OP_0E OPE3_03 Inc NA "integer ctrlr branch carry clear")
  5674. (conditional-branch-ctrlr bc n I OP_0E OPE3_03 In NA "integer ctrlr branch negative")
  5675. (conditional-branch-ctrlr bc p I OP_0E OPE3_03 Ip NA "integer ctrlr branch positive")
  5676. (conditional-branch-ctrlr bc v I OP_0E OPE3_03 Iv NA "integer ctrlr branch overflow set")
  5677. (conditional-branch-ctrlr bc nv I OP_0E OPE3_03 Inv NA "integer ctrlr branch overflow clear")
  5678. (dni fcbralr
  5679. "float ctrlr branch always"
  5680. ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2)
  5681. (FR400-MAJOR B-2) (FR450-MAJOR B-2) FR-ACCESS)
  5682. "fcbralr$pack $ccond$hint_taken"
  5683. (+ pack FCC_ra (FCCi_2-null) OP_0E hint_taken OPE3_07 ccond (s12-null))
  5684. (sequence ()
  5685. (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
  5686. (ctrlr-branch-semantics (const BI 1) ccond))
  5687. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5688. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5689. )
  5690. (dni fcbnolr
  5691. "float ctrlr branch never"
  5692. ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2)
  5693. (FR400-MAJOR B-2) (FR450-MAJOR B-2) FR-ACCESS)
  5694. "fcbnolr$pack$hint_not_taken"
  5695. (+ pack FCC_nev (FCCi_2-null) OP_0E hint_not_taken OPE3_07 (ccond-null) (s12-null))
  5696. (sequence ()
  5697. (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
  5698. (ctrlr-branch-semantics (const BI 0) ccond))
  5699. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5700. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5701. )
  5702. (conditional-branch-ctrlr fcb eq F OP_0E OPE3_07 Feq FR-ACCESS "float cclr branch equal")
  5703. (conditional-branch-ctrlr fcb ne F OP_0E OPE3_07 Fne FR-ACCESS "float cclr branch not equal")
  5704. (conditional-branch-ctrlr fcb lg F OP_0E OPE3_07 Flg FR-ACCESS "float branch less or greater")
  5705. (conditional-branch-ctrlr fcb ue F OP_0E OPE3_07 Fue FR-ACCESS "float branch unordered or equal")
  5706. (conditional-branch-ctrlr fcb ul F OP_0E OPE3_07 Ful FR-ACCESS "float branch unordered or less")
  5707. (conditional-branch-ctrlr fcb ge F OP_0E OPE3_07 Fge FR-ACCESS "float branch greater or equal")
  5708. (conditional-branch-ctrlr fcb lt F OP_0E OPE3_07 Flt FR-ACCESS "float branch less")
  5709. (conditional-branch-ctrlr fcb uge F OP_0E OPE3_07 Fuge FR-ACCESS "float branch unordered, greater, equal")
  5710. (conditional-branch-ctrlr fcb ug F OP_0E OPE3_07 Fug FR-ACCESS "float branch unordered or greater")
  5711. (conditional-branch-ctrlr fcb le F OP_0E OPE3_07 Fle FR-ACCESS "float branch less or equal")
  5712. (conditional-branch-ctrlr fcb gt F OP_0E OPE3_07 Fgt FR-ACCESS "float branch greater")
  5713. (conditional-branch-ctrlr fcb ule F OP_0E OPE3_07 Fule FR-ACCESS "float branch unordered, less or equal")
  5714. (conditional-branch-ctrlr fcb u F OP_0E OPE3_07 Fu FR-ACCESS "float branch unordered")
  5715. (conditional-branch-ctrlr fcb o F OP_0E OPE3_07 Fo FR-ACCESS "float branch ordered")
  5716. (define-pmacro (jump-and-link-semantics base offset LI)
  5717. (sequence ()
  5718. (if (eq LI 1)
  5719. (c-call VOID "@cpu@_set_write_next_vliw_addr_to_LR" 1))
  5720. ; Target address gets aligned here
  5721. (set pc (and (add base offset) #xfffffffc))
  5722. (c-call VOID "@cpu@_model_branch" pc #x2)) ; hint branch taken
  5723. )
  5724. (dni jmpl
  5725. "jump and link"
  5726. ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6)
  5727. (FR400-MAJOR I-5) (FR450-MAJOR I-5))
  5728. "jmpl$pack @($GRi,$GRj)"
  5729. (+ pack (misc-null-1) (LI-off) OP_0C GRi (misc-null-2) GRj)
  5730. (jump-and-link-semantics GRi GRj LI)
  5731. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5732. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5733. )
  5734. (dann callann "call annotation" SI "call_annotation" "at")
  5735. (dni calll
  5736. "call and link"
  5737. ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6)
  5738. (FR400-MAJOR I-5) (FR450-MAJOR I-5))
  5739. "calll$pack $callann($GRi,$GRj)"
  5740. (+ pack (misc-null-1) (LI-on) OP_0C GRi (misc-null-2) GRj)
  5741. (jump-and-link-semantics GRi GRj LI)
  5742. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5743. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5744. )
  5745. (dni jmpil
  5746. "jump immediate and link"
  5747. ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6)
  5748. (FR400-MAJOR I-5) (FR450-MAJOR I-5))
  5749. "jmpil$pack @($GRi,$s12)"
  5750. (+ pack (misc-null-1) (LI-off) OP_0D GRi s12)
  5751. (jump-and-link-semantics GRi s12 LI)
  5752. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5753. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5754. )
  5755. (dni callil
  5756. "call immediate and link"
  5757. ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6)
  5758. (FR400-MAJOR I-5) (FR450-MAJOR I-5))
  5759. "callil$pack @($GRi,$s12)"
  5760. (+ pack (misc-null-1) (LI-on) OP_0D GRi s12)
  5761. (jump-and-link-semantics GRi s12 LI)
  5762. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5763. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5764. )
  5765. (dni call
  5766. "call and link"
  5767. ((UNIT B0) (FR500-MAJOR B-4) (FR550-MAJOR B-4)
  5768. (FR400-MAJOR B-4) (FR450-MAJOR B-4))
  5769. "call$pack $label24"
  5770. (+ pack OP_0F label24)
  5771. (sequence ()
  5772. (c-call VOID "@cpu@_set_write_next_vliw_addr_to_LR" 1)
  5773. (set pc label24)
  5774. (c-call VOID "@cpu@_model_branch" pc #x2)) ; hint branch taken
  5775. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  5776. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  5777. )
  5778. (dni rett
  5779. "return from trap"
  5780. ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2)
  5781. (FR400-MAJOR C-2) (FR450-MAJOR C-2) PRIVILEGED)
  5782. "rett$pack $debug"
  5783. (+ pack (misc-null-1) debug OP_05 (rs-null) (s12-null))
  5784. ; frv_rett handles operating vs user mode
  5785. (sequence ()
  5786. (set pc (c-call UWI "frv_rett" pc debug))
  5787. (c-call VOID "@cpu@_model_branch" pc #x2)) ; hint branch taken
  5788. ()
  5789. )
  5790. (dni rei
  5791. "run exception instruction"
  5792. ((UNIT C) (FR500-MAJOR C-1) (MACH frv) PRIVILEGED)
  5793. "rei$pack $eir"
  5794. (+ pack (rd-null) OP_37 eir (s12-null))
  5795. (nop) ; for now
  5796. ()
  5797. )
  5798. (define-pmacro (trap-semantics cond base offset)
  5799. (if cond
  5800. (sequence ()
  5801. ; This is defered to frv_itrap because for the breakpoint
  5802. ; case we want to change as little of the machine state as
  5803. ; possible.
  5804. ;
  5805. ; PCSR=PC
  5806. ; PSR.PS=PSR.S
  5807. ; PSR.ET=0
  5808. ; if PSR.ESR==1
  5809. ; SR0 through SR3=GR4 through GR7
  5810. ; TBR.TT=0x80 + ((GRi + s12) & 0x7f)
  5811. ; PC=TBR
  5812. ; We still should indicate what is modified by this insn.
  5813. (clobber (spr-pcsr))
  5814. (clobber psr_ps)
  5815. (clobber psr_et)
  5816. (clobber tbr_tt)
  5817. (if (ne psr_esr (const 0))
  5818. (sequence ()
  5819. (clobber (spr-sr0))
  5820. (clobber (spr-sr1))
  5821. (clobber (spr-sr2))
  5822. (clobber (spr-sr3))))
  5823. ; frv_itrap handles operating vs user mode
  5824. (c-call VOID "frv_itrap" pc base offset)))
  5825. )
  5826. (define-pmacro (trap-r prefix cc i-f op ope cond attr comment)
  5827. (dni (.sym prefix cc)
  5828. (comment)
  5829. ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1)
  5830. (FR400-MAJOR C-1) (FR450-MAJOR C-1) attr)
  5831. (.str (.sym prefix cc) "$pack $" i-f "CCi_2,$GRi,$GRj")
  5832. (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op GRi (misc-null-3) ope GRj)
  5833. (trap-semantics (cond (.sym i-f CCi_2)) GRi GRj)
  5834. ((fr400 (unit u-trap)) (fr450 (unit u-trap))
  5835. (fr500 (unit u-trap)) (fr550 (unit u-trap)))
  5836. )
  5837. )
  5838. (dni tra
  5839. "integer trap always"
  5840. ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1)
  5841. (FR400-MAJOR C-1) (FR450-MAJOR C-1))
  5842. "tra$pack $GRi,$GRj"
  5843. (+ pack ICC_ra (ICCi_2-null) OP_04 GRi (misc-null-3) OPE4_0 GRj)
  5844. (trap-semantics (const BI 1) GRi GRj)
  5845. ((fr400 (unit u-trap)) (fr450 (unit u-trap))
  5846. (fr500 (unit u-trap)) (fr550 (unit u-trap)))
  5847. )
  5848. (dni tno
  5849. "integer trap never"
  5850. ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1)
  5851. (FR400-MAJOR C-1) (FR450-MAJOR C-1))
  5852. "tno$pack"
  5853. (+ pack ICC_nev (ICCi_2-null) OP_04 (GRi-null) (misc-null-3) OPE4_0 (GRj-null))
  5854. (trap-semantics (const BI 0) GRi GRj)
  5855. ((fr400 (unit u-trap)) (fr450 (unit u-trap))
  5856. (fr500 (unit u-trap)) (fr550 (unit u-trap)))
  5857. )
  5858. (trap-r t eq I OP_04 OPE4_0 Ieq NA "integer trap equal")
  5859. (trap-r t ne I OP_04 OPE4_0 Ine NA "integer trap not equal")
  5860. (trap-r t le I OP_04 OPE4_0 Ile NA "integer trap less or equal")
  5861. (trap-r t gt I OP_04 OPE4_0 Igt NA "integer trap greater")
  5862. (trap-r t lt I OP_04 OPE4_0 Ilt NA "integer trap less")
  5863. (trap-r t ge I OP_04 OPE4_0 Ige NA "integer trap greater or equal")
  5864. (trap-r t ls I OP_04 OPE4_0 Ils NA "integer trap less or equal unsigned")
  5865. (trap-r t hi I OP_04 OPE4_0 Ihi NA "integer trap greater unsigned")
  5866. (trap-r t c I OP_04 OPE4_0 Ic NA "integer trap carry set")
  5867. (trap-r t nc I OP_04 OPE4_0 Inc NA "integer trap carry clear")
  5868. (trap-r t n I OP_04 OPE4_0 In NA "integer trap negative")
  5869. (trap-r t p I OP_04 OPE4_0 Ip NA "integer trap positive")
  5870. (trap-r t v I OP_04 OPE4_0 Iv NA "integer trap overflow set")
  5871. (trap-r t nv I OP_04 OPE4_0 Inv NA "integer trap overflow clear")
  5872. (dni ftra
  5873. "float trap always"
  5874. ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1)
  5875. (FR400-MAJOR C-1) (FR450-MAJOR C-1) FR-ACCESS)
  5876. "ftra$pack $GRi,$GRj"
  5877. (+ pack FCC_ra (FCCi_2-null) OP_04 GRi (misc-null-3) OPE4_1 GRj)
  5878. (trap-semantics (const BI 1) GRi GRj)
  5879. ((fr400 (unit u-trap)) (fr450 (unit u-trap))
  5880. (fr500 (unit u-trap)) (fr550 (unit u-trap)))
  5881. )
  5882. (dni ftno
  5883. "flost trap never"
  5884. ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1)
  5885. (FR400-MAJOR C-1) (FR450-MAJOR C-1) FR-ACCESS)
  5886. "ftno$pack"
  5887. (+ pack FCC_nev (FCCi_2-null) OP_04 (GRi-null) (misc-null-3) OPE4_1 (GRj-null))
  5888. (trap-semantics (const BI 0) GRi GRj)
  5889. ((fr400 (unit u-trap)) (fr450 (unit u-trap))
  5890. (fr500 (unit u-trap)) (fr550 (unit u-trap)))
  5891. )
  5892. (trap-r ft ne F OP_04 OPE4_1 Fne FR-ACCESS "float trap not equal")
  5893. (trap-r ft eq F OP_04 OPE4_1 Feq FR-ACCESS "float trap equal")
  5894. (trap-r ft lg F OP_04 OPE4_1 Flg FR-ACCESS "float trap greater or less")
  5895. (trap-r ft ue F OP_04 OPE4_1 Fue FR-ACCESS "float trap unordered or equal")
  5896. (trap-r ft ul F OP_04 OPE4_1 Ful FR-ACCESS "float trap unordered or less")
  5897. (trap-r ft ge F OP_04 OPE4_1 Fge FR-ACCESS "float trap greater or equal")
  5898. (trap-r ft lt F OP_04 OPE4_1 Flt FR-ACCESS "float trap less")
  5899. (trap-r ft uge F OP_04 OPE4_1 Fuge FR-ACCESS "float trap unordered greater or equal")
  5900. (trap-r ft ug F OP_04 OPE4_1 Fug FR-ACCESS "float trap unordered or greater")
  5901. (trap-r ft le F OP_04 OPE4_1 Fle FR-ACCESS "float trap less or equal")
  5902. (trap-r ft gt F OP_04 OPE4_1 Fgt FR-ACCESS "float trap greater")
  5903. (trap-r ft ule F OP_04 OPE4_1 Fule FR-ACCESS "float trap unordered less or equal")
  5904. (trap-r ft u F OP_04 OPE4_1 Fu FR-ACCESS "float trap unordered")
  5905. (trap-r ft o F OP_04 OPE4_1 Fo FR-ACCESS "float trap ordered")
  5906. (define-pmacro (trap-immed prefix cc i-f op cond attr comment)
  5907. (dni (.sym prefix cc)
  5908. (comment)
  5909. ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1)
  5910. (FR400-MAJOR C-1) (FR450-MAJOR C-1) attr)
  5911. (.str (.sym prefix cc) "$pack $" i-f "CCi_2,$GRi,$s12")
  5912. (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op GRi s12)
  5913. (trap-semantics (cond (.sym i-f CCi_2)) GRi s12)
  5914. ((fr400 (unit u-trap)) (fr450 (unit u-trap))
  5915. (fr500 (unit u-trap)) (fr550 (unit u-trap)))
  5916. )
  5917. )
  5918. (dni tira
  5919. "integer trap always"
  5920. ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1)
  5921. (FR400-MAJOR C-1) (FR450-MAJOR C-1))
  5922. "tira$pack $GRi,$s12"
  5923. (+ pack ICC_ra (ICCi_2-null) OP_1C GRi s12)
  5924. (trap-semantics (const BI 1) GRi s12)
  5925. ((fr400 (unit u-trap)) (fr450 (unit u-trap))
  5926. (fr500 (unit u-trap)) (fr550 (unit u-trap)))
  5927. )
  5928. (dni tino
  5929. "integer trap never"
  5930. ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1)
  5931. (FR400-MAJOR C-1) (FR450-MAJOR C-1))
  5932. "tino$pack"
  5933. (+ pack ICC_nev (ICCi_2-null) OP_1C (GRi-null) (s12-null))
  5934. (trap-semantics (const BI 0) GRi s12)
  5935. ((fr400 (unit u-trap)) (fr450 (unit u-trap))
  5936. (fr500 (unit u-trap)) (fr550 (unit u-trap)))
  5937. )
  5938. (trap-immed ti eq I OP_1C Ieq NA "integer trap equal")
  5939. (trap-immed ti ne I OP_1C Ine NA "integer trap not equal")
  5940. (trap-immed ti le I OP_1C Ile NA "integer trap less or equal")
  5941. (trap-immed ti gt I OP_1C Igt NA "integer trap greater")
  5942. (trap-immed ti lt I OP_1C Ilt NA "integer trap less")
  5943. (trap-immed ti ge I OP_1C Ige NA "integer trap greater or equal")
  5944. (trap-immed ti ls I OP_1C Ils NA "integer trap less or equal unsigned")
  5945. (trap-immed ti hi I OP_1C Ihi NA "integer trap greater unsigned")
  5946. (trap-immed ti c I OP_1C Ic NA "integer trap carry set")
  5947. (trap-immed ti nc I OP_1C Inc NA "integer trap carry clear")
  5948. (trap-immed ti n I OP_1C In NA "integer trap negative")
  5949. (trap-immed ti p I OP_1C Ip NA "integer trap positive")
  5950. (trap-immed ti v I OP_1C Iv NA "integer trap overflow set")
  5951. (trap-immed ti nv I OP_1C Inv NA "integer trap overflow clear")
  5952. (dni ftira
  5953. "float trap always"
  5954. ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1)
  5955. (FR400-MAJOR C-1) (FR450-MAJOR C-1) FR-ACCESS)
  5956. "ftira$pack $GRi,$s12"
  5957. (+ pack FCC_ra (ICCi_2-null) OP_1D GRi s12)
  5958. (trap-semantics (const BI 1) GRi s12)
  5959. ((fr400 (unit u-trap))
  5960. (fr500 (unit u-trap)) (fr550 (unit u-trap)))
  5961. )
  5962. (dni ftino
  5963. "float trap never"
  5964. ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1)
  5965. (FR400-MAJOR C-1) (FR450-MAJOR C-1) FR-ACCESS)
  5966. "ftino$pack"
  5967. (+ pack FCC_nev (FCCi_2-null) OP_1D (GRi-null) (s12-null))
  5968. (trap-semantics (const BI 0) GRi s12)
  5969. ((fr400 (unit u-trap)) (fr450 (unit u-trap))
  5970. (fr500 (unit u-trap)) (fr550 (unit u-trap)))
  5971. )
  5972. (trap-immed fti ne F OP_1D Fne FR-ACCESS "float trap not equal")
  5973. (trap-immed fti eq F OP_1D Feq FR-ACCESS "float trap equal")
  5974. (trap-immed fti lg F OP_1D Flg FR-ACCESS "float trap greater or less")
  5975. (trap-immed fti ue F OP_1D Fue FR-ACCESS "float trap unordered or equal")
  5976. (trap-immed fti ul F OP_1D Ful FR-ACCESS "float trap unordered or less")
  5977. (trap-immed fti ge F OP_1D Fge FR-ACCESS "float trap greater or equal")
  5978. (trap-immed fti lt F OP_1D Flt FR-ACCESS "float trap less")
  5979. (trap-immed fti uge F OP_1D Fuge FR-ACCESS "float trap unordered greater or equal")
  5980. (trap-immed fti ug F OP_1D Fug FR-ACCESS "float trap unordered or greater")
  5981. (trap-immed fti le F OP_1D Fle FR-ACCESS "float trap less or equal")
  5982. (trap-immed fti gt F OP_1D Fgt FR-ACCESS "float trap greater")
  5983. (trap-immed fti ule F OP_1D Fule FR-ACCESS "float trap unordered less or equal")
  5984. (trap-immed fti u F OP_1D Fu FR-ACCESS "float trap unordered")
  5985. (trap-immed fti o F OP_1D Fo FR-ACCESS "float trap ordered")
  5986. (dni break
  5987. "break trap"
  5988. ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1)
  5989. (FR400-MAJOR C-1) (FR450-MAJOR C-1))
  5990. "break$pack"
  5991. (+ pack (rd-null) OP_04 (rs-null) (misc-null-3) OPE4_3 (GRj-null))
  5992. (sequence ()
  5993. ; This is defered to frv_break because for the breakpoint
  5994. ; case we want to change as little of the machine state as
  5995. ; possible.
  5996. ;
  5997. ; BPCSR=PC
  5998. ; BPSR.BS=PSR.S
  5999. ; BPSR.BET=PSR.ET
  6000. ; PSR.S=1
  6001. ; PSR.ET=0
  6002. ; TBR.TT=0xff
  6003. ; PC=TBR
  6004. ; We still should indicate what is modified by this insn.
  6005. (clobber (spr-bpcsr))
  6006. (clobber bpsr_bs)
  6007. (clobber bpsr_bet)
  6008. (clobber psr_s)
  6009. (clobber psr_et)
  6010. (clobber tbr_tt)
  6011. (c-call VOID "frv_break"))
  6012. ()
  6013. )
  6014. (dni mtrap
  6015. "media trap"
  6016. ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1)
  6017. (FR400-MAJOR C-1) (FR450-MAJOR C-1) FR-ACCESS)
  6018. "mtrap$pack"
  6019. (+ pack (rd-null) OP_04 (rs-null) (misc-null-3) OPE4_2 (GRj-null))
  6020. (c-call VOID "frv_mtrap")
  6021. ()
  6022. )
  6023. (define-pmacro (condition-code-logic name operation ope comment)
  6024. (dni name
  6025. (comment)
  6026. ((UNIT B01) (FR500-MAJOR B-6) (FR550-MAJOR B-6)
  6027. (FR400-MAJOR B-6) (FR450-MAJOR B-6))
  6028. (.str name "$pack $CRi,$CRj,$CRk")
  6029. (+ pack (misc-null-6) CRk OP_0A (misc-null-7) CRi ope (misc-null-8) CRj)
  6030. (set CRk (c-call UQI "@cpu@_cr_logic" operation CRi CRj))
  6031. ()
  6032. )
  6033. )
  6034. (define-pmacro (op-andcr) 0)
  6035. (define-pmacro (op-orcr) 1)
  6036. (define-pmacro (op-xorcr) 2)
  6037. (define-pmacro (op-nandcr) 3)
  6038. (define-pmacro (op-norcr) 4)
  6039. (define-pmacro (op-andncr) 5)
  6040. (define-pmacro (op-orncr) 6)
  6041. (define-pmacro (op-nandncr) 7)
  6042. (define-pmacro (op-norncr) 8)
  6043. (define-pmacro (cr-true) 3)
  6044. (define-pmacro (cr-false) 2)
  6045. (define-pmacro (cr-undefined) 0)
  6046. (condition-code-logic andcr (op-andcr) OPE1_08 "and condition code regs")
  6047. (condition-code-logic orcr (op-orcr) OPE1_09 "or condition code regs")
  6048. (condition-code-logic xorcr (op-xorcr) OPE1_0A "xor condition code regs")
  6049. (condition-code-logic nandcr (op-nandcr) OPE1_0C "nand condition code regs")
  6050. (condition-code-logic norcr (op-norcr) OPE1_0D "nor condition code regs")
  6051. (condition-code-logic andncr (op-andncr) OPE1_10 "andn condition code regs")
  6052. (condition-code-logic orncr (op-orncr) OPE1_11 "orn condition code regs")
  6053. (condition-code-logic nandncr (op-nandncr) OPE1_14 "nandn condition code regs")
  6054. (condition-code-logic norncr (op-norncr) OPE1_15 "norn condition code regs")
  6055. (dni notcr
  6056. ("not cccr register")
  6057. ((UNIT B01) (FR500-MAJOR B-6) (FR550-MAJOR B-6)
  6058. (FR400-MAJOR B-6) (FR450-MAJOR B-6))
  6059. (.str notcr "$pack $CRj,$CRk")
  6060. (+ pack (misc-null-6) CRk OP_0A (rs-null) OPE1_0B (misc-null-8) CRj)
  6061. (set CRk (xor CRj 1))
  6062. ()
  6063. )
  6064. (define-pmacro (check-semantics cond cr)
  6065. (if cond (set cr (cr-true)) (set cr (cr-false)))
  6066. )
  6067. (define-pmacro (check-int-condition-code prefix cc op cond comment)
  6068. (dni (.sym prefix cc)
  6069. (comment)
  6070. ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5)
  6071. (FR400-MAJOR B-5) (FR450-MAJOR B-5))
  6072. (.str (.sym prefix cc) "$pack $ICCi_3,$CRj_int")
  6073. (+ pack (.sym ICC_ cc) CRj_int op (misc-null-5) ICCi_3)
  6074. (check-semantics (cond ICCi_3) CRj_int)
  6075. ((fr400 (unit u-check)) (fr450 (unit u-check))
  6076. (fr500 (unit u-check)) (fr550 (unit u-check)))
  6077. )
  6078. )
  6079. (dni ckra
  6080. "check integer cc always"
  6081. ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5)
  6082. (FR400-MAJOR B-5) (FR450-MAJOR B-5))
  6083. "ckra$pack $CRj_int"
  6084. (+ pack ICC_ra CRj_int OP_08 (misc-null-5) (ICCi_3-null))
  6085. (check-semantics (const BI 1) CRj_int)
  6086. ((fr400 (unit u-check)) (fr450 (unit u-check))
  6087. (fr500 (unit u-check)) (fr550 (unit u-check)))
  6088. )
  6089. (dni ckno
  6090. "check integer cc never"
  6091. ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5)
  6092. (FR400-MAJOR B-5) (FR450-MAJOR B-5))
  6093. "ckno$pack $CRj_int"
  6094. (+ pack ICC_nev CRj_int OP_08 (misc-null-5) (ICCi_3-null))
  6095. (check-semantics (const BI 0) CRj_int)
  6096. ((fr400 (unit u-check)) (fr450 (unit u-check))
  6097. (fr500 (unit u-check)) (fr550 (unit u-check)))
  6098. )
  6099. (check-int-condition-code ck eq OP_08 Ieq "check integer cc equal")
  6100. (check-int-condition-code ck ne OP_08 Ine "check integer cc not equal")
  6101. (check-int-condition-code ck le OP_08 Ile "check integer cc less or equal")
  6102. (check-int-condition-code ck gt OP_08 Igt "check integer cc greater")
  6103. (check-int-condition-code ck lt OP_08 Ilt "check integer cc less")
  6104. (check-int-condition-code ck ge OP_08 Ige "check integer cc greater or equal")
  6105. (check-int-condition-code ck ls OP_08 Ils "check integer cc less or equal unsigned")
  6106. (check-int-condition-code ck hi OP_08 Ihi "check integer cc greater unsigned")
  6107. (check-int-condition-code ck c OP_08 Ic "check integer cc carry set")
  6108. (check-int-condition-code ck nc OP_08 Inc "check integer cc carry clear")
  6109. (check-int-condition-code ck n OP_08 In "check integer cc negative")
  6110. (check-int-condition-code ck p OP_08 Ip "check integer cc positive")
  6111. (check-int-condition-code ck v OP_08 Iv "check integer cc overflow set")
  6112. (check-int-condition-code ck nv OP_08 Inv "check integer cc overflow clear")
  6113. (define-pmacro (check-float-condition-code prefix cc op cond comment)
  6114. (dni (.sym prefix cc)
  6115. (comment)
  6116. ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5)
  6117. (FR400-MAJOR B-5) (FR450-MAJOR B-5) FR-ACCESS)
  6118. (.str (.sym prefix cc) "$pack $FCCi_3,$CRj_float")
  6119. (+ pack (.sym FCC_ cc) CRj_float op (misc-null-5) FCCi_3)
  6120. (check-semantics (cond FCCi_3) CRj_float)
  6121. ((fr400 (unit u-check)) (fr450 (unit u-check))
  6122. (fr500 (unit u-check)) (fr550 (unit u-check)))
  6123. )
  6124. )
  6125. (dni fckra
  6126. "check float cc always"
  6127. ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5)
  6128. (FR400-MAJOR B-5) (FR450-MAJOR B-5) FR-ACCESS)
  6129. "fckra$pack $CRj_float"
  6130. (+ pack FCC_ra CRj_float OP_09 (misc-null-5) FCCi_3)
  6131. (check-semantics (const BI 1) CRj_float)
  6132. ((fr400 (unit u-check)) (fr450 (unit u-check))
  6133. (fr500 (unit u-check)) (fr550 (unit u-check)))
  6134. )
  6135. (dni fckno
  6136. "check float cc never"
  6137. ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5)
  6138. (FR400-MAJOR B-5) (FR450-MAJOR B-5) FR-ACCESS)
  6139. "fckno$pack $CRj_float"
  6140. (+ pack FCC_nev CRj_float OP_09 (misc-null-5) FCCi_3)
  6141. (check-semantics (const BI 0) CRj_float)
  6142. ((fr400 (unit u-check)) (fr450 (unit u-check))
  6143. (fr500 (unit u-check)) (fr550 (unit u-check)))
  6144. )
  6145. (check-float-condition-code fck ne OP_09 Fne "check float cc not equal")
  6146. (check-float-condition-code fck eq OP_09 Feq "check float cc equal")
  6147. (check-float-condition-code fck lg OP_09 Flg "check float cc greater or less")
  6148. (check-float-condition-code fck ue OP_09 Fue "check float cc unordered or equal")
  6149. (check-float-condition-code fck ul OP_09 Ful "check float cc unordered or less")
  6150. (check-float-condition-code fck ge OP_09 Fge "check float cc greater or equal")
  6151. (check-float-condition-code fck lt OP_09 Flt "check float cc less")
  6152. (check-float-condition-code fck uge OP_09 Fuge "check float cc unordered greater or equal")
  6153. (check-float-condition-code fck ug OP_09 Fug "check float cc unordered or greater")
  6154. (check-float-condition-code fck le OP_09 Fle "check float cc less or equal")
  6155. (check-float-condition-code fck gt OP_09 Fgt "check float cc greater")
  6156. (check-float-condition-code fck ule OP_09 Fule "check float cc unordered less or equal")
  6157. (check-float-condition-code fck u OP_09 Fu "check float cc unordered")
  6158. (check-float-condition-code fck o OP_09 Fo "check float cc ordered")
  6159. (define-pmacro (conditional-check-int-condition-code prefix cc op ope test comment)
  6160. (dni (.sym prefix cc)
  6161. (comment)
  6162. ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5)
  6163. (FR400-MAJOR B-5) (FR450-MAJOR B-5) CONDITIONAL)
  6164. (.str (.sym prefix cc) "$pack $ICCi_3,$CRj_int,$CCi,$cond")
  6165. (+ pack (.sym ICC_ cc) CRj_int op (rs-null) CCi cond ope
  6166. (misc-null-9) ICCi_3)
  6167. (if (eq CCi (or cond 2))
  6168. (check-semantics (test ICCi_3) CRj_int)
  6169. (set CRj_int (cr-undefined)))
  6170. ((fr400 (unit u-check)) (fr450 (unit u-check))
  6171. (fr500 (unit u-check)) (fr550 (unit u-check)))
  6172. )
  6173. )
  6174. (dni cckra
  6175. "conditional check integer cc always"
  6176. ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5)
  6177. (FR400-MAJOR B-5) (FR450-MAJOR B-5) CONDITIONAL)
  6178. "cckra$pack $CRj_int,$CCi,$cond"
  6179. (+ pack ICC_ra CRj_int OP_6A (rs-null) CCi cond OPE4_0
  6180. (misc-null-9) (ICCi_3-null))
  6181. (if (eq CCi (or cond 2))
  6182. (check-semantics (const BI 1) CRj_int)
  6183. (set CRj_int (cr-undefined)))
  6184. ((fr400 (unit u-check)) (fr450 (unit u-check))
  6185. (fr500 (unit u-check)) (fr550 (unit u-check)))
  6186. )
  6187. (dni cckno
  6188. "conditional check integer cc never"
  6189. ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5)
  6190. (FR400-MAJOR B-5) (FR450-MAJOR B-5) CONDITIONAL)
  6191. "cckno$pack $CRj_int,$CCi,$cond"
  6192. (+ pack ICC_nev CRj_int OP_6A (rs-null) CCi cond OPE4_0
  6193. (misc-null-9) (ICCi_3-null))
  6194. (if (eq CCi (or cond 2))
  6195. (check-semantics (const BI 0) CRj_int)
  6196. (set CRj_int (cr-undefined)))
  6197. ((fr400 (unit u-check)) (fr450 (unit u-check))
  6198. (fr500 (unit u-check)) (fr550 (unit u-check)))
  6199. )
  6200. (conditional-check-int-condition-code cck eq OP_6A OPE4_0 Ieq "check integer cc equal")
  6201. (conditional-check-int-condition-code cck ne OP_6A OPE4_0 Ine "check integer cc not equal")
  6202. (conditional-check-int-condition-code cck le OP_6A OPE4_0 Ile "check integer cc less or equal")
  6203. (conditional-check-int-condition-code cck gt OP_6A OPE4_0 Igt "check integer cc greater")
  6204. (conditional-check-int-condition-code cck lt OP_6A OPE4_0 Ilt "check integer cc less")
  6205. (conditional-check-int-condition-code cck ge OP_6A OPE4_0 Ige "check integer cc greater or equal")
  6206. (conditional-check-int-condition-code cck ls OP_6A OPE4_0 Ils "check integer cc less or equal unsigned")
  6207. (conditional-check-int-condition-code cck hi OP_6A OPE4_0 Ihi "check integer cc greater unsigned")
  6208. (conditional-check-int-condition-code cck c OP_6A OPE4_0 Ic "check integer cc carry set")
  6209. (conditional-check-int-condition-code cck nc OP_6A OPE4_0 Inc "check integer cc carry clear")
  6210. (conditional-check-int-condition-code cck n OP_6A OPE4_0 In "check integer cc negative")
  6211. (conditional-check-int-condition-code cck p OP_6A OPE4_0 Ip "check integer cc positive")
  6212. (conditional-check-int-condition-code cck v OP_6A OPE4_0 Iv "check integer cc overflow set")
  6213. (conditional-check-int-condition-code cck nv OP_6A OPE4_0 Inv "check integer cc overflow clear")
  6214. (define-pmacro (conditional-check-float-condition-code prefix cc op ope test comment)
  6215. (dni (.sym prefix cc)
  6216. (comment)
  6217. ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5)
  6218. (FR400-MAJOR B-5) (FR450-MAJOR B-5) CONDITIONAL FR-ACCESS)
  6219. (.str (.sym prefix cc) "$pack $FCCi_3,$CRj_float,$CCi,$cond")
  6220. (+ pack (.sym FCC_ cc) CRj_float op (rs-null) CCi cond ope
  6221. (misc-null-9) FCCi_3)
  6222. (if (eq CCi (or cond 2))
  6223. (check-semantics (test FCCi_3) CRj_float)
  6224. (set CRj_float (cr-undefined)))
  6225. ((fr400 (unit u-check)) (fr450 (unit u-check))
  6226. (fr500 (unit u-check)) (fr550 (unit u-check)))
  6227. )
  6228. )
  6229. (dni cfckra
  6230. "conditional check float cc always"
  6231. ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5)
  6232. (FR400-MAJOR B-5) (FR450-MAJOR B-5) CONDITIONAL FR-ACCESS)
  6233. "cfckra$pack $CRj_float,$CCi,$cond"
  6234. (+ pack FCC_ra CRj_float OP_6A (rs-null) CCi cond OPE4_1
  6235. (misc-null-9) (FCCi_3-null))
  6236. (if (eq CCi (or cond 2))
  6237. (check-semantics (const BI 1) CRj_float)
  6238. (set CRj_float (cr-undefined)))
  6239. ((fr400 (unit u-check)) (fr450 (unit u-check))
  6240. (fr500 (unit u-check)) (fr550 (unit u-check)))
  6241. )
  6242. (dni cfckno
  6243. "conditional check float cc never"
  6244. ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5)
  6245. (FR400-MAJOR B-5) (FR450-MAJOR B-5) CONDITIONAL FR-ACCESS)
  6246. "cfckno$pack $CRj_float,$CCi,$cond"
  6247. (+ pack FCC_nev CRj_float OP_6A (rs-null) CCi cond OPE4_1
  6248. (misc-null-9) (FCCi_3-null))
  6249. (if (eq CCi (or cond 2))
  6250. (check-semantics (const BI 0) CRj_float)
  6251. (set CRj_float (cr-undefined)))
  6252. ((fr400 (unit u-check)) (fr450 (unit u-check))
  6253. (fr500 (unit u-check)) (fr550 (unit u-check)))
  6254. )
  6255. (conditional-check-float-condition-code cfck ne OP_6A OPE4_1 Fne "check float cc not equal")
  6256. (conditional-check-float-condition-code cfck eq OP_6A OPE4_1 Feq "check float cc equal")
  6257. (conditional-check-float-condition-code cfck lg OP_6A OPE4_1 Flg "check float cc greater or less")
  6258. (conditional-check-float-condition-code cfck ue OP_6A OPE4_1 Fue "check float cc unordered or equal")
  6259. (conditional-check-float-condition-code cfck ul OP_6A OPE4_1 Ful "check float cc unordered or less")
  6260. (conditional-check-float-condition-code cfck ge OP_6A OPE4_1 Fge "check float cc greater or equal")
  6261. (conditional-check-float-condition-code cfck lt OP_6A OPE4_1 Flt "check float cc less")
  6262. (conditional-check-float-condition-code cfck uge OP_6A OPE4_1 Fuge "check float cc unordered greater or equal")
  6263. (conditional-check-float-condition-code cfck ug OP_6A OPE4_1 Fug "check float cc unordered or greater")
  6264. (conditional-check-float-condition-code cfck le OP_6A OPE4_1 Fle "check float cc less or equal")
  6265. (conditional-check-float-condition-code cfck gt OP_6A OPE4_1 Fgt "check float cc greater")
  6266. (conditional-check-float-condition-code cfck ule OP_6A OPE4_1 Fule "check float cc unordered less or equal")
  6267. (conditional-check-float-condition-code cfck u OP_6A OPE4_1 Fu "check float cc unordered")
  6268. (conditional-check-float-condition-code cfck o OP_6A OPE4_1 Fo "check float cc ordered")
  6269. (dni cjmpl
  6270. "conditional jump and link"
  6271. ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6)
  6272. (FR400-MAJOR I-5) (FR450-MAJOR I-5) CONDITIONAL)
  6273. "cjmpl$pack @($GRi,$GRj),$CCi,$cond"
  6274. (+ pack (misc-null-1) (LI-off) OP_6A GRi CCi cond OPE4_2 GRj)
  6275. (if (eq CCi (or cond 2))
  6276. (jump-and-link-semantics GRi GRj LI))
  6277. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  6278. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  6279. )
  6280. (dni ccalll
  6281. "conditional call and link"
  6282. ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6)
  6283. (FR400-MAJOR I-5) (FR450-MAJOR I-5) CONDITIONAL)
  6284. "ccalll$pack @($GRi,$GRj),$CCi,$cond"
  6285. (+ pack (misc-null-1) (LI-on) OP_6A GRi CCi cond OPE4_2 GRj)
  6286. (if (eq CCi (or cond 2))
  6287. (jump-and-link-semantics GRi GRj LI))
  6288. ((fr400 (unit u-branch)) (fr450 (unit u-branch))
  6289. (fr500 (unit u-branch)) (fr550 (unit u-branch)))
  6290. )
  6291. (define-pmacro (cache-invalidate name cache all op ope profile comment)
  6292. (dni name
  6293. (comment)
  6294. ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2)
  6295. (FR400-MAJOR C-2) (FR450-MAJOR C-2))
  6296. (.str name "$pack @($GRi,$GRj)")
  6297. (+ pack (rd-null) op GRi ope GRj)
  6298. (c-call VOID (.str "@cpu@_" cache "_cache_invalidate") (add GRi GRj) all)
  6299. profile
  6300. )
  6301. )
  6302. (cache-invalidate ici insn 0 OP_03 OPE1_38
  6303. ((fr400 (unit u-ici)) (fr450 (unit u-ici))
  6304. (fr500 (unit u-ici)) (fr550 (unit u-ici)))
  6305. "invalidate insn cache")
  6306. (cache-invalidate dci data 0 OP_03 OPE1_3C
  6307. ((fr400 (unit u-dci)) (fr450 (unit u-dci))
  6308. (fr500 (unit u-dci)) (fr550 (unit u-dci)))
  6309. "invalidate data cache")
  6310. (define-pmacro (cache-invalidate-entry name cache op ope profile comment)
  6311. (dni name
  6312. (comment)
  6313. ((UNIT C) (MACH fr400,fr450,fr550) (FR550-MAJOR C-2)
  6314. (FR400-MAJOR C-2) (FR450-MAJOR C-2))
  6315. (.str name "$pack @($GRi,$GRj),$ae")
  6316. (+ pack (misc-null-1) ae op GRi ope GRj)
  6317. (if (eq ae 0)
  6318. (c-call VOID (.str "@cpu@_" cache "_cache_invalidate") (add GRi GRj) -1) ; Invalid ae setting for this insn
  6319. (c-call VOID (.str "@cpu@_" cache "_cache_invalidate") (add GRi GRj) ae))
  6320. profile
  6321. )
  6322. )
  6323. (cache-invalidate-entry icei insn OP_03 OPE1_39
  6324. ((fr400 (unit u-ici)) (fr450 (unit u-ici))
  6325. (fr550 (unit u-ici)))
  6326. "invalidate insn cache entry")
  6327. (cache-invalidate-entry dcei data OP_03 OPE1_3A
  6328. ((fr400 (unit u-dci)) (fr450 (unit u-dci))
  6329. (fr550 (unit u-dci)))
  6330. "invalidate data cache entry")
  6331. (dni dcf
  6332. "Data cache flush"
  6333. ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2)
  6334. (FR400-MAJOR C-2) (FR450-MAJOR C-2))
  6335. "dcf$pack @($GRi,$GRj)"
  6336. (+ pack (rd-null) OP_03 GRi OPE1_3D GRj)
  6337. (c-call VOID "@cpu@_data_cache_flush" (add GRi GRj) 0)
  6338. ((fr400 (unit u-dcf)) (fr450 (unit u-dcf))
  6339. (fr500 (unit u-dcf)) (fr550 (unit u-dcf)))
  6340. )
  6341. (dni dcef
  6342. "Data cache entry flush"
  6343. ((UNIT C) (MACH fr400,fr450,fr550) (FR550-MAJOR C-2)
  6344. (FR400-MAJOR C-2) (FR450-MAJOR C-2))
  6345. "dcef$pack @($GRi,$GRj),$ae"
  6346. (+ pack (misc-null-1) ae OP_03 GRi OPE1_3B GRj)
  6347. (if (eq ae 0)
  6348. (c-call VOID "@cpu@_data_cache_flush" (add GRi GRj) -1)
  6349. (c-call VOID "@cpu@_data_cache_flush" (add GRi GRj) ae))
  6350. ((fr400 (unit u-dcf)) (fr450 (unit u-dcf)) (fr550 (unit u-dcf)))
  6351. )
  6352. (define-pmacro (write-TLB name insn op ope comment)
  6353. (dni name
  6354. (comment)
  6355. ((UNIT C) (FR500-MAJOR C-2) (MACH frv) PRIVILEGED)
  6356. (.str insn "$pack $GRk,@($GRi,$GRj)")
  6357. (+ pack GRk op GRi ope GRj)
  6358. (nop) ; for now
  6359. ()
  6360. )
  6361. )
  6362. (write-TLB witlb witlb OP_03 OPE1_32 "write for insn TLB")
  6363. (write-TLB wdtlb wdtlb OP_03 OPE1_36 "write for data TLB")
  6364. (define-pmacro (invalidate-TLB name insn op ope comment)
  6365. (dni name
  6366. (comment)
  6367. ((UNIT C) (FR500-MAJOR C-2) (MACH frv) PRIVILEGED)
  6368. (.str insn "$pack @($GRi,$GRj)")
  6369. (+ pack (rd-null) op GRi ope GRj)
  6370. (nop) ; for now
  6371. ()
  6372. )
  6373. )
  6374. (invalidate-TLB itlbi itlbi OP_03 OPE1_33 "invalidate insn TLB")
  6375. (invalidate-TLB dtlbi dtlbi OP_03 OPE1_37 "invalidate data TLB")
  6376. (define-pmacro (cache-preload name cache pipe attrs op ope profile comment)
  6377. (dni name
  6378. (comment)
  6379. (.splice (UNIT pipe) (FR500-MAJOR C-2)
  6380. (FR400-MAJOR C-2) (.unsplice attrs))
  6381. (.str name "$pack $GRi,$GRj,$lock")
  6382. (+ pack (misc-null-1) lock op GRi ope GRj)
  6383. (c-call VOID (.str "@cpu@_" cache "_cache_preload") GRi GRj lock)
  6384. profile
  6385. )
  6386. )
  6387. (cache-preload icpl insn C ((FR550-MAJOR C-2) (FR450-MAJOR C-2)) OP_03 OPE1_30
  6388. ((fr400 (unit u-icpl)) (fr450 (unit u-icpl))
  6389. (fr500 (unit u-icpl)) (fr550 (unit u-icpl)))
  6390. "preload insn cache")
  6391. (cache-preload dcpl data DCPL ((FR550-MAJOR I-8) (FR450-MAJOR I-2)) OP_03 OPE1_34
  6392. ((fr400 (unit u-dcpl)) (fr450 (unit u-dcpl))
  6393. (fr500 (unit u-dcpl)) (fr550 (unit u-dcpl)))
  6394. "preload data cache")
  6395. (define-pmacro (cache-unlock name cache op ope profile comment)
  6396. (dni name
  6397. (comment)
  6398. ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2)
  6399. (FR400-MAJOR C-2) (FR450-MAJOR C-2))
  6400. (.str name "$pack $GRi")
  6401. (+ pack (rd-null) op GRi ope (GRj-null))
  6402. (c-call VOID (.str "@cpu@_" cache "_cache_unlock") GRi)
  6403. profile
  6404. )
  6405. )
  6406. (cache-unlock icul insn OP_03 OPE1_31
  6407. ((fr400 (unit u-icul)) (fr450 (unit u-icul))
  6408. (fr500 (unit u-icul)) (fr550 (unit u-icul)))
  6409. "unlock insn cache")
  6410. (cache-unlock dcul data OP_03 OPE1_35
  6411. ((fr400 (unit u-dcul)) (fr450 (unit u-dcul))
  6412. (fr500 (unit u-dcul)) (fr550 (unit u-dcul)))
  6413. "unlock data cache")
  6414. (define-pmacro (barrier name insn op ope profile comment)
  6415. (dni name
  6416. (comment)
  6417. ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2)
  6418. (FR400-MAJOR C-2) (FR450-MAJOR C-2))
  6419. (.str insn "$pack")
  6420. (+ pack (rd-null) op (rs-null) ope (GRj-null))
  6421. (nop) ; sufficient implementation
  6422. profile
  6423. )
  6424. )
  6425. (barrier bar bar OP_03 OPE1_3E
  6426. ((fr400 (unit u-barrier)) (fr450 (unit u-barrier))
  6427. (fr500 (unit u-barrier)))
  6428. "barrier")
  6429. (barrier membar membar OP_03 OPE1_3F
  6430. ((fr400 (unit u-membar)) (fr450 (unit u-membar))
  6431. (fr500 (unit u-membar)))
  6432. "memory barrier")
  6433. ; Load real address instructions
  6434. (define-pmacro (load-real-address name insn what op ope)
  6435. (dni name
  6436. (.str "Load real address of " what)
  6437. ((UNIT C) (FR450-MAJOR C-2) (MACH fr450))
  6438. (.str insn "$pack $GRi,$GRk,$LRAE,$LRAD,$LRAS")
  6439. (+ pack GRk op GRi ope LRAE LRAD LRAS (LRA-null))
  6440. (nop) ; not simulated
  6441. ()
  6442. )
  6443. )
  6444. (load-real-address lrai "lrai" "instruction" OP_03 OPE1_20)
  6445. (load-real-address lrad "lrad" "data" OP_03 OPE1_21)
  6446. (dni tlbpr
  6447. "TLB Probe"
  6448. ((UNIT C) (FR450-MAJOR C-2) (MACH fr450))
  6449. "tlbpr$pack $GRi,$GRj,$TLBPRopx,$TLBPRL"
  6450. (+ pack (TLBPR-null) TLBPRopx TLBPRL OP_03 GRi OPE1_24 GRj)
  6451. (nop) ; not simulated
  6452. ()
  6453. )
  6454. ; Coprocessor operations
  6455. (define-pmacro (cop-op num op)
  6456. (dni (.sym cop num)
  6457. "Coprocessor operation"
  6458. ((UNIT C) (FR500-MAJOR C-2) (MACH frv))
  6459. (.str "cop" num "$pack $s6_1,$CPRi,$CPRj,$CPRk")
  6460. (+ pack CPRk op CPRi s6_1 CPRj)
  6461. (nop) ; sufficient implementation
  6462. ()
  6463. )
  6464. )
  6465. (cop-op 1 OP_7E)
  6466. (cop-op 2 OP_7F)
  6467. (define-pmacro (clear-ne-flag-semantics target_index is_float)
  6468. (c-call VOID "@cpu@_clear_ne_flags" target_index is_float)
  6469. )
  6470. (define-pmacro (clear-ne-flag-r name op ope reg is_float attr profile comment)
  6471. (dni name
  6472. (comment)
  6473. ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH simple,tomcat,fr500,fr550,frv) attr)
  6474. (.str name "$pack $" reg "k")
  6475. (+ pack (.sym reg k) op (rs-null) ope (GRj-null))
  6476. (sequence ()
  6477. ; hack to get this referenced for profiling
  6478. (c-raw-call VOID "frv_ref_SI" (.sym reg k))
  6479. (clear-ne-flag-semantics (index-of (.sym reg k)) is_float))
  6480. profile
  6481. )
  6482. )
  6483. (clear-ne-flag-r clrgr OP_0A OPE1_00 GR 0 NA
  6484. ((fr500 (unit u-clrgr)) (fr550 (unit u-clrgr)))
  6485. "Clear GR NE flag")
  6486. (clear-ne-flag-r clrfr OP_0A OPE1_02 FR 1 FR-ACCESS
  6487. ((fr500 (unit u-clrfr)) (fr550 (unit u-clrfr)))
  6488. "Clear FR NE flag")
  6489. (define-pmacro (clear-ne-flag-all name op ope is_float attr profile comment)
  6490. (dni name
  6491. (comment)
  6492. ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH simple,tomcat,fr500,fr550,frv) attr)
  6493. (.str name "$pack")
  6494. (+ pack (rd-null) op (rs-null) ope (GRj-null))
  6495. (clear-ne-flag-semantics -1 is_float)
  6496. profile
  6497. )
  6498. )
  6499. (clear-ne-flag-all clrga OP_0A OPE1_01 0 NA
  6500. ((fr500 (unit u-clrgr)) (fr550 (unit u-clrgr)))
  6501. "Clear GR NE flag ALL")
  6502. (clear-ne-flag-all clrfa OP_0A OPE1_03 1 FR-ACCESS
  6503. ((fr500 (unit u-clrfr)) (fr550 (unit u-clrfr)))
  6504. "Clear FR NE flag ALL")
  6505. (define-pmacro (commit-semantics target_index is_float)
  6506. (c-call VOID "@cpu@_commit" target_index is_float)
  6507. )
  6508. (define-pmacro (commit-r name op ope reg is_float attr comment)
  6509. (dni name
  6510. (comment)
  6511. ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH frv,fr500,fr550) attr)
  6512. (.str name "$pack $" reg "k")
  6513. (+ pack (.sym reg k) op (rs-null) ope (GRj-null))
  6514. (commit-semantics (index-of (.sym reg k)) is_float)
  6515. ((fr500 (unit u-commit)) (fr550 (unit u-commit)))
  6516. )
  6517. )
  6518. (commit-r commitgr OP_0A OPE1_04 GR 0 NA "commit exceptions, specific GR")
  6519. (commit-r commitfr OP_0A OPE1_06 FR 1 FR-ACCESS "commit exceptions, specific FR")
  6520. (define-pmacro (commit name op ope is_float attr comment)
  6521. (dni name
  6522. (comment)
  6523. ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH frv,fr500,fr550) attr)
  6524. (.str name "$pack")
  6525. (+ pack (rd-null) op (rs-null) ope (GRj-null))
  6526. (commit-semantics -1 is_float)
  6527. ((fr500 (unit u-commit)) (fr550 (unit u-commit)))
  6528. )
  6529. )
  6530. (commit commitga OP_0A OPE1_05 0 NA "commit exceptions, any GR")
  6531. (commit commitfa OP_0A OPE1_07 1 FR-ACCESS "commit exceptions, any FR")
  6532. (define-pmacro (floating-point-conversion
  6533. name op ope conv mode src targ attr comment)
  6534. (dni name
  6535. (comment)
  6536. (.splice (UNIT FMALL) (FR500-MAJOR F-1) (.unsplice attr))
  6537. (.str name "$pack $" src ",$" targ)
  6538. (+ pack targ op (rs-null) ope src)
  6539. (set targ (conv mode FPCONV-DEFAULT src))
  6540. ((fr500 (unit u-float-convert)) (fr550 (unit u-float-convert)))
  6541. )
  6542. )
  6543. (floating-point-conversion fitos OP_79 OPE1_00 float SF FRintj FRk
  6544. ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
  6545. "Convert Integer to Single")
  6546. (floating-point-conversion fstoi OP_79 OPE1_01 fix SI FRj FRintk
  6547. ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
  6548. "Convert Single to Integer")
  6549. (floating-point-conversion fitod OP_7A OPE1_00 float DF FRintj FRdoublek
  6550. ((MACH frv))
  6551. "Convert Integer to Double")
  6552. (floating-point-conversion fdtoi OP_7A OPE1_01 fix SI FRdoublej FRintk
  6553. ((MACH frv))
  6554. "Convert Double to Integer")
  6555. (define-pmacro (floating-point-dual-conversion
  6556. name op ope conv mode src src_hw targ targ_hw attr comment)
  6557. (dni name
  6558. (comment)
  6559. ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1) attr)
  6560. (.str name "$pack $" src ",$" targ)
  6561. (+ pack targ op (rs-null) ope src)
  6562. (sequence ()
  6563. (set targ (conv mode FPCONV-DEFAULT src))
  6564. (set (nextreg targ_hw targ 1)
  6565. (conv mode FPCONV-DEFAULT (nextreg src_hw src 1))))
  6566. ((fr500 (unit u-float-dual-convert)))
  6567. )
  6568. )
  6569. (floating-point-dual-conversion fditos OP_79 OPE1_10 float SF FRintj h-fr_int FRk h-fr NA "Dual Convert Integer to Single")
  6570. (floating-point-dual-conversion fdstoi OP_79 OPE1_11 fix SI FRj h-fr FRintk h-fr_int NA "Dual Convert Single to Integer")
  6571. (define-pmacro (ne-floating-point-dual-conversion
  6572. name op ope conv mode src src_hw targ targ_hw attr comment)
  6573. (dni name
  6574. (comment)
  6575. ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1) NON-EXCEPTING attr)
  6576. (.str name "$pack $" src ",$" targ)
  6577. (+ pack targ op (rs-null) ope src)
  6578. (sequence ()
  6579. (c-call VOID "@cpu@_set_ne_index" (index-of targ))
  6580. (set targ (conv mode FPCONV-DEFAULT src))
  6581. (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 1))
  6582. (set (nextreg targ_hw targ 1)
  6583. (conv mode FPCONV-DEFAULT (nextreg src_hw src 1))))
  6584. ((fr500 (unit u-float-dual-convert)))
  6585. )
  6586. )
  6587. (ne-floating-point-dual-conversion nfditos OP_79 OPE1_30 float SF FRintj h-fr_int FRk h-fr NA "Non excepting dual Convert Integer to Single")
  6588. (ne-floating-point-dual-conversion nfdstoi OP_79 OPE1_31 fix SI FRj h-fr FRintk h-fr_int NA "Non excepting dual Convert Single to Integer")
  6589. (define-pmacro (conditional-floating-point-conversion
  6590. name op ope conv mode src targ comment)
  6591. (dni name
  6592. (comment)
  6593. ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
  6594. (.str name "$pack $" src ",$" targ ",$CCi,$cond")
  6595. (+ pack targ op (rs-null) CCi cond ope src)
  6596. (if (eq CCi (or cond 2))
  6597. (set targ (conv mode FPCONV-DEFAULT src)))
  6598. ((fr500 (unit u-float-convert)) (fr550 (unit u-float-convert)))
  6599. )
  6600. )
  6601. (conditional-floating-point-conversion cfitos OP_6B OPE4_0 float SF FRintj FRk "Conditional convert Integer to Single")
  6602. (conditional-floating-point-conversion cfstoi OP_6B OPE4_1 fix SI FRj FRintk "Conditional convert Single to Integer")
  6603. (define-pmacro (ne-floating-point-conversion
  6604. name op ope conv mode src targ comment)
  6605. (dni name
  6606. (comment)
  6607. ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
  6608. (.str name "$pack $" src ",$" targ)
  6609. (+ pack targ op (rs-null) ope src)
  6610. (sequence ()
  6611. (c-call VOID "@cpu@_set_ne_index" (index-of targ))
  6612. (set targ (conv mode FPCONV-DEFAULT src)))
  6613. ((fr500 (unit u-float-convert)) (fr550 (unit u-float-convert)))
  6614. )
  6615. )
  6616. (ne-floating-point-conversion nfitos OP_79 OPE1_20 float SF FRintj FRk "NE convert Integer to Single")
  6617. (ne-floating-point-conversion nfstoi OP_79 OPE1_21 fix SI FRj FRintk "NE convert Single to Integer")
  6618. (register-transfer fmovs OP_79 OPE1_02
  6619. FRj FRk FMALL
  6620. ((FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
  6621. ((fr500 (unit u-fr2fr)))
  6622. "Move Single Float")
  6623. (register-transfer fmovd OP_7A OPE1_02
  6624. ; TODO -- unit doesn't handle extra register
  6625. FRdoublej FRdoublek FM01
  6626. ((FR500-MAJOR F-1) (MACH frv))
  6627. ((fr500 (unit u-fr2fr)) (fr550 (unit u-fr2fr)))
  6628. "Move Double Float")
  6629. (dni fdmovs
  6630. "Dual move single float"
  6631. ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1))
  6632. "fdmovs$pack $FRj,$FRk"
  6633. (+ pack FRk OP_79 (rs-null) OPE1_12 FRj)
  6634. (sequence ()
  6635. (set FRk FRj)
  6636. (set (nextreg h-fr FRk 1) (nextreg h-fr FRj 1)))
  6637. ; TODO -- unit doesn't handle extra register
  6638. ((fr500 (unit u-fr2fr)))
  6639. )
  6640. (conditional-register-transfer cfmovs OP_6C OPE4_0 FRj FRk FMALL
  6641. ((FR500-MAJOR F-1) (FR550-MAJOR F-2)
  6642. (MACH simple,tomcat,fr500,fr550,frv))
  6643. ((fr500 (unit u-fr2fr)) (fr550 (unit u-fr2fr)))
  6644. "Conditional move Single Float")
  6645. (define-pmacro (floating-point-neg name src targ op ope attr comment)
  6646. (dni name
  6647. (comment)
  6648. (.splice (UNIT FMALL) (FR500-MAJOR F-1) (.unsplice attr))
  6649. (.str name "$pack $" src ",$" targ)
  6650. (+ pack src op (rs-null) ope targ)
  6651. (set targ (neg src))
  6652. ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
  6653. )
  6654. )
  6655. (floating-point-neg fnegs FRj FRk OP_79 OPE1_03 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) "Floating point negate, single")
  6656. (floating-point-neg fnegd FRdoublej FRdoublek OP_7A OPE1_03 ((MACH frv)) "Floating point negate, double")
  6657. (dni fdnegs
  6658. "Floating point dual negate, single"
  6659. ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1))
  6660. "fdnegs$pack $FRj,$FRk"
  6661. (+ pack FRk OP_79 (rs-null) OPE1_13 FRj)
  6662. (sequence ()
  6663. (set FRk (neg FRj))
  6664. (set (nextreg h-fr FRk 1) (neg (nextreg h-fr FRj 1))))
  6665. ((fr500 (unit u-float-dual-arith)))
  6666. )
  6667. (dni cfnegs
  6668. "Conditional floating point negate, single"
  6669. ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
  6670. "cfnegs$pack $FRj,$FRk,$CCi,$cond"
  6671. (+ pack FRj OP_6C (rs-null) CCi cond OPE4_1 FRk)
  6672. (if (eq CCi (or cond 2))
  6673. (set FRk (neg FRj)))
  6674. ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
  6675. )
  6676. (define-pmacro (float-abs name src targ op ope attr comment)
  6677. (dni name
  6678. (comment)
  6679. (.splice (UNIT FMALL) (FR500-MAJOR F-1) (.unsplice attr))
  6680. (.str name "$pack $" src ",$" targ )
  6681. (+ pack targ op (rs-null) ope src)
  6682. (set targ (abs src))
  6683. ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
  6684. )
  6685. )
  6686. (float-abs fabss FRj FRk OP_79 OPE1_04 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) "Float absolute value, single")
  6687. (float-abs fabsd FRdoublej FRdoublek OP_7A OPE1_04 ((MACH frv)) "Float absolute value, double")
  6688. (dni fdabss
  6689. "Floating point dual absolute value, single"
  6690. ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1))
  6691. "fdabss$pack $FRj,$FRk"
  6692. (+ pack FRk OP_79 (rs-null) OPE1_14 FRj)
  6693. (sequence ()
  6694. (set FRk (abs FRj))
  6695. (set (nextreg h-fr FRk 1) (abs (nextreg h-fr FRj 1))))
  6696. ((fr500 (unit u-float-dual-arith)))
  6697. )
  6698. (dni cfabss
  6699. "Conditional floating point absolute value, single"
  6700. ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
  6701. "cfabss$pack $FRj,$FRk,$CCi,$cond"
  6702. (+ pack FRj OP_6C (rs-null) CCi cond OPE4_2 FRk)
  6703. (if (eq CCi (or cond 2))
  6704. (set FRk (abs FRj)))
  6705. ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
  6706. )
  6707. (dni fsqrts
  6708. "Square root single"
  6709. ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
  6710. "fsqrts$pack $FRj,$FRk"
  6711. (+ pack FRk OP_79 (rs-null) OPE1_05 FRj)
  6712. (set FRk (sqrt SF FRj))
  6713. ((fr500 (unit u-float-sqrt)) (fr550 (unit u-float-sqrt)))
  6714. )
  6715. (dni fdsqrts
  6716. "Dual square root single"
  6717. ((MACH frv) (UNIT FM01) (FR500-MAJOR F-4))
  6718. "fdsqrts$pack $FRj,$FRk"
  6719. (+ pack FRk OP_79 (rs-null) OPE1_15 FRj)
  6720. (sequence ()
  6721. (set FRk (sqrt SF FRj))
  6722. (set (nextreg h-fr FRk 1) (sqrt (nextreg h-fr FRj 1))))
  6723. ((fr500 (unit u-float-dual-sqrt)))
  6724. )
  6725. (dni nfdsqrts
  6726. "Non excepting Dual square root single"
  6727. ((MACH frv) (UNIT FM01) (FR500-MAJOR F-4) NON-EXCEPTING)
  6728. "nfdsqrts$pack $FRj,$FRk"
  6729. (+ pack FRk OP_79 (rs-null) OPE1_35 FRj)
  6730. (sequence ()
  6731. (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
  6732. (set FRk (sqrt SF FRj))
  6733. (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
  6734. (set (nextreg h-fr FRk 1) (sqrt (nextreg h-fr FRj 1))))
  6735. ((fr500 (unit u-float-dual-sqrt)))
  6736. )
  6737. (dni fsqrtd
  6738. "Square root double"
  6739. ((UNIT FM01) (FR500-MAJOR F-4) (MACH frv))
  6740. "fsqrtd$pack $FRdoublej,$FRdoublek"
  6741. (+ pack FRdoublek OP_7A (rs-null) OPE1_05 FRdoublej)
  6742. (set FRdoublek (sqrt DF FRdoublej))
  6743. ((fr500 (unit u-float-sqrt)))
  6744. )
  6745. (dni cfsqrts
  6746. "Conditional square root single"
  6747. ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
  6748. "cfsqrts$pack $FRj,$FRk,$CCi,$cond"
  6749. (+ pack FRk OP_6E (rs-null) CCi cond OPE4_2 FRj)
  6750. (if (eq CCi (or cond 2))
  6751. (set FRk (sqrt SF FRj)))
  6752. ((fr500 (unit u-float-sqrt)) (fr550 (unit u-float-sqrt)))
  6753. )
  6754. (dni nfsqrts
  6755. "Non exception square root, single"
  6756. ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
  6757. "nfsqrts$pack $FRj,$FRk"
  6758. (+ pack FRk OP_79 (rs-null) OPE1_25 FRj)
  6759. (sequence ()
  6760. (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
  6761. (set FRk (sqrt SF FRj)))
  6762. ((fr500 (unit u-float-sqrt)) (fr550 (unit u-float-sqrt)))
  6763. )
  6764. (define-pmacro (float-binary-op-s name pipe attr operation op ope comment)
  6765. (dni name
  6766. (comment)
  6767. (.splice (UNIT pipe) (MACH simple,tomcat,fr500,fr550,frv) (.unsplice attr))
  6768. (.str name "$pack $FRi,$FRj,$FRk")
  6769. (+ pack FRk op FRi ope FRj)
  6770. (set FRk (operation FRi FRj))
  6771. ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
  6772. )
  6773. )
  6774. (float-binary-op-s fadds FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) add OP_79 OPE1_06 "add single float")
  6775. (float-binary-op-s fsubs FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) sub OP_79 OPE1_07 "sub single float")
  6776. (float-binary-op-s fmuls FM01 ((FR500-MAJOR F-3) (FR550-MAJOR F-3)) mul OP_79 OPE1_08 "mul single float")
  6777. (dni fdivs
  6778. "div single float"
  6779. ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
  6780. "fdivs$pack $FRi,$FRj,$FRk"
  6781. (+ pack FRk OP_79 FRi OPE1_09 FRj)
  6782. (set FRk (div FRi FRj))
  6783. ((fr500 (unit u-float-div))
  6784. (fr550 (unit u-float-div)))
  6785. )
  6786. (define-pmacro (float-binary-op-d name operation op ope major comment)
  6787. (dni name
  6788. (comment)
  6789. ((UNIT FMALL) (FR500-MAJOR major) (MACH frv))
  6790. (.str name "$pack $FRdoublei,$FRdoublej,$FRdoublek")
  6791. (+ pack FRdoublek op FRdoublei ope FRdoublej)
  6792. (set FRdoublek (operation FRdoublei FRdoublej))
  6793. ((fr500 (unit u-float-arith)))
  6794. )
  6795. )
  6796. (float-binary-op-d faddd add OP_7A OPE1_06 F-2 "add double float")
  6797. (float-binary-op-d fsubd sub OP_7A OPE1_07 F-2 "sub double float")
  6798. (float-binary-op-d fmuld mul OP_7A OPE1_08 F-3 "mul double float")
  6799. (float-binary-op-d fdivd div OP_7A OPE1_09 F-4 "div double float")
  6800. (define-pmacro (conditional-float-binary-op name pipe attr operation op ope profile comment)
  6801. (dni name
  6802. (comment)
  6803. (.splice (UNIT pipe) (MACH simple,tomcat,fr500,fr550,frv)
  6804. (.unsplice attr))
  6805. (.str name "$pack $FRi,$FRj,$FRk,$CCi,$cond")
  6806. (+ pack FRk op FRi CCi cond ope FRj)
  6807. (if (eq CCi (or cond 2))
  6808. (set FRk (operation FRi FRj)))
  6809. profile
  6810. )
  6811. )
  6812. (conditional-float-binary-op cfadds FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) add OP_6D OPE4_0
  6813. ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
  6814. "cond add single")
  6815. (conditional-float-binary-op cfsubs FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) sub OP_6D OPE4_1
  6816. ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
  6817. "cond sub single")
  6818. (conditional-float-binary-op cfmuls FM01 ((FR500-MAJOR F-3) (FR550-MAJOR F-3)) mul OP_6E OPE4_0
  6819. ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
  6820. "cond mul single")
  6821. (conditional-float-binary-op cfdivs FM01 ((FR500-MAJOR F-4) (FR550-MAJOR F-3)) div OP_6E OPE4_1
  6822. ((fr500 (unit u-float-div)) (fr550 (unit u-float-div)))
  6823. "cond div single")
  6824. (define-pmacro (ne-float-binary-op name pipe attr operation op ope profile comment)
  6825. (dni name
  6826. (comment)
  6827. (.splice (UNIT pipe) (MACH simple,tomcat,fr500,fr550,frv)
  6828. (.unsplice attr))
  6829. (.str name "$pack $FRi,$FRj,$FRk")
  6830. (+ pack FRk op FRi ope FRj)
  6831. (sequence ()
  6832. (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
  6833. (set FRk (operation FRi FRj)))
  6834. profile
  6835. )
  6836. )
  6837. (ne-float-binary-op nfadds FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) add OP_79 OPE1_26
  6838. ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
  6839. "ne add single")
  6840. (ne-float-binary-op nfsubs FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) sub OP_79 OPE1_27
  6841. ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
  6842. "ne sub single")
  6843. (ne-float-binary-op nfmuls FM01 ((FR500-MAJOR F-3) (FR550-MAJOR F-3)) mul OP_79 OPE1_28
  6844. ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
  6845. "ne mul single")
  6846. (ne-float-binary-op nfdivs FM01 ((FR500-MAJOR F-4) (FR550-MAJOR F-3)) div OP_79 OPE1_29
  6847. ((fr500 (unit u-float-div)) (fr550 (unit u-float-div)))
  6848. "ne div single")
  6849. (define-pmacro (fcc-eq) 8)
  6850. (define-pmacro (fcc-lt) 4)
  6851. (define-pmacro (fcc-gt) 2)
  6852. (define-pmacro (fcc-uo) 1)
  6853. (define-pmacro (compare-and-set-fcc arg1 arg2 fcc)
  6854. (if (gt arg1 arg2)
  6855. (set fcc (fcc-gt))
  6856. (if (eq arg1 arg2)
  6857. (set fcc (fcc-eq))
  6858. (if (lt arg1 arg2)
  6859. (set fcc (fcc-lt))
  6860. (set fcc (fcc-uo)))))
  6861. )
  6862. (dni fcmps
  6863. "compare single float"
  6864. ((UNIT FMALL) (FR500-MAJOR F-2) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
  6865. "fcmps$pack $FRi,$FRj,$FCCi_2"
  6866. (+ pack (cond-null) FCCi_2 OP_79 FRi OPE1_0A FRj)
  6867. (compare-and-set-fcc FRi FRj FCCi_2)
  6868. ((fr500 (unit u-float-compare)) (fr550 (unit u-float-compare)))
  6869. )
  6870. (dni fcmpd
  6871. "compare double float"
  6872. ((UNIT FMALL) (FR500-MAJOR F-2) (MACH frv))
  6873. "fcmpd$pack $FRdoublei,$FRdoublej,$FCCi_2"
  6874. (+ pack (cond-null) FCCi_2 OP_7A FRdoublei OPE1_0A FRdoublej)
  6875. (compare-and-set-fcc FRdoublei FRdoublej FCCi_2)
  6876. ((fr500 (unit u-float-compare)))
  6877. )
  6878. (dni cfcmps
  6879. "Conditional compare single, float"
  6880. ((UNIT FMALL) (FR500-MAJOR F-2) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
  6881. "cfcmps$pack $FRi,$FRj,$FCCi_2,$CCi,$cond"
  6882. (+ pack (cond-null) FCCi_2 OP_6D FRi CCi cond OPE4_2 FRj)
  6883. (if (eq CCi (or cond 2))
  6884. (compare-and-set-fcc FRi FRj FCCi_2))
  6885. ((fr500 (unit u-float-compare)) (fr550 (unit u-float-compare)))
  6886. )
  6887. (dni fdcmps
  6888. "float dual compare single"
  6889. ((UNIT FMALL) (FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
  6890. "fdcmps$pack $FRi,$FRj,$FCCi_2"
  6891. (+ pack (cond-null) FCCi_2 OP_79 FRi OPE1_1A FRj)
  6892. (sequence ()
  6893. (compare-and-set-fcc FRi FRj FCCi_2)
  6894. (compare-and-set-fcc (nextreg h-fr FRi 1) (nextreg h-fr FRj 1)
  6895. (nextreg h-fccr FCCi_2 1)))
  6896. ((fr500 (unit u-float-dual-compare)) (fr550 (unit u-float-dual-compare)))
  6897. )
  6898. (define-pmacro (float-mul-with-add name add_sub arg1 arg2 targ op ope comment)
  6899. (dni name
  6900. (comment)
  6901. ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv))
  6902. (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
  6903. (+ pack targ op arg1 ope arg2)
  6904. (set targ (add_sub (mul arg1 arg2) targ))
  6905. ((fr500 (unit u-float-dual-arith)))
  6906. )
  6907. )
  6908. (float-mul-with-add fmadds add FRi FRj FRk OP_79 OPE1_0B "mul with add, single")
  6909. (float-mul-with-add fmsubs sub FRi FRj FRk OP_79 OPE1_0C "mul with sub, single")
  6910. (float-mul-with-add fmaddd add FRdoublei FRdoublej FRdoublek OP_7A OPE1_0B "mul with add, double")
  6911. (float-mul-with-add fmsubd sub FRdoublei FRdoublej FRdoublek OP_7A OPE1_0C "mul with sub, double")
  6912. (dni fdmadds
  6913. "Float dual multiply with add"
  6914. ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv))
  6915. "fdmadds$pack $FRi,$FRj,$FRk"
  6916. (+ pack FRk OP_79 FRi OPE1_1B FRj)
  6917. (sequence ()
  6918. (set FRk (add (mul FRi FRj) FRk))
  6919. (set (nextreg h-fr FRk 1)
  6920. (add (mul (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))
  6921. (nextreg h-fr FRk 1))))
  6922. ; TODO dual registers not referenced for profiling
  6923. ((fr500 (unit u-float-dual-arith)))
  6924. )
  6925. (dni nfdmadds
  6926. "Non excepting float dual multiply with add"
  6927. ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv))
  6928. "nfdmadds$pack $FRi,$FRj,$FRk"
  6929. (+ pack FRk OP_79 FRi OPE1_3B FRj)
  6930. (sequence ()
  6931. (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
  6932. (set FRk (add (mul FRi FRj) FRk))
  6933. (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
  6934. (set (nextreg h-fr FRk 1)
  6935. (add (mul (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))
  6936. (nextreg h-fr FRk 1))))
  6937. ; TODO dual registers not referenced for profiling
  6938. ((fr500 (unit u-float-dual-arith)))
  6939. )
  6940. (define-pmacro (conditional-float-mul-with-add
  6941. name add_sub arg1 arg2 targ op ope comment)
  6942. (dni name
  6943. (comment)
  6944. ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv) CONDITIONAL)
  6945. (.str name "$pack $FRi,$FRj,$FRk,$CCi,$cond")
  6946. (+ pack FRk op FRi CCi cond ope FRj)
  6947. (if (eq CCi (or cond 2))
  6948. (set targ (add_sub (mul arg1 arg2) targ)))
  6949. ((fr500 (unit u-float-dual-arith)))
  6950. )
  6951. )
  6952. (conditional-float-mul-with-add cfmadds add FRi FRj FRk OP_6F OPE4_0 "conditional mul with add, single")
  6953. (conditional-float-mul-with-add cfmsubs sub FRi FRj FRk OP_6F OPE4_1 "conditional mul with sub, single")
  6954. (define-pmacro (ne-float-mul-with-add name add_sub arg1 arg2 targ op ope comment)
  6955. (dni name
  6956. (comment)
  6957. ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv) NON-EXCEPTING)
  6958. (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
  6959. (+ pack targ op arg1 ope arg2)
  6960. (sequence ()
  6961. (c-call VOID "@cpu@_set_ne_index" (index-of targ))
  6962. (set targ (add_sub (mul arg1 arg2) targ)))
  6963. ((fr500 (unit u-float-dual-arith)))
  6964. )
  6965. )
  6966. (ne-float-mul-with-add nfmadds add FRi FRj FRk OP_79 OPE1_2B "non excepting mul with add, single")
  6967. (ne-float-mul-with-add nfmsubs sub FRi FRj FRk OP_79 OPE1_2C "non excepting mul with sub, single")
  6968. (define-pmacro (float-parallel-mul-add-semantics cond add_sub arg1 arg2 targ)
  6969. (if cond
  6970. (sequence ()
  6971. (set targ (mul arg1 arg2))
  6972. (set (nextreg h-fr targ 1)
  6973. (add_sub (nextreg h-fr arg1 1) (nextreg h-fr arg2 1)))))
  6974. )
  6975. (define-pmacro (float-parallel-mul-add
  6976. name add_sub arg1 arg2 targ op ope comment)
  6977. (dni name
  6978. (comment)
  6979. ((UNIT FM01) (FR500-MAJOR F-5) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
  6980. (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
  6981. (+ pack targ op arg1 ope arg2)
  6982. (float-parallel-mul-add-semantics 1 add_sub arg1 arg2 targ)
  6983. ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
  6984. )
  6985. )
  6986. (float-parallel-mul-add fmas add FRi FRj FRk OP_79 OPE1_0E "parallel mul/add, single")
  6987. (float-parallel-mul-add fmss sub FRi FRj FRk OP_79 OPE1_0F "parallel mul/sub, single")
  6988. (define-pmacro (float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
  6989. (sequence ()
  6990. (set targ (mul arg1 arg2))
  6991. (set (nextreg h-fr targ 1)
  6992. (add_sub (nextreg h-fr arg1 1) (nextreg h-fr arg2 1)))
  6993. (set (nextreg h-fr targ 2)
  6994. (mul (nextreg h-fr arg1 2) (nextreg h-fr arg2 2)))
  6995. (set (nextreg h-fr targ 3)
  6996. (add_sub (nextreg h-fr arg1 3) (nextreg h-fr arg2 3))))
  6997. )
  6998. (define-pmacro (float-dual-parallel-mul-add
  6999. name add_sub arg1 arg2 targ op ope comment)
  7000. (dni name
  7001. (comment)
  7002. ((UNIT FM01) (FR500-MAJOR F-5) (MACH frv))
  7003. (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
  7004. (+ pack targ op arg1 ope arg2)
  7005. (float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
  7006. ()
  7007. )
  7008. )
  7009. (float-dual-parallel-mul-add fdmas add FRi FRj FRk OP_79 OPE1_1C "dual parallel mul/add, single")
  7010. (float-dual-parallel-mul-add fdmss sub FRi FRj FRk OP_79 OPE1_1D "dual parallel mul/sub, single")
  7011. (define-pmacro (ne-float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
  7012. (sequence ()
  7013. (c-call VOID "@cpu@_set_ne_index" (index-of targ))
  7014. (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 1))
  7015. (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 2))
  7016. (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 3))
  7017. (set targ (mul arg1 arg2))
  7018. (set (nextreg h-fr targ 1)
  7019. (add_sub (nextreg h-fr arg1 1) (nextreg h-fr arg2 1)))
  7020. (set (nextreg h-fr targ 2)
  7021. (mul (nextreg h-fr arg1 2) (nextreg h-fr arg2 2)))
  7022. (set (nextreg h-fr targ 3)
  7023. (add_sub (nextreg h-fr arg1 3) (nextreg h-fr arg2 3))))
  7024. )
  7025. (define-pmacro (ne-float-dual-parallel-mul-add
  7026. name add_sub arg1 arg2 targ op ope comment)
  7027. (dni name
  7028. (comment)
  7029. ((UNIT FM01) (FR500-MAJOR F-5) (MACH frv))
  7030. (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
  7031. (+ pack targ op arg1 ope arg2)
  7032. (ne-float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
  7033. ()
  7034. )
  7035. )
  7036. (ne-float-dual-parallel-mul-add nfdmas add FRi FRj FRk OP_79 OPE1_3C "non excepting dual parallel mul/add, single")
  7037. (ne-float-dual-parallel-mul-add nfdmss sub FRi FRj FRk OP_79 OPE1_3D "non excepting dual parallel mul/sub, single")
  7038. (define-pmacro (conditional-float-parallel-mul-add name add_sub op ope comment)
  7039. (dni name
  7040. (comment)
  7041. ((UNIT FM01) (FR500-MAJOR F-5) (FR550-MAJOR F-4) CONDITIONAL (MACH simple,tomcat,fr500,fr550,frv))
  7042. (.str name "$pack $FRi,$FRj,$FRk,$CCi,$cond")
  7043. (+ pack FRk op FRi CCi cond ope FRj)
  7044. (float-parallel-mul-add-semantics (eq CCi (or cond 2))
  7045. add_sub FRi FRj FRk)
  7046. ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
  7047. )
  7048. )
  7049. (conditional-float-parallel-mul-add cfmas add OP_6F OPE4_2 "conditional parallel mul/add, single")
  7050. (conditional-float-parallel-mul-add cfmss sub OP_6F OPE4_3 "conditional parallel mul/sub, single")
  7051. (define-pmacro (float-parallel-mul-add-double-semantics add_sub arg1 arg2 targ)
  7052. (sequence ()
  7053. (set targ (ftrunc SF FPCONV-DEFAULT
  7054. (mul DF
  7055. (fext DF FPCONV-DEFAULT arg1)
  7056. (fext DF FPCONV-DEFAULT arg2))))
  7057. (set (nextreg h-fr targ 1)
  7058. (ftrunc SF FPCONV-DEFAULT
  7059. (add_sub DF
  7060. (fext DF FPCONV-DEFAULT (nextreg h-fr arg1 1))
  7061. (fext DF FPCONV-DEFAULT (nextreg h-fr arg2 1))))))
  7062. )
  7063. (define-pmacro (float-parallel-mul-add-double
  7064. name add_sub arg1 arg2 targ op ope comment)
  7065. (dni name
  7066. (comment)
  7067. ((UNIT FM01) (FR500-MAJOR F-5) (MACH frv))
  7068. (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
  7069. (+ pack targ op arg1 ope arg2)
  7070. (float-parallel-mul-add-double-semantics add_sub arg1 arg2 targ)
  7071. ()
  7072. )
  7073. )
  7074. (float-parallel-mul-add-double fmad add FRi FRj FRk OP_7A OPE1_0E "parallel mul/add, double")
  7075. (float-parallel-mul-add-double fmsd sub FRi FRj FRk OP_7A OPE1_0F "parallel mul/sub, double")
  7076. (define-pmacro (ne-float-parallel-mul-add name add_sub op ope comment)
  7077. (dni name
  7078. (comment)
  7079. ((UNIT FM01) (FR500-MAJOR F-5) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
  7080. (.str name "$pack $FRi,$FRj,$FRk")
  7081. (+ pack FRk op FRi ope FRj)
  7082. (sequence ()
  7083. (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
  7084. (set FRk (mul FRi FRj))
  7085. (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
  7086. (set (nextreg h-fr FRk 1)
  7087. (add_sub (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))))
  7088. ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
  7089. )
  7090. )
  7091. (ne-float-parallel-mul-add nfmas add OP_79 OPE1_2E "ne parallel mul/add,single")
  7092. (ne-float-parallel-mul-add nfmss sub OP_79 OPE1_2F "ne parallel mul/sub,single")
  7093. (define-pmacro (float-dual-arith name attr oper1 oper2 op ope comment)
  7094. (dni name
  7095. (comment)
  7096. (.splice (UNIT FM01) (.unsplice attr))
  7097. (.str name "$pack $FRi,$FRj,$FRk")
  7098. (+ pack FRk op FRi ope FRj)
  7099. (sequence ()
  7100. (set FRk (oper1 FRi FRj))
  7101. (set (nextreg h-fr FRk 1)
  7102. (oper2 (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))))
  7103. ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
  7104. )
  7105. )
  7106. (float-dual-arith fdadds ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) add add OP_79 OPE1_16 "dual add, single")
  7107. (float-dual-arith fdsubs ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) sub sub OP_79 OPE1_17 "dual sub, single")
  7108. (float-dual-arith fdmuls ((FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) mul mul OP_79 OPE1_18 "dual mul, single")
  7109. (float-dual-arith fddivs ((FR500-MAJOR F-7) (MACH frv)) div div OP_79 OPE1_19 "dual div,single")
  7110. (float-dual-arith fdsads ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) add sub OP_79 OPE1_1E "dual add/sub, single")
  7111. (dni fdmulcs
  7112. "Float dual cross multiply single"
  7113. ((UNIT FM01) (FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
  7114. "fdmulcs$pack $FRi,$FRj,$FRk"
  7115. (+ pack FRk OP_79 FRi OPE1_1F FRj)
  7116. (sequence ()
  7117. (set FRk (mul FRi (nextreg h-fr FRj 1)))
  7118. (set (nextreg h-fr FRk 1) (mul (nextreg h-fr FRi 1) FRj)))
  7119. ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
  7120. )
  7121. (dni nfdmulcs
  7122. "NE float dual cross multiply single"
  7123. ((UNIT FM01) (FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
  7124. "nfdmulcs$pack $FRi,$FRj,$FRk"
  7125. (+ pack FRk OP_79 FRi OPE1_3F FRj)
  7126. (sequence ()
  7127. (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
  7128. (set FRk (mul FRi (nextreg h-fr FRj 1)))
  7129. (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
  7130. (set (nextreg h-fr FRk 1) (mul (nextreg h-fr FRi 1) FRj)))
  7131. ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
  7132. )
  7133. (define-pmacro (ne-float-dual-arith name attr oper1 oper2 op ope comment)
  7134. (dni name
  7135. (comment)
  7136. (.splice (UNIT FM01) (.unsplice attr))
  7137. (.str name "$pack $FRi,$FRj,$FRk")
  7138. (+ pack FRk op FRi ope FRj)
  7139. (sequence ()
  7140. (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
  7141. (set FRk (oper1 FRi FRj))
  7142. (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
  7143. (set (nextreg h-fr FRk 1)
  7144. (oper2 (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))))
  7145. ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
  7146. )
  7147. )
  7148. (ne-float-dual-arith nfdadds ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) add add OP_79 OPE1_36 "ne dual add, single")
  7149. (ne-float-dual-arith nfdsubs ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) sub sub OP_79 OPE1_37 "ne dual sub, single")
  7150. (ne-float-dual-arith nfdmuls ((FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) mul mul OP_79 OPE1_38 "ne dual mul, single")
  7151. (ne-float-dual-arith nfddivs ((FR500-MAJOR F-7) (MACH frv)) div div OP_79 OPE1_39 "ne dual div,single")
  7152. (ne-float-dual-arith nfdsads ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) add sub OP_79 OPE1_3E "ne dual add/sub, single")
  7153. (dni nfdcmps
  7154. "non-excepting dual float compare"
  7155. ((UNIT FM01) (FR500-MAJOR F-6) (MACH simple,tomcat,frv))
  7156. "nfdcmps$pack $FRi,$FRj,$FCCi_2"
  7157. (+ pack (cond-null) FCCi_2 OP_79 FRi OPE1_3A FRj)
  7158. (sequence ()
  7159. (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
  7160. (compare-and-set-fcc FRi FRj FCCi_2)
  7161. (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
  7162. (compare-and-set-fcc (nextreg h-fr FRi 1) (nextreg h-fr FRj 1)
  7163. (nextreg h-fccr FCCi_2 1)))
  7164. ((fr500 (unit u-float-dual-compare)))
  7165. )
  7166. ; Media Instructions
  7167. ;
  7168. (define-pmacro (halfword hilo arg offset)
  7169. (reg (.sym h-fr_ hilo) (add (index-of arg) offset)))
  7170. (dni mhsetlos
  7171. "Media set lower signed 12 bits"
  7172. ((UNIT FMALL) (MACH fr400,fr450,fr550) (FR550-MAJOR M-5)
  7173. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  7174. "mhsetlos$pack $u12,$FRklo"
  7175. (+ pack FRklo OP_78 OPE1_20 u12)
  7176. (set FRklo u12)
  7177. ((fr400 (unit u-media-hilo)) (fr450 (unit u-media-hilo))
  7178. (fr550 (unit u-media-set (out FRintk FRklo))))
  7179. )
  7180. (dni mhsethis
  7181. "Media set upper signed 12 bits"
  7182. ((UNIT FMALL) (MACH fr400,fr450,fr550) (FR550-MAJOR M-5)
  7183. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  7184. "mhsethis$pack $u12,$FRkhi"
  7185. (+ pack FRkhi OP_78 OPE1_22 u12)
  7186. (set FRkhi u12)
  7187. ((fr400 (unit u-media-hilo)) (fr450 (unit u-media-hilo))
  7188. (fr550 (unit u-media-set (out FRintk FRkhi))))
  7189. )
  7190. (dni mhdsets
  7191. "Media dual set halfword signed 12 bits"
  7192. ((UNIT FMALL) (MACH fr400,fr450,fr550) (FR550-MAJOR M-5)
  7193. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  7194. "mhdsets$pack $u12,$FRintk"
  7195. (+ pack FRintk OP_78 OPE1_24 u12)
  7196. (sequence ()
  7197. ; hack to get FRintk passed to modelling functions
  7198. (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
  7199. (set (halfword hi FRintk 0) u12)
  7200. (set (halfword lo FRintk 0) u12))
  7201. ((fr400 (unit u-media-1)) (fr450 (unit u-media-1))
  7202. (fr550 (unit u-media-set)))
  7203. )
  7204. (define-pmacro (set-5-semantics target value)
  7205. (sequence ((HI tmp))
  7206. (set tmp target)
  7207. (set tmp (and tmp #x07ff))
  7208. (set tmp (or tmp (sll (and s5 #x1f) 11)))
  7209. (set target tmp))
  7210. )
  7211. (define-pmacro (media-set-5 name hilo op ope comment)
  7212. (dni name
  7213. (comment)
  7214. ((UNIT FMALL) (MACH fr400,fr450,fr550) (FR550-MAJOR M-5)
  7215. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  7216. (.str name "$pack $s5,$FRk" hilo)
  7217. (+ pack (.sym FRk hilo) op (FRi-null) ope (misc-null-11) s5)
  7218. (set-5-semantics (.sym FRk hilo) s5)
  7219. ((fr400 (unit u-media-hilo)) (fr450 (unit u-media-hilo))
  7220. (fr550 (unit u-media-set (out FRintk (.sym FRk hilo)))))
  7221. )
  7222. )
  7223. (media-set-5 mhsetloh lo OP_78 OPE1_21 "Media set upper 5 bits lo")
  7224. (media-set-5 mhsethih hi OP_78 OPE1_23 "Media set upper 5 bits hi")
  7225. (dni mhdseth
  7226. "Media dual set halfword upper 5 bits"
  7227. ((UNIT FMALL) (MACH fr400,fr450,fr550) (FR550-MAJOR M-5)
  7228. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  7229. "mhdseth$pack $s5,$FRintk"
  7230. (+ pack FRintk OP_78 (FRi-null) OPE1_25 (misc-null-11) s5)
  7231. (sequence ()
  7232. ; hack to get FRintk passed to modelling functions
  7233. (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
  7234. (set-5-semantics (halfword hi FRintk 0) s5)
  7235. (set-5-semantics (halfword lo FRintk 0) s5))
  7236. ((fr400 (unit u-media-1)) (fr450 (unit u-media-1))
  7237. (fr550 (unit u-media-set)))
  7238. )
  7239. (define-pmacro (media-logic-r-r name operation op ope comment)
  7240. (dni name
  7241. (comment)
  7242. ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2)
  7243. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  7244. (.str name "$pack $FRinti,$FRintj,$FRintk")
  7245. (+ pack FRintk op FRinti ope FRintj)
  7246. (set FRintk (operation FRinti FRintj))
  7247. ((fr400 (unit u-media-1)) (fr450 (unit u-media-1))
  7248. (fr500 (unit u-media)) (fr550 (unit u-media)))
  7249. )
  7250. )
  7251. (media-logic-r-r mand and OP_7B OPE1_00 "and reg/reg")
  7252. (media-logic-r-r mor or OP_7B OPE1_01 "or reg/reg")
  7253. (media-logic-r-r mxor xor OP_7B OPE1_02 "xor reg/reg")
  7254. (define-pmacro (conditional-media-logic name operation op ope comment)
  7255. (dni name
  7256. (comment)
  7257. ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2)
  7258. (FR400-MAJOR M-1) (FR450-MAJOR M-1) CONDITIONAL)
  7259. (.str name "$pack $FRinti,$FRintj,$FRintk,$CCi,$cond")
  7260. (+ pack FRintk op FRinti CCi cond ope FRintj)
  7261. (if (eq CCi (or cond 2))
  7262. (set FRintk (operation FRinti FRintj)))
  7263. ((fr400 (unit u-media-1)) (fr450 (unit u-media-1))
  7264. (fr500 (unit u-media)) (fr550 (unit u-media)))
  7265. )
  7266. )
  7267. (conditional-media-logic cmand and OP_70 OPE4_0 "conditional and reg/reg")
  7268. (conditional-media-logic cmor or OP_70 OPE4_1 "conditional or reg/reg")
  7269. (conditional-media-logic cmxor xor OP_70 OPE4_2 "conditional xor reg/reg")
  7270. (dni mnot
  7271. ("mnot")
  7272. ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2)
  7273. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  7274. ("mnot$pack $FRintj,$FRintk")
  7275. (+ pack FRintk OP_7B (rs-null) OPE1_03 FRintj)
  7276. (set FRintk (inv FRintj))
  7277. ((fr400 (unit u-media-1)) (fr450 (unit u-media-1))
  7278. (fr500 (unit u-media)) (fr550 (unit u-media)))
  7279. )
  7280. (dni cmnot
  7281. ("cmnot")
  7282. ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2)
  7283. (FR400-MAJOR M-1) (FR450-MAJOR M-1) CONDITIONAL)
  7284. ("cmnot$pack $FRintj,$FRintk,$CCi,$cond")
  7285. (+ pack FRintk OP_70 (rs-null) CCi cond OPE4_3 FRintj)
  7286. (if (eq CCi (or cond 2))
  7287. (set FRintk (inv FRintj)))
  7288. ((fr400 (unit u-media-1)) (fr450 (unit u-media-1))
  7289. (fr500 (unit u-media)) (fr550 (unit u-media)))
  7290. )
  7291. (define-pmacro (media-rotate-r-r name operation op ope comment)
  7292. (dni name
  7293. (comment)
  7294. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  7295. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  7296. (.str name "$pack $FRinti,$u6,$FRintk")
  7297. (+ pack FRintk op FRinti ope u6)
  7298. (set FRintk (operation FRinti (and u6 #x1f)))
  7299. ((fr400 (unit u-media-3)) (fr450 (unit u-media-3))
  7300. (fr500 (unit u-media)) (fr550 (unit u-media)))
  7301. )
  7302. )
  7303. (media-rotate-r-r mrotli rol OP_7B OPE1_04 "rotate left reg/reg")
  7304. (media-rotate-r-r mrotri ror OP_7B OPE1_05 "rotate right reg/reg")
  7305. (define-pmacro (media-cut-r-r name arg op ope comment)
  7306. (dni name
  7307. (comment)
  7308. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  7309. (FR400-MAJOR M-2) (FR450-MAJOR M-2))
  7310. (.str name "$pack $FRinti,$" arg ",$FRintk")
  7311. (+ pack FRintk op FRinti ope arg)
  7312. (set FRintk (c-call SI "@cpu@_cut" FRinti (nextreg h-fr_int FRinti 1) arg))
  7313. ((fr400 (unit u-media-3)) (fr450 (unit u-media-3))
  7314. (fr500 (unit u-media)) (fr550 (unit u-media)))
  7315. )
  7316. )
  7317. (media-cut-r-r mwcut FRintj OP_7B OPE1_06 "media cut")
  7318. (media-cut-r-r mwcuti u6 OP_7B OPE1_07 "media cut")
  7319. (define-pmacro (media-cut-acc name arg op ope fr450-major comment)
  7320. (dni name
  7321. (comment)
  7322. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  7323. (FR400-MAJOR M-1) (FR450-MAJOR fr450-major))
  7324. (.str name "$pack $ACC40Si,$" arg ",$FRintk")
  7325. (+ pack FRintk op ACC40Si ope arg)
  7326. (set FRintk (c-call SI "@cpu@_media_cut" ACC40Si arg))
  7327. ((fr400 (unit u-media-4)) (fr450 (unit u-media-4))
  7328. (fr500 (unit u-media)) (fr550 (unit u-media-3-acc)))
  7329. )
  7330. )
  7331. (media-cut-acc mcut FRintj OP_7B OPE1_2C M-1 "media accumulator cut reg")
  7332. (media-cut-acc mcuti s6 OP_7B OPE1_2E M-5 "media accumulator cut immed")
  7333. (define-pmacro (media-cut-acc-ss name arg op ope fr450-major comment)
  7334. (dni name
  7335. (comment)
  7336. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  7337. (FR400-MAJOR M-1) (FR450-MAJOR fr450-major))
  7338. (.str name "$pack $ACC40Si,$" arg ",$FRintk")
  7339. (+ pack FRintk op ACC40Si ope arg)
  7340. (set FRintk (c-call SI "@cpu@_media_cut_ss" ACC40Si arg))
  7341. ((fr400 (unit u-media-4)) (fr450 (unit u-media-4))
  7342. (fr500 (unit u-media)) (fr550 (unit u-media-3-acc)))
  7343. )
  7344. )
  7345. (media-cut-acc-ss mcutss FRintj OP_7B OPE1_2D M-1 "media accumulator cut reg with saturation")
  7346. (media-cut-acc-ss mcutssi s6 OP_7B OPE1_2F M-5 "media accumulator cut immed with saturation")
  7347. ; Dual Media Instructions
  7348. ;
  7349. (define-pmacro (register-unaligned register alignment)
  7350. (and (index-of register) (sub alignment 1))
  7351. )
  7352. (dni mdcutssi
  7353. "Media dual cut with signed saturation"
  7354. ((UNIT MDCUTSSI) (MACH fr400,fr450,fr550) (FR550-MAJOR M-3)
  7355. (FR400-MAJOR M-2) (FR450-MAJOR M-6))
  7356. "mdcutssi$pack $ACC40Si,$s6,$FRintkeven"
  7357. (+ pack FRintkeven OP_78 ACC40Si OPE1_0E s6)
  7358. (if (register-unaligned ACC40Si 2)
  7359. (c-call VOID "@cpu@_media_acc_not_aligned")
  7360. (if (register-unaligned FRintkeven 2)
  7361. (c-call VOID "@cpu@_media_register_not_aligned")
  7362. (sequence ()
  7363. (set FRintkeven (c-call SI "@cpu@_media_cut_ss" ACC40Si s6))
  7364. (set (nextreg h-fr_int FRintkeven 1)
  7365. (c-call SI "@cpu@_media_cut_ss"
  7366. (nextreg h-acc40S ACC40Si 1) s6)))))
  7367. ((fr400 (unit u-media-4-acc-dual
  7368. (out FRintk FRintkeven)))
  7369. (fr450 (unit u-media-4-acc-dual
  7370. (out FRintk FRintkeven)))
  7371. (fr550 (unit u-media-3-acc-dual)))
  7372. )
  7373. ; The (add (xxxx) (mul arg 0)) is a hack to get a reference to arg generated
  7374. ; so it will be passed to the unit modelers. YUCK!!!!!
  7375. (define-pmacro (extract-hilo reg1 off1 reg2 off2 arg1hi arg1lo arg2hi arg2lo)
  7376. (sequence ()
  7377. (set arg1hi (add (halfword hi reg1 off1) (mul reg1 0)))
  7378. (set arg1lo (add (halfword lo reg1 off1) (mul reg1 0)))
  7379. (set arg2hi (add (halfword hi reg2 off2) (mul reg2 0)))
  7380. (set arg2lo (add (halfword lo reg2 off2) (mul reg2 0))))
  7381. )
  7382. (dni maveh
  7383. "Media dual average"
  7384. ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2)
  7385. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  7386. "maveh$pack $FRinti,$FRintj,$FRintk"
  7387. (+ pack FRintk OP_7B FRinti OPE1_08 FRintj)
  7388. (set FRintk (c-call SI "@cpu@_media_average" FRinti FRintj))
  7389. ((fr400 (unit u-media-1)) (fr450 (unit u-media-1))
  7390. (fr500 (unit u-media)) (fr550 (unit u-media)))
  7391. )
  7392. (define-pmacro (media-dual-shift name operation op ope profile comment)
  7393. (dni name
  7394. (comment)
  7395. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  7396. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  7397. (.str name "$pack $FRinti,$u6,$FRintk")
  7398. (+ pack FRintk op FRinti ope u6)
  7399. (sequence ()
  7400. ; hack to get these referenced for profiling
  7401. (set FRinti (c-raw-call SI "frv_ref_SI" FRinti))
  7402. (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
  7403. (set (halfword hi FRintk 0)
  7404. (operation (halfword hi FRinti 0) (and u6 #xf)))
  7405. (set (halfword lo FRintk 0)
  7406. (operation (halfword lo FRinti 0) (and u6 #xf))))
  7407. profile
  7408. )
  7409. )
  7410. (media-dual-shift msllhi sll OP_7B OPE1_09
  7411. ((fr400 (unit u-media-3)) (fr450 (unit u-media-3))
  7412. (fr500 (unit u-media)) (fr550 (unit u-media)))
  7413. "Media dual shift left logical")
  7414. (media-dual-shift msrlhi srl OP_7B OPE1_0A
  7415. ((fr400 (unit u-media-3)) (fr450 (unit u-media-3))
  7416. (fr500 (unit u-media)) (fr550 (unit u-media)))
  7417. "Media dual shift right logical")
  7418. (media-dual-shift msrahi sra OP_7B OPE1_0B
  7419. ((fr400 (unit u-media-6)) (fr450 (unit u-media-6))
  7420. (fr500 (unit u-media)) (fr550 (unit u-media)))
  7421. "Media dual shift right arithmetic")
  7422. (define-pmacro (media-dual-word-rotate-r-r name operation op ope comment)
  7423. (dni name
  7424. (comment)
  7425. ((UNIT FMLOW) (MACH fr400,fr450,fr550) (FR550-MAJOR M-3)
  7426. (FR400-MAJOR M-2) (FR450-MAJOR M-2))
  7427. (.str name "$pack $FRintieven,$s6,$FRintkeven")
  7428. (+ pack FRintkeven op FRintieven ope s6)
  7429. (if (orif (register-unaligned FRintieven 2)
  7430. (register-unaligned FRintkeven 2))
  7431. (c-call VOID "@cpu@_media_register_not_aligned")
  7432. (sequence ()
  7433. (set FRintkeven (operation FRintieven (and s6 #x1f)))
  7434. (set (nextreg h-fr_int FRintkeven 1)
  7435. (operation (nextreg h-fr_int FRintieven 1)
  7436. (and s6 #x1f)))))
  7437. ((fr400 (unit u-media-3-quad
  7438. (in FRinti FRintieven)
  7439. (out FRintk FRintkeven)))
  7440. (fr450 (unit u-media-3-quad
  7441. (in FRinti FRintieven)
  7442. (out FRintk FRintkeven)))
  7443. (fr550 (unit u-media-quad)))
  7444. )
  7445. )
  7446. (media-dual-word-rotate-r-r mdrotli rol OP_78 OPE1_0B "rotate left reg/reg")
  7447. (dni mcplhi
  7448. "Media bit concatenate, halfword"
  7449. ((UNIT FMLOW) (MACH fr400,fr450,fr550) (FR550-MAJOR M-3)
  7450. (FR400-MAJOR M-2) (FR450-MAJOR M-2))
  7451. "mcplhi$pack $FRinti,$u6,$FRintk"
  7452. (+ pack FRintk OP_78 FRinti OPE1_0C u6)
  7453. (sequence ((HI arg1) (HI arg2) (HI shift))
  7454. (set FRinti (c-raw-call SI "frv_ref_SI" FRinti))
  7455. (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
  7456. (set shift (and u6 #xf))
  7457. (set arg1 (sll (halfword hi FRinti 0) shift))
  7458. (if (ne shift 0)
  7459. (sequence ()
  7460. (set arg2 (halfword hi FRinti 1))
  7461. (set arg2 (srl HI (sll HI arg2 (sub 15 shift))
  7462. (sub 15 shift)))
  7463. (set arg1 (or HI arg1 arg2))))
  7464. (set (halfword hi FRintk 0) arg1))
  7465. ((fr400 (unit u-media-3-dual)) (fr450 (unit u-media-3-dual))
  7466. (fr550 (unit u-media-3-dual)))
  7467. )
  7468. (dni mcpli
  7469. "Media bit concatenate, word"
  7470. ((UNIT FMLOW) (MACH fr400,fr450,fr550) (FR550-MAJOR M-3)
  7471. (FR400-MAJOR M-2) (FR450-MAJOR M-2))
  7472. "mcpli$pack $FRinti,$u6,$FRintk"
  7473. (+ pack FRintk OP_78 FRinti OPE1_0D u6)
  7474. (sequence ((SI tmp) (SI shift))
  7475. (set shift (and u6 #x1f))
  7476. (set tmp (sll FRinti shift))
  7477. (if (ne shift 0)
  7478. (sequence ((SI tmp1))
  7479. (set tmp1 (srl (sll (nextreg h-fr_int FRinti 1)
  7480. (sub 31 shift))
  7481. (sub 31 shift)))
  7482. (set tmp (or tmp tmp1))))
  7483. (set FRintk tmp))
  7484. ((fr400 (unit u-media-3-dual)) (fr450 (unit u-media-3-dual))
  7485. (fr550 (unit u-media-3-dual)))
  7486. )
  7487. (define-pmacro (saturate arg max min result)
  7488. (if (gt arg max)
  7489. (set result max)
  7490. (if (lt arg min)
  7491. (set result min)
  7492. (set result arg)))
  7493. )
  7494. (dni msaths
  7495. "Media dual saturation signed"
  7496. ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2)
  7497. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  7498. "msaths$pack $FRinti,$FRintj,$FRintk"
  7499. (+ pack FRintk OP_7B FRinti OPE1_0C FRintj)
  7500. (sequence ((HI argihi) (HI argilo) (HI argjhi) (HI argjlo))
  7501. (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
  7502. (saturate argihi argjhi (inv argjhi) (halfword hi FRintk 0))
  7503. (saturate argilo argjlo (inv argjlo) (halfword lo FRintk 0)))
  7504. ((fr400 (unit u-media-1)) (fr450 (unit u-media-1))
  7505. (fr500 (unit u-media)) (fr550 (unit u-media)))
  7506. )
  7507. (dni mqsaths
  7508. "Media quad saturation signed"
  7509. ((UNIT FMALL) (MACH fr400,fr450,fr550) (FR550-MAJOR M-2)
  7510. (FR400-MAJOR M-2) (FR450-MAJOR M-2))
  7511. "mqsaths$pack $FRintieven,$FRintjeven,$FRintkeven"
  7512. (+ pack FRintkeven OP_78 FRintieven OPE1_0F FRintjeven)
  7513. (if (orif (register-unaligned FRintieven 2)
  7514. (orif (register-unaligned FRintjeven 2)
  7515. (register-unaligned FRintkeven 2)))
  7516. (c-call VOID "@cpu@_media_register_not_aligned")
  7517. (sequence ((HI argihi) (HI argilo) (HI argjhi) (HI argjlo))
  7518. ; hack to get FRintkeven referenced as a target for profiling
  7519. (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
  7520. (extract-hilo FRintieven 0 FRintjeven 0 argihi argilo argjhi argjlo)
  7521. (saturate argihi argjhi (inv argjhi) (halfword hi FRintkeven 0))
  7522. (saturate argilo argjlo (inv argjlo) (halfword lo FRintkeven 0))
  7523. (extract-hilo FRintieven 1 FRintjeven 1 argihi argilo argjhi argjlo)
  7524. (saturate argihi argjhi (inv argjhi) (halfword hi FRintkeven 1))
  7525. (saturate argilo argjlo (inv argjlo) (halfword lo FRintkeven 1))))
  7526. ((fr400 (unit u-media-1-quad
  7527. (in FRinti FRintieven)
  7528. (in FRintj FRintjeven)
  7529. (out FRintk FRintkeven)))
  7530. (fr450 (unit u-media-1-quad
  7531. (in FRinti FRintieven)
  7532. (in FRintj FRintjeven)
  7533. (out FRintk FRintkeven)))
  7534. (fr550 (unit u-media-quad)))
  7535. )
  7536. (define-pmacro (saturate-unsigned arg max result)
  7537. (if (gt arg max)
  7538. (set result max)
  7539. (set result arg))
  7540. )
  7541. (dni msathu
  7542. "Media dual saturation unsigned"
  7543. ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2)
  7544. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  7545. "msathu$pack $FRinti,$FRintj,$FRintk"
  7546. (+ pack FRintk OP_7B FRinti OPE1_0D FRintj)
  7547. (sequence ((UHI argihi) (UHI argilo) (UHI argjhi) (UHI argjlo))
  7548. (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
  7549. (saturate-unsigned argihi argjhi (halfword hi FRintk 0))
  7550. (saturate-unsigned argilo argjlo (halfword lo FRintk 0)))
  7551. ((fr400 (unit u-media-1)) (fr450 (unit u-media-1))
  7552. (fr500 (unit u-media)) (fr550 (unit u-media)))
  7553. )
  7554. (define-pmacro (media-dual-compare name mode op ope comment)
  7555. (dni name
  7556. (comment)
  7557. ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2)
  7558. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  7559. (.str name "$pack $FRinti,$FRintj,$FCCk")
  7560. (+ pack (cond-null) FCCk op FRinti ope FRintj)
  7561. (if (register-unaligned FCCk 2)
  7562. (c-call VOID "@cpu@_media_cr_not_aligned")
  7563. (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
  7564. (extract-hilo FRinti 0 FRintj 0
  7565. argihi argilo argjhi argjlo)
  7566. (compare-and-set-fcc argihi argjhi FCCk)
  7567. (compare-and-set-fcc argilo argjlo (nextreg h-fccr FCCk 1))))
  7568. ; TODO - doesn't handle second FCC
  7569. ((fr400 (unit u-media-7)) (fr450 (unit u-media-7))
  7570. (fr500 (unit u-media)) (fr550 (unit u-media)))
  7571. )
  7572. )
  7573. (media-dual-compare mcmpsh HI OP_7B OPE1_0E "Media dual compare signed")
  7574. (media-dual-compare mcmpuh UHI OP_7B OPE1_0F "Media dual compare unsigned")
  7575. ; Bits for the MSR.SIE field
  7576. (define-pmacro (msr-sie-nil) 0)
  7577. (define-pmacro (msr-sie-fri-hi) 8)
  7578. (define-pmacro (msr-sie-fri-lo) 4)
  7579. (define-pmacro (msr-sie-fri-1-hi) 2)
  7580. (define-pmacro (msr-sie-fri-1-lo) 1)
  7581. (define-pmacro (msr-sie-acci) 8)
  7582. (define-pmacro (msr-sie-acci-1) 4)
  7583. (define-pmacro (msr-sie-acci-2) 2)
  7584. (define-pmacro (msr-sie-acci-3) 1)
  7585. (define-pmacro (saturate-v arg max min sie result)
  7586. (if (gt DI arg max)
  7587. (sequence ()
  7588. (set result max)
  7589. (c-call VOID "@cpu@_media_overflow" sie))
  7590. (if (lt DI arg min)
  7591. (sequence ()
  7592. (set result min)
  7593. (c-call VOID "@cpu@_media_overflow" sie))
  7594. (set result arg)))
  7595. )
  7596. (dni mabshs
  7597. "Media dual absolute value, halfword"
  7598. ((UNIT FMALL) (MACH fr400,fr450,fr550) (FR550-MAJOR M-2)
  7599. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  7600. "mabshs$pack $FRintj,$FRintk"
  7601. (+ pack FRintk OP_78 (FRi-null) OPE1_0A FRintj)
  7602. (sequence ((HI arghi) (HI arglo))
  7603. (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
  7604. (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
  7605. (set arghi (halfword hi FRintj 0))
  7606. (set arglo (halfword lo FRintj 0))
  7607. ; We extend the argument before the abs operation so we can
  7608. ; notice -32768 overflowing as 32768.
  7609. (saturate-v (abs (ext DI arghi)) 32767 -32768 (msr-sie-fri-hi)
  7610. (halfword hi FRintk 0))
  7611. (saturate-v (abs (ext DI arglo)) 32767 -32768 (msr-sie-fri-lo)
  7612. (halfword lo FRintk 0)))
  7613. ((fr400 (unit u-media-1)) (fr450 (unit u-media-1))
  7614. (fr550 (unit u-media)))
  7615. )
  7616. ; How to extend from a mode to get the intended signedness.
  7617. (define-pmacro (DI-ext-HI x) (ext DI x))
  7618. (define-pmacro (DI-ext-UHI x) (zext DI x))
  7619. (define-pmacro (DI-ext-DI x) x)
  7620. (define-pmacro (media-arith-sat-semantics
  7621. operation arg1 arg2 res mode max min sie)
  7622. (sequence ((DI tmp))
  7623. ; Make sure we saturate at max/min against a value that is
  7624. ; sign- or zero-extended appropriately from "mode".
  7625. (set tmp (operation DI
  7626. ((.sym DI-ext- mode) arg1) ((.sym DI-ext- mode) arg2)))
  7627. (saturate-v tmp max min sie res))
  7628. )
  7629. (define-pmacro (media-dual-arith-sat-semantics operation mode max min)
  7630. (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
  7631. (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
  7632. (media-arith-sat-semantics operation argihi argjhi
  7633. (halfword hi FRintk 0) mode max min
  7634. (msr-sie-fri-hi))
  7635. (media-arith-sat-semantics operation argilo argjlo
  7636. (halfword lo FRintk 0) mode max min
  7637. (msr-sie-fri-lo)))
  7638. )
  7639. (define-pmacro (media-dual-arith-sat name operation mode max min op ope comment)
  7640. (dni name
  7641. (comment)
  7642. ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2)
  7643. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  7644. (.str name "$pack $FRinti,$FRintj,$FRintk")
  7645. (+ pack FRintk op FRinti ope FRintj)
  7646. (media-dual-arith-sat-semantics operation mode max min)
  7647. ((fr400 (unit u-media-1)) (fr450 (unit u-media-1))
  7648. (fr500 (unit u-media)) (fr550 (unit u-media)))
  7649. )
  7650. )
  7651. (media-dual-arith-sat maddhss add HI 32767 -32768 OP_7B OPE1_10 "Media dual add signed with saturation")
  7652. (media-dual-arith-sat maddhus add UHI 65535 0 OP_7B OPE1_11 "Media dual add unsigned with saturation")
  7653. (media-dual-arith-sat msubhss sub HI 32767 -32768 OP_7B OPE1_12 "Media dual sub signed with saturation")
  7654. (media-dual-arith-sat msubhus sub UHI 65535 0 OP_7B OPE1_13 "Media dual sub unsigned with saturation")
  7655. (define-pmacro (conditional-media-dual-arith-sat
  7656. name operation mode max min op ope comment)
  7657. (dni name
  7658. (comment)
  7659. ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2)
  7660. (FR400-MAJOR M-1) (FR450-MAJOR M-1) CONDITIONAL)
  7661. (.str name "$pack $FRinti,$FRintj,$FRintk,$CCi,$cond")
  7662. (+ pack FRintk op FRinti CCi cond ope FRintj)
  7663. (if (eq CCi (or cond 2))
  7664. (media-dual-arith-sat-semantics operation mode max min))
  7665. ((fr400 (unit u-media-1)) (fr450 (unit u-media-1))
  7666. (fr500 (unit u-media)) (fr550 (unit u-media)))
  7667. )
  7668. )
  7669. (conditional-media-dual-arith-sat cmaddhss add HI 32767 -32768 OP_71 OPE4_0 "Conditional Media dual add signed with saturation")
  7670. (conditional-media-dual-arith-sat cmaddhus add UHI 65535 0 OP_71 OPE4_1 "Conditional Media dual add unsigned with saturation")
  7671. (conditional-media-dual-arith-sat cmsubhss sub HI 32767 -32768 OP_71 OPE4_2 "Conditional Media dual sub signed with saturation")
  7672. (conditional-media-dual-arith-sat cmsubhus sub UHI 65535 0 OP_71 OPE4_3 "Conditional Media dual sub unsigned with saturation")
  7673. (define-pmacro (media-quad-arith-sat-semantics cond operation mode max min)
  7674. (if (orif (register-unaligned FRintieven 2)
  7675. (orif (register-unaligned FRintjeven 2)
  7676. (register-unaligned FRintkeven 2)))
  7677. (c-call VOID "@cpu@_media_register_not_aligned")
  7678. (if cond
  7679. (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
  7680. ; hack to get FRintkeven referenced as a target for profiling
  7681. (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
  7682. (extract-hilo FRintieven 0 FRintjeven 0
  7683. argihi argilo argjhi argjlo)
  7684. (media-arith-sat-semantics operation argihi argjhi
  7685. (halfword hi FRintkeven 0) mode
  7686. max min (msr-sie-fri-hi))
  7687. (media-arith-sat-semantics operation argilo argjlo
  7688. (halfword lo FRintkeven 0) mode
  7689. max min (msr-sie-fri-lo))
  7690. (extract-hilo FRintieven 1 FRintjeven 1
  7691. argihi argilo argjhi argjlo)
  7692. (media-arith-sat-semantics operation argihi argjhi
  7693. (halfword hi FRintkeven 1) mode
  7694. max min (msr-sie-fri-1-hi))
  7695. (media-arith-sat-semantics operation argilo argjlo
  7696. (halfword lo FRintkeven 1) mode
  7697. max min (msr-sie-fri-1-lo)))))
  7698. )
  7699. (define-pmacro (media-quad-arith-sat name operation mode max min op ope comment)
  7700. (dni name
  7701. (comment)
  7702. ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2)
  7703. (FR400-MAJOR M-2) (FR450-MAJOR M-2))
  7704. (.str name "$pack $FRintieven,$FRintjeven,$FRintkeven")
  7705. (+ pack FRintkeven op FRintieven ope FRintjeven)
  7706. (media-quad-arith-sat-semantics 1 operation mode max min)
  7707. ((fr400 (unit u-media-1-quad
  7708. (in FRinti FRintieven)
  7709. (in FRintj FRintjeven)
  7710. (out FRintk FRintkeven)))
  7711. (fr450 (unit u-media-1-quad
  7712. (in FRinti FRintieven)
  7713. (in FRintj FRintjeven)
  7714. (out FRintk FRintkeven)))
  7715. (fr500 (unit u-media-quad-arith
  7716. (in FRinti FRintieven)
  7717. (in FRintj FRintjeven)
  7718. (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
  7719. )
  7720. )
  7721. (media-quad-arith-sat mqaddhss add HI 32767 -32768 OP_7B OPE1_18 "Media quad add signed with saturation")
  7722. (media-quad-arith-sat mqaddhus add UHI 65535 0 OP_7B OPE1_19 "Media quad add unsigned with saturation")
  7723. (media-quad-arith-sat mqsubhss sub HI 32767 -32768 OP_7B OPE1_1A "Media quad sub signed with saturation")
  7724. (media-quad-arith-sat mqsubhus sub UHI 65535 0 OP_7B OPE1_1B "Media quad sub unsigned with saturation")
  7725. (define-pmacro (conditional-media-quad-arith-sat
  7726. name operation mode max min op ope comment)
  7727. (dni name
  7728. (comment)
  7729. ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2)
  7730. (FR400-MAJOR M-2) (FR450-MAJOR M-2) CONDITIONAL)
  7731. (.str name "$pack $FRintieven,$FRintjeven,$FRintkeven,$CCi,$cond")
  7732. (+ pack FRintkeven op FRintieven CCi cond ope FRintjeven)
  7733. (media-quad-arith-sat-semantics (eq CCi (or cond 2))
  7734. operation mode max min)
  7735. ((fr400 (unit u-media-1-quad
  7736. (in FRinti FRintieven)
  7737. (in FRintj FRintjeven)
  7738. (out FRintk FRintkeven)))
  7739. (fr450 (unit u-media-1-quad
  7740. (in FRinti FRintieven)
  7741. (in FRintj FRintjeven)
  7742. (out FRintk FRintkeven)))
  7743. (fr500 (unit u-media-quad-arith
  7744. (in FRinti FRintieven)
  7745. (in FRintj FRintjeven)
  7746. (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
  7747. )
  7748. )
  7749. (conditional-media-quad-arith-sat cmqaddhss add HI 32767 -32768 OP_73 OPE4_0 "Conditional Media quad add signed with saturation")
  7750. (conditional-media-quad-arith-sat cmqaddhus add UHI 65535 0 OP_73 OPE4_1 "Conditional Media quad add unsigned with saturation")
  7751. (conditional-media-quad-arith-sat cmqsubhss sub HI 32767 -32768 OP_73 OPE4_2 "Conditional Media quad sub signed with saturation")
  7752. (conditional-media-quad-arith-sat cmqsubhus sub UHI 65535 0 OP_73 OPE4_3 "Conditional Media quad sub unsigned with saturation")
  7753. ;; Return A if |A| > |B| and B is positive. Return -A if |A| > |B| and
  7754. ;; B is negative, saturating 0x8000 as 0x7fff. Return 0 otherwise.
  7755. (define-pmacro (media-low-clear-semantics a b)
  7756. (cond HI
  7757. ((le UHI (abs a) (abs b)) 0)
  7758. ((le HI 0 b) a)
  7759. ((eq HI a -32768) 32767)
  7760. (else (neg a))))
  7761. ;; Return A if -|B| < A < |B|. Return -B if A <= -|B|, saturating 0x8000
  7762. ;; as 0x7fff. Return B if A >= |B|.
  7763. (define-pmacro (media-scope-limit-semantics a b)
  7764. (cond HI
  7765. ((andif (gt HI b -32768)
  7766. (ge HI a (abs b))) b)
  7767. ((gt HI a (neg (abs b))) a)
  7768. ((eq HI b -32768) 32767)
  7769. (else (neg b))))
  7770. (define-pmacro (media-quad-limit name operation op ope comment)
  7771. (dni name
  7772. comment
  7773. ((UNIT FM0) (MACH fr450) (FR450-MAJOR M-2))
  7774. (.str name "$pack $FRintieven,$FRintjeven,$FRintkeven")
  7775. (+ pack FRintkeven op FRintieven ope FRintjeven)
  7776. (if (orif (register-unaligned FRintieven 2)
  7777. (orif (register-unaligned FRintjeven 2)
  7778. (register-unaligned FRintkeven 2)))
  7779. (c-call VOID "@cpu@_media_register_not_aligned")
  7780. (sequence ((HI a1) (HI a2) (HI a3) (HI a4)
  7781. (HI b1) (HI b2) (HI b3) (HI b4))
  7782. ; hack to get FRintkeven referenced as a target
  7783. ; for profiling
  7784. (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
  7785. (extract-hilo FRintieven 0 FRintjeven 0 a1 a2 b1 b2)
  7786. (extract-hilo FRintieven 1 FRintjeven 1 a3 a4 b3 b4)
  7787. (set (halfword hi FRintkeven 0) (operation a1 b1))
  7788. (set (halfword lo FRintkeven 0) (operation a2 b2))
  7789. (set (halfword hi FRintkeven 1) (operation a3 b3))
  7790. (set (halfword lo FRintkeven 1) (operation a4 b4))))
  7791. ((fr450 (unit u-media-1-quad
  7792. (in FRinti FRintieven)
  7793. (in FRintj FRintjeven)
  7794. (out FRintk FRintkeven))))
  7795. )
  7796. )
  7797. (media-quad-limit mqlclrhs media-low-clear-semantics OP_78 OPE1_10
  7798. "Media quad low clear")
  7799. (media-quad-limit mqlmths media-scope-limit-semantics OP_78 OPE1_14
  7800. "Media quad scope limitation")
  7801. (define-pmacro (media-quad-shift name operation op ope comment)
  7802. (dni name
  7803. (comment)
  7804. ((UNIT FM0) (MACH fr450) (FR450-MAJOR M-2))
  7805. (.str name "$pack $FRintieven,$u6,$FRintkeven")
  7806. (+ pack FRintkeven op FRintieven ope u6)
  7807. (if (orif (register-unaligned FRintieven 2)
  7808. (register-unaligned FRintkeven 2))
  7809. (c-call VOID "@cpu@_media_register_not_aligned")
  7810. (sequence ()
  7811. ; hack to get these referenced for profiling
  7812. (set FRintieven (c-raw-call SI "frv_ref_SI" FRintieven))
  7813. (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
  7814. (set (halfword hi FRintkeven 0)
  7815. (operation HI (halfword hi FRintieven 0)
  7816. (and u6 #xf)))
  7817. (set (halfword lo FRintkeven 0)
  7818. (operation HI (halfword lo FRintieven 0)
  7819. (and u6 #xf)))
  7820. (set (halfword hi FRintkeven 1)
  7821. (operation HI (halfword hi FRintieven 1)
  7822. (and u6 #xf)))
  7823. (set (halfword lo FRintkeven 1)
  7824. (operation HI (halfword lo FRintieven 1)
  7825. (and u6 #xf)))))
  7826. ((fr450 (unit u-media-3-quad
  7827. (in FRinti FRintieven)
  7828. (in FRintj FRintieven)
  7829. (out FRintk FRintkeven))))
  7830. )
  7831. )
  7832. (media-quad-shift mqsllhi sll OP_78 OPE1_11 "Media quad left shift")
  7833. (media-quad-shift mqsrahi sra OP_78 OPE1_13 "Media quad right shift")
  7834. (define-pmacro (media-acc-arith-sat name operation mode max min op ope comment)
  7835. (dni name
  7836. (comment)
  7837. ((UNIT FMALL) (MACH fr400,fr450,fr550) (FR550-MAJOR M-4)
  7838. (FR400-MAJOR M-1) (FR450-MAJOR M-3))
  7839. (.str name "$pack $ACC40Si,$ACC40Sk")
  7840. (+ pack ACC40Sk op ACC40Si ope (ACCj-null))
  7841. (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
  7842. (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
  7843. (if (register-unaligned ACC40Si 2)
  7844. (c-call VOID "@cpu@_media_acc_not_aligned")
  7845. (media-arith-sat-semantics operation ACC40Si
  7846. (nextreg h-acc40S ACC40Si 1)
  7847. ACC40Sk mode max min (msr-sie-acci)))))
  7848. ((fr400 (unit u-media-2-acc)) (fr450 (unit u-media-2-acc))
  7849. (fr550 (unit u-media-4-acc)))
  7850. )
  7851. )
  7852. (media-acc-arith-sat maddaccs add DI #x7fffffffff (inv DI #x7fffffffff)
  7853. OP_78 OPE1_04 "Media accumulator addition")
  7854. (media-acc-arith-sat msubaccs sub DI #x7fffffffff (inv DI #x7fffffffff)
  7855. OP_78 OPE1_05 "Media accumulator subtraction")
  7856. (define-pmacro (media-dual-acc-arith-sat name operation mode max min op ope
  7857. comment)
  7858. (dni name
  7859. (comment)
  7860. ((UNIT MDUALACC) (MACH fr400,fr450,fr550) (FR550-MAJOR M-4)
  7861. (FR400-MAJOR M-2) (FR450-MAJOR M-4))
  7862. (.str name "$pack $ACC40Si,$ACC40Sk")
  7863. (+ pack ACC40Sk op ACC40Si ope (ACCj-null))
  7864. (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
  7865. (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
  7866. (if (register-unaligned ACC40Si 4)
  7867. (c-call VOID "@cpu@_media_acc_not_aligned")
  7868. (if (register-unaligned ACC40Sk 2)
  7869. (c-call VOID "@cpu@_media_acc_not_aligned")
  7870. (sequence ()
  7871. (media-arith-sat-semantics operation ACC40Si
  7872. (nextreg h-acc40S ACC40Si 1)
  7873. ACC40Sk mode max min
  7874. (msr-sie-acci))
  7875. (media-arith-sat-semantics operation
  7876. (nextreg h-acc40S ACC40Si 2)
  7877. (nextreg h-acc40S ACC40Si 3)
  7878. (nextreg h-acc40S ACC40Sk 1)
  7879. mode max min
  7880. (msr-sie-acci-1)))))))
  7881. ((fr400 (unit u-media-2-acc-dual)) (fr450 (unit u-media-2-acc-dual))
  7882. (fr550 (unit u-media-4-acc-dual)))
  7883. )
  7884. )
  7885. (media-dual-acc-arith-sat mdaddaccs add DI #x7fffffffff (inv DI #x7fffffffff)
  7886. OP_78 OPE1_06 "Media accumulator addition")
  7887. (media-dual-acc-arith-sat mdsubaccs sub DI #x7fffffffff (inv DI #x7fffffffff)
  7888. OP_78 OPE1_07 "Media accumulator subtraction")
  7889. (dni masaccs
  7890. "Media add and subtract signed accumulator with saturation"
  7891. ((UNIT FMALL) (MACH fr400,fr450,fr550) (FR550-MAJOR M-4)
  7892. (FR400-MAJOR M-1) (FR450-MAJOR M-3))
  7893. "masaccs$pack $ACC40Si,$ACC40Sk"
  7894. (+ pack ACC40Sk OP_78 ACC40Si OPE1_08 (ACCj-null))
  7895. (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
  7896. (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
  7897. (if (register-unaligned ACC40Si 2)
  7898. (c-call VOID "@cpu@_media_acc_not_aligned")
  7899. (if (register-unaligned ACC40Sk 2)
  7900. (c-call VOID "@cpu@_media_acc_not_aligned")
  7901. (sequence ()
  7902. (media-arith-sat-semantics add ACC40Si
  7903. (nextreg h-acc40S ACC40Si 1)
  7904. ACC40Sk DI
  7905. #x7fffffffff
  7906. (inv DI #x7fffffffff)
  7907. (msr-sie-acci))
  7908. (media-arith-sat-semantics sub ACC40Si
  7909. (nextreg h-acc40S ACC40Si 1)
  7910. (nextreg h-acc40S ACC40Sk 1)
  7911. DI
  7912. #x7fffffffff
  7913. (inv DI #x7fffffffff)
  7914. (msr-sie-acci-1)))))))
  7915. ((fr400 (unit u-media-2-add-sub)) (fr450 (unit u-media-2-add-sub))
  7916. (fr550 (unit u-media-4-add-sub)))
  7917. )
  7918. (dni mdasaccs
  7919. "Media add and subtract signed accumulator with saturation"
  7920. ((UNIT MDUALACC) (MACH fr400,fr450,fr550) (FR550-MAJOR M-4)
  7921. (FR400-MAJOR M-2) (FR450-MAJOR M-4))
  7922. "mdasaccs$pack $ACC40Si,$ACC40Sk"
  7923. (+ pack ACC40Sk OP_78 ACC40Si OPE1_09 (ACCj-null))
  7924. (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
  7925. (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
  7926. (if (register-unaligned ACC40Si 4)
  7927. (c-call VOID "@cpu@_media_acc_not_aligned")
  7928. (if (register-unaligned ACC40Sk 4)
  7929. (c-call VOID "@cpu@_media_acc_not_aligned")
  7930. (sequence ()
  7931. (media-arith-sat-semantics add ACC40Si
  7932. (nextreg h-acc40S ACC40Si 1)
  7933. ACC40Sk DI
  7934. #x7fffffffff
  7935. (inv DI #x7fffffffff)
  7936. (msr-sie-acci))
  7937. (media-arith-sat-semantics sub ACC40Si
  7938. (nextreg h-acc40S ACC40Si 1)
  7939. (nextreg h-acc40S ACC40Sk 1)
  7940. DI
  7941. #x7fffffffff
  7942. (inv DI #x7fffffffff)
  7943. (msr-sie-acci-1))
  7944. (media-arith-sat-semantics add
  7945. (nextreg h-acc40S ACC40Si 2)
  7946. (nextreg h-acc40S ACC40Si 3)
  7947. (nextreg h-acc40S ACC40Sk 2)
  7948. DI
  7949. #x7fffffffff
  7950. (inv DI #x7fffffffff)
  7951. (msr-sie-acci-2))
  7952. (media-arith-sat-semantics sub
  7953. (nextreg h-acc40S ACC40Si 2)
  7954. (nextreg h-acc40S ACC40Si 3)
  7955. (nextreg h-acc40S ACC40Sk 3)
  7956. DI
  7957. #x7fffffffff
  7958. (inv DI #x7fffffffff)
  7959. (msr-sie-acci-3)))))))
  7960. ((fr400 (unit u-media-2-add-sub-dual))
  7961. (fr450 (unit u-media-2-add-sub-dual))
  7962. (fr550 (unit u-media-4-add-sub-dual)))
  7963. )
  7964. (define-pmacro (media-multiply-semantics conv arg1 arg2 res)
  7965. (set res (mul DI (conv DI arg1) (conv DI arg2)))
  7966. )
  7967. (define-pmacro (media-dual-multiply-semantics cond mode conv rhs1 rhs2)
  7968. (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
  7969. (if (register-unaligned ACC40Sk 2)
  7970. (c-call VOID "@cpu@_media_acc_not_aligned")
  7971. (if cond
  7972. (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
  7973. (extract-hilo FRinti 0 FRintj 0
  7974. argihi argilo argjhi argjlo)
  7975. (media-multiply-semantics conv argihi rhs1 ACC40Sk)
  7976. (media-multiply-semantics conv argilo rhs2
  7977. (nextreg h-acc40S ACC40Sk 1))))))
  7978. )
  7979. (define-pmacro (media-dual-multiply name mode conv rhs1 rhs2 op ope comment)
  7980. (dni name
  7981. (comment)
  7982. ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4)
  7983. (FR400-MAJOR M-1) (FR450-MAJOR M-3) PRESERVE-OVF)
  7984. (.str name "$pack $FRinti,$FRintj,$ACC40Sk")
  7985. (+ pack ACC40Sk op FRinti ope FRintj)
  7986. (media-dual-multiply-semantics 1 mode conv rhs1 rhs2)
  7987. ((fr400 (unit u-media-2)) (fr450 (unit u-media-2))
  7988. (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
  7989. )
  7990. )
  7991. (media-dual-multiply mmulhs HI ext argjhi argjlo OP_7B OPE1_14 "Media dual multiply signed")
  7992. (media-dual-multiply mmulhu UHI zext argjhi argjlo OP_7B OPE1_15 "Media dual multiply unsigned")
  7993. (media-dual-multiply mmulxhs HI ext argjlo argjhi OP_7B OPE1_28 "Media dual cross multiply signed")
  7994. (media-dual-multiply mmulxhu UHI zext argjlo argjhi OP_7B OPE1_29 "Media dual cross multiply unsigned")
  7995. (define-pmacro (conditional-media-dual-multiply
  7996. name mode conv rhs1 rhs2 op ope comment)
  7997. (dni name
  7998. (comment)
  7999. ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4)
  8000. (FR400-MAJOR M-1) (FR450-MAJOR M-3)
  8001. PRESERVE-OVF CONDITIONAL)
  8002. (.str name "$pack $FRinti,$FRintj,$ACC40Sk,$CCi,$cond")
  8003. (+ pack ACC40Sk op FRinti CCi cond ope FRintj)
  8004. (media-dual-multiply-semantics (eq CCi (or cond 2)) mode conv rhs1 rhs2)
  8005. ((fr400 (unit u-media-2)) (fr450 (unit u-media-2))
  8006. (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
  8007. )
  8008. )
  8009. (conditional-media-dual-multiply cmmulhs HI ext argjhi argjlo OP_72 OPE4_0 "Conditional Media dual multiply signed")
  8010. (conditional-media-dual-multiply cmmulhu UHI zext argjhi argjlo OP_72 OPE4_1 "Conditional Media dual multiply unsigned")
  8011. (define-pmacro (media-quad-multiply-semantics cond mode conv rhs1 rhs2)
  8012. (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
  8013. (if (register-unaligned ACC40Sk 4)
  8014. (c-call VOID "@cpu@_media_acc_not_aligned")
  8015. (if (orif (register-unaligned FRintieven 2)
  8016. (register-unaligned FRintjeven 2))
  8017. (c-call VOID "@cpu@_media_register_not_aligned")
  8018. (if cond
  8019. (sequence ((mode argihi) (mode argilo)
  8020. (mode argjhi) (mode argjlo))
  8021. (extract-hilo FRintieven 0 FRintjeven 0
  8022. argihi argilo argjhi argjlo)
  8023. (media-multiply-semantics conv argihi rhs1 ACC40Sk)
  8024. (media-multiply-semantics conv argilo rhs2
  8025. (nextreg h-acc40S ACC40Sk 1))
  8026. (extract-hilo FRintieven 1 FRintjeven 1
  8027. argihi argilo argjhi argjlo)
  8028. (media-multiply-semantics conv argihi rhs1
  8029. (nextreg h-acc40S ACC40Sk 2))
  8030. (media-multiply-semantics conv argilo rhs2
  8031. (nextreg h-acc40S ACC40Sk 3)))))))
  8032. )
  8033. (define-pmacro (media-quad-multiply name mode conv rhs1 rhs2 op ope comment)
  8034. (dni name
  8035. (comment)
  8036. ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4)
  8037. (FR400-MAJOR M-2) (FR450-MAJOR M-4) PRESERVE-OVF)
  8038. (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk")
  8039. (+ pack ACC40Sk op FRintieven ope FRintjeven)
  8040. (media-quad-multiply-semantics 1 mode conv rhs1 rhs2)
  8041. ((fr400 (unit u-media-2-quad
  8042. (in FRinti FRintieven)
  8043. (in FRintj FRintjeven)))
  8044. (fr450 (unit u-media-2-quad
  8045. (in FRinti FRintieven)
  8046. (in FRintj FRintjeven)))
  8047. (fr500 (unit u-media-quad-mul
  8048. (in FRinti FRintieven)
  8049. (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
  8050. )
  8051. )
  8052. (media-quad-multiply mqmulhs HI ext argjhi argjlo OP_7B OPE1_1C "Media quad multiply signed")
  8053. (media-quad-multiply mqmulhu UHI zext argjhi argjlo OP_7B OPE1_1D "Media quad multiply unsigned")
  8054. (media-quad-multiply mqmulxhs HI ext argjlo argjhi OP_7B OPE1_2A "Media quad cross multiply signed")
  8055. (media-quad-multiply mqmulxhu UHI zext argjlo argjhi OP_7B OPE1_2B "Media quad cross multiply unsigned")
  8056. (define-pmacro (conditional-media-quad-multiply
  8057. name mode conv rhs1 rhs2 op ope comment)
  8058. (dni name
  8059. (comment)
  8060. ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4)
  8061. (FR400-MAJOR M-2) (FR450-MAJOR M-4)
  8062. PRESERVE-OVF CONDITIONAL)
  8063. (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk,$CCi,$cond")
  8064. (+ pack ACC40Sk op FRintieven CCi cond ope FRintjeven)
  8065. (media-quad-multiply-semantics (eq CCi (or cond 2)) mode conv rhs1 rhs2)
  8066. ((fr400 (unit u-media-2-quad
  8067. (in FRinti FRintieven)
  8068. (in FRintj FRintjeven)))
  8069. (fr450 (unit u-media-2-quad
  8070. (in FRinti FRintieven)
  8071. (in FRintj FRintjeven)))
  8072. (fr500 (unit u-media-quad-mul
  8073. (in FRinti FRintieven)
  8074. (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
  8075. )
  8076. )
  8077. (conditional-media-quad-multiply cmqmulhs HI ext argjhi argjlo OP_74 OPE4_0 "Conditional Media quad multiply signed")
  8078. (conditional-media-quad-multiply cmqmulhu UHI zext argjhi argjlo OP_74 OPE4_1 "Conditional Media quad multiply unsigned")
  8079. (define-pmacro (media-multiply-acc-semantics
  8080. conv arg1 addop arg2 res max min sie)
  8081. (sequence ((DI tmp))
  8082. (set tmp (addop res (mul DI (conv DI arg1) (conv DI arg2))))
  8083. (saturate-v tmp max min sie res))
  8084. )
  8085. (define-pmacro (media-dual-multiply-acc-semantics
  8086. cond mode conv addop rhw res max min)
  8087. (if (c-call SI "@cpu@_check_acc_range" (index-of res))
  8088. (if (register-unaligned res 2)
  8089. (c-call VOID "@cpu@_media_acc_not_aligned")
  8090. (if cond
  8091. (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
  8092. (extract-hilo FRinti 0 FRintj 0
  8093. argihi argilo argjhi argjlo)
  8094. (media-multiply-acc-semantics conv argihi addop argjhi
  8095. res
  8096. max min (msr-sie-acci))
  8097. (media-multiply-acc-semantics conv argilo addop argjlo
  8098. (nextreg rhw res 1)
  8099. max min (msr-sie-acci-1))))))
  8100. )
  8101. (define-pmacro (media-dual-multiply-acc
  8102. name mode conv addop rhw res max min op ope comment)
  8103. (dni name
  8104. (comment)
  8105. ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4)
  8106. (FR400-MAJOR M-1) (FR450-MAJOR M-3))
  8107. (.str name "$pack $FRinti,$FRintj,$" res)
  8108. (+ pack res op FRinti ope FRintj)
  8109. (media-dual-multiply-acc-semantics 1 mode conv addop rhw res max min)
  8110. ((fr400 (unit u-media-2)) (fr450 (unit u-media-2))
  8111. (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
  8112. )
  8113. )
  8114. (media-dual-multiply-acc mmachs HI ext add h-acc40S ACC40Sk
  8115. (const DI #x7fffffffff) (const DI #xffffff8000000000)
  8116. OP_7B OPE1_16
  8117. "Media dual multiply and accumulate signed")
  8118. (media-dual-multiply-acc mmachu UHI zext add h-acc40U ACC40Uk
  8119. (const DI #xffffffffff) (const DI 0)
  8120. OP_7B OPE1_17
  8121. "Media dual multiply and accumulate unsigned")
  8122. (media-dual-multiply-acc mmrdhs HI ext sub h-acc40S ACC40Sk
  8123. (const DI #x7fffffffff) (const DI #xffffff8000000000)
  8124. OP_7B OPE1_30
  8125. "Media dual multiply and reduce signed")
  8126. (media-dual-multiply-acc mmrdhu UHI zext sub h-acc40U ACC40Uk
  8127. (const DI #xffffffffff) (const DI 0)
  8128. OP_7B OPE1_31
  8129. "Media dual multiply and reduce unsigned")
  8130. (define-pmacro (conditional-media-dual-multiply-acc
  8131. name mode conv addop rhw res max min op ope comment)
  8132. (dni name
  8133. (comment)
  8134. ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4)
  8135. (FR400-MAJOR M-1) (FR450-MAJOR M-3) CONDITIONAL)
  8136. (.str name "$pack $FRinti,$FRintj,$" res ",$CCi,$cond")
  8137. (+ pack res op FRinti CCi cond ope FRintj)
  8138. (media-dual-multiply-acc-semantics (eq CCi (or cond 2))
  8139. mode conv addop rhw res max min)
  8140. ((fr400 (unit u-media-2)) (fr450 (unit u-media-2))
  8141. (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
  8142. )
  8143. )
  8144. (conditional-media-dual-multiply-acc cmmachs HI ext add h-acc40S ACC40Sk
  8145. (const DI #x7fffffffff) (const DI #xffffff8000000000)
  8146. OP_72 OPE4_2
  8147. "Conditional Media dual multiply and accumulate signed")
  8148. (conditional-media-dual-multiply-acc cmmachu UHI zext add h-acc40U ACC40Uk
  8149. (const DI #xffffffffff) (const DI 0)
  8150. OP_72 OPE4_3
  8151. "Conditional Media dual multiply and accumulate unsigned")
  8152. (define-pmacro (media-quad-multiply-acc-semantics
  8153. cond mode conv addop rhw res max min)
  8154. (if (c-call SI "@cpu@_check_acc_range" (index-of res))
  8155. (if (register-unaligned res 4)
  8156. (c-call VOID "@cpu@_media_acc_not_aligned")
  8157. (if (orif (register-unaligned FRintieven 2)
  8158. (register-unaligned FRintjeven 2))
  8159. (c-call VOID "@cpu@_media_register_not_aligned")
  8160. (if cond
  8161. (sequence ((mode argihi) (mode argilo)
  8162. (mode argjhi) (mode argjlo))
  8163. (extract-hilo FRintieven 0 FRintjeven 0
  8164. argihi argilo argjhi argjlo)
  8165. (media-multiply-acc-semantics conv argihi addop argjhi
  8166. res
  8167. max min (msr-sie-acci))
  8168. (media-multiply-acc-semantics conv argilo addop argjlo
  8169. (nextreg rhw res 1)
  8170. max min (msr-sie-acci-1))
  8171. (extract-hilo FRintieven 1 FRintjeven 1
  8172. argihi argilo argjhi argjlo)
  8173. (media-multiply-acc-semantics conv argihi addop argjhi
  8174. (nextreg rhw res 2)
  8175. max min (msr-sie-acci-2))
  8176. (media-multiply-acc-semantics conv argilo addop argjlo
  8177. (nextreg rhw res 3)
  8178. max min
  8179. (msr-sie-acci-3)))))))
  8180. )
  8181. (define-pmacro (media-quad-multiply-acc
  8182. name mode conv addop rhw res max min op ope comment)
  8183. (dni name
  8184. (comment)
  8185. ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4)
  8186. (FR400-MAJOR M-2) (FR450-MAJOR M-4))
  8187. (.str name "$pack $FRintieven,$FRintjeven,$" res)
  8188. (+ pack res op FRintieven ope FRintjeven)
  8189. (media-quad-multiply-acc-semantics 1 mode conv addop rhw res max min)
  8190. ((fr400 (unit u-media-2-quad
  8191. (in FRinti FRintieven)
  8192. (in FRintj FRintjeven)))
  8193. (fr450 (unit u-media-2-quad
  8194. (in FRinti FRintieven)
  8195. (in FRintj FRintjeven)))
  8196. (fr500 (unit u-media-quad-mul
  8197. (in FRinti FRintieven)
  8198. (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
  8199. )
  8200. )
  8201. (media-quad-multiply-acc mqmachs HI ext add h-acc40S ACC40Sk
  8202. (const DI #x7fffffffff) (const DI #xffffff8000000000)
  8203. OP_7B OPE1_1E
  8204. "Media quad multiply and accumulate signed")
  8205. (media-quad-multiply-acc mqmachu UHI zext add h-acc40U ACC40Uk
  8206. (const DI #xffffffffff) (const DI 0)
  8207. OP_7B OPE1_1F
  8208. "Media quad multiply and accumulate unsigned")
  8209. (define-pmacro (conditional-media-quad-multiply-acc
  8210. name mode conv addop rhw res max min op ope comment)
  8211. (dni name
  8212. (comment)
  8213. ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4)
  8214. (FR400-MAJOR M-2) (FR450-MAJOR M-4) CONDITIONAL)
  8215. (.str name "$pack $FRintieven,$FRintjeven,$" res ",$CCi,$cond")
  8216. (+ pack res op FRintieven CCi cond ope FRintjeven)
  8217. (media-quad-multiply-acc-semantics (eq CCi (or cond 2))
  8218. mode conv addop rhw res max min)
  8219. ((fr400 (unit u-media-2-quad
  8220. (in FRinti FRintieven)
  8221. (in FRintj FRintjeven)))
  8222. (fr450 (unit u-media-2-quad
  8223. (in FRinti FRintieven)
  8224. (in FRintj FRintjeven)))
  8225. (fr500 (unit u-media-quad-mul
  8226. (in FRinti FRintieven)
  8227. (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
  8228. )
  8229. )
  8230. (conditional-media-quad-multiply-acc cmqmachs HI ext add h-acc40S ACC40Sk
  8231. (const DI #x7fffffffff) (const DI #xffffff8000000000)
  8232. OP_74 OPE4_2
  8233. "Conditional Media quad multiply and accumulate signed")
  8234. (conditional-media-quad-multiply-acc cmqmachu UHI zext add h-acc40U ACC40Uk
  8235. (const DI #xffffffffff) (const DI 0)
  8236. OP_74 OPE4_3
  8237. "Conditional media quad multiply and accumulate unsigned")
  8238. (define-pmacro (media-quad-multiply-cross-acc-semantics
  8239. cond mode conv addop rhw res max min)
  8240. (if (c-call SI "@cpu@_check_acc_range" (index-of res))
  8241. (if (register-unaligned res 4)
  8242. (c-call VOID "@cpu@_media_acc_not_aligned")
  8243. (if (orif (register-unaligned FRintieven 2)
  8244. (register-unaligned FRintjeven 2))
  8245. (c-call VOID "@cpu@_media_register_not_aligned")
  8246. (if cond
  8247. (sequence ((mode argihi) (mode argilo)
  8248. (mode argjhi) (mode argjlo))
  8249. (extract-hilo FRintieven 0 FRintjeven 0
  8250. argihi argilo argjhi argjlo)
  8251. (media-multiply-acc-semantics conv argihi addop argjhi
  8252. (nextreg rhw res 2)
  8253. max min (msr-sie-acci-2))
  8254. (media-multiply-acc-semantics conv argilo addop argjlo
  8255. (nextreg rhw res 3)
  8256. max min (msr-sie-acci-3))
  8257. (extract-hilo FRintieven 1 FRintjeven 1
  8258. argihi argilo argjhi argjlo)
  8259. (media-multiply-acc-semantics conv argihi addop argjhi
  8260. res
  8261. max min (msr-sie-acci))
  8262. (media-multiply-acc-semantics conv argilo addop argjlo
  8263. (nextreg rhw res 1)
  8264. max min
  8265. (msr-sie-acci-1)))))))
  8266. )
  8267. (define-pmacro (media-quad-multiply-cross-acc
  8268. name mode conv addop rhw res max min op ope comment)
  8269. (dni name
  8270. (comment)
  8271. ((UNIT FMALL) (MACH fr400,fr450,fr550) (FR550-MAJOR M-4)
  8272. (FR400-MAJOR M-2) (FR450-MAJOR M-4))
  8273. (.str name "$pack $FRintieven,$FRintjeven,$" res)
  8274. (+ pack res op FRintieven ope FRintjeven)
  8275. (media-quad-multiply-cross-acc-semantics 1 mode conv addop rhw res
  8276. max min)
  8277. ((fr400 (unit u-media-2-quad
  8278. (in FRinti FRintieven)
  8279. (in FRintj FRintjeven)))
  8280. (fr450 (unit u-media-2-quad
  8281. (in FRinti FRintieven)
  8282. (in FRintj FRintjeven)))
  8283. (fr550 (unit u-media-4-quad)))
  8284. )
  8285. )
  8286. (media-quad-multiply-cross-acc mqxmachs HI ext add h-acc40S ACC40Sk
  8287. (const DI #x7fffffffff) (const DI #xffffff8000000000)
  8288. OP_78 OPE1_00
  8289. "Media quad multiply and cross accumulate signed")
  8290. (define-pmacro (media-quad-cross-multiply-cross-acc-semantics
  8291. cond mode conv addop rhw res max min)
  8292. (if (c-call SI "@cpu@_check_acc_range" (index-of res))
  8293. (if (register-unaligned res 4)
  8294. (c-call VOID "@cpu@_media_acc_not_aligned")
  8295. (if (orif (register-unaligned FRintieven 2)
  8296. (register-unaligned FRintjeven 2))
  8297. (c-call VOID "@cpu@_media_register_not_aligned")
  8298. (if cond
  8299. (sequence ((mode argihi) (mode argilo)
  8300. (mode argjhi) (mode argjlo))
  8301. (extract-hilo FRintieven 0 FRintjeven 0
  8302. argihi argilo argjhi argjlo)
  8303. (media-multiply-acc-semantics conv argihi addop argjlo
  8304. (nextreg rhw res 2)
  8305. max min (msr-sie-acci-2))
  8306. (media-multiply-acc-semantics conv argilo addop argjhi
  8307. (nextreg rhw res 3)
  8308. max min (msr-sie-acci-3))
  8309. (extract-hilo FRintieven 1 FRintjeven 1
  8310. argihi argilo argjhi argjlo)
  8311. (media-multiply-acc-semantics conv argihi addop argjlo
  8312. res
  8313. max min (msr-sie-acci))
  8314. (media-multiply-acc-semantics conv argilo addop argjhi
  8315. (nextreg rhw res 1)
  8316. max min
  8317. (msr-sie-acci-1)))))))
  8318. )
  8319. (define-pmacro (media-quad-cross-multiply-cross-acc
  8320. name mode conv addop rhw res max min op ope comment)
  8321. (dni name
  8322. (comment)
  8323. ((UNIT FMALL) (MACH fr400,fr450,fr550) (FR550-MAJOR M-4)
  8324. (FR400-MAJOR M-2) (FR450-MAJOR M-4))
  8325. (.str name "$pack $FRintieven,$FRintjeven,$" res)
  8326. (+ pack res op FRintieven ope FRintjeven)
  8327. (media-quad-cross-multiply-cross-acc-semantics 1 mode conv addop rhw res
  8328. max min)
  8329. ((fr400 (unit u-media-2-quad
  8330. (in FRinti FRintieven)
  8331. (in FRintj FRintjeven)))
  8332. (fr450 (unit u-media-2-quad
  8333. (in FRinti FRintieven)
  8334. (in FRintj FRintjeven)))
  8335. (fr550 (unit u-media-4-quad)))
  8336. )
  8337. )
  8338. (media-quad-cross-multiply-cross-acc mqxmacxhs HI ext add h-acc40S ACC40Sk
  8339. (const DI #x7fffffffff) (const DI #xffffff8000000000)
  8340. OP_78 OPE1_01
  8341. "Media quad cross multiply and cross accumulate signed")
  8342. (define-pmacro (media-quad-cross-multiply-acc-semantics
  8343. cond mode conv addop rhw res max min)
  8344. (if (c-call SI "@cpu@_check_acc_range" (index-of res))
  8345. (if (register-unaligned res 4)
  8346. (c-call VOID "@cpu@_media_acc_not_aligned")
  8347. (if (orif (register-unaligned FRintieven 2)
  8348. (register-unaligned FRintjeven 2))
  8349. (c-call VOID "@cpu@_media_register_not_aligned")
  8350. (if cond
  8351. (sequence ((mode argihi) (mode argilo)
  8352. (mode argjhi) (mode argjlo))
  8353. (extract-hilo FRintieven 0 FRintjeven 0
  8354. argihi argilo argjhi argjlo)
  8355. (media-multiply-acc-semantics conv argihi addop argjlo
  8356. res
  8357. max min (msr-sie-acci))
  8358. (media-multiply-acc-semantics conv argilo addop argjhi
  8359. (nextreg rhw res 1)
  8360. max min (msr-sie-acci-1))
  8361. (extract-hilo FRintieven 1 FRintjeven 1
  8362. argihi argilo argjhi argjlo)
  8363. (media-multiply-acc-semantics conv argihi addop argjlo
  8364. (nextreg rhw res 2)
  8365. max min (msr-sie-acci-2))
  8366. (media-multiply-acc-semantics conv argilo addop argjhi
  8367. (nextreg rhw res 3)
  8368. max min
  8369. (msr-sie-acci-3)))))))
  8370. )
  8371. (define-pmacro (media-quad-cross-multiply-acc
  8372. name mode conv addop rhw res max min op ope comment)
  8373. (dni name
  8374. (comment)
  8375. ((UNIT FMALL) (MACH fr400,fr450,fr550) (FR550-MAJOR M-4)
  8376. (FR400-MAJOR M-2) (FR450-MAJOR M-4))
  8377. (.str name "$pack $FRintieven,$FRintjeven,$" res)
  8378. (+ pack res op FRintieven ope FRintjeven)
  8379. (media-quad-cross-multiply-acc-semantics 1 mode conv addop rhw res
  8380. max min)
  8381. ((fr400 (unit u-media-2-quad
  8382. (in FRinti FRintieven)
  8383. (in FRintj FRintjeven)))
  8384. (fr450 (unit u-media-2-quad
  8385. (in FRinti FRintieven)
  8386. (in FRintj FRintjeven)))
  8387. (fr550 (unit u-media-4-quad)))
  8388. )
  8389. )
  8390. (media-quad-cross-multiply-acc mqmacxhs HI ext add h-acc40S ACC40Sk
  8391. (const DI #x7fffffffff) (const DI #xffffff8000000000)
  8392. OP_78 OPE1_02
  8393. "Media quad cross multiply and accumulate signed")
  8394. (define-pmacro (media-complex-semantics
  8395. conv lhs1 rhs1 lhs2 rhs2 res max min sie)
  8396. (sequence ((DI tmp1) (DI tmp2))
  8397. (media-multiply-semantics conv lhs1 rhs1 tmp1)
  8398. (media-multiply-semantics conv lhs2 rhs2 tmp2)
  8399. (set tmp1 (sub tmp1 tmp2))
  8400. (saturate-v tmp1 max min sie res))
  8401. )
  8402. (define-pmacro (media-complex-semantics-i
  8403. conv lhs1 rhs1 lhs2 rhs2 res max min sie)
  8404. (sequence ((DI tmp1) (DI tmp2))
  8405. (media-multiply-semantics conv lhs1 rhs1 tmp1)
  8406. (media-multiply-semantics conv lhs2 rhs2 tmp2)
  8407. (set tmp1 (add tmp1 tmp2))
  8408. (saturate-v tmp1 max min sie res))
  8409. )
  8410. (define-pmacro (media-dual-complex-semantics mode conv rhs1 rhs2 max min)
  8411. (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
  8412. (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
  8413. (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
  8414. (media-complex-semantics conv argihi rhs1 argilo rhs2 ACC40Sk
  8415. max min (msr-sie-acci))))
  8416. )
  8417. (define-pmacro (media-dual-complex-semantics-i mode conv rhs1 rhs2 max min)
  8418. (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
  8419. (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
  8420. (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
  8421. (media-complex-semantics-i conv argihi rhs1 argilo rhs2 ACC40Sk
  8422. max min (msr-sie-acci))))
  8423. )
  8424. (define-pmacro (media-dual-complex
  8425. name mode conv rhs1 rhs2 max min op ope comment)
  8426. (dni name
  8427. (comment)
  8428. ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4)
  8429. (FR400-MAJOR M-1) (FR450-MAJOR M-3))
  8430. (.str name "$pack $FRinti,$FRintj,$ACC40Sk")
  8431. (+ pack ACC40Sk op FRinti ope FRintj)
  8432. (media-dual-complex-semantics mode conv rhs1 rhs2 max min)
  8433. ((fr400 (unit u-media-2)) (fr450 (unit u-media-2))
  8434. (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
  8435. )
  8436. )
  8437. (define-pmacro (media-dual-complex-i
  8438. name mode conv rhs1 rhs2 max min op ope comment)
  8439. (dni name
  8440. (comment)
  8441. ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4)
  8442. (FR400-MAJOR M-1) (FR450-MAJOR M-3))
  8443. (.str name "$pack $FRinti,$FRintj,$ACC40Sk")
  8444. (+ pack ACC40Sk op FRinti ope FRintj)
  8445. (media-dual-complex-semantics-i mode conv rhs1 rhs2 max min)
  8446. ((fr400 (unit u-media-2)) (fr450 (unit u-media-2))
  8447. (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
  8448. )
  8449. )
  8450. (media-dual-complex mcpxrs HI ext argjhi argjlo
  8451. (const DI #x7fffffffff) (const DI #xffffff8000000000)
  8452. OP_7B OPE1_20
  8453. "Media dual complex real signed with saturation")
  8454. (media-dual-complex mcpxru UHI zext argjhi argjlo
  8455. (const DI #xffffffffff) (const DI 0)
  8456. OP_7B OPE1_21
  8457. "Media dual complex real unsigned with saturation")
  8458. (media-dual-complex-i mcpxis HI ext argjlo argjhi
  8459. (const DI #x7fffffffff) (const DI #xffffff8000000000)
  8460. OP_7B OPE1_22
  8461. "Media dual complex imaginary signed with saturation")
  8462. (media-dual-complex-i mcpxiu UHI zext argjlo argjhi
  8463. (const DI #xffffffffff) (const DI 0)
  8464. OP_7B OPE1_23
  8465. "Media dual complex imaginary unsigned with saturation")
  8466. (define-pmacro (conditional-media-dual-complex
  8467. name mode conv rhs1 rhs2 max min op ope comment)
  8468. (dni name
  8469. (comment)
  8470. ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4)
  8471. (FR400-MAJOR M-1) (FR450-MAJOR M-3) CONDITIONAL)
  8472. (.str name "$pack $FRinti,$FRintj,$ACC40Sk,$CCi,$cond")
  8473. (+ pack ACC40Sk op FRinti CCi cond ope FRintj)
  8474. (if (eq CCi (or cond 2))
  8475. (media-dual-complex-semantics mode conv rhs1 rhs2 max min))
  8476. ((fr400 (unit u-media-2)) (fr450 (unit u-media-2))
  8477. (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
  8478. )
  8479. )
  8480. (define-pmacro (conditional-media-dual-complex-i
  8481. name mode conv rhs1 rhs2 max min op ope comment)
  8482. (dni name
  8483. (comment)
  8484. ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4)
  8485. (FR400-MAJOR M-1) (FR450-MAJOR M-3) CONDITIONAL)
  8486. (.str name "$pack $FRinti,$FRintj,$ACC40Sk,$CCi,$cond")
  8487. (+ pack ACC40Sk op FRinti CCi cond ope FRintj)
  8488. (if (eq CCi (or cond 2))
  8489. (media-dual-complex-semantics-i mode conv rhs1 rhs2 max min))
  8490. ((fr400 (unit u-media-2)) (fr450 (unit u-media-2))
  8491. (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
  8492. )
  8493. )
  8494. (conditional-media-dual-complex cmcpxrs HI ext argjhi argjlo
  8495. (const DI #x7fffffffff) (const DI #xffffff8000000000)
  8496. OP_75 OPE4_0
  8497. "Conditional Media dual complex real signed with saturation")
  8498. (conditional-media-dual-complex cmcpxru UHI zext argjhi argjlo
  8499. (const DI #xffffffffff) (const DI 0)
  8500. OP_75 OPE4_1
  8501. "Conditional Media dual complex real unsigned with saturation")
  8502. (conditional-media-dual-complex-i cmcpxis HI ext argjlo argjhi
  8503. (const DI #x7fffffffff) (const DI #xffffff8000000000)
  8504. OP_75 OPE4_2
  8505. "Conditional Media dual complex imaginary signed with saturation")
  8506. (conditional-media-dual-complex-i cmcpxiu UHI zext argjlo argjhi
  8507. (const DI #xffffffffff) (const DI 0)
  8508. OP_75 OPE4_3
  8509. "Conditional Media dual complex imaginary unsigned with saturation")
  8510. (define-pmacro (media-quad-complex
  8511. name mode conv rhs1 rhs2 max min op ope comment)
  8512. (dni name
  8513. (comment)
  8514. ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4)
  8515. (FR400-MAJOR M-2) (FR450-MAJOR M-4))
  8516. (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk")
  8517. (+ pack ACC40Sk op FRintieven ope FRintjeven)
  8518. (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
  8519. (if (register-unaligned ACC40Sk 2)
  8520. (c-call VOID "@cpu@_media_acc_not_aligned")
  8521. (if (orif (register-unaligned FRintieven 2)
  8522. (register-unaligned FRintjeven 2))
  8523. (c-call VOID "@cpu@_media_register_not_aligned")
  8524. (sequence ((mode argihi) (mode argilo)
  8525. (mode argjhi) (mode argjlo))
  8526. (extract-hilo FRintieven 0 FRintjeven 0
  8527. argihi argilo argjhi argjlo)
  8528. (media-complex-semantics conv argihi rhs1 argilo rhs2
  8529. ACC40Sk
  8530. max min (msr-sie-acci))
  8531. (extract-hilo FRintieven 1 FRintjeven 1
  8532. argihi argilo argjhi argjlo)
  8533. (media-complex-semantics conv argihi rhs1 argilo rhs2
  8534. (nextreg h-acc40S ACC40Sk 1)
  8535. max min (msr-sie-acci-1))))))
  8536. ((fr400 (unit u-media-2-quad
  8537. (in FRinti FRintieven)
  8538. (in FRintj FRintjeven)))
  8539. (fr450 (unit u-media-2-quad
  8540. (in FRinti FRintieven)
  8541. (in FRintj FRintjeven)))
  8542. (fr500 (unit u-media-quad-complex
  8543. (in FRinti FRintieven)
  8544. (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
  8545. )
  8546. )
  8547. (define-pmacro (media-quad-complex-i
  8548. name mode conv rhs1 rhs2 max min op ope comment)
  8549. (dni name
  8550. (comment)
  8551. ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4)
  8552. (FR400-MAJOR M-2) (FR450-MAJOR M-4))
  8553. (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk")
  8554. (+ pack ACC40Sk op FRintieven ope FRintjeven)
  8555. (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
  8556. (if (register-unaligned ACC40Sk 2)
  8557. (c-call VOID "@cpu@_media_acc_not_aligned")
  8558. (if (orif (register-unaligned FRintieven 2)
  8559. (register-unaligned FRintjeven 2))
  8560. (c-call VOID "@cpu@_media_register_not_aligned")
  8561. (sequence ((mode argihi) (mode argilo)
  8562. (mode argjhi) (mode argjlo))
  8563. (extract-hilo FRintieven 0 FRintjeven 0
  8564. argihi argilo argjhi argjlo)
  8565. (media-complex-semantics-i conv argihi rhs1 argilo rhs2
  8566. ACC40Sk
  8567. max min (msr-sie-acci))
  8568. (extract-hilo FRintieven 1 FRintjeven 1
  8569. argihi argilo argjhi argjlo)
  8570. (media-complex-semantics-i conv argihi rhs1 argilo rhs2
  8571. (nextreg h-acc40S ACC40Sk 1)
  8572. max min (msr-sie-acci-1))))))
  8573. ((fr400 (unit u-media-2-quad
  8574. (in FRinti FRintieven)
  8575. (in FRintj FRintjeven)))
  8576. (fr450 (unit u-media-2-quad
  8577. (in FRinti FRintieven)
  8578. (in FRintj FRintjeven)))
  8579. (fr500 (unit u-media-quad-complex
  8580. (in FRinti FRintieven)
  8581. (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
  8582. )
  8583. )
  8584. (media-quad-complex mqcpxrs HI ext argjhi argjlo
  8585. (const DI #x7fffffffff) (const DI #xffffff8000000000)
  8586. OP_7B OPE1_24
  8587. "Media quad complex real signed with saturation")
  8588. (media-quad-complex mqcpxru UHI zext argjhi argjlo
  8589. (const DI #xffffffffff) (const DI 0)
  8590. OP_7B OPE1_25
  8591. "Media quad complex real unsigned with saturation")
  8592. (media-quad-complex-i mqcpxis HI ext argjlo argjhi
  8593. (const DI #x7fffffffff) (const DI #xffffff8000000000)
  8594. OP_7B OPE1_26
  8595. "Media quad complex imaginary signed with saturation")
  8596. (media-quad-complex-i mqcpxiu UHI zext argjlo argjhi
  8597. (const DI #xffffffffff) (const DI 0)
  8598. OP_7B OPE1_27
  8599. "Media quad complex imaginary unsigned with saturation")
  8600. (define-pmacro (media-pack src1 src2 targ offset)
  8601. (sequence ()
  8602. (set (halfword hi targ offset) (halfword lo src1 offset))
  8603. (set (halfword lo targ offset) (halfword lo src2 offset)))
  8604. )
  8605. (define-pmacro (media-expand-halfword-to-word-semantics cond)
  8606. (if cond
  8607. (sequence ((UHI tmp))
  8608. (if (and u6 1)
  8609. (set tmp (halfword lo FRinti 0))
  8610. (set tmp (halfword hi FRinti 0)))
  8611. (set (halfword hi FRintk 0) tmp)
  8612. (set (halfword lo FRintk 0) tmp)))
  8613. )
  8614. (dni mexpdhw
  8615. "Media expand halfword to word"
  8616. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  8617. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  8618. "mexpdhw$pack $FRinti,$u6,$FRintk"
  8619. (+ pack FRintk OP_7B FRinti OPE1_32 u6)
  8620. (media-expand-halfword-to-word-semantics 1)
  8621. ((fr400 (unit u-media-3)) (fr450 (unit u-media-3))
  8622. (fr500 (unit u-media)) (fr550 (unit u-media)))
  8623. )
  8624. (dni cmexpdhw
  8625. "Conditional media expand halfword to word"
  8626. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  8627. (FR400-MAJOR M-1) (FR450-MAJOR M-1) CONDITIONAL)
  8628. "cmexpdhw$pack $FRinti,$u6,$FRintk,$CCi,$cond"
  8629. (+ pack FRintk OP_76 FRinti CCi cond OPE4_2 u6)
  8630. (media-expand-halfword-to-word-semantics (eq CCi (or cond 2)))
  8631. ((fr400 (unit u-media-3)) (fr450 (unit u-media-3))
  8632. (fr500 (unit u-media)) (fr550 (unit u-media)))
  8633. )
  8634. (define-pmacro (media-expand-halfword-to-double-semantics cond)
  8635. (if (register-unaligned FRintkeven 2)
  8636. (c-call VOID "@cpu@_media_register_not_aligned")
  8637. (if cond
  8638. (sequence ((UHI tmp))
  8639. ; a hack to get FRintkeven referenced for profiling
  8640. (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
  8641. (if (and u6 1)
  8642. (set tmp (halfword lo FRinti 0))
  8643. (set tmp (halfword hi FRinti 0)))
  8644. (set (halfword hi FRintkeven 0) tmp)
  8645. (set (halfword lo FRintkeven 0) tmp)
  8646. (set (halfword hi FRintkeven 1) tmp)
  8647. (set (halfword lo FRintkeven 1) tmp))))
  8648. )
  8649. (dni mexpdhd
  8650. "Media expand halfword to double"
  8651. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  8652. (FR400-MAJOR M-2) (FR450-MAJOR M-2))
  8653. "mexpdhd$pack $FRinti,$u6,$FRintkeven"
  8654. (+ pack FRintkeven OP_7B FRinti OPE1_33 u6)
  8655. (media-expand-halfword-to-double-semantics 1)
  8656. ((fr400 (unit u-media-dual-expand
  8657. (out FRintk FRintkeven)))
  8658. (fr450 (unit u-media-dual-expand
  8659. (out FRintk FRintkeven)))
  8660. (fr500 (unit u-media-dual-expand
  8661. (out FRintk FRintkeven)))
  8662. (fr550 (unit u-media-dual-expand)))
  8663. )
  8664. (dni cmexpdhd
  8665. "Conditional media expand halfword to double"
  8666. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  8667. (FR400-MAJOR M-2) (FR450-MAJOR M-2) CONDITIONAL)
  8668. "cmexpdhd$pack $FRinti,$u6,$FRintkeven,$CCi,$cond"
  8669. (+ pack FRintkeven OP_76 FRinti CCi cond OPE4_3 u6)
  8670. (media-expand-halfword-to-double-semantics (eq CCi (or cond 2)))
  8671. ((fr400 (unit u-media-dual-expand
  8672. (out FRintk FRintkeven)))
  8673. (fr450 (unit u-media-dual-expand
  8674. (out FRintk FRintkeven)))
  8675. (fr500 (unit u-media-dual-expand
  8676. (out FRintk FRintkeven)))
  8677. (fr550 (unit u-media-dual-expand)))
  8678. )
  8679. (dni mpackh
  8680. "Media halfword pack"
  8681. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  8682. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  8683. "mpackh$pack $FRinti,$FRintj,$FRintk"
  8684. (+ pack FRintk OP_7B FRinti OPE1_34 FRintj)
  8685. (media-pack FRinti FRintj FRintk 0)
  8686. ((fr400 (unit u-media-3)) (fr450 (unit u-media-3))
  8687. (fr500 (unit u-media)) (fr550 (unit u-media)))
  8688. )
  8689. (dni mdpackh
  8690. "Media dual pack"
  8691. ((UNIT FM01) (FR500-MAJOR M-5) (FR550-MAJOR M-3)
  8692. (FR400-MAJOR M-2) (FR450-MAJOR M-2))
  8693. "mdpackh$pack $FRintieven,$FRintjeven,$FRintkeven"
  8694. (+ pack FRintkeven OP_7B FRintieven OPE1_36 FRintjeven)
  8695. (if (orif (register-unaligned FRintieven 2)
  8696. (orif (register-unaligned FRintjeven 2)
  8697. (register-unaligned FRintkeven 2)))
  8698. (c-call VOID "@cpu@_media_register_not_aligned")
  8699. (sequence ()
  8700. ; hack to get these referenced for profiling
  8701. (set FRintieven (c-raw-call SI "frv_ref_SI" FRintieven))
  8702. (set FRintjeven (c-raw-call SI "frv_ref_SI" FRintjeven))
  8703. (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
  8704. (media-pack FRintieven FRintjeven FRintkeven 0)
  8705. (media-pack FRintieven FRintjeven FRintkeven 1)))
  8706. ((fr400 (unit u-media-3-quad
  8707. (in FRinti FRintieven)
  8708. (in FRintj FRintjeven)
  8709. (out FRintk FRintkeven)))
  8710. (fr450 (unit u-media-3-quad
  8711. (in FRinti FRintieven)
  8712. (in FRintj FRintjeven)
  8713. (out FRintk FRintkeven)))
  8714. (fr500 (unit u-media-quad-arith
  8715. (in FRinti FRintieven)
  8716. (in FRintj FRintjeven)
  8717. (out FRintk FRintkeven)))
  8718. (fr550 (unit u-media-quad)))
  8719. )
  8720. (define-pmacro (media-unpack src soff targ toff)
  8721. (sequence ()
  8722. (set (halfword hi targ toff) (halfword hi src soff))
  8723. (set (halfword lo targ toff) (halfword hi src soff))
  8724. (set (halfword hi targ (add toff 1)) (halfword lo src soff))
  8725. (set (halfword lo targ (add toff 1)) (halfword lo src soff)))
  8726. )
  8727. (dni munpackh
  8728. "Media halfword unpack"
  8729. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  8730. (FR400-MAJOR M-2) (FR450-MAJOR M-2))
  8731. "munpackh$pack $FRinti,$FRintkeven"
  8732. (+ pack FRintkeven OP_7B FRinti OPE1_35 (FRj-null))
  8733. (if (register-unaligned FRintkeven 2)
  8734. (c-call VOID "@cpu@_media_register_not_aligned")
  8735. (sequence ()
  8736. ; hack to get these referenced for profiling
  8737. (set FRinti (c-raw-call SI "frv_ref_SI" FRinti))
  8738. (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
  8739. (media-unpack FRinti 0 FRintkeven 0)))
  8740. ((fr400 (unit u-media-dual-expand
  8741. (out FRintk FRintkeven)))
  8742. (fr450 (unit u-media-dual-expand
  8743. (out FRintk FRintkeven)))
  8744. (fr500 (unit u-media-dual-expand
  8745. (out FRintk FRintkeven)))
  8746. (fr550 (unit u-media-dual-expand)))
  8747. )
  8748. (dni mdunpackh
  8749. "Media dual unpack"
  8750. ((UNIT FM01) (FR500-MAJOR M-7) (MACH simple,tomcat,frv))
  8751. "mdunpackh$pack $FRintieven,$FRintk"
  8752. (+ pack FRintk OP_7B FRintieven OPE1_37 (FRj-null))
  8753. (if (orif (register-unaligned FRintieven 2) (register-unaligned FRintk 4))
  8754. (c-call VOID "@cpu@_media_register_not_aligned")
  8755. (sequence ()
  8756. ; hack to get these referenced for profiling
  8757. (set FRintieven (c-raw-call SI "frv_ref_SI" FRintieven))
  8758. (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
  8759. (media-unpack FRintieven 0 FRintk 0)
  8760. (media-unpack FRintieven 1 FRintk 2)))
  8761. ((fr500 (unit u-media-dual-unpack
  8762. (in FRinti FRintieven))))
  8763. )
  8764. (define-pmacro (ubyte num arg offset)
  8765. (reg (.sym h-fr_ num) (add (index-of arg) offset)))
  8766. (define-pmacro (mbtoh-semantics cond)
  8767. (if (register-unaligned FRintkeven 2)
  8768. (c-call VOID "@cpu@_media_register_not_aligned")
  8769. (if cond
  8770. (sequence ()
  8771. (set (halfword hi FRintkeven 0) (ubyte 3 FRintj 0))
  8772. (set (halfword lo FRintkeven 0) (ubyte 2 FRintj 0))
  8773. (set (halfword hi FRintkeven 1) (ubyte 1 FRintj 0))
  8774. (set (halfword lo FRintkeven 1) (ubyte 0 FRintj 0)))))
  8775. )
  8776. (dni mbtoh
  8777. "Media convert byte to halfword"
  8778. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  8779. (FR400-MAJOR M-2) (FR450-MAJOR M-2))
  8780. "mbtoh$pack $FRintj,$FRintkeven"
  8781. (+ pack FRintkeven OP_7B (FRi-null) OPE1_38 FRintj)
  8782. (sequence ()
  8783. ; hack to get these referenced for profiling
  8784. (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
  8785. (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
  8786. (mbtoh-semantics 1))
  8787. ((fr400 (unit u-media-dual-expand
  8788. (out FRintk FRintkeven)))
  8789. (fr450 (unit u-media-dual-expand
  8790. (out FRintk FRintkeven)))
  8791. (fr500 (unit u-media-dual-btoh
  8792. (out FRintk FRintkeven)))
  8793. (fr550 (unit u-media-dual-expand)))
  8794. )
  8795. (dni cmbtoh
  8796. "Conditional media convert byte to halfword"
  8797. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  8798. (FR400-MAJOR M-2) (FR450-MAJOR M-2) CONDITIONAL)
  8799. "cmbtoh$pack $FRintj,$FRintkeven,$CCi,$cond"
  8800. (+ pack FRintkeven OP_77 (FRi-null) CCi cond OPE4_0 FRintj)
  8801. (sequence ()
  8802. ; hack to get these referenced for profiling
  8803. (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
  8804. (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
  8805. (mbtoh-semantics (eq CCi (or cond 2))))
  8806. ((fr400 (unit u-media-dual-expand
  8807. (out FRintk FRintkeven)))
  8808. (fr450 (unit u-media-dual-expand
  8809. (out FRintk FRintkeven)))
  8810. (fr500 (unit u-media-dual-btoh
  8811. (out FRintk FRintkeven)))
  8812. (fr550 (unit u-media-dual-expand
  8813. (in FRinti FRintj))))
  8814. )
  8815. (define-pmacro (mhtob-semantics cond)
  8816. (if (register-unaligned FRintjeven 2)
  8817. (c-call VOID "@cpu@_media_register_not_aligned")
  8818. (if cond
  8819. (sequence ()
  8820. (set (ubyte 3 FRintk 0) (halfword hi FRintjeven 0))
  8821. (set (ubyte 2 FRintk 0) (halfword lo FRintjeven 0))
  8822. (set (ubyte 1 FRintk 0) (halfword hi FRintjeven 1))
  8823. (set (ubyte 0 FRintk 0) (halfword lo FRintjeven 1)))))
  8824. )
  8825. (dni mhtob
  8826. "Media convert halfword to byte"
  8827. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  8828. (FR400-MAJOR M-2) (FR450-MAJOR M-2))
  8829. "mhtob$pack $FRintjeven,$FRintk"
  8830. (+ pack FRintk OP_7B (FRi-null) OPE1_39 FRintjeven)
  8831. (sequence ()
  8832. ; hack to get these referenced for profiling
  8833. (set FRintjeven (c-raw-call SI "frv_ref_SI" FRintjeven))
  8834. (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
  8835. (mhtob-semantics 1))
  8836. ((fr400 (unit u-media-dual-htob
  8837. (in FRintj FRintjeven)))
  8838. (fr450 (unit u-media-dual-htob
  8839. (in FRintj FRintjeven)))
  8840. (fr500 (unit u-media-dual-htob
  8841. (in FRintj FRintjeven)))
  8842. (fr550 (unit u-media-3-dual
  8843. (in FRinti FRintjeven))))
  8844. )
  8845. (dni cmhtob
  8846. "Conditional media convert halfword to byte"
  8847. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  8848. (FR400-MAJOR M-2) (FR450-MAJOR M-2) CONDITIONAL)
  8849. "cmhtob$pack $FRintjeven,$FRintk,$CCi,$cond"
  8850. (+ pack FRintk OP_77 (FRi-null) CCi cond OPE4_1 FRintjeven)
  8851. (sequence ()
  8852. ; hack to get these referenced for profiling
  8853. (set FRintjeven (c-raw-call SI "frv_ref_SI" FRintjeven))
  8854. (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
  8855. (mhtob-semantics (eq CCi (or cond 2))))
  8856. ((fr400 (unit u-media-dual-htob
  8857. (in FRintj FRintjeven)))
  8858. (fr450 (unit u-media-dual-htob
  8859. (in FRintj FRintjeven)))
  8860. (fr500 (unit u-media-dual-htob
  8861. (in FRintj FRintjeven)))
  8862. (fr550 (unit u-media-3-dual
  8863. (in FRinti FRintjeven))))
  8864. )
  8865. (define-pmacro (mbtohe-semantics cond)
  8866. (if (register-unaligned FRintk 4)
  8867. (c-call VOID "@cpu@_media_register_not_aligned")
  8868. (if cond
  8869. (sequence ()
  8870. (set (halfword hi FRintk 0) (ubyte 3 FRintj 0))
  8871. (set (halfword lo FRintk 0) (ubyte 3 FRintj 0))
  8872. (set (halfword hi FRintk 1) (ubyte 2 FRintj 0))
  8873. (set (halfword lo FRintk 1) (ubyte 2 FRintj 0))
  8874. (set (halfword hi FRintk 2) (ubyte 1 FRintj 0))
  8875. (set (halfword lo FRintk 2) (ubyte 1 FRintj 0))
  8876. (set (halfword hi FRintk 3) (ubyte 0 FRintj 0))
  8877. (set (halfword lo FRintk 3) (ubyte 0 FRintj 0)))))
  8878. )
  8879. (dni mbtohe
  8880. "Media convert byte to halfword extended"
  8881. ((UNIT FM01) (FR500-MAJOR M-7) (MACH simple,tomcat,frv))
  8882. "mbtohe$pack $FRintj,$FRintk"
  8883. (+ pack FRintk OP_7B (FRi-null) OPE1_3A FRintj)
  8884. (sequence ()
  8885. ; hack to get these referenced for profiling
  8886. (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
  8887. (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
  8888. (mbtohe-semantics 1))
  8889. ((fr500 (unit u-media-dual-btohe)))
  8890. )
  8891. (dni cmbtohe
  8892. "Conditional media convert byte to halfword extended"
  8893. ((UNIT FM01) (FR500-MAJOR M-7) CONDITIONAL (MACH simple,tomcat,frv))
  8894. "cmbtohe$pack $FRintj,$FRintk,$CCi,$cond"
  8895. (+ pack FRintk OP_77 (FRi-null) CCi cond OPE4_2 FRintj)
  8896. (sequence ()
  8897. ; hack to get these referenced for profiling
  8898. (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
  8899. (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
  8900. (mbtohe-semantics (eq CCi (or cond 2))))
  8901. ((fr500 (unit u-media-dual-btohe)))
  8902. )
  8903. ; Media NOP
  8904. ; A special case of mclracc
  8905. (dni mnop "Media nop"
  8906. ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-1)
  8907. (FR400-MAJOR M-1) (FR450-MAJOR M-1))
  8908. "mnop$pack"
  8909. (+ pack (f-ACC40Sk 63) OP_7B (f-A 1) (misc-null-10) OPE1_3B (FRj-null))
  8910. (nop)
  8911. ()
  8912. )
  8913. ; mclracc with #A==0
  8914. (dni mclracc-0
  8915. "Media clear accumulator(s)"
  8916. ((UNIT FM01) (FR500-MAJOR M-3) (FR550-MAJOR M-3)
  8917. (FR400-MAJOR M-1) (FR450-MAJOR M-3))
  8918. "mclracc$pack $ACC40Sk,$A0"
  8919. (+ pack ACC40Sk OP_7B (f-A 0) (misc-null-10) OPE1_3B (FRj-null))
  8920. (c-call VOID "@cpu@_clear_accumulators" (index-of ACC40Sk) 0)
  8921. ((fr400 (unit u-media-4)) (fr450 (unit u-media-4))
  8922. (fr500 (unit u-media)) (fr550 (unit u-media-3-mclracc)))
  8923. )
  8924. ; mclracc with #A==1
  8925. (dni mclracc-1
  8926. "Media clear accumulator(s)"
  8927. ((UNIT MCLRACC-1) (FR500-MAJOR M-6) (FR550-MAJOR M-3)
  8928. (FR400-MAJOR M-2) (FR450-MAJOR M-4))
  8929. "mclracc$pack $ACC40Sk,$A1"
  8930. (+ pack ACC40Sk OP_7B (f-A 1) (misc-null-10) OPE1_3B (FRj-null))
  8931. (c-call VOID "@cpu@_clear_accumulators" (index-of ACC40Sk) 1)
  8932. ((fr400 (unit u-media-4)) (fr450 (unit u-media-4-mclracca))
  8933. (fr500 (unit u-media)) (fr550 (unit u-media-3-mclracc)))
  8934. )
  8935. (dni mrdacc
  8936. "Media read accumulator"
  8937. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  8938. (FR400-MAJOR M-1) (FR450-MAJOR M-5))
  8939. "mrdacc$pack $ACC40Si,$FRintk"
  8940. (+ pack FRintk OP_7B ACC40Si OPE1_3C (FRj-null))
  8941. (set FRintk ACC40Si)
  8942. ((fr400 (unit u-media-4)) (fr450 (unit u-media-4))
  8943. (fr500 (unit u-media)) (fr550 (unit u-media-3-acc)))
  8944. )
  8945. (dni mrdaccg
  8946. "Media read accumulator guard"
  8947. ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3)
  8948. (FR400-MAJOR M-1) (FR450-MAJOR M-5))
  8949. "mrdaccg$pack $ACCGi,$FRintk"
  8950. (+ pack FRintk OP_7B ACCGi OPE1_3E (FRj-null))
  8951. (set FRintk ACCGi)
  8952. ((fr400 (unit u-media-4-accg)) (fr450 (unit u-media-4-accg))
  8953. (fr500 (unit u-media)) (fr550 (unit u-media-3-acc (in ACC40Si ACCGi))))
  8954. )
  8955. (dni mwtacc
  8956. "Media write accumulator"
  8957. ((UNIT FM01) (FR500-MAJOR M-3) (FR550-MAJOR M-3)
  8958. (FR400-MAJOR M-1) (FR450-MAJOR M-3))
  8959. "mwtacc$pack $FRinti,$ACC40Sk"
  8960. (+ pack ACC40Sk OP_7B FRinti OPE1_3D (FRj-null))
  8961. (set ACC40Sk (or (and ACC40Sk (const DI #xffffffff00000000))
  8962. FRinti))
  8963. ((fr400 (unit u-media-4)) (fr450 (unit u-media-4))
  8964. (fr500 (unit u-media)) (fr550 (unit u-media-3-wtacc)))
  8965. )
  8966. (dni mwtaccg
  8967. "Media write accumulator guard"
  8968. ((UNIT FM01) (FR500-MAJOR M-3) (FR550-MAJOR M-3)
  8969. (FR400-MAJOR M-1) (FR450-MAJOR M-3))
  8970. "mwtaccg$pack $FRinti,$ACCGk"
  8971. (+ pack ACCGk OP_7B FRinti OPE1_3F (FRj-null))
  8972. (sequence ()
  8973. ; hack to get these referenced for profiling
  8974. (c-raw-call VOID "frv_ref_SI" ACCGk)
  8975. (set ACCGk FRinti))
  8976. ((fr400 (unit u-media-4-accg)) (fr450 (unit u-media-4-accg))
  8977. (fr500 (unit u-media)) (fr550 (unit u-media-3-wtacc (in ACC40Sk ACCGk))))
  8978. )
  8979. (define-pmacro (media-cop num op)
  8980. (dni (.sym mcop num)
  8981. "Media custom instruction"
  8982. ((UNIT FM01) (FR500-MAJOR M-1) (MACH frv))
  8983. (.str "mcop" num "$pack $FRi,$FRj,$FRk")
  8984. (+ pack FRk op FRi OPE1_00 FRj)
  8985. (c-call VOID "@cpu@_media_cop" num)
  8986. ()
  8987. )
  8988. )
  8989. (media-cop 1 OP_7C)
  8990. (media-cop 2 OP_7D)
  8991. ; nop
  8992. ; A nop is defined to be a "ori gr0,0,gr0"
  8993. ; This needn't be a macro-insn, but making it one greatly simplifies decode.c
  8994. ; On the other hand spending a little time in the decoder is often worth it.
  8995. ;
  8996. (dnmi nop "nop"
  8997. ((UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  8998. "nop$pack"
  8999. (emit ori pack (GRi 0) (s12 0) (GRk 0))
  9000. )
  9001. ; Floating point NOP
  9002. (dni fnop
  9003. "Floating point nop"
  9004. ((UNIT FMALL) (FR500-MAJOR F-8) (FR550-MAJOR F-1) (MACH simple,tomcat,fr500,fr550,frv))
  9005. "fnop$pack"
  9006. (+ pack (rd-null) OP_79 (FRi-null) OPE1_0D (FRj-null))
  9007. (nop)
  9008. ()
  9009. )
  9010. ; A return instruction
  9011. (dnmi ret "return"
  9012. (NO-DIS (UNIT B01) (FR500-MAJOR B-3)
  9013. (FR400-MAJOR B-3) (FR450-MAJOR B-3))
  9014. "ret$pack"
  9015. (emit bralr pack (hint_taken 2))
  9016. )
  9017. (dnmi cmp "compare"
  9018. (NO-DIS (UNIT IALL) (FR500-MAJOR I-1)
  9019. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  9020. "cmp$pack $GRi,$GRj,$ICCi_1"
  9021. (emit subcc pack GRi GRj (GRk 0) ICCi_1)
  9022. )
  9023. (dnmi cmpi "compare immediate"
  9024. (NO-DIS (UNIT IALL) (FR500-MAJOR I-1)
  9025. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  9026. "cmpi$pack $GRi,$s10,$ICCi_1"
  9027. (emit subicc pack GRi s10 (GRk 0) ICCi_1)
  9028. )
  9029. (dnmi ccmp "conditional compare"
  9030. (NO-DIS (UNIT IALL) (FR500-MAJOR I-1)
  9031. (FR400-MAJOR I-1) (FR450-MAJOR I-1) CONDITIONAL)
  9032. "ccmp$pack $GRi,$GRj,$CCi,$cond"
  9033. (emit csubcc pack GRi GRj (GRk 0) CCi cond)
  9034. )
  9035. (dnmi mov "move"
  9036. (NO-DIS (UNIT IALL) (FR500-MAJOR I-1)
  9037. (FR400-MAJOR I-1) (FR450-MAJOR I-1))
  9038. "mov$pack $GRi,$GRk"
  9039. (emit ori pack GRi (s12 0) GRk)
  9040. )
  9041. (dnmi cmov "conditional move"
  9042. (NO-DIS (UNIT IALL) (FR500-MAJOR I-1)
  9043. (FR400-MAJOR I-1) (FR450-MAJOR I-1) CONDITIONAL)
  9044. "cmov$pack $GRi,$GRk,$CCi,$cond"
  9045. (emit cor pack GRi (GRj 0) GRk CCi cond)
  9046. )