frv.cpu 343 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803
  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 (mul (ifield f-u12-h) 64)
  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 (mul WI value (const 4)) 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 (mul (or (mul (ifield f-labelH6) (sll 1 18))
  1994. (ifield f-labelL18))
  1995. (const 4))
  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. )