0001-gcc-EPSON-modified-sources.patch 682 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781
  1. From 893069457ebac75052159679536e8b18fda3e314 Mon Sep 17 00:00:00 2001
  2. From: Holger Freyther <ich@tamarin.(none)>
  3. Date: Fri, 12 Sep 2008 14:26:34 +0200
  4. Subject: [PATCH] [gcc] EPSON modified sources
  5. ---
  6. config.sub | 2 +
  7. gcc/Makefile.in | 1 -
  8. gcc/builtins.def | 6 +
  9. gcc/c-decl.c | 1 +
  10. gcc/config.gcc | 15 +
  11. gcc/config/c33/c33-protos.h | 36 +
  12. gcc/config/c33/c33.c | 4086 ++++++++++++++++++++++++++++++
  13. gcc/config/c33/c33.h | 2347 +++++++++++++++++
  14. gcc/config/c33/c33.md | 1241 +++++++++
  15. gcc/config/c33/lib1funcs.s | 315 +++
  16. gcc/config/c33/libgcc/Makefile | 45 +
  17. gcc/config/c33/libgcc/adddf3.lst | 847 +++++++
  18. gcc/config/c33/libgcc/adddf3.s | 778 ++++++
  19. gcc/config/c33/libgcc/addsf3.lst | 399 +++
  20. gcc/config/c33/libgcc/addsf3.s | 368 +++
  21. gcc/config/c33/libgcc/divdf3.lst | 719 ++++++
  22. gcc/config/c33/libgcc/divdf3.s | 669 +++++
  23. gcc/config/c33/libgcc/divhi3.lst | 118 +
  24. gcc/config/c33/libgcc/divhi3.s | 112 +
  25. gcc/config/c33/libgcc/divsf3.lst | 413 +++
  26. gcc/config/c33/libgcc/divsf3.s | 384 +++
  27. gcc/config/c33/libgcc/divsi3.lst | 150 ++
  28. gcc/config/c33/libgcc/divsi3.s | 141 +
  29. gcc/config/c33/libgcc/extsfdf.lst | 174 ++
  30. gcc/config/c33/libgcc/extsfdf.s | 161 ++
  31. gcc/config/c33/libgcc/fcmpd.lst | 108 +
  32. gcc/config/c33/libgcc/fcmpd.s | 99 +
  33. gcc/config/c33/libgcc/fcmps.lst | 101 +
  34. gcc/config/c33/libgcc/fcmps.s | 92 +
  35. gcc/config/c33/libgcc/fixdfi.lst | 140 +
  36. gcc/config/c33/libgcc/fixdfi.s | 128 +
  37. gcc/config/c33/libgcc/fixdfui.lst | 154 ++
  38. gcc/config/c33/libgcc/fixdfui.s | 140 +
  39. gcc/config/c33/libgcc/fixsfi.lst | 110 +
  40. gcc/config/c33/libgcc/fixsfi.s | 101 +
  41. gcc/config/c33/libgcc/fixsfui.lst | 127 +
  42. gcc/config/c33/libgcc/fixsfui.s | 113 +
  43. gcc/config/c33/libgcc/flosidf.lst | 107 +
  44. gcc/config/c33/libgcc/flosidf.s | 100 +
  45. gcc/config/c33/libgcc/flosisf.lst | 102 +
  46. gcc/config/c33/libgcc/flosisf.s | 96 +
  47. gcc/config/c33/libgcc/libgcc.a | Bin 0 -> 21742 bytes
  48. gcc/config/c33/libgcc/modhi3.lst | 105 +
  49. gcc/config/c33/libgcc/modhi3.s | 99 +
  50. gcc/config/c33/libgcc/modsi3.lst | 138 +
  51. gcc/config/c33/libgcc/modsi3.s | 129 +
  52. gcc/config/c33/libgcc/muldf3.lst | 475 ++++
  53. gcc/config/c33/libgcc/muldf3.s | 443 ++++
  54. gcc/config/c33/libgcc/mulsf3.lst | 327 +++
  55. gcc/config/c33/libgcc/mulsf3.s | 301 +++
  56. gcc/config/c33/libgcc/negdf2.lst | 41 +
  57. gcc/config/c33/libgcc/negdf2.s | 37 +
  58. gcc/config/c33/libgcc/negsf2.lst | 38 +
  59. gcc/config/c33/libgcc/negsf2.s | 34 +
  60. gcc/config/c33/libgcc/scan64.lst | 51 +
  61. gcc/config/c33/libgcc/scan64.s | 48 +
  62. gcc/config/c33/libgcc/sedscr | 16 +
  63. gcc/config/c33/libgcc/trncdfsf.lst | 126 +
  64. gcc/config/c33/libgcc/trncdfsf.s | 113 +
  65. gcc/config/c33/libgcc1.S | 317 +++
  66. gcc/config/c33/t-c33 | 35 +
  67. gcc/cp/decl.c | 133 +
  68. gcc/cppinit.c | 56 +-
  69. gcc/cpplib.c | 5 +-
  70. gcc/cppmain.c | 97 +-
  71. gcc/final.c | 84 +
  72. gcc/gcc.c | 5 +
  73. gcc/line-map.c | 21 +-
  74. gcc/protoize.c | 2 +
  75. gcc/toplev.c | 51 +
  76. gcc/tree.h | 2 -
  77. gcc/varasm.c | 15 +-
  78. include/obstack.h | 16 +
  79. libstdc++-v3/include/c_std/std_cstring.h | 4 -
  80. 74 files changed, 18679 insertions(+), 31 deletions(-)
  81. mode change 100755 => 100644 config.sub
  82. create mode 100644 gcc/config/c33/c33-protos.h
  83. create mode 100644 gcc/config/c33/c33.c
  84. create mode 100644 gcc/config/c33/c33.h
  85. create mode 100644 gcc/config/c33/c33.md
  86. create mode 100644 gcc/config/c33/lib1funcs.s
  87. create mode 100644 gcc/config/c33/libgcc/Makefile
  88. create mode 100644 gcc/config/c33/libgcc/adddf3.lst
  89. create mode 100644 gcc/config/c33/libgcc/adddf3.s
  90. create mode 100644 gcc/config/c33/libgcc/addsf3.lst
  91. create mode 100644 gcc/config/c33/libgcc/addsf3.s
  92. create mode 100644 gcc/config/c33/libgcc/divdf3.lst
  93. create mode 100644 gcc/config/c33/libgcc/divdf3.s
  94. create mode 100644 gcc/config/c33/libgcc/divhi3.lst
  95. create mode 100644 gcc/config/c33/libgcc/divhi3.s
  96. create mode 100644 gcc/config/c33/libgcc/divsf3.lst
  97. create mode 100644 gcc/config/c33/libgcc/divsf3.s
  98. create mode 100644 gcc/config/c33/libgcc/divsi3.lst
  99. create mode 100644 gcc/config/c33/libgcc/divsi3.s
  100. create mode 100644 gcc/config/c33/libgcc/extsfdf.lst
  101. create mode 100644 gcc/config/c33/libgcc/extsfdf.s
  102. create mode 100644 gcc/config/c33/libgcc/fcmpd.lst
  103. create mode 100644 gcc/config/c33/libgcc/fcmpd.s
  104. create mode 100644 gcc/config/c33/libgcc/fcmps.lst
  105. create mode 100644 gcc/config/c33/libgcc/fcmps.s
  106. create mode 100644 gcc/config/c33/libgcc/fixdfi.lst
  107. create mode 100644 gcc/config/c33/libgcc/fixdfi.s
  108. create mode 100644 gcc/config/c33/libgcc/fixdfui.lst
  109. create mode 100644 gcc/config/c33/libgcc/fixdfui.s
  110. create mode 100644 gcc/config/c33/libgcc/fixsfi.lst
  111. create mode 100644 gcc/config/c33/libgcc/fixsfi.s
  112. create mode 100644 gcc/config/c33/libgcc/fixsfui.lst
  113. create mode 100644 gcc/config/c33/libgcc/fixsfui.s
  114. create mode 100644 gcc/config/c33/libgcc/flosidf.lst
  115. create mode 100644 gcc/config/c33/libgcc/flosidf.s
  116. create mode 100644 gcc/config/c33/libgcc/flosisf.lst
  117. create mode 100644 gcc/config/c33/libgcc/flosisf.s
  118. create mode 100644 gcc/config/c33/libgcc/libgcc.a
  119. create mode 100644 gcc/config/c33/libgcc/modhi3.lst
  120. create mode 100644 gcc/config/c33/libgcc/modhi3.s
  121. create mode 100644 gcc/config/c33/libgcc/modsi3.lst
  122. create mode 100644 gcc/config/c33/libgcc/modsi3.s
  123. create mode 100644 gcc/config/c33/libgcc/muldf3.lst
  124. create mode 100644 gcc/config/c33/libgcc/muldf3.s
  125. create mode 100644 gcc/config/c33/libgcc/mulsf3.lst
  126. create mode 100644 gcc/config/c33/libgcc/mulsf3.s
  127. create mode 100644 gcc/config/c33/libgcc/negdf2.lst
  128. create mode 100644 gcc/config/c33/libgcc/negdf2.s
  129. create mode 100644 gcc/config/c33/libgcc/negsf2.lst
  130. create mode 100644 gcc/config/c33/libgcc/negsf2.s
  131. create mode 100644 gcc/config/c33/libgcc/scan64.lst
  132. create mode 100644 gcc/config/c33/libgcc/scan64.s
  133. create mode 100644 gcc/config/c33/libgcc/sedscr
  134. create mode 100644 gcc/config/c33/libgcc/trncdfsf.lst
  135. create mode 100644 gcc/config/c33/libgcc/trncdfsf.s
  136. create mode 100644 gcc/config/c33/libgcc1.S
  137. create mode 100644 gcc/config/c33/t-c33
  138. diff --git a/config.sub b/config.sub
  139. old mode 100755
  140. new mode 100644
  141. index 2ab7f25..5afcd75
  142. --- a/config.sub
  143. +++ b/config.sub
  144. @@ -341,6 +341,8 @@ case $basic_machine in
  145. | ymp-* \
  146. | z8k-*)
  147. ;;
  148. + c33-*) # K.Watanabe gcc-3.3.2
  149. + ;;
  150. # Recognize the various machine names and aliases which stand
  151. # for a CPU type and a company and sometimes even an OS.
  152. 386bsd)
  153. diff --git a/gcc/Makefile.in b/gcc/Makefile.in
  154. index 67076d3..f8ed175 100644
  155. --- a/gcc/Makefile.in
  156. +++ b/gcc/Makefile.in
  157. @@ -660,7 +660,6 @@ HOST_VARRAY = $(BUILD_PREFIX)varray.o
  158. # currently being compiled, in both source trees, to be examined as well.
  159. INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
  160. -I$(srcdir)/config -I$(srcdir)/../include
  161. -
  162. # Always use -I$(srcdir)/config when compiling.
  163. .c.o:
  164. $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
  165. diff --git a/gcc/builtins.def b/gcc/builtins.def
  166. index c208b75..f76b74f 100644
  167. --- a/gcc/builtins.def
  168. +++ b/gcc/builtins.def
  169. @@ -738,6 +738,10 @@ DEF_BUILTIN (BUILT_IN_ABORT,
  170. 1, 0, 0,
  171. ATTR_NORETURN_NOTHROW_LIST)
  172. +/* DEL K.Watanabe V1.7 >>>>>>> */
  173. +/* -fno-builtin OƁAexit() / _exit() ֐́A^ႤƂȂB */
  174. +/* ̒`RgɂāAexit() / _exit() ֐ built in ֐O */
  175. +#if 0
  176. DEF_BUILTIN (BUILT_IN_EXIT,
  177. "__builtin_exit",
  178. NOT_BUILT_IN,
  179. @@ -753,6 +757,8 @@ DEF_BUILTIN (BUILT_IN__EXIT,
  180. BT_FN_VOID_INT,
  181. 1, 0, 1,
  182. ATTR_NORETURN_NOTHROW_LIST)
  183. +#endif
  184. +/* DEL K.Watanabe V1.7 <<<<<<< */
  185. DEF_BUILTIN (BUILT_IN__EXIT2,
  186. "__builtin__Exit",
  187. diff --git a/gcc/c-decl.c b/gcc/c-decl.c
  188. index 5cb5270..dc1a232 100644
  189. --- a/gcc/c-decl.c
  190. +++ b/gcc/c-decl.c
  191. @@ -4891,6 +4891,7 @@ get_parm_info (void_at_end)
  192. args are passed in their declared types. */
  193. tree type = TREE_TYPE (decl);
  194. DECL_ARG_TYPE (decl) = type;
  195. +
  196. if (PROMOTE_PROTOTYPES
  197. && INTEGRAL_TYPE_P (type)
  198. && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
  199. diff --git a/gcc/config.gcc b/gcc/config.gcc
  200. index 25b3be4..6d91434 100644
  201. --- a/gcc/config.gcc
  202. +++ b/gcc/config.gcc
  203. @@ -2697,6 +2697,21 @@ v850-*-*)
  204. c_target_objs="v850-c.o"
  205. cxx_target_objs="v850-c.o"
  206. ;;
  207. +
  208. +# ADD K.Watanabe V1.7 >>>>>>>
  209. +c33-*-*)
  210. + cpu_type=c33
  211. + tm_file="dbxelf.h elfos.h svr4.h c33/c33.h"
  212. + xm_file="c33/xm-c33.h"
  213. + tmake_file=c33/t-c33
  214. + if test x$stabs = xyes
  215. + then
  216. + tm_file="${tm_file} dbx.h"
  217. + fi
  218. + use_collect2=no
  219. + ;;
  220. +# ADD K.Watanabe V1.7 <<<<<<<
  221. +
  222. vax-*-bsd*) # VAXen running BSD
  223. tm_file="${tm_file} vax/bsd.h"
  224. use_collect2=yes
  225. diff --git a/gcc/config/c33/c33-protos.h b/gcc/config/c33/c33-protos.h
  226. new file mode 100644
  227. index 0000000..4221ab0
  228. --- /dev/null
  229. +++ b/gcc/config/c33/c33-protos.h
  230. @@ -0,0 +1,36 @@
  231. +extern void override_options PARAMS((void));
  232. +extern rtx function_arg PARAMS(( CUMULATIVE_ARGS *,enum machine_mode,tree,int ));
  233. +extern int const_costs PARAMS(());
  234. +extern void print_operand PARAMS(());
  235. +extern void print_operand_address PARAMS(());
  236. +extern void final_prescan_insn PARAMS((rtx insn,rtx *,int ));
  237. +extern char * output_move_single PARAMS(());
  238. +extern char * output_move_double PARAMS(( rtx * ));
  239. +extern char * output_btst PARAMS(( rtx * ));
  240. +extern char * output_bclr PARAMS(( rtx * ));
  241. +extern char * output_bset PARAMS(( rtx * ));
  242. +extern int call_address_operand PARAMS(( rtx,enum machine_mode ));
  243. +extern int power_of_two_operand PARAMS(());
  244. +extern int not_power_of_two_operand PARAMS(());
  245. +extern int general_operand_post_inc PARAMS(( rtx,enum machine_mode ));
  246. +extern int compute_register_save_size PARAMS(( long * ));
  247. +extern int compute_frame_size PARAMS(());
  248. +extern void expand_prologue PARAMS(());
  249. +extern void expand_epilogue PARAMS(());
  250. +extern void notice_update_cc PARAMS(());
  251. +extern c33_data_area c33_get_data_area PARAMS(( tree ));
  252. +extern void c33_encode_data_area PARAMS(( tree ));
  253. +extern int c33_interrupt_function_p PARAMS((void));
  254. +extern void c33_select_section PARAMS(( tree,int ));
  255. +extern int nshift_operator PARAMS(( rtx,enum machine_mode ));
  256. +extern int expand_a_shift PARAMS(( enum machine_mode,int,rtx* ));
  257. +extern char * emit_a_shift PARAMS(( enum rtx_code,rtx * ));
  258. +extern void print_options PARAMS(( FILE * ));
  259. +extern void declare_object PARAMS(());
  260. +extern void c33_output_aligned_bss PARAMS(( FILE *,tree,char*,int,int ));
  261. +extern void c33_output_common PARAMS(( FILE *,tree,char *,int,int ));
  262. +extern void c33_output_local PARAMS(( FILE *,tree,char *,int,int ));
  263. +extern void asm_file_start PARAMS(( FILE * ));
  264. +extern void expand_block_move PARAMS(( rtx* ));
  265. +extern char * output_block_move PARAMS(( rtx,rtx*,int ));
  266. +extern int c33_adjust_insn_length PARAMS(( rtx,int ));
  267. diff --git a/gcc/config/c33/c33.c b/gcc/config/c33/c33.c
  268. new file mode 100644
  269. index 0000000..6422a28
  270. --- /dev/null
  271. +++ b/gcc/config/c33/c33.c
  272. @@ -0,0 +1,4086 @@
  273. +/* Subroutines for insn-output.c for EPSON C33 series
  274. + Copyright (C) 1996, 1997 Free Software Foundation, Inc.
  275. + Contributed by Jeff Law (law@cygnus.com).
  276. +
  277. +This file is part of GNU CC.
  278. +
  279. +GNU CC is free software; you can redistribute it and/or modify
  280. +it under the terms of the GNU General Public License as published by
  281. +the Free Software Foundation; either version 2, or (at your option)
  282. +any later version.
  283. +
  284. +GNU CC is distributed in the hope that it will be useful,
  285. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  286. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  287. +GNU General Public License for more details.
  288. +
  289. +You should have received a copy of the GNU General Public License
  290. +along with GNU CC; see the file COPYING. If not, write to
  291. +the Free Software Foundation, 59 Temple Place - Suite 330,
  292. +Boston, MA 02111-1307, USA. */
  293. +
  294. +/***********************/
  295. +/* #include */
  296. +/***********************/
  297. +#include "config.h"
  298. +#include "system.h"
  299. +#include "tree.h"
  300. +#include "rtl.h"
  301. +#include "regs.h"
  302. +#include "hard-reg-set.h"
  303. +#include "real.h"
  304. +#include "insn-config.h"
  305. +#include "conditions.h"
  306. +#include "output.h"
  307. +#include "insn-attr.h"
  308. +#include "flags.h"
  309. +#include "recog.h"
  310. +#include "expr.h"
  311. +#include "function.h"
  312. +#include "toplev.h"
  313. +#include "ggc.h"
  314. +#include "integrate.h"
  315. +#include "tm_p.h"
  316. +#include "target.h"
  317. +#include "target-def.h"
  318. +
  319. +#ifndef streq
  320. +#define streq(a,b) (strcmp (a, b) == 0)
  321. +#endif
  322. +
  323. +/***********************/
  324. +/* #define */
  325. +/***********************/
  326. +#define GDA_REGNUM 15
  327. +#define ZDA_REGNUM 14
  328. +#define TDA_REGNUM 13
  329. +#define SDA_REGNUM 12
  330. +
  331. +
  332. +// ADD K.Watanabe V1.8 >>>>>>>
  333. +/***********************/
  334. +/* prototype */
  335. +/***********************/
  336. +void override_options ();
  337. +rtx function_arg ( CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, int named );
  338. +static void const_double_split ( rtx x, HOST_WIDE_INT *p_high, HOST_WIDE_INT *p_low );
  339. +static int const_costs_int ( HOST_WIDE_INT value );
  340. +int const_costs ( rtx r, enum rtx_code c );
  341. +void print_operand ( FILE *file, rtx x, int code );
  342. +void print_operand_address ( FILE *file, rtx addr );
  343. +void final_prescan_insn ( rtx insn, rtx *operand, int num_operands );
  344. +char * output_move_single ( rtx *operands, int unsignedp );
  345. +char *output_move_double ( rtx *operands );
  346. +char *output_btst ( rtx *operands );
  347. +char *output_bclr ( rtx *operands );
  348. +char *output_bset ( rtx *operands );
  349. +int call_address_operand ( rtx op, enum machine_mode mode );
  350. +int power_of_two_operand ( rtx op, enum machine_mode mode );
  351. +int not_power_of_two_operand ( rtx op, enum machine_mode mode );
  352. +int general_operand_post_inc ( rtx op, enum machine_mode mode );
  353. +int compute_register_save_size ( long *p_reg_saved );
  354. +int compute_frame_size ( int size, long *p_reg_saved );
  355. +static int check_call_being ();
  356. +static int check_mlt_being ();
  357. +void expand_prologue ( FILE *file );
  358. +void expand_epilogue ( FILE *file );
  359. +void notice_update_cc ( rtx exp, rtx insn );
  360. +c33_data_area c33_get_data_area ( tree decl );
  361. +static void c33_set_data_area ( tree decl, c33_data_area data_area );
  362. +void c33_encode_data_area ( tree decl );
  363. +int c33_interrupt_function_p (void);
  364. +void c33_select_section ( tree decl, int reloc );
  365. +int nshift_operator ( rtx x, enum machine_mode mode );
  366. +int expand_a_shift ( enum machine_mode mode, int code, rtx operands[] );
  367. +char *emit_a_shift ( enum rtx_code code, rtx *operands );
  368. +void print_options ( FILE *out );
  369. +void declare_object ( FILE *stream, char *name,
  370. + char *init_string, char *final_string, int size );
  371. +void c33_output_aligned_bss ( FILE * file, tree decl, char * name, int size, int align );
  372. +void c33_output_common ( FILE * file, tree decl, char * name, int size, int align );
  373. +void c33_output_local ( FILE * file, tree decl, char * name, int size, int align );
  374. +void asm_file_start ( FILE *file );
  375. +static void block_move_loop ( rtx dest_reg, rtx src_reg,
  376. + int bytes, int align, rtx orig_src );
  377. +static void block_move_call ( rtx dest_reg, rtx src_reg, rtx bytes_rtx );
  378. +void expand_block_move ( rtx operands[] );
  379. +char * output_block_move ( rtx insn, rtx operands[], int num_regs );
  380. +int c33_adjust_insn_length ( rtx insn, int length );
  381. +static tree c33_handle_interrupt_attribute ( tree *node, tree name,
  382. + tree args ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED, bool *no_add_attrs );
  383. +static tree c33_handle_section_attribute ( tree *node, tree name,
  384. + tree args ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED, bool *no_add_attrs );
  385. +static tree c33_handle_data_area_attribute ( tree *node, tree name,
  386. + tree args ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED, bool *no_add_attrs );
  387. +static void c33_encode_section_info ( tree decl, int first );
  388. +static void c33_asm_out_constructor ( rtx symbol, int priority ATTRIBUTE_UNUSED );
  389. +static void c33_asm_out_destructor ( rtx symbol, int priority ATTRIBUTE_UNUSED );
  390. +static void c33_unique_section ( tree decl, int reloc );
  391. +int c33_output_addr_const_extra ( FILE * file, rtx x );
  392. +static const char *c33_strip_name_encoding ( const char *str );
  393. +// ADD K.Watanabe V1.8 <<<<<<<
  394. +
  395. +
  396. +/************************/
  397. +/* C33: Global variable */
  398. +/************************/
  399. +/* ADD K.Watanabe V1.7 >>>>>>> */
  400. +const struct attribute_spec c33_attribute_table[];
  401. +
  402. +#undef TARGET_ASM_CONSTRUCTOR
  403. +#define TARGET_ASM_CONSTRUCTOR c33_asm_out_constructor
  404. +
  405. +#undef TARGET_ASM_DESTRUCTOR
  406. +#define TARGET_ASM_DESTRUCTOR c33_asm_out_destructor
  407. +
  408. +#undef TARGET_ATTRIBUTE_TABLE
  409. +#define TARGET_ATTRIBUTE_TABLE c33_attribute_table
  410. +
  411. +#undef TARGET_ASM_FUNCTION_PROLOGUE
  412. +#define TARGET_ASM_FUNCTION_PROLOGUE expand_prologue
  413. +
  414. +#undef TARGET_ASM_FUNCTION_EPILOGUE
  415. +#define TARGET_ASM_FUNCTION_EPILOGUE expand_epilogue
  416. +
  417. +#undef TARGET_ASM_SELECT_SECTION
  418. +#define TARGET_ASM_SELECT_SECTION c33_select_section
  419. +
  420. +#undef TARGET_ASM_SELECT_RTX_SECTION
  421. +#define TARGET_ASM_SELECT_RTX_SECTION const_section
  422. +
  423. +#undef TARGET_ENCODE_SECTION_INFO
  424. +#define TARGET_ENCODE_SECTION_INFO c33_encode_section_info
  425. +
  426. +#undef TARGET_ASM_UNIQUE_SECTION
  427. +#define TARGET_ASM_UNIQUE_SECTION c33_unique_section
  428. +
  429. +// ADD K.Watanabe V1.8 >>>>>>>
  430. +#undef TARGET_STRIP_NAME_ENCODING
  431. +#define TARGET_STRIP_NAME_ENCODING c33_strip_name_encoding
  432. +// ADD K.Watanabe V1.8 <<<<<<<
  433. +
  434. +
  435. +struct gcc_target targetm = TARGET_INITIALIZER;
  436. +/* ADD K.Watanabe V1.7 <<<<<<< */
  437. +
  438. +/* Information about the various small memory areas. */
  439. +/* C33: The default maximum value of the gda size is 16 byte. */
  440. +
  441. +struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] =
  442. +{
  443. + /* name value max physical max */
  444. + { "tda", (char *)0, 0, 8192 },
  445. + { "sda", (char *)0, 0, 8192 },
  446. + { "zda", (char *)0, 0, 8192 },
  447. + /* >>>>> change iruma m.takeishi '03.09.22
  448. + C33: Change the default from "-mgda=4" to "=0".
  449. + { "gda", (char *)0, 4, 8192 },
  450. + */
  451. + { "gda", (char *)0, 0, 8192 },
  452. +};
  453. +
  454. +/* C33: Change the variable for the interrupt function. */
  455. +/* True if we don't need to check any more if the current
  456. + function is an interrupt handler */
  457. +static int c33_interrupt_cache_p = FALSE;
  458. +
  459. +/* Whether current function is an interrupt handler. */
  460. +static int c33_interrupt_p = FALSE;
  461. +
  462. +#ifdef LEAF_REGISTERS
  463. +/* C33: The array which maps the normal reigster number to the interrupt leaf function. */
  464. +char leaf_reg_remap[] =
  465. + { -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, -1
  466. +};
  467. +
  468. +#endif /* */
  469. +
  470. +/* Files to separate the text and the data output, so that all of the data
  471. + can be emitted before the text, which will mean that the assembler will
  472. + generate smaller code, based on the global pointer. */
  473. +FILE *asm_out_data_file;
  474. +FILE *asm_out_text_file;
  475. +
  476. +/* Strings to hold which cpu and instruction set architecture to use. */
  477. +char *c33_cpu_string; /* for -mcpu=<xxx> */
  478. +
  479. +/* C33: Set the default GP number. */
  480. +/* >>>>> change iruma m.takeishi '03.10.08 */
  481. +/*
  482. +int gp_max = 4;
  483. +*/
  484. +int gp_max = 1;
  485. +/* <<<<< change iruma m.takeishi '03.10.08 */
  486. +char *gp_no; /* for -mdp=<xxx> */
  487. +
  488. +/* C33: specification for gdp */
  489. +int gdp = GDA_REGNUM; /* C33: the register number for gdp */
  490. +char *gdp_string; /* for -mgdp=xxx */
  491. +
  492. +struct gdp_select
  493. +{
  494. + char *name;
  495. + int number;
  496. +};
  497. +
  498. +struct gdp_select select_table[] =
  499. + {
  500. + /* name number */
  501. + { "dp", GDA_REGNUM },
  502. + { "zdp", ZDA_REGNUM },
  503. + { "tdp", TDA_REGNUM },
  504. + { "sdp", SDA_REGNUM },
  505. + { "r15", GDA_REGNUM },
  506. + { "r14", ZDA_REGNUM },
  507. + { "r13", TDA_REGNUM },
  508. + { "r12", SDA_REGNUM },
  509. + { NULL, 0 }
  510. + };
  511. +
  512. +/* Sometimes certain combinations of command options do not make
  513. + sense on a particular target machine. You can define a macro
  514. + `OVERRIDE_OPTIONS' to take account of this. This macro, if
  515. + defined, is executed once just after all the command options have
  516. + been parsed.
  517. +
  518. + Don't use this macro to turn on various extra optimizations for
  519. + `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
  520. +void
  521. +override_options ()
  522. +{
  523. + int i;
  524. +
  525. + /* parse -mdp=n switch */
  526. + if (gp_no != NULL)
  527. + {
  528. + if (!isdigit (*gp_no))
  529. + {
  530. + error ("dp=%s is not numeric.", gp_no);
  531. + }
  532. +
  533. + else
  534. + {
  535. + i = read_integral_parameter (gp_no, gp_no - 5, 4);
  536. + if (i > 6)
  537. + error ("dp=%s is too large.", gp_no);
  538. + else if (i < 1)
  539. + error ("dp=%s is too small.", gp_no);
  540. + else
  541. + gp_max = i;
  542. + }
  543. + }
  544. +
  545. + /* ADD K.Watanabe V1.7 >>>>>>> */
  546. + /* C33: "-mdp" in not supported.
  547. + So display warning if the value is set except 1. */
  548. +
  549. + if( gp_max != 1 ){
  550. + warning ( "-mdp=%d -- It does not support formally. Use it as AS IS.",gp_max );
  551. + }
  552. + /* ADD K.Watanabe V1.7 <<<<<<< */
  553. +
  554. + /* parse -mgdp=xxx switch */
  555. + if (gdp_string != NULL)
  556. + {
  557. + struct gdp_select *sel;
  558. +
  559. + gdp = 0;
  560. + for (sel = &select_table[0]; sel->name != NULL; sel++)
  561. + {
  562. + if (streq (gdp_string, sel->name)) {
  563. + gdp = sel->number;
  564. + break;
  565. + }
  566. + }
  567. + }
  568. +
  569. + if (gdp == 0)
  570. + {
  571. + error ("gdp=%s is invalid.", gdp_string);
  572. + gdp = GDA_REGNUM;
  573. + }
  574. +
  575. + if (gdp < 16 - gp_max)
  576. + {
  577. + error ("-mdp=%s does not support -mgdp=%s.", gp_no, gdp_string);
  578. + gdp = GDA_REGNUM;
  579. + }
  580. +
  581. + /* ADD K.Watanabe V1.7 >>>>>>> */
  582. + /* C33: "-mgdp" in not supported.
  583. + So display warning if the value is set except 15. ( Its meaing is %r15 ). */
  584. + if( gdp != 15 ){
  585. + warning ( "-mgdp=r%d -- It does not support formally. Use it as AS IS.",gdp );
  586. + }
  587. + /* ADD K.Watanabe V1.7 <<<<<<< */
  588. +
  589. + if (c33_cpu_string == (char *) 0)
  590. + {
  591. + if ((TARGET_C33ADV) && (TARGET_C33PE))
  592. + error ("-mc33adv conflicts with -mc33pe.");
  593. + else if (TARGET_C33ADV)
  594. + c33_cpu_string = C33_CPU_STRING_DEFAULT_ADVANCED;
  595. + else if (TARGET_C33PE)
  596. + c33_cpu_string = C33_CPU_STRING_DEFAULT_C33PE;
  597. + else
  598. + c33_cpu_string = C33_CPU_STRING_DEFAULT;
  599. + }
  600. +
  601. + /* Parse -mgda=nnn switches */
  602. + for (i = (int)SMALL_MEMORY_GDA; i < (int)SMALL_MEMORY_max; i++)
  603. + {
  604. + if (small_memory[i].value)
  605. + {
  606. + if (!isdigit (*small_memory[i].value))
  607. + error ("%s=%s is not numeric.",
  608. + small_memory[i].name,
  609. + small_memory[i].value);
  610. + else
  611. + {
  612. + small_memory[i].max = read_integral_parameter (small_memory[i].value, small_memory[i].value - 6, 4);
  613. + if (small_memory[i].max > small_memory[i].physical_max)
  614. + error ("%s=%s is too large.",
  615. + small_memory[i].name,
  616. + small_memory[i].value);
  617. + }
  618. + }
  619. + }
  620. +
  621. + /* ADD K.Watanabe V1.7 >>>>>>> */
  622. + /* C33: "-mgda" in not supported.
  623. + So display warning if the value is set except 0. */
  624. + if( small_memory [(int) SMALL_MEMORY_GDA].max != 0 ){
  625. + warning ( "-mgda=%d -- It does not support formally. Use it as AS IS.",small_memory [(int) SMALL_MEMORY_GDA].max );
  626. + }
  627. + /* ADD K.Watanabe V1.7 <<<<<<< */
  628. +
  629. + /* check -me[zts]da and -mdp=n switch */
  630. + if (TARGET_EXT_ZDA)
  631. + {
  632. + if (gp_max < 2){
  633. + error ("-mdp=%s does not support -mezda.", gp_no);
  634. + target_flags &= ~MASK_EXT_ZDA;
  635. + }
  636. +
  637. + /* ADD K.Watanabe V1.7 >>>>>>> */
  638. + /* C33: "-mezda" in not supported.
  639. + So display warning if "-mezda" is set. */
  640. + warning ( "-mezda -- It does not support formally. Use it as AS IS." );
  641. + /* ADD K.Watanabe V1.7 <<<<<<< */
  642. + }
  643. +
  644. + if (TARGET_EXT_TDA)
  645. + {
  646. + if (gp_max < 3){
  647. + error ("-mdp=%s does not support -metda.", gp_no);
  648. + target_flags &= ~MASK_EXT_TDA;
  649. + }
  650. +
  651. + /* ADD K.Watanabe V1.7 >>>>>>> */
  652. + /* C33: "-metda" in not supported.
  653. + So display warning if "-metda" is set. */
  654. + warning ( "-metda -- It does not support formally. Use it as AS IS." );
  655. + /* ADD K.Watanabe V1.7 <<<<<<< */
  656. +
  657. + }
  658. +
  659. + if (TARGET_EXT_SDA)
  660. + {
  661. + if (gp_max < 4){
  662. + error ("-mdp=%s does not support -mesda.", gp_no);
  663. + target_flags &= ~MASK_EXT_SDA;
  664. + }
  665. +
  666. + /* ADD K.Watanabe V1.7 >>>>>>> */
  667. + /* C33: "-mesda" in not supported.
  668. + So display warning if "-mesda" is set. */
  669. + warning ( "-mesda -- It does not support formally. Use it as AS IS." );
  670. + /* ADD K.Watanabe V1.7 <<<<<<< */
  671. + }
  672. +
  673. + /* ADD K.Watanabe V1.7 >>>>>>> */
  674. + if( !TARGET_C33ADV ){
  675. + if( flag_pic && TARGET_EXT_32 ){
  676. + error ("-fPIC conflicts with -medda32.");
  677. + }
  678. + }
  679. + /* ADD K.Watanabe V1.7 <<<<<<< */
  680. +}
  681. +
  682. +/* Return an RTX to represent where a value with mode MODE will be returned
  683. + from a function. If the result is 0, the argument is pushed. */
  684. +
  685. +/* C33: English above is incorrect.
  686. + This function returns RTX which represents where arguments
  687. + with mode MODE will be set.
  688. + If the result is 0, the argument is pushed. */
  689. +rtx
  690. +function_arg (cum, mode, type, named)
  691. + CUMULATIVE_ARGS *cum;
  692. + enum machine_mode mode;
  693. + tree type;
  694. + int named;
  695. +
  696. +{
  697. + rtx result = 0;
  698. + int size, align;
  699. +
  700. +/* C33: 1. The argument is pushed if if is variable argument. */
  701. + if (!named)
  702. + return NULL_RTX;
  703. +
  704. +/* C33: 2. Decide the size which corresponds to the mode. */
  705. + if (mode == BLKmode)
  706. + {
  707. + return 0; /* C33: Structure is passed through the stack. */
  708. + }
  709. + else
  710. + size = GET_MODE_SIZE (mode);
  711. +
  712. +/* C33: 3. Decide the accumlation arguments size after adjusting alignment. */
  713. + if (type)
  714. + align = TYPE_ALIGN (type) / BITS_PER_UNIT;
  715. +
  716. + else
  717. + align = size;
  718. + cum->nbytes = (cum->nbytes + align - 1) & ~(align - 1);
  719. +
  720. +/* C33: 4. The argument is pushed if the accumlation arguments is beyond 4 bytes. */
  721. + if (cum->nbytes > 4 * UNITS_PER_WORD)
  722. + return 0;
  723. +
  724. + if (type == NULL_TREE && cum->nbytes + size > 4 * UNITS_PER_WORD)
  725. + return 0;
  726. +
  727. +/* C33: 5. The argument is passed through the stack, if the mode is 'DFmode' and
  728. + already used argument registers is 3 or more. */
  729. + if (mode == DFmode)
  730. + {
  731. +
  732. + /* C33: Do argument registers be used 3 or more? */
  733. + if (cum->nbytes >= ((4 - 1) * UNITS_PER_WORD))
  734. + return (rtx) 0; /* C33: passed through the stack */
  735. + }
  736. +
  737. +/* C33: 6. Decide the argumtent register No. according to the accumlation argument size. */
  738. + switch (cum->nbytes / UNITS_PER_WORD)
  739. + {
  740. + case 0:
  741. + result = gen_rtx (REG, mode, 6);
  742. + break;
  743. + case 1:
  744. + result = gen_rtx (REG, mode, 7);
  745. + break;
  746. + case 2:
  747. + result = gen_rtx (REG, mode, 8);
  748. + break;
  749. + case 3:
  750. + result = gen_rtx (REG, mode, 9);
  751. + break;
  752. + default:
  753. + result = 0;
  754. + }
  755. +
  756. +/* C33: 7. Return the result. */
  757. + return result;
  758. +
  759. +/* C33: 8. Terminating process. */
  760. +}
  761. +
  762. +
  763. +/* Return the high and low words of a CONST_DOUBLE */
  764. +static void
  765. +const_double_split (x, p_high, p_low)
  766. + rtx x;
  767. + HOST_WIDE_INT *p_high;
  768. + HOST_WIDE_INT *p_low;
  769. +
  770. +{
  771. + if (GET_CODE (x) == CONST_DOUBLE)
  772. + {
  773. + long t[2];
  774. + REAL_VALUE_TYPE rv;
  775. + switch (GET_MODE (x))
  776. + {
  777. + case DFmode:
  778. + REAL_VALUE_FROM_CONST_DOUBLE (rv, x);
  779. + REAL_VALUE_TO_TARGET_DOUBLE (rv, t);
  780. + *p_high = t[1]; /* since v850 is little endian */
  781. + *p_low = t[0]; /* high is second word */
  782. + return;
  783. + case SFmode:
  784. + REAL_VALUE_FROM_CONST_DOUBLE (rv, x);
  785. + REAL_VALUE_TO_TARGET_SINGLE (rv, *p_high);
  786. + *p_low = 0;
  787. + return;
  788. + case VOIDmode:
  789. + case DImode:
  790. + *p_high = CONST_DOUBLE_HIGH (x);
  791. + *p_low = CONST_DOUBLE_LOW (x);
  792. + return;
  793. + }
  794. + }
  795. + fatal_insn ("const_double_split got a bad insn:", x);
  796. +}
  797. +
  798. +
  799. +/* Return the cost of the rtx R with code CODE. */
  800. +/* C33: ld.w %rd, sign6 */
  801. +static int
  802. +const_costs_int (value)
  803. + HOST_WIDE_INT value;
  804. +
  805. +{
  806. + if (CONST_OK_FOR_SIGNED6 (value)) /* 6 bit signed */
  807. + return 1;
  808. +
  809. + else if (CONST_OK_FOR_SIGNED19 (value)) /* 19 bit signed */
  810. + return 2;
  811. +
  812. + else
  813. + return 3;
  814. +}
  815. +
  816. +int
  817. +const_costs (r, c)
  818. + rtx r;
  819. + enum rtx_code c;
  820. +
  821. +{
  822. + HOST_WIDE_INT high, low;
  823. + switch (c)
  824. + {
  825. + case CONST_INT:
  826. + return const_costs_int (INTVAL (r));
  827. + case CONST_DOUBLE:
  828. + return 20; /* C33: Big value. */
  829. + case SYMBOL_REF:
  830. + case LABEL_REF:
  831. + case CONST:
  832. + default:
  833. + return 3; /* C33: sign32 */
  834. + }
  835. +}
  836. +
  837. +
  838. +/* Print operand X using operand code CODE to assembly language output file
  839. + FILE. */
  840. +/********************************************************************************************
  841. +Format : void print_operand (file, x, code)
  842. +Input : FILE *file -- pointer for the output file
  843. + rtx x
  844. + int code -- kind of opecode
  845. +Output : None
  846. +Return : None
  847. +Explanation : Add necessary information to opecode.
  848. +*********************************************************************************************/
  849. +void print_operand (file, x, code)
  850. + FILE *file;
  851. + rtx x;
  852. + int code;
  853. +{
  854. + HOST_WIDE_INT high, low;
  855. + HOST_WIDE_INT value;
  856. +
  857. + switch (code)
  858. + {
  859. + case 'b': /* C33: branch */
  860. + case 'B': /* C33: branch -- inverse condition */
  861. + switch (code == 'B' ? reverse_condition (GET_CODE (x)) : GET_CODE (x))
  862. + {
  863. + case NE:
  864. + fprintf (file, "ne");
  865. + break;
  866. + case EQ:
  867. + fprintf (file, "eq");
  868. + break;
  869. + case GE:
  870. + fprintf (file, "ge");
  871. + break;
  872. + case GT:
  873. + fprintf (file, "gt");
  874. + break;
  875. + case LE:
  876. + fprintf (file, "le");
  877. + break;
  878. + case LT:
  879. + fprintf (file, "lt");
  880. + break;
  881. + case GEU:
  882. + fprintf (file, "uge");
  883. + break;
  884. + case GTU:
  885. + fprintf (file, "ugt");
  886. + break;
  887. + case LEU:
  888. + fprintf (file, "ule");
  889. + break;
  890. + case LTU:
  891. + fprintf (file, "ult");
  892. + break;
  893. + default:
  894. + abort ();
  895. + }
  896. + break;
  897. +
  898. + case 'M': /* C33: bit operaion (btst, bset) */
  899. + fprintf (file, "%d", exact_log2 (0xff & INTVAL (x)));
  900. + break;
  901. + case 'm': /* C33: bit operaion (bclr) */
  902. + fprintf (file, "%d", exact_log2 (0xff & ~(INTVAL (x))));
  903. + break;
  904. +
  905. + case 'W': /* C33: print the instruction suffix -- sign extention */
  906. + /* C33: Is the mode dst or src? */
  907. + switch (GET_MODE (x))
  908. + {
  909. + default:
  910. + abort ();
  911. + case QImode:
  912. + fputs (".b", file);
  913. + break;
  914. + case HImode:
  915. + fputs (".h", file);
  916. + break;
  917. + case SImode:
  918. + fputs (".w", file);
  919. + break;
  920. + case SFmode:
  921. + fputs (".w", file);
  922. + break;
  923. + }
  924. + break;
  925. +
  926. + case 'w': /* C33: print the instruction suffix -- zero extention */
  927. +
  928. + /* C33: Is the mode dst or src? */
  929. + switch (GET_MODE (x))
  930. + {
  931. + default:
  932. + abort ();
  933. + case QImode:
  934. + fputs (".ub", file);
  935. + break;
  936. + case HImode:
  937. + fputs (".uh", file);
  938. + break;
  939. + case SImode:
  940. + fputs (".w", file);
  941. + break;
  942. + case SFmode:
  943. + fputs (".w", file);
  944. + break;
  945. + }
  946. + break;
  947. +
  948. + case 'p': /* SYMBOL_REF/LABEL_REF/CONST */
  949. + /* C33: The offset process in the case that symbols are reffered. */
  950. + {
  951. + char* name;
  952. +
  953. + if ((GET_CODE (x) == SYMBOL_REF) || (GET_CODE (x) == LABEL_REF))
  954. + name = XSTR (x, 0);
  955. + else if (GET_CODE (x) == CONST)
  956. + name = XSTR (XEXP (XEXP (x, 0), 0), 0);
  957. + else
  958. + abort ();
  959. +
  960. + if (ZDA_NAME_P (name))
  961. + {
  962. + if (TARGET_EXT_ZDA)
  963. + {
  964. + fprintf (file, "ext zoff_hi(");
  965. + print_operand_address (file, x);
  966. + fprintf (file, ")\n\t");
  967. + }
  968. + fprintf (file, "ext zoff_lo(");
  969. + print_operand_address (file, x);
  970. + fprintf (file, ")");
  971. + }
  972. + else if (TDA_NAME_P (name))
  973. + {
  974. + if (TARGET_EXT_TDA)
  975. + {
  976. + fprintf (file, "ext toff_hi(");
  977. + print_operand_address (file, x);
  978. + fprintf (file, ")\n\t");
  979. + }
  980. + fprintf (file, "ext toff_lo(");
  981. + print_operand_address (file, x);
  982. + fprintf (file, ")");
  983. + }
  984. + else if (SDA_NAME_P (name))
  985. + {
  986. + if (TARGET_EXT_SDA)
  987. + {
  988. + fprintf (file, "ext soff_hi(");
  989. + print_operand_address (file, x);
  990. + fprintf (file, ")\n\t");
  991. + }
  992. + fprintf (file, "ext soff_lo(");
  993. + print_operand_address (file, x);
  994. + fprintf (file, ")");
  995. + }
  996. + else if (GDA_NAME_P (name))
  997. + {
  998. + fprintf (file, "ext goff_lo(");
  999. +
  1000. + print_operand_address (file, x);
  1001. + fprintf (file, ")");
  1002. + }
  1003. + else
  1004. + {
  1005. + if(TARGET_C33ADV){
  1006. + fprintf (file, "ext dpoff_h(");
  1007. + print_operand_address (file, x);
  1008. + fprintf (file, ")\n\text dpoff_m(");
  1009. +
  1010. + print_operand_address (file, x); /* ADD K.Watanabe V1.4 */
  1011. + fprintf (file, ")"); /* ADD K.Watanabe V1.4 */
  1012. + } else {
  1013. + /* CHG K.Watanabe V1.7 >>>>>>> */
  1014. + /************************************************************/
  1015. + /* C33: In the case that symbol address is reffered. */
  1016. + /* ( no -medda32 ) */
  1017. + /* ext doff_hi() */
  1018. + /* ext doff_lo() */
  1019. + /* add %rn,%r15 */
  1020. + /* */
  1021. + /* ( -medda32 ) */
  1022. + /* xld.w %rn,xxxx */
  1023. + /************************************************************/
  1024. + if( TARGET_EXT_32 ){
  1025. + ;
  1026. + } else {
  1027. + fprintf (file, "ext doff_hi(");
  1028. + print_operand_address (file, x);
  1029. + fprintf (file, ")\n\text doff_lo(");
  1030. + print_operand_address (file, x); /* ADD K.Watanabe V1.7 */
  1031. + fprintf (file, ")"); /* ADD K.Watanabe V1.7 */
  1032. + }
  1033. + }
  1034. + /* CHG K.Watanabe V1.7 <<<<<<< */
  1035. +
  1036. + // print_operand_address (file, x); /* DEL K.Watanabe V1.4 */
  1037. + // fprintf (file, ")"); /* DEL K.Watanabe V1.4 */
  1038. + }
  1039. + }
  1040. + break;
  1041. +
  1042. + case 'P': /* C33: The offset process in the case that the memory is accessed. */
  1043. + {
  1044. + rtx xx;
  1045. + char* name;
  1046. +
  1047. + xx = XEXP(x, 0); /* C33: "x" means "MEM", so "xx" shall be "CONST" or "SYMBOL_REF". */
  1048. + if (GET_CODE (xx) == SYMBOL_REF)
  1049. + name = XSTR (xx, 0);
  1050. + else if (GET_CODE (xx) == CONST)
  1051. + name = XSTR (XEXP (XEXP (xx, 0), 0), 0);
  1052. + else
  1053. + abort ();
  1054. +
  1055. + if (ZDA_NAME_P (name))
  1056. + {
  1057. + if (TARGET_EXT_ZDA)
  1058. + {
  1059. + fprintf (file, "ext zoff_hi(");
  1060. + print_operand_address (file, xx);
  1061. + fprintf (file, ")\n\t");
  1062. + }
  1063. + fprintf (file, "ext zoff_lo(");
  1064. + print_operand_address (file, xx);
  1065. + fprintf (file, ")");
  1066. + }
  1067. + else if (TDA_NAME_P (name))
  1068. + {
  1069. + if (TARGET_EXT_TDA)
  1070. + {
  1071. + fprintf (file, "ext toff_hi(");
  1072. + print_operand_address (file, xx);
  1073. + fprintf (file, ")\n\t");
  1074. + }
  1075. + fprintf (file, "ext toff_lo(");
  1076. + print_operand_address (file, xx);
  1077. + fprintf (file, ")");
  1078. + }
  1079. + else if (SDA_NAME_P (name))
  1080. + {
  1081. + if (TARGET_EXT_SDA)
  1082. + {
  1083. + fprintf (file, "ext soff_hi(");
  1084. + print_operand_address (file, xx);
  1085. + fprintf (file, ")\n\t");
  1086. + }
  1087. + fprintf (file, "ext soff_lo(");
  1088. + print_operand_address (file, xx);
  1089. + fprintf (file, ")");
  1090. + }
  1091. + else if (GDA_NAME_P (name))
  1092. + {
  1093. + fprintf (file, "ext goff_lo(");
  1094. +
  1095. + print_operand_address (file, xx);
  1096. + fprintf (file, ")");
  1097. + }
  1098. + else
  1099. + {
  1100. + if(TARGET_C33ADV){
  1101. + fprintf (file, "ext dpoff_h(");
  1102. + print_operand_address (file, xx);
  1103. + fprintf (file, ")\n\text dpoff_m(");
  1104. +
  1105. + print_operand_address (file, xx); /* ADD K.Watanabe V1.4 */
  1106. + fprintf (file, ")"); /* ADD K.Watanabe V1.4 */
  1107. +
  1108. + /* CHG K.Watanabe V1.7 >>>>>>> */
  1109. + } else {
  1110. + /************************************************************/
  1111. + /* ext doff_hi( symbol ) */
  1112. + /* ext doff_lo( symbol ) */
  1113. + /* */
  1114. + /* xld.w %rn,symbol */
  1115. + /************************************************************/
  1116. + if (TARGET_EXT_32){
  1117. + ; /* C33: It can't come here. */
  1118. + } else {
  1119. + fprintf (file, "ext doff_hi(");
  1120. + print_operand_address (file, xx);
  1121. + fprintf (file, ")\n\text doff_lo(");
  1122. +
  1123. + print_operand_address (file, xx);
  1124. + fprintf (file, ")");
  1125. + }
  1126. + }
  1127. + /* CHG K.Watanabe V1.7 <<<<<<< */
  1128. +
  1129. + //print_operand_address (file, xx); /* DEL K.Watanabe V1.4 */
  1130. + //fprintf (file, ")"); /* DEL K.Watanabe V1.4 */
  1131. + }
  1132. + }
  1133. + break;
  1134. +
  1135. + case 'q': /* C33: Second operand in the case that symbol is refferd. */
  1136. + {
  1137. + char* name;
  1138. +
  1139. + if ((GET_CODE (x) == SYMBOL_REF) || (GET_CODE (x) == LABEL_REF))
  1140. + name = XSTR (x, 0);
  1141. + else if (GET_CODE (x) == CONST)
  1142. + name = XSTR (XEXP (XEXP (x, 0), 0), 0);
  1143. + else
  1144. + abort ();
  1145. +
  1146. + if (ZDA_NAME_P (name))
  1147. + fprintf (file, "%%r14");
  1148. + else if (TDA_NAME_P (name))
  1149. + fprintf (file, "%%r13");
  1150. + else if (SDA_NAME_P (name))
  1151. + fprintf (file, "%%r12");
  1152. + else if (GDA_NAME_P (name))
  1153. + fprintf (file, "%s", reg_names[gdp]);
  1154. + else
  1155. + if(TARGET_C33ADV)
  1156. + {
  1157. + fprintf (file, "dpoff_l(");
  1158. + print_operand_address (file, x);
  1159. + fprintf (file, ")");
  1160. + }
  1161. + else
  1162. + {
  1163. + /* CHG K.Watanabe V1.7 >>>>>>> */
  1164. + /************************************************************/
  1165. + /* C33: In the case that symbol address is referred. */
  1166. + /* ( no -medda32 ) */
  1167. + /* ext doff_hi() */
  1168. + /* ext doff_lo() */
  1169. + /* add %rn,%r15 */
  1170. + /* */
  1171. + /* ( -medda32 ) */
  1172. + /* xld.w %rn,xxxx */
  1173. + /************************************************************/
  1174. + if( TARGET_EXT_32 ){
  1175. + print_operand_address (file, x);
  1176. + } else {
  1177. + fprintf (file, "%%r15");
  1178. + }
  1179. + /* CHG K.Watanabe V1.7 <<<<<<< */
  1180. + }
  1181. + }
  1182. + break;
  1183. + case 'Q': /* C33: The register which saves the memory access address. */
  1184. + /* C33: [ %rn ] */
  1185. + {
  1186. + rtx xx;
  1187. + char* name;
  1188. +
  1189. + xx = XEXP(x, 0); /* C33: "x" means "MEM", so "xx" shall be "CONST" or "SYMBOL_REF". */
  1190. + if (GET_CODE (xx) == CONST)
  1191. + name = XSTR (XEXP (XEXP (xx, 0), 0), 0);
  1192. + else if (GET_CODE (xx) == SYMBOL_REF)
  1193. + name = XSTR (xx, 0);
  1194. + else
  1195. + abort ();
  1196. +
  1197. + if (ZDA_NAME_P (name))
  1198. + fprintf (file, "%%r14");
  1199. + else if (TDA_NAME_P (name))
  1200. + fprintf (file, "%%r13");
  1201. + else if (SDA_NAME_P (name))
  1202. + fprintf (file, "%%r12");
  1203. + else if (GDA_NAME_P (name))
  1204. + fprintf (file, "%s", reg_names[gdp]);
  1205. + else
  1206. + if(TARGET_C33ADV)
  1207. + {
  1208. + fprintf (file, "%%dp+dpoff_l(");
  1209. + print_operand_address (file, xx);
  1210. + fprintf (file, ")");
  1211. + }
  1212. + else
  1213. + {
  1214. + /* CHG K.Watanabe V1.7 >>>>>>> */
  1215. + /************************************************************/
  1216. + /* ext doff_hi( symbol ) */
  1217. + /* ext doff_lo( symbol ) */
  1218. + /* */
  1219. + /* xld.w %rn,symbol */
  1220. + /************************************************************/
  1221. + if( TARGET_EXT_32 ){
  1222. + ; /* C33: It can't come here. */
  1223. + } else {
  1224. + /* CHG K.Watanabe V1.7 <<<<<<< */
  1225. + fprintf (file, "%%r15");
  1226. + }
  1227. + }
  1228. + }
  1229. + break;
  1230. + case 'R': /* 2nd word of a double. */
  1231. + switch (GET_CODE (x))
  1232. + {
  1233. + case REG:
  1234. + fputs (reg_names[REGNO (x) + 1], file);
  1235. + break;
  1236. + case MEM:
  1237. +/* CHG K.Watanabe V1.7 >>>>>>> */
  1238. +/*
  1239. + print_operand_address (file,
  1240. + XEXP (adj_offsettable_operand (x, 4), 0));
  1241. +*/
  1242. + print_operand_address (file,
  1243. + XEXP (adjust_address (x, SImode, 4), 0));
  1244. +/* CHG K.Watanabe V1.7 <<<<<<< */
  1245. +
  1246. + break;
  1247. + default:
  1248. + break;
  1249. + }
  1250. + break;
  1251. + case 'F': /* high word of CONST_DOUBLE */
  1252. + if (GET_CODE (x) == CONST_INT)
  1253. + fprintf (file, "%d", (INTVAL (x) >= 0) ? 0 : -1);
  1254. +
  1255. + else if (GET_CODE (x) == CONST_DOUBLE)
  1256. +
  1257. + {
  1258. + const_double_split (x, &high, &low);
  1259. + fprintf (file, "0x%lx", (long) high);
  1260. + }
  1261. +
  1262. + else
  1263. + abort ();
  1264. + break;
  1265. + case 'f': /* C33: hex notation float for debug */
  1266. + {
  1267. + REAL_VALUE_TYPE type;
  1268. + char s[30];
  1269. + /* CHG K.Watanabe V1.7 >>>>>>> */
  1270. + #if 0
  1271. + REAL_VALUE_FROM_CONST_DOUBLE (type, x);
  1272. + REAL_VALUE_TO_DECIMAL (type, "%.20e", s);
  1273. + #endif
  1274. +
  1275. + real_to_decimal (s, CONST_DOUBLE_REAL_VALUE (x), sizeof (s), 0, 1);
  1276. + /* CHG K.Watanabe V1.7 <<<<<<< */
  1277. + fprintf (file, s);
  1278. + }
  1279. + break;
  1280. + case 'v': /* C33: hex notation for debug */
  1281. + fprintf (file, "0x%x", INTVAL (x));
  1282. + break;
  1283. + case '#':
  1284. +
  1285. + /* C33: ".d" is not output, if there is not the delay slot instruction. */
  1286. + if (dbr_sequence_length () != 0)
  1287. + fputs (".d", file);
  1288. + break;
  1289. + default:
  1290. + switch (GET_CODE (x))
  1291. + {
  1292. + case MEM:
  1293. + if (GET_CODE (XEXP (x, 0)) == CONST_INT)
  1294. + output_address (gen_rtx
  1295. + (PLUS, SImode, gen_rtx (REG, SImode, 0),
  1296. + XEXP (x, 0)));
  1297. +
  1298. + else
  1299. + output_address (XEXP (x, 0));
  1300. + break;
  1301. + case REG:
  1302. + /* %rd / %rs */
  1303. + /* C33: It comes here in the case that the insturction is both load and save. */
  1304. + fputs (reg_names[REGNO (x)], file);
  1305. + break;
  1306. +
  1307. + case CONST_INT:
  1308. + case SYMBOL_REF:
  1309. + case CONST:
  1310. + case LABEL_REF:
  1311. + case CODE_LABEL:
  1312. + print_operand_address (file, x);
  1313. + break;
  1314. + default:
  1315. + abort ();
  1316. + }
  1317. + break;
  1318. + }
  1319. +}
  1320. +
  1321. +/* Output assembly language output for the address ADDR to FILE. */
  1322. +void
  1323. +print_operand_address (file, addr)
  1324. + FILE *file;
  1325. + rtx addr;
  1326. +
  1327. +{
  1328. + switch (GET_CODE (addr))
  1329. + {
  1330. + case REG:
  1331. + print_operand (file, addr, 0);
  1332. + break;
  1333. + case POST_INC:
  1334. + print_operand (file, XEXP (addr, 0), 0);
  1335. + break;
  1336. + case PLUS:
  1337. + if (GET_CODE (XEXP (addr, 0)) == CONST_INT)
  1338. + {
  1339. + print_operand (file, XEXP (addr, 1), 0);
  1340. + if (INTVAL (XEXP (addr, 0)) >= 0)
  1341. + fprintf (file, "+");
  1342. + print_operand (file, XEXP (addr, 0), 0);
  1343. + }
  1344. +
  1345. + else
  1346. + {
  1347. + print_operand (file, XEXP (addr, 0), 0);
  1348. + if (INTVAL (XEXP (addr, 1)) >= 0)
  1349. + fprintf (file, "+");
  1350. + print_operand (file, XEXP (addr, 1), 0);
  1351. + }
  1352. + break;
  1353. + default:
  1354. + output_addr_const (file, addr);
  1355. + break;
  1356. + }
  1357. +}
  1358. +
  1359. +
  1360. +/* Output all insn addresses and their sizes into the assembly language
  1361. + output file. This is helpful for debugging whether the length attributes
  1362. + in the md file are correct. This is not meant to be a user selectable
  1363. + option. */
  1364. +
  1365. +void
  1366. +final_prescan_insn (insn, operand, num_operands)
  1367. + rtx insn, *operand;
  1368. + int num_operands;
  1369. +{
  1370. + /* This holds the last insn address. */
  1371. + static int last_insn_address = 0;
  1372. +
  1373. + int uid = INSN_UID (insn);
  1374. +
  1375. + if (TARGET_ADDRESSES)
  1376. + {
  1377. + /* CHG K.Watanabe V1.7 >>>>>>> */
  1378. +/*
  1379. + fprintf (asm_out_file, "; 0x%x %d\n", insn_addresses[uid],
  1380. + insn_addresses[uid] - last_insn_address);
  1381. + last_insn_address = insn_addresses[uid];
  1382. +*/
  1383. + fprintf (asm_out_file, "; 0x%x %d\n", INSN_ADDRESSES(uid),
  1384. + INSN_ADDRESSES(uid) - last_insn_address);
  1385. + last_insn_address = INSN_ADDRESSES(uid);
  1386. + /* CHG K.Watanabe V1.7 <<<<<<< */
  1387. + }
  1388. +}
  1389. +
  1390. +/* Return appropriate code to load up a 1, 2, or 4 integer/floating
  1391. + point value. */
  1392. +
  1393. +/*****************************************************************************************************
  1394. +Format : char * output_move_single (operands, unsignedp)
  1395. +Input : rtx *operands -- pointer for operand
  1396. + int unsignedp -- true in the case of zero extention
  1397. +Output : None
  1398. +Return : assember string output
  1399. +Explanation : EOutput "ld.x" instruction.
  1400. + EThere is not the instruction of memory saving and memory loading in one instruction
  1401. + in the case of "-medda32" && "!adv" && "default data area".
  1402. +*****************************************************************************************************/
  1403. +char * output_move_single (operands, unsignedp)
  1404. + rtx *operands;
  1405. + int unsignedp; /* C33: true in the case of zero extention */
  1406. +
  1407. +{
  1408. + rtx dst = operands[0];
  1409. + rtx src = operands[1];
  1410. + rtx xx;
  1411. + char* name;
  1412. +
  1413. + if (REG_P (dst)){
  1414. + if (REG_P (src)) { /* C33: register to register */
  1415. + if (unsignedp == TRUE){
  1416. + return "ld%w1\t%0,%1"; /* C33: zero extention */
  1417. + } else {
  1418. + return "ld%W1\t%0,%1"; /* C33: sign extention */
  1419. + }
  1420. + } else if (GET_CODE (src) == CONST_INT) { /* C33: immediate to register */
  1421. + return "xld.w\t%0,%1\t;%v1";
  1422. + } else if (GET_CODE (src) == CONST_DOUBLE && GET_MODE (src) == SFmode) {
  1423. + return "xld.w\t%0,%F1\t;%f1"; /* C33: immediate to register */
  1424. + } else if (GET_CODE (src) == MEM) { /* C33: memory to register */
  1425. + if (GET_CODE (XEXP (src, 0)) == POST_INC){
  1426. + if (unsignedp == TRUE){
  1427. + return "ld%w1\t%0,[%1]+"; /* C33: zero extention */
  1428. + } else {
  1429. + return "ld%W1\t%0,[%1]+"; /* C33: sign extention */
  1430. + }
  1431. + } else if (GET_CODE (XEXP (src, 0)) == REG){
  1432. + if (unsignedp == TRUE){
  1433. + return "ld%w1\t%0,[%1]"; /* C33: zero extention */
  1434. + } else {
  1435. + return "ld%W1\t%0,[%1]"; /* C33: sign extention */
  1436. + }
  1437. + } else if (GET_CODE (XEXP (src, 0)) == PLUS){
  1438. + if (unsignedp == TRUE) {
  1439. + return "xld%w1\t%0,[%1]"; /* C33: zero extention */
  1440. + } else {
  1441. + return "xld%W1\t%0,[%1]"; /* C33: sign extention */
  1442. + }
  1443. + } else {
  1444. + if (unsignedp == TRUE) {
  1445. + return "%P1\n\tld%w1\t%0,[%Q1]"; /* C33: zero extention */
  1446. + } else {
  1447. + return "%P1\n\tld%W1\t%0,[%Q1]"; /* C33: sign extention */
  1448. + }
  1449. + }
  1450. + } else if (GET_CODE (src) == LABEL_REF /* C33: symbol to register */
  1451. + || GET_CODE (src) == SYMBOL_REF || GET_CODE (src) == CONST) {
  1452. +
  1453. + /* C33: 2 instructions at addition in the case that indirect of "GP" can be used. */
  1454. + if (TARGET_C33ADV){
  1455. + /* char *name; */
  1456. +
  1457. + if ((GET_CODE (src) == SYMBOL_REF) || (GET_CODE (src) == LABEL_REF))
  1458. + name = XSTR (src, 0);
  1459. + else
  1460. + name = XSTR (XEXP (XEXP (src, 0), 0), 0);
  1461. +
  1462. + if (ENCODED_NAME_P (name))
  1463. + return "%p1\n\tadd\t%0,%q1"; /* C33: s/t/z/g data area */
  1464. + else
  1465. + return "ld.w\t%0,%%dp\n\t%p1\n\tadd\t%0,%q1"; /* C33: default data area */
  1466. + }
  1467. + /* CHG K.Watanabe V1.7 >>>>>>> */
  1468. + else
  1469. + {
  1470. + if ((GET_CODE (src) == SYMBOL_REF) || (GET_CODE (src) == LABEL_REF)){
  1471. + name = XSTR (src, 0);
  1472. + } else {
  1473. + name = XSTR (XEXP (XEXP (src, 0), 0), 0);
  1474. + }
  1475. +
  1476. + /************************************************************/
  1477. + /* C33: In the case of symbol address is referred. */
  1478. + /* ( no -medda32 ) */
  1479. + /* ext doff_hi() */
  1480. + /* ext doff_lo() */
  1481. + /* add %rn,%r15 */
  1482. + /* */
  1483. + /* ( -medda32 ) */
  1484. + /* xld.w %rn,xxxx */
  1485. + /************************************************************/
  1486. +
  1487. + /* return "%p1\n\tadd\t%0,%q1"; */
  1488. + if ( ( ENCODED_NAME_P (name) )){ /* C33: s/t/z/g data area */
  1489. + return "%p1\n\tadd\t%0,%q1";
  1490. + } else { /* C33: default data area */
  1491. + if ( TARGET_EXT_32 ){
  1492. + return "%p1xld.w\t%0,%q1"; /* C33: "-medda32" option */
  1493. + }else{
  1494. + return "%p1\n\tadd\t%0,%q1"; /* C33: Not "-medda32" option */
  1495. + }
  1496. + }
  1497. + }
  1498. + /* CHG K.Watanabe V1.7 <<<<<<< */
  1499. + }
  1500. + } else if (GET_CODE (dst) == MEM) { /* C33: register to memory */
  1501. + if (REG_P (src)) {
  1502. + if (GET_CODE (XEXP (dst, 0)) == POST_INC){
  1503. + return "ld%W1\t[%0]+,%1"; /* C33: sign extention */
  1504. + } else if (GET_CODE (XEXP (dst, 0)) == REG) {
  1505. + return "ld%W1\t[%0],%1"; /* C33: sign extention */
  1506. + } else if (GET_CODE (XEXP (dst, 0)) == PLUS){
  1507. + return "xld%W1\t[%0],%1"; /* C33: sign extention */
  1508. + } else {
  1509. + return "%P0\n\tld%W1\t[%Q0],%1"; /* C33: sign extention */
  1510. + }
  1511. + }
  1512. + }
  1513. + fatal_insn ("output_move_single:", gen_rtx (SET, VOIDmode, dst, src));
  1514. + return "";
  1515. +}
  1516. +
  1517. +/* Return appropriate code to load up an 8 byte integer or
  1518. + floating point value */
  1519. +char *
  1520. +output_move_double (operands)
  1521. + rtx *operands;
  1522. +
  1523. +{
  1524. + enum machine_mode mode = GET_MODE (operands[0]);
  1525. + rtx dst = operands[0];
  1526. + rtx src = operands[1];
  1527. +
  1528. + /* C33: register to register */
  1529. + if (register_operand (dst, mode) && register_operand (src, mode))
  1530. +
  1531. + {
  1532. + if (REGNO (src) + 1 == REGNO (dst))
  1533. + return "ld.w\t%R0,%R1\n\tld.w\t%0,%1";
  1534. +
  1535. + else
  1536. + return "ld.w\t%0,%1\n\tld.w\t%R0,%R1";
  1537. + }
  1538. +
  1539. + /* C33: immediate to register */
  1540. + if (GET_CODE (src) == CONST_INT) /* C33: Double type or long long type in the case that
  1541. + only sign is set in high order register. */
  1542. + {
  1543. + HOST_WIDE_INT high_low[2];
  1544. + int i;
  1545. + rtx xop[10];
  1546. + high_low[0] = INTVAL (src);
  1547. + high_low[1] = (INTVAL (src) >= 0) ? 0 : -1;
  1548. + for (i = 0; i < 2; i++)
  1549. +
  1550. + {
  1551. + xop[0] = gen_rtx (REG, SImode, REGNO (dst) + i);
  1552. + xop[1] = GEN_INT (high_low[i]);
  1553. +
  1554. + // CHG K.Watanabe V1.8 >>>>>>>
  1555. + #if 0
  1556. + output_asm_insn (output_move_single (xop), xop);
  1557. + #endif
  1558. +
  1559. + output_asm_insn (output_move_single (xop,1), xop);
  1560. + // CHG K.Watanabe V1.8 <<<<<<<
  1561. + }
  1562. + return "";
  1563. + }
  1564. +
  1565. + else if (GET_CODE (src) == CONST_DOUBLE)
  1566. +
  1567. + {
  1568. + split_double (src, operands + 2, operands + 3);
  1569. + if (GET_MODE (src) == DFmode)
  1570. +
  1571. + {
  1572. + return "xld.w\t%0,%v2\t;double %f1\n\txld.w\t%R0,%v3";
  1573. + }
  1574. +
  1575. + else
  1576. +
  1577. + {
  1578. + return "xld.w\t%0,%2\t;long long\n\txld.w\t%R0,%3";
  1579. + }
  1580. + }
  1581. +
  1582. + /* C33: memory to register */
  1583. + if (GET_CODE (src) == MEM)
  1584. +
  1585. + {
  1586. + int ptrreg = -1;
  1587. + int dreg = REGNO (dst);
  1588. + rtx inside = XEXP (src, 0);
  1589. + if (GET_CODE (inside) == REG)
  1590. + ptrreg = REGNO (inside);
  1591. +
  1592. + else if (GET_CODE (inside) == SUBREG)
  1593. + /* CHG K.Watanabe V1.7 >>>>>>> */
  1594. + /*
  1595. + ptrreg = REGNO (SUBREG_REG (inside)) + SUBREG_WORD (inside);
  1596. + */
  1597. + ptrreg = subreg_regno (inside);
  1598. + /* CHG K.Watanabe V1.7 <<<<<<< */
  1599. + else if (GET_CODE (inside) == PLUS)
  1600. + ptrreg = REGNO (XEXP (inside, 0));
  1601. + if (dreg == ptrreg)
  1602. + return "xld.w\t%R0,[%R1]\t;output_move_double\n\txld.w\t%0,[%1]";
  1603. +
  1604. + else
  1605. + return "xld.w\t%0,[%1]\t;output_move_double\n\txld.w\t%R0,[%R1]";
  1606. + }
  1607. +
  1608. + /* C33: register to memory */
  1609. + if (GET_CODE (dst) == MEM)
  1610. + return "xld.w\t[%0],%1\t;output_move_double\n\txld.w\t[%R0],%R1";
  1611. + fatal_insn ("output_move_double:", gen_rtx (SET, VOIDmode, dst, src));
  1612. + return "";
  1613. +}
  1614. +
  1615. +char *
  1616. +output_btst (operands)
  1617. + rtx *operands;
  1618. +
  1619. +{
  1620. + rtx dst = operands[0];
  1621. + rtx src = operands[1];
  1622. +
  1623. + if (GET_CODE (src) == MEM)
  1624. + {
  1625. + if (GET_CODE (XEXP (src, 0)) == REG)
  1626. + {
  1627. + return "btst\t[%1],%M4";
  1628. + }
  1629. + else if (GET_CODE (XEXP (src, 0)) == PLUS)
  1630. + {
  1631. + return "xbtst\t[%1],%M4";
  1632. + }
  1633. + else
  1634. + {
  1635. + return "%P1\n\tbtst\t[%Q1],%M4";
  1636. + }
  1637. + }
  1638. + fatal_insn ("output_btst:", gen_rtx (SET, VOIDmode, dst, src));
  1639. + return "";
  1640. +}
  1641. +
  1642. +
  1643. +char *
  1644. +output_bclr (operands)
  1645. + rtx *operands;
  1646. +
  1647. +{
  1648. + rtx dst = operands[0];
  1649. + rtx src = operands[1];
  1650. +
  1651. + if (GET_CODE (src) == MEM)
  1652. + {
  1653. + if (GET_CODE (XEXP (src, 0)) == REG)
  1654. + {
  1655. + return "bclr\t[%1],%m4";
  1656. + }
  1657. + else if (GET_CODE (XEXP (src, 0)) == PLUS)
  1658. + {
  1659. + return "xbclr\t[%1],%m4";
  1660. + }
  1661. + else
  1662. + {
  1663. + return "%P1\n\tbclr\t[%Q1],%m4";
  1664. + }
  1665. + }
  1666. + fatal_insn ("output_bclr:", gen_rtx (SET, VOIDmode, dst, src));
  1667. + return "";
  1668. +}
  1669. +
  1670. +
  1671. +char *
  1672. +output_bset (operands)
  1673. + rtx *operands;
  1674. +
  1675. +{
  1676. + rtx dst = operands[0];
  1677. + rtx src = operands[1];
  1678. +
  1679. + if (GET_CODE (src) == MEM)
  1680. + {
  1681. + if (GET_CODE (XEXP (src, 0)) == REG)
  1682. + {
  1683. + return "bset\t[%1],%M4";
  1684. + }
  1685. + else if (GET_CODE (XEXP (src, 0)) == PLUS)
  1686. + {
  1687. + return "xbset\t[%1],%M4";
  1688. + }
  1689. + else
  1690. + {
  1691. + return "%P1\n\tbset\t[%Q1],%M4";
  1692. + }
  1693. + }
  1694. + fatal_insn ("output_bset:", gen_rtx (SET, VOIDmode, dst, src));
  1695. + return "";
  1696. +}
  1697. +
  1698. +/* Return true if OP is a valid call operand. */
  1699. +int
  1700. +call_address_operand (op, mode)
  1701. + rtx op;
  1702. + enum machine_mode mode;
  1703. +
  1704. +{
  1705. + return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == REG);
  1706. +}
  1707. +
  1708. +/* C33: for bit operation */
  1709. +int
  1710. +power_of_two_operand (op, mode)
  1711. + rtx op;
  1712. + enum machine_mode mode;
  1713. +
  1714. +{
  1715. + if (GET_CODE (op) != CONST_INT)
  1716. + return 0;
  1717. + if (exact_log2 (INTVAL (op)) == -1)
  1718. + return 0;
  1719. + return 1;
  1720. +}
  1721. +
  1722. +int
  1723. +not_power_of_two_operand (op, mode)
  1724. + rtx op;
  1725. + enum machine_mode mode;
  1726. +
  1727. +{
  1728. + unsigned int mask;
  1729. + if (mode == QImode)
  1730. + mask = 0xff;
  1731. +
  1732. + else if (mode == HImode)
  1733. + mask = 0xffff;
  1734. +
  1735. + else if (mode == SImode)
  1736. + mask = 0xffffffff;
  1737. +
  1738. + else
  1739. + return 0;
  1740. + if (GET_CODE (op) != CONST_INT)
  1741. + return 0;
  1742. + if (exact_log2 (~INTVAL (op) & mask) == -1)
  1743. + return 0;
  1744. + return 1;
  1745. +}
  1746. +
  1747. +
  1748. +/* Return true is OP is a valid operand for an integer move instruction. */
  1749. +int
  1750. +general_operand_post_inc (op, mode)
  1751. + rtx op;
  1752. + enum machine_mode mode;
  1753. +
  1754. +{
  1755. + if (GET_CODE (op) == MEM && GET_CODE (XEXP (op, 0)) == POST_INC)
  1756. + return 1;
  1757. + return general_operand (op, mode);
  1758. +}
  1759. +
  1760. +
  1761. +int
  1762. +compute_register_save_size (p_reg_saved)
  1763. + long *p_reg_saved; /* C33: The information that which register is saved. */
  1764. +
  1765. +{
  1766. + int size;
  1767. + int i;
  1768. +
  1769. + int interrupt_handler = c33_interrupt_function_p ();
  1770. +
  1771. + long reg_saved = 0;
  1772. +
  1773. + /* >>>>> add iruma m.takeishi '03.10.03 */
  1774. + long size_add = 0;
  1775. + /* <<<<< add iruma m.takeishi '03.10.03 */
  1776. +
  1777. +
  1778. +
  1779. +/* C33: 1. Allocate the area for PC. */
  1780. + size = 4;
  1781. +
  1782. +/* C33: How "ahr,alr" shall be done at the time of interrupt? */
  1783. +
  1784. +/* C33: 2. Count the registers which shall be saved. */
  1785. + /* Count space for the register saves. */
  1786. + if (interrupt_handler)
  1787. + { /* C33: in the case of interrupt */
  1788. + /* C33: for general purpose registers ( except %r15 ) */
  1789. + for (i = 0; i < 15; i++)
  1790. + {
  1791. + if (regs_ever_live[i] != 0)
  1792. + {
  1793. + /* >>>>> change iruma m.takeishi '03.10.06 */
  1794. + /* C33: The calculation method of bytes of registers shall be correspond to "expand_prologue".
  1795. + It is calculated from the maximum register No. */
  1796. + /*
  1797. + size += 4;
  1798. + */
  1799. + size_add = (i +1)* 4;
  1800. + /* >>>>> change iruma m.takeishi '03.10.06 */
  1801. + reg_saved |= 1L << i;
  1802. + }
  1803. +
  1804. + else
  1805. + {
  1806. +
  1807. + /* EMPTY */
  1808. + }
  1809. + }
  1810. +
  1811. + /* >>>>> add iruma m.takeishi '03.10.03 */
  1812. + size += size_add;
  1813. + /* <<<<< add iruma m.takeishi '03.10.03 */
  1814. + }
  1815. +
  1816. + else
  1817. + { /* C33: normal function call */
  1818. +
  1819. + /* C33: for general purpose registers ( except %r15 ) */
  1820. + for (i = 0; i < 15; i++)
  1821. + {
  1822. + /* C33: IF Is this saved register under use? */
  1823. + if (regs_ever_live[i] && (!call_used_regs[i]))
  1824. + {
  1825. +
  1826. + /* YES */
  1827. + /* C33: Allocation of the area and registration of the register No. */
  1828. + /* >>>>> change iruma m.takeishi '03.10.03 */
  1829. + /* C33: The calculation method of bytes of registers shall be correspond to "expand_prologue".
  1830. + It is calculated from the maximum register No. */
  1831. + /*
  1832. + size += 4;
  1833. + */
  1834. + size_add = (i +1)* 4;
  1835. + /* <<<<< change iruma m.takeishi '03.10.03 */
  1836. + reg_saved |= 1L << i;
  1837. + }
  1838. +
  1839. + else
  1840. + {
  1841. +
  1842. + /* NO */
  1843. +
  1844. + /* EMPTY */
  1845. + }
  1846. + }
  1847. +
  1848. + /* >>>>> add iruma m.takeishi '03.10.03 */
  1849. + size += size_add;
  1850. + /* <<<<< add iruma m.takeishi '03.10.03 */
  1851. + }
  1852. +
  1853. +/* C33: 3. Return the saved register No. */
  1854. + if (p_reg_saved)
  1855. + *p_reg_saved = reg_saved;
  1856. +
  1857. +/* C33: 4. Return the saved area size. ( Containing PC size ) */
  1858. + return size;
  1859. +
  1860. +/* C33: 5. Terminating process. */
  1861. +}
  1862. +
  1863. +
  1864. +int
  1865. +compute_frame_size (size, p_reg_saved)
  1866. + int size;
  1867. + long *p_reg_saved;
  1868. +
  1869. +{
  1870. +// extern int current_function_outgoing_args_size; /* DEL K.Watanabe V1.7 */
  1871. + return (size + compute_register_save_size (p_reg_saved)
  1872. + + current_function_outgoing_args_size);}
  1873. +
  1874. +
  1875. +static int
  1876. +check_call_being ()
  1877. +{
  1878. + /* C33: Changed because of containing "call.d" */
  1879. + /* Return nonzero if this function has no function calls. */
  1880. + return !leaf_function_p ();
  1881. +}
  1882. +
  1883. +
  1884. +/* C33: 2000.07.19 New create.
  1885. + The following function returns the number of "MLT" instructions in the function. */
  1886. +static int
  1887. +check_mlt_being ()
  1888. +{
  1889. + int num = 0;
  1890. + rtx insn;
  1891. + for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
  1892. + {
  1893. + /* C33: Reference from try_combine() in combine.c ( 1558th line ) */
  1894. + if (GET_CODE (insn) == INSN
  1895. + && GET_CODE (PATTERN (insn)) == SET
  1896. + && GET_CODE (SET_SRC (PATTERN (insn))) == MULT)
  1897. + {
  1898. + num++;
  1899. + }
  1900. + }
  1901. + return num;
  1902. +}
  1903. +
  1904. +
  1905. +/* C33: 2000.07.19. -- All corrected. expand_prologue() & expand_epilogue()
  1906. + 2000.10.26 watanabe -- The regsieter assignment in the interrutp leaf function is changed from %r0.
  1907. + Stack frame supports 32bit value.
  1908. + Support the inturrupt function.
  1909. + 2001.11.14 watanabe -- "gp" number is variable from 1 to 6.
  1910. +
  1911. + if( Theire is function call. ){
  1912. +
  1913. + y interrupt function ( There is function call. ) z
  1914. + pushn/popn %r9
  1915. + alr %r0
  1916. + ahr %r1 pushn/popn %r1 t
  1917. + SP scratchF%r0
  1918. + }else{
  1919. +
  1920. + y interrupt function ( There is not function call. ) z
  1921. + if( reg_saved == 0 ){
  1922. +
  1923. + the process of (a): Not using registers. "run_alr_ahr == 0" in implicity.
  1924. +
  1925. + }else{
  1926. +
  1927. + if( run_alr_ahr == 1 ){
  1928. +
  1929. + the process of (b):
  1930. + if( There is the unused registers. ){
  1931. +
  1932. + the process of (b-1):
  1933. + pushn/popn %r(i+2)
  1934. + alr %r(i+1)
  1935. + ahr %r(i+2)
  1936. + SP scratchF%r0
  1937. + }else{
  1938. +
  1939. + the process of (b-2):
  1940. + pushn/popn %ri
  1941. + alr %r0
  1942. + ahr %r1 ADD pushn/popn %r1
  1943. + SP scratchF%r0
  1944. +
  1945. + }
  1946. +
  1947. + }else{
  1948. +
  1949. + the process of (c):
  1950. + pushn/popn %ri
  1951. + SP scratchF%r0
  1952. +
  1953. + }
  1954. + }
  1955. + }
  1956. +*/
  1957. +
  1958. +/****************************************************************************************************************************
  1959. +Format : void expand_prologue ( FILE *file)
  1960. +Input : pointer for the output file
  1961. +Output : None
  1962. +Return : None
  1963. +Explanation : EDo prologue process at the time of calling function.
  1964. + E"expand_prlogue()" and "expand_epilogue()" must be a pair.
  1965. + EThe structure of the stack frame.
  1966. + argument |
  1967. + return address |
  1968. + |
  1969. + Jump |
  1970. + |
  1971. + register protection |
  1972. + ( in the case of the normal function -- %r0 - %r3 |
  1973. + in the case of the interrupt function -- all used registers ) |
  1974. + local variable SP
  1975. +****************************************************************************************************************************/
  1976. +void expand_prologue (file)
  1977. + FILE *file;
  1978. +
  1979. +{
  1980. + char *fnname;
  1981. + unsigned int i;
  1982. + unsigned int size; /* C33: for local variable ( for frame ) */
  1983. + long reg_saved = 0;
  1984. +
  1985. + int interrupt_handler = c33_interrupt_function_p ();
  1986. +
  1987. +/* C33: Note: This is considered to support for varialbe arguments. */
  1988. +
  1989. +/* C33: 1. Decide the size of local variables and arguments. */
  1990. + size = get_frame_size () + current_function_outgoing_args_size;
  1991. +
  1992. +/* C33: 2. Decide the saved register No. */
  1993. + compute_register_save_size (&reg_saved);
  1994. +
  1995. +/* C33: 4. Decide the maximun register No. which is saved. */
  1996. +
  1997. + /* C33: Is there the saved register? */
  1998. + if (reg_saved != 0)
  1999. + {
  2000. + /* C33: Yes, there is the saved register.
  2001. + Decide the maximun register No. which is saved.
  2002. + Check to all general purpose registers. */
  2003. + for (i = 31; i >= 0; i--)
  2004. + {
  2005. + /* C33: Is the register saved? */
  2006. + if (((1L << i) & reg_saved) != 0)
  2007. + {
  2008. + /* C33: Yes, we have finded the maximum register No. */
  2009. + break;
  2010. + }
  2011. + }
  2012. + }
  2013. +
  2014. +/* C33: 5. Move "%sp". */
  2015. + /* C33: Is the function interrupt? */
  2016. + if (interrupt_handler)
  2017. + {
  2018. + /* C33: Yes, it is interrupt function */
  2019. +
  2020. + /* C33: Is there function call? */
  2021. + if (check_call_being ())
  2022. + {
  2023. + /* C33: Yes, there is function call.
  2024. + Output "push" instruction.
  2025. + Save all except "gp". */
  2026. + fprintf (file, "\tpushn\t%%r%d\n", 15 - gp_max);/* pushn %rX */
  2027. +
  2028. + /* C33: Save "alr, ahr" to the stack. */
  2029. + fprintf (file, "\tld.w\t%%r0,%%alr\n"); /* ld.w %r0, %alr */
  2030. + fprintf (file, "\tld.w\t%%r1,%%ahr\n"); /* ld.w %r1, %ahr */
  2031. + fprintf (file, "\tpushn\t%%r1\n"); /* pushn %r1 */
  2032. + }
  2033. + else
  2034. + {
  2035. + /* C33: No, there is not function call. */
  2036. + /* C33: Registers are used in the order of %r0,%r1,%r2,%r3,%r4,%r5,%r6,%r7,%r8,%r9
  2037. + in the case that there is not function call in the interrupt function. */
  2038. +
  2039. + /* C33: Are registers used? */
  2040. + if (reg_saved == 0)
  2041. + {
  2042. + /* C33: Registers are not used. */
  2043. + /* C33: "push" instruction is unused. */
  2044. +
  2045. + /* C33: Is the movement of %sp which uses scrath registers necessary? */
  2046. + if (size > 0xffc)
  2047. + {
  2048. + /* C33: Yes, it is necessary. */
  2049. + fprintf (file, "\tpushn\t%%r0\n"); /* pushn %r0 */
  2050. + }
  2051. + }
  2052. + else
  2053. + {
  2054. + /* C33: Registers are used. */
  2055. + /* C33: Is "ahr / alr" saved? */
  2056. + if (check_mlt_being ())
  2057. + {
  2058. + /* C33: Yes, "ahr / alr" is saved. */
  2059. +
  2060. + /* C33: Is there general purpose register for saving "ahr,alr"? */
  2061. + if (i < 14 - gp_max)
  2062. + {
  2063. + /* C33: Yes, there is. */
  2064. + /* C33: Output "pushn" instruction. */
  2065. + fprintf (file, "\tpushn\t%%r%d\n", i + 2); /* pushn %r(i+2) */
  2066. + fprintf (file, "\tld.w\t%%r%d,%%alr\n", i + 1); /* ld.w %r(i+1), %alr */
  2067. + fprintf (file, "\tld.w\t%%r%d,%%ahr\n", i + 2); /* ld.w %r(i+2), %ahr */
  2068. + }
  2069. + else
  2070. + {
  2071. + /* C33: No, there is not. ( So, save to the stack. ) */
  2072. + /* C33: Output "pushn" instruction. */
  2073. + fprintf (file, "\tpushn\t%%r%d\n", i); /* pushn %r? */
  2074. + fprintf (file, "\tld.w\t%%r0,%%alr\n"); /* ld.w %r0, %alr */
  2075. + fprintf (file, "\tld.w\t%%r1,%%ahr\n"); /* ld.w %r1, %ahr */
  2076. + fprintf (file, "\tpushn\t%%r1\n"); /* pushn %r1 */
  2077. + }
  2078. + }
  2079. + else
  2080. + {
  2081. + /* C33: No, "ahr / alr" is not saved. */
  2082. + /* C33: Output "pushn" instruction. */
  2083. + fprintf (file, "\tpushn\t%%r%d\n", i); /* pushn %r? */
  2084. + }
  2085. + } /* C33: endif( reg_saved == 0) */
  2086. + } /* C33: endif( function call ) */
  2087. +
  2088. + /* C33: Is the movement of %sp necessary? */
  2089. + if (size > 0xffc)
  2090. + {
  2091. + /* C33: Yes, it is necessary. */
  2092. + fprintf (file, "\tld.w\t%%r0,%%sp\t;sub %%sp,%d\n", size); /* ld.w %r0, %sp */
  2093. + fprintf (file, "\txsub\t%%r0,%d\t;\n", size); /* xsub %r0, imm32 */
  2094. + fprintf (file, "\tld.w\t%%sp,%%r0\t;\n"); /* ld.w %sp, %r0 */
  2095. + }
  2096. + else if (size != 0)
  2097. + {
  2098. + /* C33: Yes, it is necessary. */
  2099. + fprintf (file, "\tsub\t%%sp,%d\t;%d\n", (size >> 2), size); /* sub %sp, imm12 */
  2100. + }
  2101. + else
  2102. + {
  2103. + /* C33: No, it is not necessary. */
  2104. + /* EMPTY */
  2105. + }
  2106. + }
  2107. + else
  2108. + {
  2109. + /* C33: No, the function is normal. */
  2110. +
  2111. + /* C33: Is there the saved registers? */
  2112. + if (reg_saved != 0)
  2113. + {
  2114. + /* C33: Yes, there is. */
  2115. +
  2116. + /* C33: Output "pushn" instrcution. */
  2117. + fprintf (file, "\tpushn\t%%r%d\n", i); /* pushn %r? */
  2118. + }
  2119. + else
  2120. + {
  2121. + /* C33: No, there is not. */
  2122. + /* EMPTY */
  2123. + }
  2124. + /* C33: Use %r4 for the scratch register which is used for stack movement.
  2125. + At this point, it is no problem that the register for storing returned values is destroyed. */
  2126. +
  2127. + /* C33: Is the movement of %sp necessary? */
  2128. + if (size > 0xffc)
  2129. + {
  2130. + /* C33: Yes, it is necessary by using the scrath registers. */
  2131. + fprintf (file, "\tld.w\t%%r4,%%sp\t;sub %%sp,%d\n", size); /* ld.w %r4, %sp */
  2132. + fprintf (file, "\txsub\t%%r4,%d\t;\n", size); /* xsub %r4, imm32 */
  2133. + fprintf (file, "\tld.w\t%%sp,%%r4\t;\n"); /* ld.w %sp, %r4 */
  2134. + }
  2135. + else if (size != 0)
  2136. + {
  2137. + /* C33: Yes, it is necessary. */
  2138. + fprintf (file, "\tsub\t%%sp,%d\t;%d\n", (size >> 2), size); /* sub %sp, imm12 */
  2139. + }
  2140. + else
  2141. + {
  2142. + /* C33: No, it is not necessary. */
  2143. + /* EMPTY */
  2144. + }
  2145. + }
  2146. +
  2147. + /* ADD K.Watanabe V1.7 >>>>>>> */
  2148. + /* Set up frame pointer if it is necessary. */
  2149. + if (frame_pointer_needed){
  2150. + fprintf ( file, "\tld.w %%r0,%%sp\n" );
  2151. + }
  2152. + /* ADD K.Watanabe V1.7 <<<<<<< */
  2153. +
  2154. +/* 6. Return. */
  2155. + return;
  2156. +
  2157. +/* C33: Terminating process. */
  2158. +}
  2159. +
  2160. +
  2161. +/*************************************************************************************************************
  2162. +Format : void expand_epilogue (file)
  2163. +Input : pointer for the output file
  2164. +Output : None
  2165. +Return : None
  2166. +Explanation : EDo epilogue process at the time of calling function.
  2167. + E"expand_prlogue()" and "expand_epilogue()" must be a pair.
  2168. +*************************************************************************************************************/
  2169. +void expand_epilogue (file)
  2170. + FILE *file;
  2171. +
  2172. +{
  2173. + unsigned int i;
  2174. + unsigned int size; /* C33: for local variable ( for frame ) */
  2175. + long reg_saved = 0;
  2176. +
  2177. + int interrupt_handler = c33_interrupt_function_p ();
  2178. +
  2179. +/* C33: Note: This is considered to support for varialbe arguments. */
  2180. +
  2181. +/* C33: 1. Decide the size of local variables and arguments. */
  2182. + size = get_frame_size () + current_function_outgoing_args_size;
  2183. +
  2184. +/* C33: 2. Decide the resotred register No. */
  2185. + compute_register_save_size (&reg_saved);
  2186. +
  2187. +/* C33: 3. Decide the maximun register No. which is restored. */
  2188. +
  2189. + /* C33: If the resut is "i==0", there is not the restored register
  2190. + in the case of interrupt function.
  2191. + In the case of normal function, there is not the restored register or it means %r0. */
  2192. +
  2193. + /* C33: Is there the saved register? */
  2194. + if (reg_saved != 0)
  2195. + {
  2196. + /* C33: Yes, there is. */
  2197. +
  2198. + /* C33: Check to all general purpose registers. */
  2199. + for (i = 31; i >= 0; i--)
  2200. + {
  2201. + /* C33: Is the register restored? */
  2202. + if (((1L << i) & reg_saved) != 0)
  2203. + {
  2204. + /* C33: Yes, We have finded the maximum register No. */
  2205. + break;
  2206. + }
  2207. + }
  2208. + }
  2209. +
  2210. +/* C33: 4. Move "%sp". */
  2211. +/* C33: 5. Registers are saved. */
  2212. +/* C33: 6. Output return instruction. */
  2213. +
  2214. + /* C33: Is the function interrupt? */
  2215. + if (interrupt_handler)
  2216. + {
  2217. + /* C33: Yes, the interrupt function */
  2218. +
  2219. + /* C33: Is the movement of %sp necessary? */
  2220. + if (size > 0xffc)
  2221. + {
  2222. + /* C33: Yes, it is necessary by using the scrath registers. */
  2223. + fprintf (file, "\tld.w\t%%r0,%%sp\t;add %%sp,%d\n", size); /* ld.w %r0, %sp */
  2224. + fprintf (file, "\txadd\t%%r0,%d\t;\n", size); /* xadd %r0, imm32 */
  2225. + fprintf (file, "\tld.w\t%%sp,%%r0\t;\n"); /* ld.w %sp, %r0 */
  2226. + }
  2227. + else if (size != 0)
  2228. + {
  2229. + /* C33: Yes, it is necessary. */
  2230. + fprintf (file, "\tadd\t%%sp,%d\t;%d\n", (size >> 2), size); /* add %sp, imm12 */
  2231. + }
  2232. + else
  2233. + {
  2234. + /* C33: No, it is not necessary. */
  2235. + /* EMPTY */
  2236. + }
  2237. +
  2238. + /* C33: Is there function call? */
  2239. + if (check_call_being ())
  2240. + {
  2241. + /* C33: Yes, there is function call. */
  2242. +
  2243. + /* C33: Restore "alr,ahr" from the stack. */
  2244. + fprintf (file, "\tpopn\t%%r1\n"); /* popn %r1 */
  2245. + fprintf (file, "\tld.w\t%%alr,%%r0\n"); /* ld.w %alr, %r0 */
  2246. + fprintf (file, "\tld.w\t%%ahr,%%r1\n"); /* ld.w %ahr, %r1 */
  2247. +
  2248. + /* C33: Output "popn" instruction. */
  2249. + /* C33: Restore all except "gp". */
  2250. + fprintf (file, "\tpopn\t%%r%d\n", 15 - gp_max); /* popn %rX */
  2251. + }
  2252. + else
  2253. + {
  2254. + /* C33: No, there is not function call. */
  2255. + /* C33: Registers are used in the order of %r0,%r1,%r2,%r3,%r4,%r5,%r6,%r7,%r8,%r9
  2256. + in the case that there is not function call in the interrupt function. */
  2257. +
  2258. + /* C33: Are registers used? */
  2259. + if (reg_saved == 0)
  2260. + {
  2261. + /* C33: Registers is not used. */
  2262. +
  2263. + /* C33: Does %sp move by using the scrath registers? */
  2264. + if (size > 0xffc)
  2265. + {
  2266. + /* C33: Yes, it does. */
  2267. + fprintf (file, "\tpopn\t%%r0\n"); /* popn %r0 */
  2268. + }
  2269. + else
  2270. + {
  2271. + /* C33: No, it does not. */
  2272. + /* EMPTY */
  2273. + }
  2274. + /* "pop" instruction is unused. */
  2275. + }
  2276. + else
  2277. + {
  2278. + /* C33: Registers is used. */
  2279. +
  2280. + /* C33: Is "ahr alr" saved? */
  2281. + if (check_mlt_being ())
  2282. + {
  2283. + /* C33: Yes, "ahr alr" is saved. */
  2284. +
  2285. + /* C33: Is there general purpose register for saving "ahr,alr"? */
  2286. + if (i < 14 - gp_max)
  2287. + {
  2288. + /* C33: Yes, there is. */
  2289. +
  2290. + /* C33: Restore "alr,ahr" from the register. */
  2291. + fprintf (file, "\tld.w\t%%alr,%%r%d\n", i + 1); /* ld.w %alr, %r(i+1) */
  2292. + fprintf (file, "\tld.w\t%%ahr,%%r%d\n", i + 2); /* ld.w %ahr, %r(i+2) */
  2293. +
  2294. + /* C33: Output "popn" instruction. */
  2295. + fprintf (file, "\tpopn\t%%r%d\n", i + 2); /* popn %r(i+2) */
  2296. + }
  2297. + else
  2298. + {
  2299. + /* C33: No, there is not. ( So, save to the stack. ) */
  2300. +
  2301. + /* C33: Restore "alr,ahr" from the stack. */
  2302. + fprintf (file, "\tpopn\t%%r1\n"); /* popn %r1 */
  2303. + fprintf (file, "\tld.w\t%%alr,%%r0\n"); /* ld.w %alr, %r0 */
  2304. + fprintf (file, "\tld.w\t%%ahr,%%r1\n"); /* ld.w %ahr, %r1 */
  2305. +
  2306. + /* C33: Output "popn" instruction. */
  2307. + fprintf (file, "\tpopn\t%%r%d\n", i); /* popn %r? */
  2308. + }
  2309. + }
  2310. + else
  2311. + {
  2312. + /* C33: No, "ahr alr" is not saved. */
  2313. + /* C33: Output "pop" instruction. */
  2314. + fprintf (file, "\tpopn\t%%r%d\n", i); /* popn %r? */
  2315. + }
  2316. + } /* endif( reg_saved == 0) */
  2317. + } /* endif( Is there function call? ) */
  2318. +
  2319. + /* C33: Output "reti" instruction. */
  2320. + fprintf (file, "\treti\n");
  2321. + }
  2322. + else
  2323. + {
  2324. + /* C33: No, the normal function. */
  2325. + /* C33: Use %r6 for the scratch register which is used for stack movement.
  2326. + At this point, it is no problem that the register for storing returned values is destroyed. */
  2327. +
  2328. + /* C33: Is the movement of %sp necessary? */
  2329. + if (size > 0xffc)
  2330. + {
  2331. + /* C33: Yes, it is necessary by using the scrath registers. */
  2332. + fprintf (file, "\tld.w\t%%r6,%%sp\t;add %%sp,%d\n", size); /* ld.w %r6, %sp */
  2333. + fprintf (file, "\txadd\t%%r6,%d\t;\n", size); /* xadd %r6, imm32 */
  2334. + fprintf (file, "\tld.w\t%%sp,%%r6\t;\n"); /* ld.w %sp, %r6 */
  2335. + }
  2336. + else if (size != 0)
  2337. + {
  2338. + /* C33: Yes, it is necessary. */
  2339. + fprintf (file, "\tadd\t%%sp,%d\t;%d\n", (size >> 2), size); /* add %sp, imm12 */
  2340. + }
  2341. + else
  2342. + {
  2343. + /* C33: No, it is not necessary. */
  2344. + /* EMPTY */
  2345. + }
  2346. +
  2347. + /* C33: Are there any registers to restore? */
  2348. + if (reg_saved != 0)
  2349. + {
  2350. + /* C33: Yes, there are registers to restore. */
  2351. +
  2352. + /* C33: Restore the registers. */
  2353. + fprintf (file, "\tpopn\t%%r%d\n", i);
  2354. + }
  2355. + else
  2356. + {
  2357. + /* C33: No, there are not registers to restore. */
  2358. + /* EMPTY */
  2359. + }
  2360. +
  2361. + /* C33: Output "ret" instruction. */
  2362. + fprintf (file, "\tret\n");
  2363. + }
  2364. +
  2365. +/* C33: 8. Initialize for the commom variable. */
  2366. + c33_interrupt_cache_p = FALSE; /* C33: Interrupt judgement. */
  2367. + c33_interrupt_p = FALSE; /* C33: Interrupt judgement. */
  2368. +
  2369. +/* C33: 9. Return. */
  2370. + return;
  2371. +
  2372. +/* C33: 10. Terminating process. */
  2373. +}
  2374. +
  2375. +
  2376. +/* C33: conditions.h final.c */
  2377. +/* Update the condition code from the insn. */
  2378. +void
  2379. +notice_update_cc (exp, insn)
  2380. + rtx exp;
  2381. + rtx insn;
  2382. +{
  2383. + if (GET_CODE (exp) == SET)
  2384. + {
  2385. +
  2386. + /* Jumps do not alter the cc's. */
  2387. + if (SET_DEST (exp) == pc_rtx)
  2388. + return;
  2389. +
  2390. + /* Moving register or memory into a register:
  2391. + it doesn't alter the cc's, but it might invalidate
  2392. + the RTX's which we remember the cc's came from.
  2393. + (Note that moving a constant 0 or 1 MAY set the cc's). */
  2394. + if (REG_P (SET_DEST (exp))
  2395. + && (REG_P (SET_SRC (exp)) || GET_CODE (SET_SRC (exp)) == MEM
  2396. + || GET_RTX_CLASS (GET_CODE (SET_SRC (exp))) == '<'))
  2397. + {
  2398. + if (cc_status.value1
  2399. + && reg_overlap_mentioned_p (SET_DEST (exp),
  2400. + cc_status.
  2401. + value1)) cc_status.value1 = 0;
  2402. + if (cc_status.value2
  2403. + && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value2))
  2404. + cc_status.value2 = 0;
  2405. + return;
  2406. + }
  2407. +
  2408. + /* Moving register into memory doesn't alter the cc's.
  2409. + It may invalidate the RTX's which we remember the cc's came from. */
  2410. + if (GET_CODE (SET_DEST (exp)) == MEM
  2411. + && (REG_P (SET_SRC (exp))
  2412. + || GET_RTX_CLASS (GET_CODE (SET_SRC (exp))) == '<'))
  2413. +
  2414. + {
  2415. + if (cc_status.value1
  2416. + && reg_overlap_mentioned_p (SET_DEST (exp),
  2417. + cc_status.
  2418. + value1)) cc_status.value1 = 0;
  2419. + if (cc_status.value2
  2420. + && reg_overlap_mentioned_p (SET_DEST (exp),
  2421. + cc_status.
  2422. + value2)) cc_status.value2 = 0;
  2423. + return;
  2424. + }
  2425. +
  2426. + /* Function calls clobber the cc's. */
  2427. + else if (GET_CODE (SET_SRC (exp)) == CALL)
  2428. + {
  2429. + CC_STATUS_INIT;
  2430. + return;
  2431. + }
  2432. +
  2433. + /* Tests and compares set the cc's in predictable ways. */
  2434. + else if (SET_DEST (exp) == cc0_rtx)
  2435. + {
  2436. + CC_STATUS_INIT;
  2437. + cc_status.value1 = SET_SRC (exp);
  2438. + return;
  2439. + }
  2440. +
  2441. + /* Certain instructions effect the condition codes. */
  2442. + else if (GET_MODE (SET_SRC (exp)) == SImode
  2443. + || GET_MODE (SET_SRC (exp)) == HImode
  2444. + || GET_MODE (SET_SRC (exp)) == QImode)
  2445. + switch (GET_CODE (SET_SRC (exp)))
  2446. + {
  2447. + case ASHIFTRT:
  2448. + case LSHIFTRT:
  2449. + case ASHIFT:
  2450. +
  2451. + /* Shifts on the 386 don't set the condition codes if the
  2452. + shift count is zero. */
  2453. + if (GET_CODE (XEXP (SET_SRC (exp), 1)) != CONST_INT)
  2454. + {
  2455. + CC_STATUS_INIT;
  2456. + break;
  2457. + }
  2458. +
  2459. + /* We assume that the CONST_INT is non-zero (this rtx would
  2460. + have been deleted if it were zero. */
  2461. + case PLUS:
  2462. + case MINUS:
  2463. + case NEG:
  2464. + case AND:
  2465. + case IOR:
  2466. + case XOR:
  2467. + cc_status.flags = CC_NO_OVERFLOW;
  2468. + cc_status.value1 = SET_SRC (exp);
  2469. + cc_status.value2 = SET_DEST (exp);
  2470. + break;
  2471. + default:
  2472. + CC_STATUS_INIT;
  2473. + }
  2474. +
  2475. + else
  2476. + {
  2477. + CC_STATUS_INIT;
  2478. + }
  2479. + }
  2480. +
  2481. + else if (GET_CODE (exp) == PARALLEL
  2482. + && GET_CODE (XVECEXP (exp, 0, 0)) == SET)
  2483. + {
  2484. + rtx p = XVECEXP (exp, 0, 0);
  2485. + if ((GET_MODE (SET_SRC (p)) == SImode
  2486. + || GET_MODE (SET_SRC (p)) == HImode
  2487. + || GET_MODE (SET_SRC (p)) == QImode)
  2488. + && (GET_CODE (SET_SRC (p)) == ASHIFTRT
  2489. + || GET_CODE (SET_SRC (p)) == LSHIFTRT
  2490. + || GET_CODE (SET_SRC (p)) == ASHIFT))
  2491. +
  2492. + {
  2493. + cc_status.flags = CC_NO_OVERFLOW;
  2494. + cc_status.value1 = SET_SRC (p);
  2495. + cc_status.value2 = SET_DEST (p);
  2496. + }
  2497. + }
  2498. +
  2499. + else
  2500. + {
  2501. + CC_STATUS_INIT;
  2502. + }
  2503. +}
  2504. +
  2505. +
  2506. +/* Retrieve the data area that has been chosen for the given decl. */
  2507. +c33_data_area
  2508. +c33_get_data_area (decl)
  2509. + tree decl;
  2510. +{
  2511. + /* CHG K.Watanabe V1.7 >>>>>>> */
  2512. +/* if (lookup_attribute ("sda", DECL_MACHINE_ATTRIBUTES (decl)) != NULL_TREE) */
  2513. + if (lookup_attribute ("sda", DECL_ATTRIBUTES (decl)) != NULL_TREE)
  2514. + /* CHG K.Watanabe V1.7 <<<<<<< */
  2515. + {
  2516. + if (gp_max < 4)
  2517. + return DATA_AREA_NORMAL;
  2518. + else
  2519. + return DATA_AREA_SDA;
  2520. + }
  2521. +
  2522. + /* CHG K.Watanabe V1.7 >>>>>>> */
  2523. +/* if (lookup_attribute ("tda", DECL_MACHINE_ATTRIBUTES (decl)) != NULL_TREE) */
  2524. + if (lookup_attribute ("tda", DECL_ATTRIBUTES (decl)) != NULL_TREE)
  2525. + /* CHG K.Watanabe V1.7 <<<<<<< */
  2526. + {
  2527. + if (gp_max < 3)
  2528. + return DATA_AREA_NORMAL;
  2529. + else
  2530. + return DATA_AREA_TDA;
  2531. + }
  2532. +
  2533. + /* CHG K.Watanabe V1.7 >>>>>>> */
  2534. +/* if (lookup_attribute ("zda", DECL_MACHINE_ATTRIBUTES (decl)) != NULL_TREE) */
  2535. + if (lookup_attribute ("zda", DECL_ATTRIBUTES (decl)) != NULL_TREE)
  2536. + /* CHG K.Watanabe V1.7 <<<<<<< */
  2537. + {
  2538. + if (gp_max < 2)
  2539. + return DATA_AREA_NORMAL;
  2540. + else
  2541. + return DATA_AREA_ZDA;
  2542. + }
  2543. +
  2544. + /* CHG K.Watanabe V1.7 >>>>>>> */
  2545. +/* if (lookup_attribute ("gda", DECL_MACHINE_ATTRIBUTES (decl)) != NULL_TREE) */
  2546. + if (lookup_attribute ("gda", DECL_ATTRIBUTES (decl)) != NULL_TREE)
  2547. + /* CHG K.Watanabe V1.7 <<<<<<< */
  2548. + return DATA_AREA_GDA;
  2549. +
  2550. + return DATA_AREA_NORMAL;
  2551. +}
  2552. +
  2553. +
  2554. +/* Store the indicated data area in the decl's attributes. */
  2555. +static void
  2556. +c33_set_data_area (decl, data_area)
  2557. + tree decl;
  2558. + c33_data_area data_area;
  2559. +{
  2560. + tree name;
  2561. +
  2562. + switch (data_area)
  2563. + {
  2564. + case DATA_AREA_SDA: name = get_identifier ("sda"); break;
  2565. + case DATA_AREA_TDA: name = get_identifier ("tda"); break;
  2566. + case DATA_AREA_ZDA: name = get_identifier ("zda"); break;
  2567. + case DATA_AREA_GDA: name = get_identifier ("gda"); break;
  2568. + default:
  2569. + return;
  2570. + }
  2571. +
  2572. +/* CHG K.Watanabe V1.7 >>>>>>> */
  2573. +/*
  2574. + DECL_MACHINE_ATTRIBUTES (decl) = tree_cons
  2575. + (name, NULL, DECL_MACHINE_ATTRIBUTES (decl));
  2576. +*/
  2577. + DECL_ATTRIBUTES (decl) = tree_cons
  2578. + (name, NULL, DECL_ATTRIBUTES (decl));
  2579. +/* CHG K.Watanabe V1.7 <<<<<<< */
  2580. +}
  2581. +
  2582. +
  2583. +
  2584. +/* Return nonzero if ATTR is a valid attribute for DECL.
  2585. + ATTRIBUTES are any existing attributes and ARGS are the arguments
  2586. + supplied with ATTR.
  2587. +
  2588. + Supported attributes:
  2589. +
  2590. + interrupt_handler or interrupt: output a prologue and epilogue suitable
  2591. + for an interrupt handler. */
  2592. +
  2593. +/* Return nonzero if ATTR is a valid attribute for DECL.
  2594. + ARGS are the arguments supplied with ATTR. */
  2595. +/* DEL K.Watanabe V1.7 >>>>>>> */
  2596. +/* C33: Unused. */
  2597. +
  2598. +#if 0
  2599. +int
  2600. +c33_valid_machine_decl_attribute (decl, attr, args)
  2601. + tree decl;
  2602. + tree attr;
  2603. + tree args;
  2604. +{
  2605. + c33_data_area data_area;
  2606. + c33_data_area area;
  2607. +
  2608. + if (args != NULL_TREE)
  2609. + return 0;
  2610. +
  2611. + if (is_attribute_p ("interrupt_handler", attr)
  2612. + || is_attribute_p ("interrupt", attr))
  2613. + return TREE_CODE (decl) == FUNCTION_DECL;
  2614. +
  2615. + /* Implement data area attribute. */
  2616. + if (is_attribute_p ("sda", attr))
  2617. + {
  2618. + if (gp_max < 4)
  2619. + {
  2620. + error_with_decl (decl, "data area of '%s' cannot be specified for 'sda'.");
  2621. + return 1;
  2622. + }
  2623. + else if (TREE_CODE (decl) == FUNCTION_DECL)
  2624. + {
  2625. + error_with_decl (decl, "'%s' cannot be specified for 'sda'.");
  2626. + return 1;
  2627. + }
  2628. + else
  2629. + data_area = DATA_AREA_SDA;
  2630. + }
  2631. + else if (is_attribute_p ("tda", attr))
  2632. + {
  2633. + if (gp_max < 3)
  2634. + {
  2635. + error_with_decl (decl, "data area of '%s' cannot be specified for 'tda'.");
  2636. + return 1;
  2637. + }
  2638. + else if (TREE_CODE (decl) == FUNCTION_DECL)
  2639. + {
  2640. + error_with_decl (decl, "'%s' cannot be specified for 'tda'.");
  2641. + return 1;
  2642. + }
  2643. + else
  2644. + data_area = DATA_AREA_TDA;
  2645. + }
  2646. + else if (is_attribute_p ("zda", attr))
  2647. + {
  2648. + if (gp_max < 2)
  2649. + {
  2650. + error_with_decl (decl, "data area of '%s' cannot be specified for 'zda'.");
  2651. + return 1;
  2652. + }
  2653. + else if (TREE_CODE (decl) == FUNCTION_DECL)
  2654. + {
  2655. + error_with_decl (decl, "'%s' cannot be specified for 'zda'.");
  2656. + return 1;
  2657. + }
  2658. + else
  2659. + data_area = DATA_AREA_ZDA;
  2660. + }
  2661. + else
  2662. + return 0;
  2663. +
  2664. + switch (TREE_CODE (decl))
  2665. + {
  2666. + case VAR_DECL:
  2667. + if (current_function_decl != NULL_TREE)
  2668. + error_with_decl (decl, "\
  2669. +a data area attribute cannot be specified for local variables");
  2670. +
  2671. + /* Drop through. */
  2672. +
  2673. + case FUNCTION_DECL:
  2674. + area = c33_get_data_area (decl);
  2675. + if (area != DATA_AREA_NORMAL && data_area != area)
  2676. + error_with_decl (decl, "\
  2677. +data area of '%s' conflicts with previous declaration");
  2678. +
  2679. + return 1;
  2680. +
  2681. + default:
  2682. + break;
  2683. + }
  2684. +
  2685. + return 0;
  2686. +}
  2687. +#endif
  2688. +/* DEL K.Watanabe V1.7 <<<<<<< */
  2689. +
  2690. +
  2691. +extern struct obstack * saveable_obstack;
  2692. +
  2693. +void
  2694. +c33_encode_data_area (decl)
  2695. + tree decl;
  2696. +{
  2697. + char * str = XSTR (XEXP (DECL_RTL (decl), 0), 0);
  2698. + int len = strlen (str);
  2699. + char * newstr;
  2700. +
  2701. + /* Map explict sections into the appropriate attribute */
  2702. + if (c33_get_data_area (decl) == DATA_AREA_NORMAL)
  2703. + {
  2704. + if (DECL_SECTION_NAME (decl))
  2705. + {
  2706. + char * name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
  2707. +
  2708. + if (streq (name, ".zdata") || streq (name, ".zbss"))
  2709. + c33_set_data_area (decl, DATA_AREA_ZDA);
  2710. +
  2711. + else if (streq (name, ".sdata") || streq (name, ".sbss"))
  2712. + c33_set_data_area (decl, DATA_AREA_SDA);
  2713. +
  2714. + else if (streq (name, ".tdata") || streq (name, ".tbss"))
  2715. + c33_set_data_area (decl, DATA_AREA_TDA);
  2716. +
  2717. + else if (streq (name, ".gdata") || streq (name, ".gbss"))
  2718. + c33_set_data_area (decl, DATA_AREA_GDA);
  2719. + }
  2720. +
  2721. + /* If no attribute, support -mgda=n */
  2722. + else
  2723. + {
  2724. +
  2725. + int size = int_size_in_bytes (TREE_TYPE (decl));
  2726. + if (size <= 0)
  2727. + ;
  2728. +
  2729. + else if (size <= small_memory [(int) SMALL_MEMORY_GDA].max)
  2730. + {
  2731. +#if 0
  2732. + if ((TREE_CODE (decl) == VAR_DECL
  2733. + && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl))
  2734. + && (!DECL_INITIAL (decl)
  2735. + || TREE_CONSTANT (DECL_INITIAL (decl))))
  2736. + /* C33: Do not change the section if it is "const". */
  2737. + ;
  2738. + else
  2739. + /* C33: It is "DATA_AREA_GDA" if it is not "const". */
  2740. + c33_set_data_area (decl, DATA_AREA_GDA);
  2741. +#else
  2742. + if ((TREE_CODE (decl) == VAR_DECL
  2743. + && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)))
  2744. + {
  2745. + if (!DECL_INITIAL (decl))
  2746. + {
  2747. + ;
  2748. + }
  2749. + else if ((DECL_INITIAL (decl) == error_mark_node)
  2750. + || (TREE_CONSTANT (DECL_INITIAL (decl))))
  2751. + {
  2752. + ;
  2753. + }
  2754. + else
  2755. + {
  2756. + /* C33: It is "DATA_AREA_GDA" if it is not "const". */
  2757. + c33_set_data_area (decl, DATA_AREA_GDA);
  2758. + }
  2759. + }
  2760. + else
  2761. + /* C33: It is "DATA_AREA_GDA" if it is not "const". */
  2762. + c33_set_data_area (decl, DATA_AREA_GDA);
  2763. +#endif
  2764. + }
  2765. + }
  2766. +
  2767. + if (c33_get_data_area (decl) == DATA_AREA_NORMAL)
  2768. + return;
  2769. + }
  2770. +
  2771. + /* CHG K.Watanabe V1.7 >>>>>>> */
  2772. +/* newstr = obstack_alloc (saveable_obstack, len + 2); */
  2773. + newstr = alloca (len + 2);
  2774. + /* CHG K.Watanabe V1.7 <<<<<<< */
  2775. +
  2776. + strcpy (newstr + 1, str);
  2777. +
  2778. + switch (c33_get_data_area (decl))
  2779. + {
  2780. + case DATA_AREA_ZDA: *newstr = ZDA_NAME_FLAG_CHAR; break;
  2781. + case DATA_AREA_TDA: *newstr = TDA_NAME_FLAG_CHAR; break;
  2782. + case DATA_AREA_SDA: *newstr = SDA_NAME_FLAG_CHAR; break;
  2783. + case DATA_AREA_GDA: *newstr = GDA_NAME_FLAG_CHAR; break;
  2784. + default: abort ();
  2785. + }
  2786. +
  2787. + /* CHG K.Watanabe V1.7 >>>>>>> */
  2788. +/* XSTR (XEXP (DECL_RTL (decl), 0), 0) = newstr; */
  2789. + XSTR (XEXP (DECL_RTL (decl), 0), 0) = ggc_alloc_string (newstr, len + 2);
  2790. + /* CHG K.Watanabe V1.7 <<<<<<< */
  2791. +}
  2792. +
  2793. +
  2794. +
  2795. +/* Return nonzero if FUNC is an interrupt function as specified
  2796. + by the "interrupt" attribute. */
  2797. +int
  2798. +c33_interrupt_function_p (void)
  2799. +{
  2800. + tree a;
  2801. + int ret = 0;
  2802. + tree func = current_function_decl; /* 001026 watanabe */
  2803. + if (c33_interrupt_cache_p)
  2804. + return c33_interrupt_p;
  2805. + if (TREE_CODE (func) != FUNCTION_DECL)
  2806. + return 0;
  2807. +
  2808. +/* CHG K.Watanabe V1.7 >>>>>>> */
  2809. +/* a = lookup_attribute ("interrupt_handler", DECL_MACHINE_ATTRIBUTES (func)); */
  2810. + a = lookup_attribute ("interrupt_handler", DECL_ATTRIBUTES (func));
  2811. +/* CHG K.Watanabe V1.7 <<<<<<< */
  2812. + if (a != NULL_TREE)
  2813. + ret = 1;
  2814. +
  2815. + else
  2816. + {
  2817. +/* CHG K.Watanabe V1.7 >>>>>>> */
  2818. +/* a = lookup_attribute ("interrupt", DECL_MACHINE_ATTRIBUTES (func)); */
  2819. + a = lookup_attribute ("interrupt", DECL_ATTRIBUTES (func));
  2820. +/* CHG K.Watanabe V1.7 <<<<<<< */
  2821. + ret = a != NULL_TREE;
  2822. + }
  2823. +
  2824. + /* Its not safe to trust global variables until after function inlining has
  2825. + been done. */
  2826. + if (reload_completed | reload_in_progress)
  2827. + c33_interrupt_p = ret;
  2828. + return ret;
  2829. +}
  2830. +
  2831. +
  2832. +/* C33: The following function is the quotation from mips.c. */
  2833. +/* Choose the section to use for DECL. RELOC is true if its value contains
  2834. + any relocatable expression.
  2835. +
  2836. + Some of the logic used here needs to be replicated in
  2837. + ENCODE_SECTION_INFO in mips.h so that references to these symbols
  2838. + are done correctly. Specifically, at least all symbols assigned
  2839. + here to rom (.text and/or .rodata) must not be referenced via
  2840. + ENCODE_SECTION_INFO with %gprel, as the rom might be too far away.
  2841. +
  2842. + If you need to make a change here, you probably should check
  2843. + ENCODE_SECTION_INFO to see if it needs a similar change. */
  2844. +void
  2845. +c33_select_section (decl, reloc)
  2846. + tree decl;
  2847. + int reloc;
  2848. +{
  2849. + /* For embedded applications, always put an object in read-only data
  2850. + if possible, in order to reduce RAM usage. */
  2851. +
  2852. + if ((TREE_CODE (decl) == VAR_DECL
  2853. + && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)
  2854. + && DECL_INITIAL (decl)
  2855. + && (DECL_INITIAL (decl) == error_mark_node
  2856. + || TREE_CONSTANT (DECL_INITIAL (decl))))
  2857. + && ! (flag_pic && reloc))
  2858. + {
  2859. + switch (c33_get_data_area (decl))
  2860. + {
  2861. + case DATA_AREA_ZDA: rozdata_section (); break;
  2862. + case DATA_AREA_TDA: rotdata_section (); break;
  2863. + case DATA_AREA_SDA: rosdata_section (); break;
  2864. + case DATA_AREA_GDA: rogdata_section (); break;
  2865. + default: READONLY_DATA_SECTION (); break;
  2866. + }
  2867. + }
  2868. +
  2869. + /* Deal with calls from output_constant_def_contents. */
  2870. + else if ((TREE_CODE (decl) != VAR_DECL
  2871. + && (TREE_CODE (decl) != STRING_CST
  2872. + || !flag_writable_strings))
  2873. + && ! (flag_pic && reloc))
  2874. + READONLY_DATA_SECTION ();
  2875. + else
  2876. + {
  2877. + switch (c33_get_data_area (decl))
  2878. + {
  2879. + case DATA_AREA_ZDA: zdata_section (); break;
  2880. + case DATA_AREA_TDA: tdata_section (); break;
  2881. + case DATA_AREA_SDA: sdata_section (); break;
  2882. + case DATA_AREA_GDA: gdata_section (); break;
  2883. + default: data_section (); break;
  2884. + }
  2885. + }
  2886. +}
  2887. +
  2888. +
  2889. +/* Shifts. */
  2890. +int
  2891. +nshift_operator (x, mode)
  2892. + rtx x;
  2893. + enum machine_mode mode;
  2894. +
  2895. +{
  2896. + switch (GET_CODE (x))
  2897. + {
  2898. + case ASHIFTRT:
  2899. + case LSHIFTRT:
  2900. + case ASHIFT:
  2901. + case ROTATE:
  2902. + case ROTATERT:
  2903. + return 1;
  2904. + default:
  2905. + return 0;
  2906. + }
  2907. +}
  2908. +
  2909. +
  2910. +/* Called from the .md file to emit code to do shifts.
  2911. + Returns a boolean indicating success
  2912. + (currently this is always TRUE). */
  2913. +int
  2914. +expand_a_shift (mode, code, operands)
  2915. + enum machine_mode mode;
  2916. + int code;
  2917. + rtx operands[];
  2918. +
  2919. +{
  2920. + emit_move_insn (operands[0], operands[1]);
  2921. +
  2922. + /* need a loop to get all the bits we want - we generate the
  2923. + code at emit time, but need to allocate a scratch reg now */
  2924. + if ((TARGET_C33ADV || TARGET_C33PE))
  2925. + emit_insn (gen_rtx (SET, VOIDmode, operands[0],
  2926. + gen_rtx (code, mode, operands[0],
  2927. + operands[2])));
  2928. + else
  2929. + emit_insn (gen_rtx
  2930. + (PARALLEL, VOIDmode,
  2931. + gen_rtvec (2,
  2932. + gen_rtx (SET, VOIDmode, operands[0],
  2933. + gen_rtx (code, mode, operands[0],
  2934. + operands[2])),
  2935. + gen_rtx (CLOBBER, VOIDmode,
  2936. + gen_rtx (SCRATCH, QImode, 0)))));
  2937. + return 1;
  2938. +}
  2939. +
  2940. +
  2941. +/* Emit the assembler code for doing shifts. */
  2942. +/********************************************************************************************
  2943. +Format : char* emit_a_shift (code, operands)
  2944. +Input : code -- rtx of code
  2945. + operands -- rtx of operand
  2946. +Output : None
  2947. +Return : pointer for the output string
  2948. +Explanation : Output shift instruction called from "insn_outfun()".
  2949. +*********************************************************************************************/
  2950. +char *
  2951. +emit_a_shift (code, operands)
  2952. + enum rtx_code code;
  2953. + rtx *operands;
  2954. +
  2955. +{
  2956. + char *shift_type;
  2957. + rtx xoperands[2];
  2958. + static char mask_tab[] = {0x1, 0x3, 0x7, 0xf, 0x1f};
  2959. +
  2960. + switch (code)
  2961. + {
  2962. + case ASHIFTRT:
  2963. + shift_type = "sra";
  2964. + break;
  2965. + case LSHIFTRT:
  2966. + shift_type = "srl";
  2967. + break;
  2968. + case ASHIFT:
  2969. + shift_type = "sll";
  2970. + break;
  2971. + case ROTATE:
  2972. + shift_type = "rl";
  2973. + break;
  2974. + case ROTATERT:
  2975. + shift_type = "rr";
  2976. + break;
  2977. + }
  2978. +
  2979. + if (GET_CODE (operands[2]) == CONST_INT)
  2980. + {
  2981. + int n = INTVAL (operands[2]) & 0x1f;
  2982. +
  2983. + if ((code == LSHIFTRT) && (n > 27))
  2984. + {
  2985. + /* rl + and */
  2986. + xoperands[0] = operands[0];
  2987. + xoperands[1] = GEN_INT (32 - n);
  2988. + output_asm_insn ("rl\t%0,%1", xoperands);
  2989. + xoperands[1] = GEN_INT (mask_tab[31 - n]);
  2990. + output_asm_insn ("and\t%0,%1", xoperands);
  2991. + }
  2992. + else if ((code == ASHIFT) && (n > 27))
  2993. + {
  2994. + /* and + rr */
  2995. + xoperands[0] = operands[0];
  2996. + xoperands[1] = GEN_INT (mask_tab[31 - n]);
  2997. + output_asm_insn ("and\t%0,%1", xoperands);
  2998. + xoperands[1] = GEN_INT (32 - n);
  2999. + output_asm_insn ("rr\t%0,%1", xoperands);
  3000. + }
  3001. + else
  3002. + {
  3003. + /* C33: Inverse the direction if the value of rotate is 16 or more. */
  3004. + if ((code == ROTATE) && (n > 16))
  3005. + {
  3006. + n = 32 - n;
  3007. + shift_type = "rr";
  3008. + }
  3009. + else if ((code == ROTATERT) && (n > 16))
  3010. + {
  3011. + n = 32 - n;
  3012. + shift_type = "rl";
  3013. + }
  3014. +
  3015. + while (n > 8)
  3016. + {
  3017. + n -= 8;
  3018. + fprintf (asm_out_file, "\t%s", shift_type);
  3019. + output_asm_insn ("%0,8", operands);
  3020. + }
  3021. + xoperands[0] = operands[0];
  3022. + xoperands[1] = GEN_INT (n % 9);
  3023. + fprintf (asm_out_file, "\t%s", shift_type);
  3024. + output_asm_insn ("%0,%1", xoperands);
  3025. + }
  3026. + }
  3027. + else
  3028. + { /* register */
  3029. + output_asm_insn ("ld.w\t%3,%2", operands);
  3030. + output_asm_insn ("and\t%3,0x1f", operands);
  3031. + output_asm_insn ("cmp\t%3,0x08", operands);
  3032. + fprintf (asm_out_file, "\tjrle\t4\n");
  3033. + fprintf (asm_out_file, "\t%s", shift_type);
  3034. + output_asm_insn ("%0,8", operands);
  3035. + fprintf (asm_out_file, "\tjp.d\t-3\n");
  3036. + output_asm_insn ("sub\t%3,8", operands);
  3037. + fprintf (asm_out_file, "\t%s", shift_type);
  3038. + output_asm_insn ("%0,%3", operands);
  3039. + }
  3040. + return "";
  3041. +}
  3042. +
  3043. +
  3044. +/* Print the options used in the assembly file. */
  3045. +static struct
  3046. +{
  3047. + char *name;
  3048. + int value;
  3049. +}
  3050. +target_switches[] = TARGET_SWITCHES;
  3051. +
  3052. +void
  3053. +print_options (out)
  3054. + FILE *out;
  3055. +
  3056. +{
  3057. + /* CHG K.Watanabe V1.7 >>>>>>> */
  3058. + /*
  3059. + extern char *language_string;
  3060. + extern char *version_string;
  3061. + */
  3062. + char *language_string = "GNU C";
  3063. + extern const char version_string[];
  3064. + /* CHG K.Watanabe V1.7 <<<<<<< */
  3065. + extern char **save_argv;
  3066. + int line_len;
  3067. + int len;
  3068. + int j;
  3069. + char **p;
  3070. + int mask = TARGET_DEFAULT;
  3071. +
  3072. + /* Allow assembly language comparisons with -mdebug eliminating the
  3073. + compiler version number and switch lists. */
  3074. + fprintf (out, "\n; %s %s", language_string, version_string);
  3075. +
  3076. +#ifdef TARGET_VERSION_INTERNAL
  3077. + TARGET_VERSION_INTERNAL (out);
  3078. +
  3079. +#endif /* */
  3080. +#ifdef __GNUC__
  3081. + fprintf (out, " compiled by GNU C\n\n");
  3082. +
  3083. +#else /* */
  3084. + fprintf (out, " compiled by CC\n\n");
  3085. +
  3086. +#endif /* */
  3087. + fprintf (out, "; Cc1 defaults:");
  3088. + line_len = 32767;
  3089. + for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
  3090. + {
  3091. + if (target_switches[j].name[0] != '\0'
  3092. + && target_switches[j].value > 0
  3093. + && (target_switches[j].value & mask) == target_switches[j].value)
  3094. + {
  3095. + mask &= ~target_switches[j].value;
  3096. + len = strlen (target_switches[j].name) + 1;
  3097. + if (len + line_len > 79)
  3098. + {
  3099. + line_len = 2;
  3100. + fputs ("\n; ", out);
  3101. + }
  3102. + fprintf (out, " -m%s", target_switches[j].name);
  3103. + line_len += len;
  3104. + }
  3105. + }
  3106. + fprintf (out, "\n\n; Cc1 arguments (-cpu = %s):", c33_cpu_string);
  3107. + line_len = 32767;
  3108. + for (p = &save_argv[1]; *p != (char *) 0; p++)
  3109. + {
  3110. + char *arg = *p;
  3111. + if (*arg == '-')
  3112. + {
  3113. + len = strlen (arg) + 1;
  3114. + if (len + line_len > 79)
  3115. + {
  3116. + line_len = 2;
  3117. + fputs ("\n; ", out);
  3118. + }
  3119. + fprintf (out, " %s", *p);
  3120. + line_len += len;
  3121. + }
  3122. + }
  3123. + fputs ("\n\n", out);
  3124. +}
  3125. +
  3126. +
  3127. +/* Emit either a label, .comm, or .lcomm directive, and mark
  3128. + that the symbol is used, so that we don't emit an .extern
  3129. + for it in asm_file_end. */
  3130. +void
  3131. +declare_object (stream, name, init_string, final_string, size)
  3132. + FILE *stream;
  3133. + char *name;
  3134. + char *init_string;
  3135. + char *final_string;
  3136. + int size;
  3137. +
  3138. +{
  3139. + fputs (init_string, stream); /* "", "\t.comm\t", or "\t.lcomm\t" */
  3140. + assemble_name (stream, name);
  3141. + fprintf (stream, final_string, size); /* ":\n", ",%u\n", ",%u\n" */
  3142. +}
  3143. +
  3144. +
  3145. +extern tree last_assemble_variable_decl;
  3146. +extern int size_directive_output;
  3147. +
  3148. +/* A version of asm_output_aligned_bss() that copes with the special
  3149. + data areas of the c33. */
  3150. +/* Called via the macro ASM_OUTPUT_ALIGNED_BSS */
  3151. +void
  3152. +c33_output_aligned_bss (file, decl, name, size, align)
  3153. + FILE * file;
  3154. + tree decl;
  3155. + char * name;
  3156. + int size;
  3157. + int align;
  3158. +{
  3159. + /* DEL K.Watanabe V1.7 >>>>>>> */
  3160. + /* ASM_GLOBALIZE_LABEL (file, name); */
  3161. + /* DEL K.Watanabe V1.7 <<<<<<< */
  3162. +
  3163. + switch (c33_get_data_area (decl))
  3164. + {
  3165. + case DATA_AREA_ZDA:
  3166. + zbss_section ();
  3167. + break;
  3168. +
  3169. + case DATA_AREA_SDA:
  3170. + sbss_section ();
  3171. + break;
  3172. +
  3173. + case DATA_AREA_TDA:
  3174. + tbss_section (); /* C33: Though v850 has only "tdata", c33 has both. */
  3175. + break;
  3176. +
  3177. + case DATA_AREA_GDA:
  3178. + gbss_section ();
  3179. + break; /* GNU-GCC-045 2002/3/6 watanabe */
  3180. +
  3181. + default:
  3182. + bss_section ();
  3183. + break;
  3184. + }
  3185. +
  3186. + ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT));
  3187. +#ifdef ASM_DECLARE_OBJECT_NAME
  3188. + last_assemble_variable_decl = decl;
  3189. + ASM_DECLARE_OBJECT_NAME (file, name, decl);
  3190. +#else
  3191. + /* Standard thing is just output label for the object. */
  3192. + ASM_OUTPUT_LABEL (file, name);
  3193. +#endif /* ASM_DECLARE_OBJECT_NAME */
  3194. + ASM_OUTPUT_SKIP (file, size ? size : 1);
  3195. +}
  3196. +
  3197. +
  3198. +/* Called via the macro ASM_OUTPUT_ALIGNED_DECL_COMMON */
  3199. +void
  3200. +c33_output_common (file, decl, name, size, align)
  3201. + FILE * file;
  3202. + tree decl;
  3203. + char * name;
  3204. + int size;
  3205. + int align;
  3206. +{
  3207. + if (decl == NULL_TREE)
  3208. + {
  3209. + fprintf (file, "\t%s\t", COMMON_ASM_OP);
  3210. + }
  3211. + else
  3212. + {
  3213. + switch (c33_get_data_area (decl))
  3214. + {
  3215. + case DATA_AREA_ZDA:
  3216. + fprintf (file, "\t%s\t", ZCOMMON_ASM_OP);
  3217. + break;
  3218. +
  3219. + case DATA_AREA_SDA:
  3220. + fprintf (file, "\t%s\t", SCOMMON_ASM_OP);
  3221. + break;
  3222. +
  3223. + case DATA_AREA_TDA:
  3224. + fprintf (file, "\t%s\t", TCOMMON_ASM_OP);
  3225. + break;
  3226. +
  3227. + case DATA_AREA_GDA:
  3228. + fprintf (file, "\t%s\t", GCOMMON_ASM_OP);
  3229. + break;
  3230. +
  3231. + default:
  3232. + fprintf (file, "\t%s\t", COMMON_ASM_OP);
  3233. + break;
  3234. + }
  3235. + }
  3236. +
  3237. + assemble_name (file, name);
  3238. + fprintf (file, ",%u,%u\n", size, align / BITS_PER_UNIT);
  3239. +}
  3240. +
  3241. +
  3242. +/* Called via the macro ASM_OUTPUT_ALIGNED_DECL_LOCAL */
  3243. +void
  3244. +c33_output_local (file, decl, name, size, align)
  3245. + FILE * file;
  3246. + tree decl;
  3247. + char * name;
  3248. + int size;
  3249. + int align;
  3250. +{
  3251. + fprintf (file, "\t%s\t", LOCAL_ASM_OP);
  3252. + assemble_name (file, name);
  3253. + fprintf (file, "\n");
  3254. + ASM_OUTPUT_ALIGNED_DECL_COMMON (file, decl, name, size, align);
  3255. +}
  3256. +
  3257. +
  3258. +/* Output assembly code for the start of the file. */
  3259. +void
  3260. +asm_file_start (file)
  3261. + FILE *file;
  3262. +{
  3263. + output_file_directive (file, main_input_filename);
  3264. +
  3265. + print_options (file);
  3266. +}
  3267. +
  3268. +
  3269. +/* Write a loop to move a constant number of bytes.
  3270. + Generate load/stores as follows:
  3271. +
  3272. + do {
  3273. + temp1 = src[0];
  3274. + temp2 = src[1];
  3275. + ...
  3276. + temp<last> = src[MAX_MOVE_REGS-1];
  3277. + dest[0] = temp1;
  3278. + dest[1] = temp2;
  3279. + ...
  3280. + dest[MAX_MOVE_REGS-1] = temp<last>;
  3281. + src += MAX_MOVE_REGS;
  3282. + dest += MAX_MOVE_REGS;
  3283. + } while (src != final);
  3284. +
  3285. + This way, no NOP's are needed, and only MAX_MOVE_REGS+3 temp
  3286. + registers are needed.
  3287. +
  3288. + Aligned moves move MAX_MOVE_REGS*4 bytes every (2*MAX_MOVE_REGS)+3
  3289. + cycles, unaligned moves move MAX_MOVE_REGS*4 bytes every
  3290. + (4*MAX_MOVE_REGS)+3 cycles, assuming no cache misses. */
  3291. +
  3292. +#define MAX_MOVE_REGS 2
  3293. +#define MAX_MOVE_BYTES (MAX_MOVE_REGS * UNITS_PER_WORD)
  3294. +static void
  3295. +block_move_loop (dest_reg, src_reg, bytes, align, orig_src)
  3296. + rtx dest_reg; /* register holding destination address */
  3297. + rtx src_reg; /* register holding source address */
  3298. + int bytes; /* # bytes to move */
  3299. + int align; /* alignment */
  3300. + rtx orig_src; /* original source for making a reg note */
  3301. +
  3302. +{
  3303. + rtx dest_mem = gen_rtx (MEM, BLKmode, dest_reg);
  3304. + rtx src_mem = gen_rtx (MEM, BLKmode, src_reg);
  3305. + rtx align_rtx = GEN_INT (align);
  3306. + rtx label;
  3307. + rtx final_src;
  3308. + rtx bytes_rtx;
  3309. + int leftover;
  3310. +
  3311. + /* C33: If transmission byte is less than 16 byte. */
  3312. + if (bytes < 2 * MAX_MOVE_BYTES)
  3313. +
  3314. + /* C33: Stop processing. */
  3315. + abort ();
  3316. + leftover = bytes % MAX_MOVE_BYTES;
  3317. + bytes -= leftover;
  3318. +
  3319. + /* C33: Create the label rtx. */
  3320. + label = gen_label_rtx ();
  3321. +
  3322. + /* C33: Create the register rtx which saves the transmission end address. */
  3323. + final_src = gen_reg_rtx (Pmode);
  3324. + bytes_rtx = GEN_INT (bytes);
  3325. +
  3326. + /* C33: Emit the rtx whick decides the transmission end address. */
  3327. + emit_insn (gen_addsi3 (final_src, src_reg, bytes_rtx));
  3328. +
  3329. + /* C33: Emit the label rtx. */
  3330. + emit_label (label);
  3331. + bytes_rtx = GEN_INT (MAX_MOVE_BYTES);
  3332. +
  3333. + /* C33: Emit the rtx of transmission instruction array. */
  3334. + emit_insn (gen_movstrsi_internal (dest_reg, src_reg, bytes_rtx, align_rtx));
  3335. + /* C33: Emit the rtx of "cmp" instruction. */
  3336. + emit_insn (gen_cmpsi (src_reg, final_src));
  3337. +
  3338. + /* C33: Emit the rtx of "jump" instruction. */
  3339. + emit_jump_insn (gen_bne (label));
  3340. + if (leftover)
  3341. +
  3342. + /* C33: Emit the rtx of transmission instruction array. */
  3343. + emit_insn (gen_movstrsi_internal
  3344. + (dest_reg, src_reg, GEN_INT (leftover), align_rtx));
  3345. +}
  3346. +
  3347. +
  3348. +/* Use a library function to move some bytes. */
  3349. +static void
  3350. +block_move_call (dest_reg, src_reg, bytes_rtx)
  3351. + rtx dest_reg;
  3352. + rtx src_reg;
  3353. + rtx bytes_rtx;
  3354. +
  3355. +{
  3356. +
  3357. + /* C33: If it is not "VOIDmode", and not "Pmode". */
  3358. + /* We want to pass the size as Pmode, which will normally be SImode
  3359. + but will be DImode if we are using 64 bit longs and pointers. */
  3360. + if (GET_MODE (bytes_rtx) != VOIDmode && GET_MODE (bytes_rtx) != Pmode)
  3361. +
  3362. + /* C33: Yes, it is not "VOIDmode", and not "Pmode". */
  3363. +
  3364. + /* C33: Change the mode to Pmode. */
  3365. + bytes_rtx = convert_to_mode (Pmode, bytes_rtx, TRUE);
  3366. +
  3367. +#ifdef TARGET_MEM_FUNCTIONS
  3368. + /* C33: Emit the rtx for calling memcpy library. */
  3369. + emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memcpy"), 0, VOIDmode, 3,
  3370. + dest_reg, Pmode, src_reg, Pmode, bytes_rtx, Pmode);
  3371. +
  3372. +#else /* */
  3373. + /* C33: Emit the rtx for calling bcopy library. */
  3374. + emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "bcopy"), 0, VOIDmode, 3,
  3375. + src_reg, Pmode, dest_reg, Pmode, bytes_rtx, Pmode);
  3376. +
  3377. +#endif /* */
  3378. +
  3379. + /* C33: Terminating process. */
  3380. +}
  3381. +
  3382. +
  3383. +/* Expand string/block move operations.
  3384. +
  3385. + operands[0] is the pointer to the destination.
  3386. + operands[1] is the pointer to the source.
  3387. + operands[2] is the number of bytes to move.
  3388. + operands[3] is the alignment. */
  3389. +void
  3390. +expand_block_move (operands)
  3391. + rtx operands[];
  3392. +
  3393. +{
  3394. + rtx bytes_rtx = operands[2];
  3395. + rtx align_rtx = operands[3];
  3396. + int constp = (GET_CODE (bytes_rtx) == CONST_INT);
  3397. + int bytes = (constp ? INTVAL (bytes_rtx) : 0);
  3398. + int align = INTVAL (align_rtx);
  3399. + rtx orig_src = operands[1];
  3400. + rtx src_reg;
  3401. + rtx dest_reg;
  3402. +
  3403. + /* C33: If the transmission byte is less than 0. */
  3404. + if (constp && bytes <= 0)
  3405. +
  3406. + /* C33: Terminating process. */
  3407. + return;
  3408. +
  3409. + /* C33: If alignment is more than word. */
  3410. + if (align > UNITS_PER_WORD)
  3411. +
  3412. + /* C33: Fix to the word unit. */
  3413. + align = UNITS_PER_WORD;
  3414. +
  3415. + /* C33: Set the pair of scratch registers. */
  3416. + /* Move the address into scratch registers. */
  3417. + dest_reg = copy_addr_to_reg (XEXP (operands[0], 0));
  3418. + src_reg = copy_addr_to_reg (XEXP (orig_src, 0));
  3419. +
  3420. + /* C33:
  3421. + IF Optimize is enabled.
  3422. + There is The transmission data.
  3423. + The number of transmission is 2 or less. */
  3424. + if (constp && optimize && bytes != 0 && (bytes / align) <= 2)
  3425. +
  3426. + /* C33: Yes, the number of transmission is 2 or less. */
  3427. +
  3428. + /* C33: Emit the rtx of transmission instruction array. */
  3429. + emit_insn (gen_movstrsi_internal
  3430. + (dest_reg, src_reg, bytes_rtx, align_rtx));
  3431. + else
  3432. + /* C33, No, the number of transmission is 3 or more. */
  3433. +
  3434. + /* IF
  3435. + There is "-mno-memcpy" option.( It means default ) */
  3436. + if (TARGET_MEMCPY)
  3437. +
  3438. + /* YES memcpy */
  3439. +
  3440. + /* C33: Emit the rtx for calling memcopy library. */
  3441. + block_move_call (dest_reg, src_reg, bytes_rtx);
  3442. +
  3443. +
  3444. + /* C33: There is "-mno-memcpy" option.
  3445. + ELSE IF the transmission byte is 16 or less */
  3446. + else if (constp && bytes <= 2 * MAX_MOVE_BYTES)
  3447. + /* C33: Yes, the transmission byte is 16 or less. */
  3448. +
  3449. + /* C33: Emit the rtx of transmission instruction array. */
  3450. + emit_insn (gen_movstrsi_internal
  3451. + (dest_reg, src_reg, bytes_rtx, align_rtx));
  3452. +
  3453. + /* C33: ELSE IF
  3454. + The alignment is word and the optimize is enabled. */
  3455. + else if (constp && align >= UNITS_PER_WORD && optimize)
  3456. +
  3457. + /* YES */
  3458. +
  3459. + /* C33: Create the rtl sequence of the block transmission loop. */
  3460. + block_move_loop (dest_reg, src_reg, bytes, align, orig_src);
  3461. +
  3462. + /* C33: ELSE IF
  3463. + The alignment is not word and the optimize is enabled. */
  3464. + else if (constp && optimize)
  3465. +
  3466. + {
  3467. +
  3468. + /* If the alignment is not word aligned, generate a test at
  3469. + runtime, to see whether things wound up aligned, and we
  3470. + can use the faster lw/sw instead ulw/usw. */
  3471. + rtx temp = gen_reg_rtx (Pmode);
  3472. + rtx aligned_label = gen_label_rtx ();
  3473. + rtx join_label = gen_label_rtx ();
  3474. + int leftover = bytes % MAX_MOVE_BYTES;
  3475. + bytes -= leftover;
  3476. +
  3477. + /* C33: Create the instructions which are address calculation and
  3478. + jump destination calculation for transmitting by loop. */
  3479. + emit_insn (gen_iorsi3 (temp, src_reg, dest_reg));
  3480. + emit_insn (gen_andsi3 (temp, temp, GEN_INT (UNITS_PER_WORD - 1)));
  3481. + emit_insn (gen_cmpsi (temp, const0_rtx));
  3482. + emit_jump_insn (gen_beq (aligned_label));
  3483. +
  3484. + /* C33: Create the transmission loop which transmits 1byte at a time. */
  3485. + /* Unaligned loop. */
  3486. + block_move_loop (dest_reg, src_reg, bytes, 1, orig_src);
  3487. + emit_jump_insn (gen_jump (join_label));
  3488. + emit_barrier ();
  3489. +
  3490. + /* C33: Create the transmission loop by word unit. */
  3491. + /* Aligned loop. */
  3492. + emit_label (aligned_label);
  3493. + block_move_loop (dest_reg, src_reg, bytes, UNITS_PER_WORD, orig_src);
  3494. + emit_label (join_label);
  3495. +
  3496. + /* C33: Create the transmission instruction which can transmit
  3497. + less than the loop tranmit by word unit. */
  3498. + /* Bytes at the end of the loop. */
  3499. + if (leftover)
  3500. +
  3501. + {
  3502. + emit_insn (gen_movstrsi_internal
  3503. + (dest_reg, src_reg, GEN_INT (leftover),
  3504. + GEN_INT (align)));}
  3505. + }
  3506. +
  3507. + else
  3508. + /* C33: Yes, the specification of byte number is not constants
  3509. + or does not have the optimization. */
  3510. +
  3511. + /* C33: Emit the rtx for calling memcopy library. */
  3512. + block_move_call (dest_reg, src_reg, bytes_rtx);
  3513. +}
  3514. +
  3515. +
  3516. +/********************************************************************************************
  3517. +Format : char* output_block_move (insn, operands, num_regs)
  3518. +Input :
  3519. +Output : None
  3520. +Return :
  3521. +Explanation : Output load instruction called from "insn_outfun()".
  3522. +*********************************************************************************************/
  3523. +char *
  3524. +output_block_move (insn, operands, num_regs)
  3525. + rtx insn;
  3526. + rtx operands[];
  3527. + int num_regs; /* C33: The number of registers which can be used for transmission. */
  3528. +{
  3529. + rtx dest_reg = operands[0];
  3530. + rtx src_reg = operands[1];
  3531. + int bytes = INTVAL (operands[2]);
  3532. + int align = INTVAL (operands[3]);
  3533. + int num = 0;
  3534. + int last_operand = num_regs + 4;
  3535. + int safe_regs = 4;
  3536. + int i;
  3537. + rtx xoperands[10];
  3538. + struct
  3539. + {
  3540. + char *load; /* load insn without nop */
  3541. + char *store; /* store insn */
  3542. + enum machine_mode mode; /* mode to use on (MEM) */
  3543. + }
  3544. + load_store[4];
  3545. +
  3546. + /* Detect a bug in GCC, where it can give us a register
  3547. + the same as one of the addressing registers and reduce
  3548. + the number of registers available. */
  3549. + for (i = 4;
  3550. + i < last_operand
  3551. + && safe_regs < (sizeof (xoperands) / sizeof (xoperands[0])); i++)
  3552. +
  3553. + {
  3554. + if (!reg_mentioned_p (operands[i], operands[0])
  3555. + && !reg_mentioned_p (operands[i], operands[1]))
  3556. + xoperands[safe_regs++] = operands[i];
  3557. + }
  3558. + if (safe_regs < last_operand)
  3559. +
  3560. + {
  3561. + xoperands[0] = operands[0];
  3562. + xoperands[1] = operands[1];
  3563. + xoperands[2] = operands[2];
  3564. + xoperands[3] = operands[3];
  3565. + return output_block_move (insn, xoperands, safe_regs - 4);
  3566. + }
  3567. +
  3568. + /* If we are given global or static addresses, and we would be
  3569. + emitting a few instructions, try to save time by using a
  3570. + temporary register for the pointer. */
  3571. +
  3572. + /* C33: IF The number of registers which can be used for transmission
  3573. + is 3 or more, and the numer of transmission is 3 or more. */
  3574. + if (num_regs > 2 && (bytes > 2 * align))
  3575. +
  3576. + {
  3577. + /* C33: IF The address of memory from which to transmit is the label or the constants. */
  3578. + if (CONSTANT_P (src_reg))
  3579. + {
  3580. +
  3581. + /* C33: Get the "template" register. */
  3582. + src_reg = operands[3 + num_regs--];
  3583. +
  3584. + /* C33: Output the instruction which loads the address of memory
  3585. + from which to transmit to the "template" register. */
  3586. + xoperands[1] = operands[1];
  3587. + xoperands[0] = src_reg;
  3588. + output_asm_insn ("xld.w\t%0,%1", xoperands);
  3589. + }
  3590. +
  3591. + /* C33: IF The address of memory to which to transmit is the label or the symbols or the constants. */
  3592. + if (CONSTANT_P (dest_reg))
  3593. + {
  3594. +
  3595. + /* C33: Get the "template" register. */
  3596. + dest_reg = operands[3 + num_regs--];
  3597. +
  3598. + /* C33: Output the instruction which loads the address of memory
  3599. + from which to trasmit to the "template" register. */
  3600. + xoperands[1] = operands[0];
  3601. + xoperands[0] = dest_reg;
  3602. + output_asm_insn ("xld.w\t%0,%1", xoperands);
  3603. + }
  3604. + }
  3605. +
  3606. + /* C33: IF The number of registers which can be used for transmission is 4 or more. */
  3607. + if (num_regs > (sizeof (load_store) / sizeof (load_store[0])))
  3608. +
  3609. + /* C33: The number of registers which can be used shall be 4 or less. */
  3610. + num_regs = (sizeof (load_store) / sizeof (load_store[0]));
  3611. +
  3612. + /* C33: WHILE Until all transmitted data is output. */
  3613. + while (bytes > 0)
  3614. +
  3615. + {
  3616. +
  3617. + /* C33: IF The transmission bytes and alignment are 4byte or more. */
  3618. + if (bytes >= 4 && align >= 4)
  3619. +
  3620. + {
  3621. +
  3622. + /* C33: Transmit by word unit. */
  3623. + load_store[num].load = "ld.w\t%0,[%1]+";
  3624. + load_store[num].store = "ld.w\t[%1]+,%0";
  3625. + load_store[num].mode = SImode;
  3626. + bytes -= 4;
  3627. + }
  3628. +
  3629. + /* C33: ELSE IF The transmission bytes and alignment are 2byte or more. */
  3630. + else if (bytes >= 2 && align >= 2)
  3631. +
  3632. + {
  3633. + /* C33: Transmit by half unit. */
  3634. + load_store[num].load = "ld.h\t%0,[%1]+";
  3635. + load_store[num].store = "ld.h\t[%1]+,%0";
  3636. + load_store[num].mode = HImode;
  3637. + bytes -= 2;
  3638. + }
  3639. +
  3640. + /* C33: ELSE transmit except by word or by half. */
  3641. + else
  3642. +
  3643. + {
  3644. +
  3645. + /* byte] */
  3646. + load_store[num].load = "ld.b\t%0,[%1]+";
  3647. + load_store[num].store = "ld.b\t[%1]+,%0";
  3648. + load_store[num].mode = QImode;
  3649. + bytes--;
  3650. + }
  3651. +
  3652. + /* Emit load/stores now if we have run out of registers or are
  3653. + at the end of the move. */
  3654. +
  3655. + /* C33: IF All registers for transmission have been used,
  3656. + or all instructions which transmit all data have been output. */
  3657. + if (++num == num_regs || bytes == 0)
  3658. +
  3659. + {
  3660. +
  3661. + /* C33: Output the load instruction. */
  3662. + for (i = 0; i < num; i++)
  3663. +
  3664. + {
  3665. + if (!operands[i + 4])
  3666. + abort ();
  3667. +
  3668. + /* C33: IF The mode of "temp" register which saves temporarily
  3669. + the content of memory to transmit is different from the mode of data to transmit. */
  3670. + if (GET_MODE (operands[i + 4]) != load_store[i].mode)
  3671. +
  3672. + /* C33: Change the mode of "temp" register which saves temporarily the data. */
  3673. + operands[i + 4] =
  3674. + gen_rtx (REG, load_store[i].mode, REGNO (operands[i + 4]));
  3675. +
  3676. + /* C33: Output the instruction which loads the content of memory
  3677. + from which to transmit to "temp" register. */
  3678. + xoperands[0] = operands[i + 4];
  3679. + xoperands[1] = gen_rtx (MEM, load_store[i].mode, src_reg);
  3680. + output_asm_insn (load_store[i].load, xoperands);
  3681. + }
  3682. +
  3683. + /* C33: Output the store instruction. */
  3684. + for (i = 0; i < num; i++)
  3685. +
  3686. + {
  3687. + /* C33: Output the instruction which loads the content of "temp" register
  3688. + to the memory to which to transmit. */
  3689. + xoperands[0] = operands[i + 4];
  3690. + xoperands[1] = gen_rtx (MEM, load_store[i].mode, dest_reg);
  3691. + output_asm_insn (load_store[i].store, xoperands);
  3692. + }
  3693. +
  3694. + /* C33: Set 0 to the register number which is used for transmission. */
  3695. + num = 0; /* reset load_store */
  3696. + }
  3697. + }
  3698. +
  3699. + /* C33: Terminating process. */
  3700. + return "";
  3701. +}
  3702. +
  3703. +
  3704. +/* Given INSN and its current length LENGTH, return the adjustment
  3705. + (in bytes) to correctly compute INSN's length.
  3706. +
  3707. + We use this to get the lengths of various memory references correct. */
  3708. +/*****************************************************************************************************
  3709. +Format : int c33_adjust_insn_length (insn, length)
  3710. +Input : rtx insn -- INSN checked.
  3711. + int length -- Unused.
  3712. +Output : None
  3713. +Return : The instruction lengths corrected.( by byte unit )
  3714. +Explanation : ECalled from "shorten_branches()".
  3715. + ECorrect the instruction lengths.
  3716. + EIt is not necessary for adjusting here, because "m -> r" and "r -> m"
  3717. + are not created in the case of "-medda32" && "defaut data area".
  3718. +*****************************************************************************************************/
  3719. +// CHG K.Watanabe V1.8 >>>>>>>
  3720. +#if 0
  3721. +c33_adjust_insn_length (insn, length)
  3722. +#endif
  3723. +
  3724. +int c33_adjust_insn_length (insn, length)
  3725. +// CHG K.Watanabe V1.8 <<<<<<<
  3726. + rtx insn;
  3727. + int length;
  3728. +{
  3729. + rtx pat;
  3730. + pat = PATTERN (insn);
  3731. +
  3732. + /* Ajust length for symbol/label->reg. */
  3733. + if (GET_CODE (pat) == SET
  3734. + && (GET_CODE (SET_DEST (pat)) != PC)
  3735. + && (GET_CODE (SET_SRC (pat)) == LABEL_REF
  3736. + || GET_CODE (SET_SRC (pat)) == SYMBOL_REF
  3737. + || GET_CODE (SET_SRC (pat)) == CONST))
  3738. + {
  3739. + /* This insn might need a length adjustment. */
  3740. + rtx addr;
  3741. + char *name;
  3742. +
  3743. + /***************************************************/
  3744. + /* C33: Get the symobl address. */
  3745. + /***************************************************/
  3746. + if (GET_CODE (SET_SRC (pat)) == SYMBOL_REF
  3747. + || GET_CODE (SET_SRC (pat)) == LABEL_REF)
  3748. + name = XSTR (SET_SRC (pat), 0);
  3749. + else
  3750. + name = XSTR (XEXP (XEXP (SET_SRC (pat), 0), 0), 0);
  3751. +
  3752. + if (ENCODED_NAME_P (name))
  3753. + if ((TARGET_EXT_ZDA && ZDA_NAME_P (name))
  3754. + || (TARGET_EXT_TDA && TDA_NAME_P (name))
  3755. + || (TARGET_EXT_SDA && SDA_NAME_P (name)))
  3756. + return 0; /* [stz] data area extended */
  3757. + else
  3758. + return -2; /* [stzg] data area */
  3759. + else
  3760. + if (TARGET_C33ADV)
  3761. + return 2; /* default data area */
  3762. + else
  3763. + return 0;
  3764. + }
  3765. +
  3766. + /* Adjust length for reg->mem and mem->reg copies. */
  3767. + if (GET_CODE (pat) == SET
  3768. + && (GET_CODE (SET_SRC (pat)) == MEM
  3769. + || GET_CODE (SET_DEST (pat)) == MEM))
  3770. + {
  3771. + /* This insn might need a length adjustment. */
  3772. + rtx addr;
  3773. + int mode;
  3774. + char *name;
  3775. +
  3776. + if (GET_CODE (SET_SRC (pat)) == MEM)
  3777. + {
  3778. + addr = XEXP (SET_SRC (pat), 0);
  3779. + mode = GET_MODE (SET_SRC (pat));
  3780. + }
  3781. + else
  3782. + {
  3783. + addr = XEXP (SET_DEST (pat), 0);
  3784. + mode = GET_MODE (SET_DEST (pat));
  3785. + }
  3786. +
  3787. + switch (mode)
  3788. + {
  3789. + case DFmode:
  3790. + case DImode:
  3791. + if (GET_CODE (addr) == REG)
  3792. + return -6;
  3793. + else if (GET_CODE (addr) == PLUS)
  3794. + return 0;
  3795. + else
  3796. + {
  3797. + printf("c33_adjust_insn_length: MEM\n");// debug
  3798. + return 0;
  3799. + }
  3800. + break;
  3801. +
  3802. + default:
  3803. + switch (GET_CODE (addr))
  3804. + {
  3805. + case REG:
  3806. + return -4;
  3807. + break;
  3808. +
  3809. + case PLUS:
  3810. + if (GET_CODE (XEXP (addr, 0)) == REG
  3811. + && REGNO (XEXP (addr, 0)) == STACK_POINTER_REGNUM
  3812. + && GET_CODE (XEXP (addr, 1)) == CONST_INT)
  3813. + {
  3814. + switch (mode)
  3815. + {
  3816. + case QImode:
  3817. + if (CONST_OK_FOR_IMM6 (INTVAL (XEXP (addr, 1))))
  3818. + return -4;
  3819. + if (CONST_OK_FOR_IMM19 (INTVAL (XEXP (addr, 1))))
  3820. + return -2;
  3821. + break;
  3822. +
  3823. + case HImode:
  3824. + if (CONST_OK_FOR_IMM7 (INTVAL (XEXP (addr, 1))))
  3825. + return -4;
  3826. + if (CONST_OK_FOR_IMM19 (INTVAL (XEXP (addr, 1))))
  3827. + return -2;
  3828. + break;
  3829. +
  3830. + case SImode:
  3831. + default:
  3832. + if (CONST_OK_FOR_IMM8 (INTVAL (XEXP (addr, 1))))
  3833. + return -4;
  3834. + if (CONST_OK_FOR_IMM19 (INTVAL (XEXP (addr, 1))))
  3835. + return -2;
  3836. + break;
  3837. + }
  3838. + }
  3839. + else
  3840. + {
  3841. + if (CONST_OK_FOR_IMM13 (INTVAL (XEXP (addr, 1))))
  3842. + return -2;
  3843. + }
  3844. + break;
  3845. +
  3846. + /****************************************************************/
  3847. + /* C33: Reference the symbol.( loading memory / saving memory ) */
  3848. + /****************************************************************/
  3849. + case SYMBOL_REF:
  3850. + name = XSTR (addr, 0);
  3851. +
  3852. + /* C33: It is -2 except in the case of "dafault data area". */
  3853. + if (ENCODED_NAME_P (name))
  3854. + if ((TARGET_EXT_ZDA && ZDA_NAME_P (name))
  3855. + || (TARGET_EXT_TDA && TDA_NAME_P (name))
  3856. + || (TARGET_EXT_SDA && SDA_NAME_P (name)))
  3857. + return 0; /* [stz] data area extended */
  3858. + else
  3859. + return -2; /* [stzg] data area */
  3860. + else
  3861. + if (TARGET_C33ADV)
  3862. + return 2; /* default data area */
  3863. + else
  3864. + return 0;
  3865. + break;
  3866. +
  3867. + case CONST:
  3868. + name = XSTR (XEXP (XEXP (addr, 0), 0), 0);
  3869. +
  3870. + /* It is -2 except in the case of "dafault data area". */
  3871. + if (ENCODED_NAME_P (name))
  3872. + if ((TARGET_EXT_ZDA && ZDA_NAME_P (name))
  3873. + || (TARGET_EXT_TDA && TDA_NAME_P (name))
  3874. + || (TARGET_EXT_SDA && SDA_NAME_P (name)))
  3875. + return 0; /* [stz] data area extended */
  3876. + else
  3877. + return -2; /* [stzg] data area */
  3878. + else
  3879. + if (TARGET_C33ADV)
  3880. + return 2; /* default data area */
  3881. + else
  3882. + return 0;
  3883. + break;
  3884. + }
  3885. + }
  3886. +
  3887. + /* ADD K.Watanabe V1.4 >>>>>>> */
  3888. + } else {
  3889. + /*******************************************************************************************/
  3890. + /* @SIGN_EXTEND( MEM ) -> REG */
  3891. + /* C33: In the case that the argument is the global variable of "char" / "short" type. */
  3892. + /* AZERO_EXTEND( MEM ) -> REG */
  3893. + /* C33: In the case that the argument is the global variable of "unsigned char" / */
  3894. + /* "unsigned short" type. */
  3895. + /*******************************************************************************************/
  3896. + rtx addr;
  3897. + int mode;
  3898. + char *name;
  3899. + int i_chk_flg;
  3900. +
  3901. + i_chk_flg = 0;
  3902. + if( GET_CODE (pat) == SET ){
  3903. + if( GET_CODE (SET_DEST (pat)) == REG ){
  3904. + if( ( GET_CODE (SET_SRC (pat)) == SIGN_EXTEND ) || ( GET_CODE (SET_SRC (pat)) == ZERO_EXTEND ) ){
  3905. + if( GET_CODE( SUBREG_REG( SET_SRC (pat) ) ) == MEM ){
  3906. + i_chk_flg = 1;
  3907. + addr = XEXP( SUBREG_REG( SET_SRC (pat) ),0 );
  3908. + mode = GET_MODE ( SUBREG_REG( SET_SRC (pat) ) );
  3909. + }
  3910. + }
  3911. + }
  3912. + }
  3913. +
  3914. + /* SIGN_EXTEND( MEM ) -> REG */
  3915. + /* ZERO_EXTEND( MEM ) -> REG */
  3916. + if( i_chk_flg == 1 ){
  3917. + switch (mode){
  3918. + case DFmode:
  3919. + case DImode:
  3920. + break;
  3921. +
  3922. + default:
  3923. + switch (GET_CODE (addr)){
  3924. + case REG:
  3925. + case PLUS:
  3926. + break;
  3927. +
  3928. + /****************************************************************/
  3929. + /* C33: Reference the symbol.( loading memory / saving memory ) */
  3930. + /****************************************************************/
  3931. + case SYMBOL_REF:
  3932. + name = XSTR (addr, 0);
  3933. +
  3934. + /* It is -2 except in the case of "dafault data area". */
  3935. + if ( ( ENCODED_NAME_P (name) ) ){
  3936. + if( (TARGET_EXT_ZDA && ZDA_NAME_P (name))
  3937. + || (TARGET_EXT_TDA && TDA_NAME_P (name))
  3938. + || (TARGET_EXT_SDA && SDA_NAME_P (name)) ){
  3939. + return 0; /* [stz] data area extended */
  3940. + } else {
  3941. + return -2; /* [stzg] data area */
  3942. + }
  3943. + }
  3944. + break;
  3945. +
  3946. + case CONST:
  3947. + name = XSTR (XEXP (XEXP (addr, 0), 0), 0);
  3948. +
  3949. + /* It is -2 except in the case of "dafault data area". */
  3950. + if ( ( ENCODED_NAME_P (name) ) ){
  3951. + if( (TARGET_EXT_ZDA && ZDA_NAME_P (name))
  3952. + || (TARGET_EXT_TDA && TDA_NAME_P (name))
  3953. + || (TARGET_EXT_SDA && SDA_NAME_P (name)) ){
  3954. + return 0; /* [stz] data area extended */
  3955. + } else {
  3956. + return -2; /* [stzg] data area */
  3957. + }
  3958. + }
  3959. + break;
  3960. + }
  3961. + }
  3962. + }
  3963. + }
  3964. + /* ADD K.Watanabe V1.4 <<<<<<< */
  3965. +
  3966. + /* ADD K.Watanabe V1.7 >>>>>>> */
  3967. + /* C33: Add the process because the adjustment of instruction lengths was not described
  3968. + in the case of outputting multiple shift instrcutions. */
  3969. +
  3970. + if( ( GET_CODE (pat) == PARALLEL )
  3971. + && ( GET_CODE (XVECEXP (pat, 0, 0)) == SET ) ){
  3972. +
  3973. + rtx p = XVECEXP (pat, 0, 0);
  3974. + enum rtx_code code;
  3975. + code = GET_CODE (SET_SRC (p));
  3976. + if( ( code == ASHIFTRT )
  3977. + || ( code == LSHIFTRT )
  3978. + || ( code == ASHIFT )
  3979. + || ( code == ROTATE )
  3980. + || ( code == ROTATERT ) ) {
  3981. + if( GET_CODE( XEXP (SET_SRC (p), 1) ) == CONST_INT ){
  3982. + int n = INTVAL( (XEXP (SET_SRC (p), 1)) ) & 0x1f;
  3983. + int i_ret = 0;
  3984. +
  3985. + if ((code == LSHIFTRT) && (n > 27)){
  3986. + ;
  3987. + } else if ((code == ASHIFT) && (n > 27)){
  3988. + ;
  3989. + } else {
  3990. + /* C33: Inverse the rotate in the case of 16 or more. */
  3991. + if ((code == ROTATE) && (n > 16)){
  3992. + n = 32 - n;
  3993. + } else if ((code == ROTATERT) && (n > 16)) {
  3994. + n = 32 - n;
  3995. + }
  3996. + while (n > 8){
  3997. + n -= 8;
  3998. + i_ret += 2;
  3999. + }
  4000. + }
  4001. + return i_ret;
  4002. + }
  4003. + }
  4004. + }
  4005. + /* ADD K.Watanabe V1.7 <<<<<<< */
  4006. +
  4007. + return 0;
  4008. +}
  4009. +
  4010. +
  4011. +/* ADD K.Watanabe V1.7 >>>>>>> */
  4012. +const struct attribute_spec c33_attribute_table[] =
  4013. +{
  4014. + /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
  4015. + { "interrupt_handler", 0, 0, true, false, false, c33_handle_interrupt_attribute },
  4016. + { "section", 0, 0, true, false, false, c33_handle_section_attribute },
  4017. + { "sda", 0, 0, true, false, false, c33_handle_data_area_attribute },
  4018. + { "tda", 0, 0, true, false, false, c33_handle_data_area_attribute },
  4019. + { "zda", 0, 0, true, false, false, c33_handle_data_area_attribute },
  4020. + { NULL, 0, 0, false, false, false, NULL }
  4021. +};
  4022. +
  4023. +
  4024. +/* Handle an "interrupt" attribute; arguments as in */
  4025. +/* struct attribute_spec.handler. */
  4026. +/* C33: Quoted from v850. */
  4027. +static tree
  4028. +c33_handle_interrupt_attribute (node, name, args, flags, no_add_attrs)
  4029. + tree *node;
  4030. + tree name;
  4031. + tree args ATTRIBUTE_UNUSED;
  4032. + int flags ATTRIBUTE_UNUSED;
  4033. + bool *no_add_attrs;
  4034. +{
  4035. + if (TREE_CODE (*node) != FUNCTION_DECL)
  4036. + {
  4037. + warning ("`%s' attribute only applies to functions",
  4038. + IDENTIFIER_POINTER (name));
  4039. + *no_add_attrs = true;
  4040. + }
  4041. +
  4042. + return NULL_TREE;
  4043. +}
  4044. +
  4045. +
  4046. +static tree
  4047. +c33_handle_section_attribute (node, name, args, flags, no_add_attrs)
  4048. + tree *node;
  4049. + tree name;
  4050. + tree args ATTRIBUTE_UNUSED;
  4051. + int flags ATTRIBUTE_UNUSED;
  4052. + bool *no_add_attrs;
  4053. +{
  4054. + if (TREE_CODE (*node) != FUNCTION_DECL)
  4055. + {
  4056. + warning ("`%s' attribute only applies to functions",
  4057. + IDENTIFIER_POINTER (name));
  4058. + *no_add_attrs = true;
  4059. + }
  4060. +
  4061. + return NULL_TREE;
  4062. +}
  4063. +
  4064. +
  4065. +/* Handle a "sda", "tda" or "zda" attribute; arguments as in */
  4066. +/* struct attribute_spec.handler. */
  4067. +/* C33: Quoted from v850.
  4068. + The following function is correspond to that which is removed "interrupt_handler"
  4069. + from c33_valid_machine_decl_attribute() in v2.95.2. */
  4070. +static tree
  4071. +c33_handle_data_area_attribute (node, name, args, flags, no_add_attrs)
  4072. + tree *node;
  4073. + tree name;
  4074. + tree args ATTRIBUTE_UNUSED;
  4075. + int flags ATTRIBUTE_UNUSED;
  4076. + bool *no_add_attrs;
  4077. +{
  4078. + c33_data_area data_area;
  4079. + c33_data_area area;
  4080. + tree decl = *node;
  4081. +
  4082. + /* Implement data area attribute. */
  4083. + if (is_attribute_p ("sda", name))
  4084. + {
  4085. + if (gp_max < 4)
  4086. + {
  4087. + error_with_decl (decl, "data area of '%s' cannot be specified for 'sda'.");
  4088. + return NULL_TREE;
  4089. + }
  4090. + else if (TREE_CODE (decl) == FUNCTION_DECL)
  4091. + {
  4092. + error_with_decl (decl, "'%s' cannot be specified for 'sda'.");
  4093. + return NULL_TREE;
  4094. + }
  4095. + else
  4096. + data_area = DATA_AREA_SDA;
  4097. + }
  4098. + else if (is_attribute_p ("tda", name))
  4099. + {
  4100. + if (gp_max < 3)
  4101. + {
  4102. + error_with_decl (decl, "data area of '%s' cannot be specified for 'tda'.");
  4103. + return NULL_TREE;
  4104. + }
  4105. + else if (TREE_CODE (decl) == FUNCTION_DECL)
  4106. + {
  4107. + error_with_decl (decl, "'%s' cannot be specified for 'tda'.");
  4108. + return NULL_TREE;
  4109. + }
  4110. + else
  4111. + data_area = DATA_AREA_TDA;
  4112. + }
  4113. + else if (is_attribute_p ("zda", name))
  4114. + {
  4115. + if (gp_max < 2)
  4116. + {
  4117. + error_with_decl (decl, "data area of '%s' cannot be specified for 'zda'.");
  4118. + return NULL_TREE;
  4119. + }
  4120. + else if (TREE_CODE (decl) == FUNCTION_DECL)
  4121. + {
  4122. + error_with_decl (decl, "'%s' cannot be specified for 'zda'.");
  4123. + return NULL_TREE;
  4124. + }
  4125. + else
  4126. + data_area = DATA_AREA_ZDA;
  4127. + }
  4128. + else
  4129. + abort ();
  4130. +
  4131. + switch (TREE_CODE (decl))
  4132. + {
  4133. + case VAR_DECL:
  4134. + if (current_function_decl != NULL_TREE)
  4135. + error_with_decl (decl, "\
  4136. +a data area attribute cannot be specified for local variables");
  4137. +
  4138. + /* Drop through. */
  4139. +
  4140. + case FUNCTION_DECL:
  4141. + area = c33_get_data_area (decl);
  4142. + if (area != DATA_AREA_NORMAL && data_area != area)
  4143. + error_with_decl (decl, "\
  4144. +data area of '%s' conflicts with previous declaration");
  4145. +
  4146. + break;
  4147. +
  4148. + default:
  4149. + break;
  4150. + }
  4151. +
  4152. + return NULL_TREE;
  4153. +}
  4154. +
  4155. +
  4156. +static void
  4157. +c33_encode_section_info (decl, first)
  4158. + tree decl;
  4159. + int first;
  4160. +{
  4161. + if (first && TREE_CODE (decl) == VAR_DECL
  4162. + && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
  4163. + c33_encode_data_area (decl);
  4164. +}
  4165. +
  4166. +
  4167. +static void
  4168. +c33_asm_out_constructor (symbol, priority)
  4169. + rtx symbol;
  4170. + int priority ATTRIBUTE_UNUSED;
  4171. +{
  4172. + ctors_section ();
  4173. + fprintf (asm_out_file, "\t%s\t ", ".long");
  4174. + assemble_name (asm_out_file, XSTR (symbol, 0));
  4175. + fprintf (asm_out_file, "\n");
  4176. +}
  4177. +
  4178. +
  4179. +static void
  4180. +c33_asm_out_destructor (symbol, priority)
  4181. + rtx symbol;
  4182. + int priority ATTRIBUTE_UNUSED;
  4183. +{
  4184. + dtors_section ();
  4185. + fprintf (asm_out_file, "\t%s\t ", ".long");
  4186. + assemble_name (asm_out_file, XSTR (symbol, 0));
  4187. + fprintf (asm_out_file, "\n");
  4188. +}
  4189. +
  4190. +/* CHG K.Watanabe V1.7 >>>>>>> */
  4191. +#if 0
  4192. +/*****************************************************************************************************
  4193. +Format : static void c33_unique_section (tree decl,int reloc)
  4194. +Input : tree decl
  4195. + int reloc
  4196. +Output : None
  4197. +Return : None
  4198. +Explanation : EOutput ".gnu.linkonce." section.
  4199. + ECreated from mips_unique_section() in mips.c.
  4200. + EDo not output ".gnu.linkonce." section of "S/T/Z/G" data area
  4201. + because "S/T/Z/G" data area is not supported no more.
  4202. + The following function is described as comment for preparation in the case that
  4203. + "S/T/Z/G" data area is supported.
  4204. + If "S/T/Z/G" data area is supported in the future, the description is needed
  4205. + in the "*.lds" file for ".gnu.linkonce." section of "S/T/Z/G" data area.
  4206. +*****************************************************************************************************/
  4207. +static void
  4208. +c33_unique_section (decl, reloc)
  4209. + tree decl;
  4210. + int reloc;
  4211. +{
  4212. + int len;
  4213. + char *name, *string, *prefix;
  4214. + static const char *const cp_prefixes[11][2] = {
  4215. + { ".text.", ".gnu.linkonce.t." },
  4216. + { ".rozdata.", ".gnu.linkonce.zr." },
  4217. + { ".rotdata.", ".gnu.linkonce.tr." },
  4218. + { ".rosdata.", ".gnu.linkonce.sr." },
  4219. + { ".rodata.", ".gnu.linkonce.r." },
  4220. + { ".rodata.", ".gnu.linkonce.r." },
  4221. + { ".zdata.", ".gnu.linkonce.zd." },
  4222. + { ".tdata.", ".gnu.linkonce.td." },
  4223. + { ".sdata.", ".gnu.linkonce.sd." },
  4224. + { ".gdata.", ".gnu.linkonce.gd." },
  4225. + { ".data.", ".gnu.linkonce.d." }
  4226. + };
  4227. + int i_sec;
  4228. +
  4229. + i_sec = -1;
  4230. + name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
  4231. + name = (* targetm.strip_name_encoding) (name);
  4232. +
  4233. + if (TREE_CODE (decl) == FUNCTION_DECL){
  4234. + i_sec = 0;
  4235. + } else if (DECL_INITIAL (decl) == 0
  4236. + || DECL_INITIAL (decl) == error_mark_node) {
  4237. + switch (c33_get_data_area (decl)){
  4238. + case DATA_AREA_ZDA:
  4239. + // i_sec = 6; // C33: Not supported.
  4240. + break;
  4241. + case DATA_AREA_TDA:
  4242. + // i_sec = 7; // C33: Not supported.
  4243. + break;
  4244. + case DATA_AREA_SDA:
  4245. + // i_sec = 8; // C33: Not supported.
  4246. + break;
  4247. + case DATA_AREA_GDA:
  4248. + // i_sec = 9; // C33: Not supported.
  4249. + break;
  4250. + default:
  4251. + i_sec = 10;
  4252. + break;
  4253. + }
  4254. + } else if (decl_readonly_section (decl, reloc)) {
  4255. + switch (c33_get_data_area (decl)){
  4256. + case DATA_AREA_ZDA:
  4257. + // i_sec = 1; // C33: Not supported.
  4258. + break;
  4259. + case DATA_AREA_TDA:
  4260. + // i_sec = 2; // C33: Not supported.
  4261. + break;
  4262. + case DATA_AREA_SDA:
  4263. + // i_sec = 3; // C33: Not supported.
  4264. + break;
  4265. + case DATA_AREA_GDA:
  4266. + // i_sec = 4; // C33: Not supported.
  4267. + break;
  4268. + default:
  4269. + i_sec = 5;
  4270. + break;
  4271. + }
  4272. + } else {
  4273. + switch (c33_get_data_area (decl)){
  4274. + case DATA_AREA_ZDA:
  4275. + // i_sec = 6; // C33: Not supported.
  4276. + break;
  4277. + case DATA_AREA_TDA:
  4278. + // i_sec = 7; // C33: Not supported.
  4279. + break;
  4280. + case DATA_AREA_SDA:
  4281. + // i_sec = 8; // C33: Not supported.
  4282. + break;
  4283. + case DATA_AREA_GDA:
  4284. + // i_sec = 9; // C33: Not supported.
  4285. + break;
  4286. + default:
  4287. + i_sec = 10;
  4288. + break;
  4289. + }
  4290. + }
  4291. +
  4292. + if( i_sec != -1 ){
  4293. + prefix = cp_prefixes[i_sec][DECL_ONE_ONLY (decl)];
  4294. +
  4295. + len = strlen (name) + strlen (prefix);
  4296. + string = alloca (len + 1);
  4297. + sprintf (string, "%s%s", prefix, name);
  4298. +
  4299. + DECL_SECTION_NAME (decl) = build_string (len, string);
  4300. + }
  4301. +}
  4302. +#endif
  4303. +
  4304. +/* C33: Do not output "gnu.linkonce." because the address calculation is sometimes not correct
  4305. + at the time of linking in V1.7 release. */
  4306. +static void
  4307. +c33_unique_section (decl, reloc)
  4308. + tree decl;
  4309. + int reloc;
  4310. +{
  4311. +
  4312. +}
  4313. +/* CHG K.Watanabe V1.7 <<<<<<< */
  4314. +
  4315. +/* When assemble_integer is used to emit the offsets for a switch
  4316. + table it can encounter (TRUNCATE:HI (MINUS:SI (LABEL_REF:SI) (LABEL_REF:SI))).
  4317. + output_addr_const will normally barf at this, but it is OK to omit
  4318. + the truncate and just emit the difference of the two labels. The
  4319. + .hword directive will automatically handle the truncation for us.
  4320. + Returns 1 if rtx was handled, 0 otherwise. */
  4321. +/* C33: Quoted from v850. */
  4322. +
  4323. +int
  4324. +c33_output_addr_const_extra (file, x)
  4325. + FILE * file;
  4326. + rtx x;
  4327. +{
  4328. + if (GET_CODE (x) != TRUNCATE)
  4329. + return 0;
  4330. +
  4331. + x = XEXP (x, 0);
  4332. +
  4333. + /* We must also handle the case where the switch table was passed a
  4334. + constant value and so has been collapsed. In this case the first
  4335. + label will have been deleted. In such a case it is OK to emit
  4336. + nothing, since the table will not be used.
  4337. + (cf gcc.c-torture/compile/990801-1.c). */
  4338. + if (GET_CODE (x) == MINUS
  4339. + && GET_CODE (XEXP (x, 0)) == LABEL_REF
  4340. + && GET_CODE (XEXP (XEXP (x, 0), 0)) == CODE_LABEL
  4341. + && INSN_DELETED_P (XEXP (XEXP (x, 0), 0)))
  4342. + return 1;
  4343. +
  4344. + output_addr_const (file, x);
  4345. + return 1;
  4346. +}
  4347. +
  4348. +/* ADD K.Watanabe V1.7 <<<<<<< */
  4349. +
  4350. +
  4351. +// ADD K.Watanabe V1.8 >>>>>>>
  4352. +static const char *
  4353. +c33_strip_name_encoding (str)
  4354. + const char *str;
  4355. +{
  4356. + return str + ENCODED_NAME_P (str);
  4357. +}
  4358. +// ADD K.Watanabe V1.8 <<<<<<<
  4359. diff --git a/gcc/config/c33/c33.h b/gcc/config/c33/c33.h
  4360. new file mode 100644
  4361. index 0000000..2a7273e
  4362. --- /dev/null
  4363. +++ b/gcc/config/c33/c33.h
  4364. @@ -0,0 +1,2347 @@
  4365. +/* Definitions of target machine for GNU compiler. EPSON C33 series
  4366. + Copyright (C) 1996, 1997 Free Software Foundation, Inc.
  4367. + Contributed by Jeff Law (law@cygnus.com).
  4368. +
  4369. +This file is part of GNU CC.
  4370. +
  4371. +GNU CC is free software; you can redistribute it and/or modify
  4372. +it under the terms of the GNU General Public License as published by
  4373. +the Free Software Foundation; either version 2, or (at your option)
  4374. +any later version.
  4375. +
  4376. +GNU CC is distributed in the hope that it will be useful,
  4377. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  4378. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  4379. +GNU General Public License for more details.
  4380. +
  4381. +You should have received a copy of the GNU General Public License
  4382. +along with GNU CC; see the file COPYING. If not, write to
  4383. +the Free Software Foundation, 59 Temple Place - Suite 330,
  4384. +Boston, MA 02111-1307, USA. */
  4385. +
  4386. +/* DEL K.Watanabe V1.7 >>>>>>> */
  4387. +/* C33: Delete the following line, because it is specified to include
  4388. + in the order of dbxelf.h / elfos.h / svr4.h / c33.h
  4389. + in gcc/config.gcc. ( reference to v850 ) */
  4390. +
  4391. +/* #include "svr4.h" *//* Automatically does #undef CPP_PREDEFINES */
  4392. +/* DEL K.Watanabe V1.7 <<<<<<< */
  4393. +
  4394. +/* ADD K.Watanabe V1.7 >>>>>>> */
  4395. +/**************************************************************/
  4396. +/* C33: Definition is necessary to correspond to C+ */
  4397. +/**************************************************************/
  4398. +/* Don't assume anything about the header files. */
  4399. +#define NO_IMPLICIT_EXTERN_C
  4400. +/* ADD K.Watanabe V1.7 <<<<<<< */
  4401. +
  4402. +
  4403. +/* ADD K.Watanabe V1.7 >>>>>>> */
  4404. +/*******************************************************************************/
  4405. +/* C33: Definition is necessary to re-define in c33.h,
  4406. + this definition was described in svr4.h in v2.95.2. */
  4407. +/*******************************************************************************/
  4408. +
  4409. +/* This is how to allocate empty space in some section. The .zero
  4410. + pseudo-op is used for this on most c33 assemblers. */
  4411. +#undef SKIP_ASM_OP
  4412. +#define SKIP_ASM_OP ".zero"
  4413. +
  4414. +#undef ASM_OUTPUT_SKIP
  4415. +#define ASM_OUTPUT_SKIP(FILE,SIZE) \
  4416. + fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE))
  4417. +
  4418. +#undef READONLY_DATA_SECTION
  4419. +#define READONLY_DATA_SECTION() const_section ()
  4420. +
  4421. +#undef ALIGN_ASM_OP
  4422. +#define ALIGN_ASM_OP ".align"
  4423. +
  4424. +
  4425. +// CHG K.Watanabe V1.8 >>>>>>>
  4426. +#if 0
  4427. +#undef ASM_OUTPUT_EXTERNAL_LIBCALL
  4428. +#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
  4429. + ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
  4430. +#endif
  4431. +
  4432. +#undef ASM_OUTPUT_EXTERNAL_LIBCALL
  4433. +#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
  4434. + do { fputs ("\t.global ", FILE); assemble_name (FILE, XSTR (FUN, 0)); fputs ("\n", FILE);} while (0)
  4435. +// CHG K.Watanabe V1.8 <<<<<<<
  4436. +
  4437. +
  4438. +// DEL K.Watanabe V1.8 >>>>>>>
  4439. +#if 0
  4440. +#define ASM_GLOBALIZE_LABEL(FILE, NAME) \
  4441. + do { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
  4442. +#endif
  4443. +// DEL K.Watanabe V1.8 <<<<<<<
  4444. +
  4445. +
  4446. +/* Define the strings used for the special c33 .type and .size directives.
  4447. + These strings generally do not vary from one system running c33 to
  4448. + another, but if a given system (e.g. m88k running svr) needs to use
  4449. + different pseudo-op names for these, they may be overridden in the
  4450. + file which includes this one. */
  4451. +
  4452. +#undef TYPE_ASM_OP
  4453. +#define TYPE_ASM_OP ".type"
  4454. +
  4455. +#undef SIZE_ASM_OP
  4456. +#define SIZE_ASM_OP ".size"
  4457. +
  4458. +/* C33: Define the following definitions in order not to create _main() function,
  4459. + though they are unused sections. */
  4460. +#undef INIT_SECTION_ASM_OP
  4461. +#define INIT_SECTION_ASM_OP ".section\t.init"
  4462. +#undef FINI_SECTION_ASM_OP
  4463. +#define FINI_SECTION_ASM_OP ".section\t.fini"
  4464. +
  4465. +
  4466. +/* ADD K.Watanabe V1.7 >>>>>>> */
  4467. +/* C33: Set #undef because the linker did not correspond to weak symbol
  4468. + at the time of releasing of GNU33 V1.7. */
  4469. +#undef ASM_WEAKEN_LABEL
  4470. +/* ADD K.Watanabe V1.7 <<<<<<< */
  4471. +
  4472. +
  4473. +/* These macros generate the special .type and .size directives which
  4474. + are used to set the corresponding fields of the linker symbol table
  4475. + entries in an ELF object file under c33. These macros also output
  4476. + the starting labels for the relevant functions/objects. */
  4477. +
  4478. +
  4479. +/* C33: If the following four definitions is used, a warning occurrs.
  4480. + Probably the linker is too old.
  4481. + ASM_DECLARE_FUNCTION_NAME -- definition of v2.95.2
  4482. + ASM_DECLARE_OBJECT_NAME -- definition of v2.95.2
  4483. + ASM_FINISH_DECLARE_OBJECT -- definition of v2.95.2
  4484. + ASM_DECLARE_FUNCTION_SIZE -- definition of of v3.3.2 in rs6000/linux64.h */
  4485. +
  4486. +/* Write the extra assembler code needed to declare a function properly.
  4487. + Some c33 assemblers need to also have something extra said about the
  4488. + function's return value. We allow for that here. */
  4489. +
  4490. +#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
  4491. + do { \
  4492. + fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
  4493. + assemble_name (FILE, NAME); \
  4494. + putc (',', FILE); \
  4495. + fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
  4496. + putc ('\n', FILE); \
  4497. + ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
  4498. + ASM_OUTPUT_LABEL(FILE, NAME); \
  4499. + } while (0)
  4500. +
  4501. +/* Write the extra assembler code needed to declare an object properly. */
  4502. +
  4503. +#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
  4504. + do { \
  4505. + fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
  4506. + assemble_name (FILE, NAME); \
  4507. + putc (',', FILE); \
  4508. + fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
  4509. + putc ('\n', FILE); \
  4510. + size_directive_output = 0; \
  4511. + if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
  4512. + { \
  4513. + size_directive_output = 1; \
  4514. + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
  4515. + assemble_name (FILE, NAME); \
  4516. + putc (',', FILE); \
  4517. + fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \
  4518. + int_size_in_bytes (TREE_TYPE (DECL))); \
  4519. + fputc ('\n', FILE); \
  4520. + } \
  4521. + ASM_OUTPUT_LABEL(FILE, NAME); \
  4522. + } while (0)
  4523. +
  4524. +/* Output the size directive for a decl in rest_of_decl_compilation
  4525. + in the case where we did not do so before the initializer.
  4526. + Once we find the error_mark_node, we know that the value of
  4527. + size_directive_output was set
  4528. + by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
  4529. +
  4530. +#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
  4531. +do { \
  4532. + char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
  4533. + if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
  4534. + && ! AT_END && TOP_LEVEL \
  4535. + && DECL_INITIAL (DECL) == error_mark_node \
  4536. + && !size_directive_output) \
  4537. + { \
  4538. + size_directive_output = 1; \
  4539. + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
  4540. + assemble_name (FILE, name); \
  4541. + putc (',', FILE); \
  4542. + fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \
  4543. + int_size_in_bytes (TREE_TYPE (DECL))); \
  4544. + fputc ('\n', FILE); \
  4545. + } \
  4546. + } while (0)
  4547. +
  4548. +/* This is how to declare the size of a function. */
  4549. +#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
  4550. + do \
  4551. + { \
  4552. + if (!flag_inhibit_size_directive) \
  4553. + { \
  4554. + fputs ("\t.size\t.", (FILE)); \
  4555. + assemble_name ((FILE), (FNAME)); \
  4556. + fputs (",.-.", (FILE)); \
  4557. + assemble_name ((FILE), (FNAME)); \
  4558. + putc ('\n', (FILE)); \
  4559. + } \
  4560. + } \
  4561. + while (0)
  4562. +
  4563. +/* ADD K.Watanabe V1.7 <<<<<<< */
  4564. +
  4565. +
  4566. +#define GCC33_VERSION "20070709R"
  4567. +
  4568. +/*************/
  4569. +/* A: Driver */
  4570. +/*************/
  4571. +#undef ASM_SPEC
  4572. +#define ASM_SPEC "%{mc33adv:-mc33adv} %{mc33pe:-mc33pe} %{medda32:-medda32} %{mc33401:-mc33401} %{mc33401_2:-mc33401_2}"
  4573. +
  4574. +#define CPP_SPEC "\
  4575. + %{mc33adv:-D__c33adv} \
  4576. + %{mc33pe:-D__c33pe} \
  4577. + %{mc33401:-D__c33401} \
  4578. + %{mc33401_2:-D__c33401_2} \
  4579. + %{!mc33401:%{!mc33401_2:%{!mc33adv:%{!mc33pe:-D__c33std}}}} \
  4580. + "
  4581. +
  4582. +#undef LIB_SPEC
  4583. +#undef ENDFILE_SPEC
  4584. +#undef LINK_SPEC
  4585. +#undef STARTFILE_SPEC
  4586. +#define LIB_SPEC ""
  4587. +#define STARTFILE_SPEC ""
  4588. +
  4589. +/**********************/
  4590. +/* B: Run-time Target */
  4591. +/**********************/
  4592. +
  4593. +/* C33: If the following line is not defined, a compile error occurrs. */
  4594. +/* Names to predefine in the preprocessor for this target machine. */
  4595. +#define CPP_PREDEFINES "-D__c33"
  4596. +
  4597. +/* Run-time compilation parameters selecting different hardware subsets. */
  4598. +
  4599. +extern int target_flags;
  4600. +
  4601. +/* Target flags bits, see below for an explanation of the bits. */
  4602. +#define MASK_LONG_CALLS 0x00000001
  4603. +#define MASK_MEMCPY 0x00000002 /* call memcpy instead of inline code*/
  4604. +#define MASK_DEBUG 0x40000000
  4605. +
  4606. +#define MASK_C33 0x00000010
  4607. +#define MASK_C33ADV 0x00000020
  4608. +#define MASK_C33PE 0x00000040
  4609. +
  4610. +#define MASK_C33401 0x00000000
  4611. +#define MASK_C33401_2 0x00000000
  4612. +
  4613. +#define MASK_ADDRESSES 0x00000100
  4614. +
  4615. +#define MASK_EXT_ZDA 0x00001000
  4616. +#define MASK_EXT_TDA 0x00002000
  4617. +#define MASK_EXT_SDA 0x00004000
  4618. +#define MASK_EXT_32 0x00008000 /* ADD K.Watanabe V1.4 */
  4619. +
  4620. +#ifndef MASK_DEFAULT
  4621. +#define MASK_DEFAULT MASK_C33
  4622. +#endif
  4623. +
  4624. +#define TARGET_C33 (target_flags & MASK_C33)
  4625. +#define TARGET_C33ADV (target_flags & MASK_C33ADV)
  4626. +#define TARGET_C33PE (target_flags & MASK_C33PE)
  4627. +
  4628. +
  4629. +/* Macros used in the machine description to test the flags. */
  4630. +
  4631. +/* C33: Distinguish function call with one ext from function call with two ext. */
  4632. +#define TARGET_LONG_CALLS (target_flags & MASK_LONG_CALLS)
  4633. +
  4634. +/* call memcpy instead of inline code */
  4635. +#define TARGET_MEMCPY (target_flags & MASK_MEMCPY)
  4636. +
  4637. +/* General debug flag */
  4638. +#define TARGET_DEBUG (target_flags & MASK_DEBUG)
  4639. +
  4640. +/* Dump recorded insn lengths into the output file. This helps debug the
  4641. + md file. */
  4642. +#define TARGET_ADDRESSES (target_flags & MASK_ADDRESSES)
  4643. +
  4644. +#define TARGET_EXT_ZDA (target_flags & MASK_EXT_ZDA)
  4645. +#define TARGET_EXT_TDA (target_flags & MASK_EXT_TDA)
  4646. +#define TARGET_EXT_SDA (target_flags & MASK_EXT_SDA)
  4647. +#define TARGET_EXT_32 (target_flags & MASK_EXT_32) /* ADD K.Watanabe V1.4 */
  4648. +
  4649. +/* Macro to define tables used to set the flags.
  4650. + This is a list in braces of pairs in braces,
  4651. + each pair being { "NAME", VALUE }
  4652. + where VALUE is the bits to set or minus the bits to clear.
  4653. + An empty string NAME is used to identify the default VALUE. */
  4654. +
  4655. +#define TARGET_SWITCHES { \
  4656. + { "long-calls", MASK_LONG_CALLS }, \
  4657. + { "no-long-calls", -MASK_LONG_CALLS }, \
  4658. + { "memcpy", MASK_MEMCPY }, \
  4659. + { "no-memcpy", -MASK_MEMCPY }, \
  4660. + { "debug", MASK_DEBUG }, \
  4661. + { "c33", MASK_C33 }, \
  4662. + { "c33adv", MASK_C33ADV }, \
  4663. + { "c33401", MASK_C33401 }, \
  4664. + { "c33401_2", MASK_C33401_2 }, \
  4665. + { "c33pe", MASK_C33PE }, \
  4666. + { "addresses", MASK_ADDRESSES }, \
  4667. + { "ezda", MASK_EXT_ZDA }, \
  4668. + { "etda", MASK_EXT_TDA }, \
  4669. + { "esda", MASK_EXT_SDA }, \
  4670. + { "edda32", MASK_EXT_32 }, \
  4671. + EXTRA_SWITCHES \
  4672. + { "", TARGET_DEFAULT}}
  4673. +
  4674. +#ifndef EXTRA_SWITCHES
  4675. +#define EXTRA_SWITCHES
  4676. +#endif
  4677. +
  4678. +#ifndef TARGET_DEFAULT
  4679. +#define TARGET_DEFAULT MASK_DEFAULT | MASK_MEMCPY
  4680. +#endif
  4681. +
  4682. +
  4683. +/* Print subsidiary information on the compiler version in use. */
  4684. +
  4685. +#ifndef TARGET_VERSION
  4686. +/* >>>>> change iruma m.takeishi '03.09.22 */
  4687. +/*
  4688. +#define TARGET_VERSION fprintf (stderr, " (EPSON C33)");
  4689. +*/
  4690. +
  4691. +/* c33 xgcc, cpp, cc1 version */
  4692. +/* if version is upped, change below version. */
  4693. +#define C33_TARGET_VERSION " (EPSON C33, rev 1.8 '07.07.09)"
  4694. +
  4695. +#define TARGET_VERSION fprintf (stderr, C33_TARGET_VERSION);
  4696. +/* <<<<< change iruma m.takeishi '03.09.22 */
  4697. +#endif
  4698. +
  4699. +/* CHG K.Watanabe V1.7 >>>>>>> */
  4700. +#if 0
  4701. +#ifndef TARGET_VERSION_INTERNAL
  4702. +#define TARGET_VERSION_INTERNAL(STREAM) \
  4703. + fprintf (STREAM, " --- gcc33v2 %s", GCC33_VERSION)
  4704. +#endif
  4705. +#endif
  4706. +
  4707. +#ifndef TARGET_VERSION_INTERNAL
  4708. +#define TARGET_VERSION_INTERNAL(STREAM) \
  4709. + fprintf (STREAM, " --- gcc33 %s", GCC33_VERSION)
  4710. +#endif
  4711. +/* CHG K.Watanabe V1.7 <<<<<<< */
  4712. +
  4713. +/* Information about the various small memory areas. */
  4714. +struct small_memory_info {
  4715. + char *name;
  4716. + char *value;
  4717. + long max;
  4718. + long physical_max;
  4719. +};
  4720. +
  4721. +enum small_memory_type {
  4722. + /* gp1 data area, using R12 as base register */
  4723. + SMALL_MEMORY_SDA = 0,
  4724. + /* gp2 data area, using R13 as base register */
  4725. + SMALL_MEMORY_TDA,
  4726. + /* gp3 data area, using R14 as base register */
  4727. + SMALL_MEMORY_ZDA,
  4728. + /* gp4 data area, using R15 as base register */
  4729. + SMALL_MEMORY_GDA,
  4730. + SMALL_MEMORY_max
  4731. +};
  4732. +
  4733. +extern struct small_memory_info small_memory[(int)SMALL_MEMORY_max];
  4734. +
  4735. +
  4736. +extern char *c33_cpu_string;
  4737. +extern char *gp_no;
  4738. +extern int gp_max;
  4739. +extern char *gdp_string;
  4740. +
  4741. +/* This macro is similar to `TARGET_SWITCHES' but defines names of
  4742. + command options that have values. Its definition is an
  4743. + initializer with a subgrouping for each command option.
  4744. +
  4745. + Each subgrouping contains a string constant, that defines the
  4746. + fixed part of the option name, and the address of a variable. The
  4747. + variable, type `char *', is set to the variable part of the given
  4748. + option if the fixed part matches. The actual option name is made
  4749. + by appending `-m' to the specified name.
  4750. +
  4751. + Here is an example which defines `-mshort-data-NUMBER'. If the
  4752. + given option is `-mshort-data-512', the variable `m88k_short_data'
  4753. + will be set to the string `"512"'.
  4754. +
  4755. + extern char *m88k_short_data;
  4756. + #define TARGET_OPTIONS \
  4757. + { { "short-data-", &m88k_short_data } } */
  4758. +
  4759. +#define TARGET_OPTIONS \
  4760. +{ \
  4761. + { "cpu=", &c33_cpu_string, "" }, \
  4762. + { "cpu-", &c33_cpu_string, "" }, \
  4763. + { "dp=", &gp_no, "" }, \
  4764. + { "dp-", &gp_no, "" }, \
  4765. + { "gda=", &small_memory[ (int)SMALL_MEMORY_GDA ].value, \
  4766. + "Set the max size of data eligible for the GDA area" }, \
  4767. + { "gda-", &small_memory[ (int)SMALL_MEMORY_GDA ].value, "" }, \
  4768. + { "gdp=", &gdp_string, "" }, \
  4769. + { "gdp-", &gdp_string, "" }, \
  4770. +}
  4771. +
  4772. +#define C33_CPU_STRING_DEFAULT "S1C332xx"
  4773. +#define C33_CPU_STRING_DEFAULT_ADVANCED "S1C334xx"
  4774. +#define C33_CPU_STRING_DEFAULT_C33PE "S1C336xx"
  4775. +
  4776. +/* Sometimes certain combinations of command options do not make
  4777. + sense on a particular target machine. You can define a macro
  4778. + `OVERRIDE_OPTIONS' to take account of this. This macro, if
  4779. + defined, is executed once just after all the command options have
  4780. + been parsed.
  4781. +
  4782. + Don't use this macro to turn on various extra optimizations for
  4783. + `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
  4784. +#define OVERRIDE_OPTIONS override_options ()
  4785. +
  4786. +
  4787. +/* Show we can debug even without a frame pointer. */
  4788. +#define CAN_DEBUG_WITHOUT_FP
  4789. +
  4790. +
  4791. +/* Some machines may desire to change what optimizations are
  4792. + performed for various optimization levels. This macro, if
  4793. + defined, is executed once just after the optimization level is
  4794. + determined and before the remainder of the command options have
  4795. + been parsed. Values set in this macro are used as the default
  4796. + values for the other command line options.
  4797. +
  4798. + LEVEL is the optimization level specified; 2 if `-O2' is
  4799. + specified, 1 if `-O' is specified, and 0 if neither is specified.
  4800. +
  4801. + You should not use this macro to change options that are not
  4802. + machine-specific. These should uniformly selected by the same
  4803. + optimization level on all supported machines. Use this macro to
  4804. + enable machine-specific optimizations.
  4805. +
  4806. + *Do not examine `write_symbols' in this macro!* The debugging
  4807. + options are not supposed to alter the generated code. */
  4808. +
  4809. +/* C33: "flag_omit_frame_pointer = 1" is default when you specify the optimize. */
  4810. +#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \
  4811. +{ \
  4812. + if (LEVEL >= 0) \
  4813. + flag_omit_frame_pointer = 1; \
  4814. + \
  4815. + /* C33: Disable the following flgas in C33, though elabled in -O2 and over. */ \
  4816. + flag_schedule_insns = 0; \
  4817. + flag_schedule_insns_after_reload = 0; \
  4818. + \
  4819. + /* C33: "-fno-common" shall be dafault in C33. GNU-GCC-050 2002/6/4 watanabe */ \
  4820. + flag_no_common = 1; \
  4821. +}
  4822. +
  4823. +/* >>>>> add iruma m.takeishi '03.09.22 */
  4824. +/* C33: Define the following line in order to work EPSON-code in gcc core files. */
  4825. +#define EPSON 1
  4826. +/* <<<<< add iruma m.takeishi '03.09.22 */
  4827. +
  4828. +
  4829. +
  4830. +
  4831. +/*********************/
  4832. +/* C: Storage Layout */
  4833. +/*********************/
  4834. +
  4835. +/* Target machine storage layout */
  4836. +
  4837. +/* Define this if most significant bit is lowest numbered
  4838. + in instructions that operate on numbered bit-fields.
  4839. + This is not true on the EPSON C33. */
  4840. +#define BITS_BIG_ENDIAN 0
  4841. +/* C33: C33 is little endian. */
  4842. +
  4843. +/* Define this if most significant byte of a word is the lowest numbered. */
  4844. +/* This is not true on the EPSON C33. */
  4845. +#define BYTES_BIG_ENDIAN 0
  4846. +
  4847. +/* Define this if most significant word of a multiword number is lowest
  4848. + numbered.
  4849. + This is not true on the EPSON C33. */
  4850. +#define WORDS_BIG_ENDIAN 0
  4851. +
  4852. +/* Number of bits in an addressable storage unit */
  4853. +#define BITS_PER_UNIT 8
  4854. +
  4855. +/* Width in bits of a "word", which is the contents of a machine register.
  4856. + Note that this is not necessarily the width of data type `int';
  4857. + if using 16-bit ints on a 68000, this would still be 32.
  4858. + But on a machine with 16-bit registers, this would be 16. */
  4859. +#define BITS_PER_WORD 32
  4860. +
  4861. +/* Width of a word, in units (bytes). */
  4862. +#define UNITS_PER_WORD 4
  4863. +
  4864. +/* Width in bits of a pointer.
  4865. + See also the macro `Pmode' defined below. */
  4866. +#define POINTER_SIZE 32
  4867. +
  4868. +/* Define this macro if it is advisable to hold scalars in registers
  4869. + in a wider mode than that declared by the program. In such cases,
  4870. + the value is constrained to be within the bounds of the declared
  4871. + type, but kept valid in the wider mode. The signedness of the
  4872. + extension may differ from that of the type.
  4873. +
  4874. + Some simple experiments have shown that leaving UNSIGNEDP alone
  4875. + generates the best overall code. */
  4876. +
  4877. +#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
  4878. + if (GET_MODE_CLASS (MODE) == MODE_INT \
  4879. + && GET_MODE_SIZE (MODE) < 4) \
  4880. + { (MODE) = SImode; }
  4881. +
  4882. +/* Allocation boundary (in *bits*) for storing arguments in argument list. */
  4883. +#define PARM_BOUNDARY 32
  4884. +
  4885. +/* The stack goes in 32 bit lumps. */
  4886. +#define STACK_BOUNDARY 32
  4887. +
  4888. +/* Allocation boundary (in *bits*) for the code of a function.
  4889. + 16 is the minimum boundary; 32 would give better performance. */
  4890. +#define FUNCTION_BOUNDARY 16
  4891. +
  4892. +/* No data type wants to be aligned rounder than this. */
  4893. +#define BIGGEST_ALIGNMENT 32
  4894. +
  4895. +/* No structure field wants to be aligned rounder than this. */
  4896. +#define BIGGEST_FIELD_ALIGNMENT 32
  4897. +
  4898. +/* Alignment of field after `int : 0' in a structure. */
  4899. +#define EMPTY_FIELD_BOUNDARY 32
  4900. +
  4901. +/* C33: The alignment of ".data" section shall be 4 byte boundary. */
  4902. +/* If defined, a C expression to compute the alignment for a static
  4903. + variable. TYPE is the data type, and ALIGN is the alignment that
  4904. + the object would ordinarily have. The value of this macro is used
  4905. + instead of that alignment to align the object.
  4906. +
  4907. + If this macro is not defined, then ALIGN is used.
  4908. +
  4909. + One use of this macro is to increase alignment of medium-size
  4910. + data to make it all fit in fewer cache lines. Another is to
  4911. + cause character arrays to be word-aligned so that `strcpy' calls
  4912. + that copy constants to character arrays can be done inline. */
  4913. +
  4914. +#undef DATA_ALIGNMENT
  4915. +#define DATA_ALIGNMENT(TYPE, ALIGN) \
  4916. + ((((ALIGN) < BITS_PER_WORD) \
  4917. + && (TREE_CODE (TYPE) == ARRAY_TYPE \
  4918. + || TREE_CODE (TYPE) == UNION_TYPE \
  4919. + || TREE_CODE (TYPE) == RECORD_TYPE)) ? BITS_PER_WORD : (ALIGN))
  4920. +
  4921. +/* C33: The alignment of ".data" section shall be 4 byte boundary. */
  4922. +/* If defined, a C expression to compute the alignment given to a
  4923. + constant that is being placed in memory. CONSTANT is the constant
  4924. + and ALIGN is the alignment that the object would ordinarily have.
  4925. + The value of this macro is used instead of that alignment to align
  4926. + the object.
  4927. +
  4928. + If this macro is not defined, then ALIGN is used.
  4929. +
  4930. + The typical use of this macro is to increase alignment for string
  4931. + constants to be word aligned so that `strcpy' calls that copy
  4932. + constants can be done inline. */
  4933. +
  4934. +#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
  4935. + ((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \
  4936. + && (ALIGN) < BITS_PER_WORD \
  4937. + ? BITS_PER_WORD \
  4938. + : (ALIGN))
  4939. +
  4940. +/* Define this if move instructions will actually fail to work
  4941. + when given unaligned data. */
  4942. +#define STRICT_ALIGNMENT 1
  4943. +
  4944. +/******************/
  4945. +/* D: Type Layout */
  4946. +/******************/
  4947. +
  4948. +/* Define this as 1 if `char' should by default be signed; else as 0.
  4949. +
  4950. + On the EPSON C33, loads do sign extension, so make this default. */
  4951. +#define DEFAULT_SIGNED_CHAR 1
  4952. +
  4953. +/* Define results of standard character escape sequences. */
  4954. +#define TARGET_BELL 007
  4955. +#define TARGET_BS 010
  4956. +#define TARGET_TAB 011
  4957. +#define TARGET_NEWLINE 012
  4958. +#define TARGET_VT 013
  4959. +#define TARGET_FF 014
  4960. +#define TARGET_CR 015
  4961. +#define TARGET_ESC 033 /* ADD K.Watanabe V1.7 */
  4962. +
  4963. +/****************/
  4964. +/* E: Registers */
  4965. +/****************/
  4966. +
  4967. +/* Standard register usage. */
  4968. +
  4969. +/* Number of actual hardware registers.
  4970. + The hardware registers are assigned numbers for the compiler
  4971. + from 0 to just below FIRST_PSEUDO_REGISTER.
  4972. +
  4973. + All registers that the compiler knows about must be given numbers,
  4974. + even those that are not normally considered general registers. */
  4975. +
  4976. +
  4977. +/* %r0-%r15, .fp, .ap, %sp */
  4978. +#define FIRST_PSEUDO_REGISTER 19
  4979. +
  4980. +/* C33: New register arrangement in C33.
  4981. + %r0-%r3 saved
  4982. + %r4-%r5 return
  4983. + %r6-%r9 argument
  4984. + %r10-%r15 fixed/gp */
  4985. +
  4986. +/* 1 for registers that have pervasive standard uses
  4987. + and are not available for the register allocator. */
  4988. +
  4989. +
  4990. +/* C33: Registers that the compiler can use. */
  4991. +#define FIXED_REGISTERS \
  4992. + { 0, 0, 0, 0, 0, 0, 0, 0, \
  4993. + 0, 0, 1, 1, 1, 1, 1, 1, \
  4994. + 1, 1, 1 }
  4995. +
  4996. +/* 1 for registers not available across function calls.
  4997. + These must include the FIXED_REGISTERS and also any
  4998. + registers that can be used without being saved.
  4999. + The latter must include the registers where values are returned
  5000. + and the register where structure-value addresses are passed.
  5001. + Aside from that, you can include as many other registers as you
  5002. + like. */
  5003. +
  5004. +
  5005. +/* C33: Registers used between function calls. */
  5006. +#define CALL_USED_REGISTERS \
  5007. + { 0, 0, 0, 0, 1, 1, 1, 1, \
  5008. + 1, 1, 1, 1, 1, 1, 1, 1, \
  5009. + 1, 1, 1 }
  5010. +
  5011. +/* C33: ADD scratch registers by "-mgp=n". */
  5012. +#define CONDITIONAL_REGISTER_USAGE \
  5013. +{ \
  5014. + int regno; \
  5015. + for (regno = 6 - gp_max; regno > 0; regno--) { \
  5016. + fixed_regs[9 + regno] = 0; \
  5017. + } \
  5018. +}
  5019. +
  5020. +/* List the order in which to allocate registers. Each register must be
  5021. + listed once, even those in FIXED_REGISTERS. */
  5022. +
  5023. +/* C33: Change the priority of register assignment.
  5024. + In order to reduce the use of "push / pop" in the normal function. */
  5025. +
  5026. +/* C33: Assign registers in the following order in C33.
  5027. + Return gegisters, saved registers, and fixed registers. */
  5028. +/* CHG K.Watanabe V1.4 >>>>>>> */
  5029. +#if 0
  5030. +#define REG_ALLOC_ORDER \
  5031. +{ \
  5032. + 4, 5, /* return registers */ \
  5033. + 6, 7, 8, 9, /* argument registers */ \
  5034. + 0, 1, 2, 3, /* saved registers */ \
  5035. + 10, 11, 12, 13, /* fixed registers */ \
  5036. + 14, 15, 16, 17, 18 /* fixed registers */ \
  5037. +}
  5038. +#endif
  5039. +
  5040. +#define REG_ALLOC_ORDER \
  5041. +{ \
  5042. + 4, 5, /* return registers */ \
  5043. + 6, 7, 8, 9, /* argument registers */ \
  5044. + 11, 12, 13, 14, /* fixed registers */ \
  5045. + 0, 1, 2, 3, /* saved registers */ \
  5046. + 10, \
  5047. + 15, 16, 17, 18 /* fixed registers */ \
  5048. +}
  5049. +/* CHG K.Watanabe V1.4 <<<<<<< */
  5050. +
  5051. +
  5052. +/* Return number of consecutive hard regs needed starting at reg REGNO
  5053. + to hold something of mode MODE.
  5054. +
  5055. + This is ordinarily the length in words of a value of mode MODE
  5056. + but can be less for certain modes in special long registers. */
  5057. +
  5058. +/* C33: The number of hard registers needed to save the MODE data. */
  5059. +#define HARD_REGNO_NREGS(REGNO, MODE) \
  5060. + ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
  5061. +
  5062. +/* Value is 1 if hard register REGNO can hold a value of machine-mode
  5063. + MODE. */
  5064. +
  5065. +/* C33: "OK" is necessary for in even number in order to
  5066. + treat multi-word type such as double type or long long type.
  5067. + %sp can hold only SI-mode. */
  5068. +
  5069. +#define HARD_REGNO_MODE_OK(REGNO, MODE) \
  5070. + ((((REGNO) == STACK_POINTER_REGNUM) \
  5071. + && (GET_MODE_SIZE (MODE) == 4)) || \
  5072. + (((REGNO) != STACK_POINTER_REGNUM) \
  5073. + && ((((REGNO) & 1) == 0) || (GET_MODE_SIZE (MODE) <= 4))))
  5074. +
  5075. +/* Value is 1 if it is a good idea to tie two pseudo registers
  5076. + when one has mode MODE1 and one has mode MODE2.
  5077. + If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
  5078. + for any hard reg, then this must be 0 for correct output. */
  5079. +
  5080. +/* C33: All registers are same in C33 and any MODE can be held.
  5081. + But the following line corresponds to V850. Just in case. */
  5082. +
  5083. +#define MODES_TIEABLE_P(MODE1, MODE2) \
  5084. + (MODE1 == MODE2 || GET_MODE_SIZE (MODE1) <= 4 && GET_MODE_SIZE (MODE2) <= 4)
  5085. +
  5086. +/* This is the order in which to allocate registers for leaf functions. */
  5087. +/* C33: Change the order of register assignment when the function is
  5088. + the interrupt function which is the leaf function.
  5089. + Because C33 can operate pushn/popn opecode only from %r0,
  5090. + so this is the avoidance measure. */
  5091. +
  5092. +
  5093. +#define REG_LEAF_ALLOC_ORDER \
  5094. +{ 0, 1, 2, 3, 4, 5, \
  5095. + 6, 7, 8, 9, 10, \
  5096. + 11, 12, 13, 14, 15, \
  5097. + 16, 17, 18 }
  5098. +
  5099. +
  5100. +// CHG K.Watanabe V1.8 >>>>>>>
  5101. +#if 0
  5102. +#define ORDER_REGS_FOR_LOCAL_ALLOC \
  5103. +{ \
  5104. + static int leaf[] = REG_LEAF_ALLOC_ORDER; \
  5105. + static int nonleaf[] = REG_ALLOC_ORDER; \
  5106. + \
  5107. + bcopy ((c33_interrupt_function_p () && leaf_function_p()) ? \
  5108. + leaf : nonleaf, \
  5109. + reg_alloc_order, FIRST_PSEUDO_REGISTER * sizeof (int)); \
  5110. +}
  5111. +#endif
  5112. +
  5113. +#define ORDER_REGS_FOR_LOCAL_ALLOC \
  5114. +{ \
  5115. + static int leaf[] = REG_LEAF_ALLOC_ORDER; \
  5116. + static int nonleaf[] = REG_ALLOC_ORDER; \
  5117. + \
  5118. + memcpy (reg_alloc_order, \
  5119. + (c33_interrupt_function_p () && leaf_function_p()) ? \
  5120. + leaf : nonleaf, \
  5121. + FIRST_PSEUDO_REGISTER * sizeof (int)); \
  5122. +}
  5123. +// CHG K.Watanabe V1.8 <<<<<<<
  5124. +
  5125. +
  5126. +/***********************/
  5127. +/* F: Register Classes */
  5128. +/***********************/
  5129. +
  5130. +/* Define the classes of registers for register constraints in the
  5131. + machine description. Also define ranges of constants.
  5132. +
  5133. + One of the classes must always be named ALL_REGS and include all hard regs.
  5134. + If there is more than one class, another class must be named NO_REGS
  5135. + and contain no registers.
  5136. +
  5137. + The name GENERAL_REGS must be the name of a class (or an alias for
  5138. + another name such as ALL_REGS). This is the class of registers
  5139. + that is allowed by "g" or "r" in a register constraint.
  5140. + Also, registers outside this class are allocated only when
  5141. + instructions express preferences for them.
  5142. +
  5143. + The classes must be numbered in nondecreasing order; that is,
  5144. + a larger-numbered class must never be contained completely
  5145. + in a smaller-numbered class.
  5146. +
  5147. + For any two classes, it is very desirable that there be another
  5148. + class that represents their union. */
  5149. +
  5150. +enum reg_class {
  5151. + NO_REGS, GENERAL_REGS, SP_REGS, BASE_REGS, ALL_REGS, LIM_REG_CLASSES
  5152. +};
  5153. +
  5154. +#define N_REG_CLASSES (int) LIM_REG_CLASSES
  5155. +
  5156. +/* Give names of register classes as strings for dump file. */
  5157. +
  5158. +#define REG_CLASS_NAMES \
  5159. +{ "NO_REGS", "GENERAL_REGS", "SP_REGS", "BASE_REGS", "ALL_REGS", "LIM_REGS" }
  5160. +
  5161. +/* Define which registers fit in which classes.
  5162. + This is an initializer for a vector of HARD_REG_SET
  5163. + of length N_REG_CLASSES. */
  5164. +
  5165. +#define REG_CLASS_CONTENTS \
  5166. +{ 0x00000000, /* No regs */ \
  5167. + 0x0003ffff, /* GENERAL_REGS */ \
  5168. + 0x00040000, /* SP_REGS */ \
  5169. + 0x0007ffff, /* BASE_REGS */ \
  5170. + 0xffffffff, /* ALL_REGS */ \
  5171. +}
  5172. +
  5173. +/* The same information, inverted:
  5174. + Return the class number of the smallest class containing
  5175. + reg number REGNO. This could be a conditional expression
  5176. + or could index an array. */
  5177. +
  5178. +#define REGNO_REG_CLASS(REGNO) \
  5179. + ((REGNO) == STACK_POINTER_REGNUM ? SP_REGS : GENERAL_REGS)
  5180. +
  5181. +/* The class value for index registers, and the one for base regs. */
  5182. +
  5183. +#define INDEX_REG_CLASS NO_REGS
  5184. +#define BASE_REG_CLASS BASE_REGS
  5185. +
  5186. +/* Get reg_class from a letter such as appears in the machine description. */
  5187. +#define REG_CLASS_FROM_LETTER(C) ((C) == 'f' ? SP_REGS : NO_REGS)
  5188. +
  5189. +/* Macros to check register numbers against specific register classes. */
  5190. +
  5191. +/* These assume that REGNO is a hard or pseudo reg number.
  5192. + They give nonzero only if REGNO is a hard reg of the suitable class
  5193. + or a pseudo reg currently allocated to a suitable hard reg.
  5194. + Since they use reg_renumber, they are safe only once reg_renumber
  5195. + has been allocated, which happens in local-alloc.c. */
  5196. +
  5197. +#define REGNO_OK_FOR_BASE_P(regno) \
  5198. + ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
  5199. +
  5200. +#define REGNO_OK_FOR_INDEX_P(regno) 0
  5201. +
  5202. +/* Given an rtx X being reloaded into a reg required to be
  5203. + in class CLASS, return the class of reg to actually use.
  5204. + In general this is just CLASS; but on some machines
  5205. + in some cases it is preferable to use a more restrictive class. */
  5206. +
  5207. +#define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
  5208. +
  5209. +/* Return the maximum number of consecutive registers
  5210. + needed to represent mode MODE in a register of class CLASS. */
  5211. +
  5212. +#define CLASS_MAX_NREGS(CLASS, MODE) \
  5213. + ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
  5214. +
  5215. +/* The letters I, J, K, L, M, N, O, P in a register constraint string
  5216. + can be used to stand for particular ranges of immediate operands.
  5217. + This macro defines what the ranges are.
  5218. + C is the letter, and VALUE is a constant value.
  5219. + Return 1 if VALUE is in the range specified by C. */
  5220. +
  5221. +/* C33: Characters are assigned in C33 as follows.
  5222. + I: unused
  5223. + J: unused
  5224. + K: sign6 ld,add/sub,cmp,and/or/xor
  5225. + L: sign19 ld,add/sub,cmp,and/or/xor
  5226. + M: shift immediate data
  5227. + N: shift immediate data
  5228. + O: shift immediate data
  5229. + P: unused
  5230. +*/
  5231. +
  5232. +#define CONST_OK_FOR_SIGNED6(VALUE) ((unsigned) (VALUE) + 0x20 < 0x40)
  5233. +#define CONST_OK_FOR_SIGNED9(VALUE) ((unsigned) (VALUE) + 0x100 < 0x200)
  5234. +#define CONST_OK_FOR_SIGNED19(VALUE) ((unsigned) (VALUE) + 0x40000 < 0x80000)
  5235. +
  5236. +#define CONST_OK_FOR_IMM6(VALUE) ((unsigned)(VALUE) < 0x40)
  5237. +#define CONST_OK_FOR_IMM7(VALUE) ((unsigned)(VALUE) < 0x80)
  5238. +#define CONST_OK_FOR_IMM8(VALUE) ((unsigned)(VALUE) < 0x100)
  5239. +#define CONST_OK_FOR_IMM13(VALUE) ((unsigned)(VALUE) < 0x2000)
  5240. +#define CONST_OK_FOR_IMM19(VALUE) ((unsigned)(VALUE) < 0x80000)
  5241. +#define CONST_OK_FOR_IMM26(VALUE) ((unsigned)(VALUE) < 0x4000000)
  5242. +
  5243. +#define CONST_OK_FOR_M(VALUE) ((unsigned)(VALUE) <= 8)
  5244. +#define CONST_OK_FOR_N(VALUE) ((unsigned)(VALUE) <= 16)
  5245. +#define CONST_OK_FOR_O(VALUE) ((unsigned)(VALUE) <= 24)
  5246. +#define CONST_OK_FOR_P(VALUE) ((unsigned)(VALUE) <= 26) /* GNU-GCC-031 2001/12/27 watanabe */
  5247. +
  5248. +#define CONST_OK_FOR_LETTER_P(VALUE, C) \
  5249. + ((C) == 'I' ? 0 : \
  5250. + (C) == 'J' ? 0 : \
  5251. + (C) == 'K' ? CONST_OK_FOR_SIGNED6(VALUE) : \
  5252. + (C) == 'L' ? CONST_OK_FOR_SIGNED19(VALUE) : \
  5253. + (C) == 'M' ? CONST_OK_FOR_M(VALUE) : \
  5254. + (C) == 'N' ? CONST_OK_FOR_N(VALUE) : \
  5255. + (C) == 'O' ? CONST_OK_FOR_O(VALUE) : \
  5256. + (C) == 'P' ? CONST_OK_FOR_P(VALUE) : \
  5257. + 0)
  5258. +
  5259. +/* C33: If the following lines are not defined, the link error occurs. */
  5260. +/* Similar, but for floating constants, and defining letters G and H.
  5261. + Here VALUE is the CONST_DOUBLE rtx itself.
  5262. +
  5263. + `G' is a zero of some form. */
  5264. +
  5265. +/* C33: Define character 'G' for floating-point numbers.
  5266. + 'G' is '0'. Correspond to H8300. */
  5267. +
  5268. +#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
  5269. + ((C) == 'G' ? (VALUE) == CONST0_RTX(DFmode) \
  5270. + : 0)
  5271. +
  5272. +/* A C expression that defines the optional machine-dependent
  5273. + constraint letters that can be used to segregate specific types of
  5274. + operands, usually memory references, for the target machine.
  5275. + Normally this macro will not be defined. If it is required for a
  5276. + particular target machine, it should return 1 if VALUE corresponds
  5277. + to the operand type represented by the constraint letter C. If C
  5278. + is not defined as an extra constraint, the value returned should
  5279. + be 0 regardless of VALUE.
  5280. +
  5281. + For example, on the ROMP, load instructions cannot have their
  5282. + output in r0 if the memory reference contains a symbolic address.
  5283. + Constraint letter `Q' is defined as representing a memory address
  5284. + that does *not* contain a symbolic address. An alternative is
  5285. + specified with a `Q' constraint on the input and `r' on the
  5286. + output. The next alternative specifies `m' on the input and a
  5287. + register class that does not include r0 on the output. */
  5288. +
  5289. +#define EXTRA_CONSTRAINT(OP, C) \
  5290. + ((C) == 'Q' ? 0 \
  5291. + : (C) == 'R' ? 0 \
  5292. + : (C) == 'S' ? (GET_CODE (OP) == SYMBOL_REF) \
  5293. + : (C) == 'T' ? 0 \
  5294. + : (C) == 'U' ? 0 \
  5295. + : 0)
  5296. +
  5297. +/************************/
  5298. +/* G: Stack and Calling */
  5299. +/************************/
  5300. +
  5301. +/* G-1: Basic Stack Layout */
  5302. +
  5303. +/* Stack layout; function entry, exit and calling. */
  5304. +
  5305. +/* Define this if pushing a word on the stack
  5306. + makes the stack pointer a smaller address. */
  5307. +
  5308. +#define STACK_GROWS_DOWNWARD
  5309. +
  5310. +/* Define this if the nominal address of the stack frame
  5311. + is at the high-address end of the local variables;
  5312. + that is, each additional local variable allocated
  5313. + goes at a more negative offset in the frame. */
  5314. +/* C33: The frame pointer is used as plus offset in C33. */
  5315. +
  5316. +/* #define FRAME_GROWS_DOWNWARD */
  5317. +/* #define ARGS_GROWS_DOWNWARD */
  5318. +
  5319. +/* Offset within stack frame to start allocating local variables at.
  5320. + If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
  5321. + first local allocated. Otherwise, it is the offset to the BEGINNING
  5322. + of the first local allocated. */
  5323. +
  5324. +/* C33: %fp and %sp shall be in common in C33.
  5325. + Allocate the space for arguments of called function. */
  5326. +
  5327. +#define STARTING_FRAME_OFFSET (current_function_outgoing_args_size)
  5328. +
  5329. +/* Offset of first parameter from the argument pointer register value. */
  5330. +/* Is equal to the size of the saved fp + pc, even if an fp isn't
  5331. + saved since the value is used before we know. */
  5332. +
  5333. +#define FIRST_PARM_OFFSET(FNDECL) 0
  5334. +
  5335. +/* G-2: Specifying How Stack Checking is Done */
  5336. +
  5337. +
  5338. +/* G-3: Registers That Address the Stack Frame */
  5339. +
  5340. +/* Specify the registers used for certain standard purposes.
  5341. + The values of these macros are register numbers. */
  5342. +
  5343. +/* Register to use for pushing function arguments. */
  5344. +#define STACK_POINTER_REGNUM 18
  5345. +
  5346. +/* Base register for access to local variables of the function. */
  5347. +/* CHG K.Watanabe V1.7 >>>>>>> */
  5348. +#if 0
  5349. +/* C33: The following definition shall be the temporary register.
  5350. + It will be useless if it is assigned as saved register. */
  5351. +
  5352. +#define FRAME_POINTER_REGNUM 16
  5353. +#endif
  5354. +
  5355. +#define FRAME_POINTER_REGNUM 0
  5356. +/* CHG K.Watanabe V1.7 <<<<<<< */
  5357. +
  5358. +
  5359. +/* Base register for access to arguments of the function. */
  5360. +/* C33: Make the temporary register. */
  5361. +#define ARG_POINTER_REGNUM 17
  5362. +
  5363. +/* Register in which static-chain is passed to a function. */
  5364. +/* >>>>> change iruma m.takeishi '04.04.01 */
  5365. +/* C33: The following line is corrected,
  5366. + because forcibly terminated was occurred
  5367. + when the function was declared in the function,
  5368. +
  5369. + *
  5370. + * int main() {
  5371. + * int sub () {};
  5372. + * }
  5373. + */
  5374. +/* #define STATIC_CHAIN_REGNUM 9 */
  5375. +
  5376. +#define STATIC_CHAIN_REGNUM 9
  5377. +/* <<<<< change iruma m.takeishi '04.04.01 */
  5378. +
  5379. +/* G-4: Eliminating Frame Pointer and Arg Pointer */
  5380. +
  5381. +/* Value should be nonzero if functions must have frame pointers.
  5382. + Zero means the frame pointer need not be set up (and parms
  5383. + may be accessed via the stack pointer) in functions that seem suitable.
  5384. + This is computed in `reload', in reload1.c. */
  5385. +#define FRAME_POINTER_REQUIRED 0
  5386. +
  5387. +/* If defined, this macro specifies a table of register pairs used to
  5388. + eliminate unneeded registers that point into the stack frame. If
  5389. + it is not defined, the only elimination attempted by the compiler
  5390. + is to replace references to the frame pointer with references to
  5391. + the stack pointer.
  5392. +
  5393. + The definition of this macro is a list of structure
  5394. + initializations, each of which specifies an original and
  5395. + replacement register.
  5396. +
  5397. + On some machines, the position of the argument pointer is not
  5398. + known until the compilation is completed. In such a case, a
  5399. + separate hard register must be used for the argument pointer.
  5400. + This register can be eliminated by replacing it with either the
  5401. + frame pointer or the argument pointer, depending on whether or not
  5402. + the frame pointer has been eliminated.
  5403. +
  5404. + In this case, you might specify:
  5405. + #define ELIMINABLE_REGS \
  5406. + {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
  5407. + {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
  5408. + {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
  5409. +
  5410. + Note that the elimination of the argument pointer with the stack
  5411. + pointer is specified first since that is the preferred elimination. */
  5412. +
  5413. +#define ELIMINABLE_REGS \
  5414. + {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
  5415. + {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
  5416. + {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
  5417. +
  5418. +/* A C expression that returns non-zero if the compiler is allowed to
  5419. + try to replace register number FROM-REG with register number
  5420. + TO-REG. This macro need only be defined if `ELIMINABLE_REGS' is
  5421. + defined, and will usually be the constant 1, since most of the
  5422. + cases preventing register elimination are things that the compiler
  5423. + already knows about. */
  5424. +
  5425. +#define CAN_ELIMINATE(FROM, TO) 1
  5426. +
  5427. +/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
  5428. + specifies the initial difference between the specified pair of
  5429. + registers. This macro must be defined if `ELIMINABLE_REGS' is
  5430. + defined. */
  5431. +
  5432. +#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
  5433. +{ \
  5434. + if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
  5435. + (OFFSET) = 0; \
  5436. + else if ((FROM) == ARG_POINTER_REGNUM) \
  5437. + (OFFSET) = compute_frame_size (get_frame_size (), (long *)0); \
  5438. + else { \
  5439. + abort (); \
  5440. + } \
  5441. +}
  5442. +
  5443. +/* G-5: Passing Function Arguments on the Stack */
  5444. +
  5445. +/* A guess for the C33. */
  5446. +/* CHG K.Watanabe V1.7 >>>>>>> */
  5447. +/* #define PROMOTE_PROTOTYPES */
  5448. +#define PROMOTE_PROTOTYPES 1
  5449. +/* CHG K.Watanabe V1.7 <<<<<<< */
  5450. +
  5451. +/* Keep the stack pointer constant throughout the function. */
  5452. +
  5453. +/* CHG K.Watanabe V1.7 >>>>>>> */
  5454. +/* #define ACCUMULATE_OUTGOING_ARGS */
  5455. +#define ACCUMULATE_OUTGOING_ARGS 1
  5456. +/* CHG K.Watanabe V1.7 <<<<<<< */
  5457. +
  5458. +/* When a parameter is passed in a register, stack space is still
  5459. + allocated for it. */
  5460. +/* C33: When a parameter is passed through the register,
  5461. + stack space is not allocated for it in C33. */
  5462. +#define REG_PARM_STACK_SPACE(DECL) (0)
  5463. +
  5464. +
  5465. +/* Value is the number of bytes of arguments automatically
  5466. + popped when returning from a subroutine call.
  5467. + FUNDECL is the declaration node of the function (as a tree),
  5468. + FUNTYPE is the data type of the function (as a tree),
  5469. + or for a library call it is an identifier node for the subroutine name.
  5470. + SIZE is the number of bytes of arguments passed on the stack. */
  5471. +
  5472. +#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
  5473. +
  5474. +/* G-6: Passing Arguments in Registers */
  5475. +
  5476. +/* Define where to put the arguments to a function.
  5477. + Value is zero to push the argument on the stack,
  5478. + or a hard register in which to store the argument.
  5479. +
  5480. + MODE is the argument's machine mode.
  5481. + TYPE is the data type of the argument (as a tree).
  5482. + This is null for libcalls where that information may
  5483. + not be available.
  5484. + CUM is a variable of type CUMULATIVE_ARGS which gives info about
  5485. + the preceding args and about the function being called.
  5486. + NAMED is nonzero if this argument is a named parameter
  5487. + (otherwise it is an extra parameter matching an ellipsis). */
  5488. +
  5489. +struct rtx_def *function_arg();
  5490. +#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
  5491. + function_arg (&CUM, MODE, TYPE, NAMED)
  5492. +
  5493. +/* C33: Do not define the following line according to MIPS. */
  5494. +
  5495. +/* Define a data type for recording info about an argument list
  5496. + during the scan of that argument list. This data type should
  5497. + hold all necessary information about the function itself
  5498. + and about the args processed so far, enough to enable macros
  5499. + such as FUNCTION_ARG to determine where the next arg should go. */
  5500. +
  5501. +#define CUMULATIVE_ARGS struct cum_arg
  5502. +struct cum_arg { int nbytes; };
  5503. +
  5504. +/* Initialize a variable CUM of type CUMULATIVE_ARGS
  5505. + for a call to a function whose data type is FNTYPE.
  5506. + For a library call, FNTYPE is 0. */
  5507. +
  5508. +#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
  5509. + ((CUM).nbytes = 0)
  5510. +
  5511. +/* Update the data in CUM to advance over an argument
  5512. + of mode MODE and data type TYPE.
  5513. + (TYPE is null for libcalls where that information may not be available.) */
  5514. +
  5515. +/* C33: The structure are passed through the stack.
  5516. + Do not add in the case that the parameter is passed in DFmode
  5517. + because registers are not used in this type. */
  5518. +#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
  5519. + ((CUM).nbytes += ((MODE) == BLKmode \
  5520. + ? 0 \
  5521. + : ((MODE) == DFmode \
  5522. + ? (((CUM).nbytes < ((4-1) * UNITS_PER_WORD)) \
  5523. + ? ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD) \
  5524. + : 0) \
  5525. + : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD)))
  5526. +
  5527. +
  5528. +/* 1 if N is a possible register number for function argument passing. */
  5529. +
  5530. +#define FUNCTION_ARG_REGNO_P(N) (N >= 6 && N <= 9)
  5531. +
  5532. +/* G-7: How Scalar Function Values Are Returned */
  5533. +
  5534. +/* Define how to find the value returned by a function.
  5535. + VALTYPE is the data type of the value (as a tree).
  5536. + If the precise function being called is known, FUNC is its FUNCTION_DECL;
  5537. + otherwise, FUNC is 0. */
  5538. +
  5539. +#define FUNCTION_VALUE(VALTYPE, FUNC) \
  5540. + gen_rtx (REG, TYPE_MODE (VALTYPE), 4)
  5541. +
  5542. +/* C33: If the following lines are not defined, the link error occurs. */
  5543. +/* Define how to find the value returned by a library function
  5544. + assuming the value has mode MODE. */
  5545. +
  5546. +#define LIBCALL_VALUE(MODE) \
  5547. + gen_rtx (REG, MODE, 4)
  5548. +
  5549. +/* 1 if N is a possible register number for a function value. */
  5550. +
  5551. +#define FUNCTION_VALUE_REGNO_P(N) ((N) == 4)
  5552. +
  5553. +
  5554. +/* G-8: How Large Values Are Returned */
  5555. +
  5556. +/* C33: Define "DEFAULT_PCC_STRUCT_RETURN" as 0,
  5557. + or the principle of the structure / the union does not obey
  5558. + the "RETURN_IN_MEMORY". */
  5559. +
  5560. +
  5561. +/* Return values > 8 bytes in length in memory. */
  5562. +#define DEFAULT_PCC_STRUCT_RETURN 0
  5563. +
  5564. +/* C33: Though define RETURN_IN_MEMORY as (TYPE_MODE (TYPE) == BLKmode) in MIPS,
  5565. + shall the structure / the union be BLKmode?
  5566. + mn(980903) BLKmode may be string. */
  5567. +
  5568. +#define RETURN_IN_MEMORY(TYPE) \
  5569. + (int_size_in_bytes (TYPE) > 8 || TYPE_MODE (TYPE) == BLKmode)
  5570. +
  5571. +/* Register in which address to store a structure value
  5572. + is passed to a function. On the C33 it's passed as
  5573. + the first parameter. */
  5574. +
  5575. +#define STRUCT_VALUE 0
  5576. +
  5577. +
  5578. +/* G-9: Caller-Saves Register Allocation */
  5579. +
  5580. +
  5581. +/* G-10: Function Entry and Exit */
  5582. +
  5583. +/* DEL K.Watanabe V1.7 >>>>>>> */
  5584. +/* C33: Unused. Define the following contents in TARGET_ASM_FUNCTION_PROLOGUE. */
  5585. +
  5586. +
  5587. +/* C33: Define function prologue. */
  5588. +/* #define FUNCTION_PROLOGUE(FILE, SIZE) expand_prologue(file); */
  5589. +/* DEL K.Watanabe V1.7 <<<<<<< */
  5590. +
  5591. +/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
  5592. + the stack pointer does not matter. The value is tested only in
  5593. + functions that have frame pointers.
  5594. + No definition is equivalent to always zero. */
  5595. +
  5596. +#define EXIT_IGNORE_STACK 0
  5597. +
  5598. +/* DEL K.Watanabe V1.7 >>>>>>> */
  5599. +/* C33: Unused. Define the following contents in TARGET_ASM_FUNCTION_EPILOGUE */
  5600. +
  5601. +/* C33: Define function epilogue. */
  5602. +/* #define FUNCTION_EPILOGUE(FILE, SIZE) expand_epilogue(file); */
  5603. +/* DEL K.Watanabe V1.7 <<<<<<< */
  5604. +
  5605. +/* G-11: Generating Code for Profiling */
  5606. +
  5607. +/* C33: If the following line is not defined, the link error occurs. */
  5608. +/* Output assembler code to FILE to increment profiler label # LABELNO
  5609. + for profiling a function entry. */
  5610. +#define FUNCTION_PROFILER(FILE, LABELNO) ;
  5611. +
  5612. +/**************/
  5613. +/* H: Varargs */
  5614. +/**************/
  5615. +
  5616. +
  5617. +
  5618. +/******************/
  5619. +/* I: Trampolines */
  5620. +/******************/
  5621. +
  5622. +/* Length in units of the trampoline for entering a nested function. */
  5623. +/* C33: Set 0 to length, because we don't define TRAMPOLINE_TEMPLATE */
  5624. +#define TRAMPOLINE_SIZE 0
  5625. +
  5626. +/* C33: If the following line is not defined, the link error occurs. */
  5627. +#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) ;
  5628. +
  5629. +
  5630. +/********************/
  5631. +/* J: Library Calls */
  5632. +/********************/
  5633. +
  5634. +#define TARGET_MEM_FUNCTIONS
  5635. +
  5636. +/***********************/
  5637. +/* K: Addressing Modes */
  5638. +/***********************/
  5639. +
  5640. +/* Addressing modes, and classification of registers for them. */
  5641. +
  5642. +#define HAVE_POST_INCREMENT 1
  5643. +
  5644. +/* 1 if X is an rtx for a constant that is a valid address. */
  5645. +
  5646. +/* ??? This seems too exclusive. May get better code by accepting more
  5647. + possibilities here, in particular, should accept ZDA_NAME SYMBOL_REFs. */
  5648. +
  5649. +#define CONSTANT_ADDRESS_P(X) \
  5650. + (GET_CODE (X) == CONST_INT \
  5651. + && CONST_OK_FOR_IMM26 (INTVAL (X))) /* unsigned 26bit */
  5652. +
  5653. +/* Maximum number of registers that can appear in a valid memory address. */
  5654. +
  5655. +#define MAX_REGS_PER_ADDRESS 1
  5656. +
  5657. +/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
  5658. + and check its validity for a certain class.
  5659. + We have two alternate definitions for each of them.
  5660. + The usual definition accepts all pseudo regs; the other rejects
  5661. + them unless they have been allocated suitable hard regs.
  5662. + The symbol REG_OK_STRICT causes the latter definition to be used.
  5663. +
  5664. + Most source files want to accept pseudo regs in the hope that
  5665. + they will get allocated to the class that the insn wants them to be in.
  5666. + Source files for reload pass need to be strict.
  5667. + After reload, it makes no difference, since pseudo regs have
  5668. + been eliminated by then. */
  5669. +
  5670. +#ifndef REG_OK_STRICT
  5671. +
  5672. +/* Nonzero if X is a hard reg that can be used as an index
  5673. + or if it is a pseudo reg. */
  5674. +#define REG_OK_FOR_INDEX_P(X) 0
  5675. +/* Nonzero if X is a hard reg that can be used as a base reg
  5676. + or if it is a pseudo reg. */
  5677. +#define REG_OK_FOR_BASE_P(X) 1
  5678. +#define REG_OK_FOR_INDEX_P_STRICT(X) 0
  5679. +#define REG_OK_FOR_BASE_P_STRICT(X) REGNO_OK_FOR_BASE_P (REGNO (X))
  5680. +#define STRICT 0
  5681. +
  5682. +#else
  5683. +
  5684. +/* Nonzero if X is a hard reg that can be used as an index. */
  5685. +#define REG_OK_FOR_INDEX_P(X) 0
  5686. +/* Nonzero if X is a hard reg that can be used as a base reg. */
  5687. +#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
  5688. +#define STRICT 1
  5689. +
  5690. +#endif
  5691. +
  5692. +/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
  5693. + that is a valid memory address for an instruction.
  5694. + The MODE argument is the machine mode for the MEM expression
  5695. + that wants to use this address.
  5696. +
  5697. + The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
  5698. + except for CONSTANT_ADDRESS_P which is actually
  5699. + machine-independent. */
  5700. +
  5701. +/* Accept either REG or SUBREG where a register is valid. */
  5702. +
  5703. +
  5704. +//#define RTX_OK_FOR_BASE_P(X) (REG_P (X) && REG_OK_FOR_BASE_P (X))
  5705. +#define RTX_OK_FOR_BASE_P(X) \
  5706. + ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \
  5707. + || (GET_CODE (X) == SUBREG && REG_P (SUBREG_REG (X)) \
  5708. + && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
  5709. +
  5710. +/* CHG K.Watanabe V1.7 >>>>>>> */
  5711. +/* C33: Reflect the option of "-medda32" in the following definition.
  5712. + When the option is "-medda32 && !adv",
  5713. + forbid the access of symbols which use the data pointer. */
  5714. +#if 0
  5715. +#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
  5716. +do { \
  5717. + if (RTX_OK_FOR_BASE_P (X)) goto ADDR; \
  5718. + if (GET_CODE (X) == SYMBOL_REF \
  5719. + && (GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode))) \
  5720. + goto ADDR; \
  5721. + if (GET_CODE (X) == CONST \
  5722. + && (GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode))) \
  5723. + goto ADDR; \
  5724. + if (GET_CODE (X) == PLUS \
  5725. + && CONSTANT_ADDRESS_P (XEXP (X, 1)) \
  5726. + && ((MODE == QImode) \
  5727. + || ((MODE == HImode) && (INTVAL (XEXP(X, 1)) % 2 == 0)) \
  5728. + || ((MODE == SImode) && (INTVAL (XEXP(X, 1)) % 4 == 0)) \
  5729. + || ((MODE == DImode) && (INTVAL (XEXP(X, 1)) % 4 == 0)) \
  5730. + || ((MODE == SFmode) && (INTVAL (XEXP(X, 1)) % 4 == 0)) \
  5731. + || ((MODE == DFmode) && (INTVAL (XEXP(X, 1)) % 4 == 0))) \
  5732. + && RTX_OK_FOR_BASE_P (XEXP (X, 0))) goto ADDR; \
  5733. +} while (0)
  5734. +#endif
  5735. +
  5736. +#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
  5737. +do { \
  5738. + if (RTX_OK_FOR_BASE_P (X)) goto ADDR; \
  5739. + if (GET_CODE (X) == SYMBOL_REF \
  5740. + && (GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode)) \
  5741. + && ( !TARGET_EXT_32 || TARGET_C33ADV || ENCODED_NAME_P( XSTR(X, 0) ) ) ) \
  5742. + goto ADDR; \
  5743. + if (GET_CODE (X) == CONST \
  5744. + && (GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode)) \
  5745. + && ( !TARGET_EXT_32 || TARGET_C33ADV || ENCODED_NAME_P( XSTR(XEXP(XEXP(X, 0),0),0) ) ) ) \
  5746. + goto ADDR; \
  5747. + if (GET_CODE (X) == PLUS \
  5748. + && CONSTANT_ADDRESS_P (XEXP (X, 1)) \
  5749. + && ((MODE == QImode) \
  5750. + || ((MODE == HImode) && (INTVAL (XEXP(X, 1)) % 2 == 0)) \
  5751. + || ((MODE == SImode) && (INTVAL (XEXP(X, 1)) % 4 == 0)) \
  5752. + || ((MODE == DImode) && (INTVAL (XEXP(X, 1)) % 4 == 0)) \
  5753. + || ((MODE == SFmode) && (INTVAL (XEXP(X, 1)) % 4 == 0)) \
  5754. + || ((MODE == DFmode) && (INTVAL (XEXP(X, 1)) % 4 == 0))) \
  5755. + && RTX_OK_FOR_BASE_P (XEXP (X, 0))) goto ADDR; \
  5756. +} while (0)
  5757. +/* CHG K.Watanabe V1.7 <<<<<<< */
  5758. +
  5759. +/* Try machine-dependent ways of modifying an illegitimate address
  5760. + to be legitimate. If we find one, return the new, valid address.
  5761. + This macro is used in only one place: `memory_address' in explow.c.
  5762. +
  5763. + OLDX is the address as it was before break_out_memory_refs was called.
  5764. + In some cases it is useful to look at this to decide what needs to be done.
  5765. +
  5766. + MODE and WIN are passed so that this macro can use
  5767. + GO_IF_LEGITIMATE_ADDRESS.
  5768. +
  5769. + It is always safe for this macro to do nothing. It exists to recognize
  5770. + opportunities to optimize the output. */
  5771. +
  5772. +#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
  5773. +
  5774. +/* Go to LABEL if ADDR (a legitimate address expression)
  5775. + has an effect that depends on the machine mode it is used for. */
  5776. +
  5777. +#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
  5778. +
  5779. +/* Nonzero if the constant value X is a legitimate general operand.
  5780. + It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
  5781. +#define LEGITIMATE_CONSTANT_P(X) \
  5782. + (GET_CODE (X) == CONST_DOUBLE \
  5783. + || flag_pic \
  5784. + || !(GET_CODE (X) == CONST \
  5785. + && GET_CODE (XEXP (X, 0)) == PLUS \
  5786. + && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF \
  5787. + && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
  5788. + && ! CONST_OK_FOR_IMM26 (INTVAL (XEXP (XEXP (X, 0), 1)))))
  5789. +
  5790. +/*********************/
  5791. +/* L: Condition Code */
  5792. +/*********************/
  5793. +
  5794. +/* Tell final.c how to eliminate redundant test instructions. */
  5795. +
  5796. +/* Here we define machine-dependent flags and fields in cc_status
  5797. + (see `conditions.h'). No extra ones are needed for the vax. */
  5798. +
  5799. +/* Store in cc_status the expressions
  5800. + that the condition codes will describe
  5801. + after execution of an instruction whose pattern is EXP.
  5802. + Do not alter them if the instruction would not alter the cc's. */
  5803. +
  5804. +#define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
  5805. +
  5806. +
  5807. +/************/
  5808. +/* M: Costs */
  5809. +/************/
  5810. +
  5811. +/* A part of a C `switch' statement that describes the relative costs
  5812. + of constant RTL expressions. It must contain `case' labels for
  5813. + expression codes `const_int', `const', `symbol_ref', `label_ref'
  5814. + and `const_double'. Each case must ultimately reach a `return'
  5815. + statement to return the relative cost of the use of that kind of
  5816. + constant value in an expression. The cost may depend on the
  5817. + precise value of the constant, which is available for examination
  5818. + in X, and the rtx code of the expression in which it is contained,
  5819. + found in OUTER_CODE.
  5820. +
  5821. + CODE is the expression code--redundant, since it can be obtained
  5822. + with `GET_CODE (X)'. */
  5823. +
  5824. +#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
  5825. + case CONST_INT: \
  5826. + case CONST_DOUBLE: \
  5827. + case CONST: \
  5828. + case SYMBOL_REF: \
  5829. + case LABEL_REF: \
  5830. + { \
  5831. + int _zxy = const_costs(RTX, CODE); \
  5832. + return (_zxy) ? COSTS_N_INSNS (_zxy) : 0; \
  5833. + }
  5834. +
  5835. +/* C33: According to V850 for now. */
  5836. +/* A crude cut at RTX_COSTS for the V850. */
  5837. +
  5838. +/* Provide the costs of a rtl expression. This is in the body of a
  5839. + switch on CODE.
  5840. +
  5841. + There aren't DImode MOD, DIV or MULT operations, so call them
  5842. + very expensive. Everything else is pretty much a constant cost. */
  5843. +
  5844. +#define RTX_COSTS(RTX,CODE,OUTER_CODE) \
  5845. + case ASHIFT: /* C33 */ \
  5846. + case ASHIFTRT: /* C33 */ \
  5847. + case LSHIFTRT: /* C33 */ \
  5848. + { \
  5849. + rtx stRtxOpt1 = XEXP (RTX, 1); \
  5850. + \
  5851. + if (GET_CODE (stRtxOpt1) == CONST_INT) { \
  5852. + \
  5853. + if (INTVAL(stRtxOpt1) <= 8) \
  5854. + return COSTS_N_INSNS(1); \
  5855. + \
  5856. + if (INTVAL(stRtxOpt1) <= 16) \
  5857. + return COSTS_N_INSNS(2); \
  5858. + \
  5859. + if (INTVAL(stRtxOpt1) <= 24) \
  5860. + return COSTS_N_INSNS(3); \
  5861. + \
  5862. + return COSTS_N_INSNS(4); \
  5863. + } \
  5864. + \
  5865. + return COSTS_N_INSNS(8); \
  5866. + } \
  5867. + \
  5868. + case MOD: \
  5869. + case DIV: \
  5870. + return 60; \
  5871. + case MULT: \
  5872. + return 20;
  5873. +
  5874. +
  5875. +
  5876. +
  5877. +
  5878. +/*#define ADDRESS_COST(ADDR) c33_address_cost (ADDR) */
  5879. +/* C33: If the following line is not defined,
  5880. + the reference of SYMBOL_REF of the memory is changed to the reference of REG.
  5881. + And the name is missed in this timing, and SIGSEGV occurs at the time of
  5882. + outputting .comm. ( Is this a bug ? )
  5883. + reference to cse.c:find_best_add */
  5884. +
  5885. +#define ADDRESS_COST(ADDR) 1 /* 000524 watanabe */
  5886. +
  5887. +
  5888. +/* C33: If the following lines are not defined, the compile error occurs. */
  5889. +/* Nonzero if access to memory by bytes or half words is no faster
  5890. + than accessing full words. */
  5891. +#define SLOW_BYTE_ACCESS 1
  5892. +
  5893. +#define ADJUST_INSN_LENGTH(INSN, LENGTH) \
  5894. + LENGTH += c33_adjust_insn_length (INSN, LENGTH);
  5895. +
  5896. +
  5897. +/***************/
  5898. +/* N: Sections */
  5899. +/***************/
  5900. +
  5901. +/* The five different data regions on the c33. */
  5902. +typedef enum
  5903. +{
  5904. + DATA_AREA_NORMAL,
  5905. + DATA_AREA_SDA,
  5906. + DATA_AREA_TDA,
  5907. + DATA_AREA_ZDA,
  5908. + DATA_AREA_GDA
  5909. +} c33_data_area;
  5910. +
  5911. +/* A list of names for sections other than the standard two, which are
  5912. + `in_text' and `in_data'. You need not define this macro on a
  5913. + system with no other sections (that GCC needs to use). */
  5914. +
  5915. +/* One or more functions to be defined in `varasm.c'. These
  5916. + functions should do jobs analogous to those of `text_section' and
  5917. + `data_section', for your additional sections. Do not define this
  5918. + macro if you do not define `EXTRA_SECTIONS'. */
  5919. +#undef EXTRA_SECTION_FUNCTIONS
  5920. +
  5921. +/* A list of names for sections other than the standard two, which are
  5922. + `in_text' and `in_data'. You need not define this macro on a
  5923. + system with no other sections (that GCC needs to use). */
  5924. +
  5925. +/* CHG K.Watanabe V1.7 >>>>>>> */
  5926. +/* C33: Because "in_ctros, in_dtros" are already defined in varasm.c,
  5927. + delete them. */
  5928. +#if 0
  5929. +#undef EXTRA_SECTIONS
  5930. +#define EXTRA_SECTIONS in_tdata, in_sdata, in_zdata, in_gdata, \
  5931. +in_const, in_ctors, in_dtors, \
  5932. +in_rozdata, in_rosdata, in_rotdata, in_rogdata, \
  5933. +in_tbss, in_sbss, in_zbss, in_gbss, \
  5934. +in_tcommon, in_scommon, in_zcommon, in_gcommon
  5935. +#endif
  5936. +
  5937. +#define EXTRA_SECTIONS in_tdata, in_sdata, in_zdata, in_gdata, \
  5938. +in_const, \
  5939. +in_rozdata, in_rosdata, in_rotdata, in_rogdata, \
  5940. +in_tbss, in_sbss, in_zbss, in_gbss, \
  5941. +in_tcommon, in_scommon, in_zcommon, in_gcommon
  5942. +/* CHG K.Watanabe V1.7 <<<<<<<< */
  5943. +
  5944. +/* This could be done a lot more cleanly using ANSI C ... */
  5945. +
  5946. +/* CHG K.Watanabe V1.7 >>>>>>> */
  5947. +/* C33: Because "in_ctros, in_dtros" are already defined in varasm.c,
  5948. + delete them. */
  5949. +#if 0
  5950. +#define EXTRA_SECTION_FUNCTIONS \
  5951. +CONST_SECTION_FUNCTION \
  5952. +CTORS_SECTION_FUNCTION \
  5953. +DTORS_SECTION_FUNCTION \
  5954. + \
  5955. +void \
  5956. +sdata_section () \
  5957. +{ \
  5958. + if (in_section != in_sdata) \
  5959. + { \
  5960. + if( i_32bit_Insn_Chk_Flg == 0 ){ \
  5961. + fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
  5962. + } \
  5963. + in_section = in_sdata; \
  5964. + } \
  5965. +} \
  5966. + \
  5967. +void \
  5968. +rosdata_section () \
  5969. +{ \
  5970. + if (in_section != in_rosdata) \
  5971. + { \
  5972. + if( i_32bit_Insn_Chk_Flg == 0 ){ \
  5973. + fprintf (asm_out_file, "%s\n", ROSDATA_SECTION_ASM_OP); \
  5974. + } \
  5975. + in_section = in_rosdata; \
  5976. + } \
  5977. +} \
  5978. + \
  5979. +void \
  5980. +sbss_section () \
  5981. +{ \
  5982. + if (in_section != in_sbss) \
  5983. + { \
  5984. + if( i_32bit_Insn_Chk_Flg == 0 ){ \
  5985. + fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
  5986. + } \
  5987. + in_section = in_sbss; \
  5988. + } \
  5989. +} \
  5990. + \
  5991. +void \
  5992. +tdata_section () \
  5993. +{ \
  5994. + if (in_section != in_tdata) \
  5995. + { \
  5996. + if( i_32bit_Insn_Chk_Flg == 0 ){ \
  5997. + fprintf (asm_out_file, "%s\n", TDATA_SECTION_ASM_OP); \
  5998. + } \
  5999. + in_section = in_tdata; \
  6000. + } \
  6001. +} \
  6002. + \
  6003. +void \
  6004. +rotdata_section () \
  6005. +{ \
  6006. + if (in_section != in_rotdata) \
  6007. + { \
  6008. + if( i_32bit_Insn_Chk_Flg == 0 ){ \
  6009. + fprintf (asm_out_file, "%s\n", ROTDATA_SECTION_ASM_OP); \
  6010. + } \
  6011. + in_section = in_rotdata; \
  6012. + } \
  6013. +} \
  6014. + \
  6015. +void \
  6016. +tbss_section () \
  6017. +{ \
  6018. + if (in_section != in_tbss) \
  6019. + { \
  6020. + if( i_32bit_Insn_Chk_Flg == 0 ){ \
  6021. + fprintf (asm_out_file, "%s\n", TBSS_SECTION_ASM_OP); \
  6022. + } \
  6023. + in_section = in_tbss; \
  6024. + } \
  6025. +} \
  6026. + \
  6027. +void \
  6028. +zdata_section () \
  6029. +{ \
  6030. + if (in_section != in_zdata) \
  6031. + { \
  6032. + if( i_32bit_Insn_Chk_Flg == 0 ){ \
  6033. + fprintf (asm_out_file, "%s\n", ZDATA_SECTION_ASM_OP); \
  6034. + } \
  6035. + in_section = in_zdata; \
  6036. + } \
  6037. +} \
  6038. + \
  6039. +void \
  6040. +rozdata_section () \
  6041. +{ \
  6042. + if (in_section != in_rozdata) \
  6043. + { \
  6044. + if( i_32bit_Insn_Chk_Flg == 0 ){ \
  6045. + fprintf (asm_out_file, "%s\n", ROZDATA_SECTION_ASM_OP); \
  6046. + } \
  6047. + in_section = in_rozdata; \
  6048. + } \
  6049. +} \
  6050. + \
  6051. +void \
  6052. +zbss_section () \
  6053. +{ \
  6054. + if (in_section != in_zbss) \
  6055. + { \
  6056. + if( i_32bit_Insn_Chk_Flg == 0 ){ \
  6057. + fprintf (asm_out_file, "%s\n", ZBSS_SECTION_ASM_OP); \
  6058. + } \
  6059. + in_section = in_zbss; \
  6060. + } \
  6061. +} \
  6062. + \
  6063. +void \
  6064. +gdata_section () \
  6065. +{ \
  6066. + if (in_section != in_gdata) \
  6067. + { \
  6068. + if( i_32bit_Insn_Chk_Flg == 0 ){ \
  6069. + fprintf (asm_out_file, "%s\n", GDATA_SECTION_ASM_OP); \
  6070. + } \
  6071. + in_section = in_gdata; \
  6072. + } \
  6073. +} \
  6074. + \
  6075. +void \
  6076. +rogdata_section () \
  6077. +{ \
  6078. + if (in_section != in_rogdata) \
  6079. + { \
  6080. + if( i_32bit_Insn_Chk_Flg == 0 ){ \
  6081. + fprintf (asm_out_file, "%s\n", ROGDATA_SECTION_ASM_OP); \
  6082. + } \
  6083. + in_section = in_rogdata; \
  6084. + } \
  6085. +} \
  6086. + \
  6087. +void \
  6088. +gbss_section () \
  6089. +{ \
  6090. + if (in_section != in_gbss) \
  6091. + { \
  6092. + if( i_32bit_Insn_Chk_Flg == 0 ){ \
  6093. + fprintf (asm_out_file, "%s\n", GBSS_SECTION_ASM_OP); \
  6094. + } \
  6095. + in_section = in_gbss; \
  6096. + } \
  6097. +}
  6098. +#endif
  6099. +
  6100. +#define EXTRA_SECTION_FUNCTIONS \
  6101. +void \
  6102. +const_section () \
  6103. +{ \
  6104. + if (in_section != in_const) \
  6105. + { \
  6106. + fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
  6107. + in_section = in_const; \
  6108. + } \
  6109. +} \
  6110. + \
  6111. +void \
  6112. +sdata_section () \
  6113. +{ \
  6114. + if (in_section != in_sdata) \
  6115. + { \
  6116. + fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
  6117. + in_section = in_sdata; \
  6118. + } \
  6119. +} \
  6120. + \
  6121. +void \
  6122. +rosdata_section () \
  6123. +{ \
  6124. + if (in_section != in_rosdata) \
  6125. + { \
  6126. + fprintf (asm_out_file, "%s\n", ROSDATA_SECTION_ASM_OP); \
  6127. + in_section = in_rosdata; \
  6128. + } \
  6129. +} \
  6130. + \
  6131. +void \
  6132. +sbss_section () \
  6133. +{ \
  6134. + if (in_section != in_sbss) \
  6135. + { \
  6136. + fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
  6137. + in_section = in_sbss; \
  6138. + } \
  6139. +} \
  6140. + \
  6141. +void \
  6142. +tdata_section () \
  6143. +{ \
  6144. + if (in_section != in_tdata) \
  6145. + { \
  6146. + fprintf (asm_out_file, "%s\n", TDATA_SECTION_ASM_OP); \
  6147. + in_section = in_tdata; \
  6148. + } \
  6149. +} \
  6150. + \
  6151. +void \
  6152. +rotdata_section () \
  6153. +{ \
  6154. + if (in_section != in_rotdata) \
  6155. + { \
  6156. + fprintf (asm_out_file, "%s\n", ROTDATA_SECTION_ASM_OP); \
  6157. + in_section = in_rotdata; \
  6158. + } \
  6159. +} \
  6160. + \
  6161. +void \
  6162. +tbss_section () \
  6163. +{ \
  6164. + if (in_section != in_tbss) \
  6165. + { \
  6166. + fprintf (asm_out_file, "%s\n", TBSS_SECTION_ASM_OP); \
  6167. + in_section = in_tbss; \
  6168. + } \
  6169. +} \
  6170. + \
  6171. +void \
  6172. +zdata_section () \
  6173. +{ \
  6174. + if (in_section != in_zdata) \
  6175. + { \
  6176. + fprintf (asm_out_file, "%s\n", ZDATA_SECTION_ASM_OP); \
  6177. + in_section = in_zdata; \
  6178. + } \
  6179. +} \
  6180. + \
  6181. +void \
  6182. +rozdata_section () \
  6183. +{ \
  6184. + if (in_section != in_rozdata) \
  6185. + { \
  6186. + fprintf (asm_out_file, "%s\n", ROZDATA_SECTION_ASM_OP); \
  6187. + in_section = in_rozdata; \
  6188. + } \
  6189. +} \
  6190. + \
  6191. +void \
  6192. +zbss_section () \
  6193. +{ \
  6194. + if (in_section != in_zbss) \
  6195. + { \
  6196. + fprintf (asm_out_file, "%s\n", ZBSS_SECTION_ASM_OP); \
  6197. + in_section = in_zbss; \
  6198. + } \
  6199. +} \
  6200. + \
  6201. +void \
  6202. +gdata_section () \
  6203. +{ \
  6204. + if (in_section != in_gdata) \
  6205. + { \
  6206. + fprintf (asm_out_file, "%s\n", GDATA_SECTION_ASM_OP); \
  6207. + in_section = in_gdata; \
  6208. + } \
  6209. +} \
  6210. + \
  6211. +void \
  6212. +rogdata_section () \
  6213. +{ \
  6214. + if (in_section != in_rogdata) \
  6215. + { \
  6216. + fprintf (asm_out_file, "%s\n", ROGDATA_SECTION_ASM_OP); \
  6217. + in_section = in_rogdata; \
  6218. + } \
  6219. +} \
  6220. + \
  6221. +void \
  6222. +gbss_section () \
  6223. +{ \
  6224. + if (in_section != in_gbss) \
  6225. + { \
  6226. + fprintf (asm_out_file, "%s\n", GBSS_SECTION_ASM_OP); \
  6227. + in_section = in_gbss; \
  6228. + } \
  6229. +}
  6230. +/* CHG K.Watanabe V1.7 <<<<<<< */
  6231. +
  6232. +// 2001/6/5 watanabe
  6233. +/* C33: Though the value of "in_section" is different between "rosdata_section"
  6234. + and "rotdata_section" in v850, it may be a bug, so we changed to call
  6235. + the sections. */
  6236. +#define TEXT_SECTION_ASM_OP "\t.section .text"
  6237. +#define DATA_SECTION_ASM_OP "\t.section .data"
  6238. +#define BSS_SECTION_ASM_OP "\t.section .bss"
  6239. +#define SDATA_SECTION_ASM_OP "\t.section .sdata,\"aw\""
  6240. +#define SBSS_SECTION_ASM_OP "\t.section .sbss,\"aw\""
  6241. +#define ZDATA_SECTION_ASM_OP "\t.section .zdata,\"aw\""
  6242. +#define ZBSS_SECTION_ASM_OP "\t.section .zbss,\"aw\""
  6243. +#define TDATA_SECTION_ASM_OP "\t.section .tdata,\"aw\""
  6244. +#define TBSS_SECTION_ASM_OP "\t.section .tbss,\"aw\""
  6245. +#define GDATA_SECTION_ASM_OP "\t.section .gdata,\"aw\""
  6246. +#define GBSS_SECTION_ASM_OP "\t.section .gbss,\"aw\""
  6247. +#define ROSDATA_SECTION_ASM_OP "\t.section .rosdata,\"a\""
  6248. +#define ROZDATA_SECTION_ASM_OP "\t.section .rozdata,\"a\""
  6249. +#define ROTDATA_SECTION_ASM_OP "\t.section .rotdata,\"a\""
  6250. +#define ROGDATA_SECTION_ASM_OP "\t.section .rogdata,\"a\""
  6251. +#undef CONST_SECTION_ASM_OP
  6252. +#define CONST_SECTION_ASM_OP "\t.section .rodata"
  6253. +
  6254. +/* ADD K.Watanabe V1.7 >>>>>>> */
  6255. +#define CTORS_SECTION_ASM_OP "\t.section .ctors,\"aw\""
  6256. +#define DTORS_SECTION_ASM_OP "\t.section .dtors,\"aw\""
  6257. +
  6258. +/* Support a read-only data section. */
  6259. +#define READONLY_DATA_SECTION_ASM_OP "\t.section .rodata"
  6260. +/* ADD K.Watanabe V1.7 <<<<<<< */
  6261. +
  6262. +#define SCOMMON_ASM_OP ".scomm"
  6263. +#define ZCOMMON_ASM_OP ".zcomm"
  6264. +#define TCOMMON_ASM_OP ".tcomm"
  6265. +#define GCOMMON_ASM_OP ".gcomm"
  6266. +
  6267. +/* A C statement or statements to switch to the appropriate section
  6268. + for output of EXP. You can assume that EXP is either a `VAR_DECL'
  6269. + node or a constant of some sort. RELOC indicates whether the
  6270. + initial value of EXP requires link-time relocations. Select the
  6271. + section by calling `text_section' or one of the alternatives for
  6272. + other sections.
  6273. +
  6274. + Do not define this macro if you put all read-only variables and
  6275. + constants in the read-only data section (usually the text section). */
  6276. +
  6277. +/* DEL K.Watanabe V1.7 >>>>>>> */
  6278. +/* C33: Unused. Define the following contents in TARGET_ASM_SELECT_SECTION. */
  6279. +#if 0
  6280. +#undef SELECT_SECTION
  6281. +#define SELECT_SECTION(EXP, RELOC) c33_select_section(EXP, RELOC)
  6282. +#endif
  6283. +/* DEL K.Watanabe V1.7 <<<<<<< */
  6284. +
  6285. +/* A C statement or statements to switch to the appropriate section
  6286. + for output of RTX in mode MODE. You can assume that RTX is some
  6287. + kind of constant in RTL. The argument MODE is redundant except in
  6288. + the case of a `const_int' rtx. Select the section by calling
  6289. + `text_section' or one of the alternatives for other sections.
  6290. +
  6291. + Do not define this macro if you put all constants in the read-only
  6292. + data section. */
  6293. +/* #define SELECT_RTX_SECTION(MODE, RTX) */
  6294. +
  6295. +
  6296. +#define OUTPUT_ADDR_CONST_EXTRA(FILE, X, FAIL) \
  6297. + if (! c33_output_addr_const_extra (FILE, X)) \
  6298. + goto FAIL
  6299. +
  6300. +/**********/
  6301. +/* O: PIC */
  6302. +/**********/
  6303. +
  6304. +/***********************/
  6305. +/* P: Assembler Format */
  6306. +/***********************/
  6307. +
  6308. +/* P-1: The Overall Framework of an Assembler File */
  6309. +/* Output at beginning/end of assembler file. */
  6310. +#undef ASM_FILE_START
  6311. +#define ASM_FILE_START(FILE) asm_file_start(FILE)
  6312. +
  6313. +#define ASM_COMMENT_START ";"
  6314. +
  6315. +/* Output to assembler file text saying following lines
  6316. + may contain character constants, extra white space, comments, etc. */
  6317. +
  6318. +/* C33: If the following line is not defined, the compile error occurs. */
  6319. +#define ASM_APP_ON ";APP\n"
  6320. +
  6321. +/* Output to assembler file text saying following lines
  6322. + no longer contain unusual constructs. */
  6323. +
  6324. +/* C33: If the following line is not defined, the compile error occurs. */
  6325. +#define ASM_APP_OFF ";NO_APP\n"
  6326. +
  6327. +
  6328. +/* P-2: Output of Data */
  6329. +
  6330. +/* DEL K.Watanabe V1.7 >>>>>>> */
  6331. +/* C33: Unused. */
  6332. +#if 0
  6333. +/* This is how to output an assembler line defining a `double' constant.
  6334. + It is .double or .float, depending. */
  6335. +
  6336. +#define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
  6337. +do { char dstr[30]; \
  6338. + REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
  6339. + fprintf (FILE, "\t.double %s\n", dstr); \
  6340. + } while (0)
  6341. +
  6342. +
  6343. +/* This is how to output an assembler line defining a `float' constant. */
  6344. +#define ASM_OUTPUT_FLOAT(FILE, VALUE) \
  6345. +do { char dstr[30]; \
  6346. + REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
  6347. + fprintf (FILE, "\t.float %s\n", dstr); \
  6348. + } while (0)
  6349. +
  6350. +/* This is how to output an assembler line defining an `int' constant. */
  6351. +
  6352. +#define ASM_OUTPUT_INT(FILE, VALUE) \
  6353. +( fprintf (FILE, "\t.long "), \
  6354. + output_addr_const (FILE, (VALUE)), \
  6355. + fprintf (FILE, "\n"))
  6356. +
  6357. +/* Likewise for `char' and `short' constants. */
  6358. +
  6359. +#define ASM_OUTPUT_SHORT(FILE, VALUE) \
  6360. +( fprintf (FILE, "\t.hword "), \
  6361. + output_addr_const (FILE, (VALUE)), \
  6362. + fprintf (FILE, "\n"))
  6363. +
  6364. +#define ASM_OUTPUT_CHAR(FILE, VALUE) \
  6365. +( fprintf (FILE, "\t.byte "), \
  6366. + output_addr_const (FILE, (VALUE)), \
  6367. + fprintf (FILE, "\n"))
  6368. +
  6369. +/* This is how to output an assembler line for a numeric constant byte. */
  6370. +/* C33: If the following line is not defined, the compile error occurs. */
  6371. +#define ASM_OUTPUT_BYTE(FILE, VALUE) \
  6372. + fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
  6373. +
  6374. +#endif /* #if 0 */
  6375. +/* DEL K.Watanabe V1.7 <<<<<<< */
  6376. +
  6377. +/* Define the parentheses used to group arithmetic operations
  6378. + in assembler code. */
  6379. +
  6380. +
  6381. +// DEL K.Watanabe V1.8 >>>>>>>
  6382. +#if 0
  6383. +/* C33: If the following line is not defined, the compile error occurs. */
  6384. +#define ASM_OPEN_PAREN "("
  6385. +#define ASM_CLOSE_PAREN ")"
  6386. +#endif
  6387. +// DEL K.Watanabe V1.8 <<<<<<<
  6388. +
  6389. +
  6390. +/* P-3: Output of Uninitialized Variables */
  6391. +
  6392. +/* This says how to output the assembler to define a global
  6393. + uninitialized but not common symbol. */
  6394. +
  6395. +#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
  6396. + asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
  6397. +
  6398. +#undef ASM_OUTPUT_ALIGNED_BSS
  6399. +#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
  6400. + c33_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
  6401. +
  6402. +/* This says how to output the assembler to define a global
  6403. + uninitialized, common symbol. */
  6404. +#undef ASM_OUTPUT_ALIGNED_COMMON
  6405. +#undef ASM_OUTPUT_COMMON
  6406. +#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
  6407. + c33_output_common (FILE, DECL, NAME, SIZE, ALIGN)
  6408. +
  6409. +/* This says how to output the assembler to define a local
  6410. + uninitialized symbol. */
  6411. +#undef ASM_OUTPUT_ALIGNED_LOCAL
  6412. +#undef ASM_OUTPUT_LOCAL
  6413. +#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
  6414. + c33_output_local (FILE, DECL, NAME, SIZE, ALIGN)
  6415. +
  6416. +
  6417. +/* P-4: Output and Generation of Labels */
  6418. +
  6419. +/* This is how to output the definition of a user-level label named NAME,
  6420. + such as the label on a static function or variable NAME. */
  6421. +
  6422. +/* C33: If the following line is not defined, the compile error occurs. */
  6423. +#define ASM_OUTPUT_LABEL(FILE, NAME) \
  6424. + do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
  6425. +
  6426. +/* This is how to output a command to make the user-level label named NAME
  6427. + defined for reference from other files. */
  6428. +
  6429. +/* ADD K.Watanabe V1.7 >>>>>>> */
  6430. +/* Globalizing directive for a label. */
  6431. +#define GLOBAL_ASM_OP "\t.global\t"
  6432. +/* ADD K.Watanabe V1.7 <<<<<<< */
  6433. +
  6434. +/* This is how to output a reference to a user-level label named NAME.
  6435. + `assemble_name' uses this. */
  6436. +
  6437. +// CHG K.Watanabe V1.8 >>>>>>>
  6438. +#if 0
  6439. +#undef ASM_OUTPUT_LABELREF
  6440. +#define ASM_OUTPUT_LABELREF(FILE, NAME) \
  6441. + do { \
  6442. + char* real_name; \
  6443. + STRIP_NAME_ENCODING (real_name, (NAME)); \
  6444. + fprintf (FILE, "%s", real_name); \
  6445. + } while (0)
  6446. +#endif
  6447. +
  6448. +#undef ASM_OUTPUT_LABELREF
  6449. +#define ASM_OUTPUT_LABELREF(FILE, NAME) \
  6450. + asm_fprintf (FILE, "%U%s", (*targetm.strip_name_encoding) (NAME))
  6451. +// CHG K.Watanabe V1.8 <<<<<<<
  6452. +
  6453. +
  6454. +/* Store in OUTPUT a string (made with alloca) containing
  6455. + an assembler-name for a local static variable named NAME.
  6456. + LABELNO is an integer which is different for each call. */
  6457. +
  6458. +#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
  6459. +( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
  6460. + sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
  6461. +
  6462. +/* This is how we tell the assembler that two symbols have the same value. */
  6463. +
  6464. +#define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
  6465. + do { assemble_name(FILE, NAME1); \
  6466. + fputs(" = ", FILE); \
  6467. + assemble_name(FILE, NAME2); \
  6468. + fputc('\n', FILE); } while (0)
  6469. +
  6470. +
  6471. +/* P-5: How Initialization Functions Are Handled */
  6472. +
  6473. +/* P-6: Macros Controlling Initialization Routines */
  6474. +
  6475. +/* P-7: Output of Assembler Instructions */
  6476. +
  6477. +/* How to refer to registers in assembler output.
  6478. + This sequence is indexed by compiler's hard-register-number (see above). */
  6479. +#define REGISTER_NAMES \
  6480. +{ "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6" , "%r7", \
  6481. + "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", \
  6482. + ".fp", ".ap", "%sp" }
  6483. +
  6484. +#define FINAL_PRESCAN_INSN(insn, operand, nop) final_prescan_insn (insn, operand, nop)
  6485. +
  6486. +/* Print an instruction operand X on file FILE.
  6487. + look in c33.c for details */
  6488. +
  6489. +#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
  6490. +
  6491. +#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
  6492. + (((CODE) == '.') || ((CODE) == '#'))
  6493. +
  6494. +/* Print a memory operand whose address is X, on file FILE.
  6495. + This uses a function in output-vax.c. */
  6496. +
  6497. +#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
  6498. +
  6499. +#define ASM_OUTPUT_REG_PUSH(FILE,REGNO)
  6500. +#define ASM_OUTPUT_REG_POP(FILE,REGNO)
  6501. +
  6502. +
  6503. +/* P-8: Output of Dispatch Tables */
  6504. +
  6505. +/* C33: If the following line is not defined, the default is enabled and the error occurs.(defaults.h) */
  6506. +/* This is how to output an element of a case-vector that is absolute. */
  6507. +
  6508. +#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
  6509. + asm_fprintf (FILE, "\t.long .L%d\n", VALUE)
  6510. +
  6511. +/* P-9: Assembler Commands for Exception Regions */
  6512. +
  6513. +/* P-10: Assembler Commands for Alignment */
  6514. +
  6515. +#define ASM_OUTPUT_ALIGN(FILE,LOG) \
  6516. + if ((LOG) != 0) \
  6517. + fprintf (FILE, "\t.align %d\n", (LOG))
  6518. +
  6519. +
  6520. +/*********************/
  6521. +/* Q: Debugging Info */
  6522. +/*********************/
  6523. +
  6524. +/* We don't have to worry about dbx compatibility for the c33. */
  6525. +#define DEFAULT_GDB_EXTENSIONS 1
  6526. +
  6527. +/* Use stabs debugging info by default. */
  6528. +#undef PREFERRED_DEBUGGING_TYPE
  6529. +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
  6530. +
  6531. +/* DEL K.Watanabe V1.7 >>>>>>> */
  6532. +/* C33: Delete according to V850.
  6533. + The following line is defined in defaults.h */
  6534. +#if 0
  6535. +#undef DBX_REGISTER_NUMBER
  6536. +#define DBX_REGISTER_NUMBER(REGNO) REGNO
  6537. +#endif
  6538. +/* DEL K.Watanabe V1.7 <<<<<<< */
  6539. +
  6540. +/************************/
  6541. +/* R: Cross-compilation */
  6542. +/************************/
  6543. +
  6544. +
  6545. +/***********/
  6546. +/* S: Misc */
  6547. +/***********/
  6548. +
  6549. +/* Define this if you have defined special-purpose predicates in the
  6550. + file `MACHINE.c'. This macro is called within an initializer of an
  6551. + array of structures. The first field in the structure is the name
  6552. + of a predicate and the second field is an array of rtl codes. For
  6553. + each predicate, list all rtl codes that can be in expressions
  6554. + matched by the predicate. The list should have a trailing comma. */
  6555. +
  6556. +/* C33: Why is "CONST" not in "special_symbolref_operand"? */
  6557. +
  6558. +#define PREDICATE_CODES \
  6559. +{ "call_address_operand", { REG, SYMBOL_REF }}, \
  6560. +{ "power_of_two_operand", { CONST_INT }}, \
  6561. +{ "not_power_of_two_operand", { CONST_INT }}, \
  6562. +{ "general_operand_post_inc", { CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \
  6563. + LABEL_REF, SUBREG, REG, MEM}},
  6564. +
  6565. +
  6566. +/* Define to use software floating point emulator for REAL_ARITHMETIC and
  6567. + decimal <-> binary conversion. */
  6568. +
  6569. +
  6570. +/* C33: If the following line is not defined, the compile error occurs. */
  6571. +/* Specify the machine mode that this machine uses
  6572. + for the index in the tablejump instruction. */
  6573. +#define CASE_VECTOR_MODE Pmode
  6574. +
  6575. +#define WORD_REGISTER_OPERATIONS
  6576. +
  6577. +
  6578. +/* Byte and short loads sign extend the value to a word. */
  6579. +#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
  6580. +
  6581. +
  6582. +// DEL K.Watanabe V1.8 >>>>>>>
  6583. +#if 0
  6584. +/* C33: If the following line is not defined, the compile error occurs. */
  6585. +/* This is the kind of divide that is easiest to do in the general case. */
  6586. +#define EASY_DIV_EXPR TRUNC_DIV_EXPR
  6587. +#endif
  6588. +// DEL K.Watanabe V1.8 <<<<<<<<
  6589. +
  6590. +
  6591. +/* >>>>> delete iruma m.takeishi '04.02.24 */
  6592. +/* C33: Correction in which the change of the library specification was refrected.
  6593. + Revert to the old code. */
  6594. +/* >>>>> add iruma m.takeishi '03.11.19 */
  6595. +/* C33: Change the libgcc function names which are the default call. */
  6596. +/* C33: /gcc/opttabs.c -- Overrideed in "init_optabs" function ( Only PE )*/
  6597. +#if 0
  6598. +#define INIT_TARGET_OPTABS \
  6599. + if ( TARGET_C33PE ) { \
  6600. + init_integral_libfuncs (sdiv_optab, "div_pe", '3'); \
  6601. + init_integral_libfuncs (udiv_optab, "udiv_pe", '3'); \
  6602. + init_integral_libfuncs (smod_optab, "mod_pe", '3'); \
  6603. + init_integral_libfuncs (umod_optab, "umod_pe", '3'); \
  6604. + \
  6605. + \
  6606. + init_floating_libfuncs (add_optab, "add_pe", '3'); \
  6607. + init_floating_libfuncs (sub_optab, "sub_pe", '3'); \
  6608. + /* >>>>> add iruma m.takeishi '03.12.22 */ \
  6609. + init_floating_libfuncs (smul_optab, "mul_pe", '3'); \
  6610. + /* <<<<< add iruma m.takeishi '03.12.22 */ \
  6611. + init_floating_libfuncs (flodiv_optab, "div_pe", '3'); \
  6612. + \
  6613. + floatsisf_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__float_pesisf"); \
  6614. + floatsidf_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__float_pesidf"); \
  6615. + extendsfdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__extend_pesfdf2"); \
  6616. + }
  6617. +/* <<<<< add iruma m.takeishi '03.11.19 */
  6618. +#endif
  6619. +/* <<<<< delete iruma m.takeishi '04.02.24 */
  6620. +
  6621. +
  6622. +/* C33: If the following line is not defined, the compile error occurs. */
  6623. +/* Max number of bytes we can move from memory to memory
  6624. + in one reasonably fast instruction. */
  6625. +#define MOVE_MAX 4
  6626. +
  6627. +
  6628. +/* C33: If the following line is not defined, the link error occurs. */
  6629. +/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
  6630. + is done just by pretending it is already truncated. */
  6631. +#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
  6632. +
  6633. +
  6634. +/* Specify the machine mode that pointers have.
  6635. + After generation of rtl, the compiler makes no further distinction
  6636. + between pointers and any other objects of this machine mode. */
  6637. +#define Pmode SImode
  6638. +
  6639. +/* C33: If the following line is not defined, the compile error occurs. */
  6640. +/* A function address in a call instruction
  6641. + is a byte address (for indexing purposes)
  6642. + so give the MEM rtx a byte's mode. */
  6643. +#define FUNCTION_MODE QImode
  6644. +
  6645. +/* DEL K.Watanabe V1.7 >>>>>>> */
  6646. +/* C33: Unused */
  6647. +#if 0
  6648. +/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
  6649. + is a valid machine specific attribute for DECL.
  6650. + The attributes in ATTRIBUTES have previously been assigned to DECL. */
  6651. +#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
  6652. +c33_valid_machine_decl_attribute (DECL, IDENTIFIER, ARGS)
  6653. +#endif
  6654. +/* DEL K.Watanabe V1.7 <<<<<<< */
  6655. +
  6656. +
  6657. +/******************/
  6658. +/* C33: X: Others */
  6659. +/******************/
  6660. +
  6661. +/* Implement ZDA, TDA, SDA, and GDA */
  6662. +
  6663. +/* DEL K.Watanabe V1.7 >>>>>>> */
  6664. +/* C33: Unused. Define the following contents in "TARGET_ENCODE_SECTION_INFO". */
  6665. +#if 0
  6666. +#define ENCODE_SECTION_INFO(DECL) \
  6667. +do { \
  6668. + if ((TREE_STATIC (DECL) || DECL_EXTERNAL (DECL)) \
  6669. + && TREE_CODE (DECL) == VAR_DECL) \
  6670. + c33_encode_data_area (DECL); \
  6671. +} while (0)
  6672. +#endif
  6673. +/* DEL K.Watanabe V1.7 <<<<<<< */
  6674. +
  6675. +#define ZDA_NAME_FLAG_CHAR '@'
  6676. +#define TDA_NAME_FLAG_CHAR '%'
  6677. +#define SDA_NAME_FLAG_CHAR '&'
  6678. +#define GDA_NAME_FLAG_CHAR '$'
  6679. +
  6680. +#define ZDA_NAME_P(NAME) (*(NAME) == ZDA_NAME_FLAG_CHAR)
  6681. +#define TDA_NAME_P(NAME) (*(NAME) == TDA_NAME_FLAG_CHAR)
  6682. +#define SDA_NAME_P(NAME) (*(NAME) == SDA_NAME_FLAG_CHAR)
  6683. +#define GDA_NAME_P(NAME) (*(NAME) == GDA_NAME_FLAG_CHAR)
  6684. +
  6685. +#define ENCODED_NAME_P(SYMBOL_NAME) \
  6686. + (ZDA_NAME_P (SYMBOL_NAME) \
  6687. + || TDA_NAME_P (SYMBOL_NAME) \
  6688. + || SDA_NAME_P (SYMBOL_NAME) \
  6689. + || GDA_NAME_P (SYMBOL_NAME))
  6690. +
  6691. +
  6692. +// DEL K.Watanabe V1.8 >>>>>>>
  6693. +#if 0
  6694. +#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
  6695. + (VAR) = (SYMBOL_NAME) + ENCODED_NAME_P (SYMBOL_NAME)
  6696. +#endif
  6697. +// DEL K.Watanabe V1.8 <<<<<<<
  6698. +
  6699. +
  6700. +extern int const_costs ();
  6701. +extern void print_operand ();
  6702. +extern void print_operand_address ();
  6703. +extern char *output_move_single ();
  6704. +extern int power_of_two_operand ();
  6705. +extern int not_power_of_two_operand ();
  6706. +extern int compute_frame_size ();
  6707. +extern void expand_prologue ();
  6708. +extern void expand_epilogue ();
  6709. +extern void notice_update_cc ();
  6710. +extern void declare_object ();
  6711. +
  6712. diff --git a/gcc/config/c33/c33.md b/gcc/config/c33/c33.md
  6713. new file mode 100644
  6714. index 0000000..1371f97
  6715. --- /dev/null
  6716. +++ b/gcc/config/c33/c33.md
  6717. @@ -0,0 +1,1241 @@
  6718. +;; GCC machine description for EPSON C33
  6719. +;; Copyright (C) 1996, 1997 Free Software Foundation, Inc.
  6720. +
  6721. +;; Contributed by Jeff Law (law@cygnus.com).
  6722. +
  6723. +;; This file is part of GNU CC.
  6724. +
  6725. +;; GNU CC is free software; you can redistribute it and/or modify
  6726. +;; it under the terms of the GNU General Public License as published by
  6727. +;; the Free Software Foundation; either version 2, or (at your option)
  6728. +;; any later version.
  6729. +
  6730. +;; GNU CC is distributed in the hope that it will be useful,
  6731. +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  6732. +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  6733. +;; GNU General Public License for more details.
  6734. +
  6735. +;; You should have received a copy of the GNU General Public License
  6736. +;; along with GNU CC; see the file COPYING. If not, write to
  6737. +;; the Free Software Foundation, 59 Temple Place - Suite 330,
  6738. +;; Boston, MA 02111-1307, USA.
  6739. +
  6740. +
  6741. +;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
  6742. +
  6743. +
  6744. +;; Types of instructions (for scheduling purposes). C33: Add instrucutions for branch.
  6745. +
  6746. +(define_attr "type" "load,branch,other"
  6747. + (const_string "other"))
  6748. +
  6749. +;; The size of instructions in bytes.
  6750. +
  6751. +(define_attr "length" ""
  6752. + (cond [(eq_attr "type" "branch")
  6753. + (if_then_else (and (ge (minus (pc) (match_dup 0))
  6754. + (const_int -254))
  6755. + (le (minus (pc) (match_dup 0))
  6756. +; (const_int 256)))
  6757. + (const_int 258)))
  6758. + (const_int 2)
  6759. + (if_then_else (and (ge (minus (pc) (match_dup 0))
  6760. + (const_int -2097150))
  6761. + (le (minus (pc) (match_dup 0))
  6762. + (const_int 2097152)))
  6763. + (const_int 4)
  6764. + (const_int 6)))]
  6765. + (const_int 200)))
  6766. +
  6767. +(define_function_unit "memory" 1 1 (eq_attr "type" "load") 2 0)
  6768. +
  6769. +; Definitions for filling branch delay slots.
  6770. +
  6771. +(define_attr "needs_delay_slot" "yes,no" (const_string "no"))
  6772. +
  6773. +(define_attr "in_delay_slot" "yes,no" (const_string "no"))
  6774. +
  6775. +(define_delay
  6776. + (eq_attr "needs_delay_slot" "yes")
  6777. + [(eq_attr "in_delay_slot" "yes") (nil) (nil)])
  6778. +
  6779. +;; ----------------------------------------------------------------------
  6780. +;; MOVE INSTRUCTIONS
  6781. +;; ----------------------------------------------------------------------
  6782. +
  6783. +;; movqi
  6784. +
  6785. +(define_expand "movqi"
  6786. + [(set (match_operand:QI 0 "general_operand_post_inc" "")
  6787. + (match_operand:QI 1 "general_operand_post_inc" ""))]
  6788. + ""
  6789. + "
  6790. +{
  6791. + /* One of the ops has to be in a register */
  6792. + if (!register_operand (operand0, QImode)
  6793. + && !register_operand (operand1, QImode))
  6794. + operands[1] = copy_to_mode_reg (QImode, operand1);
  6795. +}")
  6796. +
  6797. +(define_insn "*movqi_internal"
  6798. + [(set (match_operand:QI 0 "general_operand_post_inc" "=r,r,r,r,m,r,>")
  6799. + (match_operand:QI 1 "general_operand_post_inc" "r,K,n,m,r,>,r"))]
  6800. + "register_operand (operands[0], QImode)
  6801. + || register_operand (operands[1], QImode)"
  6802. + "* return output_move_single (operands, TRUE);"
  6803. + [(set_attr "length" "2,2,4,6,6,2,2")
  6804. + (set_attr "type" "other,other,other,load,other,load,other")
  6805. + (set_attr "in_delay_slot" "yes,yes,no,no,no,no,no")])
  6806. +
  6807. +;; movhi
  6808. +
  6809. +(define_expand "movhi"
  6810. + [(set (match_operand:HI 0 "general_operand_post_inc" "")
  6811. + (match_operand:HI 1 "general_operand_post_inc" ""))]
  6812. + ""
  6813. + "
  6814. +{
  6815. + /* One of the ops has to be in a register */
  6816. + if (!register_operand (operand0, HImode)
  6817. + && !register_operand (operand1, HImode))
  6818. + operands[1] = copy_to_mode_reg (HImode, operand1);
  6819. +}")
  6820. +
  6821. +(define_insn "*movhi_internal"
  6822. + [(set (match_operand:HI 0 "general_operand_post_inc" "=r,r,r,r,m,r,>")
  6823. + (match_operand:HI 1 "general_operand_post_inc" "r,K,n,m,r,>,r"))]
  6824. + "register_operand (operands[0], HImode)
  6825. + || register_operand (operands[1], HImode)"
  6826. + "* return output_move_single (operands, TRUE);"
  6827. + [(set_attr "length" "2,2,4,6,6,2,2")
  6828. + (set_attr "type" "other,other,other,load,other,load,other")
  6829. + (set_attr "in_delay_slot" "yes,yes,no,no,no,no,no")])
  6830. +
  6831. +
  6832. +;; movsi and helpers
  6833. +
  6834. +(define_expand "movsi"
  6835. + [(set (match_operand:SI 0 "general_operand_post_inc" "")
  6836. + (match_operand:SI 1 "general_operand_post_inc" ""))]
  6837. + ""
  6838. + "
  6839. +{
  6840. + /* One of the ops has to be in a register */
  6841. + if (!register_operand (operand0, SImode)
  6842. + && !register_operand (operand1, SImode))
  6843. + operands[1] = copy_to_mode_reg (SImode, operand1);
  6844. +}")
  6845. +
  6846. +(define_insn "*movsi_internal"
  6847. + [(set (match_operand:SI 0 "general_operand_post_inc" "=r,r,f,r,r,r,r,m,r,>")
  6848. + (match_operand:SI 1 "general_operand_post_inc" "r,f,r,K,L,m,i,r,>,r"))]
  6849. + "register_operand (operands[0], SImode)
  6850. + || register_operand (operands[1], SImode)"
  6851. + "* return output_move_single (operands, FALSE);"
  6852. + [(set_attr "length" "2,2,2,2,4,6,6,6,2,2")
  6853. + (set_attr "type" "other,other,other,other,other,load,other,other,load,other")
  6854. + (set_attr "in_delay_slot" "yes,no,no,yes,no,no,no,no,no,no")])
  6855. +
  6856. +(define_expand "movdi"
  6857. + [(set (match_operand:DI 0 "general_operand" "")
  6858. + (match_operand:DI 1 "general_operand" ""))]
  6859. + ""
  6860. + "
  6861. +{
  6862. + /* One of the ops has to be in a register */
  6863. + if (!register_operand (operand0, DImode)
  6864. + && !register_operand (operand1, DImode))
  6865. + operands[1] = copy_to_mode_reg (DImode, operand1);
  6866. +}")
  6867. +
  6868. +;;; CHG K.Watanabe V1.7 >>>>>>>
  6869. +
  6870. +;;;; (define_insn "*movdi_internal"
  6871. +;;;; [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,m,r")
  6872. +;;;; (match_operand:DI 1 "general_operand" "r,K,L,i,m,r,iF"))]
  6873. +;;;; "register_operand (operands[0], DImode)
  6874. +;;;; || register_operand (operands[1], DImode)"
  6875. +;;;; "* return output_move_double (operands);"
  6876. +;;;; [(set_attr "length" "4,4,6,12,12,12,12")
  6877. +;;;; (set_attr "type" "other,other,other,other,load,other,other")])
  6878. +
  6879. +(define_insn "*movdi_internal"
  6880. +[(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,m,r")
  6881. +(match_operand:DI 1 "general_operand" "r,K,L,i,m,r,iF"))]
  6882. +"register_operand (operands[0], DImode)
  6883. +|| register_operand (operands[1], DImode)"
  6884. +"* return output_move_double (operands);"
  6885. +[(set_attr "length" "4,4,8,12,12,12,12")
  6886. +(set_attr "type" "other,other,other,other,load,other,other")])
  6887. +
  6888. +;;; CHG K.Watanabe V1.7 <<<<<<<
  6889. +
  6890. +(define_expand "movsf"
  6891. + [(set (match_operand:SF 0 "general_operand" "")
  6892. + (match_operand:SF 1 "general_operand" ""))]
  6893. + ""
  6894. + "
  6895. +{
  6896. + /* One of the ops has to be in a register or 0 */
  6897. + if (!register_operand (operand0, SFmode)
  6898. + && !register_operand (operand1, SFmode))
  6899. + operands[1] = copy_to_mode_reg (SFmode, operand1);
  6900. +}")
  6901. +
  6902. +(define_insn "*movsf_internal"
  6903. + [(set (match_operand:SF 0 "general_operand" "=r,r,m,r")
  6904. + (match_operand:SF 1 "general_operand" "r,m,r,iF"))]
  6905. + "register_operand (operands[0], SFmode)
  6906. + || register_operand (operands[1], SFmode)"
  6907. + "* return output_move_single (operands, FALSE);"
  6908. + [(set_attr "length" "2,6,6,6")
  6909. + (set_attr "type" "other,load,other,other")
  6910. + (set_attr "in_delay_slot" "yes,no,no,no")])
  6911. +
  6912. +
  6913. +(define_expand "movdf"
  6914. + [(set (match_operand:DF 0 "general_operand" "")
  6915. + (match_operand:DF 1 "general_operand" ""))]
  6916. + ""
  6917. + "
  6918. +{
  6919. + /* One of the ops has to be in a register or 0 */
  6920. + if (!register_operand (operand0, DFmode)
  6921. + && !register_operand (operand1, DFmode))
  6922. + operands[1] = copy_to_mode_reg (DFmode, operand1);
  6923. +}")
  6924. +
  6925. +(define_insn "*movdf_internal"
  6926. + [(set (match_operand:DF 0 "general_operand" "=r,r,m,r")
  6927. + (match_operand:DF 1 "general_operand" "r,m,r,iF"))]
  6928. + "register_operand (operands[0], DFmode)
  6929. + || register_operand (operands[1], DFmode)"
  6930. + "*
  6931. +{
  6932. + rtx xoperands[10];
  6933. +
  6934. + xoperands[0] = operands[0];
  6935. + xoperands[1] = operands[1];
  6936. +
  6937. + output_asm_insn (output_move_double (xoperands), xoperands);
  6938. + return \"\";
  6939. +}"
  6940. + [(set_attr "length" "4,12,12,12")
  6941. + (set_attr "type" "other,load,other,other")])
  6942. +
  6943. +;; ----------------------------------------------------------------------
  6944. +;; TEST INSTRUCTIONS
  6945. +;; ----------------------------------------------------------------------
  6946. +
  6947. +;;; CHG K.Watanabe V1.7 >>>>>>>
  6948. +;;;; C33: The process of "tstsi" is sometimes omitted
  6949. +;;;; in the case that "tstsi" is defined and compiled with "-O".
  6950. +;;;; In this case, the incorrect process is done in the case of
  6951. +;;;; "negative numbers - positive numbers => overflow".
  6952. +;;;; So disable "tstsi" in the case of "-O" or more.
  6953. +
  6954. +
  6955. +;; C33: The comparison is the essential after the operation,
  6956. +;; if "tstsi" is defined.
  6957. +;;
  6958. +;;(define_insn "tstsi"
  6959. +;; [(set (cc0) (match_operand:SI 0 "register_operand" "r"))]
  6960. +;; ""
  6961. +;; "cmp\\t%0,0\\t;tstsi"
  6962. +;; [(set_attr "length" "2")
  6963. +;; (set_attr "in_delay_slot" "yes")])
  6964. +
  6965. +(define_insn "tstsi"
  6966. + [(set (cc0) (match_operand:SI 0 "register_operand" "r"))]
  6967. + "optimize == 0"
  6968. + "cmp\\t%0,0\\t;tstsi"
  6969. + [(set_attr "length" "2")
  6970. + (set_attr "in_delay_slot" "yes")])
  6971. +
  6972. +;;; CHG K.Watanabe V1.7 <<<<<<<
  6973. +
  6974. +
  6975. +(define_insn "cmpsi"
  6976. + [(set (cc0)
  6977. + (compare (match_operand:SI 0 "register_operand" "r,r,r,r")
  6978. + (match_operand:SI 1 "nonmemory_operand" "r,K,L,n")))]
  6979. + ""
  6980. + "@
  6981. + cmp\\t%0,%1
  6982. + xcmp\\t%0,%1\\t;%v1
  6983. + xcmp\\t%0,%1\\t;%v1
  6984. + xcmp\\t%0,%1\\t;%v1"
  6985. + [(set_attr "length" "2,2,4,6")
  6986. + (set_attr "in_delay_slot" "yes,yes,no,no")])
  6987. +
  6988. +
  6989. +
  6990. +;; ----------------------------------------------------------------------
  6991. +;; ADD INSTRUCTIONS
  6992. +;; ----------------------------------------------------------------------
  6993. +
  6994. +(define_insn "addsi3"
  6995. + [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
  6996. + (plus:SI (match_operand:SI 1 "register_operand" "0,0,0,0")
  6997. + (match_operand:SI 2 "nonmemory_operand" "r,K,L,n")))]
  6998. + ""
  6999. + "*
  7000. +{
  7001. + HOST_WIDE_INT value;
  7002. + switch (which_alternative) {
  7003. + case 0: /* C33: In the case of matching the first restriction.( Add the register value. ) */
  7004. + return \"add\\t%0,%2\";
  7005. + break;
  7006. + case 1: /* C33: In the case of matching the second restriction.( Add the immediate. ) */
  7007. + case 2:
  7008. + case 3:
  7009. + value = INTVAL(operands[2]); /* C33: Take out the value of operand2. */
  7010. + if (value > 0) { /* C33: In the case that operand2 is positive numbers. */
  7011. + return \"xadd\\t%0,%2\\t;%v2\";
  7012. + }
  7013. + else { /* C33: In the case that operand2 is negative numbers. */
  7014. + return \"xsub\\t%0,%n2\\t;%v2\";
  7015. + }
  7016. + break;
  7017. +
  7018. + default:
  7019. + abort();
  7020. + return \"\";
  7021. + }
  7022. +}"
  7023. + [(set_attr "length" "2,2,4,6")
  7024. + (set_attr "type" "other")
  7025. + (set_attr "in_delay_slot" "yes,yes,no,no")])
  7026. +
  7027. +
  7028. +
  7029. +;; ----------------------------------------------------------------------
  7030. +;; SUBTRACT INSTRUCTIONS
  7031. +;; ----------------------------------------------------------------------
  7032. +
  7033. +(define_insn "subsi3"
  7034. + [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
  7035. + (minus:SI (match_operand:SI 1 "register_operand" "0,0,0,0")
  7036. + (match_operand:SI 2 "nonmemory_operand" "r,K,L,n")))]
  7037. + ""
  7038. + "*
  7039. +{
  7040. + HOST_WIDE_INT value;
  7041. + switch (which_alternative) {
  7042. + case 0: /* C33: In the case of matching the first restriction.( Subtract the register value. ) */
  7043. + return \"sub\\t%0,%2\";
  7044. + break;
  7045. + case 1: /* C33: In the case of matching the second restriction.( Subtract the immediate. ) */
  7046. + case 2:
  7047. + case 3:
  7048. + value = INTVAL(operands[2]); /* C33: Take out the value of operand2. */
  7049. + if (value > 0) { /* C33: In the case that operand2 is positive numbers. */
  7050. + return \"xsub\\t%0,%2\\t;%v2\";
  7051. + }
  7052. + else { /* C33: In the case that operand2 is negative numbers. */
  7053. + return \"xadd\\t%0,%n2\\t;%v2\";
  7054. + }
  7055. + break;
  7056. +
  7057. + default:
  7058. + abort();
  7059. + return \"\";
  7060. + }
  7061. +}"
  7062. + [(set_attr "length" "2,2,4,6")
  7063. + (set_attr "type" "other")
  7064. + (set_attr "in_delay_slot" "yes,yes,no,no")])
  7065. +
  7066. +
  7067. +(define_insn "negsi2"
  7068. + [(set (match_operand:SI 0 "register_operand" "=r")
  7069. + (neg:SI (match_operand:SI 1 "register_operand" "r")))]
  7070. + ""
  7071. + "not\\t%0,%1\\t;negsi2\\n\\tadd\\t%0,1"
  7072. +; "not %0,%1; add %0,1\\t#negsi2"
  7073. + [(set_attr "length" "4")])
  7074. +
  7075. +;;; C33: If we have 0 register, we can do above with one struction,
  7076. +;;; but we don't have it, so do this with two instructions.
  7077. +;;; There is the other method that substract %1 after load 0.
  7078. +
  7079. +
  7080. +;; ----------------------------------------------------------------------
  7081. +;; MULTIPLY INSTRUCTIONS
  7082. +;; ----------------------------------------------------------------------
  7083. +
  7084. +;;; DEL K.Watanabe V1.8 >>>>>>>
  7085. +;;; compiler_known_isuues.txt -- No9
  7086. +;;; C33: The definition of "mulqihi3/umulqihi3" which defines 8bit multiplication is not necessary
  7087. +;;; because "mlt" instruction has only 16 bit multiplication and 32 bit multiplication.
  7088. +;;; Delete this definition because char type multiplication in negative numbers is incorrect
  7089. +;;; in the case that this definition is defined.
  7090. +;;;(define_insn "mulqihi3"
  7091. +;;; [(set (match_operand:HI 0 "register_operand" "=r")
  7092. +;;; (mult:HI
  7093. +;;; (sign_extend:HI (match_operand:QI 1 "register_operand" "r"))
  7094. +;;; (sign_extend:HI (match_operand:QI 2 "register_operand" "r"))))]
  7095. +;;; ""
  7096. +;;; "mlt.h\\t%1,%2\\n\\tld.w\\t%0,%%alr\\t; mulqihi3"
  7097. +;;;; "mlt.h %1,%2; ld.w %0,alr\\t# mulqihi3"
  7098. +;;; [(set_attr "length" "4")
  7099. +;;; (set_attr "type" "other")])
  7100. +;;;
  7101. +;;;(define_insn "umulqihi3"
  7102. +;;; [(set (match_operand:HI 0 "register_operand" "=r")
  7103. +;;; (mult:HI
  7104. +;;; (zero_extend:HI (match_operand:QI 1 "register_operand" "r"))
  7105. +;;; (zero_extend:HI (match_operand:QI 2 "register_operand" "r"))))]
  7106. +;;; ""
  7107. +;;; "mltu.h\\t%1,%2\\n\\tld.w\\t%0,%%alr\\t; umulqihi3"
  7108. +;;;; "mltu.h %1,%2; ld.w %0,alr\\t# umulqihi3"
  7109. +;;; [(set_attr "length" "4")
  7110. +;;; (set_attr "type" "other")])
  7111. +;; DEL K.Watanabe V1.8 <<<<<<<
  7112. +
  7113. +
  7114. +(define_insn "mulhisi3"
  7115. + [(set (match_operand:SI 0 "register_operand" "=r")
  7116. + (mult:SI
  7117. + (sign_extend:SI (match_operand:HI 1 "register_operand" "r"))
  7118. + (sign_extend:SI (match_operand:HI 2 "register_operand" "r"))))]
  7119. + ""
  7120. + "mlt.h\\t%1,%2\\n\\tld.w\\t%0,%%alr\\t; mulhisi3"
  7121. +; "mlt.h %1,%2; ld.w %0,alr\\t# mulhisi3"
  7122. + [(set_attr "length" "4")
  7123. + (set_attr "type" "other")])
  7124. +
  7125. +(define_insn "umulhisi3"
  7126. + [(set (match_operand:SI 0 "register_operand" "=r")
  7127. + (mult:SI
  7128. + (zero_extend:SI (match_operand:HI 1 "register_operand" "r"))
  7129. + (zero_extend:SI (match_operand:HI 2 "register_operand" "r"))))]
  7130. + ""
  7131. + "mltu.h\\t%1,%2\\n\\tld.w\\t%0,%%alr\\t; umulhisi3"
  7132. +; "mltu.h %1,%2; ld.w %0,alr\\t# umulhisi3"
  7133. + [(set_attr "length" "4")
  7134. + (set_attr "type" "other")])
  7135. +
  7136. +(define_insn "mulsi3"
  7137. + [(set (match_operand:SI 0 "register_operand" "=r")
  7138. + (mult:SI
  7139. + (match_operand:SI 1 "register_operand" "r")
  7140. + (match_operand:SI 2 "register_operand" "r")))]
  7141. + ""
  7142. + "mlt.w\\t%1,%2\\n\\tld.w\\t%0,%%alr\\t; mulsi3"
  7143. +; "mlt.w %1,%2; ld.w %0,alr\\t# mulsi3"
  7144. + [(set_attr "length" "4")
  7145. + (set_attr "type" "other")])
  7146. +
  7147. +
  7148. +;; ----------------------------------------------------------------------
  7149. +;; AND INSTRUCTIONS
  7150. +;; ----------------------------------------------------------------------
  7151. +
  7152. +(define_insn "andsi3"
  7153. + [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
  7154. + (and:SI (match_operand:SI 1 "register_operand" "0,0,0,0")
  7155. + (match_operand:SI 2 "nonmemory_operand" "r,K,L,n")))]
  7156. + ""
  7157. + "@
  7158. + and\\t%0,%2
  7159. + xand\\t%0,%2\\t;%v2
  7160. + xand\\t%0,%2\\t;%v2
  7161. + xand\\t%0,%2\\t;%v2"
  7162. + [(set_attr "length" "2,2,4,6")
  7163. + (set_attr "type" "other")
  7164. + (set_attr "in_delay_slot" "yes,yes,no,no")])
  7165. +
  7166. +
  7167. +;; ----------------------------------------------------------------------
  7168. +;; OR INSTRUCTIONS
  7169. +;; ----------------------------------------------------------------------
  7170. +
  7171. +(define_insn "iorsi3"
  7172. + [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
  7173. + (ior:SI (match_operand:SI 1 "register_operand" "0,0,0,0")
  7174. + (match_operand:SI 2 "nonmemory_operand" "r,K,L,n")))]
  7175. + ""
  7176. + "@
  7177. + or\\t%0,%2
  7178. + xoor\\t%0,%2\\t;%v2
  7179. + xoor\\t%0,%2\\t;%v2
  7180. + xoor\\t%0,%2\\t;%v2"
  7181. + [(set_attr "length" "2,2,4,6")
  7182. + (set_attr "type" "other")
  7183. + (set_attr "in_delay_slot" "yes,yes,no,no")])
  7184. +
  7185. +
  7186. +;; ----------------------------------------------------------------------
  7187. +;; XOR INSTRUCTIONS
  7188. +;; ----------------------------------------------------------------------
  7189. +
  7190. +(define_insn "xorsi3"
  7191. + [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
  7192. + (xor:SI (match_operand:SI 1 "register_operand" "0,0,0,0")
  7193. + (match_operand:SI 2 "nonmemory_operand" "r,K,L,n")))]
  7194. + ""
  7195. + "@
  7196. + xor\\t%0,%2
  7197. + xxor\\t%0,%2\\t;%v2
  7198. + xxor\\t%0,%2\\t;%v2
  7199. + xxor\\t%0,%2\\t;%v2"
  7200. + [(set_attr "length" "2,2,4,6")
  7201. + (set_attr "type" "other")
  7202. + (set_attr "in_delay_slot" "yes,yes,no,no")])
  7203. +
  7204. +
  7205. +;; ----------------------------------------------------------------------
  7206. +;; NOT INSTRUCTIONS
  7207. +;; ----------------------------------------------------------------------
  7208. +
  7209. +(define_insn "one_cmplsi2"
  7210. + [(set (match_operand:SI 0 "register_operand" "=r")
  7211. + (not:SI (match_operand:SI 1 "register_operand" "r")))]
  7212. + ""
  7213. + "not %0,%1"
  7214. + [(set_attr "length" "2")
  7215. + (set_attr "in_delay_slot" "yes")])
  7216. +
  7217. + /* C33: Do not define logic negative of the immediate,
  7218. + because it is solved at the time of compiling. */
  7219. +
  7220. +
  7221. +;; -----------------------------------------------------------------
  7222. +;; BIT FIELDS
  7223. +;; -----------------------------------------------------------------
  7224. +
  7225. +/* C33: Unnecessary in C33. */
  7226. +
  7227. +;; -----------------------------------------------------------------
  7228. +;; Scc INSTRUCTIONS
  7229. +;; -----------------------------------------------------------------
  7230. +
  7231. +/* C33: Do not define "Scc" in C33 because C33 do not have the instruction
  7232. + which sets the value accroding to the condition judgment. */
  7233. +
  7234. +;; -----------------------------------------------------------------
  7235. +;; C33: BIT OPERATION INSTRUCTIONS
  7236. +;; -----------------------------------------------------------------
  7237. +
  7238. +(define_peephole
  7239. + [(set (match_operand:QI 0 "register_operand" "=r")
  7240. + (match_operand:QI 1 "memory_operand" "m"))
  7241. + (set (match_operand:SI 2 "register_operand" "=r")
  7242. + (and:SI (match_operand:SI 3 "register_operand" "r")
  7243. + (match_operand:SI 4 "const_int_operand" "n")))
  7244. + (set (cc0) (match_operand:SI 5 "register_operand" "r"))]
  7245. +
  7246. + "/* C33: The registers must not be used in the future. */
  7247. + dead_or_set_p (insn, operands[0])
  7248. + && dead_or_set_p (insn, operands[2])
  7249. + /* C33: The registers for the process must be the same. */
  7250. + && (REGNO(operands[0]) == REGNO(operands[2]))
  7251. + && (REGNO(operands[0]) == REGNO(operands[5]))
  7252. + /* C33: Operation object must be 1bit. */
  7253. + && (GET_CODE(operands[4]) == CONST_INT)
  7254. + && ((INTVAL(operands[4]) == 0x01) || (INTVAL(operands[4]) == 0x02)
  7255. + || (INTVAL(operands[4]) == 0x04) || (INTVAL(operands[4]) == 0x08)
  7256. + || (INTVAL(operands[4]) == 0x10) || (INTVAL(operands[4]) == 0x20)
  7257. + || (INTVAL(operands[4]) == 0x40) || (INTVAL(operands[4]) == 0x80)
  7258. + || (INTVAL(operands[4]) == 0xffffff80))
  7259. + /* C33: The memory reference must not be %sp indirect. */
  7260. + && !((GET_CODE(XEXP(operands[1], 0)) == PLUS)
  7261. + && (REGNO(XEXP(XEXP(operands[1], 0), 0)) == STACK_POINTER_REGNUM))
  7262. + && !((GET_CODE(XEXP(operands[1], 0)) == REG)
  7263. + && (REGNO(XEXP(operands[1], 0)) == STACK_POINTER_REGNUM))
  7264. + /* C33: The reference destination must not be defaut data area in the case of Advanced mode. */
  7265. + && !(TARGET_C33ADV
  7266. + && (GET_CODE(XEXP(operands[1], 0)) == SYMBOL_REF)
  7267. + && (!ENCODED_NAME_P(XSTR(XEXP(operands[1], 0), 0))))
  7268. + && !(TARGET_C33ADV
  7269. + && (GET_CODE(XEXP(operands[1], 0)) == CONST)
  7270. + && (!ENCODED_NAME_P(XSTR(XEXP(XEXP(XEXP(operands[1], 0), 0), 0), 0))))"
  7271. + "* return output_btst (operands);")
  7272. +
  7273. +
  7274. +(define_peephole
  7275. + [(set (match_operand:QI 0 "register_operand" "=r")
  7276. + (match_operand:QI 1 "memory_operand" "m"))
  7277. + (set (match_operand:SI 2 "register_operand" "=r")
  7278. + (and:SI (match_operand:SI 3 "register_operand" "r")
  7279. + (match_operand:SI 4 "const_int_operand" "n")))
  7280. + (set (match_dup 1)
  7281. + (match_operand:QI 5 "register_operand" "r"))]
  7282. +
  7283. + "/* C33: The registers must not be used in the future. */
  7284. + dead_or_set_p (insn, operands[0])
  7285. + && dead_or_set_p (insn, operands[2])
  7286. + /* C33: The registers for the process must be the same. */
  7287. + && (REGNO(operands[0]) == REGNO(operands[2]))
  7288. + && (REGNO(operands[0]) == REGNO(operands[5]))
  7289. + /* C33: Operation object must be 1bit. */
  7290. + && (GET_CODE(operands[4]) == CONST_INT)
  7291. + && (((INTVAL(operands[4]) & 0xff) == 0xfe)
  7292. + || ((INTVAL(operands[4]) & 0xff) == 0xfd)
  7293. + || ((INTVAL(operands[4]) & 0xff) == 0xfb)
  7294. + || ((INTVAL(operands[4]) & 0xff) == 0xf7)
  7295. + || ((INTVAL(operands[4]) & 0xff) == 0xef)
  7296. + || ((INTVAL(operands[4]) & 0xff) == 0xdf)
  7297. + || ((INTVAL(operands[4]) & 0xff) == 0xbf)
  7298. + || ((INTVAL(operands[4]) & 0xff) == 0x7f))
  7299. + /* C33: The memory reference must not be %sp indirect. */
  7300. + && !((GET_CODE(XEXP(operands[1], 0)) == PLUS)
  7301. + && (REGNO(XEXP(XEXP(operands[1], 0), 0)) == STACK_POINTER_REGNUM))
  7302. + && !((GET_CODE(XEXP(operands[1], 0)) == REG)
  7303. + && (REGNO(XEXP(operands[1], 0)) == STACK_POINTER_REGNUM))
  7304. + /* C33: The reference destination must not be defaut data area in the case of Advanced mode. */
  7305. + && !(TARGET_C33ADV
  7306. + && (GET_CODE(XEXP(operands[1], 0)) == SYMBOL_REF)
  7307. + && (!ENCODED_NAME_P(XSTR(XEXP(operands[1], 0), 0))))
  7308. + && !(TARGET_C33ADV
  7309. + && (GET_CODE(XEXP(operands[1], 0)) == CONST)
  7310. + && (!ENCODED_NAME_P(XSTR(XEXP(XEXP(XEXP(operands[1], 0), 0), 0), 0))))"
  7311. + "* return output_bclr (operands);")
  7312. +
  7313. +
  7314. +(define_peephole
  7315. + [(set (match_operand:QI 0 "register_operand" "=r")
  7316. + (match_operand:QI 1 "memory_operand" "m"))
  7317. + (set (match_operand:SI 2 "register_operand" "=r")
  7318. + (ior:SI (match_operand:SI 3 "register_operand" "r")
  7319. + (match_operand:SI 4 "const_int_operand" "n")))
  7320. + (set (match_dup 1)
  7321. + (match_operand:QI 5 "register_operand" "r"))]
  7322. +
  7323. + "/* C33: The registers must not be used in the future. */
  7324. + dead_or_set_p (insn, operands[0])
  7325. + && dead_or_set_p (insn, operands[2])
  7326. + /* C33: The registers for the process must be the same. */
  7327. + && (REGNO(operands[0]) == REGNO(operands[2]))
  7328. + && (REGNO(operands[0]) == REGNO(operands[5]))
  7329. + /* C33: Operation object must be 1bit. */
  7330. + && (GET_CODE(operands[4]) == CONST_INT)
  7331. + && (((INTVAL(operands[4]) & 0xff) == 0x01)
  7332. + || ((INTVAL(operands[4]) & 0xff) == 0x02)
  7333. + || ((INTVAL(operands[4]) & 0xff) == 0x04)
  7334. + || ((INTVAL(operands[4]) & 0xff) == 0x08)
  7335. + || ((INTVAL(operands[4]) & 0xff) == 0x10)
  7336. + || ((INTVAL(operands[4]) & 0xff) == 0x20)
  7337. + || ((INTVAL(operands[4]) & 0xff) == 0x40)
  7338. + || ((INTVAL(operands[4]) & 0xff) == 0x80))
  7339. + /* C33: The memory reference must not be %sp indirect. */
  7340. + && !((GET_CODE(XEXP(operands[1], 0)) == PLUS)
  7341. + && (REGNO(XEXP(XEXP(operands[1], 0), 0)) == STACK_POINTER_REGNUM))
  7342. + && !((GET_CODE(XEXP(operands[1], 0)) == REG)
  7343. + && (REGNO(XEXP(operands[1], 0)) == STACK_POINTER_REGNUM))
  7344. + /* C33: The reference destination must not be defaut data area in the case of Advanced mode. */
  7345. + && !(TARGET_C33ADV
  7346. + && (GET_CODE(XEXP(operands[1], 0)) == SYMBOL_REF)
  7347. + && (!ENCODED_NAME_P(XSTR(XEXP(operands[1], 0), 0))))
  7348. + && !(TARGET_C33ADV
  7349. + && (GET_CODE(XEXP(operands[1], 0)) == CONST)
  7350. + && (!ENCODED_NAME_P(XSTR(XEXP(XEXP(XEXP(operands[1], 0), 0), 0), 0))))"
  7351. + "* return output_bset (operands);")
  7352. +
  7353. +
  7354. +;; ----------------------------------------------------------------------
  7355. +;; JUMP INSTRUCTIONS
  7356. +;; ----------------------------------------------------------------------
  7357. +
  7358. +;; Conditional jump instructions
  7359. +
  7360. +(define_expand "ble"
  7361. + [(set (pc)
  7362. + (if_then_else (le (cc0)
  7363. + (const_int 0))
  7364. + (label_ref (match_operand 0 "" ""))
  7365. + (pc)))]
  7366. + ""
  7367. + "")
  7368. +
  7369. +(define_expand "bleu"
  7370. + [(set (pc)
  7371. + (if_then_else (leu (cc0)
  7372. + (const_int 0))
  7373. + (label_ref (match_operand 0 "" ""))
  7374. + (pc)))]
  7375. + ""
  7376. + "")
  7377. +
  7378. +(define_expand "bge"
  7379. + [(set (pc)
  7380. + (if_then_else (ge (cc0)
  7381. + (const_int 0))
  7382. + (label_ref (match_operand 0 "" ""))
  7383. + (pc)))]
  7384. + ""
  7385. + "")
  7386. +
  7387. +(define_expand "bgeu"
  7388. + [(set (pc)
  7389. + (if_then_else (geu (cc0)
  7390. + (const_int 0))
  7391. + (label_ref (match_operand 0 "" ""))
  7392. + (pc)))]
  7393. + ""
  7394. + "")
  7395. +
  7396. +(define_expand "blt"
  7397. + [(set (pc)
  7398. + (if_then_else (lt (cc0)
  7399. + (const_int 0))
  7400. + (label_ref (match_operand 0 "" ""))
  7401. + (pc)))]
  7402. + ""
  7403. + "")
  7404. +
  7405. +(define_expand "bltu"
  7406. + [(set (pc)
  7407. + (if_then_else (ltu (cc0)
  7408. + (const_int 0))
  7409. + (label_ref (match_operand 0 "" ""))
  7410. + (pc)))]
  7411. + ""
  7412. + "")
  7413. +
  7414. +(define_expand "bgt"
  7415. + [(set (pc)
  7416. + (if_then_else (gt (cc0)
  7417. + (const_int 0))
  7418. + (label_ref (match_operand 0 "" ""))
  7419. + (pc)))]
  7420. + ""
  7421. + "")
  7422. +
  7423. +(define_expand "bgtu"
  7424. + [(set (pc)
  7425. + (if_then_else (gtu (cc0)
  7426. + (const_int 0))
  7427. + (label_ref (match_operand 0 "" ""))
  7428. + (pc)))]
  7429. + ""
  7430. + "")
  7431. +
  7432. +(define_expand "beq"
  7433. + [(set (pc)
  7434. + (if_then_else (eq (cc0)
  7435. + (const_int 0))
  7436. + (label_ref (match_operand 0 "" ""))
  7437. + (pc)))]
  7438. + ""
  7439. + "")
  7440. +
  7441. +(define_expand "bne"
  7442. + [(set (pc)
  7443. + (if_then_else (ne (cc0)
  7444. + (const_int 0))
  7445. + (label_ref (match_operand 0 "" ""))
  7446. + (pc)))]
  7447. + ""
  7448. + "")
  7449. +
  7450. +/* C33: The conditional branch is the same to V850 so far. */
  7451. +
  7452. +(define_insn "*branch_normal"
  7453. + [(set (pc)
  7454. + (if_then_else (match_operator 1 "comparison_operator"
  7455. + [(cc0) (const_int 0)])
  7456. + (label_ref (match_operand 0 "" ""))
  7457. + (pc)))]
  7458. + ""
  7459. + "*
  7460. +{
  7461. + if (get_attr_length (insn) == 2)
  7462. + return \"jr%b1%#\\t%l0\";
  7463. + else if (get_attr_length (insn) == 4)
  7464. + /* return \"ext %l0@rm\; jr%b1%# %l0@rl\"; */
  7465. + return \"sjr%b1%#\\t%l0\";
  7466. + else
  7467. + /* return \"ext %l0@rh\; ext %l0@rm\; jr%b1%# %l0@rl\"; */
  7468. + return \"xjr%b1%#\\t%l0\";
  7469. +}"
  7470. + [(set_attr "type" "branch")
  7471. + (set_attr "needs_delay_slot" "yes")])
  7472. +
  7473. +
  7474. +(define_insn "*branch_invert"
  7475. + [(set (pc)
  7476. + (if_then_else (match_operator 1 "comparison_operator"
  7477. + [(cc0) (const_int 0)])
  7478. + (pc)
  7479. + (label_ref (match_operand 0 "" ""))))]
  7480. + ""
  7481. + "*
  7482. +{
  7483. + if (get_attr_length (insn) == 2)
  7484. + return \"jr%B1%#\\t%l0\";
  7485. + else if (get_attr_length (insn) == 4)
  7486. + /* return \"ext %l0@rm\; jr%B1%# %l0@rl\"; */
  7487. + return \"sjr%B1%#\\t%l0\";
  7488. + else
  7489. + /* return \"ext %l0@rh\; ext %l0@rm\; jr%B1%# %l0@rl\"; */
  7490. + return \"xjr%B1%#\\t%l0\";
  7491. +}"
  7492. + [(set_attr "type" "branch")
  7493. + (set_attr "needs_delay_slot" "yes")])
  7494. +
  7495. +
  7496. +;; Unconditional and other jump instructions.
  7497. +
  7498. +(define_insn "jump"
  7499. + [(set (pc)
  7500. + (label_ref (match_operand 0 "" "")))]
  7501. + ""
  7502. + "*
  7503. +{
  7504. + if (get_attr_length (insn) == 2)
  7505. + return \"jp%#\\t%l0\";
  7506. + else if (get_attr_length (insn) == 4)
  7507. + /* return \"ext %l0@rm\; jp%# %l0@rl\"; */
  7508. + return \"sjp%#\\t%l0\";
  7509. + else
  7510. + /* return \"ext %l0@rh\; ext %l0@rm\; jp%# %l0@rl\"; */
  7511. + return \"xjp%#\\t%l0\";
  7512. +}"
  7513. + [(set_attr "type" "branch")
  7514. + (set_attr "needs_delay_slot" "yes")])
  7515. +
  7516. +
  7517. +(define_insn "indirect_jump"
  7518. + [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
  7519. + ""
  7520. + "jp%#\\t%0"
  7521. + [(set_attr "length" "2")
  7522. + (set_attr "needs_delay_slot" "yes")])
  7523. +
  7524. +
  7525. +(define_insn "tablejump"
  7526. + [(set (pc) (match_operand:SI 0 "register_operand" "r"))
  7527. + (use (label_ref (match_operand 1 "" "")))]
  7528. + ""
  7529. + "jp%#\\t%0"
  7530. + [(set_attr "length" "2")
  7531. + (set_attr "needs_delay_slot" "yes")])
  7532. +
  7533. +
  7534. +;; Call subroutine with no return value.
  7535. +
  7536. +(define_expand "call"
  7537. + [(call (match_operand:QI 0 "general_operand" "")
  7538. + (match_operand:SI 1 "general_operand" ""))]
  7539. + ""
  7540. + "
  7541. +{
  7542. + /* CHG K.Watanabe V1.7 >>>>>>> */
  7543. +/* if (! call_address_operand (XEXP (operands[0], 0))) */
  7544. + if (! call_address_operand (XEXP (operands[0], 0),QImode))
  7545. + /* CHG K.Watanabe V1.7 <<<<<<< */
  7546. +
  7547. + XEXP (operands[0], 0) = force_reg (SImode, XEXP (operands[0], 0));
  7548. + if (TARGET_LONG_CALLS)
  7549. + emit_call_insn (gen_call_internal_long (XEXP (operands[0], 0), operands[1]));
  7550. + else
  7551. + emit_call_insn (gen_call_internal_short (XEXP (operands[0], 0), operands[1]));
  7552. + DONE;
  7553. +}")
  7554. +
  7555. +
  7556. +;; C33: Define the follwing lines in c33.c.
  7557. +;; call_address_operand()
  7558. +;; {
  7559. +;; return (GET_CODE(op) == SYMBOL_REF || GET_CODE(op) == REG);
  7560. +;; }
  7561. +
  7562. +(define_insn "call_internal_short"
  7563. + [(call (mem:QI (match_operand:SI 0 "call_address_operand" "S,r"))
  7564. + (match_operand:SI 1 "general_operand" "g,g"))]
  7565. + "! TARGET_LONG_CALLS"
  7566. + "@
  7567. + scall%#\\t%0
  7568. + call%#\\t%0"
  7569. + [(set_attr "length" "4,2")
  7570. + (set_attr "needs_delay_slot" "yes")])
  7571. +
  7572. +(define_insn "call_internal_long"
  7573. + [(call (mem:QI (match_operand:SI 0 "call_address_operand" "S,r"))
  7574. + (match_operand:SI 1 "general_operand" "g,g"))]
  7575. + "TARGET_LONG_CALLS"
  7576. + "@
  7577. + xcall%#\\t%0
  7578. + call%#\\t%0"
  7579. + [(set_attr "length" "6,2")
  7580. + (set_attr "needs_delay_slot" "yes")])
  7581. +
  7582. +
  7583. +;; Call subroutine, returning value in operand 0
  7584. +;; (which must be a hard register).
  7585. +
  7586. +(define_expand "call_value"
  7587. + [(set (match_operand 0 "" "")
  7588. + (call (match_operand:QI 1 "general_operand" "")
  7589. + (match_operand:SI 2 "general_operand" "")))]
  7590. + ""
  7591. + "
  7592. +{
  7593. + /* CHG K.Watanabe V1.7 >>>>>>> */
  7594. +/* if (! call_address_operand (XEXP (operands[1], 0))) */
  7595. + if (! call_address_operand (XEXP (operands[1], 0),QImode))
  7596. + /* CHG K.Watanabe V1.7 <<<<<<< */
  7597. +
  7598. + XEXP (operands[1], 0) = force_reg (SImode, XEXP (operands[1], 0));
  7599. + if (TARGET_LONG_CALLS)
  7600. + emit_call_insn (gen_call_value_internal_long (operands[0],
  7601. + XEXP (operands[1], 0),
  7602. + operands[2]));
  7603. + else
  7604. + emit_call_insn (gen_call_value_internal_short (operands[0],
  7605. + XEXP (operands[1], 0),
  7606. + operands[2]));
  7607. + DONE;
  7608. +}")
  7609. +
  7610. +(define_insn "call_value_internal_short"
  7611. + [(set (match_operand 0 "" "=r,r")
  7612. + (call (mem:QI (match_operand:SI 1 "call_address_operand" "S,r"))
  7613. + (match_operand:SI 2 "general_operand" "g,g")))]
  7614. + "! TARGET_LONG_CALLS"
  7615. + "@
  7616. + scall%#\\t%1
  7617. + call%#\\t%1"
  7618. + [(set_attr "length" "4,2")
  7619. + (set_attr "needs_delay_slot" "yes")])
  7620. +
  7621. +(define_insn "call_value_internal_long"
  7622. + [(set (match_operand 0 "" "=r,r")
  7623. + (call (mem:QI (match_operand:SI 1 "call_address_operand" "S,r"))
  7624. + (match_operand:SI 2 "general_operand" "g,g")))]
  7625. + "TARGET_LONG_CALLS"
  7626. + "@
  7627. + xcall%#\\t%1
  7628. + call%#\\t%1"
  7629. + [(set_attr "length" "6,2")
  7630. + (set_attr "needs_delay_slot" "yes")])
  7631. +
  7632. +
  7633. +(define_insn "nop"
  7634. + [(const_int 0)]
  7635. + ""
  7636. + "nop"
  7637. + [(set_attr "length" "2")
  7638. + (set_attr "in_delay_slot" "yes")])
  7639. +
  7640. +;; ----------------------------------------------------------------------
  7641. +;; EXTEND INSTRUCTIONS
  7642. +;; ----------------------------------------------------------------------
  7643. +
  7644. +(define_insn "zero_extendhisi2"
  7645. + [(set (match_operand:SI 0 "register_operand" "=r,r")
  7646. + (zero_extend:SI
  7647. + (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
  7648. + ""
  7649. + "* return output_move_single (operands, TRUE);"
  7650. + [(set_attr "length" "2,6")
  7651. + (set_attr "type" "other,load")
  7652. + (set_attr "in_delay_slot" "yes,no")])
  7653. +
  7654. +
  7655. +(define_insn "zero_extendqisi2"
  7656. + [(set (match_operand:SI 0 "register_operand" "=r,r")
  7657. + (zero_extend:SI
  7658. + (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
  7659. + ""
  7660. + "* return output_move_single (operands, TRUE);"
  7661. + [(set_attr "length" "2,6")
  7662. + (set_attr "type" "other,load")
  7663. + (set_attr "in_delay_slot" "yes,no")])
  7664. +
  7665. +
  7666. +;;- sign extension instructions
  7667. +(define_insn "extendhisi2"
  7668. + [(set (match_operand:SI 0 "register_operand" "=r,r")
  7669. + (sign_extend:SI
  7670. + (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
  7671. + ""
  7672. + "* return output_move_single (operands, FALSE);"
  7673. + [(set_attr "length" "2,6")
  7674. + (set_attr "type" "other,load")
  7675. + (set_attr "in_delay_slot" "yes,no")])
  7676. +
  7677. +
  7678. +(define_insn "extendqisi2"
  7679. + [(set (match_operand:SI 0 "register_operand" "=r,r")
  7680. + (sign_extend:SI
  7681. + (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
  7682. + ""
  7683. + "* return output_move_single (operands, FALSE);"
  7684. + [(set_attr "length" "2,6")
  7685. + (set_attr "type" "other,load")
  7686. + (set_attr "in_delay_slot" "yes,no")])
  7687. +
  7688. +
  7689. +;; ----------------------------------------------------------------------
  7690. +;; SHIFTS
  7691. +;; ----------------------------------------------------------------------
  7692. +
  7693. +(define_expand "rotlsi3"
  7694. + [(set (match_operand:SI 0 "register_operand" "")
  7695. + (rotate:SI (match_operand:SI 1 "register_operand" "")
  7696. + (match_operand:QI 2 "nonmemory_operand" "")))]
  7697. + ""
  7698. + "if (expand_a_shift (SImode, ROTATE, operands)) DONE;else FAIL;")
  7699. +
  7700. +(define_insn "rotlsi3_c33"
  7701. + [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
  7702. + (rotate:SI (match_operand:SI 1 "register_operand" "0,0,0,0,0")
  7703. + (match_operand:QI 2 "nonmemory_operand" "r,M,N,O,n")))
  7704. + (clobber (match_scratch:QI 3 "=&r,X,X,X,X"))]
  7705. + "!TARGET_C33ADV && !TARGET_C33PE"
  7706. + "* return emit_a_shift (ROTATE, operands);"
  7707. + [(set_attr "length" "16,2,4,4,2")
  7708. + (set_attr "in_delay_slot" "no,yes,no,no,yes")])
  7709. +
  7710. +(define_insn "rotlsi3_c33adv"
  7711. + [(set (match_operand:SI 0 "register_operand" "=r,r")
  7712. + (rotate:SI (match_operand:SI 1 "register_operand" "0,0")
  7713. + (match_operand:QI 2 "nonmemory_operand" "r,n")))]
  7714. + "TARGET_C33ADV || TARGET_C33PE"
  7715. + "@
  7716. + rl %0,%2
  7717. + rl %0,%2"
  7718. + [(set_attr "length" "2,2")
  7719. + (set_attr "in_delay_slot" "yes,yes")])
  7720. +
  7721. +
  7722. +(define_expand "rotrsi3"
  7723. + [(set (match_operand:SI 0 "register_operand" "")
  7724. + (rotatert:SI (match_operand:SI 1 "register_operand" "")
  7725. + (match_operand:QI 2 "nonmemory_operand" "")))]
  7726. + ""
  7727. + "if (expand_a_shift (SImode, ROTATERT, operands)) DONE;else FAIL;")
  7728. +
  7729. +(define_insn "rotrsi3_c33"
  7730. + [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
  7731. + (rotatert:SI (match_operand:SI 1 "register_operand" "0,0,0,0,0")
  7732. + (match_operand:QI 2 "nonmemory_operand" "r,M,N,O,n")))
  7733. + (clobber (match_scratch:QI 3 "=&r,X,X,X,X"))]
  7734. + "!TARGET_C33ADV && !TARGET_C33PE"
  7735. + "* return emit_a_shift (ROTATERT, operands);"
  7736. + [(set_attr "length" "16,2,4,4,2")
  7737. + (set_attr "in_delay_slot" "no,yes,no,no,yes")])
  7738. +
  7739. +(define_insn "rotrsi3_c33adv"
  7740. + [(set (match_operand:SI 0 "register_operand" "=r,r")
  7741. + (rotatert:SI (match_operand:SI 1 "register_operand" "0,0")
  7742. + (match_operand:QI 2 "nonmemory_operand" "r,n")))]
  7743. + "TARGET_C33ADV || TARGET_C33PE"
  7744. + "@
  7745. + rr %0,%2
  7746. + rr %0,%2"
  7747. + [(set_attr "length" "2,2")
  7748. + (set_attr "in_delay_slot" "yes,yes")])
  7749. +
  7750. +
  7751. +/* C33: Arithmetical shift to left.
  7752. + ( The instruction output actually is logical shift instruction "sll" ) */
  7753. +(define_expand "ashlsi3"
  7754. + [(set (match_operand:SI 0 "register_operand" "")
  7755. + (ashift:SI (match_operand:SI 1 "register_operand" "")
  7756. + (match_operand:QI 2 "nonmemory_operand" "")))]
  7757. + ""
  7758. + "if (expand_a_shift (SImode, ASHIFT, operands)) DONE;else FAIL;")
  7759. +
  7760. +(define_insn "ashlsi3_c33"
  7761. + [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r")
  7762. + (ashift:SI (match_operand:SI 1 "register_operand" "0,0,0,0,0,0")
  7763. + (match_operand:QI 2 "nonmemory_operand" "r,M,N,O,P,n")))
  7764. + (clobber (match_scratch:QI 3 "=&r,X,X,X,X,X"))]
  7765. + "!TARGET_C33ADV && !TARGET_C33PE"
  7766. + "* return emit_a_shift (ASHIFT, operands);"
  7767. + [(set_attr "length" "16,2,4,6,8,4")
  7768. + (set_attr "in_delay_slot" "no,yes,no,no,no,no")])
  7769. +
  7770. +(define_insn "ashlsi3_c33adv"
  7771. + [(set (match_operand:SI 0 "register_operand" "=r,r")
  7772. + (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
  7773. + (match_operand:QI 2 "nonmemory_operand" "r,n")))]
  7774. + "TARGET_C33ADV || TARGET_C33PE"
  7775. + "@
  7776. + sll %0,%2
  7777. + sll %0,%2"
  7778. + [(set_attr "length" "2,2")
  7779. + (set_attr "in_delay_slot" "yes,yes")])
  7780. +
  7781. +
  7782. +/* C33: Logical shift to right.
  7783. + ( The instruction output actually is logical shift instruction "srl" ) */
  7784. +(define_expand "lshrsi3"
  7785. + [(set (match_operand:SI 0 "register_operand" "")
  7786. + (lshiftrt:SI (match_operand:SI 1 "register_operand" "")
  7787. + (match_operand:QI 2 "nonmemory_operand" "")))]
  7788. + ""
  7789. + "if (expand_a_shift (SImode, LSHIFTRT, operands)) DONE;else FAIL;")
  7790. +
  7791. +(define_insn "lshrsi3_c33"
  7792. + [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r")
  7793. + (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0,0,0,0,0")
  7794. + (match_operand:QI 2 "nonmemory_operand" "r,M,N,O,P,n")))
  7795. + (clobber (match_scratch:QI 3 "=&r,X,X,X,X,X"))]
  7796. + "!TARGET_C33ADV && !TARGET_C33PE"
  7797. + "* return emit_a_shift (LSHIFTRT, operands);"
  7798. + [(set_attr "length" "16,2,4,6,8,4")
  7799. + (set_attr "in_delay_slot" "no,yes,no,no,no,no")])
  7800. +
  7801. +(define_insn "lshrsi3_c33adv"
  7802. + [(set (match_operand:SI 0 "register_operand" "=r,r")
  7803. + (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
  7804. + (match_operand:QI 2 "nonmemory_operand" "r,n")))]
  7805. + "TARGET_C33ADV || TARGET_C33PE"
  7806. + "@
  7807. + srl %0,%2
  7808. + srl %0,%2"
  7809. + [(set_attr "length" "2,2")
  7810. + (set_attr "in_delay_slot" "yes,yes")])
  7811. +
  7812. +
  7813. +/* C33: Arithmetical shift to right.
  7814. + ( The instruction output actually is arithmetical shift instruction "sra" ) */
  7815. +(define_expand "ashrsi3"
  7816. + [(set (match_operand:SI 0 "register_operand" "")
  7817. + (ashiftrt:SI (match_operand:SI 1 "register_operand" "")
  7818. + (match_operand:QI 2 "nonmemory_operand" "")))]
  7819. + ""
  7820. + "if (expand_a_shift (SImode, ASHIFTRT, operands)) DONE;else FAIL;")
  7821. +
  7822. +(define_insn "ashrsi3_c33"
  7823. + [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
  7824. + (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0,0,0,0")
  7825. + (match_operand:QI 2 "nonmemory_operand" "r,M,N,O,n")))
  7826. + (clobber (match_scratch:QI 3 "=&r,X,X,X,X"))]
  7827. + "!TARGET_C33ADV && !TARGET_C33PE"
  7828. + "* return emit_a_shift (ASHIFTRT, operands);"
  7829. + [(set_attr "length" "16,2,4,6,8")
  7830. + (set_attr "in_delay_slot" "no,yes,no,no,no")])
  7831. +
  7832. +(define_insn "ashrsi3_c33adv"
  7833. + [(set (match_operand:SI 0 "register_operand" "=r,r")
  7834. + (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
  7835. + (match_operand:QI 2 "nonmemory_operand" "r,n")))]
  7836. + "TARGET_C33ADV || TARGET_C33PE"
  7837. + "@
  7838. + sra %0,%2
  7839. + sra %0,%2"
  7840. + [(set_attr "length" "2,2")
  7841. + (set_attr "in_delay_slot" "yes,yes")])
  7842. +
  7843. +
  7844. +
  7845. +;; Block moves, see c33.c for more details.
  7846. +;; Argument 0 is the destination
  7847. +;; Argument 1 is the source
  7848. +;; Argument 2 is the length
  7849. +;; Argument 3 is the alignment
  7850. +
  7851. +;; C33: Besed on mips.
  7852. +
  7853. +(define_expand "movstrsi"
  7854. + [(parallel [(set (match_operand:BLK 0 "general_operand" "")
  7855. + (match_operand:BLK 1 "general_operand" ""))
  7856. + (use (match_operand:SI 2 "const_int_operand" ""))
  7857. + (use (match_operand:SI 3 "const_int_operand" ""))])]
  7858. + ""
  7859. + "
  7860. +{
  7861. + if (operands[0]) /* avoid unused code messages */
  7862. + {
  7863. + expand_block_move (operands);
  7864. + DONE;
  7865. + }
  7866. +}")
  7867. +
  7868. +;; Insn generated by block moves
  7869. +
  7870. +;;; CHG K.Watanabe V1.7 >>>>>>>
  7871. +;;;; C33: "register_operand" shall not be "r" but be "+r".
  7872. +;;;; Because the value of "destination/ source" is rewritten in "output_block_move()".
  7873. +
  7874. +;;(define_insn "movstrsi_internal"
  7875. +;; [(set (mem:BLK (match_operand:SI 0 "register_operand" "r")) ;; destination
  7876. +;; (mem:BLK (match_operand:SI 1 "register_operand" "r"))) ;; source
  7877. +;; (clobber (match_dup 0)) ;; destination
  7878. +;; (clobber (match_dup 1)) ;; source
  7879. +;; (clobber (match_scratch:SI 4 "=&r")) ;; temp 1
  7880. +;; (clobber (match_scratch:SI 5 "=&r")) ;; temp 2
  7881. +;; (clobber (match_scratch:SI 6 "=&r")) ;; temp 3
  7882. +;; (clobber (match_scratch:SI 7 "=&r")) ;; temp 4
  7883. +;; (use (match_operand:SI 2 "const_int_operand" "")) ;; # bytes to move
  7884. +;; (use (match_operand:SI 3 "const_int_operand" "")) ;; alignment
  7885. +;; (use (const_int 0))] ;; normal block move
  7886. +;; ""
  7887. +;; "* return output_block_move (insn, operands, 4);"
  7888. +;; [(set_attr "length" "20")])
  7889. +
  7890. +(define_insn "movstrsi_internal"
  7891. + [(set (mem:BLK (match_operand:SI 0 "register_operand" "+r")) ;; destination
  7892. + (mem:BLK (match_operand:SI 1 "register_operand" "+r"))) ;; source
  7893. + (clobber (match_dup 0)) ;; destination
  7894. + (clobber (match_dup 1)) ;; source
  7895. + (clobber (match_scratch:SI 4 "=&r")) ;; temp 1
  7896. + (clobber (match_scratch:SI 5 "=&r")) ;; temp 2
  7897. + (clobber (match_scratch:SI 6 "=&r")) ;; temp 3
  7898. + (clobber (match_scratch:SI 7 "=&r")) ;; temp 4
  7899. + (use (match_operand:SI 2 "const_int_operand" "")) ;; # bytes to move
  7900. + (use (match_operand:SI 3 "const_int_operand" "")) ;; alignment
  7901. + (use (const_int 0))] ;; normal block move
  7902. + ""
  7903. + "* return output_block_move (insn, operands, 4);"
  7904. + [(set_attr "length" "20")])
  7905. +;;; CHG K.Watanabe V1.7 <<<<<<<
  7906. +
  7907. +
  7908. +
  7909. +;; ide 2000.10.4 Added
  7910. +;; C33: "peephole" for reducing ext by replacing "shift/and".
  7911. +;; watanabe 2001.12.28
  7912. +;; The following definition is for ASHIFT( shift to left ).
  7913. +;; Another definiton is necessary for shift to right.
  7914. +
  7915. +(define_peephole
  7916. + [(parallel [
  7917. + (set (match_operand:SI 0 "register_operand" "")
  7918. + (match_operator:SI 3 "nshift_operator"
  7919. + [(match_operand:SI 1 "register_operand" "0")
  7920. + (match_operand:QI 2 "const_int_operand" "n")]))
  7921. + (clobber (scratch:QI))])
  7922. + (set (match_operand:SI 4 "register_operand" "r")
  7923. + (and:SI (match_operand:SI 5 "register_operand" "%0")
  7924. + (match_operand:SI 6 "nonmemory_operand" "n")))
  7925. +]
  7926. +
  7927. + "
  7928. + /* C33: The registers for the process must be the same. */
  7929. + (REGNO(operands[0]) == REGNO(operands[4]))
  7930. + /* C33: Shift to left. */
  7931. + && (GET_CODE(operands[3]) == ASHIFT)
  7932. + /* C33: The bit position before shifting is less than sign19
  7933. + and the bit position after shifting is sign19 or more.
  7934. + Or the bit position before shifting is less than sign6
  7935. + and the bit position after shifting is sign6 or more. */
  7936. + && (
  7937. + (((unsigned) (INTVAL(operands[6]) >> INTVAL(operands[2])) + 0x40000 < 0x80000)
  7938. + && ((unsigned) (INTVAL(operands[6])) + 0x40000 >= 0x80000))
  7939. + ||(((unsigned) (INTVAL(operands[6]) >> INTVAL(operands[2])) + 0x20 < 0x40)
  7940. + && ((unsigned) (INTVAL(operands[6])) + 0x20 >= 0x40))
  7941. + )
  7942. +"
  7943. + "*
  7944. +{
  7945. + int shift_cnt = INTVAL(operands[2]);
  7946. + int i = INTVAL(operands[6]);
  7947. +
  7948. + i >>= shift_cnt;
  7949. + operands[6] = GEN_INT(i);
  7950. +
  7951. + output_asm_insn(\"xand\\t%0,%6\\t;%v6\\t;peephole\",operands);
  7952. +
  7953. +// emit_a_shift (insn, operands);
  7954. + emit_a_shift (ASHIFT, operands);
  7955. + return \"\";
  7956. +}")
  7957. +
  7958. +
  7959. diff --git a/gcc/config/c33/lib1funcs.s b/gcc/config/c33/lib1funcs.s
  7960. new file mode 100644
  7961. index 0000000..7157c19
  7962. --- /dev/null
  7963. +++ b/gcc/config/c33/lib1funcs.s
  7964. @@ -0,0 +1,315 @@
  7965. +/* libgcc1 routines for EPSON C33.
  7966. + Copyright (C) 1996, 1997 Free Software Foundation, Inc.
  7967. +
  7968. +This file is part of GNU CC.
  7969. +
  7970. +GNU CC is free software; you can redistribute it and/or modify it
  7971. +under the terms of the GNU General Public License as published by the
  7972. +Free Software Foundation; either version 2, or (at your option) any
  7973. +later version.
  7974. +
  7975. +In addition to the permissions in the GNU General Public License, the
  7976. +Free Software Foundation gives you unlimited permission to link the
  7977. +compiled version of this file with other programs, and to distribute
  7978. +those programs without any restriction coming from the use of this
  7979. +file. (The General Public License restrictions do apply in other
  7980. +respects; for example, they cover modification of the file, and
  7981. +distribution when not linked into another program.)
  7982. +
  7983. +This file is distributed in the hope that it will be useful, but
  7984. +WITHOUT ANY WARRANTY; without even the implied warranty of
  7985. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  7986. +General Public License for more details.
  7987. +
  7988. +You should have received a copy of the GNU General Public License
  7989. +along with this program; see the file COPYING. If not, write to
  7990. +the Free Software Foundation, 59 Temple Place - Suite 330,
  7991. +Boston, MA 02111-1307, USA. */
  7992. +
  7993. +/* As a special exception, if you link this library with files
  7994. + compiled with GCC to produce an executable, this does not cause
  7995. + the resulting executable to be covered by the GNU General Public License.
  7996. + This exception does not however invalidate any other reasons why
  7997. + the executable file might be covered by the GNU General Public License. */
  7998. +
  7999. +/*
  8000. + Copyright (C) SEIKO EPSON CORP. 1996
  8001. +
  8002. + Filename : divsi3.c
  8003. + Function :
  8004. + This module defines the functions
  8005. + that emulate signed and unsigned integer division.
  8006. + Revision :
  8007. + 10/18/1996 ESD T.Katahira start */
  8008. +
  8009. +#ifdef L_divsi3
  8010. +
  8011. +// Function : ___divsi3
  8012. +// Input : r6 --- dividend
  8013. +// r7 --- divisor
  8014. +// Output : r4 --- quotient
  8015. +// Function : calculate signed integer division
  8016. +
  8017. + .section .text
  8018. + .align 1
  8019. + .global ___divsi3
  8020. +___divsi3:
  8021. + ld.w alr,r6 # set dividend to accumlator (alr)
  8022. + div0s r7 # initializer of signed division
  8023. +#ifdef FAST
  8024. + div1 r7 # execute division #1
  8025. + div1 r7 # execute division #2
  8026. + div1 r7 # execute division #3
  8027. + div1 r7 # execute division #4
  8028. + div1 r7 # execute division #5
  8029. + div1 r7 # execute division #6
  8030. + div1 r7 # execute division #7
  8031. + div1 r7 # execute division #8
  8032. + div1 r7 # execute division #9
  8033. + div1 r7 # execute division #10
  8034. + div1 r7 # execute division #11
  8035. + div1 r7 # execute division #12
  8036. + div1 r7 # execute division #13
  8037. + div1 r7 # execute division #14
  8038. + div1 r7 # execute division #15
  8039. + div1 r7 # execute division #16
  8040. + div1 r7 # execute division #17
  8041. + div1 r7 # execute division #18
  8042. + div1 r7 # execute division #19
  8043. + div1 r7 # execute division #20
  8044. + div1 r7 # execute division #21
  8045. + div1 r7 # execute division #22
  8046. + div1 r7 # execute division #23
  8047. + div1 r7 # execute division #24
  8048. + div1 r7 # execute division #25
  8049. + div1 r7 # execute division #26
  8050. + div1 r7 # execute division #27
  8051. + div1 r7 # execute division #28
  8052. + div1 r7 # execute division #29
  8053. + div1 r7 # execute division #30
  8054. + div1 r7 # execute division #31
  8055. + div1 r7 # execute division #32
  8056. +#else
  8057. + ld.w r8,0x4 # set loop counter (N = 4)
  8058. + ld.w r9,psr # save flag register
  8059. +___divsi3_loop_start:
  8060. + div1 r7 # execute division #1
  8061. + div1 r7 # execute division #2
  8062. + div1 r7 # execute division #3
  8063. + div1 r7 # execute division #4
  8064. + div1 r7 # execute division #5
  8065. + div1 r7 # execute division #6
  8066. + div1 r7 # execute division #7
  8067. + div1 r7 # execute division #8
  8068. + sub r8,0x1 # decrement loop counter
  8069. + jrne.d ___divsi3_loop_start # if (loop counter != 0) goto loop top
  8070. + ld.w psr,r9 # restore flag register (delayed slot)
  8071. +#endif
  8072. + div2s r7 # post divistion process #1
  8073. + div3s # post divistion process #2
  8074. + ret.d # return to the caller (use delayed return)
  8075. + ld.w r4,alr # set quotient to return reg (delayed slot)
  8076. +#endif /* L_divsi3 */
  8077. +
  8078. +#ifdef L_udivsi3
  8079. +
  8080. +// Function : ___udivsi3
  8081. +// Input : r6 --- dividend
  8082. +// r7 --- divisor
  8083. +// Output : r4 --- quotient
  8084. +// Function : calculate unsigned integer division
  8085. +
  8086. + .section .text
  8087. + .align 1
  8088. + .global ___udivsi3
  8089. +___udivsi3:
  8090. + ld.w alr,r6 # set dividend to accumlator (alr)
  8091. + div0u r7 # initializer of signed division
  8092. +#ifdef FAST
  8093. + div1 r7 # execute division #1
  8094. + div1 r7 # execute division #2
  8095. + div1 r7 # execute division #3
  8096. + div1 r7 # execute division #4
  8097. + div1 r7 # execute division #5
  8098. + div1 r7 # execute division #6
  8099. + div1 r7 # execute division #7
  8100. + div1 r7 # execute division #8
  8101. + div1 r7 # execute division #9
  8102. + div1 r7 # execute division #10
  8103. + div1 r7 # execute division #11
  8104. + div1 r7 # execute division #12
  8105. + div1 r7 # execute division #13
  8106. + div1 r7 # execute division #14
  8107. + div1 r7 # execute division #15
  8108. + div1 r7 # execute division #16
  8109. + div1 r7 # execute division #17
  8110. + div1 r7 # execute division #18
  8111. + div1 r7 # execute division #19
  8112. + div1 r7 # execute division #20
  8113. + div1 r7 # execute division #21
  8114. + div1 r7 # execute division #22
  8115. + div1 r7 # execute division #23
  8116. + div1 r7 # execute division #24
  8117. + div1 r7 # execute division #25
  8118. + div1 r7 # execute division #26
  8119. + div1 r7 # execute division #27
  8120. + div1 r7 # execute division #28
  8121. + div1 r7 # execute division #29
  8122. + div1 r7 # execute division #30
  8123. + div1 r7 # execute division #31
  8124. + div1 r7 # execute division #32
  8125. +#else
  8126. + ld.w r8,0x4 # set loop counter (N = 4)
  8127. +___udivsi3_loop_start:
  8128. + div1 r7 # execute division #1
  8129. + div1 r7 # execute division #2
  8130. + div1 r7 # execute division #3
  8131. + div1 r7 # execute division #4
  8132. + div1 r7 # execute division #5
  8133. + div1 r7 # execute division #6
  8134. + div1 r7 # execute division #7
  8135. + div1 r7 # execute division #8
  8136. + sub r8,0x1 # decrement loop counter
  8137. + jrne ___udivsi3_loop_start # if (loop counter != 0) goto loop top
  8138. +#endif
  8139. + ret.d # return to the caller (use delayed return)
  8140. + ld.w r4,alr # set quotient to return reg (delayed slot)
  8141. +
  8142. +#endif /* L_udivsi3 */
  8143. +
  8144. +
  8145. +#ifdef L_modsi3
  8146. +
  8147. +// Function : ___modsi3
  8148. +// Input : r6 --- dividend
  8149. +// r7 --- divisor
  8150. +// Output : r4 --- remainder
  8151. +// Function : calculate signed integer modulo arithmetic
  8152. +
  8153. + .section .text
  8154. + .align 1
  8155. + .global ___modsi3
  8156. +___modsi3:
  8157. + ld.w alr,r6 # set dividend to accumlator (alr)
  8158. + div0s r7 # initializer of signed division
  8159. +#ifdef FAST
  8160. + div1 r7 # execute division #1
  8161. + div1 r7 # execute division #2
  8162. + div1 r7 # execute division #3
  8163. + div1 r7 # execute division #4
  8164. + div1 r7 # execute division #5
  8165. + div1 r7 # execute division #6
  8166. + div1 r7 # execute division #7
  8167. + div1 r7 # execute division #8
  8168. + div1 r7 # execute division #9
  8169. + div1 r7 # execute division #10
  8170. + div1 r7 # execute division #11
  8171. + div1 r7 # execute division #12
  8172. + div1 r7 # execute division #13
  8173. + div1 r7 # execute division #14
  8174. + div1 r7 # execute division #15
  8175. + div1 r7 # execute division #16
  8176. + div1 r7 # execute division #17
  8177. + div1 r7 # execute division #18
  8178. + div1 r7 # execute division #19
  8179. + div1 r7 # execute division #20
  8180. + div1 r7 # execute division #21
  8181. + div1 r7 # execute division #22
  8182. + div1 r7 # execute division #23
  8183. + div1 r7 # execute division #24
  8184. + div1 r7 # execute division #25
  8185. + div1 r7 # execute division #26
  8186. + div1 r7 # execute division #27
  8187. + div1 r7 # execute division #28
  8188. + div1 r7 # execute division #29
  8189. + div1 r7 # execute division #30
  8190. + div1 r7 # execute division #31
  8191. + div1 r7 # execute division #32
  8192. +#else
  8193. + ld.w r8,0x4 # set loop counter (N = 4)
  8194. + ld.w r9,psr # save flag register
  8195. +___modsi3_loop_start:
  8196. + div1 r7 # execute division #1
  8197. + div1 r7 # execute division #2
  8198. + div1 r7 # execute division #3
  8199. + div1 r7 # execute division #4
  8200. + div1 r7 # execute division #5
  8201. + div1 r7 # execute division #6
  8202. + div1 r7 # execute division #7
  8203. + div1 r7 # execute division #8
  8204. + sub r8,0x1 # decrement loop counter
  8205. + jrne.d ___modsi3_loop_start # if (loop counter != 0) goto loop top
  8206. + ld.w psr,r9 # restore flag register (delayed slot)
  8207. +#endif
  8208. + div2s r7 # post divistion process #1
  8209. + div3s # post divistion process #2
  8210. + ret.d # return to the caller (use delayed return)
  8211. + ld.w r4,ahr # set remainder to return reg (delayed slot)
  8212. +
  8213. +#endif /* L_modsi3 */
  8214. +
  8215. +#ifdef L_umodsi3
  8216. +
  8217. +// Function : ___umodsi3
  8218. +// Input : r6 --- dividend
  8219. +// r7 --- divisor
  8220. +// Output : r4 --- remainder
  8221. +// Function : calculate unsigned integer modulo arithmetic
  8222. +
  8223. + .section .text
  8224. + .align 1
  8225. + .global ___umodsi3
  8226. +___umodsi3:
  8227. + ld.w alr,r6 # set dividend to accumlator (alr)
  8228. + div0u r7 # initializer of signed division
  8229. +#ifdef FAST
  8230. + div1 r7 # execute division #1
  8231. + div1 r7 # execute division #2
  8232. + div1 r7 # execute division #3
  8233. + div1 r7 # execute division #4
  8234. + div1 r7 # execute division #5
  8235. + div1 r7 # execute division #6
  8236. + div1 r7 # execute division #7
  8237. + div1 r7 # execute division #8
  8238. + div1 r7 # execute division #9
  8239. + div1 r7 # execute division #10
  8240. + div1 r7 # execute division #11
  8241. + div1 r7 # execute division #12
  8242. + div1 r7 # execute division #13
  8243. + div1 r7 # execute division #14
  8244. + div1 r7 # execute division #15
  8245. + div1 r7 # execute division #16
  8246. + div1 r7 # execute division #17
  8247. + div1 r7 # execute division #18
  8248. + div1 r7 # execute division #19
  8249. + div1 r7 # execute division #20
  8250. + div1 r7 # execute division #21
  8251. + div1 r7 # execute division #22
  8252. + div1 r7 # execute division #23
  8253. + div1 r7 # execute division #24
  8254. + div1 r7 # execute division #25
  8255. + div1 r7 # execute division #26
  8256. + div1 r7 # execute division #27
  8257. + div1 r7 # execute division #28
  8258. + div1 r7 # execute division #29
  8259. + div1 r7 # execute division #30
  8260. + div1 r7 # execute division #31
  8261. + div1 r7 # execute division #32
  8262. +#else
  8263. + ld.w r8,0x4 # set loop counter (N = 4)
  8264. +___umodsi3_loop_start:
  8265. + div1 r7 # execute division #1
  8266. + div1 r7 # execute division #2
  8267. + div1 r7 # execute division #3
  8268. + div1 r7 # execute division #4
  8269. + div1 r7 # execute division #5
  8270. + div1 r7 # execute division #6
  8271. + div1 r7 # execute division #7
  8272. + div1 r7 # execute division #8
  8273. + sub r8,0x1 # decrement loop counter
  8274. + jrne ___umodsi3_loop_start # if (loop counter != 0) goto loop top
  8275. +#endif
  8276. + ret.d # return to the caller (use delayed return)
  8277. + ld.w r4,ahr # set remainder to return reg (delayed slot)
  8278. +
  8279. +#endif /* L_umodsi3 */
  8280. diff --git a/gcc/config/c33/libgcc/Makefile b/gcc/config/c33/libgcc/Makefile
  8281. new file mode 100644
  8282. index 0000000..dbf9238
  8283. --- /dev/null
  8284. +++ b/gcc/config/c33/libgcc/Makefile
  8285. @@ -0,0 +1,45 @@
  8286. +# 011016 watanabe
  8287. +# 020612 fcmpd, fcmps͎gpȂƂɂȂB
  8288. +
  8289. +FP_LIB = adddf3 \
  8290. + addsf3 \
  8291. + divdf3 \
  8292. + divsf3 \
  8293. + extsfdf \
  8294. + fcmpd \
  8295. + fcmps \
  8296. + fixdfi \
  8297. + fixdfui \
  8298. + fixsfi \
  8299. + fixsfui \
  8300. + flosidf \
  8301. + flosisf \
  8302. + muldf3 \
  8303. + mulsf3 \
  8304. + negdf2 \
  8305. + negsf2 \
  8306. + scan64 \
  8307. + trncdfsf
  8308. +
  8309. +EMU_LIB = divsi3 \
  8310. + modsi3 \
  8311. + divhi3 \
  8312. + modhi3
  8313. +
  8314. +LIB1ASMFUNCS = $(FP_LIB) $(EMU_LIB)
  8315. +#LIB1ASMFUNCS = $(FP_LIB)
  8316. +
  8317. +GAS_FOR_TARGET = /gnu33/as
  8318. +AR_FOR_TARGET = ar
  8319. +AR_FLAGS_FOR_TARGET = rc
  8320. +
  8321. +libgcc.a:
  8322. + for name in $(LIB1ASMFUNCS); \
  8323. + do \
  8324. + echo $${name}; \
  8325. + $(GAS_FOR_TARGET) -alh $${name}.s -o $${name}.o >$${name}.lst; \
  8326. + $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc1.a $${name}.o; \
  8327. + rm -f $${name}.o; \
  8328. + done
  8329. + mv tmplibgcc1.a libgcc.a
  8330. +
  8331. diff --git a/gcc/config/c33/libgcc/adddf3.lst b/gcc/config/c33/libgcc/adddf3.lst
  8332. new file mode 100644
  8333. index 0000000..3965930
  8334. --- /dev/null
  8335. +++ b/gcc/config/c33/libgcc/adddf3.lst
  8336. @@ -0,0 +1,847 @@
  8337. +GAS LISTING adddf3.s page 1
  8338. +
  8339. +
  8340. + 1 ;*********************************************
  8341. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  8342. + 3 ;* ALL RIGHTS RESERVED
  8343. + 4 ;*
  8344. + 5 ;* filename : adddf3.s
  8345. + 6 ;*
  8346. + 7 ;* Double floating point addition function
  8347. + 8 ;* & subtract function
  8348. + 9 ;* input: (%r7, %r6) & (%r9, %r8)
  8349. + 10 ;* output: (%r5, %r4)
  8350. + 11 ;*
  8351. + 12 ;* Begin 1996/09/12 V. Chan
  8352. + 13 ;* Fixed sign bug 1997/02/17 V. Chan
  8353. + 14 ;* ѹ 2001/01/18 O.Hinokuchi
  8354. + 15 ;* 쥸֤
  8355. + 16 ;* gasб 2001/10/15 watanabe
  8356. + 17 ;*
  8357. + 18 ;*****************************************
  8358. + 19
  8359. + 20 .section .text
  8360. + 21 .align 1
  8361. + 22 .global __adddf3
  8362. + 23 .global __subdf3
  8363. + 24
  8364. + 25 ;==============================================
  8365. + 26 ;쥸
  8366. + 27 ; %r0:ӥåȣ(0(+) or 1(-))
  8367. + 28 ; %r1:ؿ(8bit)
  8368. + 29 ; %r2:ӥåȣ(0(+) or 1(-))/count
  8369. + 30 ; %r3:ؿ(8bit)
  8370. + 31 ; %r4:[L]
  8371. + 32 ; %r5:[H]
  8372. + 33 ; %r6:[L](double)/[L]/shift counter
  8373. + 34 ; %r7:[H](double)/[H]
  8374. + 35 ; %r8:[L](double)/[L]
  8375. + 36 ; %r9:[H](double)/[H]
  8376. + 37 ; %r10:temp/difference/implied
  8377. + 38 ; %r11:xflag
  8378. + 39 ; %r13:count/shift
  8379. + 40 ; -------------------------------------------
  8380. + 41 ; %r0:ͭ쥸
  8381. + 42 ; bit31:ؿ
  8382. + 43 ; bit30:ؿ
  8383. + 44 ; bit29-22:TEMP(1byte)
  8384. + 45 ; bit21-11:ؿ
  8385. + 46 ; bit10-0 :ؿ
  8386. + 47 ;==============================================
  8387. + 48
  8388. + 49
  8389. + 50 ;;macro VARSHIFT $1, $2, $3
  8390. + 51 ; used in 32-bit variable shifting
  8391. + 52 ; $1 = input register
  8392. + 53 ; $2 = shift amount
  8393. + 54 ; $3 = shift instruction
  8394. + 55
  8395. + 56 ;$$1:
  8396. + 57 ; cmp $2, 8 ; if temp <= 8 then goto $$2
  8397. + GAS LISTING adddf3.s page 2
  8398. +
  8399. +
  8400. + 58 ; jrle $$2
  8401. + 59
  8402. + 60 ; $3 $1, 8 ; shift input register 8 bits
  8403. + 61 ; jp.d $$1
  8404. + 62 ; sub $2, 8 ; temp = temp - 8
  8405. + 63
  8406. + 64 ;$$2:
  8407. + 65 ; $3 $1, $2 ; last shift
  8408. + 66 ;;endm
  8409. + 67
  8410. + 68 ;;macro SHFTROTSHFT $1, $2, $3, $4, $5, $6, $7
  8411. + 69 ; used in 64-bit variable shifting
  8412. + 70 ; $1 = shift amount
  8413. + 71 ; $2 = 1st input register (shifted)
  8414. + 72 ; $3 = 2nd input register (rotated)
  8415. + 73 ; $4 = 3rd input register (mask --> shifted)
  8416. + 74 ; $5 = shift instruction
  8417. + 75 ; $6 = rotate instruction
  8418. + 76 ; $7 = temp register
  8419. + 77 ; ld.w $7, $1 ; temp = shift amount
  8420. + 78
  8421. + 79 ;$$1:
  8422. + 80 ; cmp $7, 8 ; if temp <= 8 then goto $$2
  8423. + 81 ; jrle $$2
  8424. + 82
  8425. + 83 ; $5 $2, 8 ; shift 1st register
  8426. + 84 ; $6 $3, 8 ; rotate 2nd register
  8427. + 85 ; $5 $4, 8 ; shift 3rd register
  8428. + 86 ; jp.d $$1
  8429. + 87 ; sub $7, 8 ; temp = temp - 8
  8430. + 88
  8431. + 89 ;$$2:
  8432. + 90 ; $5 $2, $7 ; last shift
  8433. + 91 ; $6 $3, $7 ; last rotate
  8434. + 92 ; $5 $4, $7 ; last shift
  8435. + 93 ;;endm
  8436. + 94
  8437. + 95 __subdf3:
  8438. + 96 0000 00D000C0 xxor %r9, 0x80000000 ; [H}(%r9)= [H](%r9) & 0x80000000
  8439. + 96 0978
  8440. + 97
  8441. + 98 __adddf3:
  8442. + 99 0006 0302 pushn %r3 ; save register values
  8443. + 100
  8444. + 101 ;@@@ 01/01/23 add start hinokuchi
  8445. + 102 ;sub %sp, 4
  8446. + 103 ;ld.w [%sp+0], %r10 ; %r10
  8447. + 104 ;ld.w [%sp+1], %r11 ; %r11
  8448. + 105 ;ld.w [%sp+2], %r12 ; %r12
  8449. + 106 ;ld.w [%sp+3], %r13 ; %r13
  8450. + 107 ;@@@ 01/01/23 add end
  8451. + 108
  8452. + 109 ;@@@ 01/02/14 del start
  8453. + 110 ;ld.w %r0, %r7 ; ӥåȣ(%r0) <- [H](%r7)
  8454. + 111 ;rl %r0, 1 ; ӥåȣ(%r0) rotate left 1 bit
  8455. + 112 ;and %r0, 1 ; ӥåȣ(%r0) & 1
  8456. + 113 ;@@@ 01/01/23 del end
  8457. + GAS LISTING adddf3.s page 3
  8458. +
  8459. +
  8460. + 114 0008 006C ld.w %r0, 0 ; ͭ쥸ꥢ(%r0) @@@ 01/02/14 add
  8461. + 115
  8462. + 116 ;@@@ 01/02/14 add start
  8463. + 117 000a 712E ld.w %r1, %r7 ; ӥåȣ(%r1) <- [H](%r7)
  8464. + 118 000c 119C rl %r1, 1 ; ӥåȣ(%r1) rotate left 1 bit
  8465. + 119 000e 1170 and %r1, 1 ; ӥåȣ(%r1) & 1
  8466. + 120 ; SET_SIGN1 %r0, %r1 ; ͭ쥸ӥåȣ¸
  8467. + 121 __L0001:
  8468. + 122 0010 FFCFFFDF xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  8469. + 122 F073
  8470. + 123 0016 1170 and %r1,1 ; 1ӥåȥޥ
  8471. + 124 0018 1198 rr %r1,1 ; ӥåȣΥӥåȰ֤˥ơ
  8472. + 125 001a 1036 or %r0,%r1 ; ӥåȣå
  8473. + 126 001c 119C rl %r1,1 ; ӥå
  8474. + 127 ;@@@ 01/01/23 add end
  8475. + 128
  8476. + 129
  8477. + 130
  8478. + 131 ;@@@ 01/02/14 del start
  8479. + 132 ;ld.w %r2, %r9 ; ӥåȣ(%r2) <- [H](%r9)
  8480. + 133 ;rl %r2, 1 ; ӥåȣ(%r2) rotate left 1 bit
  8481. + 134 ;and %r2, 1 ; ӥåȣ(%r2) & 1
  8482. + 135 ;@@@ 01/01/23 del end
  8483. + 136
  8484. + 137 ;@@@ 01/02/14 add start
  8485. + 138 001e 922E ld.w %r2, %r9 ; ӥåȣ(%r1) <- [H](%r9)
  8486. + 139 0020 129C rl %r2, 1 ; ӥåȣ(%r1) rotate left 1 bit
  8487. + 140 0022 1270 and %r2, 1 ; ӥåȣ(%r1) & 1
  8488. + 141 ; SET_SIGN2 %r0, %r2 ; ͭ쥸ӥåȣ¸
  8489. + 142 __L0002:
  8490. + 143 0024 FFD7FFDF xand %r0,0xbfffffff ; ͭ쥸 ӥåȣꥢ
  8491. + 143 F073
  8492. + 144 002a 1270 and %r2,1 ; 1ӥåȥޥ
  8493. + 145 002c 2298 rr %r2,2 ; ӥåȣΥӥåȰ֤˥ơ
  8494. + 146 002e 2036 or %r0,%r2 ; ӥåȣå
  8495. + 147 0030 229C rl %r2,2 ; ӥå
  8496. + 148
  8497. + 149 ;@@@ 01/01/23 add end
  8498. + 150
  8499. + 151
  8500. + 152 0032 712E ld.w %r1, %r7 ; ؿ(%r1) <- [H](%r7)
  8501. + 153 0034 118C sll %r1, 1 ; ؿ(%r1) << 1
  8502. + 154 0036 81888188 xsrl %r1, 21 ; ؿ(%r1) >> 21
  8503. + 154 5188
  8504. + 155
  8505. + 156 ; SET_EXP1 %r0, %r1 ; @@@ 01/02/14 add start
  8506. + 157 __L0003:
  8507. + 158 003c E0DF0070 xand %r0,0xfffff800 ; ͭ쥸 ؿꥢ
  8508. + 159 0040 1FC0F173 xand %r1,0x7ff ; ӥåȥޥ
  8509. + 160 0044 1036 or %r0,%r1 ; ؿå
  8510. + 161
  8511. + 162
  8512. + 163 0046 1FC0F16B xcmp %r1, 0x7ff ; if ؿ(%r1) >= ؿСե(0x7ff)
  8513. + 164 004a 00C001C0 xjrge overflow ; then jump to overflow
  8514. + 164 380A
  8515. + 165
  8516. + 166 0050 932E ld.w %r3, %r9 ; ؿ(%r3) <- [H](%r9)
  8517. + GAS LISTING adddf3.s page 4
  8518. +
  8519. +
  8520. + 167 0052 138C sll %r3, 1 ; ؿ(%r3) << 1
  8521. + 168 0054 83888388 xsrl %r3, 21 ; ؿ(%r3) >> 21
  8522. + 168 5388
  8523. + 169
  8524. + 170 ; SET_EXP2 %r0, %r3 ; @@@ 01/02/14 add start
  8525. + 171 __L0004:
  8526. + 172 005a F8DF1FC0 xand %r0,0xffc007ff ; ͭ쥸 ؿꥢ
  8527. + 172 F073
  8528. + 173 0060 1FC0F373 xand %r3,0x7ff ; ӥåȥޥ
  8529. + 174 0064 838C sll %r3,8 ; ؿΥӥåȰ֤˥ե
  8530. + 175 0066 338C sll %r3,3 ; ؿΥӥåȰ֤˥ե
  8531. + 176 0068 3036 or %r0,%r3 ; ؿå
  8532. + 177 006a 8388 srl %r3,8 ; ؿ
  8533. + 178 006c 3388 srl %r3,3 ; ؿ
  8534. + 179
  8535. + 180 ; GET_SIGN1 %r0, %r4
  8536. + 181 __L0005:
  8537. + 182 006e 042E ld.w %r4,%r0 ;
  8538. + 183 0070 149C rl %r4,1 ; ӥåȥơ
  8539. + 184 0072 1470 and %r4,1 ; ͭ쥸 ӥåȣ
  8540. + 185
  8541. + 186
  8542. + 187 ;@@@ del 01/02/15 ld.w %r10, %r0 ; temp(%r10) = ӥåȣ(%r0)
  8543. + 188 ;@@@ del 01/02/15 ld.w %r10, %r0 ; temp(%r10) = ӥåȣ(%r0)
  8544. + 189
  8545. + 190 ; SET_SIGN1 %r0, %r2 ; ͭ쥸[ӥåȣ](%r0) <- ӥåȣ(%r2)
  8546. + 191 __L0006:
  8547. + 192 0074 FFCFFFDF xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  8548. + 192 F073
  8549. + 193 007a 1270 and %r2,1 ; 1ӥåȥޥ
  8550. + 194 007c 1298 rr %r2,1 ; ӥåȣΥӥåȰ֤˥ơ
  8551. + 195 007e 2036 or %r0,%r2 ; ӥåȣå
  8552. + 196 0080 129C rl %r2,1 ; ӥå
  8553. + 197 0082 1FC0F36B xcmp %r3, 0x7ff ; if ؿ(%r3) >= ؿСե(0x7ff)
  8554. + 198 ;@@@ del 01/02/15 ld.w %r0, %r2 ; ӥåȣ(%r0) <- ӥåȣ(%r2)
  8555. + 199 0086 00C001C0 xjrge overflow ; then jump to overflow
  8556. + 199 1A0A
  8557. + 200 ; SET_SIGN1 %r0, %r4 ; ͭ쥸[ӥåȣ](%r0) <- ӥåȣ(%r2)
  8558. + 201 __L0007:
  8559. + 202 008c FFCFFFDF xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  8560. + 202 F073
  8561. + 203 0092 1470 and %r4,1 ; 1ӥåȥޥ
  8562. + 204 0094 1498 rr %r4,1 ; ӥåȣΥӥåȰ֤˥ơ
  8563. + 205 0096 4036 or %r0,%r4 ; ӥåȣå
  8564. + 206 0098 149C rl %r4,1 ; ӥå
  8565. + 207
  8566. + 208 009a 312A cmp %r1, %r3 ; if ؿ(%r1) < ؿ(%r3)
  8567. + 209 009c 0B0C jrlt ex1ltex2 ; then jump to ex1ltex2
  8568. + 210 ;@@@ del 01/02/15 ld.w %r0, %r10 ; ӥåȣ(%r0) <- temp(%r10)
  8569. + 211
  8570. + 212 ; case: exp1 >= exp2
  8571. + 213 009e 752E ld.w %r5, %r7 ; [H](%r5) <- [H](%r7)
  8572. + 214 ;@@@ del 01/02/15 ld.w %r10, %r1 ; difference(%r10) = ؿ(%r1) - ؿ(%r3)
  8573. + 215 00a0 142E ld.w %r4, %r1 ; difference(%r4) = ؿ(%r1) - ؿ(%r3)
  8574. + 216 00a2 3426 sub %r4, %r3
  8575. + 217 ;@@@ del 01/02/15 sub %r10, %r3
  8576. + 218
  8577. + GAS LISTING adddf3.s page 5
  8578. +
  8579. +
  8580. + 219 ;@@@ del 01/02/15 xcmp %r10, 0x35 ; if difference(%r10) >= 0x35 (53-bits) then
  8581. + 220 00a4 00C0546B xcmp %r4, 0x35 ; if difference(%r4) >= 0x35 (53-bits) then
  8582. + 221
  8583. + 222 00a8 642E ld.w %r4, %r6 ; [L](%r4) <- [L](%r6)
  8584. + 223 00aa 00C001C0 xjrge end ; return first input
  8585. + 223 130A
  8586. + 224 00b0 121E jp continue
  8587. + 225
  8588. + 226 ex1ltex2:
  8589. + 227 00b2 952E ld.w %r5, %r9 ; [H](%r5) <- [H](%r9)
  8590. + 228 ;@@@ del 01/02/15 ld.w %r10, %r3 ; difference(%r10) = ؿ(%r1) - ؿ(%r3)
  8591. + 229 00b4 342E ld.w %r4, %r3 ; difference(%r4) = ؿ(%r1) - ؿ(%r3)
  8592. + 230
  8593. + 231 00b6 1426 sub %r4, %r1
  8594. + 232 ;@@@ del 01/02/15 sub %r10, %r1
  8595. + 233
  8596. + 234 ;@@@ del 01/02/15 xcmp %r10, 0x35 ; if difference(%r10) >= 0x35 (53-bits) then
  8597. + 235 00b8 00C0546B xcmp %r4, 0x35 ; if difference(%r4) >= 0x35 (53-bits) then
  8598. + 236
  8599. + 237 00bc 842E ld.w %r4, %r8 ; [L](%r4) <- [L](%r8)
  8600. + 238 00be 0B0C jrlt continue
  8601. + 239 ;@@@ del 01/02/15 ld.w %r0, %r2 ; ӥåȣ(%r0) <- ӥåȣ(%r2)
  8602. + 240 ; SET_SIGN1 %r0, %r2 ; ͭ쥸[ӥåȣ] <- ӥåȣ(%r2)@@@ add 01/02/15
  8603. + 241 __L0008:
  8604. + 242 00c0 FFCFFFDF xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  8605. + 242 F073
  8606. + 243 00c6 1270 and %r2,1 ; 1ӥåȥޥ
  8607. + 244 00c8 1298 rr %r2,1 ; ӥåȣΥӥåȰ֤˥ơ
  8608. + 245 00ca 2036 or %r0,%r2 ; ӥåȣå
  8609. + 246 00cc 129C rl %r2,1 ; ӥå
  8610. + 247 00ce 00C001C0 xjp end ; return 2nd input
  8611. + 247 011E
  8612. + 248
  8613. + 249 continue:
  8614. + 250 ;@@@ del 01/02/15 xld.w %r10, 0x100000 ; implied bit(%r10) <- 0x100000
  8615. + 251 00d4 02C000C0 xld.w %r2, 0x100000 ; implied bit(%r2) <- 0x100000
  8616. + 251 026C
  8617. + 252
  8618. + 253 ;@@@ del 01/02/15 xld.w %r13, 0xfffff ; mask(%r13) <- 0xfffff
  8619. + 254 00da 01C0FFDF xld.w %r4, 0xfffff ; mask(%r4) <- 0xfffff
  8620. + 254 F46F
  8621. + 255
  8622. + 256 ; isolate mantissa1
  8623. + 257 00e0 0168 cmp %r1, 0 ; if ؿ(%r1) = 0 then goto getman2
  8624. + 258 00e2 0319 jreq.d getman2
  8625. + 259 ;@@@ del 01/02/15 and %r7, %r13 ; [H](%r7) & mask(%r13) clear first 12 bits of %r7
  8626. + 260 00e4 4732 and %r7, %r4 ; [H](%r7) & mask(%r4) clear first 12 bits of %r7
  8627. + 261
  8628. + 262 ;@@@ del 01/02/15 or %r7, %r10 ; [H](%r7) | mplied bit(%r10) else normal input --> add im
  8629. + 263 00e6 2736 or %r7, %r2 ; [H](%r7) | mplied bit(%r2) else normal input --> add implied bit
  8630. + 264
  8631. + 265 getman2:
  8632. + 266 00e8 0368 cmp %r3, 0 ; if ؿ(%r3) = 0 then goto signs
  8633. + 267 00ea 0319 jreq.d cmpexp
  8634. + 268 ;@@@ del 01/02/15 and %r9, %r13 ; [H](%r9) & mask(%r13) clear first 12 bits of %r9
  8635. + 269 00ec 4932 and %r9, %r4 ; [H](%r9) & mask(%r4) clear first 12 bits of %r9
  8636. + 270
  8637. + GAS LISTING adddf3.s page 6
  8638. +
  8639. +
  8640. + 271 ;@@@ del 01/02/15 or %r9, %r10 ; [H](%r9) | mplied bit(%r10) else normal input --> add imp
  8641. + 272 00ee 2936 or %r9, %r2 ; [H](%r9) | mplied bit(%r2) else normal input --> add implied bit
  8642. + 273
  8643. + 274 cmpexp:
  8644. + 275 ; compare exponents -- %r1 will be result exponent
  8645. + 276 ; if exp1 > exp2 then mantissa2 is shifted to the right
  8646. + 277 ; if exp2 > exp1 then mantissa1 is shifted to the right
  8647. + 278
  8648. + 279 ;@@@ del 01/02/15 ld.w %r11, 0 ; xflag(%r11) = 0
  8649. + 280 00f0 046C ld.w %r4, 0
  8650. + 281 ; SET_TEMP %r0, %r4 ; ͭ쥸[temp](%r0) <- xflag = 0
  8651. + 282 __L0009:
  8652. + 283 00f2 07D8FFDF xand %r0,0xc03fffff ; ͭ쥸 TEMPꥢ
  8653. + 283 F073
  8654. + 284 00f8 03C0F473 xand %r4,0xff ; 1Х mask
  8655. + 285 00fc 8498 rr %r4,8 ; TEMPΥӥåȰ֤˥ե
  8656. + 286 00fe 2498 rr %r4,2 ; TEMPΥӥåȰ֤˥ե
  8657. + 287 0100 4036 or %r0,%r4 ; TEMPå
  8658. + 288 0102 849C rl %r4,8 ;
  8659. + 289 0104 249C rl %r4,2 ;
  8660. + 290
  8661. + 291
  8662. + 292 0106 312A cmp %r1, %r3
  8663. + 293 0108 6318 jreq negation ; if ؿ(%r1) = ؿ(%r3) then jump to negation
  8664. + 294 010a 3508 jrgt man2 ; if ؿ(%r1) > ؿ(%r3) then jump to man2
  8665. + 295
  8666. + 296 ; case: exp1 < exp2
  8667. + 297 ;@@@ del 01/02/15 ld.w %r11, 2 ; xflag(%r11) = 2
  8668. + 298 010c 246C ld.w %r4, 2
  8669. + 299 ; SET_TEMP %r0, %r4 ; ͭ쥸[temp](%r0) <- xflag = 2
  8670. + 300 __L0010:
  8671. + 301 010e 07D8FFDF xand %r0,0xc03fffff ; ͭ쥸 TEMPꥢ
  8672. + 301 F073
  8673. + 302 0114 03C0F473 xand %r4,0xff ; 1Х mask
  8674. + 303 0118 8498 rr %r4,8 ; TEMPΥӥåȰ֤˥ե
  8675. + 304 011a 2498 rr %r4,2 ; TEMPΥӥåȰ֤˥ե
  8676. + 305 011c 4036 or %r0,%r4 ; TEMPå
  8677. + 306 011e 849C rl %r4,8 ;
  8678. + 307 0120 249C rl %r4,2 ;
  8679. + 308
  8680. + 309
  8681. + 310 ;@@@ del 01/02/15 ld.w %r10, %r1 ; temp(%r10) = ؿ(%r1)
  8682. + 311 0122 142E ld.w %r4, %r1 ; temp(%r4) = ؿ(%r1)
  8683. + 312
  8684. + 313 0124 312E ld.w %r1, %r3 ; ؿ(%r1) = ؿ(%r3)
  8685. + 314 ; SET_EXP1 %r0, %r1 ; @@@ 01/02/26 add start
  8686. + 315 __L0011:
  8687. + 316 0126 E0DF0070 xand %r0,0xfffff800 ; ͭ쥸 ؿꥢ
  8688. + 317 012a 1FC0F173 xand %r1,0x7ff ; ӥåȥޥ
  8689. + 318 012e 1036 or %r0,%r1 ; ؿå
  8690. + 319
  8691. + 320
  8692. + 321 ;@@@ del 01/02/15 sub %r3, %r10 ; shift (%r3) = ؿ(%r3) - ؿ(%r1)
  8693. + 322 0130 4326 sub %r3, %r4 ; shift (%r3) = ؿ(%r3) - ؿ(%r4)
  8694. + 323
  8695. + 324 ;@@@ del 01/02/15 cmp %r10, 0 ; if ؿ(%r1) != 0 then goto shftm1 (normal)
  8696. + 325 0132 0468 cmp %r4, 0 ; if ؿ(%r4) != 0 then goto shftm1 (normal)
  8697. + GAS LISTING adddf3.s page 7
  8698. +
  8699. +
  8700. + 326
  8701. + 327 0134 021A jrne shftm1
  8702. + 328 0136 1364 sub %r3, 1 ; shift(%r3) = shift (%r3) - 1 else denormal --> decrement shift
  8703. + 329
  8704. + 330 shftm1:
  8705. + 331 0138 00C0036A xcmp %r3, 32 ; if shift(%r3) < 32 then 64-bit shift
  8706. + 332 013c 0B0C jrlt shift1
  8707. + 333
  8708. + 334 ; case: shift >=32
  8709. + 335 013e 762E ld.w %r6, %r7 ; [L] <- [H] (32-bit shift)
  8710. + 336 0140 076C ld.w %r7, 0 ; [H] <- 0
  8711. + 337 0142 0366 sub %r3, 32 ; shift(%r3) = shift(%r3) - 32
  8712. + 338 ;xsrl %r6, %r3 ; man1_2 >> shift
  8713. + 339 ; used in 32-bit variable shifting ; VARSHIFT %r6, %r3, srl
  8714. + 340 ; $1 = input register
  8715. + 341 ; $2 = shift amount
  8716. + 342 ; $3 = shift instruction
  8717. + 343
  8718. + 344 __L0012:
  8719. + 345 0144 8368 cmp %r3, 8 ; if temp <= 8 then goto $$2
  8720. + 346 0146 040E jrle __L0013
  8721. + 347
  8722. + 348 0148 8688 srl %r6, 8 ; shift input register 8 bits
  8723. + 349 014a FD1F jp.d __L0012
  8724. + 350 014c 8364 sub %r3, 8 ; temp = temp - 8
  8725. + 351
  8726. + 352 __L0013:
  8727. + 353 014e 3689 srl %r6, %r3 ; last shift
  8728. + 354 0150 3F1E jp negation
  8729. + 355
  8730. + 356 shift1:
  8731. + 357 ; shift {man1, man1_2} right
  8732. + 358 ;xsrl %r6, %r3 ; shift low 32-bits to the right x bits (shift amount = x)
  8733. + 359 ;xrr %r7, %r3 ; rotate high 32-bits to the right x bits
  8734. + 360 ;xsrl %r10, %r3 ; make a mask for last 32-x bits --> %r10 = 000...111
  8735. + 361
  8736. + 362 ;@@@ del 01/02/15 ld.w %r10, -1 ; mask(%r10) <- 0xffff ffff
  8737. + 363 0152 F46F ld.w %r4, -1 ; mask(%r4) <- 0xffff ffff
  8738. + 364
  8739. + 365 ;@@@ del 01/02/15 SHFTROTSHFT %r3, %r6, %r7, %r10, srl, rr, %r3
  8740. + 366 ; used in 64-bit variable shifting ; SHFTROTSHFT %r3, %r6, %r7, %r4, srl, rr, %r3
  8741. + 367 ; $1 = shift amount
  8742. + 368 ; $2 = 1st input register (shifted)
  8743. + 369 ; $3 = 2nd input register (rotated)
  8744. + 370 ; $4 = 3rd input register (mask --> shifted)
  8745. + 371 ; $5 = shift instruction
  8746. + 372 ; $6 = rotate instruction
  8747. + 373 ; $7 = temp register
  8748. + 374 0154 332E ld.w %r3, %r3 ; temp = shift amount
  8749. + 375
  8750. + 376 __L0014:
  8751. + 377 0156 8368 cmp %r3, 8 ; if temp <= 8 then goto $$2
  8752. + 378 0158 060E jrle __L0015
  8753. + 379
  8754. + 380 015a 8688 srl %r6, 8 ; shift 1st register
  8755. + 381 015c 8798 rr %r7, 8 ; rotate 2nd register
  8756. + 382 015e 8488 srl %r4, 8 ; shift 3rd register
  8757. + GAS LISTING adddf3.s page 8
  8758. +
  8759. +
  8760. + 383 0160 FB1F jp.d __L0014
  8761. + 384 0162 8364 sub %r3, 8 ; temp = temp - 8
  8762. + 385
  8763. + 386 __L0015:
  8764. + 387 0164 3689 srl %r6, %r3 ; last shift
  8765. + 388 0166 3799 rr %r7, %r3 ; last rotate
  8766. + 389 0168 3489 srl %r4, %r3 ; last shift
  8767. + 390
  8768. + 391 ;@@@ del 01/02/15 not %r3, %r10 ; shift(%r3) = ~mask(%r10) flip mask for first x bits --> %r3
  8769. + 392 016a 433E not %r3, %r4 ; shift(%r3) = ~mask(%r4) flip mask for first x bits --> %r3 = 111...000 (mask)
  8770. + 393
  8771. + 394 016c 7332 and %r3, %r7 ; isolate first x bits of %r7
  8772. + 395 016e 3636 or %r6, %r3 ; add first x bits of %r7 to %r6
  8773. + 396 0170 2F1F jp.d negation
  8774. + 397 ;@@@ del 01/02/15 and %r7, %r10 ; keep the low 32-x bits of %r7
  8775. + 398 0172 4732 and %r7, %r4 ; keep the low 32-x bits of %r7
  8776. + 399
  8777. + 400
  8778. + 401 man2: ; case: ؿ(%r1) > ؿ(%r3)
  8779. + 402 ;@@@ del 01/02/15 ld.w %r11, 1 ; xflag(%r11) = 1
  8780. + 403 0174 146C ld.w %r4, 1
  8781. + 404 ; SET_TEMP %r0, %r4 ; ͭ쥸[temp](%r0) <- xflag = 1
  8782. + 405 __L0016:
  8783. + 406 0176 07D8FFDF xand %r0,0xc03fffff ; ͭ쥸 TEMPꥢ
  8784. + 406 F073
  8785. + 407 017c 03C0F473 xand %r4,0xff ; 1Х mask
  8786. + 408 0180 8498 rr %r4,8 ; TEMPΥӥåȰ֤˥ե
  8787. + 409 0182 2498 rr %r4,2 ; TEMPΥӥåȰ֤˥ե
  8788. + 410 0184 4036 or %r0,%r4 ; TEMPå
  8789. + 411 0186 849C rl %r4,8 ;
  8790. + 412 0188 249C rl %r4,2 ;
  8791. + 413
  8792. + 414
  8793. + 415 ;@@@ del 01/02/15 ld.w %r10, %r1 ; temp(%r10) <- ؿ(%r1)
  8794. + 416 018a 142E ld.w %r4, %r1 ; temp(%r4) <- ؿ(%r1)
  8795. + 417
  8796. + 418 ;@@@ del 01/02/15 sub %r10, %r3 ; shift(%r10) = ؿ(%r1) - ؿ(%r3)
  8797. + 419 018c 3426 sub %r4, %r3 ; shift(%r4) = ؿ(%r1) - ؿ(%r3)
  8798. + 420
  8799. + 421 018e 0368 cmp %r3, 0 ; if ؿ(%r1) != 0 then goto shftm2 (normal)
  8800. + 422 0190 021A jrne shftm2
  8801. + 423 ;@@@ del 01/02/15 sub %r10, 1 ; else denormal --> shift(%r10) = shift(%r10) - 1
  8802. + 424 0192 1464 sub %r4, 1 ; else denormal --> shift(%r4) = shift(%r4) - 1
  8803. + 425
  8804. + 426 shftm2:
  8805. + 427 ;@@@ del 01/02/15 xcmp %r10, 32 ; if shift(%r10) < 32 then 64-bit shift
  8806. + 428 0194 00C0046A xcmp %r4, 32 ; if shift(%r4) < 32 then 64-bit shift
  8807. + 429
  8808. + 430 0198 0B0C jrlt shift2
  8809. + 431
  8810. + 432 ; case: shift >=32
  8811. + 433 019a 982E ld.w %r8, %r9 ; [L] <- [H]
  8812. + 434 019c 096C ld.w %r9, 0 ; [H] <- 0
  8813. + 435 ;@@@ del 01/02/15 sub %r10, 32 ; shift(%r10) = shift(%r10) - 32
  8814. + 436 019e 0466 sub %r4, 32 ; shift(%r4) = shift(%r4) - 32
  8815. + 437
  8816. + 438 ;xsrl %r8, %r10 ; man2_2 >> shift
  8817. + GAS LISTING adddf3.s page 9
  8818. +
  8819. +
  8820. + 439 ;@@@ del 01/02/15 VARSHIFT %r8, %r10, srl
  8821. + 440 ; used in 32-bit variable shifting ; VARSHIFT %r8, %r4, srl
  8822. + 441 ; $1 = input register
  8823. + 442 ; $2 = shift amount
  8824. + 443 ; $3 = shift instruction
  8825. + 444
  8826. + 445 __L0017:
  8827. + 446 01a0 8468 cmp %r4, 8 ; if temp <= 8 then goto $$2
  8828. + 447 01a2 040E jrle __L0018
  8829. + 448
  8830. + 449 01a4 8888 srl %r8, 8 ; shift input register 8 bits
  8831. + 450 01a6 FD1F jp.d __L0017
  8832. + 451 01a8 8464 sub %r4, 8 ; temp = temp - 8
  8833. + 452
  8834. + 453 __L0018:
  8835. + 454 01aa 4889 srl %r8, %r4 ; last shift
  8836. + 455
  8837. + 456 01ac 111E jp negation
  8838. + 457
  8839. + 458 shift2:
  8840. + 459 ; shift {man2, man2_2} right
  8841. + 460 ;xsrl %r8, %r10 ; shift low 32-bits to the right x bits (shift amount = x)
  8842. + 461 ;xrr %r9, %r10 ; rotate high 32-bits to the right x bits
  8843. + 462 ;xsrl %r3, %r10 ; make a mask for last 32-x bits --> %r3 = 000...111
  8844. + 463
  8845. + 464 01ae F36F ld.w %r3, -1 ; %r3 = 0xffff ffff
  8846. + 465 ;@@@ del 01/02/15 SHFTROTSHFT %r10, %r8, %r9, %r3, srl, rr, %r13 ; %r13 = temp
  8847. + 466 ; used in 64-bit variable shifting ; SHFTROTSHFT %r4, %r8, %r9, %r3, srl, rr, %r4 ; %r4 = temp
  8848. + 467 ; $1 = shift amount
  8849. + 468 ; $2 = 1st input register (shifted)
  8850. + 469 ; $3 = 2nd input register (rotated)
  8851. + 470 ; $4 = 3rd input register (mask --> shifted)
  8852. + 471 ; $5 = shift instruction
  8853. + 472 ; $6 = rotate instruction
  8854. + 473 ; $7 = temp register
  8855. + 474 01b0 442E ld.w %r4, %r4 ; temp = shift amount
  8856. + 475
  8857. + 476 __L0019:
  8858. + 477 01b2 8468 cmp %r4, 8 ; if temp <= 8 then goto $$2
  8859. + 478 01b4 060E jrle __L0020
  8860. + 479
  8861. + 480 01b6 8888 srl %r8, 8 ; shift 1st register
  8862. + 481 01b8 8998 rr %r9, 8 ; rotate 2nd register
  8863. + 482 01ba 8388 srl %r3, 8 ; shift 3rd register
  8864. + 483 01bc FB1F jp.d __L0019
  8865. + 484 01be 8464 sub %r4, 8 ; temp = temp - 8
  8866. + 485
  8867. + 486 __L0020:
  8868. + 487 01c0 4889 srl %r8, %r4 ; last shift
  8869. + 488 01c2 4999 rr %r9, %r4 ; last rotate
  8870. + 489 01c4 4389 srl %r3, %r4 ; last shift
  8871. + 490
  8872. + 491 ;@@@ del 01/02/15 not %r10, %r3 ; flip mask for first x bits --> %r10 = 111...000 (mask)
  8873. + 492 01c6 343E not %r4, %r3 ; flip mask for first x bits --> %r4 = 111...000 (mask)
  8874. + 493
  8875. + 494 ;@@@ del 01/02/15 and %r10, %r9 ; isolate first x bits of %r9
  8876. + 495 01c8 9432 and %r4, %r9 ; isolate first x bits of %r9
  8877. + GAS LISTING adddf3.s page 10
  8878. +
  8879. +
  8880. + 496
  8881. + 497 ;@@@ del 01/02/15 or %r8, %r10 ; add first x bits of %r9 to %r8
  8882. + 498 01ca 4836 or %r8, %r4 ; add first x bits of %r9 to %r8
  8883. + 499
  8884. + 500 01cc 3932 and %r9, %r3 ; keep the low 32-x bits of %r9
  8885. + 501
  8886. + 502 negation:
  8887. + 503 ; xflag = 0 if exp1 = exp2
  8888. + 504 ; 1 if exp1 > exp2
  8889. + 505 ; 2 if exp1 < exp2
  8890. + 506 ; %r0 will now be result sign bit
  8891. + 507
  8892. + 508 ; if exp1 = exp2 then this is the case
  8893. + 509 ; sign1 (%r0) sign2 (%r2) result sign (%r0)
  8894. + 510 ; 0 0 0 <== no change
  8895. + 511 ; 1 0 0 <== change to 1 if result < 0
  8896. + 512 ; 0 1 0 <== change to 1 if result < 0
  8897. + 513 ; 1 1 1 <== no change
  8898. + 514
  8899. + 515 ; GET_TEMP %r0, %r1 ; xflag(%r1) <- ͭ쥸[TEMP](%r0) @@@ 01/02/15 add
  8900. + 516 __L0021:
  8901. + 517 01ce 012E ld.w %r1,%r0
  8902. + 518 01d0 819C rl %r1,8
  8903. + 519 01d2 219C rl %r1,2
  8904. + 520 01d4 03C0F173 xand %r1,0xff ; ͭ쥸 TEMP
  8905. + 521
  8906. + 522 ; GET_SIGN1 %r0, %r4 ; ӥåȣ(%r4) <- ͭ쥸[ӥåȣ](%r0) @@@ 01/02/15 add
  8907. + 523 __L0022:
  8908. + 524 01d8 042E ld.w %r4,%r0 ;
  8909. + 525 01da 149C rl %r4,1 ; ӥåȥơ
  8910. + 526 01dc 1470 and %r4,1 ; ͭ쥸 ӥåȣ
  8911. + 527
  8912. + 528 ; GET_SIGN2 %r0, %r2 ; ӥåȣ(%r2) <- ͭ쥸[ӥåȣ](%r0) @@@ 01/02/15 add
  8913. + 529 __L0023:
  8914. + 530 01de 022E ld.w %r2,%r0 ;
  8915. + 531 01e0 229C rl %r2,2 ; ӥåȥơ
  8916. + 532 01e2 1270 and %r2,1 ; ͭ쥸 ӥåȣ
  8917. + 533
  8918. + 534
  8919. + 535 ;@@@ del 01/02/15 cmp %r0, %r2 ; if ӥåȣ(%r0) = ӥåȣ(%r2)
  8920. + 536 01e4 242A cmp %r4, %r2 ; if ӥåȣ(%r4) = ӥåȣ(%r2)
  8921. + 537
  8922. + 538 01e6 1618 jreq sign ; then goto sign
  8923. + 539 ;@@@ del 01/02/15 cmp %r0, 1 ; if ӥåȣ(%r0) != 1
  8924. + 540 01e8 1468 cmp %r4, 1 ; if ӥåȣ(%r4) != 1
  8925. + 541
  8926. + 542 01ea 101A jrne negm2 ; then goto negm2
  8927. + 543
  8928. + 544 ; case: sign1 = 1
  8929. + 545 ;@@@ del 01/02/15 cmp %r11, 0 ; only change %r0 if xflag(%r11) = 0
  8930. + 546 01ec 0168 cmp %r1, 0 ; only change %r0 if xflag(%r1) = 0
  8931. + 547
  8932. + 548 01ee 091A jrne negm1
  8933. + 549 ;@@@ del 01/02/15 ld.w %r0, 0 ; ӥåȣ(%r0) <- 0
  8934. + 550 01f0 046C ld.w %r4, 0
  8935. + 551 ; SET_SIGN1 %r0, %r4 ; ͭ쥸[ӥåȣ] <- 0
  8936. + 552 __L0024:
  8937. + GAS LISTING adddf3.s page 11
  8938. +
  8939. +
  8940. + 553 01f2 FFCFFFDF xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  8941. + 553 F073
  8942. + 554 01f8 1470 and %r4,1 ; 1ӥåȥޥ
  8943. + 555 01fa 1498 rr %r4,1 ; ӥåȣΥӥåȰ֤˥ơ
  8944. + 556 01fc 4036 or %r0,%r4 ; ӥåȣå
  8945. + 557 01fe 149C rl %r4,1 ; ӥå
  8946. + 558
  8947. + 559 negm1:
  8948. + 560 0200 773E not %r7, %r7 ; negate the first input
  8949. + 561 0202 663E not %r6, %r6
  8950. + 562 0204 1660 add %r6, 1
  8951. + 563 0206 27B8 adc %r7, %r2 ; using %r2 (equals 0) to add the carry-over
  8952. + 564 0208 051E jp sign
  8953. + 565
  8954. + 566 negm2:
  8955. + 567 ; case: sign2 = 1
  8956. + 568 020a 993E not %r9, %r9 ; negate the second input
  8957. + 569 020c 883E not %r8, %r8
  8958. + 570 020e 1860 add %r8, 1
  8959. + 571 ;@@@ del 01/02/15 adc %r9, %r0 ; using %r0 (equals 0) to add carry-over
  8960. + 572 0210 49B8 adc %r9, %r4 ; using %r4 (equals 0) to add carry-over
  8961. + 573
  8962. + 574 sign:
  8963. + 575 ; fix sign
  8964. + 576 ; if xflag = 2 then result sign = sign2 (%r0 = %r2)
  8965. + 577 ; if xflag = 1 then result sign = sign1 (%r0 = %r0)
  8966. + 578 ; if xflag = 0 then result sign = 0 or 1
  8967. + 579
  8968. + 580 0212 2168 cmp %r1, 2 ; if xflag(%r1) != 2
  8969. + 581 0214 081A jrne addition ; then goto addition
  8970. + 582
  8971. + 583 ; case: xflag = 2
  8972. + 584 ;@@@ del 01/02/15 ld.w %r0, %r2 ; ӥåȣ(%r0) <- ӥåȣ(%r2)
  8973. + 585 ; SET_SIGN1 %r0, %r2 ; ͭ쥸[ӥåȣ] <- ӥåȣ(%r2)
  8974. + 586 __L0025:
  8975. + 587 0216 FFCFFFDF xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  8976. + 587 F073
  8977. + 588 021c 1270 and %r2,1 ; 1ӥåȥޥ
  8978. + 589 021e 1298 rr %r2,1 ; ӥåȣΥӥåȰ֤˥ơ
  8979. + 590 0220 2036 or %r0,%r2 ; ӥåȣå
  8980. + 591 0222 129C rl %r2,1 ; ӥå
  8981. + 592
  8982. + 593
  8983. + 594 addition:
  8984. + 595 ; %r0 = result sign, %r1 = result exponent
  8985. + 596 ; {%r7, %r6} = mantissa1, {%r9, %r8} = mantiss2
  8986. + 597 ; {%r5, %r5} = result
  8987. + 598
  8988. + 599 0224 642E ld.w %r4, %r6 ; [L](%r4) = [L](6) + [L](%r8)
  8989. + 600 0226 8422 add %r4, %r8
  8990. + 601
  8991. + 602 0228 752E ld.w %r5, %r7 ; [H](%r5) = [H](%r7) + [H](%r9) (with carry)
  8992. + 603 022a 95B8 adc %r5, %r9
  8993. + 604
  8994. + 605 022c 0568 cmp %r5, 0
  8995. + 606 022e 1408 jrgt count ; if [H](%r5) > 0 then normalize
  8996. + 607 0230 040C jrlt negative ; if [H](%r5) < 0 then negate result first
  8997. + GAS LISTING adddf3.s page 12
  8998. +
  8999. +
  9000. + 608
  9001. + 609 ; case: result1 = 0
  9002. + 610 0232 0468 cmp %r4, 0
  9003. + 611 0234 5018 jreq end ; if [L](%r4) = 0 then end
  9004. + 612 0236 1008 jrgt count ; if [L](%r4) > 0 then normalize
  9005. + 613
  9006. + 614 negative: ; result is negative
  9007. + 615 0238 553E not %r5, %r5 ; negate the 64-bit result
  9008. + 616 023a 443E not %r4, %r4
  9009. + 617 023c 1460 add %r4, 1 ; [L](%r4) = ~[L](%r4) + 1
  9010. + 618 023e 026C ld.w %r2, 0 ; %r2 = 0 (temp variable for carry-over add)
  9011. + 619 0240 25B8 adc %r5, %r2 ; [H](%r5) = ~[H](%r5) + carry over
  9012. + 620
  9013. + 621 ;@@@ 01/02/15 del cmp %r11, 0 ; if xflag(%r11) != 0 then goto count
  9014. + 622 0242 0168 cmp %r1, 0 ; if xflag(%r1) != 0 then goto count
  9015. + 623
  9016. + 624 0244 091A jrne count
  9017. + 625 ;@@@ 01/02/15 del ld.w %r0, 1 ; sign was 0 now sign = 1
  9018. + 626 0246 166C ld.w %r6, 1
  9019. + 627 ; SET_SIGN1 %r0, %r6 ; ͭ쥸[ӥåȣ] <- 1
  9020. + 628 __L0026:
  9021. + 629 0248 FFCFFFDF xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  9022. + 629 F073
  9023. + 630 024e 1670 and %r6,1 ; 1ӥåȥޥ
  9024. + 631 0250 1698 rr %r6,1 ; ӥåȣΥӥåȰ֤˥ơ
  9025. + 632 0252 6036 or %r0,%r6 ; ӥåȣå
  9026. + 633 0254 169C rl %r6,1 ; ӥå
  9027. + 634
  9028. + 635 count:
  9029. + 636 ; %r0 = result sign, %r1 = result exponent
  9030. + 637 ; {%r5, %r4} = result, %r13 = count
  9031. + 638
  9032. + 639 0256 162E ld.w %r6, %r1 ; xflag(%r6) <- xflag(%r1) @@@ 01/02/15 add
  9033. + 640
  9034. + 641 ;@@@ 01/02/15 del ld.w %r12, %r5 ; copy result to input register of subroutine
  9035. + 642 0258 582E ld.w %r8, %r5 ; copy result to input register of subroutine
  9036. + 643
  9037. + 644 ;@@@ 01/02/15 del ld.w %r13, %r4
  9038. + 645 025a 492E ld.w %r9, %r4
  9039. + 646 025c 00C000C0 xcall __scan64 ; call 64-bit scan subroutine
  9040. + 646 001C
  9041. + 647
  9042. + 648 ; check result exponent for normalizing
  9043. + 649
  9044. + 650 ; GET_EXP1 %r0, %r1 ; ؿ(%r1) <- ͭ쥸[ؿ](%r0)
  9045. + 651 __L0027:
  9046. + 652 0262 012E ld.w %r1,%r0 ;
  9047. + 653 0264 1FC0F173 xand %r1,0x7ff ; ͭ쥸 ؿ
  9048. + 654
  9049. + 655 0268 0168 cmp %r1, 0 ; if ؿ(%r1) != 0 then goto normalize
  9050. + 656 026a 051A jrne normalize
  9051. + 657
  9052. + 658 ; case: exp = 0
  9053. + 659 ;@@@ 01/02/15 del cmp %r13, 11 ; if count(%r13) != 11 then goto end (denormal result)
  9054. + 660 026c B968 cmp %r9, 11 ; if count(%r9) != 11 then goto end (denormal result)
  9055. + 661
  9056. + 662 026e 2D1A jrne finish
  9057. + GAS LISTING adddf3.s page 13
  9058. +
  9059. +
  9060. + 663
  9061. + 664 ; case: count = 11 & exp = 0 (denormal + denormal with carry-over result)
  9062. + 665 0270 2C1F jp.d finish
  9063. + 666 0272 116C ld.w %r1, 1 ; ؿ(%r1) <- 1
  9064. + 667
  9065. + 668 normalize:
  9066. + 669 ;@@@ 01/02/15 del cmp %r13, 11
  9067. + 670 0274 B968 cmp %r9, 11
  9068. + 671
  9069. + 672 0276 2918 jreq finish ; if count(%r13) = 11 then goto finish (no shifting needed)
  9070. + 673 0278 190C jrlt rshift ; if count(%r9) < 11 then need to shift right
  9071. + 674
  9072. + 675 ; case: count > 11 (need to shift left)
  9073. + 676 ;@@@ 01/02/15 del sub %r13, 11 ; count(%r13) = count(%r13) - 11
  9074. + 677 027a B964 sub %r9, 11 ; count(%r9) = count(%r9) - 11
  9075. + 678
  9076. + 679 ;@@@ 01/02/15 del cmp %r1, %r13 ; if ؿ(%r1) > count then normal result
  9077. + 680 027c 912A cmp %r1, %r9 ; if ؿ(%r1) > count(%r9) then normal result
  9078. + 681 027e 0408 jrgt lshift
  9079. + 682
  9080. + 683 ; case: exp <= count (denormal result)
  9081. + 684 0280 1164 sub %r1, 1 ; ؿ(%r1) = ؿ(%r1) - 1
  9082. + 685 0282 021F jp.d lshift
  9083. + 686 ;@@@ 01/02/15 del ld.w %r13, %r1 ; shift(%r13) = ؿ(%r1)
  9084. + 687 0284 192E ld.w %r9, %r1 ; shift(%r9) = ؿ(%r1)
  9085. + 688
  9086. + 689
  9087. + 690 lshift:
  9088. + 691 ; {%r5, %r4} << shift
  9089. + 692 ;xsll %r5, %r13 ; shift high 32-bits to the left x bits (shift amount = x)
  9090. + 693 ;xrl %r4, %r13 ; rotate low 32-bits to the left x bits
  9091. + 694 ;xsll %r2, %r13 ; make a mask for first 32-x bits --> %r2 = 111...000
  9092. + 695
  9093. + 696 0286 F26F ld.w %r2, -1 ; %r2 = 0xffff ffff
  9094. + 697 ;@@@ 01/02/15 del SHFTROTSHFT %r13, %r5, %r4, %r2, sll, rl, %r11
  9095. + 698 ; used in 64-bit variable shifting ; SHFTROTSHFT %r9, %r5, %r4, %r2, sll, rl, %r6
  9096. + 699 ; $1 = shift amount
  9097. + 700 ; $2 = 1st input register (shifted)
  9098. + 701 ; $3 = 2nd input register (rotated)
  9099. + 702 ; $4 = 3rd input register (mask --> shifted)
  9100. + 703 ; $5 = shift instruction
  9101. + 704 ; $6 = rotate instruction
  9102. + 705 ; $7 = temp register
  9103. + 706 0288 962E ld.w %r6, %r9 ; temp = shift amount
  9104. + 707
  9105. + 708 __L0028:
  9106. + 709 028a 8668 cmp %r6, 8 ; if temp <= 8 then goto $$2
  9107. + 710 028c 060E jrle __L0029
  9108. + 711
  9109. + 712 028e 858C sll %r5, 8 ; shift 1st register
  9110. + 713 0290 849C rl %r4, 8 ; rotate 2nd register
  9111. + 714 0292 828C sll %r2, 8 ; shift 3rd register
  9112. + 715 0294 FB1F jp.d __L0028
  9113. + 716 0296 8664 sub %r6, 8 ; temp = temp - 8
  9114. + 717
  9115. + 718 __L0029:
  9116. + 719 0298 658D sll %r5, %r6 ; last shift
  9117. + GAS LISTING adddf3.s page 14
  9118. +
  9119. +
  9120. + 720 029a 649D rl %r4, %r6 ; last rotate
  9121. + 721 029c 628D sll %r2, %r6 ; last shift
  9122. + 722
  9123. + 723 029e 233E not %r3, %r2 ; flip mask for last x bits --> %r3 = 000...111 (mask)
  9124. + 724 02a0 4332 and %r3, %r4 ; isolate last x bits of %r4
  9125. + 725 02a2 3536 or %r5, %r3 ; add last x bits of %r4 to %r5
  9126. + 726 02a4 2432 and %r4, %r2 ; keep the high 32-x bits of %r4
  9127. + 727
  9128. + 728 02a6 111F jp.d finish
  9129. + 729 ;@@@ 01/02/15 del sub %r1, %r13 ; ؿ(%r1) = ؿ(%r1) - shift(%r13)
  9130. + 730 02a8 9126 sub %r1, %r9 ; ؿ(%r1) = ؿ(%r1) - shift(%r9)
  9131. + 731
  9132. + 732 rshift:
  9133. + 733 ; shift to the right 1 bit
  9134. + 734 02aa 1488 srl %r4, 1 ; shift low 32-bits to the right 1 bit
  9135. + 735 02ac 136C ld.w %r3, 1 ; mask
  9136. + 736 02ae 5332 and %r3, %r5 ; get LSB of high 32-bits
  9137. + 737 02b0 1398 rr %r3, 1 ; rotate to MSB position
  9138. + 738 02b2 3436 or %r4, %r3 ; add to %r4
  9139. + 739 02b4 1588 srl %r5, 1 ; shift high 32-bits to the right 1 bit
  9140. + 740 02b6 1160 add %r1, 1 ; exp = exp + 1
  9141. + 741
  9142. + 742 ; overflow check
  9143. + 743 02b8 1FC0F16B xcmp %r1, 0x7ff ; if ؿ(%r1) < 0x7ff then jump to finish
  9144. + 744 02bc 060C jrlt finish
  9145. + 745
  9146. + 746 overflow:
  9147. + 747 02be FECF00C0 xld.w %r5, 0x7ff00000 ; put infinity into result
  9148. + 747 056C
  9149. + 748 02c4 081F jp.d end ; delayed jump
  9150. + 749 02c6 046C ld.w %r4, 0
  9151. + 750
  9152. + 751 finish:
  9153. + 752 ; %r0 = sign, %r1 = exponent, %r5 = mantissa
  9154. + 753 02c8 01C0FFDF xand %r5, 0xfffff ; isolate mantissa
  9155. + 753 F573
  9156. + 754
  9157. + 755 02ce 81984198 xrr %r1, 12 ; position exponent bits to [30:23]
  9158. + 756 02d2 1536 or %r5, %r1
  9159. + 757
  9160. + 758 end:
  9161. + 759 ;@@@ 01/02/15 del rr %r0, 1 ; position sign bit to MSB
  9162. + 760 ; GET_SIGN1 %r0, %r6 ; ӥåȣ(%r6) <- ͭ쥸[ӥåȣ](%r0)
  9163. + 761 __L0030:
  9164. + 762 02d4 062E ld.w %r6,%r0 ;
  9165. + 763 02d6 169C rl %r6,1 ; ӥåȥơ
  9166. + 764 02d8 1670 and %r6,1 ; ͭ쥸 ӥåȣ
  9167. + 765
  9168. + 766 02da 1698 rr %r6, 1 ; position sign bit to MSB @@@ 01/02/15 add
  9169. + 767 ;@@@ 01/02/15 del or %r5, %r0 ; [H](%r5) | ӥåȣ(%r0)
  9170. + 768 02dc 6536 or %r5, %r6 ; [H](%r5) | ӥåȣ(%r0)
  9171. + 769
  9172. + 770 ;@@@ 01/01/23 add start hinokuchi
  9173. + 771 ;ld.w %r13, [%sp+3] ; %r13
  9174. + 772 ;ld.w %r12, [%sp+2] ; %r12
  9175. + 773 ;ld.w %r11, [%sp+1] ; %r11
  9176. + 774 ;ld.w %r10, [%sp+0] ; %r10
  9177. + GAS LISTING adddf3.s page 15
  9178. +
  9179. +
  9180. + 775 ;add %sp, 4
  9181. + 776 ;@@@ 01/01/23 add end
  9182. + 777 02de 4302 popn %r3 ; restore register values
  9183. + 778 02e0 4006 ret
  9184. diff --git a/gcc/config/c33/libgcc/adddf3.s b/gcc/config/c33/libgcc/adddf3.s
  9185. new file mode 100644
  9186. index 0000000..38dcd59
  9187. --- /dev/null
  9188. +++ b/gcc/config/c33/libgcc/adddf3.s
  9189. @@ -0,0 +1,778 @@
  9190. +;*********************************************
  9191. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  9192. +;* ALL RIGHTS RESERVED
  9193. +;*
  9194. +;* filename : adddf3.s
  9195. +;*
  9196. +;* Double floating point addition function
  9197. +;* & subtract function
  9198. +;* input: (%r7, %r6) & (%r9, %r8)
  9199. +;* output: (%r5, %r4)
  9200. +;*
  9201. +;* Begin 1996/09/12 V. Chan
  9202. +;* Fixed sign bug 1997/02/17 V. Chan
  9203. +;* ѹ 2001/01/18 O.Hinokuchi
  9204. +;* 쥸֤
  9205. +;* gasб 2001/10/15 watanabe
  9206. +;*
  9207. +;*****************************************
  9208. +
  9209. +.section .text
  9210. +.align 1
  9211. +.global __adddf3
  9212. +.global __subdf3
  9213. +
  9214. +;==============================================
  9215. +;쥸
  9216. +; %r0:ӥåȣ(0(+) or 1(-))
  9217. +; %r1:ؿ(8bit)
  9218. +; %r2:ӥåȣ(0(+) or 1(-))/count
  9219. +; %r3:ؿ(8bit)
  9220. +; %r4:[L]
  9221. +; %r5:[H]
  9222. +; %r6:[L](double)/[L]/shift counter
  9223. +; %r7:[H](double)/[H]
  9224. +; %r8:[L](double)/[L]
  9225. +; %r9:[H](double)/[H]
  9226. +; %r10:temp/difference/implied
  9227. +; %r11:xflag
  9228. +; %r13:count/shift
  9229. +; -------------------------------------------
  9230. +; %r0:ͭ쥸
  9231. +; bit31:ؿ
  9232. +; bit30:ؿ
  9233. +; bit29-22:TEMP(1byte)
  9234. +; bit21-11:ؿ
  9235. +; bit10-0 :ؿ
  9236. +;==============================================
  9237. +
  9238. +
  9239. +;;macro VARSHIFT $1, $2, $3
  9240. + ; used in 32-bit variable shifting
  9241. + ; $1 = input register
  9242. + ; $2 = shift amount
  9243. + ; $3 = shift instruction
  9244. +
  9245. +;$$1:
  9246. +; cmp $2, 8 ; if temp <= 8 then goto $$2
  9247. +; jrle $$2
  9248. +
  9249. +; $3 $1, 8 ; shift input register 8 bits
  9250. +; jp.d $$1
  9251. +; sub $2, 8 ; temp = temp - 8
  9252. +
  9253. +;$$2:
  9254. +; $3 $1, $2 ; last shift
  9255. +;;endm
  9256. +
  9257. +;;macro SHFTROTSHFT $1, $2, $3, $4, $5, $6, $7
  9258. + ; used in 64-bit variable shifting
  9259. + ; $1 = shift amount
  9260. + ; $2 = 1st input register (shifted)
  9261. + ; $3 = 2nd input register (rotated)
  9262. + ; $4 = 3rd input register (mask --> shifted)
  9263. + ; $5 = shift instruction
  9264. + ; $6 = rotate instruction
  9265. + ; $7 = temp register
  9266. +; ld.w $7, $1 ; temp = shift amount
  9267. +
  9268. +;$$1:
  9269. +; cmp $7, 8 ; if temp <= 8 then goto $$2
  9270. +; jrle $$2
  9271. +
  9272. +; $5 $2, 8 ; shift 1st register
  9273. +; $6 $3, 8 ; rotate 2nd register
  9274. +; $5 $4, 8 ; shift 3rd register
  9275. +; jp.d $$1
  9276. +; sub $7, 8 ; temp = temp - 8
  9277. +
  9278. +;$$2:
  9279. +; $5 $2, $7 ; last shift
  9280. +; $6 $3, $7 ; last rotate
  9281. +; $5 $4, $7 ; last shift
  9282. +;;endm
  9283. +
  9284. +__subdf3:
  9285. + xxor %r9, 0x80000000 ; [H}(%r9)= [H](%r9) & 0x80000000
  9286. +
  9287. +__adddf3:
  9288. + pushn %r3 ; save register values
  9289. +
  9290. + ;@@@ 01/01/23 add start hinokuchi
  9291. + ;sub %sp, 4
  9292. + ;ld.w [%sp+0], %r10 ; %r10
  9293. + ;ld.w [%sp+1], %r11 ; %r11
  9294. + ;ld.w [%sp+2], %r12 ; %r12
  9295. + ;ld.w [%sp+3], %r13 ; %r13
  9296. + ;@@@ 01/01/23 add end
  9297. +
  9298. + ;@@@ 01/02/14 del start
  9299. + ;ld.w %r0, %r7 ; ӥåȣ(%r0) <- [H](%r7)
  9300. + ;rl %r0, 1 ; ӥåȣ(%r0) rotate left 1 bit
  9301. + ;and %r0, 1 ; ӥåȣ(%r0) & 1
  9302. + ;@@@ 01/01/23 del end
  9303. + ld.w %r0, 0 ; ͭ쥸ꥢ(%r0) @@@ 01/02/14 add
  9304. +
  9305. + ;@@@ 01/02/14 add start
  9306. + ld.w %r1, %r7 ; ӥåȣ(%r1) <- [H](%r7)
  9307. + rl %r1, 1 ; ӥåȣ(%r1) rotate left 1 bit
  9308. + and %r1, 1 ; ӥåȣ(%r1) & 1
  9309. + ; SET_SIGN1 %r0, %r1 ; ͭ쥸ӥåȣ¸
  9310. +__L0001:
  9311. + xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  9312. + and %r1,1 ; 1ӥåȥޥ
  9313. + rr %r1,1 ; ӥåȣΥӥåȰ֤˥ơ
  9314. + or %r0,%r1 ; ӥåȣå
  9315. + rl %r1,1 ; ӥå
  9316. + ;@@@ 01/01/23 add end
  9317. +
  9318. +
  9319. +
  9320. + ;@@@ 01/02/14 del start
  9321. + ;ld.w %r2, %r9 ; ӥåȣ(%r2) <- [H](%r9)
  9322. + ;rl %r2, 1 ; ӥåȣ(%r2) rotate left 1 bit
  9323. + ;and %r2, 1 ; ӥåȣ(%r2) & 1
  9324. + ;@@@ 01/01/23 del end
  9325. +
  9326. + ;@@@ 01/02/14 add start
  9327. + ld.w %r2, %r9 ; ӥåȣ(%r1) <- [H](%r9)
  9328. + rl %r2, 1 ; ӥåȣ(%r1) rotate left 1 bit
  9329. + and %r2, 1 ; ӥåȣ(%r1) & 1
  9330. + ; SET_SIGN2 %r0, %r2 ; ͭ쥸ӥåȣ¸
  9331. +__L0002:
  9332. + xand %r0,0xbfffffff ; ͭ쥸 ӥåȣꥢ
  9333. + and %r2,1 ; 1ӥåȥޥ
  9334. + rr %r2,2 ; ӥåȣΥӥåȰ֤˥ơ
  9335. + or %r0,%r2 ; ӥåȣå
  9336. + rl %r2,2 ; ӥå
  9337. +
  9338. + ;@@@ 01/01/23 add end
  9339. +
  9340. +
  9341. + ld.w %r1, %r7 ; ؿ(%r1) <- [H](%r7)
  9342. + sll %r1, 1 ; ؿ(%r1) << 1
  9343. + xsrl %r1, 21 ; ؿ(%r1) >> 21
  9344. +
  9345. + ; SET_EXP1 %r0, %r1 ; @@@ 01/02/14 add start
  9346. +__L0003:
  9347. + xand %r0,0xfffff800 ; ͭ쥸 ؿꥢ
  9348. + xand %r1,0x7ff ; ӥåȥޥ
  9349. + or %r0,%r1 ; ؿå
  9350. +
  9351. +
  9352. + xcmp %r1, 0x7ff ; if ؿ(%r1) >= ؿСե(0x7ff)
  9353. + xjrge overflow ; then jump to overflow
  9354. +
  9355. + ld.w %r3, %r9 ; ؿ(%r3) <- [H](%r9)
  9356. + sll %r3, 1 ; ؿ(%r3) << 1
  9357. + xsrl %r3, 21 ; ؿ(%r3) >> 21
  9358. +
  9359. + ; SET_EXP2 %r0, %r3 ; @@@ 01/02/14 add start
  9360. +__L0004:
  9361. + xand %r0,0xffc007ff ; ͭ쥸 ؿꥢ
  9362. + xand %r3,0x7ff ; ӥåȥޥ
  9363. + sll %r3,8 ; ؿΥӥåȰ֤˥ե
  9364. + sll %r3,3 ; ؿΥӥåȰ֤˥ե
  9365. + or %r0,%r3 ; ؿå
  9366. + srl %r3,8 ; ؿ
  9367. + srl %r3,3 ; ؿ
  9368. +
  9369. + ; GET_SIGN1 %r0, %r4
  9370. +__L0005:
  9371. + ld.w %r4,%r0 ;
  9372. + rl %r4,1 ; ӥåȥơ
  9373. + and %r4,1 ; ͭ쥸 ӥåȣ
  9374. +
  9375. +
  9376. + ;@@@ del 01/02/15 ld.w %r10, %r0 ; temp(%r10) = ӥåȣ(%r0)
  9377. + ;@@@ del 01/02/15 ld.w %r10, %r0 ; temp(%r10) = ӥåȣ(%r0)
  9378. +
  9379. + ; SET_SIGN1 %r0, %r2 ; ͭ쥸[ӥåȣ](%r0) <- ӥåȣ(%r2)
  9380. +__L0006:
  9381. + xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  9382. + and %r2,1 ; 1ӥåȥޥ
  9383. + rr %r2,1 ; ӥåȣΥӥåȰ֤˥ơ
  9384. + or %r0,%r2 ; ӥåȣå
  9385. + rl %r2,1 ; ӥå
  9386. + xcmp %r3, 0x7ff ; if ؿ(%r3) >= ؿСե(0x7ff)
  9387. + ;@@@ del 01/02/15 ld.w %r0, %r2 ; ӥåȣ(%r0) <- ӥåȣ(%r2)
  9388. + xjrge overflow ; then jump to overflow
  9389. + ; SET_SIGN1 %r0, %r4 ; ͭ쥸[ӥåȣ](%r0) <- ӥåȣ(%r2)
  9390. +__L0007:
  9391. + xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  9392. + and %r4,1 ; 1ӥåȥޥ
  9393. + rr %r4,1 ; ӥåȣΥӥåȰ֤˥ơ
  9394. + or %r0,%r4 ; ӥåȣå
  9395. + rl %r4,1 ; ӥå
  9396. +
  9397. + cmp %r1, %r3 ; if ؿ(%r1) < ؿ(%r3)
  9398. + jrlt ex1ltex2 ; then jump to ex1ltex2
  9399. + ;@@@ del 01/02/15 ld.w %r0, %r10 ; ӥåȣ(%r0) <- temp(%r10)
  9400. +
  9401. + ; case: exp1 >= exp2
  9402. + ld.w %r5, %r7 ; [H](%r5) <- [H](%r7)
  9403. + ;@@@ del 01/02/15 ld.w %r10, %r1 ; difference(%r10) = ؿ(%r1) - ؿ(%r3)
  9404. + ld.w %r4, %r1 ; difference(%r4) = ؿ(%r1) - ؿ(%r3)
  9405. + sub %r4, %r3
  9406. + ;@@@ del 01/02/15 sub %r10, %r3
  9407. +
  9408. + ;@@@ del 01/02/15 xcmp %r10, 0x35 ; if difference(%r10) >= 0x35 (53-bits) then
  9409. + xcmp %r4, 0x35 ; if difference(%r4) >= 0x35 (53-bits) then
  9410. +
  9411. + ld.w %r4, %r6 ; [L](%r4) <- [L](%r6)
  9412. + xjrge end ; return first input
  9413. + jp continue
  9414. +
  9415. +ex1ltex2:
  9416. + ld.w %r5, %r9 ; [H](%r5) <- [H](%r9)
  9417. + ;@@@ del 01/02/15 ld.w %r10, %r3 ; difference(%r10) = ؿ(%r1) - ؿ(%r3)
  9418. + ld.w %r4, %r3 ; difference(%r4) = ؿ(%r1) - ؿ(%r3)
  9419. +
  9420. + sub %r4, %r1
  9421. + ;@@@ del 01/02/15 sub %r10, %r1
  9422. +
  9423. + ;@@@ del 01/02/15 xcmp %r10, 0x35 ; if difference(%r10) >= 0x35 (53-bits) then
  9424. + xcmp %r4, 0x35 ; if difference(%r4) >= 0x35 (53-bits) then
  9425. +
  9426. + ld.w %r4, %r8 ; [L](%r4) <- [L](%r8)
  9427. + jrlt continue
  9428. + ;@@@ del 01/02/15 ld.w %r0, %r2 ; ӥåȣ(%r0) <- ӥåȣ(%r2)
  9429. + ; SET_SIGN1 %r0, %r2 ; ͭ쥸[ӥåȣ] <- ӥåȣ(%r2)@@@ add 01/02/15
  9430. +__L0008:
  9431. + xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  9432. + and %r2,1 ; 1ӥåȥޥ
  9433. + rr %r2,1 ; ӥåȣΥӥåȰ֤˥ơ
  9434. + or %r0,%r2 ; ӥåȣå
  9435. + rl %r2,1 ; ӥå
  9436. + xjp end ; return 2nd input
  9437. +
  9438. +continue:
  9439. + ;@@@ del 01/02/15 xld.w %r10, 0x100000 ; implied bit(%r10) <- 0x100000
  9440. + xld.w %r2, 0x100000 ; implied bit(%r2) <- 0x100000
  9441. +
  9442. + ;@@@ del 01/02/15 xld.w %r13, 0xfffff ; mask(%r13) <- 0xfffff
  9443. + xld.w %r4, 0xfffff ; mask(%r4) <- 0xfffff
  9444. +
  9445. + ; isolate mantissa1
  9446. + cmp %r1, 0 ; if ؿ(%r1) = 0 then goto getman2
  9447. + jreq.d getman2
  9448. + ;@@@ del 01/02/15 and %r7, %r13 ; [H](%r7) & mask(%r13) clear first 12 bits of %r7
  9449. + and %r7, %r4 ; [H](%r7) & mask(%r4) clear first 12 bits of %r7
  9450. +
  9451. + ;@@@ del 01/02/15 or %r7, %r10 ; [H](%r7) | mplied bit(%r10) else normal input --> add implied bit
  9452. + or %r7, %r2 ; [H](%r7) | mplied bit(%r2) else normal input --> add implied bit
  9453. +
  9454. +getman2:
  9455. + cmp %r3, 0 ; if ؿ(%r3) = 0 then goto signs
  9456. + jreq.d cmpexp
  9457. + ;@@@ del 01/02/15 and %r9, %r13 ; [H](%r9) & mask(%r13) clear first 12 bits of %r9
  9458. + and %r9, %r4 ; [H](%r9) & mask(%r4) clear first 12 bits of %r9
  9459. +
  9460. + ;@@@ del 01/02/15 or %r9, %r10 ; [H](%r9) | mplied bit(%r10) else normal input --> add implied bit
  9461. + or %r9, %r2 ; [H](%r9) | mplied bit(%r2) else normal input --> add implied bit
  9462. +
  9463. +cmpexp:
  9464. + ; compare exponents -- %r1 will be result exponent
  9465. + ; if exp1 > exp2 then mantissa2 is shifted to the right
  9466. + ; if exp2 > exp1 then mantissa1 is shifted to the right
  9467. +
  9468. + ;@@@ del 01/02/15 ld.w %r11, 0 ; xflag(%r11) = 0
  9469. + ld.w %r4, 0
  9470. + ; SET_TEMP %r0, %r4 ; ͭ쥸[temp](%r0) <- xflag = 0
  9471. +__L0009:
  9472. + xand %r0,0xc03fffff ; ͭ쥸 TEMPꥢ
  9473. + xand %r4,0xff ; 1Х mask
  9474. + rr %r4,8 ; TEMPΥӥåȰ֤˥ե
  9475. + rr %r4,2 ; TEMPΥӥåȰ֤˥ե
  9476. + or %r0,%r4 ; TEMPå
  9477. + rl %r4,8 ;
  9478. + rl %r4,2 ;
  9479. +
  9480. +
  9481. + cmp %r1, %r3
  9482. + jreq negation ; if ؿ(%r1) = ؿ(%r3) then jump to negation
  9483. + jrgt man2 ; if ؿ(%r1) > ؿ(%r3) then jump to man2
  9484. +
  9485. + ; case: exp1 < exp2
  9486. + ;@@@ del 01/02/15 ld.w %r11, 2 ; xflag(%r11) = 2
  9487. + ld.w %r4, 2
  9488. + ; SET_TEMP %r0, %r4 ; ͭ쥸[temp](%r0) <- xflag = 2
  9489. +__L0010:
  9490. + xand %r0,0xc03fffff ; ͭ쥸 TEMPꥢ
  9491. + xand %r4,0xff ; 1Х mask
  9492. + rr %r4,8 ; TEMPΥӥåȰ֤˥ե
  9493. + rr %r4,2 ; TEMPΥӥåȰ֤˥ե
  9494. + or %r0,%r4 ; TEMPå
  9495. + rl %r4,8 ;
  9496. + rl %r4,2 ;
  9497. +
  9498. +
  9499. + ;@@@ del 01/02/15 ld.w %r10, %r1 ; temp(%r10) = ؿ(%r1)
  9500. + ld.w %r4, %r1 ; temp(%r4) = ؿ(%r1)
  9501. +
  9502. + ld.w %r1, %r3 ; ؿ(%r1) = ؿ(%r3)
  9503. + ; SET_EXP1 %r0, %r1 ; @@@ 01/02/26 add start
  9504. +__L0011:
  9505. + xand %r0,0xfffff800 ; ͭ쥸 ؿꥢ
  9506. + xand %r1,0x7ff ; ӥåȥޥ
  9507. + or %r0,%r1 ; ؿå
  9508. +
  9509. +
  9510. + ;@@@ del 01/02/15 sub %r3, %r10 ; shift (%r3) = ؿ(%r3) - ؿ(%r1)
  9511. + sub %r3, %r4 ; shift (%r3) = ؿ(%r3) - ؿ(%r4)
  9512. +
  9513. + ;@@@ del 01/02/15 cmp %r10, 0 ; if ؿ(%r1) != 0 then goto shftm1 (normal)
  9514. + cmp %r4, 0 ; if ؿ(%r4) != 0 then goto shftm1 (normal)
  9515. +
  9516. + jrne shftm1
  9517. + sub %r3, 1 ; shift(%r3) = shift (%r3) - 1 else denormal --> decrement shift
  9518. +
  9519. +shftm1:
  9520. + xcmp %r3, 32 ; if shift(%r3) < 32 then 64-bit shift
  9521. + jrlt shift1
  9522. +
  9523. + ; case: shift >=32
  9524. + ld.w %r6, %r7 ; [L] <- [H] (32-bit shift)
  9525. + ld.w %r7, 0 ; [H] <- 0
  9526. + sub %r3, 32 ; shift(%r3) = shift(%r3) - 32
  9527. + ;xsrl %r6, %r3 ; man1_2 >> shift
  9528. + ; used in 32-bit variable shifting ; VARSHIFT %r6, %r3, srl
  9529. + ; $1 = input register
  9530. + ; $2 = shift amount
  9531. + ; $3 = shift instruction
  9532. +
  9533. +__L0012:
  9534. + cmp %r3, 8 ; if temp <= 8 then goto $$2
  9535. + jrle __L0013
  9536. +
  9537. + srl %r6, 8 ; shift input register 8 bits
  9538. + jp.d __L0012
  9539. + sub %r3, 8 ; temp = temp - 8
  9540. +
  9541. +__L0013:
  9542. + srl %r6, %r3 ; last shift
  9543. + jp negation
  9544. +
  9545. +shift1:
  9546. + ; shift {man1, man1_2} right
  9547. + ;xsrl %r6, %r3 ; shift low 32-bits to the right x bits (shift amount = x)
  9548. + ;xrr %r7, %r3 ; rotate high 32-bits to the right x bits
  9549. + ;xsrl %r10, %r3 ; make a mask for last 32-x bits --> %r10 = 000...111
  9550. +
  9551. + ;@@@ del 01/02/15 ld.w %r10, -1 ; mask(%r10) <- 0xffff ffff
  9552. + ld.w %r4, -1 ; mask(%r4) <- 0xffff ffff
  9553. +
  9554. + ;@@@ del 01/02/15 SHFTROTSHFT %r3, %r6, %r7, %r10, srl, rr, %r3
  9555. + ; used in 64-bit variable shifting ; SHFTROTSHFT %r3, %r6, %r7, %r4, srl, rr, %r3
  9556. + ; $1 = shift amount
  9557. + ; $2 = 1st input register (shifted)
  9558. + ; $3 = 2nd input register (rotated)
  9559. + ; $4 = 3rd input register (mask --> shifted)
  9560. + ; $5 = shift instruction
  9561. + ; $6 = rotate instruction
  9562. + ; $7 = temp register
  9563. + ld.w %r3, %r3 ; temp = shift amount
  9564. +
  9565. +__L0014:
  9566. + cmp %r3, 8 ; if temp <= 8 then goto $$2
  9567. + jrle __L0015
  9568. +
  9569. + srl %r6, 8 ; shift 1st register
  9570. + rr %r7, 8 ; rotate 2nd register
  9571. + srl %r4, 8 ; shift 3rd register
  9572. + jp.d __L0014
  9573. + sub %r3, 8 ; temp = temp - 8
  9574. +
  9575. +__L0015:
  9576. + srl %r6, %r3 ; last shift
  9577. + rr %r7, %r3 ; last rotate
  9578. + srl %r4, %r3 ; last shift
  9579. +
  9580. + ;@@@ del 01/02/15 not %r3, %r10 ; shift(%r3) = ~mask(%r10) flip mask for first x bits --> %r3 = 111...000 (mask)
  9581. + not %r3, %r4 ; shift(%r3) = ~mask(%r4) flip mask for first x bits --> %r3 = 111...000 (mask)
  9582. +
  9583. + and %r3, %r7 ; isolate first x bits of %r7
  9584. + or %r6, %r3 ; add first x bits of %r7 to %r6
  9585. + jp.d negation
  9586. + ;@@@ del 01/02/15 and %r7, %r10 ; keep the low 32-x bits of %r7
  9587. + and %r7, %r4 ; keep the low 32-x bits of %r7
  9588. +
  9589. +
  9590. +man2: ; case: ؿ(%r1) > ؿ(%r3)
  9591. + ;@@@ del 01/02/15 ld.w %r11, 1 ; xflag(%r11) = 1
  9592. + ld.w %r4, 1
  9593. + ; SET_TEMP %r0, %r4 ; ͭ쥸[temp](%r0) <- xflag = 1
  9594. +__L0016:
  9595. + xand %r0,0xc03fffff ; ͭ쥸 TEMPꥢ
  9596. + xand %r4,0xff ; 1Х mask
  9597. + rr %r4,8 ; TEMPΥӥåȰ֤˥ե
  9598. + rr %r4,2 ; TEMPΥӥåȰ֤˥ե
  9599. + or %r0,%r4 ; TEMPå
  9600. + rl %r4,8 ;
  9601. + rl %r4,2 ;
  9602. +
  9603. +
  9604. + ;@@@ del 01/02/15 ld.w %r10, %r1 ; temp(%r10) <- ؿ(%r1)
  9605. + ld.w %r4, %r1 ; temp(%r4) <- ؿ(%r1)
  9606. +
  9607. + ;@@@ del 01/02/15 sub %r10, %r3 ; shift(%r10) = ؿ(%r1) - ؿ(%r3)
  9608. + sub %r4, %r3 ; shift(%r4) = ؿ(%r1) - ؿ(%r3)
  9609. +
  9610. + cmp %r3, 0 ; if ؿ(%r1) != 0 then goto shftm2 (normal)
  9611. + jrne shftm2
  9612. + ;@@@ del 01/02/15 sub %r10, 1 ; else denormal --> shift(%r10) = shift(%r10) - 1
  9613. + sub %r4, 1 ; else denormal --> shift(%r4) = shift(%r4) - 1
  9614. +
  9615. +shftm2:
  9616. + ;@@@ del 01/02/15 xcmp %r10, 32 ; if shift(%r10) < 32 then 64-bit shift
  9617. + xcmp %r4, 32 ; if shift(%r4) < 32 then 64-bit shift
  9618. +
  9619. + jrlt shift2
  9620. +
  9621. + ; case: shift >=32
  9622. + ld.w %r8, %r9 ; [L] <- [H]
  9623. + ld.w %r9, 0 ; [H] <- 0
  9624. + ;@@@ del 01/02/15 sub %r10, 32 ; shift(%r10) = shift(%r10) - 32
  9625. + sub %r4, 32 ; shift(%r4) = shift(%r4) - 32
  9626. +
  9627. + ;xsrl %r8, %r10 ; man2_2 >> shift
  9628. + ;@@@ del 01/02/15 VARSHIFT %r8, %r10, srl
  9629. + ; used in 32-bit variable shifting ; VARSHIFT %r8, %r4, srl
  9630. + ; $1 = input register
  9631. + ; $2 = shift amount
  9632. + ; $3 = shift instruction
  9633. +
  9634. +__L0017:
  9635. + cmp %r4, 8 ; if temp <= 8 then goto $$2
  9636. + jrle __L0018
  9637. +
  9638. + srl %r8, 8 ; shift input register 8 bits
  9639. + jp.d __L0017
  9640. + sub %r4, 8 ; temp = temp - 8
  9641. +
  9642. +__L0018:
  9643. + srl %r8, %r4 ; last shift
  9644. +
  9645. + jp negation
  9646. +
  9647. +shift2:
  9648. + ; shift {man2, man2_2} right
  9649. + ;xsrl %r8, %r10 ; shift low 32-bits to the right x bits (shift amount = x)
  9650. + ;xrr %r9, %r10 ; rotate high 32-bits to the right x bits
  9651. + ;xsrl %r3, %r10 ; make a mask for last 32-x bits --> %r3 = 000...111
  9652. +
  9653. + ld.w %r3, -1 ; %r3 = 0xffff ffff
  9654. + ;@@@ del 01/02/15 SHFTROTSHFT %r10, %r8, %r9, %r3, srl, rr, %r13 ; %r13 = temp
  9655. + ; used in 64-bit variable shifting ; SHFTROTSHFT %r4, %r8, %r9, %r3, srl, rr, %r4 ; %r4 = temp
  9656. + ; $1 = shift amount
  9657. + ; $2 = 1st input register (shifted)
  9658. + ; $3 = 2nd input register (rotated)
  9659. + ; $4 = 3rd input register (mask --> shifted)
  9660. + ; $5 = shift instruction
  9661. + ; $6 = rotate instruction
  9662. + ; $7 = temp register
  9663. + ld.w %r4, %r4 ; temp = shift amount
  9664. +
  9665. +__L0019:
  9666. + cmp %r4, 8 ; if temp <= 8 then goto $$2
  9667. + jrle __L0020
  9668. +
  9669. + srl %r8, 8 ; shift 1st register
  9670. + rr %r9, 8 ; rotate 2nd register
  9671. + srl %r3, 8 ; shift 3rd register
  9672. + jp.d __L0019
  9673. + sub %r4, 8 ; temp = temp - 8
  9674. +
  9675. +__L0020:
  9676. + srl %r8, %r4 ; last shift
  9677. + rr %r9, %r4 ; last rotate
  9678. + srl %r3, %r4 ; last shift
  9679. +
  9680. + ;@@@ del 01/02/15 not %r10, %r3 ; flip mask for first x bits --> %r10 = 111...000 (mask)
  9681. + not %r4, %r3 ; flip mask for first x bits --> %r4 = 111...000 (mask)
  9682. +
  9683. + ;@@@ del 01/02/15 and %r10, %r9 ; isolate first x bits of %r9
  9684. + and %r4, %r9 ; isolate first x bits of %r9
  9685. +
  9686. + ;@@@ del 01/02/15 or %r8, %r10 ; add first x bits of %r9 to %r8
  9687. + or %r8, %r4 ; add first x bits of %r9 to %r8
  9688. +
  9689. + and %r9, %r3 ; keep the low 32-x bits of %r9
  9690. +
  9691. +negation:
  9692. + ; xflag = 0 if exp1 = exp2
  9693. + ; 1 if exp1 > exp2
  9694. + ; 2 if exp1 < exp2
  9695. + ; %r0 will now be result sign bit
  9696. +
  9697. + ; if exp1 = exp2 then this is the case
  9698. + ; sign1 (%r0) sign2 (%r2) result sign (%r0)
  9699. + ; 0 0 0 <== no change
  9700. + ; 1 0 0 <== change to 1 if result < 0
  9701. + ; 0 1 0 <== change to 1 if result < 0
  9702. + ; 1 1 1 <== no change
  9703. +
  9704. + ; GET_TEMP %r0, %r1 ; xflag(%r1) <- ͭ쥸[TEMP](%r0) @@@ 01/02/15 add
  9705. +__L0021:
  9706. + ld.w %r1,%r0
  9707. + rl %r1,8
  9708. + rl %r1,2
  9709. + xand %r1,0xff ; ͭ쥸 TEMP
  9710. +
  9711. + ; GET_SIGN1 %r0, %r4 ; ӥåȣ(%r4) <- ͭ쥸[ӥåȣ](%r0) @@@ 01/02/15 add
  9712. +__L0022:
  9713. + ld.w %r4,%r0 ;
  9714. + rl %r4,1 ; ӥåȥơ
  9715. + and %r4,1 ; ͭ쥸 ӥåȣ
  9716. +
  9717. + ; GET_SIGN2 %r0, %r2 ; ӥåȣ(%r2) <- ͭ쥸[ӥåȣ](%r0) @@@ 01/02/15 add
  9718. +__L0023:
  9719. + ld.w %r2,%r0 ;
  9720. + rl %r2,2 ; ӥåȥơ
  9721. + and %r2,1 ; ͭ쥸 ӥåȣ
  9722. +
  9723. +
  9724. + ;@@@ del 01/02/15 cmp %r0, %r2 ; if ӥåȣ(%r0) = ӥåȣ(%r2)
  9725. + cmp %r4, %r2 ; if ӥåȣ(%r4) = ӥåȣ(%r2)
  9726. +
  9727. + jreq sign ; then goto sign
  9728. + ;@@@ del 01/02/15 cmp %r0, 1 ; if ӥåȣ(%r0) != 1
  9729. + cmp %r4, 1 ; if ӥåȣ(%r4) != 1
  9730. +
  9731. + jrne negm2 ; then goto negm2
  9732. +
  9733. + ; case: sign1 = 1
  9734. + ;@@@ del 01/02/15 cmp %r11, 0 ; only change %r0 if xflag(%r11) = 0
  9735. + cmp %r1, 0 ; only change %r0 if xflag(%r1) = 0
  9736. +
  9737. + jrne negm1
  9738. + ;@@@ del 01/02/15 ld.w %r0, 0 ; ӥåȣ(%r0) <- 0
  9739. + ld.w %r4, 0
  9740. + ; SET_SIGN1 %r0, %r4 ; ͭ쥸[ӥåȣ] <- 0
  9741. +__L0024:
  9742. + xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  9743. + and %r4,1 ; 1ӥåȥޥ
  9744. + rr %r4,1 ; ӥåȣΥӥåȰ֤˥ơ
  9745. + or %r0,%r4 ; ӥåȣå
  9746. + rl %r4,1 ; ӥå
  9747. +
  9748. +negm1:
  9749. + not %r7, %r7 ; negate the first input
  9750. + not %r6, %r6
  9751. + add %r6, 1
  9752. + adc %r7, %r2 ; using %r2 (equals 0) to add the carry-over
  9753. + jp sign
  9754. +
  9755. +negm2:
  9756. + ; case: sign2 = 1
  9757. + not %r9, %r9 ; negate the second input
  9758. + not %r8, %r8
  9759. + add %r8, 1
  9760. + ;@@@ del 01/02/15 adc %r9, %r0 ; using %r0 (equals 0) to add carry-over
  9761. + adc %r9, %r4 ; using %r4 (equals 0) to add carry-over
  9762. +
  9763. +sign:
  9764. + ; fix sign
  9765. + ; if xflag = 2 then result sign = sign2 (%r0 = %r2)
  9766. + ; if xflag = 1 then result sign = sign1 (%r0 = %r0)
  9767. + ; if xflag = 0 then result sign = 0 or 1
  9768. +
  9769. + cmp %r1, 2 ; if xflag(%r1) != 2
  9770. + jrne addition ; then goto addition
  9771. +
  9772. + ; case: xflag = 2
  9773. + ;@@@ del 01/02/15 ld.w %r0, %r2 ; ӥåȣ(%r0) <- ӥåȣ(%r2)
  9774. + ; SET_SIGN1 %r0, %r2 ; ͭ쥸[ӥåȣ] <- ӥåȣ(%r2)
  9775. +__L0025:
  9776. + xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  9777. + and %r2,1 ; 1ӥåȥޥ
  9778. + rr %r2,1 ; ӥåȣΥӥåȰ֤˥ơ
  9779. + or %r0,%r2 ; ӥåȣå
  9780. + rl %r2,1 ; ӥå
  9781. +
  9782. +
  9783. +addition:
  9784. + ; %r0 = result sign, %r1 = result exponent
  9785. + ; {%r7, %r6} = mantissa1, {%r9, %r8} = mantiss2
  9786. + ; {%r5, %r5} = result
  9787. +
  9788. + ld.w %r4, %r6 ; [L](%r4) = [L](6) + [L](%r8)
  9789. + add %r4, %r8
  9790. +
  9791. + ld.w %r5, %r7 ; [H](%r5) = [H](%r7) + [H](%r9) (with carry)
  9792. + adc %r5, %r9
  9793. +
  9794. + cmp %r5, 0
  9795. + jrgt count ; if [H](%r5) > 0 then normalize
  9796. + jrlt negative ; if [H](%r5) < 0 then negate result first
  9797. +
  9798. + ; case: result1 = 0
  9799. + cmp %r4, 0
  9800. + jreq end ; if [L](%r4) = 0 then end
  9801. + jrgt count ; if [L](%r4) > 0 then normalize
  9802. +
  9803. +negative: ; result is negative
  9804. + not %r5, %r5 ; negate the 64-bit result
  9805. + not %r4, %r4
  9806. + add %r4, 1 ; [L](%r4) = ~[L](%r4) + 1
  9807. + ld.w %r2, 0 ; %r2 = 0 (temp variable for carry-over add)
  9808. + adc %r5, %r2 ; [H](%r5) = ~[H](%r5) + carry over
  9809. +
  9810. + ;@@@ 01/02/15 del cmp %r11, 0 ; if xflag(%r11) != 0 then goto count
  9811. + cmp %r1, 0 ; if xflag(%r1) != 0 then goto count
  9812. +
  9813. + jrne count
  9814. + ;@@@ 01/02/15 del ld.w %r0, 1 ; sign was 0 now sign = 1
  9815. + ld.w %r6, 1
  9816. + ; SET_SIGN1 %r0, %r6 ; ͭ쥸[ӥåȣ] <- 1
  9817. +__L0026:
  9818. + xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  9819. + and %r6,1 ; 1ӥåȥޥ
  9820. + rr %r6,1 ; ӥåȣΥӥåȰ֤˥ơ
  9821. + or %r0,%r6 ; ӥåȣå
  9822. + rl %r6,1 ; ӥå
  9823. +
  9824. +count:
  9825. + ; %r0 = result sign, %r1 = result exponent
  9826. + ; {%r5, %r4} = result, %r13 = count
  9827. +
  9828. + ld.w %r6, %r1 ; xflag(%r6) <- xflag(%r1) @@@ 01/02/15 add
  9829. +
  9830. + ;@@@ 01/02/15 del ld.w %r12, %r5 ; copy result to input register of subroutine
  9831. + ld.w %r8, %r5 ; copy result to input register of subroutine
  9832. +
  9833. + ;@@@ 01/02/15 del ld.w %r13, %r4
  9834. + ld.w %r9, %r4
  9835. + xcall __scan64 ; call 64-bit scan subroutine
  9836. +
  9837. + ; check result exponent for normalizing
  9838. +
  9839. + ; GET_EXP1 %r0, %r1 ; ؿ(%r1) <- ͭ쥸[ؿ](%r0)
  9840. +__L0027:
  9841. + ld.w %r1,%r0 ;
  9842. + xand %r1,0x7ff ; ͭ쥸 ؿ
  9843. +
  9844. + cmp %r1, 0 ; if ؿ(%r1) != 0 then goto normalize
  9845. + jrne normalize
  9846. +
  9847. + ; case: exp = 0
  9848. + ;@@@ 01/02/15 del cmp %r13, 11 ; if count(%r13) != 11 then goto end (denormal result)
  9849. + cmp %r9, 11 ; if count(%r9) != 11 then goto end (denormal result)
  9850. +
  9851. + jrne finish
  9852. +
  9853. + ; case: count = 11 & exp = 0 (denormal + denormal with carry-over result)
  9854. + jp.d finish
  9855. + ld.w %r1, 1 ; ؿ(%r1) <- 1
  9856. +
  9857. +normalize:
  9858. + ;@@@ 01/02/15 del cmp %r13, 11
  9859. + cmp %r9, 11
  9860. +
  9861. + jreq finish ; if count(%r13) = 11 then goto finish (no shifting needed)
  9862. + jrlt rshift ; if count(%r9) < 11 then need to shift right
  9863. +
  9864. + ; case: count > 11 (need to shift left)
  9865. + ;@@@ 01/02/15 del sub %r13, 11 ; count(%r13) = count(%r13) - 11
  9866. + sub %r9, 11 ; count(%r9) = count(%r9) - 11
  9867. +
  9868. + ;@@@ 01/02/15 del cmp %r1, %r13 ; if ؿ(%r1) > count then normal result
  9869. + cmp %r1, %r9 ; if ؿ(%r1) > count(%r9) then normal result
  9870. + jrgt lshift
  9871. +
  9872. + ; case: exp <= count (denormal result)
  9873. + sub %r1, 1 ; ؿ(%r1) = ؿ(%r1) - 1
  9874. + jp.d lshift
  9875. + ;@@@ 01/02/15 del ld.w %r13, %r1 ; shift(%r13) = ؿ(%r1)
  9876. + ld.w %r9, %r1 ; shift(%r9) = ؿ(%r1)
  9877. +
  9878. +
  9879. +lshift:
  9880. + ; {%r5, %r4} << shift
  9881. + ;xsll %r5, %r13 ; shift high 32-bits to the left x bits (shift amount = x)
  9882. + ;xrl %r4, %r13 ; rotate low 32-bits to the left x bits
  9883. + ;xsll %r2, %r13 ; make a mask for first 32-x bits --> %r2 = 111...000
  9884. +
  9885. + ld.w %r2, -1 ; %r2 = 0xffff ffff
  9886. + ;@@@ 01/02/15 del SHFTROTSHFT %r13, %r5, %r4, %r2, sll, rl, %r11
  9887. + ; used in 64-bit variable shifting ; SHFTROTSHFT %r9, %r5, %r4, %r2, sll, rl, %r6
  9888. + ; $1 = shift amount
  9889. + ; $2 = 1st input register (shifted)
  9890. + ; $3 = 2nd input register (rotated)
  9891. + ; $4 = 3rd input register (mask --> shifted)
  9892. + ; $5 = shift instruction
  9893. + ; $6 = rotate instruction
  9894. + ; $7 = temp register
  9895. + ld.w %r6, %r9 ; temp = shift amount
  9896. +
  9897. +__L0028:
  9898. + cmp %r6, 8 ; if temp <= 8 then goto $$2
  9899. + jrle __L0029
  9900. +
  9901. + sll %r5, 8 ; shift 1st register
  9902. + rl %r4, 8 ; rotate 2nd register
  9903. + sll %r2, 8 ; shift 3rd register
  9904. + jp.d __L0028
  9905. + sub %r6, 8 ; temp = temp - 8
  9906. +
  9907. +__L0029:
  9908. + sll %r5, %r6 ; last shift
  9909. + rl %r4, %r6 ; last rotate
  9910. + sll %r2, %r6 ; last shift
  9911. +
  9912. + not %r3, %r2 ; flip mask for last x bits --> %r3 = 000...111 (mask)
  9913. + and %r3, %r4 ; isolate last x bits of %r4
  9914. + or %r5, %r3 ; add last x bits of %r4 to %r5
  9915. + and %r4, %r2 ; keep the high 32-x bits of %r4
  9916. +
  9917. + jp.d finish
  9918. + ;@@@ 01/02/15 del sub %r1, %r13 ; ؿ(%r1) = ؿ(%r1) - shift(%r13)
  9919. + sub %r1, %r9 ; ؿ(%r1) = ؿ(%r1) - shift(%r9)
  9920. +
  9921. +rshift:
  9922. + ; shift to the right 1 bit
  9923. + srl %r4, 1 ; shift low 32-bits to the right 1 bit
  9924. + ld.w %r3, 1 ; mask
  9925. + and %r3, %r5 ; get LSB of high 32-bits
  9926. + rr %r3, 1 ; rotate to MSB position
  9927. + or %r4, %r3 ; add to %r4
  9928. + srl %r5, 1 ; shift high 32-bits to the right 1 bit
  9929. + add %r1, 1 ; exp = exp + 1
  9930. +
  9931. + ; overflow check
  9932. + xcmp %r1, 0x7ff ; if ؿ(%r1) < 0x7ff then jump to finish
  9933. + jrlt finish
  9934. +
  9935. +overflow:
  9936. + xld.w %r5, 0x7ff00000 ; put infinity into result
  9937. + jp.d end ; delayed jump
  9938. + ld.w %r4, 0
  9939. +
  9940. +finish:
  9941. + ; %r0 = sign, %r1 = exponent, %r5 = mantissa
  9942. + xand %r5, 0xfffff ; isolate mantissa
  9943. +
  9944. + xrr %r1, 12 ; position exponent bits to [30:23]
  9945. + or %r5, %r1
  9946. +
  9947. +end:
  9948. + ;@@@ 01/02/15 del rr %r0, 1 ; position sign bit to MSB
  9949. + ; GET_SIGN1 %r0, %r6 ; ӥåȣ(%r6) <- ͭ쥸[ӥåȣ](%r0)
  9950. +__L0030:
  9951. + ld.w %r6,%r0 ;
  9952. + rl %r6,1 ; ӥåȥơ
  9953. + and %r6,1 ; ͭ쥸 ӥåȣ
  9954. +
  9955. + rr %r6, 1 ; position sign bit to MSB @@@ 01/02/15 add
  9956. + ;@@@ 01/02/15 del or %r5, %r0 ; [H](%r5) | ӥåȣ(%r0)
  9957. + or %r5, %r6 ; [H](%r5) | ӥåȣ(%r0)
  9958. +
  9959. + ;@@@ 01/01/23 add start hinokuchi
  9960. + ;ld.w %r13, [%sp+3] ; %r13
  9961. + ;ld.w %r12, [%sp+2] ; %r12
  9962. + ;ld.w %r11, [%sp+1] ; %r11
  9963. + ;ld.w %r10, [%sp+0] ; %r10
  9964. + ;add %sp, 4
  9965. + ;@@@ 01/01/23 add end
  9966. + popn %r3 ; restore register values
  9967. + ret
  9968. diff --git a/gcc/config/c33/libgcc/addsf3.lst b/gcc/config/c33/libgcc/addsf3.lst
  9969. new file mode 100644
  9970. index 0000000..06a57f8
  9971. --- /dev/null
  9972. +++ b/gcc/config/c33/libgcc/addsf3.lst
  9973. @@ -0,0 +1,399 @@
  9974. +GAS LISTING addsf3.s page 1
  9975. +
  9976. +
  9977. + 1 ;*********************************************
  9978. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  9979. + 3 ;* ALL RIGHTS RESERVED
  9980. + 4 ;*
  9981. + 5 ;* filename : addsf3.s
  9982. + 6 ;*
  9983. + 7 ;* Single floating point add function
  9984. + 8 ;* subtract function
  9985. + 9 ;* input: %r6, %r7
  9986. + 10 ;* output: %r4
  9987. + 11 ;*
  9988. + 12 ;* Begin 1996/09/12 V. Chan
  9989. + 13 ;* Fixed sign bug 1997/02/17 V. Chan
  9990. + 14 ;* Fixed a precision bug 1997/02/24 V. Chan
  9991. + 15 ;* ѹ 2001/01/15 O.Hinokuchi
  9992. + 16 ;* gasб 2001/10/15 watanabe
  9993. + 17 ;*
  9994. + 18 ;*********************************************
  9995. + 19
  9996. + 20 .section .text
  9997. + 21 .align 1
  9998. + 22 .global __addsf3
  9999. + 23 .global __subsf3
  10000. + 24
  10001. + 25 ;==============================================
  10002. + 26 ;쥸
  10003. + 27 ; %r0:ӥåȣ(0(+) or 1(-))
  10004. + 28 ; %r1:ؿ(8bit)
  10005. + 29 ; %r2:ӥåȣ(0(+) or 1(-))/count
  10006. + 30 ; %r3:ؿ(8bit)
  10007. + 31 ; %r4:
  10008. + 32 ; %r5:ؿСե(8bit)/xflag
  10009. + 33 ; %r6:(float)//shift counter
  10010. + 34 ; %r7:(float)/
  10011. + 35 ; %r8:temp/implied bit/shift/loop counter
  10012. + 36 ; %r9:mask
  10013. + 37 ;==============================================
  10014. + 38
  10015. + 39
  10016. + 40 ;;macro VARSHIFT $1, $2, $3
  10017. + 41 ; used in 32-bit variable shifting
  10018. + 42 ; $1 = input register
  10019. + 43 ; $2 = shift amount
  10020. + 44 ; $3 = shift instruction
  10021. + 45
  10022. + 46 ;$$1:
  10023. + 47 ; cmp $2, 8 ; if temp <= 8 then goto $$2
  10024. + 48 ; jrle $$2
  10025. + 49
  10026. + 50 ; $3 $1, 8 ; shift input register 8 bits
  10027. + 51 ; jp.d $$1
  10028. + 52 ; sub $2, 8 ; temp = temp - 8
  10029. + 53
  10030. + 54 ;$$2:
  10031. + 55 ; $3 $1, $2 ; last shift
  10032. + 56 ;;endm
  10033. + 57
  10034. + GAS LISTING addsf3.s page 2
  10035. +
  10036. +
  10037. + 58 __subsf3:
  10038. + 59 0000 00D000C0 xxor %r7, 0x80000000 ; (%r7)= (%r7) & 0x80000000
  10039. + 59 0778
  10040. + 60
  10041. + 61 __addsf3:
  10042. + 62 0006 0302 pushn %r3 ; save register values
  10043. + 63
  10044. + 64 0008 03C0F56F xld.w %r5, 0xff ; ؿСե <- 0xff
  10045. + 65
  10046. + 66 000c 602E ld.w %r0, %r6 ; ӥåȣ(%r0) <- (%r6)
  10047. + 67 000e 109C rl %r0, 1 ; ӥåȣ(%r0) rotate left 1 bit
  10048. + 68 0010 1070 and %r0, 1 ; ӥåȣ(%r0) & 1
  10049. + 69 0012 082E ld.w %r8, %r0 ; temp(%r8) = ӥåȣ(%r0)
  10050. + 70
  10051. + 71 0014 722E ld.w %r2, %r7 ; ӥåȣ(%r0) <- (%r7)
  10052. + 72 0016 129C rl %r2, 1 ; ӥåȣ(%r2) rotate left 1 bit
  10053. + 73 0018 1270 and %r2, 1 ; ӥåȣ(%r2) & 1
  10054. + 74
  10055. + 75 001a 612E ld.w %r1, %r6 ; ؿ(%r1) <- (%r6)
  10056. + 76 001c 118C sll %r1, 1 ; ؿ(%r1) << 1
  10057. + 77 001e 81888188 xsrl %r1, 24 ; ؿ(%r1) >> 24
  10058. + 77 8188
  10059. + 78
  10060. + 79 0024 512A cmp %r1, %r5 ; if ؿ(%r1) >= ؿСե(%r5)
  10061. + 80 0026 00C000C0 xjrge overflow ; then jump to overflow
  10062. + 80 920A
  10063. + 81
  10064. + 82 002c 732E ld.w %r3, %r7 ; ؿ(%r3) <- (%r6)
  10065. + 83 002e 138C sll %r3, 1 ; ؿ(%r3) << 1
  10066. + 84 0030 83888388 xsrl %r3, 24 ; ؿ(%r3) >> 24
  10067. + 84 8388
  10068. + 85 0036 202E ld.w %r0, %r2 ; ӥåȣ(%r0) <- ӥåȣ(%r0)
  10069. + 86
  10070. + 87 0038 532A cmp %r3, %r5 ; if ؿ(%r3) >= ؿСե(%r5)
  10071. + 88 003a 00C000C0 xjrge overflow ; then jump to overflow
  10072. + 88 880A
  10073. + 89
  10074. + 90 0040 312A cmp %r1, %r3 ; if ؿ(%r1) < ؿ(%r3)
  10075. + 91 0042 0A0D jrlt.d ex1ltex2 ; then jump to ex1ltex2
  10076. + 92 0044 802E ld.w %r0, %r8 ; ӥåȣ(%r0) <- temp(%r8)
  10077. + 93
  10078. + 94 ; case: exp1 >= exp2
  10079. + 95 0046 182E ld.w %r8, %r1 ; temp(%r8) = ӥåȣ(%r0) - ؿ(%r3) (difference)
  10080. + 96 0048 3826 sub %r8, %r3 ; temp(%r8) = temp(%r8) - ؿ(%r3)
  10081. + 97 004a 8869 cmp %r8, 0x18 ; if temp(%r8)difference >= 0x18 (24-bits it too large)
  10082. + 98 004c 642E ld.w %r4, %r6 ; (%r4) <- (%r6)
  10083. + 99 004e 00C000C0 xjrge end ; then jump to end return first input
  10084. + 99 860A
  10085. + 100 0054 0A1E jp continue
  10086. + 101
  10087. + 102 ex1ltex2:
  10088. + 103 ; case: exp2 > exp1
  10089. + 104 0056 382E ld.w %r8, %r3 ; temp(%r8) <- ؿ(%r3)
  10090. + 105 0058 1826 sub %r8, %r1 ; temp(%r8) = ؿ(%r3) - ؿ(%r1)
  10091. + 106 005a 8869 xcmp %r8, 0x18 ; if temp(%r8)difference < 0x18
  10092. + 107 005c 742E ld.w %r4, %r7 ; (%r4) <-
  10093. + 108 005e 050C jrlt continue ; then jump to continue
  10094. + GAS LISTING addsf3.s page 3
  10095. +
  10096. +
  10097. + 109 0060 202E ld.w %r0, %r2 ; ӥåȣ(%r0) <- ӥåȣ(%r2)
  10098. + 110 0062 00C000C0 xjp end ; return second input
  10099. + 110 7C1E
  10100. + 111
  10101. + 112 continue:
  10102. + 113 0068 0FC0FFDF xld.w %r9, 0x7fffff ; mask(%r9) <- 0x7fffff
  10103. + 113 F96F
  10104. + 114 006e 10C000C0 xld.w %r8, 0x800000 ; implied bit(%r8) <- 0x800000
  10105. + 114 086C
  10106. + 115
  10107. + 116 ; isolate mantissa1
  10108. + 117 0074 0168 cmp %r1, 0 ; if ؿ(%r1) = 0
  10109. + 118 0076 0319 jreq.d getman2 ; then jump to getman2
  10110. + 119 0078 9632 and %r6, %r9 ; (%r6) & mask(%r9)
  10111. + 120 007a 8636 or %r6, %r8 ; (%r6) & mplied bit(%r8)
  10112. + 121
  10113. + 122 getman2:
  10114. + 123 ; isolate mantissa2
  10115. + 124 007c 0368 cmp %r3, 0 ; if ؿ(%r3) = 0
  10116. + 125 007e 0319 jreq.d cmpexp ; then jump to cmpexp
  10117. + 126 0080 9732 and %r7, %r9 ; (%r7) & mask(%r9) clear first 9 bits of %r7
  10118. + 127 0082 8736 or %r7, %r8 ; (%r7) | mplied bit(%r8) if exp2 != 0 then add implied bit (normal)
  10119. + 128
  10120. + 129 cmpexp:
  10121. + 130 ; compare exponents -- %r1 will be result exponent
  10122. + 131 ; if exp1 > exp2 then mantissa2 is shifted to the right
  10123. + 132 ; if exp2 > exp1 then mantissa1 is shifted to the right
  10124. + 133
  10125. + 134 ; shift mantissa left for increased precision
  10126. + 135 0084 168C sll %r6, 1 ; (%r6) << 1
  10127. + 136 0086 178C sll %r7, 1 ; (%r6) << 1
  10128. + 137
  10129. + 138 ; xflag indicates which input (1 or 2) is the smaller input
  10130. + 139 0088 056C ld.w %r5, 0 ; xflag(%r5) <- 0
  10131. + 140
  10132. + 141 008a 312A cmp %r1, %r3
  10133. + 142 008c 1C18 jreq negation ; if ؿ(%r1) = ؿ(%r3) then jump to negation
  10134. + 143 008e 0F08 jrgt man2 ; if ؿ(%r1) > ؿ(%r3) then jump to man2
  10135. + 144
  10136. + 145 ; case: exp1 < exp2
  10137. + 146 0090 0168 cmp %r1, 0
  10138. + 147 0092 182E ld.w %r8, %r1 ; temp(%r8) <- ؿ(%r1)
  10139. + 148 0094 031B jrne.d shftm1 ; if ؿ(%r1) != 0 then normal
  10140. + 149 0096 312E ld.w %r1, %r3 ; ؿ(%r1) <- ؿ(%r3) result exp = exp2
  10141. + 150 0098 1364 sub %r3, 1 ; ؿ(%r3) = ؿ(%r3) - 1 else denormal --> decrement shift
  10142. + 151
  10143. + 152 shftm1:
  10144. + 153 009a 8326 sub %r3, %r8 ; ؿ(%r3) = ؿ(%r3) - temp(%r8) shift amount = exp2 - temp (exp1)
  10145. + 154
  10146. + 155 ;xsrl %r6, %r3 ; man1 >> shift
  10147. + 156 ; used in 32-bit variable shifting ; VARSHIFT %r6, %r3, srl ; (%r6) >> shift
  10148. + 157 ; $1 = input register
  10149. + 158 ; $2 = shift amount
  10150. + 159 ; $3 = shift instruction
  10151. + 160
  10152. + 161 __L0001:
  10153. + 162 009c 8368 cmp %r3, 8 ; if temp <= 8 then goto $$2
  10154. + GAS LISTING addsf3.s page 4
  10155. +
  10156. +
  10157. + 163 009e 040E jrle __L0002
  10158. + 164
  10159. + 165 00a0 8688 srl %r6, 8 ; shift input register 8 bits
  10160. + 166 00a2 FD1F jp.d __L0001
  10161. + 167 00a4 8364 sub %r3, 8 ; temp = temp - 8
  10162. + 168
  10163. + 169 __L0002:
  10164. + 170 00a6 3689 srl %r6, %r3 ; last shift
  10165. + 171 00a8 0E1F jp.d negation
  10166. + 172 00aa 256C ld.w %r5, 2 ; xflag(%r5) = 2
  10167. + 173
  10168. + 174 man2:
  10169. + 175 ; case: ؿ > ؿ
  10170. + 176 00ac 0368 cmp %r3, 0
  10171. + 177 00ae 031B jrne.d shftm2 ; if ؿ(%r3) != 0 then normal
  10172. + 178 00b0 182E ld.w %r8, %r1 ; shift(%r8) <- ؿ
  10173. + 179 00b2 1864 sub %r8, 1 ; shift(%r8) = shift(%r8) - 1 else denormal -- decrement shift
  10174. + 180
  10175. + 181 shftm2:
  10176. + 182 00b4 3826 sub %r8, %r3 ; shift(%r8) = ؿ(%r1) - ؿ(%r3)
  10177. + 183
  10178. + 184 ;srl %r7, %r8 ; man2 >> shift
  10179. + 185 ; used in 32-bit variable shifting ; VARSHIFT %r7, %r8, srl ; (%r7) >> shift(%r8)
  10180. + 186 ; $1 = input register
  10181. + 187 ; $2 = shift amount
  10182. + 188 ; $3 = shift instruction
  10183. + 189
  10184. + 190 __L0003:
  10185. + 191 00b6 8868 cmp %r8, 8 ; if temp <= 8 then goto $$2
  10186. + 192 00b8 040E jrle __L0004
  10187. + 193
  10188. + 194 00ba 8788 srl %r7, 8 ; shift input register 8 bits
  10189. + 195 00bc FD1F jp.d __L0003
  10190. + 196 00be 8864 sub %r8, 8 ; temp = temp - 8
  10191. + 197
  10192. + 198 __L0004:
  10193. + 199 00c0 8789 srl %r7, %r8 ; last shift
  10194. + 200
  10195. + 201 00c2 156C ld.w %r5, 1 ; xflag(%r5) <- 1
  10196. + 202
  10197. + 203 negation:
  10198. + 204 ; xflag = 0 if exp1 = exp2
  10199. + 205 ; 1 if exp1 > exp2
  10200. + 206 ; 2 if exp1 < exp2
  10201. + 207 ; %r0 will now be result sign bit
  10202. + 208
  10203. + 209 ; if exp1 = exp2 then this is the case
  10204. + 210 ; sign1 (%r0) sign2 (%r2) result sign (%r0)
  10205. + 211 ; 0 0 0 <== no change
  10206. + 212 ; 1 0 0 <== change to 1 if result < 0
  10207. + 213 ; 0 1 0 <== change to 1 if result < 0
  10208. + 214 ; 1 1 1 <== no change
  10209. + 215
  10210. + 216 00c4 202A cmp %r0, %r2 ; if ӥåȣ(%r0) = ӥåȣ(%r2) compare sign bits
  10211. + 217 00c6 0B18 jreq sign ; then jump to sign
  10212. + 218 00c8 1068 cmp %r0, 1 ; if ӥåȣ(%r0) != 1
  10213. + 219 00ca 071A jrne negm2 ; then jump to negm2
  10214. + GAS LISTING addsf3.s page 5
  10215. +
  10216. +
  10217. + 220
  10218. + 221 ; case: sign1 = 1
  10219. + 222 00cc 0568 cmp %r5, 0 ; if xflag(%r5) != 0 only change %r0 if xflag = 0
  10220. + 223 00ce 021A jrne negm1 ; then jump to negm1
  10221. + 224 00d0 006C ld.w %r0, 0 ; ӥåȣ(%r0) <- 0 %r0 is now temp result sign (positive)
  10222. + 225
  10223. + 226 negm1:
  10224. + 227 00d2 663E not %r6, %r6 ; (%r6) = ~(%r6) negate man1
  10225. + 228 00d4 041F jp.d sign ; delayed jump to sign
  10226. + 229 00d6 1660 add %r6, 1 ; (%r6) = (%r6) + 1
  10227. + 230
  10228. + 231 negm2:
  10229. + 232 00d8 773E not %r7, %r7 ; (%r7) = ~(%r7) negate man2
  10230. + 233 00da 1760 add %r7, 1 ; (%r7) = (%r7) + 1
  10231. + 234
  10232. + 235 sign:
  10233. + 236 ; fix sign, case where exp2 > exp1 and sign2 = 1
  10234. + 237 ; if xflag = 2 then result sign = sign2 (%r0 = %r2)
  10235. + 238 ; if xflag = 1 then result sign = sign1 (%r0 = %r0)
  10236. + 239 ; if xflag = 0 then result sign = 0 or 1
  10237. + 240 00dc 2568 cmp %r5, 2 ; if xflag(%r5) != 2
  10238. + 241 00de 021A jrne addition ; then jump to addition begin addition
  10239. + 242
  10240. + 243 ; case: xflag = 2
  10241. + 244 00e0 202E ld.w %r0, %r2 ; ӥåȣ(%r0) <- ӥåȣ(%r2) result sign = sign2
  10242. + 245
  10243. + 246 addition:
  10244. + 247 ; %r0 = result sign, %r1 = result exponent
  10245. + 248 ; %r6 = mantissa1, %r7 = mantissa2
  10246. + 249 ; %r4 = result
  10247. + 250
  10248. + 251 00e2 7622 add %r6, %r7 ; = + add man1 and man2
  10249. + 252 00e4 642E ld.w %r4, %r6 ; (%r4) <- + put result (%r6) in %r4
  10250. + 253
  10251. + 254 00e6 0468 cmp %r4, 0 ; if (%r4) = 0
  10252. + 255 00e8 3B19 jreq.d end ; jump to end if result = 0
  10253. + 256 00ea 086C ld.w %r8, 0 ; loop counter(8) <- 0 clear temp register
  10254. + 257 00ec 0608 jrgt precount ; if result > 0 then continue with normalize
  10255. + 258
  10256. + 259 ; case: result < 0
  10257. + 260 00ee 443E not %r4, %r4 ; (%r4) = ~(%r4) + 1
  10258. + 261 00f0 1460 add %r4, 1
  10259. + 262
  10260. + 263 00f2 0568 cmp %r5, 0 ; if xflag(%r5) != 0
  10261. + 264 00f4 021A jrne precount ; then goto count
  10262. + 265 00f6 106C ld.w %r0, 1 ; ӥåȣ(%r0) <- 1 sign was 0 now sign = 1
  10263. + 266
  10264. + 267 precount:
  10265. + 268 00f8 1488 srl %r4, 1 ; (%r4) >> 1 compensate for shifts on 117, 118
  10266. + 269 00fa 462E ld.w %r6, %r4 ; shift counter(%r6) <- ((%r4) >> 1) copy new result to %r6 for counting
  10267. + 270
  10268. + 271 count:
  10269. + 272 00fc 628E scan1 %r2, %r6 ; scan1 count(%r2), shift counter(%r6) count = ; of 0's before leading 1 in result
  10270. + 273 00fe 0412 jruge expchk ; if count !=8 then goto expchk
  10271. + 274 0100 8860 add %r8, 8 ; loop counter(%r8) = loop counter (%r8) + 8 add 8 to loop counter
  10272. + 275 0102 FD1F jp.d count
  10273. + 276 0104 868C sll %r6, 8 ; shift counter(%r6) >> 8 shift 8 leading 0's out of %r6
  10274. + GAS LISTING addsf3.s page 6
  10275. +
  10276. +
  10277. + 277
  10278. + 278 expchk:
  10279. + 279 0106 8222 add %r2, %r8 ; count(%r2) = count(%r2) + loop counter(%r8)
  10280. + 280
  10281. + 281 0108 0168 cmp %r1, 0 ; if ؿ(%r1) != 0
  10282. + 282 010a 051A jrne normalize ; then jump to normalize
  10283. + 283
  10284. + 284 ; case: denormal + denormal (sisu = 0)
  10285. + 285 010c 8268 cmp %r2, 8 ; if count(%r2) != 8
  10286. + 286 010e 241A jrne finish ; then jump to finish
  10287. + 287 0110 231F jp.d finish
  10288. + 288 0112 116C ld.w %r1, 1 ; ؿ(%r1) <- 1 if count = 8 then normal result
  10289. + 289
  10290. + 290 normalize:
  10291. + 291 0114 8264 sub %r2, 8 ; count(%r2) = count(%r2) - 8
  10292. + 292 0116 2018 jreq finish ; if count(%r2) = 8 then no normalize needed
  10293. + 293 0118 150C jrlt shftrght ; if count(%r2) <= 8 then normal result with carry-over
  10294. + 294
  10295. + 295 ; case: count > 8
  10296. + 296 011a 212A cmp %r1, %r2 ; if ؿ(%r1) <= count(%r2)
  10297. + 297 011c 0A0E jrle denormal ; then denormal
  10298. + 298
  10299. + 299 011e 282E ld.w %r8, %r2 ; temp(%r8) <- count(%r2)
  10300. + 300 ; used in 32-bit variable shifting ; VARSHIFT %r4, %r2, sll ; (%r4) << count(%r2)
  10301. + 301 ; $1 = input register
  10302. + 302 ; $2 = shift amount
  10303. + 303 ; $3 = shift instruction
  10304. + 304
  10305. + 305 __L0005:
  10306. + 306 0120 8268 cmp %r2, 8 ; if temp <= 8 then goto $$2
  10307. + 307 0122 040E jrle __L0006
  10308. + 308
  10309. + 309 0124 848C sll %r4, 8 ; shift input register 8 bits
  10310. + 310 0126 FD1F jp.d __L0005
  10311. + 311 0128 8264 sub %r2, 8 ; temp = temp - 8
  10312. + 312
  10313. + 313 __L0006:
  10314. + 314 012a 248D sll %r4, %r2 ; last shift
  10315. + 315 ;xsll %r4, %r2 ; result << count
  10316. + 316
  10317. + 317 012c 151F jp.d finish
  10318. + 318 012e 8126 sub %r1, %r8 ; ؿ(%r1) = ؿ(%r1) - count(%r2)
  10319. + 319
  10320. + 320 denormal:
  10321. + 321 0130 1164 sub %r1, 1 ; ؿ(%r1) = ؿ(%r1) - 1 (shift to denormal position)
  10322. + 322 ; used in 32-bit variable shifting ; VARSHIFT %r4, %r1, sll ; (%r4) << ؿ(%r1)
  10323. + 323 ; $1 = input register
  10324. + 324 ; $2 = shift amount
  10325. + 325 ; $3 = shift instruction
  10326. + 326
  10327. + 327 __L0007:
  10328. + 328 0132 8168 cmp %r1, 8 ; if temp <= 8 then goto $$2
  10329. + 329 0134 040E jrle __L0008
  10330. + 330
  10331. + 331 0136 848C sll %r4, 8 ; shift input register 8 bits
  10332. + 332 0138 FD1F jp.d __L0007
  10333. + 333 013a 8164 sub %r1, 8 ; temp = temp - 8
  10334. + GAS LISTING addsf3.s page 7
  10335. +
  10336. +
  10337. + 334
  10338. + 335 __L0008:
  10339. + 336 013c 148D sll %r4, %r1 ; last shift
  10340. + 337 ;xsll %r4, %r1 ; result << exp
  10341. + 338 013e 0C1F jp.d finish
  10342. + 339 0140 016C ld.w %r1, 0 ; ؿ(%r1) <- 0 (denormal result)
  10343. + 340
  10344. + 341 shftrght:
  10345. + 342 0142 1488 srl %r4, 1 ; (%r4) >> 1
  10346. + 343 0144 1160 add %r1, 1 ; ؿ(%r1) = ؿ(%r1) + 1
  10347. + 344
  10348. + 345 ; overflow check
  10349. + 346 0146 03C0F56F xld.w %r5, 0xff ; ؿСե(%r5) <- 0xff add:01/01/19 Hinokuchi set overflow compari
  10350. + 347 014a 512A cmp %r1, %r5 ; if ؿ(%r1) < 0xff
  10351. + 348 014c 050C jrlt finish ; then jump to finish
  10352. + 349
  10353. + 350 overflow:
  10354. + 351 014e F0CF00C0 xld.w %r4, 0x7f800000 ; (%r4) <- 0x7f800000 put infinity into result
  10355. + 351 046C
  10356. + 352 0154 051E jp end
  10357. + 353
  10358. + 354 finish:
  10359. + 355 ; %r0 = sign, %r1 = exponent, %r4 = mantissa
  10360. + 356
  10361. + 357 0156 9432 and %r4, %r9 ; (%r4) = (%r4) & mask(%r9) isolate mantissa
  10362. + 358
  10363. + 359 0158 81981198 xrr %r1, 9 ; ؿ(%r1) bit[3023]˥ե position exponent bits to [30:23]
  10364. + 360 015c 1436 or %r4, %r1 ; (%r4) = ؿ(%r1) | (%r4)
  10365. + 361
  10366. + 362 end:
  10367. + 363 015e 1098 rr %r0, 1 ; ӥåȣ(%r0)bit[31]˥ե position sign bit to MSB
  10368. + 364 0160 0436 or %r4, %r0 ; (%r4) = ӥåȣ(%r0) | ؿ(%r1) | (%r4) add sign bit
  10369. + 365
  10370. + 366 0162 4302 popn %r3 ; restore register values
  10371. + 367
  10372. + 368 0164 4006 ret
  10373. diff --git a/gcc/config/c33/libgcc/addsf3.s b/gcc/config/c33/libgcc/addsf3.s
  10374. new file mode 100644
  10375. index 0000000..9f01ece
  10376. --- /dev/null
  10377. +++ b/gcc/config/c33/libgcc/addsf3.s
  10378. @@ -0,0 +1,368 @@
  10379. +;*********************************************
  10380. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  10381. +;* ALL RIGHTS RESERVED
  10382. +;*
  10383. +;* filename : addsf3.s
  10384. +;*
  10385. +;* Single floating point add function
  10386. +;* subtract function
  10387. +;* input: %r6, %r7
  10388. +;* output: %r4
  10389. +;*
  10390. +;* Begin 1996/09/12 V. Chan
  10391. +;* Fixed sign bug 1997/02/17 V. Chan
  10392. +;* Fixed a precision bug 1997/02/24 V. Chan
  10393. +;* ѹ 2001/01/15 O.Hinokuchi
  10394. +;* gasб 2001/10/15 watanabe
  10395. +;*
  10396. +;*********************************************
  10397. +
  10398. +.section .text
  10399. +.align 1
  10400. +.global __addsf3
  10401. +.global __subsf3
  10402. +
  10403. +;==============================================
  10404. +;쥸
  10405. +; %r0:ӥåȣ(0(+) or 1(-))
  10406. +; %r1:ؿ(8bit)
  10407. +; %r2:ӥåȣ(0(+) or 1(-))/count
  10408. +; %r3:ؿ(8bit)
  10409. +; %r4:
  10410. +; %r5:ؿСե(8bit)/xflag
  10411. +; %r6:(float)//shift counter
  10412. +; %r7:(float)/
  10413. +; %r8:temp/implied bit/shift/loop counter
  10414. +; %r9:mask
  10415. +;==============================================
  10416. +
  10417. +
  10418. +;;macro VARSHIFT $1, $2, $3
  10419. + ; used in 32-bit variable shifting
  10420. + ; $1 = input register
  10421. + ; $2 = shift amount
  10422. + ; $3 = shift instruction
  10423. +
  10424. +;$$1:
  10425. +; cmp $2, 8 ; if temp <= 8 then goto $$2
  10426. +; jrle $$2
  10427. +
  10428. +; $3 $1, 8 ; shift input register 8 bits
  10429. +; jp.d $$1
  10430. +; sub $2, 8 ; temp = temp - 8
  10431. +
  10432. +;$$2:
  10433. +; $3 $1, $2 ; last shift
  10434. +;;endm
  10435. +
  10436. +__subsf3:
  10437. + xxor %r7, 0x80000000 ; (%r7)= (%r7) & 0x80000000
  10438. +
  10439. +__addsf3:
  10440. + pushn %r3 ; save register values
  10441. +
  10442. + xld.w %r5, 0xff ; ؿСե <- 0xff
  10443. +
  10444. + ld.w %r0, %r6 ; ӥåȣ(%r0) <- (%r6)
  10445. + rl %r0, 1 ; ӥåȣ(%r0) rotate left 1 bit
  10446. + and %r0, 1 ; ӥåȣ(%r0) & 1
  10447. + ld.w %r8, %r0 ; temp(%r8) = ӥåȣ(%r0)
  10448. +
  10449. + ld.w %r2, %r7 ; ӥåȣ(%r0) <- (%r7)
  10450. + rl %r2, 1 ; ӥåȣ(%r2) rotate left 1 bit
  10451. + and %r2, 1 ; ӥåȣ(%r2) & 1
  10452. +
  10453. + ld.w %r1, %r6 ; ؿ(%r1) <- (%r6)
  10454. + sll %r1, 1 ; ؿ(%r1) << 1
  10455. + xsrl %r1, 24 ; ؿ(%r1) >> 24
  10456. +
  10457. + cmp %r1, %r5 ; if ؿ(%r1) >= ؿСե(%r5)
  10458. + xjrge overflow ; then jump to overflow
  10459. +
  10460. + ld.w %r3, %r7 ; ؿ(%r3) <- (%r6)
  10461. + sll %r3, 1 ; ؿ(%r3) << 1
  10462. + xsrl %r3, 24 ; ؿ(%r3) >> 24
  10463. + ld.w %r0, %r2 ; ӥåȣ(%r0) <- ӥåȣ(%r0)
  10464. +
  10465. + cmp %r3, %r5 ; if ؿ(%r3) >= ؿСե(%r5)
  10466. + xjrge overflow ; then jump to overflow
  10467. +
  10468. + cmp %r1, %r3 ; if ؿ(%r1) < ؿ(%r3)
  10469. + jrlt.d ex1ltex2 ; then jump to ex1ltex2
  10470. + ld.w %r0, %r8 ; ӥåȣ(%r0) <- temp(%r8)
  10471. +
  10472. + ; case: exp1 >= exp2
  10473. + ld.w %r8, %r1 ; temp(%r8) = ӥåȣ(%r0) - ؿ(%r3) (difference)
  10474. + sub %r8, %r3 ; temp(%r8) = temp(%r8) - ؿ(%r3)
  10475. + cmp %r8, 0x18 ; if temp(%r8)difference >= 0x18 (24-bits it too large)
  10476. + ld.w %r4, %r6 ; (%r4) <- (%r6)
  10477. + xjrge end ; then jump to end return first input
  10478. + jp continue
  10479. +
  10480. +ex1ltex2:
  10481. + ; case: exp2 > exp1
  10482. + ld.w %r8, %r3 ; temp(%r8) <- ؿ(%r3)
  10483. + sub %r8, %r1 ; temp(%r8) = ؿ(%r3) - ؿ(%r1)
  10484. + xcmp %r8, 0x18 ; if temp(%r8)difference < 0x18
  10485. + ld.w %r4, %r7 ; (%r4) <-
  10486. + jrlt continue ; then jump to continue
  10487. + ld.w %r0, %r2 ; ӥåȣ(%r0) <- ӥåȣ(%r2)
  10488. + xjp end ; return second input
  10489. +
  10490. +continue:
  10491. + xld.w %r9, 0x7fffff ; mask(%r9) <- 0x7fffff
  10492. + xld.w %r8, 0x800000 ; implied bit(%r8) <- 0x800000
  10493. +
  10494. + ; isolate mantissa1
  10495. + cmp %r1, 0 ; if ؿ(%r1) = 0
  10496. + jreq.d getman2 ; then jump to getman2
  10497. + and %r6, %r9 ; (%r6) & mask(%r9)
  10498. + or %r6, %r8 ; (%r6) & mplied bit(%r8)
  10499. +
  10500. +getman2:
  10501. + ; isolate mantissa2
  10502. + cmp %r3, 0 ; if ؿ(%r3) = 0
  10503. + jreq.d cmpexp ; then jump to cmpexp
  10504. + and %r7, %r9 ; (%r7) & mask(%r9) clear first 9 bits of %r7
  10505. + or %r7, %r8 ; (%r7) | mplied bit(%r8) if exp2 != 0 then add implied bit (normal)
  10506. +
  10507. +cmpexp:
  10508. + ; compare exponents -- %r1 will be result exponent
  10509. + ; if exp1 > exp2 then mantissa2 is shifted to the right
  10510. + ; if exp2 > exp1 then mantissa1 is shifted to the right
  10511. +
  10512. + ; shift mantissa left for increased precision
  10513. + sll %r6, 1 ; (%r6) << 1
  10514. + sll %r7, 1 ; (%r6) << 1
  10515. +
  10516. + ; xflag indicates which input (1 or 2) is the smaller input
  10517. + ld.w %r5, 0 ; xflag(%r5) <- 0
  10518. +
  10519. + cmp %r1, %r3
  10520. + jreq negation ; if ؿ(%r1) = ؿ(%r3) then jump to negation
  10521. + jrgt man2 ; if ؿ(%r1) > ؿ(%r3) then jump to man2
  10522. +
  10523. + ; case: exp1 < exp2
  10524. + cmp %r1, 0
  10525. + ld.w %r8, %r1 ; temp(%r8) <- ؿ(%r1)
  10526. + jrne.d shftm1 ; if ؿ(%r1) != 0 then normal
  10527. + ld.w %r1, %r3 ; ؿ(%r1) <- ؿ(%r3) result exp = exp2
  10528. + sub %r3, 1 ; ؿ(%r3) = ؿ(%r3) - 1 else denormal --> decrement shift
  10529. +
  10530. +shftm1:
  10531. + sub %r3, %r8 ; ؿ(%r3) = ؿ(%r3) - temp(%r8) shift amount = exp2 - temp (exp1)
  10532. +
  10533. + ;xsrl %r6, %r3 ; man1 >> shift
  10534. + ; used in 32-bit variable shifting ; VARSHIFT %r6, %r3, srl ; (%r6) >> shift
  10535. + ; $1 = input register
  10536. + ; $2 = shift amount
  10537. + ; $3 = shift instruction
  10538. +
  10539. +__L0001:
  10540. + cmp %r3, 8 ; if temp <= 8 then goto $$2
  10541. + jrle __L0002
  10542. +
  10543. + srl %r6, 8 ; shift input register 8 bits
  10544. + jp.d __L0001
  10545. + sub %r3, 8 ; temp = temp - 8
  10546. +
  10547. +__L0002:
  10548. + srl %r6, %r3 ; last shift
  10549. + jp.d negation
  10550. + ld.w %r5, 2 ; xflag(%r5) = 2
  10551. +
  10552. +man2:
  10553. + ; case: ؿ > ؿ
  10554. + cmp %r3, 0
  10555. + jrne.d shftm2 ; if ؿ(%r3) != 0 then normal
  10556. + ld.w %r8, %r1 ; shift(%r8) <- ؿ
  10557. + sub %r8, 1 ; shift(%r8) = shift(%r8) - 1 else denormal -- decrement shift
  10558. +
  10559. +shftm2:
  10560. + sub %r8, %r3 ; shift(%r8) = ؿ(%r1) - ؿ(%r3)
  10561. +
  10562. + ;srl %r7, %r8 ; man2 >> shift
  10563. + ; used in 32-bit variable shifting ; VARSHIFT %r7, %r8, srl ; (%r7) >> shift(%r8)
  10564. + ; $1 = input register
  10565. + ; $2 = shift amount
  10566. + ; $3 = shift instruction
  10567. +
  10568. +__L0003:
  10569. + cmp %r8, 8 ; if temp <= 8 then goto $$2
  10570. + jrle __L0004
  10571. +
  10572. + srl %r7, 8 ; shift input register 8 bits
  10573. + jp.d __L0003
  10574. + sub %r8, 8 ; temp = temp - 8
  10575. +
  10576. +__L0004:
  10577. + srl %r7, %r8 ; last shift
  10578. +
  10579. + ld.w %r5, 1 ; xflag(%r5) <- 1
  10580. +
  10581. +negation:
  10582. + ; xflag = 0 if exp1 = exp2
  10583. + ; 1 if exp1 > exp2
  10584. + ; 2 if exp1 < exp2
  10585. + ; %r0 will now be result sign bit
  10586. +
  10587. + ; if exp1 = exp2 then this is the case
  10588. + ; sign1 (%r0) sign2 (%r2) result sign (%r0)
  10589. + ; 0 0 0 <== no change
  10590. + ; 1 0 0 <== change to 1 if result < 0
  10591. + ; 0 1 0 <== change to 1 if result < 0
  10592. + ; 1 1 1 <== no change
  10593. +
  10594. + cmp %r0, %r2 ; if ӥåȣ(%r0) = ӥåȣ(%r2) compare sign bits
  10595. + jreq sign ; then jump to sign
  10596. + cmp %r0, 1 ; if ӥåȣ(%r0) != 1
  10597. + jrne negm2 ; then jump to negm2
  10598. +
  10599. + ; case: sign1 = 1
  10600. + cmp %r5, 0 ; if xflag(%r5) != 0 only change %r0 if xflag = 0
  10601. + jrne negm1 ; then jump to negm1
  10602. + ld.w %r0, 0 ; ӥåȣ(%r0) <- 0 %r0 is now temp result sign (positive)
  10603. +
  10604. +negm1:
  10605. + not %r6, %r6 ; (%r6) = ~(%r6) negate man1
  10606. + jp.d sign ; delayed jump to sign
  10607. + add %r6, 1 ; (%r6) = (%r6) + 1
  10608. +
  10609. +negm2:
  10610. + not %r7, %r7 ; (%r7) = ~(%r7) negate man2
  10611. + add %r7, 1 ; (%r7) = (%r7) + 1
  10612. +
  10613. +sign:
  10614. + ; fix sign, case where exp2 > exp1 and sign2 = 1
  10615. + ; if xflag = 2 then result sign = sign2 (%r0 = %r2)
  10616. + ; if xflag = 1 then result sign = sign1 (%r0 = %r0)
  10617. + ; if xflag = 0 then result sign = 0 or 1
  10618. + cmp %r5, 2 ; if xflag(%r5) != 2
  10619. + jrne addition ; then jump to addition begin addition
  10620. +
  10621. + ; case: xflag = 2
  10622. + ld.w %r0, %r2 ; ӥåȣ(%r0) <- ӥåȣ(%r2) result sign = sign2
  10623. +
  10624. +addition:
  10625. + ; %r0 = result sign, %r1 = result exponent
  10626. + ; %r6 = mantissa1, %r7 = mantissa2
  10627. + ; %r4 = result
  10628. +
  10629. + add %r6, %r7 ; = + add man1 and man2
  10630. + ld.w %r4, %r6 ; (%r4) <- + put result (%r6) in %r4
  10631. +
  10632. + cmp %r4, 0 ; if (%r4) = 0
  10633. + jreq.d end ; jump to end if result = 0
  10634. + ld.w %r8, 0 ; loop counter(8) <- 0 clear temp register
  10635. + jrgt precount ; if result > 0 then continue with normalize
  10636. +
  10637. + ; case: result < 0
  10638. + not %r4, %r4 ; (%r4) = ~(%r4) + 1
  10639. + add %r4, 1
  10640. +
  10641. + cmp %r5, 0 ; if xflag(%r5) != 0
  10642. + jrne precount ; then goto count
  10643. + ld.w %r0, 1 ; ӥåȣ(%r0) <- 1 sign was 0 now sign = 1
  10644. +
  10645. +precount:
  10646. + srl %r4, 1 ; (%r4) >> 1 compensate for shifts on 117, 118
  10647. + ld.w %r6, %r4 ; shift counter(%r6) <- ((%r4) >> 1) copy new result to %r6 for counting
  10648. +
  10649. +count:
  10650. + scan1 %r2, %r6 ; scan1 count(%r2), shift counter(%r6) count = ; of 0's before leading 1 in result
  10651. + jruge expchk ; if count !=8 then goto expchk
  10652. + add %r8, 8 ; loop counter(%r8) = loop counter (%r8) + 8 add 8 to loop counter
  10653. + jp.d count
  10654. + sll %r6, 8 ; shift counter(%r6) >> 8 shift 8 leading 0's out of %r6
  10655. +
  10656. +expchk:
  10657. + add %r2, %r8 ; count(%r2) = count(%r2) + loop counter(%r8)
  10658. +
  10659. + cmp %r1, 0 ; if ؿ(%r1) != 0
  10660. + jrne normalize ; then jump to normalize
  10661. +
  10662. + ; case: denormal + denormal (sisu = 0)
  10663. + cmp %r2, 8 ; if count(%r2) != 8
  10664. + jrne finish ; then jump to finish
  10665. + jp.d finish
  10666. + ld.w %r1, 1 ; ؿ(%r1) <- 1 if count = 8 then normal result
  10667. +
  10668. +normalize:
  10669. + sub %r2, 8 ; count(%r2) = count(%r2) - 8
  10670. + jreq finish ; if count(%r2) = 8 then no normalize needed
  10671. + jrlt shftrght ; if count(%r2) <= 8 then normal result with carry-over
  10672. +
  10673. + ; case: count > 8
  10674. + cmp %r1, %r2 ; if ؿ(%r1) <= count(%r2)
  10675. + jrle denormal ; then denormal
  10676. +
  10677. + ld.w %r8, %r2 ; temp(%r8) <- count(%r2)
  10678. + ; used in 32-bit variable shifting ; VARSHIFT %r4, %r2, sll ; (%r4) << count(%r2)
  10679. + ; $1 = input register
  10680. + ; $2 = shift amount
  10681. + ; $3 = shift instruction
  10682. +
  10683. +__L0005:
  10684. + cmp %r2, 8 ; if temp <= 8 then goto $$2
  10685. + jrle __L0006
  10686. +
  10687. + sll %r4, 8 ; shift input register 8 bits
  10688. + jp.d __L0005
  10689. + sub %r2, 8 ; temp = temp - 8
  10690. +
  10691. +__L0006:
  10692. + sll %r4, %r2 ; last shift
  10693. + ;xsll %r4, %r2 ; result << count
  10694. +
  10695. + jp.d finish
  10696. + sub %r1, %r8 ; ؿ(%r1) = ؿ(%r1) - count(%r2)
  10697. +
  10698. +denormal:
  10699. + sub %r1, 1 ; ؿ(%r1) = ؿ(%r1) - 1 (shift to denormal position)
  10700. + ; used in 32-bit variable shifting ; VARSHIFT %r4, %r1, sll ; (%r4) << ؿ(%r1)
  10701. + ; $1 = input register
  10702. + ; $2 = shift amount
  10703. + ; $3 = shift instruction
  10704. +
  10705. +__L0007:
  10706. + cmp %r1, 8 ; if temp <= 8 then goto $$2
  10707. + jrle __L0008
  10708. +
  10709. + sll %r4, 8 ; shift input register 8 bits
  10710. + jp.d __L0007
  10711. + sub %r1, 8 ; temp = temp - 8
  10712. +
  10713. +__L0008:
  10714. + sll %r4, %r1 ; last shift
  10715. + ;xsll %r4, %r1 ; result << exp
  10716. + jp.d finish
  10717. + ld.w %r1, 0 ; ؿ(%r1) <- 0 (denormal result)
  10718. +
  10719. +shftrght:
  10720. + srl %r4, 1 ; (%r4) >> 1
  10721. + add %r1, 1 ; ؿ(%r1) = ؿ(%r1) + 1
  10722. +
  10723. + ; overflow check
  10724. + xld.w %r5, 0xff ; ؿСե(%r5) <- 0xff add:01/01/19 Hinokuchi set overflow comparison value
  10725. + cmp %r1, %r5 ; if ؿ(%r1) < 0xff
  10726. + jrlt finish ; then jump to finish
  10727. +
  10728. +overflow:
  10729. + xld.w %r4, 0x7f800000 ; (%r4) <- 0x7f800000 put infinity into result
  10730. + jp end
  10731. +
  10732. +finish:
  10733. + ; %r0 = sign, %r1 = exponent, %r4 = mantissa
  10734. +
  10735. + and %r4, %r9 ; (%r4) = (%r4) & mask(%r9) isolate mantissa
  10736. +
  10737. + xrr %r1, 9 ; ؿ(%r1) bit[3023]˥ե position exponent bits to [30:23]
  10738. + or %r4, %r1 ; (%r4) = ؿ(%r1) | (%r4)
  10739. +
  10740. +end:
  10741. + rr %r0, 1 ; ӥåȣ(%r0)bit[31]˥ե position sign bit to MSB
  10742. + or %r4, %r0 ; (%r4) = ӥåȣ(%r0) | ؿ(%r1) | (%r4) add sign bit
  10743. +
  10744. + popn %r3 ; restore register values
  10745. +
  10746. + ret
  10747. diff --git a/gcc/config/c33/libgcc/divdf3.lst b/gcc/config/c33/libgcc/divdf3.lst
  10748. new file mode 100644
  10749. index 0000000..59aa746
  10750. --- /dev/null
  10751. +++ b/gcc/config/c33/libgcc/divdf3.lst
  10752. @@ -0,0 +1,719 @@
  10753. +GAS LISTING divdf3.s page 1
  10754. +
  10755. +
  10756. + 1 ;*********************************************
  10757. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  10758. + 3 ;* ALL RIGHTS RESERVED
  10759. + 4 ;*
  10760. + 5 ;* filename : divdf3.s
  10761. + 6 ;*
  10762. + 7 ;* Double floating point division function
  10763. + 8 ;* input: (%r7, %r6) & (%r9, %r8)
  10764. + 9 ;* output: (%r5, %r4)
  10765. + 10 ;*
  10766. + 11 ;* Begin 1996/09/12 V. Chan
  10767. + 12 ;* ѹ 2001/01/31 O.Hinokuchi
  10768. + 13 ;* gasб 2001/10/15 watanabe
  10769. + 14 ;*
  10770. + 15 ;*****************************************
  10771. + 16
  10772. + 17 .section .text
  10773. + 18 .align 1
  10774. + 19 .global __divdf3
  10775. + 20
  10776. + 21 ;==============================================
  10777. + 22 ;쥸
  10778. + 23 ; %r0:ӥåȣ(0(+) or 1(-))
  10779. + 24 ; %r1:ؿ(11bit)
  10780. + 25 ; %r2:ӥåȣ(0(+) or 1(-))/shift/flag
  10781. + 26 ; %r3:ؿ(11bit)/count/loop
  10782. + 27 ; %r4:[L]
  10783. + 28 ; %r5:[H]
  10784. + 29 ; %r6:[L]()/[L]
  10785. + 30 ; %r7:[H]()/[H]
  10786. + 31 ; %r8:[L]()/[L]
  10787. + 32 ; %r9:[H]()/[H]
  10788. + 33 ; %r10:implied bit/lshift
  10789. + 34 ; %r11:count1/shift/flag/extra
  10790. + 35 ; %r12:scan64 /count2
  10791. + 36 ; %r13:loop counter/scan64 /shift
  10792. + 37 ;==============================================
  10793. + 38
  10794. + 39 ;;macro SHFTROTSHFT $1, $2, $3, $4, $5, $6, $7
  10795. + 40 ; used in 64-bit variable shifts
  10796. + 41 ; $1 = shift amount
  10797. + 42 ; $2 = 1st input register (shifted)
  10798. + 43 ; $3 = 2nd input register (rotated)
  10799. + 44 ; $4 = 3rd input register (mask --> shifted)
  10800. + 45 ; $5 = shift instruction
  10801. + 46 ; $6 = rotate instruction
  10802. + 47 ; $7 = temp register
  10803. + 48 ; ld.w $7, $1 ; temp = shift amount
  10804. + 49
  10805. + 50 ;$$1:
  10806. + 51 ; cmp $7, 8 ; if temp <= 8 then goto $$2
  10807. + 52 ; jrle $$2
  10808. + 53
  10809. + 54 ; $5 $2, 8 ; shift 1st register
  10810. + 55 ; $6 $3, 8 ; rotate 2nd register
  10811. + 56 ; $5 $4, 8 ; shift 3rd register
  10812. + 57 ; jp.d $$1
  10813. + GAS LISTING divdf3.s page 2
  10814. +
  10815. +
  10816. + 58 ; sub $7, 8 ; temp = temp - 8
  10817. + 59
  10818. + 60 ;$$2:
  10819. + 61 ; $5 $2, $7 ; last shift
  10820. + 62 ; $6 $3, $7 ; last rotate
  10821. + 63 ; $5 $4, $7 ; last shift
  10822. + 64 ;;endm
  10823. + 65
  10824. + 66 __divdf3:
  10825. + 67 0000 0302 pushn %r3 ; save register values
  10826. + 68 ;@@@ 01/01/30 add start hinokuchi
  10827. + 69 ;sub %sp, 4
  10828. + 70 ;ld.w [%sp+0], %r10 ; %r10
  10829. + 71 ;ld.w [%sp+1], %r11 ; %r11
  10830. + 72 ;ld.w [%sp+2], %r12 ; %r12
  10831. + 73 ;ld.w [%sp+3], %r13 ; %r13
  10832. + 74 ;@@@ 01/01/30 add end
  10833. + 75 0002 006C ld.w %r0, 0 ; ͭ쥸ꥢ @@@ 01/02/19
  10834. + 76
  10835. + 77 0004 712E ld.w %r1, %r7 ; ӥåȣ(%r1) <- [H](%r7)
  10836. + 78 0006 119C rl %r1, 1 ; ӥåȣ(%r1) rotate left 1 bit
  10837. + 79 0008 1170 and %r1, 1 ; ӥåȣ(%r1) & 1
  10838. + 80
  10839. + 81 000a 922E ld.w %r2, %r9 ; ӥåȣ(%r2) <- [H](%r9)
  10840. + 82 000c 129C rl %r2, 1 ; ӥåȣ(%r2) rotate left 1 bit
  10841. + 83 000e 1270 and %r2, 1 ; ӥåȣ(%r2) & 1
  10842. + 84
  10843. + 85 0010 213A xor %r1, %r2 ; ӥåȣ(%r0) = ~ӥåȣ(%r0)
  10844. + 86 ; SET_SIGN1 %r0, %r1
  10845. + 87 __L0001:
  10846. + 88 0012 FFCFFFDF xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  10847. + 88 F073
  10848. + 89 0018 1170 and %r1,1 ; 1ӥåȥޥ
  10849. + 90 001a 1198 rr %r1,1 ; ӥåȣΥӥåȰ֤˥ơ
  10850. + 91 001c 1036 or %r0,%r1 ; ӥåȣå
  10851. + 92 001e 119C rl %r1,1 ; ӥå
  10852. + 93
  10853. + 94 0020 056C ld.w %r5, 0 ; [H](%r5) <- 0
  10854. + 95 0022 046C ld.w %r4, 0 ; [L](%r4) <- 0
  10855. + 96
  10856. + 97 0024 178C sll %r7, 1 ; [H](%r7) << 1
  10857. + 98 0026 1788 srl %r7, 1 ; [H](%r7) >> 1
  10858. + 99 0028 0768 cmp %r7, 0 ; if [H](%r7) != 0 then check input2
  10859. + 100 002a 041A jrne zerochk2
  10860. + 101 002c 0668 cmp %r6, 0 ; if [L](%r6) = 0 then end
  10861. + 102 002e 01C0 ext end@rm
  10862. + 103 0030 6018 jreq end@rl
  10863. + 104
  10864. + 105 zerochk2:
  10865. + 106 0032 198C sll %r9, 1 ; [H](%r9) << 1
  10866. + 107 0034 1988 srl %r9, 1 ; [H](%r9) >> 1
  10867. + 108 0036 0968 cmp %r9, 0 ; if [H](%r9) != 0 then goto getexp
  10868. + 109 0038 041A jrne getexp
  10869. + 110 003a 0868 cmp %r8, 0 ; if [L](%r8) = 0 then overflow
  10870. + 111 003c 01C0 ext overflow@rm
  10871. + 112 003e 4B18 jreq overflow@rl
  10872. + 113
  10873. + GAS LISTING divdf3.s page 3
  10874. +
  10875. +
  10876. + 114 getexp:
  10877. + 115 0040 712E ld.w %r1, %r7 ; ؿ(%r1) <- [H](%r7)
  10878. + 116 0042 81888188 xsrl %r1, 20 ; ؿ(%r1) >> 20
  10879. + 116 4188
  10880. + 117 ; SET_EXP1 %r0 ,%r1 ; ͭ쥸[ؿ](%r0) <- ؿ(%r1) @@@ 01/02/19
  10881. + 118 __L0002:
  10882. + 119 0048 E0DF0070 xand %r0,0xfffff800 ; ͭ쥸 ؿꥢ
  10883. + 120 004c 1FC0F173 xand %r1,0x7ff ; ӥåȥޥ
  10884. + 121 0050 1036 or %r0,%r1 ; ؿå
  10885. + 122
  10886. + 123
  10887. + 124 0052 1FC0F16B xcmp %r1, 0x7ff ; if ؿ(%r1) >= overflow value
  10888. + 125 0056 01C0 ext overflow@rm
  10889. + 126 0058 3E0A jrge overflow@rl ; result is overflow
  10890. + 127
  10891. + 128 005a 932E ld.w %r3, %r9 ; ؿ(%r3) <- [H](%r9)
  10892. + 129 005c 83888388 xsrl %r3, 20 ; ؿ(%r3) >> 20
  10893. + 129 4388
  10894. + 130 ; SET_EXP2 %r0 ,%r3 ; ͭ쥸[ؿ](%r0) <- ؿ(%r3) @@@ 01/02/19
  10895. + 131 __L0003:
  10896. + 132 0062 F8DF1FC0 xand %r0,0xffc007ff ; ͭ쥸 ؿꥢ
  10897. + 132 F073
  10898. + 133 0068 1FC0F373 xand %r3,0x7ff ; ӥåȥޥ
  10899. + 134 006c 838C sll %r3,8 ; ؿΥӥåȰ֤˥ե
  10900. + 135 006e 338C sll %r3,3 ; ؿΥӥåȰ֤˥ե
  10901. + 136 0070 3036 or %r0,%r3 ; ؿå
  10902. + 137 0072 8388 srl %r3,8 ; ؿ
  10903. + 138 0074 3388 srl %r3,3 ; ؿ
  10904. + 139
  10905. + 140
  10906. + 141 0076 1FC0F36B xcmp %r3, 0x7ff ; if ؿ(%r3) >= overflow value
  10907. + 142 007a 01C0 ext end@rm
  10908. + 143 007c 3A18 jreq end@rl ; result is 0 (xxx/NaN = 0)
  10909. + 144
  10910. + 145 ; del @@@ 01/02/19 del xld.w %r10, 0x100000 ; implied bit(%r10) <- 0x100000
  10911. + 146
  10912. + 147 ; isolate mantissa1
  10913. + 148 007e 01C0FFDF xand %r7, 0xfffff ; clear first 12 bits of %r7
  10914. + 148 F773
  10915. + 149
  10916. + 150 0084 0168 cmp %r1, 0
  10917. + 151 0086 0819 jreq.d count1 ; if ؿ(%r1) = 0 (denormal)
  10918. + 152 0088 126C ld.w %r2, 1 ; flag(%r2) = 1
  10919. + 153
  10920. + 154 ; case: normal input
  10921. + 155 008a 02C000C0 xoor %r7, 0x100000 ; else add implied bit(0x100000) to mantissa @@@ 01/02/19
  10922. + 155 0774
  10923. + 156 0090 026C ld.w %r2, 0 ; flag(%r2) = 0
  10924. + 157 0092 151F jp.d getman2
  10925. + 158 0094 B56C ld.w %r5, 11 ; count1(%r5) = 11
  10926. + 159
  10927. + 160 count1:
  10928. + 161 0096 742E ld.w %r4, %r7 ; scan64 (%r4) <- [H](%r7)
  10929. + 162 0098 652E ld.w %r5, %r6 ; scan64 (%r5) <- [L](%r6)
  10930. + 163 ; @@@ del 01/02/19 xcall __scan64
  10931. + 164 ; SCAN64 %r4, %r5 ; @@@ add 01/02/19
  10932. + 165 009a 0102 pushn %r1 ; save register values
  10933. + GAS LISTING divdf3.s page 4
  10934. +
  10935. +
  10936. + 166
  10937. + 167 009c 006C ld.w %r0, 0 ; loop counter = 0
  10938. + 168
  10939. + 169 009e 0468 cmp %r4, 0 ; if high 32-bits != 0 then count
  10940. + 170 00a0 041A jrne __L0004
  10941. + 171
  10942. + 172 ; case: $1 = 0
  10943. + 173 00a2 542E ld.w %r4, %r5 ; count low 32-bits instead
  10944. + 174 00a4 00C0006E xld.w %r0, 32 ; loop counter = 32
  10945. + 175
  10946. + 176 __L0004: ; count ; of leading 0's
  10947. + 177 00a8 418E scan1 %r1, %r4 ; %r1 = count
  10948. + 178 00aa 0612 jruge __L0005 ; if count != 8 then goto end
  10949. + 179 00ac 8069 cmp %r0, 24
  10950. + 180 00ae 0419 jreq.d __L0005 ; if count = 32 then jump to end
  10951. + 181 00b0 8060 add %r0, 8 ; increment loop counter
  10952. + 182 00b2 FB1F jp.d __L0004
  10953. + 183 00b4 848C sll %r4, 8 ; shift register to the left 8 bits
  10954. + 184
  10955. + 185 __L0005:
  10956. + 186 00b6 0122 add %r1, %r0 ; count = count + loop counter
  10957. + 187 00b8 152E ld.w %r5, %r1 ; put result into output register
  10958. + 188
  10959. + 189 00ba 4102 popn %r1 ; restore register values
  10960. + 190
  10961. + 191 getman2:
  10962. + 192 ; isolate mantissa2
  10963. + 193
  10964. + 194 00bc 01C0FFDF xand %r9, 0xfffff ; [H] = [H] & 0xfffff clear first 12 bits of %r9
  10965. + 194 F973
  10966. + 195
  10967. + 196 00c2 0368 cmp %r3, 0 ; if ؿ(%r3) = 0
  10968. + 197 00c4 0719 jreq.d count2 ; then jump to count2
  10969. + 198 00c6 532E ld.w %r3, %r5 ; %r11 = count1
  10970. + 199
  10971. + 200 ; case: normal input
  10972. + 201 00c8 02C000C0 xoor %r9, 0x100000 ; else add implied bit(0x100000) @@@ 01/02/19
  10973. + 201 0974
  10974. + 202 00ce 161F jp.d cmpcount
  10975. + 203 00d0 B46C ld.w %r4, 11 ; count2(%r12) = 11
  10976. + 204
  10977. + 205 count2:
  10978. + 206 00d2 942E ld.w %r4, %r9 ; scan64 (%r4) = [H](%r9)
  10979. + 207 00d4 852E ld.w %r5, %r8 ; scan64 (%r5) = [L](%r8)
  10980. + 208 ; @@@ del 01/02/19 xcall __scan64 ; %r13 = count2
  10981. + 209 ; SCAN64 %r4, %r5 ; @@@ add 01/02/19
  10982. + 210 00d6 0102 pushn %r1 ; save register values
  10983. + 211
  10984. + 212 00d8 006C ld.w %r0, 0 ; loop counter = 0
  10985. + 213
  10986. + 214 00da 0468 cmp %r4, 0 ; if high 32-bits != 0 then count
  10987. + 215 00dc 041A jrne __L0006
  10988. + 216
  10989. + 217 ; case: $1 = 0
  10990. + 218 00de 542E ld.w %r4, %r5 ; count low 32-bits instead
  10991. + 219 00e0 00C0006E xld.w %r0, 32 ; loop counter = 32
  10992. + 220
  10993. + GAS LISTING divdf3.s page 5
  10994. +
  10995. +
  10996. + 221 __L0006: ; count ; of leading 0's
  10997. + 222 00e4 418E scan1 %r1, %r4 ; %r1 = count
  10998. + 223 00e6 0612 jruge __L0007 ; if count != 8 then goto end
  10999. + 224 00e8 8069 cmp %r0, 24
  11000. + 225 00ea 0419 jreq.d __L0007 ; if count = 32 then jump to end
  11001. + 226 00ec 8060 add %r0, 8 ; increment loop counter
  11002. + 227 00ee FB1F jp.d __L0006
  11003. + 228 00f0 848C sll %r4, 8 ; shift register to the left 8 bits
  11004. + 229
  11005. + 230 __L0007:
  11006. + 231 00f2 0122 add %r1, %r0 ; count = count + loop counter
  11007. + 232 00f4 152E ld.w %r5, %r1 ; put result into output register
  11008. + 233
  11009. + 234 00f6 4102 popn %r1 ; restore register values
  11010. + 235
  11011. + 236
  11012. + 237 00f8 1264 sub %r2, 1 ; flag(%r2) = flag(%r2) - 1 (0 or -1)
  11013. + 238
  11014. + 239 cmpcount:
  11015. + 240 ; SET_TEMP %r0, %r2 ; ͭ쥸[TEMP](%r0) <- flag(%r2)
  11016. + 241 __L0008:
  11017. + 242 00fa 07D8FFDF xand %r0,0xc03fffff ; ͭ쥸 TEMPꥢ
  11018. + 242 F073
  11019. + 243 0100 03C0F273 xand %r2,0xff ; 1Х mask
  11020. + 244 0104 8298 rr %r2,8 ; TEMPΥӥåȰ֤˥ե
  11021. + 245 0106 2298 rr %r2,2 ; TEMPΥӥåȰ֤˥ե
  11022. + 246 0108 2036 or %r0,%r2 ; TEMPå
  11023. + 247 010a 829C rl %r2,8 ;
  11024. + 248 010c 229C rl %r2,2 ;
  11025. + 249
  11026. + 250 010e 532A cmp %r3, %r5 ; if count1(%r11) <= count2(%r13)
  11027. + 251 0110 160E jrle man2shift ; then goto man2shift
  11028. + 252
  11029. + 253 ; case: count1 > count2
  11030. + 254 0112 5326 sub %r3, %r5 ; shift(%r3) = (count1(%r3) - count2(%r5)) - 1
  11031. + 255 0114 1364 sub %r3, 1
  11032. + 256
  11033. + 257 ; {%r7, %r6} << shift
  11034. + 258 ;xsll %r7, %r11 ; shift high 32-bits to the left x bits
  11035. + 259 ;xrl %r6, %r11 ; rotate low 32-bits to the left x bits
  11036. + 260 ;xsll %r10, %r11 ; make a mask for first 32-x bits --> %r10 = 111...000
  11037. + 261
  11038. + 262 0116 F26F ld.w %r2, -1 ; %r2 = 0xffff ffff
  11039. + 263 ; used in 64-bit variable shifts ; SHFTROTSHFT %r3, %r7, %r6, %r2, sll, rl, %r5 ; %r5 = temp
  11040. + 264 ; $1 = shift amount
  11041. + 265 ; $2 = 1st input register (shifted)
  11042. + 266 ; $3 = 2nd input register (rotated)
  11043. + 267 ; $4 = 3rd input register (mask --> shifted)
  11044. + 268 ; $5 = shift instruction
  11045. + 269 ; $6 = rotate instruction
  11046. + 270 ; $7 = temp register
  11047. + 271 0118 352E ld.w %r5, %r3 ; temp = shift amount
  11048. + 272
  11049. + 273 __L0009:
  11050. + 274 011a 8568 cmp %r5, 8 ; if temp <= 8 then goto $$2
  11051. + 275 011c 060E jrle __L0010
  11052. + 276
  11053. + GAS LISTING divdf3.s page 6
  11054. +
  11055. +
  11056. + 277 011e 878C sll %r7, 8 ; shift 1st register
  11057. + 278 0120 869C rl %r6, 8 ; rotate 2nd register
  11058. + 279 0122 828C sll %r2, 8 ; shift 3rd register
  11059. + 280 0124 FB1F jp.d __L0009
  11060. + 281 0126 8564 sub %r5, 8 ; temp = temp - 8
  11061. + 282
  11062. + 283 __L0010:
  11063. + 284 0128 578D sll %r7, %r5 ; last shift
  11064. + 285 012a 569D rl %r6, %r5 ; last rotate
  11065. + 286 012c 528D sll %r2, %r5 ; last shift
  11066. + 287 012e 253E not %r5, %r2 ; flip mask for last x bits --> %r5 = 000...111 (mask)
  11067. + 288 0130 6532 and %r5, %r6 ; isolate last x bits of %r6
  11068. + 289 0132 5736 or %r7, %r5 ; add last x bits of %r6 to %r7
  11069. + 290 0134 2632 and %r6, %r2 ; keep the high 32-x bits of %r6
  11070. + 291
  11071. + 292 0136 1360 add %r3, 1 ; shift(%r3) = shift(%r3) + 1
  11072. + 293 0138 161F jp.d divide
  11073. + 294 013a 322E ld.w %r2, %r3 ; lshift(%r2) = count1 - count2
  11074. + 295
  11075. + 296 man2shift:
  11076. + 297 013c 3526 sub %r5, %r3 ; shift(%r5) = count2 - count1 + 1
  11077. + 298 013e 1560 add %r5, 1
  11078. + 299
  11079. + 300 ; {%r9, %r8} << shift
  11080. + 301 ;xsll %r9, %r13 ; shift high 32-bits to the left x bits
  11081. + 302 ;xrl %r8, %r13 ; rotate low 32-bits to the left x bits
  11082. + 303 ;xsll %r10, %r13 ; make a mask for first 32-x bits --> %r10 = 111...000
  11083. + 304
  11084. + 305 0140 F26F ld.w %r2, -1 ; %r2 = 0xffff ffff
  11085. + 306 ; used in 64-bit variable shifts ; SHFTROTSHFT %r5, %r9, %r8, %r2, sll, rl, %r4 ; %r4 = temp
  11086. + 307 ; $1 = shift amount
  11087. + 308 ; $2 = 1st input register (shifted)
  11088. + 309 ; $3 = 2nd input register (rotated)
  11089. + 310 ; $4 = 3rd input register (mask --> shifted)
  11090. + 311 ; $5 = shift instruction
  11091. + 312 ; $6 = rotate instruction
  11092. + 313 ; $7 = temp register
  11093. + 314 0142 542E ld.w %r4, %r5 ; temp = shift amount
  11094. + 315
  11095. + 316 __L0011:
  11096. + 317 0144 8468 cmp %r4, 8 ; if temp <= 8 then goto $$2
  11097. + 318 0146 060E jrle __L0012
  11098. + 319
  11099. + 320 0148 898C sll %r9, 8 ; shift 1st register
  11100. + 321 014a 889C rl %r8, 8 ; rotate 2nd register
  11101. + 322 014c 828C sll %r2, 8 ; shift 3rd register
  11102. + 323 014e FB1F jp.d __L0011
  11103. + 324 0150 8464 sub %r4, 8 ; temp = temp - 8
  11104. + 325
  11105. + 326 __L0012:
  11106. + 327 0152 498D sll %r9, %r4 ; last shift
  11107. + 328 0154 489D rl %r8, %r4 ; last rotate
  11108. + 329 0156 428D sll %r2, %r4 ; last shift
  11109. + 330 0158 243E not %r4, %r2 ; flip mask for last x bits --> %r4 = 000...111 (mask)
  11110. + 331 015a 8432 and %r4, %r8 ; isolate last x bits of %r8
  11111. + 332 015c 4936 or %r9, %r4 ; add last x bits of %r8 to %r9
  11112. + 333 015e 2832 and %r8, %r2 ; keep the high 32-x bits of %r8
  11113. + GAS LISTING divdf3.s page 7
  11114. +
  11115. +
  11116. + 334
  11117. + 335 0160 523E not %r2, %r5 ; lshift(%r10) = count1 - count2 (~shift + 1 + 1)
  11118. + 336 0162 2260 add %r2, 2
  11119. + 337
  11120. + 338 divide:
  11121. + 339 ; man1 has x leading 0's
  11122. + 340 ; man2 has x-1 leading 0's
  11123. + 341 ; lshift used to normalize result
  11124. + 342 ; %r0 = sign; %r1 = exp1, %r3 = exp2
  11125. + 343 ; %r10 = lshift
  11126. + 344 ; GET_EXP2 %r0, %r3 ; ؿ(%r3) <- ͭ쥸[ؿ](%r0)
  11127. + 345 __L0013:
  11128. + 346 0164 032E ld.w %r3,%r0
  11129. + 347 0166 8388 srl %r3,8
  11130. + 348 0168 3388 srl %r3,3
  11131. + 349 016a 1FC0F373 xand %r3,0x7ff ; ͭ쥸 ؿ
  11132. + 350
  11133. + 351
  11134. + 352 016e 3126 sub %r1, %r3 ; new sisu = sisu1 - sisu2 + bias + flag (0,1,-1)
  11135. + 353
  11136. + 354 0170 0FC0F163 xadd %r1, 0x3ff
  11137. + 355 ; GET_TEMP %r0, %r3 ; flag(%r3) <- ͭ쥸[TEMP](%r0) @@@ 01/02/19 add
  11138. + 356 __L0014:
  11139. + 357 0174 032E ld.w %r3,%r0
  11140. + 358 0176 839C rl %r3,8
  11141. + 359 0178 239C rl %r3,2
  11142. + 360 017a 03C0F373 xand %r3,0xff ; ͭ쥸 TEMP
  11143. + 361
  11144. + 362 017e 3122 add %r1, %r3
  11145. + 363
  11146. + 364 0180 1FC0F16B xcmp %r1, 0x7ff ; if ؿ(%r1) >= 0x7ff then goto overflow
  11147. + 365 0184 00C0 ext overflow@rm
  11148. + 366 0186 A70A jrge overflow@rl
  11149. + 367 0188 FFDFC168 xcmp %r1, -52 ; if ؿ(%r1) <= -52 then underflow
  11150. + 368 018c 00C0 ext end@rm
  11151. + 369 018e B10E jrle end@rl
  11152. + 370
  11153. + 371 ; DIVIDE CODE STARTS HERE
  11154. + 372 0190 132E ld.w %r3, %r1
  11155. + 373 0192 139C rl %r3,1 ; ؿӥå¸
  11156. + 374 ; SET_SIGN2 %r0, %r3 ; ͭ쥸[ӥåȣ](%r0) <- ؿӥå
  11157. + 375 __L0015:
  11158. + 376 0194 FFD7FFDF xand %r0,0xbfffffff ; ͭ쥸 ӥåȣꥢ
  11159. + 376 F073
  11160. + 377 019a 1370 and %r3,1 ; 1ӥåȥޥ
  11161. + 378 019c 2398 rr %r3,2 ; ӥåȣΥӥåȰ֤˥ơ
  11162. + 379 019e 3036 or %r0,%r3 ; ӥåȣå
  11163. + 380 01a0 239C rl %r3,2 ; ӥå
  11164. + 381
  11165. + 382 ; SET_EXP1 %r0, %r1 ; ͭ쥸[ؿ](%r0) <- ؿ(%r1) @@@ 01/02/19 add
  11166. + 383 __L0016:
  11167. + 384 01a2 E0DF0070 xand %r0,0xfffff800 ; ͭ쥸 ؿꥢ
  11168. + 385 01a6 1FC0F173 xand %r1,0x7ff ; ӥåȥޥ
  11169. + 386 01aa 1036 or %r0,%r1 ; ؿå
  11170. + 387
  11171. + 388 ; SET_TEMP %r0, %r2 ; ͭ쥸[TEMP](%r0) <- lshift(%r2) @@@ 01/02/19 add
  11172. + 389 __L0017:
  11173. + GAS LISTING divdf3.s page 8
  11174. +
  11175. +
  11176. + 390 01ac 07D8FFDF xand %r0,0xc03fffff ; ͭ쥸 TEMPꥢ
  11177. + 390 F073
  11178. + 391 01b2 03C0F273 xand %r2,0xff ; 1Х mask
  11179. + 392 01b6 8298 rr %r2,8 ; TEMPΥӥåȰ֤˥ե
  11180. + 393 01b8 2298 rr %r2,2 ; TEMPΥӥåȰ֤˥ե
  11181. + 394 01ba 2036 or %r0,%r2 ; TEMPå
  11182. + 395 01bc 829C rl %r2,8 ;
  11183. + 396 01be 229C rl %r2,2 ;
  11184. + 397
  11185. + 398
  11186. + 399 ; make a mask for first 31 bits --> %r2 = 111...110
  11187. + 400 ; @@@ del 01/02/19 ld.w %r2, -2 ; %r2 = 0xffff fffe
  11188. + 401 01c0 036C ld.w %r3, 0 ; loop(%r3) <- 0
  11189. + 402 01c2 016C ld.w %r1, 0 ; flag(%r1) = 0
  11190. + 403 01c4 046C ld.w %r4, 0 ; @@@ 01/02/26 add
  11191. + 404 01c6 056C ld.w %r5, 0 ; @@@ 01/02/26 add
  11192. + 405
  11193. + 406
  11194. + 407 loop:
  11195. + 408 01c8 1360 add %r3, 1 ; loop(%r3) = loop(%r3) + 1
  11196. + 409 01ca 00C0736B xcmp %r3, 55 ; if loop(%r3) >= 55 then exit divide loop
  11197. + 410 01ce 380A jrge normalize
  11198. + 411
  11199. + 412 ; {result1, result2} << 1
  11200. + 413 01d0 158C sll %r5, 1 ; shift high 32-bits to the left 1 bit
  11201. + 414 01d2 149C rl %r4, 1 ; rotate low 32-bits to the left 1 bit
  11202. + 415 01d4 126C ld.w %r2, 1 ; mask for last bit (LSB)
  11203. + 416 01d6 4232 and %r2, %r4 ; isolate last bit of %r8
  11204. + 417 01d8 2536 or %r5, %r2 ; add last bit of %r8 to %r9
  11205. + 418 01da E473 xand %r4, -2 ; keep the high 31 bits of %r8
  11206. + 419
  11207. + 420 01dc 718E scan1 %r1, %r7 ; is there a leading 1? (0 = yes)
  11208. + 421
  11209. + 422 ; {[H](%r7), [L](%r6)} << 1
  11210. + 423 01de 178C sll %r7, 1 ; shift high 32-bits to the left 1 bit
  11211. + 424 01e0 169C rl %r6, 1 ; rotate low 32-bits to the left 1 bit
  11212. + 425 01e2 126C ld.w %r2, 1 ; mask for last bit (LSB)
  11213. + 426 01e4 6232 and %r2, %r6 ; isolate last bit of %r8
  11214. + 427 01e6 2736 or %r7, %r2 ; add last bit of %r8 to %r9
  11215. + 428 01e8 E673 xand %r6, -2 ; keep the high 31 bits of %r8
  11216. + 429 01ea 0168 cmp %r1, 0 ; if a leading 1 was shifted out then subtract
  11217. + 430 01ec 0618 jreq subtract
  11218. + 431
  11219. + 432 01ee 972A cmp %r7, %r9
  11220. + 433 01f0 0410 jrugt subtract ; if [H](%r7) > [H](%r9) then subtract
  11221. + 434 01f2 EB14 jrult loop ; if [H](%r7) < [H](%r9) then goto loop
  11222. + 435
  11223. + 436 ; case: man1 = man2 (%r7 = %r9)
  11224. + 437 01f4 862A cmp %r6, %r8 ; if [L](%r6) < [L](%r8) then goto loop
  11225. + 438 01f6 E914 jrult loop
  11226. + 439
  11227. + 440 subtract:
  11228. + 441 01f8 8626 sub %r6, %r8 ; [L](%r6) = [L](%r6) - [L](%r8)
  11229. + 442 01fa 97BC sbc %r7, %r9 ; [H](%r7) = [H](%r7) - [H](%r9) - carry
  11230. + 443 01fc 1460 add %r4, 1 ; [L](%r4) = [L](%r4) + 1
  11231. + 444
  11232. + 445 01fe 0768 cmp %r7, 0 ; if {[H](%r7), [L](%r6) } = 0 then exit
  11233. + GAS LISTING divdf3.s page 9
  11234. +
  11235. +
  11236. + 446 0200 E41A jrne loop
  11237. + 447 0202 0668 cmp %r6, 0
  11238. + 448 0204 E21A jrne loop
  11239. + 449
  11240. + 450 0206 00C0636B xcmp %r3, 54 ; if loop(%r3) >= 54 then exit divide loop
  11241. + 451 020a 1A0A jrge normalize
  11242. + 452
  11243. + 453 ; fill in the extra 0's needed in the result
  11244. + 454 020c 00C0616F xld.w %r1, 54
  11245. + 455 0210 3126 sub %r1, %r3 ; extra(%r1) = 54 - loop(%r3)
  11246. + 456 0212 00C0016A xcmp %r1, 32 ; if extra(%r1) < 32 then goto shift
  11247. + 457 0216 040C jrlt xshift
  11248. + 458
  11249. + 459 ; case: extra iterations >= 32
  11250. + 460 0218 452E ld.w %r5, %r4 ; [H](%r5) <- [L](%r4)
  11251. + 461 021a 046C ld.w %r4, 0 ; [L](%r4) <- 0
  11252. + 462 021c 0166 sub %r1, 32 ; extra(%r1) = extra(%r1) - 32
  11253. + 463
  11254. + 464 xshift:
  11255. + 465 ; {%r5, %r4} << extra
  11256. + 466 ;xsll %r5, %r11 ; shift high 32-bits to the left x bits
  11257. + 467 ;xrl %r4, %r11 ; rotate low 32-bits to the left x bits
  11258. + 468 ;xsll %r3, %r11 ; make a mask for first 32-x bits --> %r3 = 111...000
  11259. + 469
  11260. + 470 021e F36F ld.w %r3, -1 ; %r3 = 0xffff ffff
  11261. + 471 ; used in 64-bit variable shifts ; SHFTROTSHFT %r1, %r5, %r4, %r3, sll, rl, %r1
  11262. + 472 ; $1 = shift amount
  11263. + 473 ; $2 = 1st input register (shifted)
  11264. + 474 ; $3 = 2nd input register (rotated)
  11265. + 475 ; $4 = 3rd input register (mask --> shifted)
  11266. + 476 ; $5 = shift instruction
  11267. + 477 ; $6 = rotate instruction
  11268. + 478 ; $7 = temp register
  11269. + 479 0220 112E ld.w %r1, %r1 ; temp = shift amount
  11270. + 480
  11271. + 481 __L0018:
  11272. + 482 0222 8168 cmp %r1, 8 ; if temp <= 8 then goto $$2
  11273. + 483 0224 060E jrle __L0019
  11274. + 484
  11275. + 485 0226 858C sll %r5, 8 ; shift 1st register
  11276. + 486 0228 849C rl %r4, 8 ; rotate 2nd register
  11277. + 487 022a 838C sll %r3, 8 ; shift 3rd register
  11278. + 488 022c FB1F jp.d __L0018
  11279. + 489 022e 8164 sub %r1, 8 ; temp = temp - 8
  11280. + 490
  11281. + 491 __L0019:
  11282. + 492 0230 158D sll %r5, %r1 ; last shift
  11283. + 493 0232 149D rl %r4, %r1 ; last rotate
  11284. + 494 0234 138D sll %r3, %r1 ; last shift
  11285. + 495 0236 323E not %r2, %r3 ; flip mask for last x bits --> %r2 = 000...111 (mask)
  11286. + 496 0238 4232 and %r2, %r4 ; isolate last x bits of %r6
  11287. + 497 023a 2536 or %r5, %r2 ; add last x bits of %r6 to %r7
  11288. + 498 023c 3432 and %r4, %r3 ; keep the high 32-x bits of %r6
  11289. + 499
  11290. + 500 ; DIVIDE CODE ENDS HERE
  11291. + 501
  11292. + 502 normalize:
  11293. + GAS LISTING divdf3.s page 10
  11294. +
  11295. +
  11296. + 503 ; %r0 = result sign, %r1 = result exponent
  11297. + 504 ; %r10 = lshift, (%r5, %r4) = result
  11298. + 505
  11299. + 506 ;ld.w %r3, 10 ; count = 10
  11300. + 507 023e 036C ld.w %r3, 0 ; count(%r3) <- 0
  11301. + 508
  11302. + 509 0240 582E ld.w %r8, %r5
  11303. + 510 0242 04C000C0 xand %r8, 0x200000 ; check 21st bit
  11304. + 510 0870
  11305. + 511
  11306. + 512 0248 021A jrne continue2 ; if 21st bit = 1 then count = 10
  11307. + 513 024a 1360 add %r3, 1 ; else count(%r3) = count(%r3) + 1
  11308. + 514
  11309. + 515 continue2:
  11310. + 516 ; GET_EXP1 %r0, %r1 ; ؿ(%r1) <- ͭ쥸[ؿ](%r0)
  11311. + 517 __L0020:
  11312. + 518 024c 012E ld.w %r1,%r0 ;
  11313. + 519 024e 1FC0F173 xand %r1,0x7ff ; ͭ쥸 ؿ
  11314. + 520
  11315. + 521 ; GET_SIGN2 %r0, %r2 ; ؿӥå(%r2) <- ͭ쥸[ӥåȣ](%r0)
  11316. + 522 __L0021:
  11317. + 523 0252 022E ld.w %r2,%r0 ;
  11318. + 524 0254 229C rl %r2,2 ; ӥåȥơ
  11319. + 525 0256 1270 and %r2,1 ; ͭ쥸 ӥåȣ
  11320. + 526
  11321. + 527 0258 1268 cmp %r2, 1 ; ؿޥʥ
  11322. + 528 025a 031A jrne exp1_no_sign
  11323. + 529 025c E0DF0174 xoor %r1, 0xfffff800 ; ؿĥ
  11324. + 530 exp1_no_sign:
  11325. + 531
  11326. + 532
  11327. + 533 ; GET_TEMP %r0, %r2 ; lshift(%r2) <- ͭ쥸[TEMP](%r0)
  11328. + 534 __L0022:
  11329. + 535 0260 022E ld.w %r2,%r0
  11330. + 536 0262 829C rl %r2,8
  11331. + 537 0264 229C rl %r2,2
  11332. + 538 0266 03C0F273 xand %r2,0xff ; ͭ쥸 TEMP
  11333. + 539
  11334. + 540
  11335. + 541 ;sub %r3, 10 ; count = count - 10
  11336. + 542 026a 3222 add %r2, %r3 ; lshift(%r2) = lshiftؿ + count(%r3)
  11337. + 543 026c 212A cmp %r1, %r2
  11338. + 544 026e 2208 jrgt normal ; if ؿ(%r1) > lshift(%r10) then normal result
  11339. + 545
  11340. + 546 ; case: ؿ(%r1) <= lshift(%r2)
  11341. + 547 0270 1260 add %r2, 1
  11342. + 548 0272 3226 sub %r2, %r3 ; lshift(%r2) = lshift(%r2) + (11 - count(%r3))
  11343. + 549 0274 1226 sub %r2, %r1
  11344. + 550 0276 1260 add %r2, 1 ; lshift(%r2) = lshift(%r2) - (ؿ(%r1) - 1)
  11345. + 551
  11346. + 552 0278 00C0626B xcmp %r2, 54 ; if lshift(%r2) >= 54 then underflow
  11347. + 553 027c 040C jrlt notunder
  11348. + 554 027e 056C ld.w %r5, 0 ; [H](%r5) <- 0
  11349. + 555 0280 381F jp.d end
  11350. + 556 0282 046C ld.w %r4, 0
  11351. + 557
  11352. + 558 notunder:
  11353. + GAS LISTING divdf3.s page 11
  11354. +
  11355. +
  11356. + 559 ; {%r5, %r4} >> %r10
  11357. + 560 ;xsrl %r4, %r10 ; shift low 32-bits to the right x bits (shift amount = x)
  11358. + 561 ;xrr %r5, %r10 ; rotate high 32-bits to the right x bits
  11359. + 562 ;xsrl %r3, %r10 ; make a mask for last 32-x bits --> %r3 = 000...111
  11360. + 563
  11361. + 564 0284 F36F ld.w %r3, -1 ; %r3 = 0xffff ffff
  11362. + 565 ; used in 64-bit variable shifts ; SHFTROTSHFT %r2, %r4, %r5, %r3, srl, rr, %r2
  11363. + 566 ; $1 = shift amount
  11364. + 567 ; $2 = 1st input register (shifted)
  11365. + 568 ; $3 = 2nd input register (rotated)
  11366. + 569 ; $4 = 3rd input register (mask --> shifted)
  11367. + 570 ; $5 = shift instruction
  11368. + 571 ; $6 = rotate instruction
  11369. + 572 ; $7 = temp register
  11370. + 573 0286 222E ld.w %r2, %r2 ; temp = shift amount
  11371. + 574
  11372. + 575 __L0023:
  11373. + 576 0288 8268 cmp %r2, 8 ; if temp <= 8 then goto $$2
  11374. + 577 028a 060E jrle __L0024
  11375. + 578
  11376. + 579 028c 8488 srl %r4, 8 ; shift 1st register
  11377. + 580 028e 8598 rr %r5, 8 ; rotate 2nd register
  11378. + 581 0290 8388 srl %r3, 8 ; shift 3rd register
  11379. + 582 0292 FB1F jp.d __L0023
  11380. + 583 0294 8264 sub %r2, 8 ; temp = temp - 8
  11381. + 584
  11382. + 585 __L0024:
  11383. + 586 0296 2489 srl %r4, %r2 ; last shift
  11384. + 587 0298 2599 rr %r5, %r2 ; last rotate
  11385. + 588 029a 2389 srl %r3, %r2 ; last shift
  11386. + 589 029c 383E not %r8, %r3 ; flip mask for first x bits --> %r8 = 111...000 (mask)
  11387. + 590 029e 5832 and %r8, %r5 ; isolate first x bits of %r5
  11388. + 591 02a0 8436 or %r4, %r8 ; add first x bits of %r5 to %r4
  11389. + 592 02a2 3532 and %r5, %r3 ; keep the low 32-x bits of %r5
  11390. + 593
  11391. + 594
  11392. + 595 02a4 016C ld.w %r1, 0 ; ؿ(%r1) <- 0 for denormal result
  11393. + 596 ; SET_EXP1 %r0, %r1
  11394. + 597 __L0025:
  11395. + 598 02a6 E0DF0070 xand %r0,0xfffff800 ; ͭ쥸 ؿꥢ
  11396. + 599 02aa 1FC0F173 xand %r1,0x7ff ; ӥåȥޥ
  11397. + 600 02ae 1036 or %r0,%r1 ; ؿå
  11398. + 601
  11399. + 602 02b0 171E jp finish
  11400. + 603 ; @@@ 01/03/02 del ld.w %r1, 0 ; ؿ(%r1) <- 0 for denormal result
  11401. + 604
  11402. + 605 normal:
  11403. + 606 ; case: exp > lshift
  11404. + 607 02b2 2126 sub %r1, %r2 ; ؿ(%r1) = ؿ(%r1) - lshift(%r2)
  11405. + 608 ; SET_EXP1 %r0, %r1 ; ؿ(%r1) <- ͭ쥸[ؿ](%r0) @@@ 01/02/26 add
  11406. + 609 __L0026:
  11407. + 610 02b4 E0DF0070 xand %r0,0xfffff800 ; ͭ쥸 ؿꥢ
  11408. + 611 02b8 1FC0F173 xand %r1,0x7ff ; ӥåȥޥ
  11409. + 612 02bc 1036 or %r0,%r1 ; ؿå
  11410. + 613
  11411. + 614
  11412. + 615 02be 1368 cmp %r3, 1 ; if original count(%r3) = 11 then no shifting needed
  11413. + GAS LISTING divdf3.s page 12
  11414. +
  11415. +
  11416. + 616 02c0 0718 jreq overchk
  11417. + 617
  11418. + 618 ; {[H](%r5), [L](%r4)} >> 1 (shift to the right 1 bit)
  11419. + 619 02c2 1488 srl %r4, 1 ; shift low 32-bits to the right 1 bit
  11420. + 620 02c4 136C ld.w %r3, 1 ; mask
  11421. + 621 02c6 5332 and %r3, %r5 ; get LSB of high 32-bits
  11422. + 622 02c8 1398 rr %r3, 1 ; rotate to MSB position
  11423. + 623 02ca 3436 or %r4, %r3 ; add to %r4
  11424. + 624 02cc 1588 srl %r5, 1 ; shift high 32-bits to the right 1 bit
  11425. + 625
  11426. + 626 overchk:
  11427. + 627 02ce 1FC0F16B xcmp %r1, 0x7ff ; if ؿ(%r1) < 0x7ff then jump to finish
  11428. + 628 02d2 060C jrlt finish
  11429. + 629
  11430. + 630 overflow:
  11431. + 631 02d4 FECF00C0 xld.w %r5, 0x7ff00000 ; put infinity into result
  11432. + 631 056C
  11433. + 632 02da 0B1F jp.d end
  11434. + 633 02dc 046C ld.w %r4, 0
  11435. + 634
  11436. + 635 finish:
  11437. + 636 ; %r0 = sign, %r1 = exponent, %r5 = mantissa
  11438. + 637
  11439. + 638 02de 01C0FFDF xand %r5, 0xfffff ; [H](%r5) = [H](%r5) & 0xfffff
  11440. + 638 F573
  11441. + 639
  11442. + 640 ; GET_EXP1 %r0, %r1 ; ؿ(%r1) <- ͭ쥸[ؿ](%r0)
  11443. + 641 __L0027:
  11444. + 642 02e4 012E ld.w %r1,%r0 ;
  11445. + 643 02e6 1FC0F173 xand %r1,0x7ff ; ͭ쥸 ؿ
  11446. + 644
  11447. + 645
  11448. + 646 02ea 81984198 xrr %r1, 12 ; position exponent bits to [30:20]
  11449. + 647 02ee 1536 or %r5, %r1
  11450. + 648
  11451. + 649 end:
  11452. + 650 ; GET_SIGN1 %r0, %r2 ; ӥåȣ(%r2) <- ͭ쥸[ӥåȣ](%r0)
  11453. + 651 __L0028:
  11454. + 652 02f0 022E ld.w %r2,%r0 ;
  11455. + 653 02f2 129C rl %r2,1 ; ӥåȥơ
  11456. + 654 02f4 1270 and %r2,1 ; ͭ쥸 ӥåȣ
  11457. + 655
  11458. + 656
  11459. + 657 02f6 1298 rr %r2, 1 ; position sign bit to MSB
  11460. + 658 02f8 2536 or %r5, %r2 ; [H](%r5) = [H](%r5) | ӥåȣ(%r1)
  11461. + 659
  11462. + 660 ;@@@ 01/01/23 add start hinokuchi
  11463. + 661 ;ld.w %r13, [%sp+3] ; %r13
  11464. + 662 ;ld.w %r12, [%sp+2] ; %r12
  11465. + 663 ;ld.w %r11, [%sp+1] ; %r11
  11466. + 664 ;ld.w %r10, [%sp+0] ; %r10
  11467. + 665 ;add %sp, 4
  11468. + 666 ;@@@ 01/01/23 add end
  11469. + 667
  11470. + 668 02fa 4302 popn %r3 ; restore register values
  11471. + 669 02fc 4006 ret
  11472. diff --git a/gcc/config/c33/libgcc/divdf3.s b/gcc/config/c33/libgcc/divdf3.s
  11473. new file mode 100644
  11474. index 0000000..79bf88e
  11475. --- /dev/null
  11476. +++ b/gcc/config/c33/libgcc/divdf3.s
  11477. @@ -0,0 +1,669 @@
  11478. +;*********************************************
  11479. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  11480. +;* ALL RIGHTS RESERVED
  11481. +;*
  11482. +;* filename : divdf3.s
  11483. +;*
  11484. +;* Double floating point division function
  11485. +;* input: (%r7, %r6) & (%r9, %r8)
  11486. +;* output: (%r5, %r4)
  11487. +;*
  11488. +;* Begin 1996/09/12 V. Chan
  11489. +;* ѹ 2001/01/31 O.Hinokuchi
  11490. +;* gasб 2001/10/15 watanabe
  11491. +;*
  11492. +;*****************************************
  11493. +
  11494. +.section .text
  11495. +.align 1
  11496. +.global __divdf3
  11497. +
  11498. +;==============================================
  11499. +;쥸
  11500. +; %r0:ӥåȣ(0(+) or 1(-))
  11501. +; %r1:ؿ(11bit)
  11502. +; %r2:ӥåȣ(0(+) or 1(-))/shift/flag
  11503. +; %r3:ؿ(11bit)/count/loop
  11504. +; %r4:[L]
  11505. +; %r5:[H]
  11506. +; %r6:[L]()/[L]
  11507. +; %r7:[H]()/[H]
  11508. +; %r8:[L]()/[L]
  11509. +; %r9:[H]()/[H]
  11510. +; %r10:implied bit/lshift
  11511. +; %r11:count1/shift/flag/extra
  11512. +; %r12:scan64 /count2
  11513. +; %r13:loop counter/scan64 /shift
  11514. +;==============================================
  11515. +
  11516. +;;macro SHFTROTSHFT $1, $2, $3, $4, $5, $6, $7
  11517. + ; used in 64-bit variable shifts
  11518. + ; $1 = shift amount
  11519. + ; $2 = 1st input register (shifted)
  11520. + ; $3 = 2nd input register (rotated)
  11521. + ; $4 = 3rd input register (mask --> shifted)
  11522. + ; $5 = shift instruction
  11523. + ; $6 = rotate instruction
  11524. + ; $7 = temp register
  11525. +; ld.w $7, $1 ; temp = shift amount
  11526. +
  11527. +;$$1:
  11528. +; cmp $7, 8 ; if temp <= 8 then goto $$2
  11529. +; jrle $$2
  11530. +
  11531. +; $5 $2, 8 ; shift 1st register
  11532. +; $6 $3, 8 ; rotate 2nd register
  11533. +; $5 $4, 8 ; shift 3rd register
  11534. +; jp.d $$1
  11535. +; sub $7, 8 ; temp = temp - 8
  11536. +
  11537. +;$$2:
  11538. +; $5 $2, $7 ; last shift
  11539. +; $6 $3, $7 ; last rotate
  11540. +; $5 $4, $7 ; last shift
  11541. +;;endm
  11542. +
  11543. +__divdf3:
  11544. + pushn %r3 ; save register values
  11545. + ;@@@ 01/01/30 add start hinokuchi
  11546. + ;sub %sp, 4
  11547. + ;ld.w [%sp+0], %r10 ; %r10
  11548. + ;ld.w [%sp+1], %r11 ; %r11
  11549. + ;ld.w [%sp+2], %r12 ; %r12
  11550. + ;ld.w [%sp+3], %r13 ; %r13
  11551. + ;@@@ 01/01/30 add end
  11552. + ld.w %r0, 0 ; ͭ쥸ꥢ @@@ 01/02/19
  11553. +
  11554. + ld.w %r1, %r7 ; ӥåȣ(%r1) <- [H](%r7)
  11555. + rl %r1, 1 ; ӥåȣ(%r1) rotate left 1 bit
  11556. + and %r1, 1 ; ӥåȣ(%r1) & 1
  11557. +
  11558. + ld.w %r2, %r9 ; ӥåȣ(%r2) <- [H](%r9)
  11559. + rl %r2, 1 ; ӥåȣ(%r2) rotate left 1 bit
  11560. + and %r2, 1 ; ӥåȣ(%r2) & 1
  11561. +
  11562. + xor %r1, %r2 ; ӥåȣ(%r0) = ~ӥåȣ(%r0)
  11563. + ; SET_SIGN1 %r0, %r1
  11564. +__L0001:
  11565. + xand %r0,0x7fffffff ; ͭ쥸 ӥåȣꥢ
  11566. + and %r1,1 ; 1ӥåȥޥ
  11567. + rr %r1,1 ; ӥåȣΥӥåȰ֤˥ơ
  11568. + or %r0,%r1 ; ӥåȣå
  11569. + rl %r1,1 ; ӥå
  11570. +
  11571. + ld.w %r5, 0 ; [H](%r5) <- 0
  11572. + ld.w %r4, 0 ; [L](%r4) <- 0
  11573. +
  11574. + sll %r7, 1 ; [H](%r7) << 1
  11575. + srl %r7, 1 ; [H](%r7) >> 1
  11576. + cmp %r7, 0 ; if [H](%r7) != 0 then check input2
  11577. + jrne zerochk2
  11578. + cmp %r6, 0 ; if [L](%r6) = 0 then end
  11579. + ext end@rm
  11580. + jreq end@rl
  11581. +
  11582. +zerochk2:
  11583. + sll %r9, 1 ; [H](%r9) << 1
  11584. + srl %r9, 1 ; [H](%r9) >> 1
  11585. + cmp %r9, 0 ; if [H](%r9) != 0 then goto getexp
  11586. + jrne getexp
  11587. + cmp %r8, 0 ; if [L](%r8) = 0 then overflow
  11588. + ext overflow@rm
  11589. + jreq overflow@rl
  11590. +
  11591. +getexp:
  11592. + ld.w %r1, %r7 ; ؿ(%r1) <- [H](%r7)
  11593. + xsrl %r1, 20 ; ؿ(%r1) >> 20
  11594. + ; SET_EXP1 %r0 ,%r1 ; ͭ쥸[ؿ](%r0) <- ؿ(%r1) @@@ 01/02/19
  11595. +__L0002:
  11596. + xand %r0,0xfffff800 ; ͭ쥸 ؿꥢ
  11597. + xand %r1,0x7ff ; ӥåȥޥ
  11598. + or %r0,%r1 ; ؿå
  11599. +
  11600. +
  11601. + xcmp %r1, 0x7ff ; if ؿ(%r1) >= overflow value
  11602. + ext overflow@rm
  11603. + jrge overflow@rl ; result is overflow
  11604. +
  11605. + ld.w %r3, %r9 ; ؿ(%r3) <- [H](%r9)
  11606. + xsrl %r3, 20 ; ؿ(%r3) >> 20
  11607. + ; SET_EXP2 %r0 ,%r3 ; ͭ쥸[ؿ](%r0) <- ؿ(%r3) @@@ 01/02/19
  11608. +__L0003:
  11609. + xand %r0,0xffc007ff ; ͭ쥸 ؿꥢ
  11610. + xand %r3,0x7ff ; ӥåȥޥ
  11611. + sll %r3,8 ; ؿΥӥåȰ֤˥ե
  11612. + sll %r3,3 ; ؿΥӥåȰ֤˥ե
  11613. + or %r0,%r3 ; ؿå
  11614. + srl %r3,8 ; ؿ
  11615. + srl %r3,3 ; ؿ
  11616. +
  11617. +
  11618. + xcmp %r3, 0x7ff ; if ؿ(%r3) >= overflow value
  11619. + ext end@rm
  11620. + jreq end@rl ; result is 0 (xxx/NaN = 0)
  11621. +
  11622. + ; del @@@ 01/02/19 del xld.w %r10, 0x100000 ; implied bit(%r10) <- 0x100000
  11623. +
  11624. + ; isolate mantissa1
  11625. + xand %r7, 0xfffff ; clear first 12 bits of %r7
  11626. +
  11627. + cmp %r1, 0
  11628. + jreq.d count1 ; if ؿ(%r1) = 0 (denormal)
  11629. + ld.w %r2, 1 ; flag(%r2) = 1
  11630. +
  11631. + ; case: normal input
  11632. + xoor %r7, 0x100000 ; else add implied bit(0x100000) to mantissa @@@ 01/02/19
  11633. + ld.w %r2, 0 ; flag(%r2) = 0
  11634. + jp.d getman2
  11635. + ld.w %r5, 11 ; count1(%r5) = 11
  11636. +
  11637. +count1:
  11638. + ld.w %r4, %r7 ; scan64 (%r4) <- [H](%r7)
  11639. + ld.w %r5, %r6 ; scan64 (%r5) <- [L](%r6)
  11640. + ; @@@ del 01/02/19 xcall __scan64
  11641. + ; SCAN64 %r4, %r5 ; @@@ add 01/02/19
  11642. + pushn %r1 ; save register values
  11643. +
  11644. + ld.w %r0, 0 ; loop counter = 0
  11645. +
  11646. + cmp %r4, 0 ; if high 32-bits != 0 then count
  11647. + jrne __L0004
  11648. +
  11649. + ; case: $1 = 0
  11650. + ld.w %r4, %r5 ; count low 32-bits instead
  11651. + xld.w %r0, 32 ; loop counter = 32
  11652. +
  11653. +__L0004: ; count ; of leading 0's
  11654. + scan1 %r1, %r4 ; %r1 = count
  11655. + jruge __L0005 ; if count != 8 then goto end
  11656. + cmp %r0, 24
  11657. + jreq.d __L0005 ; if count = 32 then jump to end
  11658. + add %r0, 8 ; increment loop counter
  11659. + jp.d __L0004
  11660. + sll %r4, 8 ; shift register to the left 8 bits
  11661. +
  11662. +__L0005:
  11663. + add %r1, %r0 ; count = count + loop counter
  11664. + ld.w %r5, %r1 ; put result into output register
  11665. +
  11666. + popn %r1 ; restore register values
  11667. +
  11668. +getman2:
  11669. + ; isolate mantissa2
  11670. +
  11671. + xand %r9, 0xfffff ; [H] = [H] & 0xfffff clear first 12 bits of %r9
  11672. +
  11673. + cmp %r3, 0 ; if ؿ(%r3) = 0
  11674. + jreq.d count2 ; then jump to count2
  11675. + ld.w %r3, %r5 ; %r11 = count1
  11676. +
  11677. + ; case: normal input
  11678. + xoor %r9, 0x100000 ; else add implied bit(0x100000) @@@ 01/02/19
  11679. + jp.d cmpcount
  11680. + ld.w %r4, 11 ; count2(%r12) = 11
  11681. +
  11682. +count2:
  11683. + ld.w %r4, %r9 ; scan64 (%r4) = [H](%r9)
  11684. + ld.w %r5, %r8 ; scan64 (%r5) = [L](%r8)
  11685. + ; @@@ del 01/02/19 xcall __scan64 ; %r13 = count2
  11686. + ; SCAN64 %r4, %r5 ; @@@ add 01/02/19
  11687. + pushn %r1 ; save register values
  11688. +
  11689. + ld.w %r0, 0 ; loop counter = 0
  11690. +
  11691. + cmp %r4, 0 ; if high 32-bits != 0 then count
  11692. + jrne __L0006
  11693. +
  11694. + ; case: $1 = 0
  11695. + ld.w %r4, %r5 ; count low 32-bits instead
  11696. + xld.w %r0, 32 ; loop counter = 32
  11697. +
  11698. +__L0006: ; count ; of leading 0's
  11699. + scan1 %r1, %r4 ; %r1 = count
  11700. + jruge __L0007 ; if count != 8 then goto end
  11701. + cmp %r0, 24
  11702. + jreq.d __L0007 ; if count = 32 then jump to end
  11703. + add %r0, 8 ; increment loop counter
  11704. + jp.d __L0006
  11705. + sll %r4, 8 ; shift register to the left 8 bits
  11706. +
  11707. +__L0007:
  11708. + add %r1, %r0 ; count = count + loop counter
  11709. + ld.w %r5, %r1 ; put result into output register
  11710. +
  11711. + popn %r1 ; restore register values
  11712. +
  11713. +
  11714. + sub %r2, 1 ; flag(%r2) = flag(%r2) - 1 (0 or -1)
  11715. +
  11716. +cmpcount:
  11717. + ; SET_TEMP %r0, %r2 ; ͭ쥸[TEMP](%r0) <- flag(%r2)
  11718. +__L0008:
  11719. + xand %r0,0xc03fffff ; ͭ쥸 TEMPꥢ
  11720. + xand %r2,0xff ; 1Х mask
  11721. + rr %r2,8 ; TEMPΥӥåȰ֤˥ե
  11722. + rr %r2,2 ; TEMPΥӥåȰ֤˥ե
  11723. + or %r0,%r2 ; TEMPå
  11724. + rl %r2,8 ;
  11725. + rl %r2,2 ;
  11726. +
  11727. + cmp %r3, %r5 ; if count1(%r11) <= count2(%r13)
  11728. + jrle man2shift ; then goto man2shift
  11729. +
  11730. + ; case: count1 > count2
  11731. + sub %r3, %r5 ; shift(%r3) = (count1(%r3) - count2(%r5)) - 1
  11732. + sub %r3, 1
  11733. +
  11734. + ; {%r7, %r6} << shift
  11735. + ;xsll %r7, %r11 ; shift high 32-bits to the left x bits
  11736. + ;xrl %r6, %r11 ; rotate low 32-bits to the left x bits
  11737. + ;xsll %r10, %r11 ; make a mask for first 32-x bits --> %r10 = 111...000
  11738. +
  11739. + ld.w %r2, -1 ; %r2 = 0xffff ffff
  11740. + ; used in 64-bit variable shifts ; SHFTROTSHFT %r3, %r7, %r6, %r2, sll, rl, %r5 ; %r5 = temp
  11741. + ; $1 = shift amount
  11742. + ; $2 = 1st input register (shifted)
  11743. + ; $3 = 2nd input register (rotated)
  11744. + ; $4 = 3rd input register (mask --> shifted)
  11745. + ; $5 = shift instruction
  11746. + ; $6 = rotate instruction
  11747. + ; $7 = temp register
  11748. + ld.w %r5, %r3 ; temp = shift amount
  11749. +
  11750. +__L0009:
  11751. + cmp %r5, 8 ; if temp <= 8 then goto $$2
  11752. + jrle __L0010
  11753. +
  11754. + sll %r7, 8 ; shift 1st register
  11755. + rl %r6, 8 ; rotate 2nd register
  11756. + sll %r2, 8 ; shift 3rd register
  11757. + jp.d __L0009
  11758. + sub %r5, 8 ; temp = temp - 8
  11759. +
  11760. +__L0010:
  11761. + sll %r7, %r5 ; last shift
  11762. + rl %r6, %r5 ; last rotate
  11763. + sll %r2, %r5 ; last shift
  11764. + not %r5, %r2 ; flip mask for last x bits --> %r5 = 000...111 (mask)
  11765. + and %r5, %r6 ; isolate last x bits of %r6
  11766. + or %r7, %r5 ; add last x bits of %r6 to %r7
  11767. + and %r6, %r2 ; keep the high 32-x bits of %r6
  11768. +
  11769. + add %r3, 1 ; shift(%r3) = shift(%r3) + 1
  11770. + jp.d divide
  11771. + ld.w %r2, %r3 ; lshift(%r2) = count1 - count2
  11772. +
  11773. +man2shift:
  11774. + sub %r5, %r3 ; shift(%r5) = count2 - count1 + 1
  11775. + add %r5, 1
  11776. +
  11777. + ; {%r9, %r8} << shift
  11778. + ;xsll %r9, %r13 ; shift high 32-bits to the left x bits
  11779. + ;xrl %r8, %r13 ; rotate low 32-bits to the left x bits
  11780. + ;xsll %r10, %r13 ; make a mask for first 32-x bits --> %r10 = 111...000
  11781. +
  11782. + ld.w %r2, -1 ; %r2 = 0xffff ffff
  11783. + ; used in 64-bit variable shifts ; SHFTROTSHFT %r5, %r9, %r8, %r2, sll, rl, %r4 ; %r4 = temp
  11784. + ; $1 = shift amount
  11785. + ; $2 = 1st input register (shifted)
  11786. + ; $3 = 2nd input register (rotated)
  11787. + ; $4 = 3rd input register (mask --> shifted)
  11788. + ; $5 = shift instruction
  11789. + ; $6 = rotate instruction
  11790. + ; $7 = temp register
  11791. + ld.w %r4, %r5 ; temp = shift amount
  11792. +
  11793. +__L0011:
  11794. + cmp %r4, 8 ; if temp <= 8 then goto $$2
  11795. + jrle __L0012
  11796. +
  11797. + sll %r9, 8 ; shift 1st register
  11798. + rl %r8, 8 ; rotate 2nd register
  11799. + sll %r2, 8 ; shift 3rd register
  11800. + jp.d __L0011
  11801. + sub %r4, 8 ; temp = temp - 8
  11802. +
  11803. +__L0012:
  11804. + sll %r9, %r4 ; last shift
  11805. + rl %r8, %r4 ; last rotate
  11806. + sll %r2, %r4 ; last shift
  11807. + not %r4, %r2 ; flip mask for last x bits --> %r4 = 000...111 (mask)
  11808. + and %r4, %r8 ; isolate last x bits of %r8
  11809. + or %r9, %r4 ; add last x bits of %r8 to %r9
  11810. + and %r8, %r2 ; keep the high 32-x bits of %r8
  11811. +
  11812. + not %r2, %r5 ; lshift(%r10) = count1 - count2 (~shift + 1 + 1)
  11813. + add %r2, 2
  11814. +
  11815. +divide:
  11816. + ; man1 has x leading 0's
  11817. + ; man2 has x-1 leading 0's
  11818. + ; lshift used to normalize result
  11819. + ; %r0 = sign; %r1 = exp1, %r3 = exp2
  11820. + ; %r10 = lshift
  11821. + ; GET_EXP2 %r0, %r3 ; ؿ(%r3) <- ͭ쥸[ؿ](%r0)
  11822. +__L0013:
  11823. + ld.w %r3,%r0
  11824. + srl %r3,8
  11825. + srl %r3,3
  11826. + xand %r3,0x7ff ; ͭ쥸 ؿ
  11827. +
  11828. +
  11829. + sub %r1, %r3 ; new sisu = sisu1 - sisu2 + bias + flag (0,1,-1)
  11830. +
  11831. + xadd %r1, 0x3ff
  11832. + ; GET_TEMP %r0, %r3 ; flag(%r3) <- ͭ쥸[TEMP](%r0) @@@ 01/02/19 add
  11833. +__L0014:
  11834. + ld.w %r3,%r0
  11835. + rl %r3,8
  11836. + rl %r3,2
  11837. + xand %r3,0xff ; ͭ쥸 TEMP
  11838. +
  11839. + add %r1, %r3
  11840. +
  11841. + xcmp %r1, 0x7ff ; if ؿ(%r1) >= 0x7ff then goto overflow
  11842. + ext overflow@rm
  11843. + jrge overflow@rl
  11844. + xcmp %r1, -52 ; if ؿ(%r1) <= -52 then underflow
  11845. + ext end@rm
  11846. + jrle end@rl
  11847. +
  11848. + ; DIVIDE CODE STARTS HERE
  11849. + ld.w %r3, %r1
  11850. + rl %r3,1 ; ؿӥå¸
  11851. + ; SET_SIGN2 %r0, %r3 ; ͭ쥸[ӥåȣ](%r0) <- ؿӥå
  11852. +__L0015:
  11853. + xand %r0,0xbfffffff ; ͭ쥸 ӥåȣꥢ
  11854. + and %r3,1 ; 1ӥåȥޥ
  11855. + rr %r3,2 ; ӥåȣΥӥåȰ֤˥ơ
  11856. + or %r0,%r3 ; ӥåȣå
  11857. + rl %r3,2 ; ӥå
  11858. +
  11859. + ; SET_EXP1 %r0, %r1 ; ͭ쥸[ؿ](%r0) <- ؿ(%r1) @@@ 01/02/19 add
  11860. +__L0016:
  11861. + xand %r0,0xfffff800 ; ͭ쥸 ؿꥢ
  11862. + xand %r1,0x7ff ; ӥåȥޥ
  11863. + or %r0,%r1 ; ؿå
  11864. +
  11865. + ; SET_TEMP %r0, %r2 ; ͭ쥸[TEMP](%r0) <- lshift(%r2) @@@ 01/02/19 add
  11866. +__L0017:
  11867. + xand %r0,0xc03fffff ; ͭ쥸 TEMPꥢ
  11868. + xand %r2,0xff ; 1Х mask
  11869. + rr %r2,8 ; TEMPΥӥåȰ֤˥ե
  11870. + rr %r2,2 ; TEMPΥӥåȰ֤˥ե
  11871. + or %r0,%r2 ; TEMPå
  11872. + rl %r2,8 ;
  11873. + rl %r2,2 ;
  11874. +
  11875. +
  11876. + ; make a mask for first 31 bits --> %r2 = 111...110
  11877. + ; @@@ del 01/02/19 ld.w %r2, -2 ; %r2 = 0xffff fffe
  11878. + ld.w %r3, 0 ; loop(%r3) <- 0
  11879. + ld.w %r1, 0 ; flag(%r1) = 0
  11880. + ld.w %r4, 0 ; @@@ 01/02/26 add
  11881. + ld.w %r5, 0 ; @@@ 01/02/26 add
  11882. +
  11883. +
  11884. +loop:
  11885. + add %r3, 1 ; loop(%r3) = loop(%r3) + 1
  11886. + xcmp %r3, 55 ; if loop(%r3) >= 55 then exit divide loop
  11887. + jrge normalize
  11888. +
  11889. + ; {result1, result2} << 1
  11890. + sll %r5, 1 ; shift high 32-bits to the left 1 bit
  11891. + rl %r4, 1 ; rotate low 32-bits to the left 1 bit
  11892. + ld.w %r2, 1 ; mask for last bit (LSB)
  11893. + and %r2, %r4 ; isolate last bit of %r8
  11894. + or %r5, %r2 ; add last bit of %r8 to %r9
  11895. + xand %r4, -2 ; keep the high 31 bits of %r8
  11896. +
  11897. + scan1 %r1, %r7 ; is there a leading 1? (0 = yes)
  11898. +
  11899. + ; {[H](%r7), [L](%r6)} << 1
  11900. + sll %r7, 1 ; shift high 32-bits to the left 1 bit
  11901. + rl %r6, 1 ; rotate low 32-bits to the left 1 bit
  11902. + ld.w %r2, 1 ; mask for last bit (LSB)
  11903. + and %r2, %r6 ; isolate last bit of %r8
  11904. + or %r7, %r2 ; add last bit of %r8 to %r9
  11905. + xand %r6, -2 ; keep the high 31 bits of %r8
  11906. + cmp %r1, 0 ; if a leading 1 was shifted out then subtract
  11907. + jreq subtract
  11908. +
  11909. + cmp %r7, %r9
  11910. + jrugt subtract ; if [H](%r7) > [H](%r9) then subtract
  11911. + jrult loop ; if [H](%r7) < [H](%r9) then goto loop
  11912. +
  11913. + ; case: man1 = man2 (%r7 = %r9)
  11914. + cmp %r6, %r8 ; if [L](%r6) < [L](%r8) then goto loop
  11915. + jrult loop
  11916. +
  11917. +subtract:
  11918. + sub %r6, %r8 ; [L](%r6) = [L](%r6) - [L](%r8)
  11919. + sbc %r7, %r9 ; [H](%r7) = [H](%r7) - [H](%r9) - carry
  11920. + add %r4, 1 ; [L](%r4) = [L](%r4) + 1
  11921. +
  11922. + cmp %r7, 0 ; if {[H](%r7), [L](%r6) } = 0 then exit
  11923. + jrne loop
  11924. + cmp %r6, 0
  11925. + jrne loop
  11926. +
  11927. + xcmp %r3, 54 ; if loop(%r3) >= 54 then exit divide loop
  11928. + jrge normalize
  11929. +
  11930. + ; fill in the extra 0's needed in the result
  11931. + xld.w %r1, 54
  11932. + sub %r1, %r3 ; extra(%r1) = 54 - loop(%r3)
  11933. + xcmp %r1, 32 ; if extra(%r1) < 32 then goto shift
  11934. + jrlt xshift
  11935. +
  11936. + ; case: extra iterations >= 32
  11937. + ld.w %r5, %r4 ; [H](%r5) <- [L](%r4)
  11938. + ld.w %r4, 0 ; [L](%r4) <- 0
  11939. + sub %r1, 32 ; extra(%r1) = extra(%r1) - 32
  11940. +
  11941. +xshift:
  11942. + ; {%r5, %r4} << extra
  11943. + ;xsll %r5, %r11 ; shift high 32-bits to the left x bits
  11944. + ;xrl %r4, %r11 ; rotate low 32-bits to the left x bits
  11945. + ;xsll %r3, %r11 ; make a mask for first 32-x bits --> %r3 = 111...000
  11946. +
  11947. + ld.w %r3, -1 ; %r3 = 0xffff ffff
  11948. + ; used in 64-bit variable shifts ; SHFTROTSHFT %r1, %r5, %r4, %r3, sll, rl, %r1
  11949. + ; $1 = shift amount
  11950. + ; $2 = 1st input register (shifted)
  11951. + ; $3 = 2nd input register (rotated)
  11952. + ; $4 = 3rd input register (mask --> shifted)
  11953. + ; $5 = shift instruction
  11954. + ; $6 = rotate instruction
  11955. + ; $7 = temp register
  11956. + ld.w %r1, %r1 ; temp = shift amount
  11957. +
  11958. +__L0018:
  11959. + cmp %r1, 8 ; if temp <= 8 then goto $$2
  11960. + jrle __L0019
  11961. +
  11962. + sll %r5, 8 ; shift 1st register
  11963. + rl %r4, 8 ; rotate 2nd register
  11964. + sll %r3, 8 ; shift 3rd register
  11965. + jp.d __L0018
  11966. + sub %r1, 8 ; temp = temp - 8
  11967. +
  11968. +__L0019:
  11969. + sll %r5, %r1 ; last shift
  11970. + rl %r4, %r1 ; last rotate
  11971. + sll %r3, %r1 ; last shift
  11972. + not %r2, %r3 ; flip mask for last x bits --> %r2 = 000...111 (mask)
  11973. + and %r2, %r4 ; isolate last x bits of %r6
  11974. + or %r5, %r2 ; add last x bits of %r6 to %r7
  11975. + and %r4, %r3 ; keep the high 32-x bits of %r6
  11976. +
  11977. + ; DIVIDE CODE ENDS HERE
  11978. +
  11979. +normalize:
  11980. + ; %r0 = result sign, %r1 = result exponent
  11981. + ; %r10 = lshift, (%r5, %r4) = result
  11982. +
  11983. + ;ld.w %r3, 10 ; count = 10
  11984. + ld.w %r3, 0 ; count(%r3) <- 0
  11985. +
  11986. + ld.w %r8, %r5
  11987. + xand %r8, 0x200000 ; check 21st bit
  11988. +
  11989. + jrne continue2 ; if 21st bit = 1 then count = 10
  11990. + add %r3, 1 ; else count(%r3) = count(%r3) + 1
  11991. +
  11992. +continue2:
  11993. + ; GET_EXP1 %r0, %r1 ; ؿ(%r1) <- ͭ쥸[ؿ](%r0)
  11994. +__L0020:
  11995. + ld.w %r1,%r0 ;
  11996. + xand %r1,0x7ff ; ͭ쥸 ؿ
  11997. +
  11998. + ; GET_SIGN2 %r0, %r2 ; ؿӥå(%r2) <- ͭ쥸[ӥåȣ](%r0)
  11999. +__L0021:
  12000. + ld.w %r2,%r0 ;
  12001. + rl %r2,2 ; ӥåȥơ
  12002. + and %r2,1 ; ͭ쥸 ӥåȣ
  12003. +
  12004. + cmp %r2, 1 ; ؿޥʥ
  12005. + jrne exp1_no_sign
  12006. + xoor %r1, 0xfffff800 ; ؿĥ
  12007. +exp1_no_sign:
  12008. +
  12009. +
  12010. + ; GET_TEMP %r0, %r2 ; lshift(%r2) <- ͭ쥸[TEMP](%r0)
  12011. +__L0022:
  12012. + ld.w %r2,%r0
  12013. + rl %r2,8
  12014. + rl %r2,2
  12015. + xand %r2,0xff ; ͭ쥸 TEMP
  12016. +
  12017. +
  12018. + ;sub %r3, 10 ; count = count - 10
  12019. + add %r2, %r3 ; lshift(%r2) = lshiftؿ + count(%r3)
  12020. + cmp %r1, %r2
  12021. + jrgt normal ; if ؿ(%r1) > lshift(%r10) then normal result
  12022. +
  12023. + ; case: ؿ(%r1) <= lshift(%r2)
  12024. + add %r2, 1
  12025. + sub %r2, %r3 ; lshift(%r2) = lshift(%r2) + (11 - count(%r3))
  12026. + sub %r2, %r1
  12027. + add %r2, 1 ; lshift(%r2) = lshift(%r2) - (ؿ(%r1) - 1)
  12028. +
  12029. + xcmp %r2, 54 ; if lshift(%r2) >= 54 then underflow
  12030. + jrlt notunder
  12031. + ld.w %r5, 0 ; [H](%r5) <- 0
  12032. + jp.d end
  12033. + ld.w %r4, 0
  12034. +
  12035. +notunder:
  12036. + ; {%r5, %r4} >> %r10
  12037. + ;xsrl %r4, %r10 ; shift low 32-bits to the right x bits (shift amount = x)
  12038. + ;xrr %r5, %r10 ; rotate high 32-bits to the right x bits
  12039. + ;xsrl %r3, %r10 ; make a mask for last 32-x bits --> %r3 = 000...111
  12040. +
  12041. + ld.w %r3, -1 ; %r3 = 0xffff ffff
  12042. + ; used in 64-bit variable shifts ; SHFTROTSHFT %r2, %r4, %r5, %r3, srl, rr, %r2
  12043. + ; $1 = shift amount
  12044. + ; $2 = 1st input register (shifted)
  12045. + ; $3 = 2nd input register (rotated)
  12046. + ; $4 = 3rd input register (mask --> shifted)
  12047. + ; $5 = shift instruction
  12048. + ; $6 = rotate instruction
  12049. + ; $7 = temp register
  12050. + ld.w %r2, %r2 ; temp = shift amount
  12051. +
  12052. +__L0023:
  12053. + cmp %r2, 8 ; if temp <= 8 then goto $$2
  12054. + jrle __L0024
  12055. +
  12056. + srl %r4, 8 ; shift 1st register
  12057. + rr %r5, 8 ; rotate 2nd register
  12058. + srl %r3, 8 ; shift 3rd register
  12059. + jp.d __L0023
  12060. + sub %r2, 8 ; temp = temp - 8
  12061. +
  12062. +__L0024:
  12063. + srl %r4, %r2 ; last shift
  12064. + rr %r5, %r2 ; last rotate
  12065. + srl %r3, %r2 ; last shift
  12066. + not %r8, %r3 ; flip mask for first x bits --> %r8 = 111...000 (mask)
  12067. + and %r8, %r5 ; isolate first x bits of %r5
  12068. + or %r4, %r8 ; add first x bits of %r5 to %r4
  12069. + and %r5, %r3 ; keep the low 32-x bits of %r5
  12070. +
  12071. +
  12072. + ld.w %r1, 0 ; ؿ(%r1) <- 0 for denormal result
  12073. + ; SET_EXP1 %r0, %r1
  12074. +__L0025:
  12075. + xand %r0,0xfffff800 ; ͭ쥸 ؿꥢ
  12076. + xand %r1,0x7ff ; ӥåȥޥ
  12077. + or %r0,%r1 ; ؿå
  12078. +
  12079. + jp finish
  12080. + ; @@@ 01/03/02 del ld.w %r1, 0 ; ؿ(%r1) <- 0 for denormal result
  12081. +
  12082. +normal:
  12083. + ; case: exp > lshift
  12084. + sub %r1, %r2 ; ؿ(%r1) = ؿ(%r1) - lshift(%r2)
  12085. + ; SET_EXP1 %r0, %r1 ; ؿ(%r1) <- ͭ쥸[ؿ](%r0) @@@ 01/02/26 add
  12086. +__L0026:
  12087. + xand %r0,0xfffff800 ; ͭ쥸 ؿꥢ
  12088. + xand %r1,0x7ff ; ӥåȥޥ
  12089. + or %r0,%r1 ; ؿå
  12090. +
  12091. +
  12092. + cmp %r3, 1 ; if original count(%r3) = 11 then no shifting needed
  12093. + jreq overchk
  12094. +
  12095. + ; {[H](%r5), [L](%r4)} >> 1 (shift to the right 1 bit)
  12096. + srl %r4, 1 ; shift low 32-bits to the right 1 bit
  12097. + ld.w %r3, 1 ; mask
  12098. + and %r3, %r5 ; get LSB of high 32-bits
  12099. + rr %r3, 1 ; rotate to MSB position
  12100. + or %r4, %r3 ; add to %r4
  12101. + srl %r5, 1 ; shift high 32-bits to the right 1 bit
  12102. +
  12103. +overchk:
  12104. + xcmp %r1, 0x7ff ; if ؿ(%r1) < 0x7ff then jump to finish
  12105. + jrlt finish
  12106. +
  12107. +overflow:
  12108. + xld.w %r5, 0x7ff00000 ; put infinity into result
  12109. + jp.d end
  12110. + ld.w %r4, 0
  12111. +
  12112. +finish:
  12113. + ; %r0 = sign, %r1 = exponent, %r5 = mantissa
  12114. +
  12115. + xand %r5, 0xfffff ; [H](%r5) = [H](%r5) & 0xfffff
  12116. +
  12117. + ; GET_EXP1 %r0, %r1 ; ؿ(%r1) <- ͭ쥸[ؿ](%r0)
  12118. +__L0027:
  12119. + ld.w %r1,%r0 ;
  12120. + xand %r1,0x7ff ; ͭ쥸 ؿ
  12121. +
  12122. +
  12123. + xrr %r1, 12 ; position exponent bits to [30:20]
  12124. + or %r5, %r1
  12125. +
  12126. +end:
  12127. + ; GET_SIGN1 %r0, %r2 ; ӥåȣ(%r2) <- ͭ쥸[ӥåȣ](%r0)
  12128. +__L0028:
  12129. + ld.w %r2,%r0 ;
  12130. + rl %r2,1 ; ӥåȥơ
  12131. + and %r2,1 ; ͭ쥸 ӥåȣ
  12132. +
  12133. +
  12134. + rr %r2, 1 ; position sign bit to MSB
  12135. + or %r5, %r2 ; [H](%r5) = [H](%r5) | ӥåȣ(%r1)
  12136. +
  12137. + ;@@@ 01/01/23 add start hinokuchi
  12138. + ;ld.w %r13, [%sp+3] ; %r13
  12139. + ;ld.w %r12, [%sp+2] ; %r12
  12140. + ;ld.w %r11, [%sp+1] ; %r11
  12141. + ;ld.w %r10, [%sp+0] ; %r10
  12142. + ;add %sp, 4
  12143. + ;@@@ 01/01/23 add end
  12144. +
  12145. + popn %r3 ; restore register values
  12146. + ret
  12147. diff --git a/gcc/config/c33/libgcc/divhi3.lst b/gcc/config/c33/libgcc/divhi3.lst
  12148. new file mode 100644
  12149. index 0000000..eb17ef0
  12150. --- /dev/null
  12151. +++ b/gcc/config/c33/libgcc/divhi3.lst
  12152. @@ -0,0 +1,118 @@
  12153. +GAS LISTING divhi3.s page 1
  12154. +
  12155. +
  12156. + 1 ;
  12157. + 2 ; Copyright (C) SEIKO EPSON CORP. 1996
  12158. + 3 ;
  12159. + 4 ; Filename : divhi3.s
  12160. + 5 ; Function :
  12161. + 6 ; This module defines the functions
  12162. + 7 ; that emulate signed and unsigned integer division.
  12163. + 8 ; Revision :
  12164. + 9 ; 10/18/1996 ESD T.Katahira start */
  12165. + 10 ; 06/11/2002 watanabe for divhi3
  12166. + 11 ;
  12167. + 12 ;
  12168. + 13 ; Function : __divhi3
  12169. + 14 ; Input : %r6 --- dividend
  12170. + 15 ; %r7 --- divisor
  12171. + 16 ; Output : %r4 --- quotient
  12172. + 17 ; Function : calculate signed integer division
  12173. + 18
  12174. + 19
  12175. + 20 .section .text
  12176. + 21 .align 1
  12177. + 22 .global __divhi3
  12178. + 23 __divhi3:
  12179. + 24 0000 868C868C xsll %r6, 16
  12180. + 25 0004 62A0 ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  12181. + 26 0006 708B div0s %r7 ; initializer of signed division
  12182. + 27 ;ifdef FAST
  12183. + 28 0008 7093 div1 %r7 ; execute division ;1
  12184. + 29 000a 7093 div1 %r7 ; execute division ;2
  12185. + 30 000c 7093 div1 %r7 ; execute division ;3
  12186. + 31 000e 7093 div1 %r7 ; execute division ;4
  12187. + 32 0010 7093 div1 %r7 ; execute division ;5
  12188. + 33 0012 7093 div1 %r7 ; execute division ;6
  12189. + 34 0014 7093 div1 %r7 ; execute division ;7
  12190. + 35 0016 7093 div1 %r7 ; execute division ;8
  12191. + 36 0018 7093 div1 %r7 ; execute division ;9
  12192. + 37 001a 7093 div1 %r7 ; execute division ;10
  12193. + 38 001c 7093 div1 %r7 ; execute division ;11
  12194. + 39 001e 7093 div1 %r7 ; execute division ;12
  12195. + 40 0020 7093 div1 %r7 ; execute division ;13
  12196. + 41 0022 7093 div1 %r7 ; execute division ;14
  12197. + 42 0024 7093 div1 %r7 ; execute division ;15
  12198. + 43 0026 7093 div1 %r7 ; execute division ;16
  12199. + 44 ;else
  12200. + 45 ; ld.w %r8,0x2 ; set loop counter (N = 2)
  12201. + 46 ; ld.w %r9,%psr ; save flag register
  12202. + 47 ;__divhi3_loop_start:
  12203. + 48 ; div1 %r7 ; execute division ;1
  12204. + 49 ; div1 %r7 ; execute division ;2
  12205. + 50 ; div1 %r7 ; execute division ;3
  12206. + 51 ; div1 %r7 ; execute division ;4
  12207. + 52 ; div1 %r7 ; execute division ;5
  12208. + 53 ; div1 %r7 ; execute division ;6
  12209. + 54 ; div1 %r7 ; execute division ;7
  12210. + 55 ; div1 %r7 ; execute division ;8
  12211. + 56 ; sub %r8,0x1 ; decrement loop counter
  12212. + 57 ; jrne.d __divhi3_loop_start ; if (loop counter != 0) goto loop top
  12213. + GAS LISTING divhi3.s page 2
  12214. +
  12215. +
  12216. + 58 ; ld.w %psr,%r9 ; restore flag register (delayed slot)
  12217. + 59 ;endif
  12218. + 60 0028 7097 div2s %r7 ; post divistion process ;1
  12219. + 61 002a 009B div3s ; post divistion process ;2
  12220. + 62 002c 4007 ret.d ; return to the caller (use delayed return)
  12221. + 63 002e 24A4 ld.w %r4,%alr ; set quotient to return reg (delayed slot)
  12222. + 64
  12223. + 65
  12224. + 66 ; Function : __udivhi3
  12225. + 67 ; Input : %r6 --- dividend
  12226. + 68 ; %r7 --- divisor
  12227. + 69 ; Output : %r4 --- quotient
  12228. + 70 ; Function : calculate unsigned integer division
  12229. + 71
  12230. + 72 .section .text
  12231. + 73 .align 1
  12232. + 74 .global __udivhi3
  12233. + 75 __udivhi3:
  12234. + 76 0030 868C868C xsll %r6, 16
  12235. + 77 0034 62A0 ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  12236. + 78 0036 708F div0u %r7 ; initializer of signed division
  12237. + 79 ;ifdef FAST
  12238. + 80 0038 7093 div1 %r7 ; execute division ;1
  12239. + 81 003a 7093 div1 %r7 ; execute division ;2
  12240. + 82 003c 7093 div1 %r7 ; execute division ;3
  12241. + 83 003e 7093 div1 %r7 ; execute division ;4
  12242. + 84 0040 7093 div1 %r7 ; execute division ;5
  12243. + 85 0042 7093 div1 %r7 ; execute division ;6
  12244. + 86 0044 7093 div1 %r7 ; execute division ;7
  12245. + 87 0046 7093 div1 %r7 ; execute division ;8
  12246. + 88 0048 7093 div1 %r7 ; execute division ;9
  12247. + 89 004a 7093 div1 %r7 ; execute division ;10
  12248. + 90 004c 7093 div1 %r7 ; execute division ;11
  12249. + 91 004e 7093 div1 %r7 ; execute division ;12
  12250. + 92 0050 7093 div1 %r7 ; execute division ;13
  12251. + 93 0052 7093 div1 %r7 ; execute division ;14
  12252. + 94 0054 7093 div1 %r7 ; execute division ;15
  12253. + 95 0056 7093 div1 %r7 ; execute division ;16
  12254. + 96 ;else
  12255. + 97 ; ld.w %r8,0x2 ; set loop counter (N = 2)
  12256. + 98 ;__udivhi3_loop_start:
  12257. + 99 ; div1 %r7 ; execute division ;1
  12258. + 100 ; div1 %r7 ; execute division ;2
  12259. + 101 ; div1 %r7 ; execute division ;3
  12260. + 102 ; div1 %r7 ; execute division ;4
  12261. + 103 ; div1 %r7 ; execute division ;5
  12262. + 104 ; div1 %r7 ; execute division ;6
  12263. + 105 ; div1 %r7 ; execute division ;7
  12264. + 106 ; div1 %r7 ; execute division ;8
  12265. + 107 ; sub %r8,0x1 ; decrement loop counter
  12266. + 108 ; jrne __udivhi3_loop_start ; if (loop counter != 0) goto loop top
  12267. + 109 ;endif
  12268. + 110 0058 4007 ret.d ; return to the caller (use delayed return)
  12269. + 111 005a 24A4 ld.w %r4,%alr ; set quotient to return reg (delayed slot)
  12270. + 112
  12271. diff --git a/gcc/config/c33/libgcc/divhi3.s b/gcc/config/c33/libgcc/divhi3.s
  12272. new file mode 100644
  12273. index 0000000..6928db9
  12274. --- /dev/null
  12275. +++ b/gcc/config/c33/libgcc/divhi3.s
  12276. @@ -0,0 +1,112 @@
  12277. +;
  12278. +; Copyright (C) SEIKO EPSON CORP. 1996
  12279. +;
  12280. +; Filename : divhi3.s
  12281. +; Function :
  12282. +; This module defines the functions
  12283. +; that emulate signed and unsigned integer division.
  12284. +; Revision :
  12285. +; 10/18/1996 ESD T.Katahira start */
  12286. +; 06/11/2002 watanabe for divhi3
  12287. +;
  12288. +;
  12289. +; Function : __divhi3
  12290. +; Input : %r6 --- dividend
  12291. +; %r7 --- divisor
  12292. +; Output : %r4 --- quotient
  12293. +; Function : calculate signed integer division
  12294. +
  12295. +
  12296. + .section .text
  12297. + .align 1
  12298. + .global __divhi3
  12299. +__divhi3:
  12300. + xsll %r6, 16
  12301. + ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  12302. + div0s %r7 ; initializer of signed division
  12303. +;ifdef FAST
  12304. + div1 %r7 ; execute division ;1
  12305. + div1 %r7 ; execute division ;2
  12306. + div1 %r7 ; execute division ;3
  12307. + div1 %r7 ; execute division ;4
  12308. + div1 %r7 ; execute division ;5
  12309. + div1 %r7 ; execute division ;6
  12310. + div1 %r7 ; execute division ;7
  12311. + div1 %r7 ; execute division ;8
  12312. + div1 %r7 ; execute division ;9
  12313. + div1 %r7 ; execute division ;10
  12314. + div1 %r7 ; execute division ;11
  12315. + div1 %r7 ; execute division ;12
  12316. + div1 %r7 ; execute division ;13
  12317. + div1 %r7 ; execute division ;14
  12318. + div1 %r7 ; execute division ;15
  12319. + div1 %r7 ; execute division ;16
  12320. +;else
  12321. +; ld.w %r8,0x2 ; set loop counter (N = 2)
  12322. +; ld.w %r9,%psr ; save flag register
  12323. +;__divhi3_loop_start:
  12324. +; div1 %r7 ; execute division ;1
  12325. +; div1 %r7 ; execute division ;2
  12326. +; div1 %r7 ; execute division ;3
  12327. +; div1 %r7 ; execute division ;4
  12328. +; div1 %r7 ; execute division ;5
  12329. +; div1 %r7 ; execute division ;6
  12330. +; div1 %r7 ; execute division ;7
  12331. +; div1 %r7 ; execute division ;8
  12332. +; sub %r8,0x1 ; decrement loop counter
  12333. +; jrne.d __divhi3_loop_start ; if (loop counter != 0) goto loop top
  12334. +; ld.w %psr,%r9 ; restore flag register (delayed slot)
  12335. +;endif
  12336. + div2s %r7 ; post divistion process ;1
  12337. + div3s ; post divistion process ;2
  12338. + ret.d ; return to the caller (use delayed return)
  12339. + ld.w %r4,%alr ; set quotient to return reg (delayed slot)
  12340. +
  12341. +
  12342. +; Function : __udivhi3
  12343. +; Input : %r6 --- dividend
  12344. +; %r7 --- divisor
  12345. +; Output : %r4 --- quotient
  12346. +; Function : calculate unsigned integer division
  12347. +
  12348. + .section .text
  12349. + .align 1
  12350. + .global __udivhi3
  12351. +__udivhi3:
  12352. + xsll %r6, 16
  12353. + ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  12354. + div0u %r7 ; initializer of signed division
  12355. +;ifdef FAST
  12356. + div1 %r7 ; execute division ;1
  12357. + div1 %r7 ; execute division ;2
  12358. + div1 %r7 ; execute division ;3
  12359. + div1 %r7 ; execute division ;4
  12360. + div1 %r7 ; execute division ;5
  12361. + div1 %r7 ; execute division ;6
  12362. + div1 %r7 ; execute division ;7
  12363. + div1 %r7 ; execute division ;8
  12364. + div1 %r7 ; execute division ;9
  12365. + div1 %r7 ; execute division ;10
  12366. + div1 %r7 ; execute division ;11
  12367. + div1 %r7 ; execute division ;12
  12368. + div1 %r7 ; execute division ;13
  12369. + div1 %r7 ; execute division ;14
  12370. + div1 %r7 ; execute division ;15
  12371. + div1 %r7 ; execute division ;16
  12372. +;else
  12373. +; ld.w %r8,0x2 ; set loop counter (N = 2)
  12374. +;__udivhi3_loop_start:
  12375. +; div1 %r7 ; execute division ;1
  12376. +; div1 %r7 ; execute division ;2
  12377. +; div1 %r7 ; execute division ;3
  12378. +; div1 %r7 ; execute division ;4
  12379. +; div1 %r7 ; execute division ;5
  12380. +; div1 %r7 ; execute division ;6
  12381. +; div1 %r7 ; execute division ;7
  12382. +; div1 %r7 ; execute division ;8
  12383. +; sub %r8,0x1 ; decrement loop counter
  12384. +; jrne __udivhi3_loop_start ; if (loop counter != 0) goto loop top
  12385. +;endif
  12386. + ret.d ; return to the caller (use delayed return)
  12387. + ld.w %r4,%alr ; set quotient to return reg (delayed slot)
  12388. +
  12389. diff --git a/gcc/config/c33/libgcc/divsf3.lst b/gcc/config/c33/libgcc/divsf3.lst
  12390. new file mode 100644
  12391. index 0000000..86112e5
  12392. --- /dev/null
  12393. +++ b/gcc/config/c33/libgcc/divsf3.lst
  12394. @@ -0,0 +1,413 @@
  12395. +GAS LISTING divsf3.s page 1
  12396. +
  12397. +
  12398. + 1 ;*********************************************
  12399. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  12400. + 3 ;* ALL RIGHTS RESERVED
  12401. + 4 ;*
  12402. + 5 ;* filename : divsf3.s
  12403. + 6 ;*
  12404. + 7 ;* Single floating point division function
  12405. + 8 ;* input: %r6, %r7
  12406. + 9 ;* output: %r4
  12407. + 10 ;*
  12408. + 11 ;* Begin 1996/09/12 V. Chan
  12409. + 12 ;* ѹ 2001/01/18 O.Hinokuchi
  12410. + 13 ;* gasб 2001/10/15 watanabe
  12411. + 14 ;*
  12412. + 15 ;*****************************************
  12413. + 16
  12414. + 17 .section .text
  12415. + 18 .align 1
  12416. + 19 .global __divsf3
  12417. + 20
  12418. + 21 ;==============================================
  12419. + 22 ;쥸
  12420. + 23 ; %r0:ӥåȣ(0(+) or 1(-))
  12421. + 24 ; %r1:ؿ(8bit)
  12422. + 25 ; %r2:ӥåȣ(0(+) or 1(-))/shift/flag
  12423. + 26 ; %r3:ؿ(8bit)/count
  12424. + 27 ; %r4:(float)
  12425. + 28 ; %r5:temp
  12426. + 29 ; %r6:()
  12427. + 30 ; %r7:()
  12428. + 31 ; %r8:mask
  12429. + 32 ; %r9:overflow value
  12430. + 33 ; %r10:implied bit/lshift
  12431. + 34 ; %r11:count1/shift
  12432. + 35 ; %r12:temp/count2
  12433. + 36 ; %r13:loop counter/temp/shift
  12434. + 37 ;==============================================
  12435. + 38
  12436. + 39
  12437. + 40 ;;macro VARSHIFT $1, $2, $3
  12438. + 41 ; used in 32-bit variable shifting
  12439. + 42 ; $1 = input register
  12440. + 43 ; $2 = shift amount
  12441. + 44 ; $3 = shift instruction
  12442. + 45 ;$$1:
  12443. + 46 ; cmp $2, 8 ; if temp <= 8 then goto $$2
  12444. + 47 ; jrle $$2
  12445. + 48
  12446. + 49 ; $3 $1, 8 ; shift input register 8 bits
  12447. + 50 ; jp.d $$1
  12448. + 51 ; sub $2, 8 ; temp = temp - 8
  12449. + 52
  12450. + 53 ;$$2:
  12451. + 54 ; $3 $1, $2 ; last shift
  12452. + 55 ;;endm
  12453. + 56
  12454. + 57 __divsf3:
  12455. + GAS LISTING divsf3.s page 2
  12456. +
  12457. +
  12458. + 58 0000 0302 pushn %r3 ; save register values
  12459. + 59 ;@@@ 01/01/30 add start hinokuchi
  12460. + 60 ;sub %sp, 4
  12461. + 61 ;ld.w [%sp+0], %r10 ; %r10
  12462. + 62 ;ld.w [%sp+1], %r11 ; %r11
  12463. + 63 ;ld.w [%sp+2], %r12 ; %r12
  12464. + 64 ;ld.w [%sp+3], %r13 ; %r13
  12465. + 65 ;@@@ 01/01/30 add end
  12466. + 66
  12467. + 67 ;@@@ 01/02/15 del xld.w %r9, 0xff ; set overflow comparison value
  12468. + 68
  12469. + 69 0002 602E ld.w %r0, %r6 ; ӥåȣ(%r0) <- (%r6)
  12470. + 70 0004 109C rl %r0, 1 ; ӥåȣ(%r0) rotate left 1 bit
  12471. + 71 0006 1070 and %r0, 1 ; ӥåȣ(%r0) & 1
  12472. + 72
  12473. + 73 0008 722E ld.w %r2, %r7 ; ӥåȣ(%r2) <- (%r7)
  12474. + 74 000a 129C rl %r2, 1 ; ӥåȣ(%r2) rotate left 1 bit
  12475. + 75 000c 1270 and %r2, 1 ; ӥåȣ(%r2) & 1
  12476. + 76
  12477. + 77 000e 203A xor %r0, %r2 ; ӥåȣ(%r0) = ~ӥåȣ(%r0)
  12478. + 78 0010 046C ld.w %r4, 0 ; (%r4) <- 0
  12479. + 79
  12480. + 80 0012 168C sll %r6, 1 ; (%r6) << 1 clear MSB
  12481. + 81 0014 1688 srl %r6, 1 ; (%r6) >> 1
  12482. + 82 0016 0668 cmp %r6, 0
  12483. + 83 0018 00C0 ext end@rm
  12484. + 84 001a 9A18 jreq end@rl ; if (%r6) = 0 then end
  12485. + 85
  12486. + 86 001c 0768 cmp %r7, 0
  12487. + 87 001e 178C sll %r7, 1 ; (%r7) << 1 clear
  12488. + 88 0020 1788 srl %r7, 1 ; (%r7) >> 1
  12489. + 89 0022 00C0 ext overflow@rm
  12490. + 90 0024 8B18 jreq overflow@rl ; if (%r7) = 0 then overflow
  12491. + 91
  12492. + 92 0026 612E ld.w %r1, %r6 ; ؿ(%r1) <- (%r6)
  12493. + 93 0028 81888188 xsrl %r1, 23 ; ؿ(%r1) >> 23
  12494. + 93 7188
  12495. + 94
  12496. + 95 ;@@@ 01/02/15 del cmp %r1, %r9 ; if ؿ(%r1) >= overflow value
  12497. + 96 002e 03C0F16B xcmp %r1, 0xff ; if ؿ(%r1) >= overflow value
  12498. + 97 0032 00C0 ext overflow@rm
  12499. + 98 0034 830A jrge overflow@rl ; result is overflow
  12500. + 99
  12501. + 100 0036 732E ld.w %r3, %r7 ; ؿ(%r3) <- (%r7)
  12502. + 101 0038 83888388 xsrl %r3, 23 ; ؿ(%r3) >> 23
  12503. + 101 7388
  12504. + 102
  12505. + 103 ;@@@ 01/02/15 del cmp %r3, %r9 ; if ؿ(%r3) >= overflow value
  12506. + 104 003e 03C0F36B xcmp %r3, 0xff ; if ؿ(%r3) >= overflow value
  12507. + 105
  12508. + 106 0042 00C0 ext end@rm
  12509. + 107 0044 8518 jreq end@rl ; result is 0 (xxx/NaN = 0)
  12510. + 108
  12511. + 109 ;@@@ 01/02/15 del xld.w %r8, 0x7fffff ; mask(%r8) <- 0x7fffff set mask for isolating mantissa
  12512. + 110 ;@@@ 01/02/15 del xld.w %r10, 0x800000 ; implied bit(%r10)
  12513. + 111 0046 0FC0FFDF xld.w %r5, 0x7fffff ; mask(%r8) <- 0x7fffff @@@ 01/02/16 add
  12514. + 111 F56F
  12515. + GAS LISTING divsf3.s page 3
  12516. +
  12517. +
  12518. + 112 004c 126C ld.w %r2, 1 ; flag(%r2) = 1
  12519. + 113 ;@@@ 01/02/15 del ld.w %r13, 0 ; loop counter(%r13) <- 0
  12520. + 114 004e 086C ld.w %r8, 0 ; loop counter(%r8) <- 0
  12521. + 115
  12522. + 116 ; isolate mantissa1
  12523. + 117 ;and %r6, %r8 ; line 62
  12524. + 118 0050 0168 cmp %r1, 0 ;
  12525. + 119 0052 0819 jreq.d count1 ; if ؿ(%r1) = 0 (denormal)
  12526. + 120 ;@@@ 01/02/15 del and %r6, %r8 ; (%r6) = (%r6) & mask(%r8) clear first 9 bits of %r
  12527. + 121 0054 5632 and %r6, %r5 ; (%r6) = (%r6) & 0x7fffff clear first 9 bits of %r6
  12528. + 122
  12529. + 123 ; case: normal input
  12530. + 124 ;@@@ 01/02/15 del or %r6, %r10 ; (%r6) = (%r6) & implied bit(%r10) else add implie
  12531. + 125 0056 10C000C0 xoor %r6, 0x800000 ; (%r6) = (%r6) & implied bit(0x800000) else add implied bit to m
  12532. + 125 0674
  12533. + 126 005c 026C ld.w %r2, 0 ; flag(%r2) <- 0
  12534. + 127 005e 081F jp.d getman2
  12535. + 128 ;@@@ 01/02/15 del ld.w %r11, 8 ; count1(%r11) <- 8
  12536. + 129 0060 896C ld.w %r9, 8 ; count1(%r9) <- 8
  12537. + 130
  12538. + 131 count1:
  12539. + 132 ;@@@ 01/02/15 del ld.w %r12, %r6 ; temp(%r12) <- (%r6)
  12540. + 133 0062 642E ld.w %r4, %r6 ; temp(%r4) <- (%r6)
  12541. + 134
  12542. + 135 loop1:
  12543. + 136 ;@@@ 01/02/15 del scan1 %r11, %r12 ; %r11 = count1
  12544. + 137 0064 498E scan1 %r9, %r4 ; %r9 = count1
  12545. + 138 0066 0412 jruge getman2 ; if count1 !=8 then goto getman2
  12546. + 139 ;@@@ 01/02/15 del add %r13, 8 ; loop counter(%r13) = loop counter(%r13) + 8
  12547. + 140 0068 8860 add %r8, 8 ; loop counter(%r8) = loop counter(%r8) + 8
  12548. + 141 006a FD1F jp.d loop1
  12549. + 142 ;@@@ 01/02/15 del sll %r12, 8 ; temp(%r12) << 8 shift register to the left 8 bits
  12550. + 143 006c 848C sll %r4, 8 ; temp(%r4) << 8 shift register to the left 8 bits
  12551. + 144
  12552. + 145 getman2:
  12553. + 146 ;@@@ 01/02/15 del add %r11, %r13 ; count1(%r11) = count1(%r11) + loop counter(%r13)
  12554. + 147 006e 8922 add %r9, %r8 ; count1(%r9) = count1(%r8) + loop counter(%r13)
  12555. + 148 ;@@@ 01/02/15 del ld.w %r13, 0 ; loop counter(%r13) = 0
  12556. + 149 0070 086C ld.w %r8, 0 ; loop counter(%r8) = 0
  12557. + 150
  12558. + 151 ; isolate mantissa2
  12559. + 152 ;and %r7, %r8 ; line 85
  12560. + 153 0072 0368 cmp %r3, 0
  12561. + 154 0074 0719 jreq.d count2 ; if ؿ(%r3) = 0 then jump to count2
  12562. + 155 ;@@@ 01/02/15 del and %r7, %r8 ; (%r7) = (%r7) & mask(%r8) clear first 9 bits of %r7
  12563. + 156 0076 5732 and %r7, %r5 ; (%r7) = (%r7) & mask(0x7fffff) clear first 9 bits of %r7
  12564. + 157 ;@@@ 01/02/15 del or %r7, %r10 ; (%r7) = (%r7) | implied bit(%r10) else add implied
  12565. + 158 0078 10C000C0 xoor %r7, 0x800000 ; (%r7) = (%r7) | implied bit(0x800000) else add implied bit
  12566. + 158 0774
  12567. + 159 007e 091F jp.d cmpcount
  12568. + 160 ;@@@ 01/02/15 del ld.w %r12, 8 ; count2(%r12) <- 8
  12569. + 161 0080 846C ld.w %r4, 8 ; count2(%r12) <- 8
  12570. + 162
  12571. + 163 count2:
  12572. + 164 0082 752E ld.w %r5, %r7 ; temp(%r5) <- (%r7) man2
  12573. + 165 0084 1264 sub %r2, 1 ; flag(%r2) = flag(%r2) - 1 (0 or -1)
  12574. + 166
  12575. + GAS LISTING divsf3.s page 4
  12576. +
  12577. +
  12578. + 167 loop2:
  12579. + 168 ;@@@ 01/02/15 del scan1 %r12, %r5 ; %r12 = count2
  12580. + 169 0086 548E scan1 %r4, %r5 ; %r4 = count2
  12581. + 170
  12582. + 171 0088 0412 jruge cmpcount ; if count2 !=8 then goto cmpcount
  12583. + 172 008a 8860 add %r8, 8 ; loop counter(%r8) = loop counter(%r8) + 8
  12584. + 173 008c FD1F jp.d loop2
  12585. + 174 008e 858C sll %r5, 8 ; temp(%r5) << 8 shift register to the left 8 bits
  12586. + 175
  12587. + 176 cmpcount:
  12588. + 177 0090 8422 add %r4, %r8 ; count2(%r4) = count2(%r4) + loop counter(%r8)
  12589. + 178
  12590. + 179 0092 492A cmp %r9, %r4 ; if count1(%r9) <= count2(%r4) then goto man2 shift
  12591. + 180 0094 0D0E jrle man2shift
  12592. + 181
  12593. + 182 ; case: count1 > count2
  12594. + 183 0096 4926 sub %r9, %r4 ; shift(%r9) = count1(%r9) - count2(%r4)
  12595. + 184 0098 1964 sub %r9, 1 ; shift(%r9) = shift(%r9) - 1
  12596. + 185
  12597. + 186 ;xsll %r6, %r11 ; shift man1
  12598. + 187 009a 982E ld.w %r8, %r9 ; temp(%r8) <- shift(%r9)
  12599. + 188 ; used in 32-bit variable shifting ; VARSHIFT %r6, %r9, sll
  12600. + 189 ; $1 = input register
  12601. + 190 ; $2 = shift amount
  12602. + 191 ; $3 = shift instruction
  12603. + 192 __L0001:
  12604. + 193 009c 8968 cmp %r9, 8 ; if temp <= 8 then goto $$2
  12605. + 194 009e 040E jrle __L0002
  12606. + 195
  12607. + 196 00a0 868C sll %r6, 8 ; shift input register 8 bits
  12608. + 197 00a2 FD1F jp.d __L0001
  12609. + 198 00a4 8964 sub %r9, 8 ; temp = temp - 8
  12610. + 199
  12611. + 200 __L0002:
  12612. + 201 00a6 968D sll %r6, %r9 ; last shift
  12613. + 202
  12614. + 203 00a8 1860 add %r8, 1 ; shift(%r8) = shift(%r8) + 1
  12615. + 204 00aa 0D1F jp.d divide
  12616. + 205 00ac 852E ld.w %r5, %r8 ; lshift(%r5) <- shift(%r8)
  12617. + 206
  12618. + 207 man2shift:
  12619. + 208 00ae 9426 sub %r4, %r9 ; shift(%r4) = count2(%r4) - count1(%r9)
  12620. + 209 00b0 1460 add %r4, 1 ; shift(%r4) = shift(%r4) + 1
  12621. + 210
  12622. + 211 ;xsll %r7, %r12 ; shift man2 to the left
  12623. + 212 00b2 482E ld.w %r8, %r4 ; temp(%r8) = shift(%r4)
  12624. + 213 ; used in 32-bit variable shifting ; VARSHIFT %r7, %r4, sll
  12625. + 214 ; $1 = input register
  12626. + 215 ; $2 = shift amount
  12627. + 216 ; $3 = shift instruction
  12628. + 217 __L0003:
  12629. + 218 00b4 8468 cmp %r4, 8 ; if temp <= 8 then goto $$2
  12630. + 219 00b6 040E jrle __L0004
  12631. + 220
  12632. + 221 00b8 878C sll %r7, 8 ; shift input register 8 bits
  12633. + 222 00ba FD1F jp.d __L0003
  12634. + 223 00bc 8464 sub %r4, 8 ; temp = temp - 8
  12635. + GAS LISTING divsf3.s page 5
  12636. +
  12637. +
  12638. + 224
  12639. + 225 __L0004:
  12640. + 226 00be 478D sll %r7, %r4 ; last shift
  12641. + 227
  12642. + 228 00c0 853E not %r5, %r8 ; lshift(%r5) = ~temp(%r8)
  12643. + 229 00c2 2560 add %r5, 2 ; lshift(%r5) = lshift(%r5) + 2
  12644. + 230
  12645. + 231 divide:
  12646. + 232 ; man1 has 8 leading 0's
  12647. + 233 ; man2 has 0 leading 0's
  12648. + 234 ; lshift used to normalize result
  12649. + 235
  12650. + 236 00c4 3126 sub %r1, %r3 ; ؿ(%r1) = ؿ(%r1) - ؿ(%r3) new sisu = sisu1 - sisu2 + bias +
  12651. + 237
  12652. + 238 00c6 01C0F163 xadd %r1, 0x7f ; ؿ(%r1) = ؿ(%r1) + 0x7f
  12653. + 239
  12654. + 240 00ca 2122 add %r1, %r2 ; ؿ(%r1) = ؿ(%r1) + flag(%r2)
  12655. + 241
  12656. + 242 00cc 03C0F16B xcmp %r1, 0xff ; if ؿ(%r1) >= 0xff then goto overflow
  12657. + 243 00d0 350A jrge overflow
  12658. + 244 00d2 916A xcmp %r1, -23 ; if ؿ(%r1) <= -23 then underflow
  12659. + 245 00d4 3D0F jrle.d end
  12660. + 246 00d6 046C ld.w %r4, 0 ; <- 0
  12661. + 247
  12662. + 248 00d8 42A0 ld.w %alr, %r4 ; extra 32-bits for accuracy
  12663. + 249 00da 708F div0u %r7
  12664. + 250 00dc 63A0 ld.w %ahr, %r6 ; dividend
  12665. + 251
  12666. + 252 ;;ifdef FAST
  12667. + 253 ; div1 %r7 ; 25 division instructions
  12668. + 254 ; div1 %r7
  12669. + 255 ; div1 %r7
  12670. + 256 ; div1 %r7
  12671. + 257 ; div1 %r7
  12672. + 258 ; div1 %r7
  12673. + 259 ; div1 %r7
  12674. + 260 ; div1 %r7
  12675. + 261 ; div1 %r7
  12676. + 262 ; div1 %r7
  12677. + 263 ; div1 %r7
  12678. + 264 ; div1 %r7
  12679. + 265 ; div1 %r7
  12680. + 266 ; div1 %r7
  12681. + 267 ; div1 %r7
  12682. + 268 ; div1 %r7
  12683. + 269 ; div1 %r7
  12684. + 270 ; div1 %r7
  12685. + 271 ; div1 %r7
  12686. + 272 ; div1 %r7
  12687. + 273 ; div1 %r7
  12688. + 274 ; div1 %r7
  12689. + 275 ; div1 %r7
  12690. + 276 ; div1 %r7
  12691. + 277 ; div1 %r7
  12692. + 278 ;
  12693. + 279 ;;else
  12694. + 280
  12695. + GAS LISTING divsf3.s page 6
  12696. +
  12697. +
  12698. + 281 00de 386C ld.w %r8, 3 ; loop counter(%r8) <- 3
  12699. + 282 00e0 7093 div1 %r7 ; first division step (25 in total)
  12700. + 283
  12701. + 284 divloop:
  12702. + 285 00e2 7093 div1 %r7 ; 8 division steps
  12703. + 286 00e4 7093 div1 %r7
  12704. + 287 00e6 7093 div1 %r7
  12705. + 288 00e8 7093 div1 %r7
  12706. + 289 00ea 7093 div1 %r7
  12707. + 290 00ec 7093 div1 %r7
  12708. + 291 00ee 7093 div1 %r7
  12709. + 292 00f0 7093 div1 %r7
  12710. + 293
  12711. + 294 00f2 1864 sub %r8, 1 ; loop counter(%r8) = loop counter(%r8) - 1
  12712. + 295 00f4 F71A jrne divloop ; exit when zero flag is set
  12713. + 296
  12714. + 297 ;;endif
  12715. + 298
  12716. + 299 00f6 24A4 ld.w %r4, %alr ; (%r4) <- (%alr)
  12717. + 300
  12718. + 301 ; normalize
  12719. + 302 ; %r0 = result sign, %r1 = result exponent
  12720. + 303 ; %r10 = lshift, %r4 = result
  12721. + 304
  12722. + 305 ;ld.w %r3, 7 ; count = 7
  12723. + 306 00f8 036C ld.w %r3, 0 ; count(%r3) <- 0
  12724. + 307 00fa 482E ld.w %r8, %r4
  12725. + 308 00fc 20C000C0 xand %r8, 0x1000000 ; check 24th bit
  12726. + 308 0870
  12727. + 309
  12728. + 310 0102 021A jrne continue2 ; if 24th bit = 1 then count = 7
  12729. + 311 0104 1360 add %r3, 1 ; else count(%r3) = count(%r3) + 1
  12730. + 312
  12731. + 313 continue2:
  12732. + 314 ;sub %r3, 7 ; count = count - 7
  12733. + 315 0106 3522 add %r5, %r3 ; lshift(%r5) = lshift(%r5) + count(%r3)
  12734. + 316 0108 512A cmp %r1, %r5
  12735. + 317 010a 1108 jrgt normal ; if ؿ(%r1) > lshift(%r5) then normal result
  12736. + 318
  12737. + 319 ; case: exp <= lshift
  12738. + 320 010c 1560 add %r5, 1
  12739. + 321 010e 3526 sub %r5, %r3 ; lshift(%r5) = lshift(%r5) + (8 - (count(%r3)+7) )
  12740. + 322 0110 1526 sub %r5, %r1
  12741. + 323 0112 1560 add %r5, 1 ; lshift(%r5) = lshift(%r5) - (ؿ(%r1) - 1)
  12742. + 324
  12743. + 325 0114 9569 cmp %r5, 25 ; if lshift(%r5) amount >= 25 then underflow
  12744. + 326 0116 030C jrlt notunder
  12745. + 327 0118 1B1F jp.d end
  12746. + 328 011a 046C ld.w %r4, 0 ; (%r4) <- 0
  12747. + 329
  12748. + 330 notunder:
  12749. + 331 ;xsrl %r4, %r10 ; %r4 >> lshift (shift amount)
  12750. + 332 ; used in 32-bit variable shifting ; VARSHIFT %r4, %r5, srl
  12751. + 333 ; $1 = input register
  12752. + 334 ; $2 = shift amount
  12753. + 335 ; $3 = shift instruction
  12754. + 336 __L0005:
  12755. + GAS LISTING divsf3.s page 7
  12756. +
  12757. +
  12758. + 337 011c 8568 cmp %r5, 8 ; if temp <= 8 then goto $$2
  12759. + 338 011e 040E jrle __L0006
  12760. + 339
  12761. + 340 0120 8488 srl %r4, 8 ; shift input register 8 bits
  12762. + 341 0122 FD1F jp.d __L0005
  12763. + 342 0124 8564 sub %r5, 8 ; temp = temp - 8
  12764. + 343
  12765. + 344 __L0006:
  12766. + 345 0126 5489 srl %r4, %r5 ; last shift
  12767. + 346 0128 0D1F jp.d finish
  12768. + 347 012a 016C ld.w %r1, 0 ; ؿ(%r1) <- 0 for denormal result
  12769. + 348
  12770. + 349 normal:
  12771. + 350 ; case: exp > lshift
  12772. + 351 012c 126C ld.w %r2, 1 ; shift(%r2) <- 1
  12773. + 352 012e 3226 sub %r2, %r3 ; shift(%r2) = shift(%r2) - count(%r3)
  12774. + 353
  12775. + 354 0130 2489 srl %r4, %r2 ; (%r4) >> shift(%r2) <-- [1 or 0]
  12776. + 355 0132 5126 sub %r1, %r5 ; ؿ(%r1) = ؿ(%r1) - lshift(%r5)
  12777. + 356
  12778. + 357 0134 03C0F16B xcmp %r1, 0xff ; if ؿ(%r1) < 0xff then jump to finish
  12779. + 358 0138 050C jrlt finish
  12780. + 359
  12781. + 360 overflow:
  12782. + 361 013a F0CF00C0 xld.w %r4, 0x7f800000 ; put infinity into result
  12783. + 361 046C
  12784. + 362 0140 071E jp end
  12785. + 363
  12786. + 364 finish:
  12787. + 365 ; %r0 = sign, %r1 = exponent, %r4 = mantissa
  12788. + 366 0142 0FC0FFDF xand %r4, 0x7fffff ; isolate mantissa
  12789. + 366 F473
  12790. + 367
  12791. + 368 0148 81981198 xrr %r1, 9 ; position exponent bits to [30:23]
  12792. + 369 014c 1436 or %r4, %r1
  12793. + 370
  12794. + 371 end:
  12795. + 372 014e 1098 rr %r0, 1 ; position sign bit to MSB
  12796. + 373 0150 0436 or %r4, %r0 ; (%r4) = (%r4) | ӥåȣ(%r0)t
  12797. + 374
  12798. + 375 ;@@@ 01/01/23 add start hinokuchi
  12799. + 376 ;ld.w %r13, [%sp+3] ; %r13
  12800. + 377 ;ld.w %r12, [%sp+2] ; %r12
  12801. + 378 ;ld.w %r11, [%sp+1] ; %r11
  12802. + 379 ;ld.w %r10, [%sp+0] ; %r10
  12803. + 380 ;add %sp, 4
  12804. + 381 ;@@@ 01/01/23 add end
  12805. + 382 0152 4302 popn %r3 ; restore register values
  12806. + 383
  12807. + 384 0154 4006 ret
  12808. diff --git a/gcc/config/c33/libgcc/divsf3.s b/gcc/config/c33/libgcc/divsf3.s
  12809. new file mode 100644
  12810. index 0000000..79f3add
  12811. --- /dev/null
  12812. +++ b/gcc/config/c33/libgcc/divsf3.s
  12813. @@ -0,0 +1,384 @@
  12814. +;*********************************************
  12815. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  12816. +;* ALL RIGHTS RESERVED
  12817. +;*
  12818. +;* filename : divsf3.s
  12819. +;*
  12820. +;* Single floating point division function
  12821. +;* input: %r6, %r7
  12822. +;* output: %r4
  12823. +;*
  12824. +;* Begin 1996/09/12 V. Chan
  12825. +;* ѹ 2001/01/18 O.Hinokuchi
  12826. +;* gasб 2001/10/15 watanabe
  12827. +;*
  12828. +;*****************************************
  12829. +
  12830. +.section .text
  12831. +.align 1
  12832. +.global __divsf3
  12833. +
  12834. +;==============================================
  12835. +;쥸
  12836. +; %r0:ӥåȣ(0(+) or 1(-))
  12837. +; %r1:ؿ(8bit)
  12838. +; %r2:ӥåȣ(0(+) or 1(-))/shift/flag
  12839. +; %r3:ؿ(8bit)/count
  12840. +; %r4:(float)
  12841. +; %r5:temp
  12842. +; %r6:()
  12843. +; %r7:()
  12844. +; %r8:mask
  12845. +; %r9:overflow value
  12846. +; %r10:implied bit/lshift
  12847. +; %r11:count1/shift
  12848. +; %r12:temp/count2
  12849. +; %r13:loop counter/temp/shift
  12850. +;==============================================
  12851. +
  12852. +
  12853. +;;macro VARSHIFT $1, $2, $3
  12854. + ; used in 32-bit variable shifting
  12855. + ; $1 = input register
  12856. + ; $2 = shift amount
  12857. + ; $3 = shift instruction
  12858. +;$$1:
  12859. +; cmp $2, 8 ; if temp <= 8 then goto $$2
  12860. +; jrle $$2
  12861. +
  12862. +; $3 $1, 8 ; shift input register 8 bits
  12863. +; jp.d $$1
  12864. +; sub $2, 8 ; temp = temp - 8
  12865. +
  12866. +;$$2:
  12867. +; $3 $1, $2 ; last shift
  12868. +;;endm
  12869. +
  12870. +__divsf3:
  12871. + pushn %r3 ; save register values
  12872. + ;@@@ 01/01/30 add start hinokuchi
  12873. + ;sub %sp, 4
  12874. + ;ld.w [%sp+0], %r10 ; %r10
  12875. + ;ld.w [%sp+1], %r11 ; %r11
  12876. + ;ld.w [%sp+2], %r12 ; %r12
  12877. + ;ld.w [%sp+3], %r13 ; %r13
  12878. + ;@@@ 01/01/30 add end
  12879. +
  12880. + ;@@@ 01/02/15 del xld.w %r9, 0xff ; set overflow comparison value
  12881. +
  12882. + ld.w %r0, %r6 ; ӥåȣ(%r0) <- (%r6)
  12883. + rl %r0, 1 ; ӥåȣ(%r0) rotate left 1 bit
  12884. + and %r0, 1 ; ӥåȣ(%r0) & 1
  12885. +
  12886. + ld.w %r2, %r7 ; ӥåȣ(%r2) <- (%r7)
  12887. + rl %r2, 1 ; ӥåȣ(%r2) rotate left 1 bit
  12888. + and %r2, 1 ; ӥåȣ(%r2) & 1
  12889. +
  12890. + xor %r0, %r2 ; ӥåȣ(%r0) = ~ӥåȣ(%r0)
  12891. + ld.w %r4, 0 ; (%r4) <- 0
  12892. +
  12893. + sll %r6, 1 ; (%r6) << 1 clear MSB
  12894. + srl %r6, 1 ; (%r6) >> 1
  12895. + cmp %r6, 0
  12896. + ext end@rm
  12897. + jreq end@rl ; if (%r6) = 0 then end
  12898. +
  12899. + cmp %r7, 0
  12900. + sll %r7, 1 ; (%r7) << 1 clear
  12901. + srl %r7, 1 ; (%r7) >> 1
  12902. + ext overflow@rm
  12903. + jreq overflow@rl ; if (%r7) = 0 then overflow
  12904. +
  12905. + ld.w %r1, %r6 ; ؿ(%r1) <- (%r6)
  12906. + xsrl %r1, 23 ; ؿ(%r1) >> 23
  12907. +
  12908. + ;@@@ 01/02/15 del cmp %r1, %r9 ; if ؿ(%r1) >= overflow value
  12909. + xcmp %r1, 0xff ; if ؿ(%r1) >= overflow value
  12910. + ext overflow@rm
  12911. + jrge overflow@rl ; result is overflow
  12912. +
  12913. + ld.w %r3, %r7 ; ؿ(%r3) <- (%r7)
  12914. + xsrl %r3, 23 ; ؿ(%r3) >> 23
  12915. +
  12916. + ;@@@ 01/02/15 del cmp %r3, %r9 ; if ؿ(%r3) >= overflow value
  12917. + xcmp %r3, 0xff ; if ؿ(%r3) >= overflow value
  12918. +
  12919. + ext end@rm
  12920. + jreq end@rl ; result is 0 (xxx/NaN = 0)
  12921. +
  12922. + ;@@@ 01/02/15 del xld.w %r8, 0x7fffff ; mask(%r8) <- 0x7fffff set mask for isolating mantissa
  12923. + ;@@@ 01/02/15 del xld.w %r10, 0x800000 ; implied bit(%r10)
  12924. + xld.w %r5, 0x7fffff ; mask(%r8) <- 0x7fffff @@@ 01/02/16 add
  12925. + ld.w %r2, 1 ; flag(%r2) = 1
  12926. + ;@@@ 01/02/15 del ld.w %r13, 0 ; loop counter(%r13) <- 0
  12927. + ld.w %r8, 0 ; loop counter(%r8) <- 0
  12928. +
  12929. + ; isolate mantissa1
  12930. + ;and %r6, %r8 ; line 62
  12931. + cmp %r1, 0 ;
  12932. + jreq.d count1 ; if ؿ(%r1) = 0 (denormal)
  12933. + ;@@@ 01/02/15 del and %r6, %r8 ; (%r6) = (%r6) & mask(%r8) clear first 9 bits of %r6
  12934. + and %r6, %r5 ; (%r6) = (%r6) & 0x7fffff clear first 9 bits of %r6
  12935. +
  12936. + ; case: normal input
  12937. + ;@@@ 01/02/15 del or %r6, %r10 ; (%r6) = (%r6) & implied bit(%r10) else add implied bit to mantissa
  12938. + xoor %r6, 0x800000 ; (%r6) = (%r6) & implied bit(0x800000) else add implied bit to mantissa
  12939. + ld.w %r2, 0 ; flag(%r2) <- 0
  12940. + jp.d getman2
  12941. + ;@@@ 01/02/15 del ld.w %r11, 8 ; count1(%r11) <- 8
  12942. + ld.w %r9, 8 ; count1(%r9) <- 8
  12943. +
  12944. +count1:
  12945. + ;@@@ 01/02/15 del ld.w %r12, %r6 ; temp(%r12) <- (%r6)
  12946. + ld.w %r4, %r6 ; temp(%r4) <- (%r6)
  12947. +
  12948. +loop1:
  12949. + ;@@@ 01/02/15 del scan1 %r11, %r12 ; %r11 = count1
  12950. + scan1 %r9, %r4 ; %r9 = count1
  12951. + jruge getman2 ; if count1 !=8 then goto getman2
  12952. + ;@@@ 01/02/15 del add %r13, 8 ; loop counter(%r13) = loop counter(%r13) + 8
  12953. + add %r8, 8 ; loop counter(%r8) = loop counter(%r8) + 8
  12954. + jp.d loop1
  12955. + ;@@@ 01/02/15 del sll %r12, 8 ; temp(%r12) << 8 shift register to the left 8 bits
  12956. + sll %r4, 8 ; temp(%r4) << 8 shift register to the left 8 bits
  12957. +
  12958. +getman2:
  12959. + ;@@@ 01/02/15 del add %r11, %r13 ; count1(%r11) = count1(%r11) + loop counter(%r13)
  12960. + add %r9, %r8 ; count1(%r9) = count1(%r8) + loop counter(%r13)
  12961. + ;@@@ 01/02/15 del ld.w %r13, 0 ; loop counter(%r13) = 0
  12962. + ld.w %r8, 0 ; loop counter(%r8) = 0
  12963. +
  12964. + ; isolate mantissa2
  12965. + ;and %r7, %r8 ; line 85
  12966. + cmp %r3, 0
  12967. + jreq.d count2 ; if ؿ(%r3) = 0 then jump to count2
  12968. + ;@@@ 01/02/15 del and %r7, %r8 ; (%r7) = (%r7) & mask(%r8) clear first 9 bits of %r7
  12969. + and %r7, %r5 ; (%r7) = (%r7) & mask(0x7fffff) clear first 9 bits of %r7
  12970. + ;@@@ 01/02/15 del or %r7, %r10 ; (%r7) = (%r7) | implied bit(%r10) else add implied bit
  12971. + xoor %r7, 0x800000 ; (%r7) = (%r7) | implied bit(0x800000) else add implied bit
  12972. + jp.d cmpcount
  12973. + ;@@@ 01/02/15 del ld.w %r12, 8 ; count2(%r12) <- 8
  12974. + ld.w %r4, 8 ; count2(%r12) <- 8
  12975. +
  12976. +count2:
  12977. + ld.w %r5, %r7 ; temp(%r5) <- (%r7) man2
  12978. + sub %r2, 1 ; flag(%r2) = flag(%r2) - 1 (0 or -1)
  12979. +
  12980. +loop2:
  12981. + ;@@@ 01/02/15 del scan1 %r12, %r5 ; %r12 = count2
  12982. + scan1 %r4, %r5 ; %r4 = count2
  12983. +
  12984. + jruge cmpcount ; if count2 !=8 then goto cmpcount
  12985. + add %r8, 8 ; loop counter(%r8) = loop counter(%r8) + 8
  12986. + jp.d loop2
  12987. + sll %r5, 8 ; temp(%r5) << 8 shift register to the left 8 bits
  12988. +
  12989. +cmpcount:
  12990. + add %r4, %r8 ; count2(%r4) = count2(%r4) + loop counter(%r8)
  12991. +
  12992. + cmp %r9, %r4 ; if count1(%r9) <= count2(%r4) then goto man2 shift
  12993. + jrle man2shift
  12994. +
  12995. + ; case: count1 > count2
  12996. + sub %r9, %r4 ; shift(%r9) = count1(%r9) - count2(%r4)
  12997. + sub %r9, 1 ; shift(%r9) = shift(%r9) - 1
  12998. +
  12999. + ;xsll %r6, %r11 ; shift man1
  13000. + ld.w %r8, %r9 ; temp(%r8) <- shift(%r9)
  13001. + ; used in 32-bit variable shifting ; VARSHIFT %r6, %r9, sll
  13002. + ; $1 = input register
  13003. + ; $2 = shift amount
  13004. + ; $3 = shift instruction
  13005. +__L0001:
  13006. + cmp %r9, 8 ; if temp <= 8 then goto $$2
  13007. + jrle __L0002
  13008. +
  13009. + sll %r6, 8 ; shift input register 8 bits
  13010. + jp.d __L0001
  13011. + sub %r9, 8 ; temp = temp - 8
  13012. +
  13013. +__L0002:
  13014. + sll %r6, %r9 ; last shift
  13015. +
  13016. + add %r8, 1 ; shift(%r8) = shift(%r8) + 1
  13017. + jp.d divide
  13018. + ld.w %r5, %r8 ; lshift(%r5) <- shift(%r8)
  13019. +
  13020. +man2shift:
  13021. + sub %r4, %r9 ; shift(%r4) = count2(%r4) - count1(%r9)
  13022. + add %r4, 1 ; shift(%r4) = shift(%r4) + 1
  13023. +
  13024. + ;xsll %r7, %r12 ; shift man2 to the left
  13025. + ld.w %r8, %r4 ; temp(%r8) = shift(%r4)
  13026. + ; used in 32-bit variable shifting ; VARSHIFT %r7, %r4, sll
  13027. + ; $1 = input register
  13028. + ; $2 = shift amount
  13029. + ; $3 = shift instruction
  13030. +__L0003:
  13031. + cmp %r4, 8 ; if temp <= 8 then goto $$2
  13032. + jrle __L0004
  13033. +
  13034. + sll %r7, 8 ; shift input register 8 bits
  13035. + jp.d __L0003
  13036. + sub %r4, 8 ; temp = temp - 8
  13037. +
  13038. +__L0004:
  13039. + sll %r7, %r4 ; last shift
  13040. +
  13041. + not %r5, %r8 ; lshift(%r5) = ~temp(%r8)
  13042. + add %r5, 2 ; lshift(%r5) = lshift(%r5) + 2
  13043. +
  13044. +divide:
  13045. + ; man1 has 8 leading 0's
  13046. + ; man2 has 0 leading 0's
  13047. + ; lshift used to normalize result
  13048. +
  13049. + sub %r1, %r3 ; ؿ(%r1) = ؿ(%r1) - ؿ(%r3) new sisu = sisu1 - sisu2 + bias + flag (0,1,-1)
  13050. +
  13051. + xadd %r1, 0x7f ; ؿ(%r1) = ؿ(%r1) + 0x7f
  13052. +
  13053. + add %r1, %r2 ; ؿ(%r1) = ؿ(%r1) + flag(%r2)
  13054. +
  13055. + xcmp %r1, 0xff ; if ؿ(%r1) >= 0xff then goto overflow
  13056. + jrge overflow
  13057. + xcmp %r1, -23 ; if ؿ(%r1) <= -23 then underflow
  13058. + jrle.d end
  13059. + ld.w %r4, 0 ; <- 0
  13060. +
  13061. + ld.w %alr, %r4 ; extra 32-bits for accuracy
  13062. + div0u %r7
  13063. + ld.w %ahr, %r6 ; dividend
  13064. +
  13065. +;;ifdef FAST
  13066. +; div1 %r7 ; 25 division instructions
  13067. +; div1 %r7
  13068. +; div1 %r7
  13069. +; div1 %r7
  13070. +; div1 %r7
  13071. +; div1 %r7
  13072. +; div1 %r7
  13073. +; div1 %r7
  13074. +; div1 %r7
  13075. +; div1 %r7
  13076. +; div1 %r7
  13077. +; div1 %r7
  13078. +; div1 %r7
  13079. +; div1 %r7
  13080. +; div1 %r7
  13081. +; div1 %r7
  13082. +; div1 %r7
  13083. +; div1 %r7
  13084. +; div1 %r7
  13085. +; div1 %r7
  13086. +; div1 %r7
  13087. +; div1 %r7
  13088. +; div1 %r7
  13089. +; div1 %r7
  13090. +; div1 %r7
  13091. +;
  13092. +;;else
  13093. +
  13094. + ld.w %r8, 3 ; loop counter(%r8) <- 3
  13095. + div1 %r7 ; first division step (25 in total)
  13096. +
  13097. +divloop:
  13098. + div1 %r7 ; 8 division steps
  13099. + div1 %r7
  13100. + div1 %r7
  13101. + div1 %r7
  13102. + div1 %r7
  13103. + div1 %r7
  13104. + div1 %r7
  13105. + div1 %r7
  13106. +
  13107. + sub %r8, 1 ; loop counter(%r8) = loop counter(%r8) - 1
  13108. + jrne divloop ; exit when zero flag is set
  13109. +
  13110. +;;endif
  13111. +
  13112. + ld.w %r4, %alr ; (%r4) <- (%alr)
  13113. +
  13114. + ; normalize
  13115. + ; %r0 = result sign, %r1 = result exponent
  13116. + ; %r10 = lshift, %r4 = result
  13117. +
  13118. + ;ld.w %r3, 7 ; count = 7
  13119. + ld.w %r3, 0 ; count(%r3) <- 0
  13120. + ld.w %r8, %r4
  13121. + xand %r8, 0x1000000 ; check 24th bit
  13122. +
  13123. + jrne continue2 ; if 24th bit = 1 then count = 7
  13124. + add %r3, 1 ; else count(%r3) = count(%r3) + 1
  13125. +
  13126. +continue2:
  13127. + ;sub %r3, 7 ; count = count - 7
  13128. + add %r5, %r3 ; lshift(%r5) = lshift(%r5) + count(%r3)
  13129. + cmp %r1, %r5
  13130. + jrgt normal ; if ؿ(%r1) > lshift(%r5) then normal result
  13131. +
  13132. + ; case: exp <= lshift
  13133. + add %r5, 1
  13134. + sub %r5, %r3 ; lshift(%r5) = lshift(%r5) + (8 - (count(%r3)+7) )
  13135. + sub %r5, %r1
  13136. + add %r5, 1 ; lshift(%r5) = lshift(%r5) - (ؿ(%r1) - 1)
  13137. +
  13138. + cmp %r5, 25 ; if lshift(%r5) amount >= 25 then underflow
  13139. + jrlt notunder
  13140. + jp.d end
  13141. + ld.w %r4, 0 ; (%r4) <- 0
  13142. +
  13143. +notunder:
  13144. + ;xsrl %r4, %r10 ; %r4 >> lshift (shift amount)
  13145. + ; used in 32-bit variable shifting ; VARSHIFT %r4, %r5, srl
  13146. + ; $1 = input register
  13147. + ; $2 = shift amount
  13148. + ; $3 = shift instruction
  13149. +__L0005:
  13150. + cmp %r5, 8 ; if temp <= 8 then goto $$2
  13151. + jrle __L0006
  13152. +
  13153. + srl %r4, 8 ; shift input register 8 bits
  13154. + jp.d __L0005
  13155. + sub %r5, 8 ; temp = temp - 8
  13156. +
  13157. +__L0006:
  13158. + srl %r4, %r5 ; last shift
  13159. + jp.d finish
  13160. + ld.w %r1, 0 ; ؿ(%r1) <- 0 for denormal result
  13161. +
  13162. +normal:
  13163. + ; case: exp > lshift
  13164. + ld.w %r2, 1 ; shift(%r2) <- 1
  13165. + sub %r2, %r3 ; shift(%r2) = shift(%r2) - count(%r3)
  13166. +
  13167. + srl %r4, %r2 ; (%r4) >> shift(%r2) <-- [1 or 0]
  13168. + sub %r1, %r5 ; ؿ(%r1) = ؿ(%r1) - lshift(%r5)
  13169. +
  13170. + xcmp %r1, 0xff ; if ؿ(%r1) < 0xff then jump to finish
  13171. + jrlt finish
  13172. +
  13173. +overflow:
  13174. + xld.w %r4, 0x7f800000 ; put infinity into result
  13175. + jp end
  13176. +
  13177. +finish:
  13178. + ; %r0 = sign, %r1 = exponent, %r4 = mantissa
  13179. + xand %r4, 0x7fffff ; isolate mantissa
  13180. +
  13181. + xrr %r1, 9 ; position exponent bits to [30:23]
  13182. + or %r4, %r1
  13183. +
  13184. +end:
  13185. + rr %r0, 1 ; position sign bit to MSB
  13186. + or %r4, %r0 ; (%r4) = (%r4) | ӥåȣ(%r0)t
  13187. +
  13188. + ;@@@ 01/01/23 add start hinokuchi
  13189. + ;ld.w %r13, [%sp+3] ; %r13
  13190. + ;ld.w %r12, [%sp+2] ; %r12
  13191. + ;ld.w %r11, [%sp+1] ; %r11
  13192. + ;ld.w %r10, [%sp+0] ; %r10
  13193. + ;add %sp, 4
  13194. + ;@@@ 01/01/23 add end
  13195. + popn %r3 ; restore register values
  13196. +
  13197. + ret
  13198. diff --git a/gcc/config/c33/libgcc/divsi3.lst b/gcc/config/c33/libgcc/divsi3.lst
  13199. new file mode 100644
  13200. index 0000000..66501e7
  13201. --- /dev/null
  13202. +++ b/gcc/config/c33/libgcc/divsi3.lst
  13203. @@ -0,0 +1,150 @@
  13204. +GAS LISTING divsi3.s page 1
  13205. +
  13206. +
  13207. + 1 ;
  13208. + 2 ; Copyright (C) SEIKO EPSON CORP. 1996
  13209. + 3 ;
  13210. + 4 ; Filename : divsi3.c
  13211. + 5 ; Function :
  13212. + 6 ; This module defines the functions
  13213. + 7 ; that emulate signed and unsigned integer division.
  13214. + 8 ; Revision :
  13215. + 9 ; 10/18/1996 ESD T.Katahira start */
  13216. + 10 ;
  13217. + 11 ;
  13218. + 12 ; Function : __divsi3
  13219. + 13 ; Input : %r6 --- dividend
  13220. + 14 ; %r7 --- divisor
  13221. + 15 ; Output : %r4 --- quotient
  13222. + 16 ; Function : calculate signed integer division
  13223. + 17
  13224. + 18
  13225. + 19 .section .text
  13226. + 20 .align 1
  13227. + 21 .global __divsi3
  13228. + 22 __divsi3:
  13229. + 23 0000 62A0 ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  13230. + 24 0002 708B div0s %r7 ; initializer of signed division
  13231. + 25 ;ifdef FAST
  13232. + 26 ; div1 %r7 ; execute division ;1
  13233. + 27 ; div1 %r7 ; execute division ;2
  13234. + 28 ; div1 %r7 ; execute division ;3
  13235. + 29 ; div1 %r7 ; execute division ;4
  13236. + 30 ; div1 %r7 ; execute division ;5
  13237. + 31 ; div1 %r7 ; execute division ;6
  13238. + 32 ; div1 %r7 ; execute division ;7
  13239. + 33 ; div1 %r7 ; execute division ;8
  13240. + 34 ; div1 %r7 ; execute division ;9
  13241. + 35 ; div1 %r7 ; execute division ;10
  13242. + 36 ; div1 %r7 ; execute division ;11
  13243. + 37 ; div1 %r7 ; execute division ;12
  13244. + 38 ; div1 %r7 ; execute division ;13
  13245. + 39 ; div1 %r7 ; execute division ;14
  13246. + 40 ; div1 %r7 ; execute division ;15
  13247. + 41 ; div1 %r7 ; execute division ;16
  13248. + 42 ; div1 %r7 ; execute division ;17
  13249. + 43 ; div1 %r7 ; execute division ;18
  13250. + 44 ; div1 %r7 ; execute division ;19
  13251. + 45 ; div1 %r7 ; execute division ;20
  13252. + 46 ; div1 %r7 ; execute division ;21
  13253. + 47 ; div1 %r7 ; execute division ;22
  13254. + 48 ; div1 %r7 ; execute division ;23
  13255. + 49 ; div1 %r7 ; execute division ;24
  13256. + 50 ; div1 %r7 ; execute division ;25
  13257. + 51 ; div1 %r7 ; execute division ;26
  13258. + 52 ; div1 %r7 ; execute division ;27
  13259. + 53 ; div1 %r7 ; execute division ;28
  13260. + 54 ; div1 %r7 ; execute division ;29
  13261. + 55 ; div1 %r7 ; execute division ;30
  13262. + 56 ; div1 %r7 ; execute division ;31
  13263. + 57 ; div1 %r7 ; execute division ;32
  13264. + GAS LISTING divsi3.s page 2
  13265. +
  13266. +
  13267. + 58 ;else
  13268. + 59 0004 486C ld.w %r8,0x4 ; set loop counter (N = 4)
  13269. + 60 0006 09A4 ld.w %r9,%psr ; save flag register
  13270. + 61 __divsi3_loop_start:
  13271. + 62 0008 7093 div1 %r7 ; execute division ;1
  13272. + 63 000a 7093 div1 %r7 ; execute division ;2
  13273. + 64 000c 7093 div1 %r7 ; execute division ;3
  13274. + 65 000e 7093 div1 %r7 ; execute division ;4
  13275. + 66 0010 7093 div1 %r7 ; execute division ;5
  13276. + 67 0012 7093 div1 %r7 ; execute division ;6
  13277. + 68 0014 7093 div1 %r7 ; execute division ;7
  13278. + 69 0016 7093 div1 %r7 ; execute division ;8
  13279. + 70 0018 1864 sub %r8,0x1 ; decrement loop counter
  13280. + 71 001a F71B jrne.d __divsi3_loop_start ; if (loop counter != 0) goto loop top
  13281. + 72 001c 90A0 ld.w %psr,%r9 ; restore flag register (delayed slot)
  13282. + 73 ;endif
  13283. + 74 001e 7097 div2s %r7 ; post divistion process ;1
  13284. + 75 0020 009B div3s ; post divistion process ;2
  13285. + 76 0022 4007 ret.d ; return to the caller (use delayed return)
  13286. + 77 0024 24A4 ld.w %r4,%alr ; set quotient to return reg (delayed slot)
  13287. + 78
  13288. + 79
  13289. + 80 ; Function : __udivsi3
  13290. + 81 ; Input : %r6 --- dividend
  13291. + 82 ; %r7 --- divisor
  13292. + 83 ; Output : %r4 --- quotient
  13293. + 84 ; Function : calculate unsigned integer division
  13294. + 85
  13295. + 86 .section .text
  13296. + 87 .align 1
  13297. + 88 .global __udivsi3
  13298. + 89 __udivsi3:
  13299. + 90 0026 62A0 ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  13300. + 91 0028 708F div0u %r7 ; initializer of signed division
  13301. + 92 ;ifdef FAST
  13302. + 93 ; div1 %r7 ; execute division ;1
  13303. + 94 ; div1 %r7 ; execute division ;2
  13304. + 95 ; div1 %r7 ; execute division ;3
  13305. + 96 ; div1 %r7 ; execute division ;4
  13306. + 97 ; div1 %r7 ; execute division ;5
  13307. + 98 ; div1 %r7 ; execute division ;6
  13308. + 99 ; div1 %r7 ; execute division ;7
  13309. + 100 ; div1 %r7 ; execute division ;8
  13310. + 101 ; div1 %r7 ; execute division ;9
  13311. + 102 ; div1 %r7 ; execute division ;10
  13312. + 103 ; div1 %r7 ; execute division ;11
  13313. + 104 ; div1 %r7 ; execute division ;12
  13314. + 105 ; div1 %r7 ; execute division ;13
  13315. + 106 ; div1 %r7 ; execute division ;14
  13316. + 107 ; div1 %r7 ; execute division ;15
  13317. + 108 ; div1 %r7 ; execute division ;16
  13318. + 109 ; div1 %r7 ; execute division ;17
  13319. + 110 ; div1 %r7 ; execute division ;18
  13320. + 111 ; div1 %r7 ; execute division ;19
  13321. + 112 ; div1 %r7 ; execute division ;20
  13322. + 113 ; div1 %r7 ; execute division ;21
  13323. + 114 ; div1 %r7 ; execute division ;22
  13324. + GAS LISTING divsi3.s page 3
  13325. +
  13326. +
  13327. + 115 ; div1 %r7 ; execute division ;23
  13328. + 116 ; div1 %r7 ; execute division ;24
  13329. + 117 ; div1 %r7 ; execute division ;25
  13330. + 118 ; div1 %r7 ; execute division ;26
  13331. + 119 ; div1 %r7 ; execute division ;27
  13332. + 120 ; div1 %r7 ; execute division ;28
  13333. + 121 ; div1 %r7 ; execute division ;29
  13334. + 122 ; div1 %r7 ; execute division ;30
  13335. + 123 ; div1 %r7 ; execute division ;31
  13336. + 124 ; div1 %r7 ; execute division ;32
  13337. + 125 ;else
  13338. + 126 002a 486C ld.w %r8,0x4 ; set loop counter (N = 4)
  13339. + 127 __udivsi3_loop_start:
  13340. + 128 002c 7093 div1 %r7 ; execute division ;1
  13341. + 129 002e 7093 div1 %r7 ; execute division ;2
  13342. + 130 0030 7093 div1 %r7 ; execute division ;3
  13343. + 131 0032 7093 div1 %r7 ; execute division ;4
  13344. + 132 0034 7093 div1 %r7 ; execute division ;5
  13345. + 133 0036 7093 div1 %r7 ; execute division ;6
  13346. + 134 0038 7093 div1 %r7 ; execute division ;7
  13347. + 135 003a 7093 div1 %r7 ; execute division ;8
  13348. + 136 003c 1864 sub %r8,0x1 ; decrement loop counter
  13349. + 137 003e F71A jrne __udivsi3_loop_start ; if (loop counter != 0) goto loop top
  13350. + 138 ;endif
  13351. + 139 0040 4007 ret.d ; return to the caller (use delayed return)
  13352. + 140 0042 24A4 ld.w %r4,%alr ; set quotient to return reg (delayed slot)
  13353. + 141
  13354. diff --git a/gcc/config/c33/libgcc/divsi3.s b/gcc/config/c33/libgcc/divsi3.s
  13355. new file mode 100644
  13356. index 0000000..f8c44bf
  13357. --- /dev/null
  13358. +++ b/gcc/config/c33/libgcc/divsi3.s
  13359. @@ -0,0 +1,141 @@
  13360. +;
  13361. +; Copyright (C) SEIKO EPSON CORP. 1996
  13362. +;
  13363. +; Filename : divsi3.c
  13364. +; Function :
  13365. +; This module defines the functions
  13366. +; that emulate signed and unsigned integer division.
  13367. +; Revision :
  13368. +; 10/18/1996 ESD T.Katahira start */
  13369. +;
  13370. +;
  13371. +; Function : __divsi3
  13372. +; Input : %r6 --- dividend
  13373. +; %r7 --- divisor
  13374. +; Output : %r4 --- quotient
  13375. +; Function : calculate signed integer division
  13376. +
  13377. +
  13378. + .section .text
  13379. + .align 1
  13380. + .global __divsi3
  13381. +__divsi3:
  13382. + ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  13383. + div0s %r7 ; initializer of signed division
  13384. +;ifdef FAST
  13385. +; div1 %r7 ; execute division ;1
  13386. +; div1 %r7 ; execute division ;2
  13387. +; div1 %r7 ; execute division ;3
  13388. +; div1 %r7 ; execute division ;4
  13389. +; div1 %r7 ; execute division ;5
  13390. +; div1 %r7 ; execute division ;6
  13391. +; div1 %r7 ; execute division ;7
  13392. +; div1 %r7 ; execute division ;8
  13393. +; div1 %r7 ; execute division ;9
  13394. +; div1 %r7 ; execute division ;10
  13395. +; div1 %r7 ; execute division ;11
  13396. +; div1 %r7 ; execute division ;12
  13397. +; div1 %r7 ; execute division ;13
  13398. +; div1 %r7 ; execute division ;14
  13399. +; div1 %r7 ; execute division ;15
  13400. +; div1 %r7 ; execute division ;16
  13401. +; div1 %r7 ; execute division ;17
  13402. +; div1 %r7 ; execute division ;18
  13403. +; div1 %r7 ; execute division ;19
  13404. +; div1 %r7 ; execute division ;20
  13405. +; div1 %r7 ; execute division ;21
  13406. +; div1 %r7 ; execute division ;22
  13407. +; div1 %r7 ; execute division ;23
  13408. +; div1 %r7 ; execute division ;24
  13409. +; div1 %r7 ; execute division ;25
  13410. +; div1 %r7 ; execute division ;26
  13411. +; div1 %r7 ; execute division ;27
  13412. +; div1 %r7 ; execute division ;28
  13413. +; div1 %r7 ; execute division ;29
  13414. +; div1 %r7 ; execute division ;30
  13415. +; div1 %r7 ; execute division ;31
  13416. +; div1 %r7 ; execute division ;32
  13417. +;else
  13418. + ld.w %r8,0x4 ; set loop counter (N = 4)
  13419. + ld.w %r9,%psr ; save flag register
  13420. +__divsi3_loop_start:
  13421. + div1 %r7 ; execute division ;1
  13422. + div1 %r7 ; execute division ;2
  13423. + div1 %r7 ; execute division ;3
  13424. + div1 %r7 ; execute division ;4
  13425. + div1 %r7 ; execute division ;5
  13426. + div1 %r7 ; execute division ;6
  13427. + div1 %r7 ; execute division ;7
  13428. + div1 %r7 ; execute division ;8
  13429. + sub %r8,0x1 ; decrement loop counter
  13430. + jrne.d __divsi3_loop_start ; if (loop counter != 0) goto loop top
  13431. + ld.w %psr,%r9 ; restore flag register (delayed slot)
  13432. +;endif
  13433. + div2s %r7 ; post divistion process ;1
  13434. + div3s ; post divistion process ;2
  13435. + ret.d ; return to the caller (use delayed return)
  13436. + ld.w %r4,%alr ; set quotient to return reg (delayed slot)
  13437. +
  13438. +
  13439. +; Function : __udivsi3
  13440. +; Input : %r6 --- dividend
  13441. +; %r7 --- divisor
  13442. +; Output : %r4 --- quotient
  13443. +; Function : calculate unsigned integer division
  13444. +
  13445. + .section .text
  13446. + .align 1
  13447. + .global __udivsi3
  13448. +__udivsi3:
  13449. + ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  13450. + div0u %r7 ; initializer of signed division
  13451. +;ifdef FAST
  13452. +; div1 %r7 ; execute division ;1
  13453. +; div1 %r7 ; execute division ;2
  13454. +; div1 %r7 ; execute division ;3
  13455. +; div1 %r7 ; execute division ;4
  13456. +; div1 %r7 ; execute division ;5
  13457. +; div1 %r7 ; execute division ;6
  13458. +; div1 %r7 ; execute division ;7
  13459. +; div1 %r7 ; execute division ;8
  13460. +; div1 %r7 ; execute division ;9
  13461. +; div1 %r7 ; execute division ;10
  13462. +; div1 %r7 ; execute division ;11
  13463. +; div1 %r7 ; execute division ;12
  13464. +; div1 %r7 ; execute division ;13
  13465. +; div1 %r7 ; execute division ;14
  13466. +; div1 %r7 ; execute division ;15
  13467. +; div1 %r7 ; execute division ;16
  13468. +; div1 %r7 ; execute division ;17
  13469. +; div1 %r7 ; execute division ;18
  13470. +; div1 %r7 ; execute division ;19
  13471. +; div1 %r7 ; execute division ;20
  13472. +; div1 %r7 ; execute division ;21
  13473. +; div1 %r7 ; execute division ;22
  13474. +; div1 %r7 ; execute division ;23
  13475. +; div1 %r7 ; execute division ;24
  13476. +; div1 %r7 ; execute division ;25
  13477. +; div1 %r7 ; execute division ;26
  13478. +; div1 %r7 ; execute division ;27
  13479. +; div1 %r7 ; execute division ;28
  13480. +; div1 %r7 ; execute division ;29
  13481. +; div1 %r7 ; execute division ;30
  13482. +; div1 %r7 ; execute division ;31
  13483. +; div1 %r7 ; execute division ;32
  13484. +;else
  13485. + ld.w %r8,0x4 ; set loop counter (N = 4)
  13486. +__udivsi3_loop_start:
  13487. + div1 %r7 ; execute division ;1
  13488. + div1 %r7 ; execute division ;2
  13489. + div1 %r7 ; execute division ;3
  13490. + div1 %r7 ; execute division ;4
  13491. + div1 %r7 ; execute division ;5
  13492. + div1 %r7 ; execute division ;6
  13493. + div1 %r7 ; execute division ;7
  13494. + div1 %r7 ; execute division ;8
  13495. + sub %r8,0x1 ; decrement loop counter
  13496. + jrne __udivsi3_loop_start ; if (loop counter != 0) goto loop top
  13497. +;endif
  13498. + ret.d ; return to the caller (use delayed return)
  13499. + ld.w %r4,%alr ; set quotient to return reg (delayed slot)
  13500. +
  13501. diff --git a/gcc/config/c33/libgcc/extsfdf.lst b/gcc/config/c33/libgcc/extsfdf.lst
  13502. new file mode 100644
  13503. index 0000000..0bd5395
  13504. --- /dev/null
  13505. +++ b/gcc/config/c33/libgcc/extsfdf.lst
  13506. @@ -0,0 +1,174 @@
  13507. +GAS LISTING extsfdf.s page 1
  13508. +
  13509. +
  13510. + 1 ;*********************************************
  13511. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  13512. + 3 ;* ALL RIGHTS RESERVED
  13513. + 4 ;*
  13514. + 5 ;* filename : extsfdf.s
  13515. + 6 ;*
  13516. + 7 ;* Change type: Single float --> Double float
  13517. + 8 ;* input: %r6
  13518. + 9 ;* output: (%r5, %r4)
  13519. + 10 ;*
  13520. + 11 ;* Begin 1996/09/12 V. Chan
  13521. + 12 ;* Fixed bug with variable shift (ln. 108)
  13522. + 13 ;* 1997/02/18 V. Chan
  13523. + 14 ;* ѹ 2001/01/17 O.Hinokuchi
  13524. + 15 ;* gasб 2001/10/15 watanabe
  13525. + 16 ;*
  13526. + 17 ;*****************************************
  13527. + 18
  13528. + 19 .section .text
  13529. + 20 .align 1
  13530. + 21 .global __extendsfdf2
  13531. + 22
  13532. + 23 __extendsfdf2:
  13533. + 24
  13534. + 25 0000 0302 pushn %r3 ; save register values
  13535. + 26
  13536. + 27 0002 602E ld.w %r0, %r6 ; put sign of input (%r6) into %r0
  13537. + 28 0004 109C rl %r0, 1
  13538. + 29 0006 1070 and %r0, 1
  13539. + 30
  13540. + 31 0008 056C ld.w %r5, 0 ; clear output registers
  13541. + 32 000a 168C sll %r6, 1 ; remove MSB
  13542. + 33 000c 1688 srl %r6, 1
  13543. + 34
  13544. + 35 000e 0668 cmp %r6, 0 ; if input = 0 then exit
  13545. + 36 0010 4F19 jreq.d end
  13546. + 37 0012 046C ld.w %r4, 0
  13547. + 38
  13548. + 39 0014 612E ld.w %r1, %r6 ; put exponent into %r1
  13549. + 40 0016 118C sll %r1, 1
  13550. + 41 0018 81888188 xsrl %r1, 24
  13551. + 41 8188
  13552. + 42
  13553. + 43 001e 03C0F16B xcmp %r1, 0xff ; if NaN or Inf input then return Inf
  13554. + 44 0022 FECF00C0 xld.w %r5, 0x7ff00000
  13555. + 44 056C
  13556. + 45 0028 430B jrge.d end
  13557. + 46 002a 046C ld.w %r4, 0
  13558. + 47
  13559. + 48
  13560. + 49 ; isolate mantissa
  13561. + 50 002c 0FC0FFDF xand %r6,0x7fffff ; clear first 9 bits of %r6
  13562. + 50 F673
  13563. + 51
  13564. + 52 0032 0168 cmp %r1, 0
  13565. + 53 0034 2C1B jrne.d expnez ; if exp != 0 then goto expnez
  13566. + 54 0036 652E ld.w %r5, %r6 ; result1 = input
  13567. + GAS LISTING extsfdf.s page 2
  13568. +
  13569. +
  13570. + 55
  13571. + 56 ; case: exp = 0
  13572. + 57 0038 592E ld.w %r9, %r5 ; copy new result to %r9 for counting
  13573. + 58 003a 086C ld.w %r8, 0 ; initialize loop counter
  13574. + 59
  13575. + 60 count:
  13576. + 61 003c 978E scan1 %r7, %r9 ; count = ; of 0's before leading 1 in result
  13577. + 62 003e 0412 jruge continue ; if count !=8 then goto continue
  13578. + 63 0040 8860 add %r8, 8 ; add 8 to loop counter
  13579. + 64 0042 FD1F jp.d count
  13580. + 65 0044 898C sll %r9, 8 ; shift 8 leading 0's out of %r9
  13581. + 66
  13582. + 67 continue:
  13583. + 68 0046 8722 add %r7, %r8 ; count = count + loop counter
  13584. + 69 0048 0EC0016C xld.w %r1, 0x380 ; exp = 0x380
  13585. + 70 004c 7126 sub %r1, %r7 ; exp = exp - count
  13586. + 71 ;add %r1, 9 ; moved to line 55
  13587. + 72
  13588. + 73 004e B768 cmp %r7, 11
  13589. + 74 0050 140B jrge.d shftleft ; if count >= 11 then goto shftleft
  13590. + 75 0052 9160 add %r1, 9 ; exp = exp + 9
  13591. + 76
  13592. + 77 ; case: count < 11
  13593. + 78 0054 B26C ld.w %r2, 11
  13594. + 79 0056 7226 sub %r2, %r7 ; %r2 = shift = 11 - count
  13595. + 80
  13596. + 81 ; {result1, result2} >> 11 - count
  13597. + 82 ;xsrl %r4_p, %r2 ; shift low 32-bits to the right 11-count bits
  13598. + 83 ;xrr %r5_p, %r2 ; rotate high 32-bits to the right 11-count bits
  13599. + 84 ;xsrl %r3, %r2 ; make a mask for last 20-count bits --> %r3 = 000...111
  13600. + 85
  13601. + 86 0058 F36F ld.w %r3, -1 ; %r3 = 0xffff ffff
  13602. + 87 ; 64-bit variable shift and rotate routine
  13603. + 88 L1:
  13604. + 89 005a 8268 cmp %r2, 8 ; if shift amount <= 8 then goto L2
  13605. + 90 005c 060E jrle L2
  13606. + 91
  13607. + 92 005e 8488 srl %r4, 8 ; result1 >> 8
  13608. + 93 0060 8598 rr %r5, 8 ; result2 rotate >> 8
  13609. + 94 0062 8388 srl %r3, 8 ; mask >> 8
  13610. + 95 0064 FB1F jp.d L1
  13611. + 96 0066 8264 sub %r2, 8 ; shift amount -= 8
  13612. + 97
  13613. + 98 L2:
  13614. + 99 0068 2489 srl %r4, %r2 ; result1 >> %r2
  13615. + 100 006a 2599 rr %r5, %r2 ; result2 rotate >> %r2
  13616. + 101 006c 2389 srl %r3, %r2 ; mask >> %r2
  13617. + 102
  13618. + 103 006e 383E not %r8, %r3 ; flip mask for first 12-count bits --> %r8 = 111...000 (mask)
  13619. + 104 0070 5832 and %r8, %r5 ; isolate first 12-count bits of %r5
  13620. + 105 0072 8436 or %r4, %r8 ; add first 12-count bits of %r5 to %r4
  13621. + 106 0074 171F jp.d finish
  13622. + 107 0076 3532 and %r5, %r3 ; keep the low 20-count bits of %r5
  13623. + 108
  13624. + 109 shftleft:
  13625. + 110 0078 722E ld.w %r2, %r7
  13626. + 111 007a B264 sub %r2, 11 ; %r2 = shift = count - 11
  13627. + GAS LISTING extsfdf.s page 3
  13628. +
  13629. +
  13630. + 112
  13631. + 113 ; MXSLL %r5, %r2 ; result1 << count - 11
  13632. + 114 __L0001:
  13633. + 115
  13634. + 116 ; sub %sp, 1
  13635. + 117 ; ld.w [%sp+0], $2 ; rså
  13636. + 118
  13637. + 119 007c F271 and %r2,0x1f ; 祷եȿ=
  13638. + 120 __L0002:
  13639. + 121 007e 8268 cmp %r2,0x8 ; if rs <= 8
  13640. + 122 0080 040E jrle __L0003 ; then $$3
  13641. + 123 0082 858C sll %r5,0x8 ; rd << 8
  13642. + 124 0084 FD1F jp.d __L0002
  13643. + 125 0086 8264 sub %r2,0x8 ; ĥեȲ׻
  13644. + 126 __L0003:
  13645. + 127 0088 258D sll %r5,%r2
  13646. + 128
  13647. + 129 ; ld.w $2, [%sp+0] ; rså
  13648. + 130 ; add %sp, 1
  13649. + 131
  13650. + 132 008a 0C1E jp finish
  13651. + 133
  13652. + 134 expnez:
  13653. + 135 008c 0EC00160 xadd %r1, 0x380 ; exp = exp + 0x380 (0011 1000 0000 in binary)
  13654. + 136
  13655. + 137 ; {result1, result2} >> 3
  13656. + 138 0090 3488 srl %r4, 3 ; shift low 32-bits to the right 3 bits
  13657. + 139 0092 3598 rr %r5, 3 ; rotate high 32-bits to the right 3 bits
  13658. + 140 0094 F36F ld.w %r3, -1 ; %r3 = 0xffff ffff
  13659. + 141 0096 3388 srl %r3, 3 ; make a mask for last 29 bits --> %r3 = 0001...111
  13660. + 142 0098 383E not %r8, %r3 ; flip mask for first 3 bits --> %r8 = 1110...000
  13661. + 143 009a 5832 and %r8, %r5 ; isolate first 3 bits of %r5
  13662. + 144 009c 8436 or %r4, %r8 ; add first 3 bits of %r5 to %r4
  13663. + 145 009e 021F jp.d finish
  13664. + 146 00a0 3532 and %r5, %r3 ; keep the low 29 bits of %r5
  13665. + 147
  13666. + 148 finish:
  13667. + 149 00a2 01C0FFDF xand %r5, 0xfffff ; remove implied bit
  13668. + 149 F573
  13669. + 150
  13670. + 151 00a8 81984198 xrr %r1, 12 ; position exponent bits
  13671. + 152 00ac 1536 or %r5, %r1 ; add exponent
  13672. + 153
  13673. + 154 end:
  13674. + 155 00ae 1098 rr %r0, 1 ; position sign bit
  13675. + 156 00b0 0536 or %r5, %r0 ; add sign bit
  13676. + 157
  13677. + 158 00b2 4302 popn %r3 ; restore register values
  13678. + 159
  13679. + 160
  13680. + 161 00b4 4006 ret
  13681. diff --git a/gcc/config/c33/libgcc/extsfdf.s b/gcc/config/c33/libgcc/extsfdf.s
  13682. new file mode 100644
  13683. index 0000000..7f9b1c2
  13684. --- /dev/null
  13685. +++ b/gcc/config/c33/libgcc/extsfdf.s
  13686. @@ -0,0 +1,161 @@
  13687. +;*********************************************
  13688. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  13689. +;* ALL RIGHTS RESERVED
  13690. +;*
  13691. +;* filename : extsfdf.s
  13692. +;*
  13693. +;* Change type: Single float --> Double float
  13694. +;* input: %r6
  13695. +;* output: (%r5, %r4)
  13696. +;*
  13697. +;* Begin 1996/09/12 V. Chan
  13698. +;* Fixed bug with variable shift (ln. 108)
  13699. +;* 1997/02/18 V. Chan
  13700. +;* ѹ 2001/01/17 O.Hinokuchi
  13701. +;* gasб 2001/10/15 watanabe
  13702. +;*
  13703. +;*****************************************
  13704. +
  13705. +.section .text
  13706. +.align 1
  13707. +.global __extendsfdf2
  13708. +
  13709. +__extendsfdf2:
  13710. +
  13711. + pushn %r3 ; save register values
  13712. +
  13713. + ld.w %r0, %r6 ; put sign of input (%r6) into %r0
  13714. + rl %r0, 1
  13715. + and %r0, 1
  13716. +
  13717. + ld.w %r5, 0 ; clear output registers
  13718. + sll %r6, 1 ; remove MSB
  13719. + srl %r6, 1
  13720. +
  13721. + cmp %r6, 0 ; if input = 0 then exit
  13722. + jreq.d end
  13723. + ld.w %r4, 0
  13724. +
  13725. + ld.w %r1, %r6 ; put exponent into %r1
  13726. + sll %r1, 1
  13727. + xsrl %r1, 24
  13728. +
  13729. + xcmp %r1, 0xff ; if NaN or Inf input then return Inf
  13730. + xld.w %r5, 0x7ff00000
  13731. + jrge.d end
  13732. + ld.w %r4, 0
  13733. +
  13734. +
  13735. + ; isolate mantissa
  13736. + xand %r6,0x7fffff ; clear first 9 bits of %r6
  13737. +
  13738. + cmp %r1, 0
  13739. + jrne.d expnez ; if exp != 0 then goto expnez
  13740. + ld.w %r5, %r6 ; result1 = input
  13741. +
  13742. + ; case: exp = 0
  13743. + ld.w %r9, %r5 ; copy new result to %r9 for counting
  13744. + ld.w %r8, 0 ; initialize loop counter
  13745. +
  13746. +count:
  13747. + scan1 %r7, %r9 ; count = ; of 0's before leading 1 in result
  13748. + jruge continue ; if count !=8 then goto continue
  13749. + add %r8, 8 ; add 8 to loop counter
  13750. + jp.d count
  13751. + sll %r9, 8 ; shift 8 leading 0's out of %r9
  13752. +
  13753. +continue:
  13754. + add %r7, %r8 ; count = count + loop counter
  13755. + xld.w %r1, 0x380 ; exp = 0x380
  13756. + sub %r1, %r7 ; exp = exp - count
  13757. + ;add %r1, 9 ; moved to line 55
  13758. +
  13759. + cmp %r7, 11
  13760. + jrge.d shftleft ; if count >= 11 then goto shftleft
  13761. + add %r1, 9 ; exp = exp + 9
  13762. +
  13763. + ; case: count < 11
  13764. + ld.w %r2, 11
  13765. + sub %r2, %r7 ; %r2 = shift = 11 - count
  13766. +
  13767. + ; {result1, result2} >> 11 - count
  13768. + ;xsrl %r4_p, %r2 ; shift low 32-bits to the right 11-count bits
  13769. + ;xrr %r5_p, %r2 ; rotate high 32-bits to the right 11-count bits
  13770. + ;xsrl %r3, %r2 ; make a mask for last 20-count bits --> %r3 = 000...111
  13771. +
  13772. + ld.w %r3, -1 ; %r3 = 0xffff ffff
  13773. + ; 64-bit variable shift and rotate routine
  13774. +L1:
  13775. + cmp %r2, 8 ; if shift amount <= 8 then goto L2
  13776. + jrle L2
  13777. +
  13778. + srl %r4, 8 ; result1 >> 8
  13779. + rr %r5, 8 ; result2 rotate >> 8
  13780. + srl %r3, 8 ; mask >> 8
  13781. + jp.d L1
  13782. + sub %r2, 8 ; shift amount -= 8
  13783. +
  13784. +L2:
  13785. + srl %r4, %r2 ; result1 >> %r2
  13786. + rr %r5, %r2 ; result2 rotate >> %r2
  13787. + srl %r3, %r2 ; mask >> %r2
  13788. +
  13789. + not %r8, %r3 ; flip mask for first 12-count bits --> %r8 = 111...000 (mask)
  13790. + and %r8, %r5 ; isolate first 12-count bits of %r5
  13791. + or %r4, %r8 ; add first 12-count bits of %r5 to %r4
  13792. + jp.d finish
  13793. + and %r5, %r3 ; keep the low 20-count bits of %r5
  13794. +
  13795. +shftleft:
  13796. + ld.w %r2, %r7
  13797. + sub %r2, 11 ; %r2 = shift = count - 11
  13798. +
  13799. + ; MXSLL %r5, %r2 ; result1 << count - 11
  13800. +__L0001:
  13801. +
  13802. +; sub %sp, 1
  13803. +; ld.w [%sp+0], $2 ; rså
  13804. +
  13805. + and %r2,0x1f ; 祷եȿ=
  13806. +__L0002:
  13807. + cmp %r2,0x8 ; if rs <= 8
  13808. + jrle __L0003 ; then $$3
  13809. + sll %r5,0x8 ; rd << 8
  13810. + jp.d __L0002
  13811. + sub %r2,0x8 ; ĥեȲ׻
  13812. +__L0003:
  13813. + sll %r5,%r2
  13814. +
  13815. +; ld.w $2, [%sp+0] ; rså
  13816. +; add %sp, 1
  13817. +
  13818. + jp finish
  13819. +
  13820. +expnez:
  13821. + xadd %r1, 0x380 ; exp = exp + 0x380 (0011 1000 0000 in binary)
  13822. +
  13823. + ; {result1, result2} >> 3
  13824. + srl %r4, 3 ; shift low 32-bits to the right 3 bits
  13825. + rr %r5, 3 ; rotate high 32-bits to the right 3 bits
  13826. + ld.w %r3, -1 ; %r3 = 0xffff ffff
  13827. + srl %r3, 3 ; make a mask for last 29 bits --> %r3 = 0001...111
  13828. + not %r8, %r3 ; flip mask for first 3 bits --> %r8 = 1110...000
  13829. + and %r8, %r5 ; isolate first 3 bits of %r5
  13830. + or %r4, %r8 ; add first 3 bits of %r5 to %r4
  13831. + jp.d finish
  13832. + and %r5, %r3 ; keep the low 29 bits of %r5
  13833. +
  13834. +finish:
  13835. + xand %r5, 0xfffff ; remove implied bit
  13836. +
  13837. + xrr %r1, 12 ; position exponent bits
  13838. + or %r5, %r1 ; add exponent
  13839. +
  13840. +end:
  13841. + rr %r0, 1 ; position sign bit
  13842. + or %r5, %r0 ; add sign bit
  13843. +
  13844. + popn %r3 ; restore register values
  13845. +
  13846. +
  13847. + ret
  13848. diff --git a/gcc/config/c33/libgcc/fcmpd.lst b/gcc/config/c33/libgcc/fcmpd.lst
  13849. new file mode 100644
  13850. index 0000000..5d6b224
  13851. --- /dev/null
  13852. +++ b/gcc/config/c33/libgcc/fcmpd.lst
  13853. @@ -0,0 +1,108 @@
  13854. +GAS LISTING fcmpd.s page 1
  13855. +
  13856. +
  13857. + 1 ;*********************************************
  13858. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  13859. + 3 ;* ALL RIGHTS RESERVED
  13860. + 4 ;*
  13861. + 5 ;* filename : fcmpd.s
  13862. + 6 ;*
  13863. + 7 ;* Double floating point compare
  13864. + 8 ;* input: (%r7, %r6) & (%r9, %r8)
  13865. + 9 ;* output: %psr
  13866. + 10 ;*
  13867. + 11 ;* Begin 1996/10/30 V. Chan
  13868. + 12 ;* ѹ 2001/01/15 O.Hinokuchi
  13869. + 13 ;* 쥸ִ
  13870. + 14 ;* gasб 2001/10/15 watanabe
  13871. + 15 ;*
  13872. + 16 ;*********************************************
  13873. + 17
  13874. + 18 .section .text
  13875. + 19 .align 1
  13876. + 20 .global __fcmpd
  13877. + 21
  13878. + 22 ;==============================================
  13879. + 23 ;쥸
  13880. + 24 ; %r2:ؿ
  13881. + 25 ; %r4:ӥåȣ[0(+) or 1(-)]
  13882. + 26 ; %r5:ӥåȣ[0(+) or 1(-)]/ؿ/mask
  13883. + 27 ; %r6:[L](double)/[L]
  13884. + 28 ; %r7:[H](double)/[H]
  13885. + 29 ; %r8:[L](double)/[L]
  13886. + 30 ; %r9:[H](double)/[H]
  13887. + 31 ;==============================================
  13888. + 32
  13889. + 33 __fcmpd:
  13890. + 34 0000 0202 pushn %r2 ; %r0%r2
  13891. + 35
  13892. + 36 0002 742E ld.w %r4, %r7 ; ӥåȣ(%r4) <- [H](%r7)
  13893. + 37 0004 149C rl %r4, 1 ; rotate left 1 bit
  13894. + 38 0006 1470 and %r4, 1 ; use mask to keep LSB
  13895. + 39
  13896. + 40 0008 952E ld.w %r5, %r9 ; ӥåȣ(%r4) <- [H](%r9)
  13897. + 41 000a 159C rl %r5, 1 ; rotate left 1 bit
  13898. + 42 000c 1570 and %r5, 1 ; use mask to keep LSB
  13899. + 43
  13900. + 44 ; if ӥåȣ(%r4) = 1 and ӥåȣ(%r5) = 0 then CVZN = 1001 (lt)
  13901. + 45 ; if ӥåȣ(%r4) = 0 and ӥåȣ(%r5) = 1 then CVZN = 0000 (gt)
  13902. + 46 000e 452A cmp %r5, %r4 ; if ӥåȣ(%r5) != ӥåȣ(%r4)
  13903. + 47 0010 231A jrne end ; %psr is changed
  13904. + 48
  13905. + 49 ; case: ӥåȣ(%r4) = ӥåȣ(%r5)
  13906. + 50 0012 752E ld.w %r5, %r7 ; ؿ(%r5) <- [H](%r7)
  13907. + 51 0014 158C sll %r5, 1 ; ؿ(%r5) << 1
  13908. + 52 0016 85888588 xsrl %r5, 21 ; ؿ(%r5) >> 21
  13909. + 52 5588
  13910. + 53
  13911. + 54 001c 922E ld.w %r2, %r9 ; ؿ(%r2) <- [H](%r9)
  13912. + 55 001e 128C sll %r2, 1 ; ؿ(%r2) << 1
  13913. + 56 0020 82888288 xsrl %r2, 21 ; ؿ(%r2) >> 21
  13914. + GAS LISTING fcmpd.s page 2
  13915. +
  13916. +
  13917. + 56 5288
  13918. + 57
  13919. + 58 0026 1468 cmp %r4, 1 ; if ӥåȣ(%r4) = 1
  13920. + 59 0028 0418 jreq negexp ; then goto negexp
  13921. + 60
  13922. + 61 ; max. ؿ = 0x7ff
  13923. + 62 ; min. ؿ = 0x00
  13924. + 63 002a 252A cmp %r5, %r2 ; if ؿ(%r5) != ؿ(%r2)
  13925. + 64 002c 151A jrne end ; then goto end
  13926. + 65 002e 031E jp mancmp
  13927. + 66
  13928. + 67 negexp:
  13929. + 68 0030 522A cmp %r2, %r5 ; if ؿ(%r2) != ؿ(%r5)
  13930. + 69 0032 121A jrne end ; then goto end
  13931. + 70
  13932. + 71 mancmp:
  13933. + 72 0034 1FC0F56B xcmp %r5, 0x7ff ; if ؿ(%r5) = ؿ(%r2) = ü(0xff)
  13934. + 73 0038 0F18 jreq end ; then goto end
  13935. + 74
  13936. + 75 ; case: ؿ(%r5) = ؿ(%r2)
  13937. + 76 003a 01C0FFDF xld.w %r5, 0xfffff ; mask(%r5) <- 0x7fffff
  13938. + 76 F56F
  13939. + 77
  13940. + 78 0040 5732 and %r7, %r5 ; (%r7) = (%r7) & mask(%r5)
  13941. + 79 0042 5932 and %r9, %r5 ; (%r9) = (%r9) & mask(%r5)
  13942. + 80
  13943. + 81 0044 1468 cmp %r4, 1 ; if ӥåȣ(%r4) = 1
  13944. + 82 0046 0518 jreq negman
  13945. + 83
  13946. + 84 0048 972A cmp %r7, %r9 ; compare [H](%r7) : [H](%r9)
  13947. + 85 004a 061A jrne end
  13948. + 86
  13949. + 87 ; case: man1 = man2
  13950. + 88 004c 862A cmp %r6, %r8 ; compare [L](%r6) : [L](%r8)
  13951. + 89 004e 041E jp end
  13952. + 90
  13953. + 91 negman:
  13954. + 92 0050 792A cmp %r9, %r7 ; compare [H](%r9) : [H](%r7)
  13955. + 93 0052 021A jrne end
  13956. + 94
  13957. + 95 0054 682A cmp %r8, %r6 ; compare [L](%r6) : [L](%r8)
  13958. + 96
  13959. + 97 end:
  13960. + 98 0056 4202 popn %r2 ; %r0%r2
  13961. + 99 0058 4006 ret
  13962. diff --git a/gcc/config/c33/libgcc/fcmpd.s b/gcc/config/c33/libgcc/fcmpd.s
  13963. new file mode 100644
  13964. index 0000000..076e672
  13965. --- /dev/null
  13966. +++ b/gcc/config/c33/libgcc/fcmpd.s
  13967. @@ -0,0 +1,99 @@
  13968. +;*********************************************
  13969. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  13970. +;* ALL RIGHTS RESERVED
  13971. +;*
  13972. +;* filename : fcmpd.s
  13973. +;*
  13974. +;* Double floating point compare
  13975. +;* input: (%r7, %r6) & (%r9, %r8)
  13976. +;* output: %psr
  13977. +;*
  13978. +;* Begin 1996/10/30 V. Chan
  13979. +;* ѹ 2001/01/15 O.Hinokuchi
  13980. +;* 쥸ִ
  13981. +;* gasб 2001/10/15 watanabe
  13982. +;*
  13983. +;*********************************************
  13984. +
  13985. +.section .text
  13986. +.align 1
  13987. +.global __fcmpd
  13988. +
  13989. +;==============================================
  13990. +;쥸
  13991. +; %r2:ؿ
  13992. +; %r4:ӥåȣ[0(+) or 1(-)]
  13993. +; %r5:ӥåȣ[0(+) or 1(-)]/ؿ/mask
  13994. +; %r6:[L](double)/[L]
  13995. +; %r7:[H](double)/[H]
  13996. +; %r8:[L](double)/[L]
  13997. +; %r9:[H](double)/[H]
  13998. +;==============================================
  13999. +
  14000. +__fcmpd:
  14001. + pushn %r2 ; %r0%r2
  14002. +
  14003. + ld.w %r4, %r7 ; ӥåȣ(%r4) <- [H](%r7)
  14004. + rl %r4, 1 ; rotate left 1 bit
  14005. + and %r4, 1 ; use mask to keep LSB
  14006. +
  14007. + ld.w %r5, %r9 ; ӥåȣ(%r4) <- [H](%r9)
  14008. + rl %r5, 1 ; rotate left 1 bit
  14009. + and %r5, 1 ; use mask to keep LSB
  14010. +
  14011. + ; if ӥåȣ(%r4) = 1 and ӥåȣ(%r5) = 0 then CVZN = 1001 (lt)
  14012. + ; if ӥåȣ(%r4) = 0 and ӥåȣ(%r5) = 1 then CVZN = 0000 (gt)
  14013. + cmp %r5, %r4 ; if ӥåȣ(%r5) != ӥåȣ(%r4)
  14014. + jrne end ; %psr is changed
  14015. +
  14016. + ; case: ӥåȣ(%r4) = ӥåȣ(%r5)
  14017. + ld.w %r5, %r7 ; ؿ(%r5) <- [H](%r7)
  14018. + sll %r5, 1 ; ؿ(%r5) << 1
  14019. + xsrl %r5, 21 ; ؿ(%r5) >> 21
  14020. +
  14021. + ld.w %r2, %r9 ; ؿ(%r2) <- [H](%r9)
  14022. + sll %r2, 1 ; ؿ(%r2) << 1
  14023. + xsrl %r2, 21 ; ؿ(%r2) >> 21
  14024. +
  14025. + cmp %r4, 1 ; if ӥåȣ(%r4) = 1
  14026. + jreq negexp ; then goto negexp
  14027. +
  14028. + ; max. ؿ = 0x7ff
  14029. + ; min. ؿ = 0x00
  14030. + cmp %r5, %r2 ; if ؿ(%r5) != ؿ(%r2)
  14031. + jrne end ; then goto end
  14032. + jp mancmp
  14033. +
  14034. +negexp:
  14035. + cmp %r2, %r5 ; if ؿ(%r2) != ؿ(%r5)
  14036. + jrne end ; then goto end
  14037. +
  14038. +mancmp:
  14039. + xcmp %r5, 0x7ff ; if ؿ(%r5) = ؿ(%r2) = ü(0xff)
  14040. + jreq end ; then goto end
  14041. +
  14042. + ; case: ؿ(%r5) = ؿ(%r2)
  14043. + xld.w %r5, 0xfffff ; mask(%r5) <- 0x7fffff
  14044. +
  14045. + and %r7, %r5 ; (%r7) = (%r7) & mask(%r5)
  14046. + and %r9, %r5 ; (%r9) = (%r9) & mask(%r5)
  14047. +
  14048. + cmp %r4, 1 ; if ӥåȣ(%r4) = 1
  14049. + jreq negman
  14050. +
  14051. + cmp %r7, %r9 ; compare [H](%r7) : [H](%r9)
  14052. + jrne end
  14053. +
  14054. + ; case: man1 = man2
  14055. + cmp %r6, %r8 ; compare [L](%r6) : [L](%r8)
  14056. + jp end
  14057. +
  14058. +negman:
  14059. + cmp %r9, %r7 ; compare [H](%r9) : [H](%r7)
  14060. + jrne end
  14061. +
  14062. + cmp %r8, %r6 ; compare [L](%r6) : [L](%r8)
  14063. +
  14064. +end:
  14065. + popn %r2 ; %r0%r2
  14066. + ret
  14067. diff --git a/gcc/config/c33/libgcc/fcmps.lst b/gcc/config/c33/libgcc/fcmps.lst
  14068. new file mode 100644
  14069. index 0000000..f9ec7b0
  14070. --- /dev/null
  14071. +++ b/gcc/config/c33/libgcc/fcmps.lst
  14072. @@ -0,0 +1,101 @@
  14073. +GAS LISTING fcmps.s page 1
  14074. +
  14075. +
  14076. + 1 ;*********************************************
  14077. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  14078. + 3 ;* ALL RIGHTS RESERVED
  14079. + 4 ;*
  14080. + 5 ;* filename : fcmps.s
  14081. + 6 ;*
  14082. + 7 ;* Single floating point compare
  14083. + 8 ;* input: %r6 & %r7
  14084. + 9 ;* output: %psr
  14085. + 10 ;*
  14086. + 11 ;* Begin 1996/10/30 V. Chan
  14087. + 12 ;* ѹ 2001/01/15 O.Hinokuchi
  14088. + 13 ;* 쥸ִ
  14089. + 14 ;* gasб 2001/10/15 watanabe
  14090. + 15 ;*
  14091. + 16 ;*********************************************
  14092. + 17
  14093. + 18 .section .text
  14094. + 19 .align 1
  14095. + 20 .global __fcmps
  14096. + 21
  14097. + 22 ;==============================================
  14098. + 23 ;쥸
  14099. + 24 ; %r2:ؿ
  14100. + 25 ; %r4:ӥåȣ[0(+) or 1(-)]
  14101. + 26 ; %r5:ӥåȣ[0(+) or 1(-)]/ؿ/mask
  14102. + 27 ; %r6:(float)/
  14103. + 28 ; %r7:(float)/
  14104. + 29 ;==============================================
  14105. + 30
  14106. + 31
  14107. + 32 __fcmps:
  14108. + 33 0000 0202 pushn %r2 ; %r0%r2
  14109. + 34
  14110. + 35 0002 642E ld.w %r4, %r6 ; ӥåȣ(%r4) <- (%r6)
  14111. + 36 0004 149C rl %r4, 1 ; rotate left 1 bit
  14112. + 37 0006 1470 and %r4, 1 ; keep LSB
  14113. + 38
  14114. + 39 0008 752E ld.w %r5, %r7 ; ӥåȣ(%r5) <- (%r7)
  14115. + 40 000a 159C rl %r5, 1 ; rotate left 1 bit
  14116. + 41 000c 1570 and %r5, 1 ; keep LSB
  14117. + 42
  14118. + 43 ; if ӥåȣ(%r4) = 1 and ӥåȣ(%r5) = 0 then CVZN = 1001 (lt)
  14119. + 44 ; if ӥåȣ(%r4) = 0 and ӥåȣ(%r5) = 1 then CVZN = 0000 (gt)
  14120. + 45 000e 452A cmp %r5, %r4 ; if ӥåȣ(%r5) != ӥåȣ(%r4)
  14121. + 46 0010 1F1A jrne end ; then goto end
  14122. + 47
  14123. + 48 ; case: ӥåȣ(%r4) = ӥåȣ(%r5)
  14124. + 49 0012 652E ld.w %r5, %r6 ; ؿ(%r5) <- (%r6)
  14125. + 50 0014 158C sll %r5, 1 ; ؿ(%r5) << 1
  14126. + 51 0016 85888588 xsrl %r5, 24 ; ؿ(%r5) >> 24
  14127. + 51 8588
  14128. + 52
  14129. + 53 001c 722E ld.w %r2, %r7 ; ؿ(%r2) <- (%r7)
  14130. + 54 001e 128C sll %r2, 1 ; ؿ(%r2) << 1
  14131. + 55 0020 82888288 xsrl %r2, 24 ; ؿ(%r2) >> 24
  14132. + 55 8288
  14133. + GAS LISTING fcmps.s page 2
  14134. +
  14135. +
  14136. + 56
  14137. + 57 0026 1468 cmp %r4, 1 ; if ӥåȣ(%r4) = 1
  14138. + 58 0028 0418 jreq negexp ; then goto negexp
  14139. + 59
  14140. + 60 ; max. ؿ = 0xff
  14141. + 61 ; min. ؿ = 0x00
  14142. + 62 002a 252A cmp %r5, %r2 ; if ؿ(%r5) != ؿ(%r2)
  14143. + 63 002c 111A jrne end ; then goto end
  14144. + 64 002e 031E jp mancmp
  14145. + 65
  14146. + 66 negexp:
  14147. + 67 0030 522A cmp %r2, %r5 ; if ؿ(%r2) != ؿ(%r5)
  14148. + 68 0032 0E1A jrne end ; then goto end
  14149. + 69
  14150. + 70 mancmp:
  14151. + 71 ; check if Inf or NaN values
  14152. + 72 0034 03C0F56B xcmp %r5, 0xff ; if ؿ(%r5) = ؿ(%r2) = ü(0xff)
  14153. + 73 0038 0B18 jreq end ; then goto end
  14154. + 74
  14155. + 75 ; case: ؿ(%r5) = ؿ(%r2)
  14156. + 76 003a 0FC0FFDF xld.w %r5, 0x7fffff ; mask(%r5) <- 0x7fffff
  14157. + 76 F56F
  14158. + 77
  14159. + 78 0040 5632 and %r6, %r5 ; (%r6) = (%r6) & mask(%r5)
  14160. + 79 0042 5732 and %r7, %r5 ; (%r7) = (%r7) & mask(%r5)
  14161. + 80
  14162. + 81 0044 1468 cmp %r4, 1 ; if ӥåȣ(%r4) = 1
  14163. + 82 0046 0318 jreq negman ; then goto negman
  14164. + 83
  14165. + 84 0048 762A cmp %r6, %r7 ; compare (%r6) : (%r7)
  14166. + 85 004a 021E jp end
  14167. + 86
  14168. + 87 negman:
  14169. + 88 004c 672A cmp %r7, %r6 ; compare (%r7) : (%r6)
  14170. + 89
  14171. + 90 end:
  14172. + 91 004e 4202 popn %r2 ; %r0%r2
  14173. + 92 0050 4006 ret
  14174. diff --git a/gcc/config/c33/libgcc/fcmps.s b/gcc/config/c33/libgcc/fcmps.s
  14175. new file mode 100644
  14176. index 0000000..e31c159
  14177. --- /dev/null
  14178. +++ b/gcc/config/c33/libgcc/fcmps.s
  14179. @@ -0,0 +1,92 @@
  14180. +;*********************************************
  14181. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  14182. +;* ALL RIGHTS RESERVED
  14183. +;*
  14184. +;* filename : fcmps.s
  14185. +;*
  14186. +;* Single floating point compare
  14187. +;* input: %r6 & %r7
  14188. +;* output: %psr
  14189. +;*
  14190. +;* Begin 1996/10/30 V. Chan
  14191. +;* ѹ 2001/01/15 O.Hinokuchi
  14192. +;* 쥸ִ
  14193. +;* gasб 2001/10/15 watanabe
  14194. +;*
  14195. +;*********************************************
  14196. +
  14197. +.section .text
  14198. +.align 1
  14199. +.global __fcmps
  14200. +
  14201. +;==============================================
  14202. +;쥸
  14203. +; %r2:ؿ
  14204. +; %r4:ӥåȣ[0(+) or 1(-)]
  14205. +; %r5:ӥåȣ[0(+) or 1(-)]/ؿ/mask
  14206. +; %r6:(float)/
  14207. +; %r7:(float)/
  14208. +;==============================================
  14209. +
  14210. +
  14211. +__fcmps:
  14212. + pushn %r2 ; %r0%r2
  14213. +
  14214. + ld.w %r4, %r6 ; ӥåȣ(%r4) <- (%r6)
  14215. + rl %r4, 1 ; rotate left 1 bit
  14216. + and %r4, 1 ; keep LSB
  14217. +
  14218. + ld.w %r5, %r7 ; ӥåȣ(%r5) <- (%r7)
  14219. + rl %r5, 1 ; rotate left 1 bit
  14220. + and %r5, 1 ; keep LSB
  14221. +
  14222. + ; if ӥåȣ(%r4) = 1 and ӥåȣ(%r5) = 0 then CVZN = 1001 (lt)
  14223. + ; if ӥåȣ(%r4) = 0 and ӥåȣ(%r5) = 1 then CVZN = 0000 (gt)
  14224. + cmp %r5, %r4 ; if ӥåȣ(%r5) != ӥåȣ(%r4)
  14225. + jrne end ; then goto end
  14226. +
  14227. + ; case: ӥåȣ(%r4) = ӥåȣ(%r5)
  14228. + ld.w %r5, %r6 ; ؿ(%r5) <- (%r6)
  14229. + sll %r5, 1 ; ؿ(%r5) << 1
  14230. + xsrl %r5, 24 ; ؿ(%r5) >> 24
  14231. +
  14232. + ld.w %r2, %r7 ; ؿ(%r2) <- (%r7)
  14233. + sll %r2, 1 ; ؿ(%r2) << 1
  14234. + xsrl %r2, 24 ; ؿ(%r2) >> 24
  14235. +
  14236. + cmp %r4, 1 ; if ӥåȣ(%r4) = 1
  14237. + jreq negexp ; then goto negexp
  14238. +
  14239. + ; max. ؿ = 0xff
  14240. + ; min. ؿ = 0x00
  14241. + cmp %r5, %r2 ; if ؿ(%r5) != ؿ(%r2)
  14242. + jrne end ; then goto end
  14243. + jp mancmp
  14244. +
  14245. +negexp:
  14246. + cmp %r2, %r5 ; if ؿ(%r2) != ؿ(%r5)
  14247. + jrne end ; then goto end
  14248. +
  14249. +mancmp:
  14250. + ; check if Inf or NaN values
  14251. + xcmp %r5, 0xff ; if ؿ(%r5) = ؿ(%r2) = ü(0xff)
  14252. + jreq end ; then goto end
  14253. +
  14254. + ; case: ؿ(%r5) = ؿ(%r2)
  14255. + xld.w %r5, 0x7fffff ; mask(%r5) <- 0x7fffff
  14256. +
  14257. + and %r6, %r5 ; (%r6) = (%r6) & mask(%r5)
  14258. + and %r7, %r5 ; (%r7) = (%r7) & mask(%r5)
  14259. +
  14260. + cmp %r4, 1 ; if ӥåȣ(%r4) = 1
  14261. + jreq negman ; then goto negman
  14262. +
  14263. + cmp %r6, %r7 ; compare (%r6) : (%r7)
  14264. + jp end
  14265. +
  14266. +negman:
  14267. + cmp %r7, %r6 ; compare (%r7) : (%r6)
  14268. +
  14269. +end:
  14270. + popn %r2 ; %r0%r2
  14271. + ret
  14272. diff --git a/gcc/config/c33/libgcc/fixdfi.lst b/gcc/config/c33/libgcc/fixdfi.lst
  14273. new file mode 100644
  14274. index 0000000..2f72dcd
  14275. --- /dev/null
  14276. +++ b/gcc/config/c33/libgcc/fixdfi.lst
  14277. @@ -0,0 +1,140 @@
  14278. +GAS LISTING fixdfi.s page 1
  14279. +
  14280. +
  14281. + 1 ;*********************************************
  14282. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  14283. + 3 ;* ALL RIGHTS RESERVED
  14284. + 4 ;*
  14285. + 5 ;* filename : fixdfui.s
  14286. + 6 ;*
  14287. + 7 ;* Change type: Double float --> Unsigned integer
  14288. + 8 ;* --> Signed integer
  14289. + 9 ;* input: (%r7, %r6)
  14290. + 10 ;* output: %r4
  14291. + 11 ;*
  14292. + 12 ;* Begin 1996/09/12 V. Chan
  14293. + 13 ;* ѹ 2001/01/18 O.Hinokuchi
  14294. + 14 ;* 쥸֤
  14295. + 15 ;* __fixunsdfsi եʬΤ
  14296. + 16 ;* gasб 2001/10/15 watanabe
  14297. + 17 ;*
  14298. + 18 ;*****************************************
  14299. + 19
  14300. + 20 .section .text
  14301. + 21 .align 1
  14302. + 22 .global __fixdfsi
  14303. + 23
  14304. + 24 ;==============================================
  14305. + 25 ;쥸
  14306. + 26 ; %r0:ӥå(0(+) or 1(-))
  14307. + 27 ; %r4:(int or uint)
  14308. + 28 ; %r5:ؿ(11bit)
  14309. + 29 ; %r6:(Double32bit)
  14310. + 30 ; %r7:(Double32bit)
  14311. + 31 ; %r8:mask
  14312. + 32 ; %r9:shift
  14313. + 33 ;==============================================
  14314. + 34
  14315. + 35 __fixdfsi:
  14316. + 36
  14317. + 37 0000 0002 pushn %r0 ; %r0
  14318. + 38
  14319. + 39 0002 702E ld.w %r0, %r7 ; ӥå(%r0) <- (%r7) put sign of input (%r7) into %r0
  14320. + 40 0004 109C rl %r0, 1 ; ӥå(%r0) >> 31 Ʊ
  14321. + 41 0006 1070 and %r0, 1 ; ӥå(%r0) = ӥå(%r0) & 1 moved to line 33
  14322. + 42
  14323. + 43 0008 752E ld.w %r5, %r7 ; ؿ(%r5) <- (%r7) put exponent into %r5
  14324. + 44 000a 158C sll %r5, 1 ; ؿ(%r7) << 1
  14325. + 45 000c 85888588 xsrl %r5, 21 ; ؿ(%r7) >> 24
  14326. + 45 5588
  14327. + 46
  14328. + 47 0012 0FC0F56B xcmp %r5, 0x3ff ; if ؿ(%r7) < 0x3ff then goto end
  14329. + 48 0016 320D jrlt.d end ; case: round to zero (underflow)
  14330. + 49 0018 046C ld.w %r4, 0 ; (%r4) <- 0 clear output register
  14331. + 50
  14332. + 51 001a 10C0F569 xcmp %r5, 0x41f ; if (%r4) >= 0x41f then integer overflow
  14333. + 52 001e 146C ld.w %r4, 1 ; (%r4) <- 1
  14334. + 53 0020 2A0B jrge.d overflow
  14335. + 54 0022 1498 rr %r4, 1 ; (%r4) = 0x8000 0000
  14336. + 55
  14337. + 56 ; isolate mantissa
  14338. + GAS LISTING fixdfi.s page 2
  14339. +
  14340. +
  14341. + 57 0024 742E ld.w %r4, %r7 ; (%r4) <- (%r7)
  14342. + 58 0026 01C0FFDF xand %r4, 0xfffff ; (%r4) <- (%r4) & 0xfffff) clear first 12 bits of %r7
  14343. + 58 F473
  14344. + 59 002c 02C000C0 xoor %r4, 0x100000 ; (%r4) <- ((%r4) | 0x100000) add implied bit
  14345. + 59 0474
  14346. + 60 0032 10C0396D xld.w %r9, 0x413 ;shift(%r9) <- 0x413
  14347. + 61
  14348. + 62 0036 952A cmp %r5, %r9 ; 0x3ff + 31 - 11 = 0x413
  14349. + 63 0038 0908 jrgt shftleft ; if ؿ(%r7) > 0x413 then shift left
  14350. + 64
  14351. + 65 ; case: exp <= 0x413
  14352. + 66 003a 5926 sub %r9, %r5 ; %r9 = 0x413 - exp (max = 20)
  14353. + 67
  14354. + 68 ;xsrl %r4, %r3 ; final shift of result
  14355. + 69 ; 32-bit variable shift routine
  14356. + 70 L1:
  14357. + 71 003c 8968 cmp %r9, 8 ; if shift(%r9) <= 8 then goto L2
  14358. + 72 003e 040E jrle L2
  14359. + 73
  14360. + 74 0040 8488 srl %r4, 8 ; (%r4) >> 8
  14361. + 75 0042 FD1F jp.d L1
  14362. + 76 0044 8964 sub %r9, 8 ; shift(%r9) = shift(%r9) - 8
  14363. + 77
  14364. + 78 L2:
  14365. + 79 0046 121F jp.d finish
  14366. + 80 0048 9489 srl %r4, %r9 ; (%r4) >> shift(%r9) last shift
  14367. + 81
  14368. + 82 shftleft:
  14369. + 83 004a 9526 sub %r5, %r9 ; ؿ(%r5) = ؿ(%r5) - shift(%r9=0x413) (max = 11)
  14370. + 84
  14371. + 85 ; {result, man1_2} << 0x413-exp
  14372. + 86 ;xsll %r4, %r1 ; shift high 32-bits to the left x bits (shift amount = x)
  14373. + 87 ;xrl %r6, %r1 ; rotate low 32-bits to the left x bits
  14374. + 88 ;xsll %r2, %r1 ; make a mask for first 32-x bits --> %r2 = 111...000
  14375. + 89
  14376. + 90 004c F86F ld.w %r8, -1 ; mask(%r8) = 0xffff ffff
  14377. + 91 ; 64-bit variable shift and rotate routine
  14378. + 92 L3:
  14379. + 93 004e 8568 cmp %r5, 8 ; if ؿ(%r5) <= 8 then goto L2
  14380. + 94 0050 060E jrle L4
  14381. + 95
  14382. + 96 0052 848C sll %r4, 8 ; (%r4) << 8
  14383. + 97 0054 869C rl %r6, 8 ; (%r6) rotate << 8
  14384. + 98 0056 888C sll %r8, 8 ; mask(%r8) << 8
  14385. + 99 0058 FB1F jp.d L3
  14386. + 100 005a 8564 sub %r5, 8 ; ؿ(%r5) = ؿ(%r5) - 8
  14387. + 101
  14388. + 102 L4:
  14389. + 103 005c 548D sll %r4, %r5 ; (%r4) << ؿ(%r5)
  14390. + 104 005e 569D rl %r6, %r5 ; (%r6) rotate << ؿ(%r5)
  14391. + 105 0060 588D sll %r8, %r5 ; mask(%r8) << ؿ(%r5)
  14392. + 106
  14393. + 107 0062 853E not %r5, %r8 ; ؿ(%r5) = ~mask(%r8) flip mask for last x bits --> %r9 = 000...111 (mask)
  14394. + 108 0064 6532 and %r5, %r6 ; ؿ(%r5) = ؿ(%r5) & (%r6) isolate last x bits of %r6
  14395. + 109 0066 5436 or %r4, %r5 ; (%r4) = (%r4) & ؿ(%r5) add last x bits of %r6 to %r4
  14396. + 110 0068 8632 and %r6, %r8 ; (%r6) = (%r6) & mask(%r8) keep the high 32-x bits of %r6
  14397. + 111
  14398. + GAS LISTING fixdfi.s page 3
  14399. +
  14400. +
  14401. + 112 finish:
  14402. + 113 006a 0068 cmp %r0, 0 ; if ӥå(%r0) = 0 then goto end
  14403. + 114 006c 0718 jreq end
  14404. + 115
  14405. + 116 ; case: sign = 1
  14406. + 117 006e 443E not %r4, %r4 ; (%r4) = ~(%r4)
  14407. + 118 0070 051F jp.d end
  14408. + 119 0072 1460 add %r4, 1 ; (%r4) = (%r4) + 1 ()
  14409. + 120
  14410. + 121 overflow:
  14411. + 122 0074 0068 cmp %r0, 0 ; check sign
  14412. + 123 0076 021A jrne end ; if ӥå(%r0) = 1 then goto end
  14413. + 124 0078 443E not %r4, %r4 ; ӥå(%r0) <- 0xffffffff
  14414. + 125
  14415. + 126 end:
  14416. + 127 007a 4002 popn %r0 ; %r0
  14417. + 128 007c 4006 ret
  14418. diff --git a/gcc/config/c33/libgcc/fixdfi.s b/gcc/config/c33/libgcc/fixdfi.s
  14419. new file mode 100644
  14420. index 0000000..ad49802
  14421. --- /dev/null
  14422. +++ b/gcc/config/c33/libgcc/fixdfi.s
  14423. @@ -0,0 +1,128 @@
  14424. +;*********************************************
  14425. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  14426. +;* ALL RIGHTS RESERVED
  14427. +;*
  14428. +;* filename : fixdfui.s
  14429. +;*
  14430. +;* Change type: Double float --> Unsigned integer
  14431. +;* --> Signed integer
  14432. +;* input: (%r7, %r6)
  14433. +;* output: %r4
  14434. +;*
  14435. +;* Begin 1996/09/12 V. Chan
  14436. +;* ѹ 2001/01/18 O.Hinokuchi
  14437. +;* 쥸֤
  14438. +;* __fixunsdfsi եʬΤ
  14439. +;* gasб 2001/10/15 watanabe
  14440. +;*
  14441. +;*****************************************
  14442. +
  14443. +.section .text
  14444. +.align 1
  14445. +.global __fixdfsi
  14446. +
  14447. +;==============================================
  14448. +;쥸
  14449. +; %r0:ӥå(0(+) or 1(-))
  14450. +; %r4:(int or uint)
  14451. +; %r5:ؿ(11bit)
  14452. +; %r6:(Double32bit)
  14453. +; %r7:(Double32bit)
  14454. +; %r8:mask
  14455. +; %r9:shift
  14456. +;==============================================
  14457. +
  14458. +__fixdfsi:
  14459. +
  14460. + pushn %r0 ; %r0
  14461. +
  14462. + ld.w %r0, %r7 ; ӥå(%r0) <- (%r7) put sign of input (%r7) into %r0
  14463. + rl %r0, 1 ; ӥå(%r0) >> 31 Ʊ
  14464. + and %r0, 1 ; ӥå(%r0) = ӥå(%r0) & 1 moved to line 33
  14465. +
  14466. + ld.w %r5, %r7 ; ؿ(%r5) <- (%r7) put exponent into %r5
  14467. + sll %r5, 1 ; ؿ(%r7) << 1
  14468. + xsrl %r5, 21 ; ؿ(%r7) >> 24
  14469. +
  14470. + xcmp %r5, 0x3ff ; if ؿ(%r7) < 0x3ff then goto end
  14471. + jrlt.d end ; case: round to zero (underflow)
  14472. + ld.w %r4, 0 ; (%r4) <- 0 clear output register
  14473. +
  14474. + xcmp %r5, 0x41f ; if (%r4) >= 0x41f then integer overflow
  14475. + ld.w %r4, 1 ; (%r4) <- 1
  14476. + jrge.d overflow
  14477. + rr %r4, 1 ; (%r4) = 0x8000 0000
  14478. +
  14479. + ; isolate mantissa
  14480. + ld.w %r4, %r7 ; (%r4) <- (%r7)
  14481. + xand %r4, 0xfffff ; (%r4) <- (%r4) & 0xfffff) clear first 12 bits of %r7
  14482. + xoor %r4, 0x100000 ; (%r4) <- ((%r4) | 0x100000) add implied bit
  14483. + xld.w %r9, 0x413 ;shift(%r9) <- 0x413
  14484. +
  14485. + cmp %r5, %r9 ; 0x3ff + 31 - 11 = 0x413
  14486. + jrgt shftleft ; if ؿ(%r7) > 0x413 then shift left
  14487. +
  14488. + ; case: exp <= 0x413
  14489. + sub %r9, %r5 ; %r9 = 0x413 - exp (max = 20)
  14490. +
  14491. + ;xsrl %r4, %r3 ; final shift of result
  14492. + ; 32-bit variable shift routine
  14493. +L1:
  14494. + cmp %r9, 8 ; if shift(%r9) <= 8 then goto L2
  14495. + jrle L2
  14496. +
  14497. + srl %r4, 8 ; (%r4) >> 8
  14498. + jp.d L1
  14499. + sub %r9, 8 ; shift(%r9) = shift(%r9) - 8
  14500. +
  14501. +L2:
  14502. + jp.d finish
  14503. + srl %r4, %r9 ; (%r4) >> shift(%r9) last shift
  14504. +
  14505. +shftleft:
  14506. + sub %r5, %r9 ; ؿ(%r5) = ؿ(%r5) - shift(%r9=0x413) (max = 11)
  14507. +
  14508. + ; {result, man1_2} << 0x413-exp
  14509. + ;xsll %r4, %r1 ; shift high 32-bits to the left x bits (shift amount = x)
  14510. + ;xrl %r6, %r1 ; rotate low 32-bits to the left x bits
  14511. + ;xsll %r2, %r1 ; make a mask for first 32-x bits --> %r2 = 111...000
  14512. +
  14513. + ld.w %r8, -1 ; mask(%r8) = 0xffff ffff
  14514. + ; 64-bit variable shift and rotate routine
  14515. +L3:
  14516. + cmp %r5, 8 ; if ؿ(%r5) <= 8 then goto L2
  14517. + jrle L4
  14518. +
  14519. + sll %r4, 8 ; (%r4) << 8
  14520. + rl %r6, 8 ; (%r6) rotate << 8
  14521. + sll %r8, 8 ; mask(%r8) << 8
  14522. + jp.d L3
  14523. + sub %r5, 8 ; ؿ(%r5) = ؿ(%r5) - 8
  14524. +
  14525. +L4:
  14526. + sll %r4, %r5 ; (%r4) << ؿ(%r5)
  14527. + rl %r6, %r5 ; (%r6) rotate << ؿ(%r5)
  14528. + sll %r8, %r5 ; mask(%r8) << ؿ(%r5)
  14529. +
  14530. + not %r5, %r8 ; ؿ(%r5) = ~mask(%r8) flip mask for last x bits --> %r9 = 000...111 (mask)
  14531. + and %r5, %r6 ; ؿ(%r5) = ؿ(%r5) & (%r6) isolate last x bits of %r6
  14532. + or %r4, %r5 ; (%r4) = (%r4) & ؿ(%r5) add last x bits of %r6 to %r4
  14533. + and %r6, %r8 ; (%r6) = (%r6) & mask(%r8) keep the high 32-x bits of %r6
  14534. +
  14535. +finish:
  14536. + cmp %r0, 0 ; if ӥå(%r0) = 0 then goto end
  14537. + jreq end
  14538. +
  14539. + ; case: sign = 1
  14540. + not %r4, %r4 ; (%r4) = ~(%r4)
  14541. + jp.d end
  14542. + add %r4, 1 ; (%r4) = (%r4) + 1 ()
  14543. +
  14544. +overflow:
  14545. + cmp %r0, 0 ; check sign
  14546. + jrne end ; if ӥå(%r0) = 1 then goto end
  14547. + not %r4, %r4 ; ӥå(%r0) <- 0xffffffff
  14548. +
  14549. +end:
  14550. + popn %r0 ; %r0
  14551. + ret
  14552. diff --git a/gcc/config/c33/libgcc/fixdfui.lst b/gcc/config/c33/libgcc/fixdfui.lst
  14553. new file mode 100644
  14554. index 0000000..9f496ff
  14555. --- /dev/null
  14556. +++ b/gcc/config/c33/libgcc/fixdfui.lst
  14557. @@ -0,0 +1,154 @@
  14558. +GAS LISTING fixdfui.s page 1
  14559. +
  14560. +
  14561. + 1 ;*********************************************
  14562. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  14563. + 3 ;* ALL RIGHTS RESERVED
  14564. + 4 ;*
  14565. + 5 ;* filename : fixdfui.s
  14566. + 6 ;*
  14567. + 7 ;* Change type: Double float --> Unsigned integer
  14568. + 8 ;* --> Signed integer
  14569. + 9 ;* input: (%r7, %r6)
  14570. + 10 ;* output: %r4
  14571. + 11 ;*
  14572. + 12 ;* Begin 1996/09/12 V. Chan
  14573. + 13 ;* ѹ 2001/01/17 O.Hinokuchi
  14574. + 14 ;* 쥸֤
  14575. + 15 ;* __fixdfsi եʬΤ
  14576. + 16 ;* ޥʥͤΥ㥹Ȥ Сեϡ
  14577. + 17 ;* 0xffffffff֤褦˽(gccνƱ)
  14578. + 18 ;* gasб 2001/10/15 watanabe
  14579. + 19 ;*
  14580. + 20 ;*****************************************
  14581. + 21
  14582. + 22 .section .text
  14583. + 23 .align 1
  14584. + 24 .global __fixunsdfsi
  14585. + 25
  14586. + 26 ;==============================================
  14587. + 27 ;쥸
  14588. + 28 ; %r0:ӥå(0(+) or 1(-))
  14589. + 29 ; %r4:(int or uint)
  14590. + 30 ; %r5:ؿ(11bit)
  14591. + 31 ; %r6:(Double32bit)
  14592. + 32 ; %r7:(Double32bit)
  14593. + 33 ; %r8:mask
  14594. + 34 ; %r9:shift
  14595. + 35 ;==============================================
  14596. + 36
  14597. + 37 __fixunsdfsi:
  14598. + 38
  14599. + 39 0000 742E ld.w %r4, %r7
  14600. + 40 0002 00D000C0 xand %r4, 0x80000000 ; if( sign_bit == 0 )
  14601. + 40 0470
  14602. + 41
  14603. + 42 0008 00C000C0 xjreq start ; goto __fixdfsi
  14604. + 42 0318
  14605. + 43 ; else
  14606. + 44 000e 046C xld.w %r4, 0x0 ; return(0)
  14607. + 45 0010 4006 ret
  14608. + 46 start:
  14609. + 47
  14610. + 48 0012 0002 pushn %r0 ; %r0
  14611. + 49
  14612. + 50 0014 702E ld.w %r0, %r7 ; ӥå(%r0) <- (%r7) put sign of input (%r7) into %r0
  14613. + 51 0016 109C rl %r0, 1 ; ӥå(%r0) >> 31 Ʊ
  14614. + 52 0018 1070 and %r0, 1 ; ӥå(%r0) = ӥå(%r0) & 1 moved to line 33
  14615. + 53
  14616. + 54 001a 752E ld.w %r5, %r7 ; ؿ(%r5) <- (%r7) put exponent into %r5
  14617. + 55 001c 158C sll %r5, 1 ; ؿ(%r7) << 1
  14618. + GAS LISTING fixdfui.s page 2
  14619. +
  14620. +
  14621. + 56 001e 85888588 xsrl %r5, 21 ; ؿ(%r7) >> 24
  14622. + 56 5588
  14623. + 57
  14624. + 58 0024 0FC0F56B xcmp %r5, 0x3ff ; if ؿ(%r7) < 0x3ff then goto end
  14625. + 59 0028 330D jrlt.d end ; case: round to zero (underflow)
  14626. + 60 002a 046C ld.w %r4, 0 ; (%r4) <- 0 clear output register
  14627. + 61
  14628. + 62 002c 10C0F569 xcmp %r5, 0x41f ; if (%r4) >= 0x41f then integer overflow
  14629. + 63 0030 146C ld.w %r4, 1 ; (%r4) <- 1
  14630. + 64 0032 2A0B jrge.d overflow
  14631. + 65 0034 1498 rr %r4, 1 ; (%r4) = 0x8000 0000
  14632. + 66
  14633. + 67 ; isolate mantissa
  14634. + 68 0036 742E ld.w %r4, %r7 ; (%r4) <- (%r7)
  14635. + 69 0038 01C0FFDF xand %r4, 0xfffff ; (%r4) <- (%r4) & 0xfffff) clear first 12 bits of %r7
  14636. + 69 F473
  14637. + 70 003e 02C000C0 xoor %r4, 0x100000 ; (%r4) <- ((%r4) | 0x100000) add implied bit
  14638. + 70 0474
  14639. + 71 0044 10C0396D xld.w %r9, 0x413 ;shift(%r9) <- 0x413
  14640. + 72
  14641. + 73 0048 952A cmp %r5, %r9 ; 0x3ff + 31 - 11 = 0x413
  14642. + 74 004a 0908 jrgt shftleft ; if ؿ(%r7) > 0x413 then shift left
  14643. + 75
  14644. + 76 ; case: exp <= 0x413
  14645. + 77 004c 5926 sub %r9, %r5 ; %r9 = 0x413 - exp (max = 20)
  14646. + 78
  14647. + 79 ;xsrl %r4, %r3 ; final shift of result
  14648. + 80 ; 32-bit variable shift routine
  14649. + 81 L1:
  14650. + 82 004e 8968 cmp %r9, 8 ; if shift(%r9) <= 8 then goto L2
  14651. + 83 0050 040E jrle L2
  14652. + 84
  14653. + 85 0052 8488 srl %r4, 8 ; (%r4) >> 8
  14654. + 86 0054 FD1F jp.d L1
  14655. + 87 0056 8964 sub %r9, 8 ; shift(%r9) = shift(%r9) - 8
  14656. + 88
  14657. + 89 L2:
  14658. + 90 0058 121F jp.d finish
  14659. + 91 005a 9489 srl %r4, %r9 ; (%r4) >> shift(%r9) last shift
  14660. + 92
  14661. + 93 shftleft:
  14662. + 94 005c 9526 sub %r5, %r9 ; ؿ(%r5) = ؿ(%r5) - shift(%r9=0x413) (max = 11)
  14663. + 95
  14664. + 96 ; {result, man1_2} << 0x413-exp
  14665. + 97 ;xsll %r4, %r1 ; shift high 32-bits to the left x bits (shift amount = x)
  14666. + 98 ;xrl %r6, %r1 ; rotate low 32-bits to the left x bits
  14667. + 99 ;xsll %r2, %r1 ; make a mask for first 32-x bits --> %r2 = 111...000
  14668. + 100
  14669. + 101 005e F86F ld.w %r8, -1 ; mask(%r8) = 0xffff ffff
  14670. + 102 ; 64-bit variable shift and rotate routine
  14671. + 103 L3:
  14672. + 104 0060 8568 cmp %r5, 8 ; if ؿ(%r5) <= 8 then goto L2
  14673. + 105 0062 060E jrle L4
  14674. + 106
  14675. + 107 0064 848C sll %r4, 8 ; (%r4) << 8
  14676. + 108 0066 869C rl %r6, 8 ; (%r6) rotate << 8
  14677. + 109 0068 888C sll %r8, 8 ; mask(%r8) << 8
  14678. + GAS LISTING fixdfui.s page 3
  14679. +
  14680. +
  14681. + 110 006a FB1F jp.d L3
  14682. + 111 006c 8564 sub %r5, 8 ; ؿ(%r5) = ؿ(%r5) - 8
  14683. + 112
  14684. + 113 L4:
  14685. + 114 006e 548D sll %r4, %r5 ; (%r4) << ؿ(%r5)
  14686. + 115 0070 569D rl %r6, %r5 ; (%r6) rotate << ؿ(%r5)
  14687. + 116 0072 588D sll %r8, %r5 ; mask(%r8) << ؿ(%r5)
  14688. + 117
  14689. + 118 0074 853E not %r5, %r8 ; ؿ(%r5) = ~mask(%r8) flip mask for last x bits --> %r9 = 000...111 (mask)
  14690. + 119 0076 6532 and %r5, %r6 ; ؿ(%r5) = ؿ(%r5) & (%r6) isolate last x bits of %r6
  14691. + 120 0078 5436 or %r4, %r5 ; (%r4) = (%r4) & ؿ(%r5) add last x bits of %r6 to %r4
  14692. + 121 007a 8632 and %r6, %r8 ; (%r6) = (%r6) & mask(%r8) keep the high 32-x bits of %r6
  14693. + 122
  14694. + 123 finish:
  14695. + 124 007c 0068 cmp %r0, 0 ; if ӥå(%r0) = 0 then goto end
  14696. + 125 007e 0818 jreq end
  14697. + 126
  14698. + 127 ; case: sign = 1
  14699. + 128 0080 443E not %r4, %r4 ; (%r4) = ~(%r4)
  14700. + 129 0082 061F jp.d end
  14701. + 130 0084 1460 add %r4, 1 ; (%r4) = (%r4) + 1 ()
  14702. + 131
  14703. + 132 overflow:
  14704. + 133 0086 0068 cmp %r0, 0 ; check sign
  14705. + 134 0088 031A jrne end ; if ӥå(%r0) = 1 then goto end
  14706. + 135 008a 046C ld.w %r4, 0 ; Сեϡ0xffffffff֤褦˽01/01/17 Hinokuchi
  14707. + 136 008c 443E not %r4, %r4 ; ӥå(%r0) <- 0xffffffff
  14708. + 137
  14709. + 138 end:
  14710. + 139 008e 4002 popn %r0 ; %r0
  14711. + 140 0090 4006 ret
  14712. diff --git a/gcc/config/c33/libgcc/fixdfui.s b/gcc/config/c33/libgcc/fixdfui.s
  14713. new file mode 100644
  14714. index 0000000..f472cc0
  14715. --- /dev/null
  14716. +++ b/gcc/config/c33/libgcc/fixdfui.s
  14717. @@ -0,0 +1,140 @@
  14718. +;*********************************************
  14719. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  14720. +;* ALL RIGHTS RESERVED
  14721. +;*
  14722. +;* filename : fixdfui.s
  14723. +;*
  14724. +;* Change type: Double float --> Unsigned integer
  14725. +;* --> Signed integer
  14726. +;* input: (%r7, %r6)
  14727. +;* output: %r4
  14728. +;*
  14729. +;* Begin 1996/09/12 V. Chan
  14730. +;* ѹ 2001/01/17 O.Hinokuchi
  14731. +;* 쥸֤
  14732. +;* __fixdfsi եʬΤ
  14733. +;* ޥʥͤΥ㥹Ȥ Сեϡ
  14734. +;* 0xffffffff֤褦˽(gccνƱ)
  14735. +;* gasб 2001/10/15 watanabe
  14736. +;*
  14737. +;*****************************************
  14738. +
  14739. +.section .text
  14740. +.align 1
  14741. +.global __fixunsdfsi
  14742. +
  14743. +;==============================================
  14744. +;쥸
  14745. +; %r0:ӥå(0(+) or 1(-))
  14746. +; %r4:(int or uint)
  14747. +; %r5:ؿ(11bit)
  14748. +; %r6:(Double32bit)
  14749. +; %r7:(Double32bit)
  14750. +; %r8:mask
  14751. +; %r9:shift
  14752. +;==============================================
  14753. +
  14754. +__fixunsdfsi:
  14755. +
  14756. + ld.w %r4, %r7
  14757. + xand %r4, 0x80000000 ; if( sign_bit == 0 )
  14758. +
  14759. + xjreq start ; goto __fixdfsi
  14760. + ; else
  14761. + xld.w %r4, 0x0 ; return(0)
  14762. + ret
  14763. +start:
  14764. +
  14765. + pushn %r0 ; %r0
  14766. +
  14767. + ld.w %r0, %r7 ; ӥå(%r0) <- (%r7) put sign of input (%r7) into %r0
  14768. + rl %r0, 1 ; ӥå(%r0) >> 31 Ʊ
  14769. + and %r0, 1 ; ӥå(%r0) = ӥå(%r0) & 1 moved to line 33
  14770. +
  14771. + ld.w %r5, %r7 ; ؿ(%r5) <- (%r7) put exponent into %r5
  14772. + sll %r5, 1 ; ؿ(%r7) << 1
  14773. + xsrl %r5, 21 ; ؿ(%r7) >> 24
  14774. +
  14775. + xcmp %r5, 0x3ff ; if ؿ(%r7) < 0x3ff then goto end
  14776. + jrlt.d end ; case: round to zero (underflow)
  14777. + ld.w %r4, 0 ; (%r4) <- 0 clear output register
  14778. +
  14779. + xcmp %r5, 0x41f ; if (%r4) >= 0x41f then integer overflow
  14780. + ld.w %r4, 1 ; (%r4) <- 1
  14781. + jrge.d overflow
  14782. + rr %r4, 1 ; (%r4) = 0x8000 0000
  14783. +
  14784. + ; isolate mantissa
  14785. + ld.w %r4, %r7 ; (%r4) <- (%r7)
  14786. + xand %r4, 0xfffff ; (%r4) <- (%r4) & 0xfffff) clear first 12 bits of %r7
  14787. + xoor %r4, 0x100000 ; (%r4) <- ((%r4) | 0x100000) add implied bit
  14788. + xld.w %r9, 0x413 ;shift(%r9) <- 0x413
  14789. +
  14790. + cmp %r5, %r9 ; 0x3ff + 31 - 11 = 0x413
  14791. + jrgt shftleft ; if ؿ(%r7) > 0x413 then shift left
  14792. +
  14793. + ; case: exp <= 0x413
  14794. + sub %r9, %r5 ; %r9 = 0x413 - exp (max = 20)
  14795. +
  14796. + ;xsrl %r4, %r3 ; final shift of result
  14797. + ; 32-bit variable shift routine
  14798. +L1:
  14799. + cmp %r9, 8 ; if shift(%r9) <= 8 then goto L2
  14800. + jrle L2
  14801. +
  14802. + srl %r4, 8 ; (%r4) >> 8
  14803. + jp.d L1
  14804. + sub %r9, 8 ; shift(%r9) = shift(%r9) - 8
  14805. +
  14806. +L2:
  14807. + jp.d finish
  14808. + srl %r4, %r9 ; (%r4) >> shift(%r9) last shift
  14809. +
  14810. +shftleft:
  14811. + sub %r5, %r9 ; ؿ(%r5) = ؿ(%r5) - shift(%r9=0x413) (max = 11)
  14812. +
  14813. + ; {result, man1_2} << 0x413-exp
  14814. + ;xsll %r4, %r1 ; shift high 32-bits to the left x bits (shift amount = x)
  14815. + ;xrl %r6, %r1 ; rotate low 32-bits to the left x bits
  14816. + ;xsll %r2, %r1 ; make a mask for first 32-x bits --> %r2 = 111...000
  14817. +
  14818. + ld.w %r8, -1 ; mask(%r8) = 0xffff ffff
  14819. + ; 64-bit variable shift and rotate routine
  14820. +L3:
  14821. + cmp %r5, 8 ; if ؿ(%r5) <= 8 then goto L2
  14822. + jrle L4
  14823. +
  14824. + sll %r4, 8 ; (%r4) << 8
  14825. + rl %r6, 8 ; (%r6) rotate << 8
  14826. + sll %r8, 8 ; mask(%r8) << 8
  14827. + jp.d L3
  14828. + sub %r5, 8 ; ؿ(%r5) = ؿ(%r5) - 8
  14829. +
  14830. +L4:
  14831. + sll %r4, %r5 ; (%r4) << ؿ(%r5)
  14832. + rl %r6, %r5 ; (%r6) rotate << ؿ(%r5)
  14833. + sll %r8, %r5 ; mask(%r8) << ؿ(%r5)
  14834. +
  14835. + not %r5, %r8 ; ؿ(%r5) = ~mask(%r8) flip mask for last x bits --> %r9 = 000...111 (mask)
  14836. + and %r5, %r6 ; ؿ(%r5) = ؿ(%r5) & (%r6) isolate last x bits of %r6
  14837. + or %r4, %r5 ; (%r4) = (%r4) & ؿ(%r5) add last x bits of %r6 to %r4
  14838. + and %r6, %r8 ; (%r6) = (%r6) & mask(%r8) keep the high 32-x bits of %r6
  14839. +
  14840. +finish:
  14841. + cmp %r0, 0 ; if ӥå(%r0) = 0 then goto end
  14842. + jreq end
  14843. +
  14844. + ; case: sign = 1
  14845. + not %r4, %r4 ; (%r4) = ~(%r4)
  14846. + jp.d end
  14847. + add %r4, 1 ; (%r4) = (%r4) + 1 ()
  14848. +
  14849. +overflow:
  14850. + cmp %r0, 0 ; check sign
  14851. + jrne end ; if ӥå(%r0) = 1 then goto end
  14852. + ld.w %r4, 0 ; Сեϡ0xffffffff֤褦˽01/01/17 Hinokuchi
  14853. + not %r4, %r4 ; ӥå(%r0) <- 0xffffffff
  14854. +
  14855. +end:
  14856. + popn %r0 ; %r0
  14857. + ret
  14858. diff --git a/gcc/config/c33/libgcc/fixsfi.lst b/gcc/config/c33/libgcc/fixsfi.lst
  14859. new file mode 100644
  14860. index 0000000..01e67e8
  14861. --- /dev/null
  14862. +++ b/gcc/config/c33/libgcc/fixsfi.lst
  14863. @@ -0,0 +1,110 @@
  14864. +GAS LISTING fixsfi.s page 1
  14865. +
  14866. +
  14867. + 1 ;*********************************************
  14868. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  14869. + 3 ;* ALL RIGHTS RESERVED
  14870. + 4 ;*
  14871. + 5 ;* filename : fixsfui.s
  14872. + 6 ;*
  14873. + 7 ;* Change type: Single float --> Unsigned integer
  14874. + 8 ;* --> Signed integer
  14875. + 9 ;* input: %r6
  14876. + 10 ;* output: %r4
  14877. + 11 ;*
  14878. + 12 ;* Begin 1996/09/12 V. Chan
  14879. + 13 ;* ѹ 2001/01/17 O.Hinokuchi
  14880. + 14 ;* 쥸ִ
  14881. + 15 ;* __fixunssfsi եʬΤ
  14882. + 16 ;* gasб 2001/10/15 watanabe
  14883. + 17 ;*********************************************
  14884. + 18
  14885. + 19 .section .text
  14886. + 20 .align 1
  14887. + 21 .global __fixsfsi
  14888. + 22
  14889. + 23 ;==============================================
  14890. + 24 ;쥸
  14891. + 25 ; %r4:(int or uint)
  14892. + 26 ; %r5:ӥå(0(+) or 1(-))
  14893. + 27 ; %r6:(float)
  14894. + 28 ; %r7:ؿ(8bit)
  14895. + 29 ; %r8:shift
  14896. + 30 ;
  14897. + 31 ;==============================================
  14898. + 32
  14899. + 33 __fixsfsi:
  14900. + 34
  14901. + 35 0000 652E ld.w %r5, %r6 ; ӥå(%r5) <- (%r6)
  14902. + 36 0002 159C rl %r5, 1 ; ӥå(%r5) >> 31 Ʊ
  14903. + 37 0004 1570 and %r5, 1 ; ӥå(%r5) = ӥå(%r5) & 1
  14904. + 38
  14905. + 39 0006 672E ld.w %r7, %r6 ; ؿ(%r7) <- (%r6)
  14906. + 40 0008 178C sll %r7, 1 ; ؿ(%r7) << 1
  14907. + 41 000a 87888788 xsrl %r7, 24 ; ؿ(%r7) >> 24
  14908. + 41 8788
  14909. + 42 ;
  14910. + 43 ;
  14911. + 44 ;
  14912. + 45 0010 01C0F76B xcmp %r7, 0x7f ; if ؿ(%r7) < 0x7f then goto end
  14913. + 46 0014 240D jrlt.d end ; round to zero case (integer underflow)
  14914. + 47 0016 046C ld.w %r4, 0 ; (%r4) <- 0
  14915. + 48
  14916. + 49 0018 02C0F769 xcmp %r7, 0x9f ; if ؿ(%r7) >= 0x9f then integer overflow
  14917. + 50 001c 146C ld.w %r4, 1 ; (%r4) <- 1
  14918. + 51 001e 1C0B jrge.d overflow
  14919. + 52 0020 1498 rr %r4, 1 ; (%r4) <- 0x8000 0000
  14920. + 53
  14921. + 54 ; isolate mantissa
  14922. + 55 0022 642E ld.w %r4,%r6 ; (%r4) <- (%r6)
  14923. + 56 0024 0FC0FFDF xand %r4,0x7fffff ; (%r4) <- (%r4) & 0x7fffff) clear first 9 bits of %r6
  14924. + GAS LISTING fixsfi.s page 2
  14925. +
  14926. +
  14927. + 56 F473
  14928. + 57 002a 10C000C0 xoor %r4,0x800000 ; (%r4) <- ((%r4) | 0x800000) add implied bit
  14929. + 57 0474
  14930. + 58
  14931. + 59 0030 02C0686D xld.w %r8, 0x96 ;shift(%r8) <- 0x96
  14932. + 60
  14933. + 61 0034 872A cmp %r7, %r8 ; 0x7f + 31 - 8 = 0x96
  14934. + 62 0036 0908 jrgt shftleft ; if ؿ(%r7) > 0x96 then goto shftleft
  14935. + 63
  14936. + 64 ; case: exp <= 0x96
  14937. + 65 0038 7826 sub %r8, %r7 ; shift(%r8) = shift(%r8=0x96) - ؿ(%r7) (max = 23)
  14938. + 66
  14939. + 67 ; 32-bit variable right shift routine (faster than xsrl)
  14940. + 68 shift:
  14941. + 69 003a 8868 cmp %r8, 8 ; if shift(%r8) <= 8 then goto done
  14942. + 70 003c 040E jrle done
  14943. + 71
  14944. + 72 ; case: shift > 8
  14945. + 73 003e 8864 sub %r8, 8 ; shift(%r8) = shift(%r8) - 8
  14946. + 74 0040 FD1F jp.d shift
  14947. + 75 0042 8488 srl %r4, 8 ; (%r4) >> 8
  14948. + 76
  14949. + 77 done: ; case: shift(%r8) < 8
  14950. + 78 0044 041F jp.d finish
  14951. + 79 0046 8489 srl %r4, %r8 ; (%r4) >> shift(%r8) final shift of result
  14952. + 80
  14953. + 81 shftleft:
  14954. + 82 0048 8726 sub %r7, %r8 ; ؿ(%r7) = ؿ(%r7) - shift(%r8=0x96) (max = 8)
  14955. + 83
  14956. + 84 004a 748D sll %r4, %r7 ; (%r4) >> ؿ(%r7) shift mantissa to the left 8-shift bits
  14957. + 85
  14958. + 86 finish:
  14959. + 87 004c 0568 cmp %r5, 0 ; if ӥå(%r5) = 0 then goto end
  14960. + 88 004e 0718 jreq end
  14961. + 89
  14962. + 90 ; case: sign = 1
  14963. + 91 0050 443E not %r4, %r4 ; (%r4) = ~(%r4)
  14964. + 92 0052 051F jp.d end
  14965. + 93 0054 1460 add %r4, 1 ; (%r4) = (%r4) + 1 ()
  14966. + 94
  14967. + 95 overflow:
  14968. + 96 0056 0568 cmp %r5, 0 ; check sign
  14969. + 97 0058 021A jrne end ; if ӥå(%r5) = 1 then goto end
  14970. + 98 005a 443E not %r4, %r4 ; (%r4) <- 0xffffffff
  14971. + 99
  14972. + 100 end:
  14973. + 101 005c 4006 ret
  14974. diff --git a/gcc/config/c33/libgcc/fixsfi.s b/gcc/config/c33/libgcc/fixsfi.s
  14975. new file mode 100644
  14976. index 0000000..74a29d4
  14977. --- /dev/null
  14978. +++ b/gcc/config/c33/libgcc/fixsfi.s
  14979. @@ -0,0 +1,101 @@
  14980. +;*********************************************
  14981. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  14982. +;* ALL RIGHTS RESERVED
  14983. +;*
  14984. +;* filename : fixsfui.s
  14985. +;*
  14986. +;* Change type: Single float --> Unsigned integer
  14987. +;* --> Signed integer
  14988. +;* input: %r6
  14989. +;* output: %r4
  14990. +;*
  14991. +;* Begin 1996/09/12 V. Chan
  14992. +;* ѹ 2001/01/17 O.Hinokuchi
  14993. +;* 쥸ִ
  14994. +;* __fixunssfsi եʬΤ
  14995. +;* gasб 2001/10/15 watanabe
  14996. +;*********************************************
  14997. +
  14998. +.section .text
  14999. +.align 1
  15000. +.global __fixsfsi
  15001. +
  15002. +;==============================================
  15003. +;쥸
  15004. +; %r4:(int or uint)
  15005. +; %r5:ӥå(0(+) or 1(-))
  15006. +; %r6:(float)
  15007. +; %r7:ؿ(8bit)
  15008. +; %r8:shift
  15009. +;
  15010. +;==============================================
  15011. +
  15012. +__fixsfsi:
  15013. +
  15014. + ld.w %r5, %r6 ; ӥå(%r5) <- (%r6)
  15015. + rl %r5, 1 ; ӥå(%r5) >> 31 Ʊ
  15016. + and %r5, 1 ; ӥå(%r5) = ӥå(%r5) & 1
  15017. +
  15018. + ld.w %r7, %r6 ; ؿ(%r7) <- (%r6)
  15019. + sll %r7, 1 ; ؿ(%r7) << 1
  15020. + xsrl %r7, 24 ; ؿ(%r7) >> 24
  15021. + ;
  15022. + ;
  15023. + ;
  15024. + xcmp %r7, 0x7f ; if ؿ(%r7) < 0x7f then goto end
  15025. + jrlt.d end ; round to zero case (integer underflow)
  15026. + ld.w %r4, 0 ; (%r4) <- 0
  15027. +
  15028. + xcmp %r7, 0x9f ; if ؿ(%r7) >= 0x9f then integer overflow
  15029. + ld.w %r4, 1 ; (%r4) <- 1
  15030. + jrge.d overflow
  15031. + rr %r4, 1 ; (%r4) <- 0x8000 0000
  15032. +
  15033. + ; isolate mantissa
  15034. + ld.w %r4,%r6 ; (%r4) <- (%r6)
  15035. + xand %r4,0x7fffff ; (%r4) <- (%r4) & 0x7fffff) clear first 9 bits of %r6
  15036. + xoor %r4,0x800000 ; (%r4) <- ((%r4) | 0x800000) add implied bit
  15037. +
  15038. + xld.w %r8, 0x96 ;shift(%r8) <- 0x96
  15039. +
  15040. + cmp %r7, %r8 ; 0x7f + 31 - 8 = 0x96
  15041. + jrgt shftleft ; if ؿ(%r7) > 0x96 then goto shftleft
  15042. +
  15043. + ; case: exp <= 0x96
  15044. + sub %r8, %r7 ; shift(%r8) = shift(%r8=0x96) - ؿ(%r7) (max = 23)
  15045. +
  15046. + ; 32-bit variable right shift routine (faster than xsrl)
  15047. +shift:
  15048. + cmp %r8, 8 ; if shift(%r8) <= 8 then goto done
  15049. + jrle done
  15050. +
  15051. + ; case: shift > 8
  15052. + sub %r8, 8 ; shift(%r8) = shift(%r8) - 8
  15053. + jp.d shift
  15054. + srl %r4, 8 ; (%r4) >> 8
  15055. +
  15056. +done: ; case: shift(%r8) < 8
  15057. + jp.d finish
  15058. + srl %r4, %r8 ; (%r4) >> shift(%r8) final shift of result
  15059. +
  15060. +shftleft:
  15061. + sub %r7, %r8 ; ؿ(%r7) = ؿ(%r7) - shift(%r8=0x96) (max = 8)
  15062. +
  15063. + sll %r4, %r7 ; (%r4) >> ؿ(%r7) shift mantissa to the left 8-shift bits
  15064. +
  15065. +finish:
  15066. + cmp %r5, 0 ; if ӥå(%r5) = 0 then goto end
  15067. + jreq end
  15068. +
  15069. + ; case: sign = 1
  15070. + not %r4, %r4 ; (%r4) = ~(%r4)
  15071. + jp.d end
  15072. + add %r4, 1 ; (%r4) = (%r4) + 1 ()
  15073. +
  15074. +overflow:
  15075. + cmp %r5, 0 ; check sign
  15076. + jrne end ; if ӥå(%r5) = 1 then goto end
  15077. + not %r4, %r4 ; (%r4) <- 0xffffffff
  15078. +
  15079. +end:
  15080. + ret
  15081. diff --git a/gcc/config/c33/libgcc/fixsfui.lst b/gcc/config/c33/libgcc/fixsfui.lst
  15082. new file mode 100644
  15083. index 0000000..e372f06
  15084. --- /dev/null
  15085. +++ b/gcc/config/c33/libgcc/fixsfui.lst
  15086. @@ -0,0 +1,127 @@
  15087. +GAS LISTING fixsfui.s page 1
  15088. +
  15089. +
  15090. + 1 ;*********************************************
  15091. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  15092. + 3 ;* ALL RIGHTS RESERVED
  15093. + 4 ;*
  15094. + 5 ;* filename : fixsfui.s
  15095. + 6 ;*
  15096. + 7 ;* Change type: Single float --> Unsigned integer
  15097. + 8 ;* --> Signed integer
  15098. + 9 ;* input: %r6
  15099. + 10 ;* output: %r4
  15100. + 11 ;*
  15101. + 12 ;* Begin 1996/09/12 V. Chan
  15102. + 13 ;* ѹ 2001/01/17 O.Hinokuchi
  15103. + 14 ;* 쥸֤
  15104. + 15 ;* եʬ __fixsfsi -> fixsfis.s ˰ư
  15105. + 16 ;* ޥʥͤΥ㥹Ȥ Сեϡ
  15106. + 17 ;* 0xffffffff֤褦˽(gccνƱ)
  15107. + 18 ;* gasб 2001/10/15 watanabe
  15108. + 19 ;*********************************************
  15109. + 20
  15110. + 21 .section .text
  15111. + 22 .align 1
  15112. + 23 .global __fixunssfsi
  15113. + 24
  15114. + 25 ;==============================================
  15115. + 26 ;쥸
  15116. + 27 ; %r4:(int or uint)
  15117. + 28 ; %r5:ӥå(0(+) or 1(-))
  15118. + 29 ; %r6:(float)
  15119. + 30 ; %r7:ؿ(8bit)
  15120. + 31 ; %r8:shift
  15121. + 32 ;
  15122. + 33 ;==============================================
  15123. + 34
  15124. + 35 __fixunssfsi:
  15125. + 36
  15126. + 37 0000 642E ld.w %r4, %r6
  15127. + 38 0002 00D000C0 xand %r4, 0x80000000 ; if( ӥå == 0 )
  15128. + 38 0470
  15129. + 39
  15130. + 40 0008 00C000C0 xjreq start ; goto __start
  15131. + 40 0318
  15132. + 41 ; else
  15133. + 42 000e 046C xld.w %r4, 0x0 ; return 0
  15134. + 43 0010 4006 ret
  15135. + 44 start:
  15136. + 45
  15137. + 46 0012 652E ld.w %r5, %r6 ; ӥå(%r5) <- (%r6)
  15138. + 47 0014 159C rl %r5, 1 ; ӥå(%r5) >> 31 Ʊ
  15139. + 48 0016 1570 and %r5, 1 ; ӥå(%r5) = ӥå(%r5) & 1
  15140. + 49
  15141. + 50 0018 672E ld.w %r7, %r6 ; ؿ(%r7) <- (%r6)
  15142. + 51 001a 178C sll %r7, 1 ; ؿ(%r7) << 1
  15143. + 52 001c 87888788 xsrl %r7, 24 ; ؿ(%r7) >> 24
  15144. + 52 8788
  15145. + 53 ;
  15146. + 54 ;
  15147. + GAS LISTING fixsfui.s page 2
  15148. +
  15149. +
  15150. + 55 ;
  15151. + 56 0022 01C0F76B xcmp %r7, 0x7f ; if ؿ(%r7) < 0x7f then goto end
  15152. + 57 0026 250D jrlt.d end ; round to zero case (integer underflow)
  15153. + 58 0028 046C ld.w %r4, 0 ; (%r4) <- 0
  15154. + 59
  15155. + 60 002a 02C0F769 xcmp %r7, 0x9f ; if ؿ(%r7) >= 0x9f then integer overflow
  15156. + 61 002e 146C ld.w %r4, 1 ; (%r4) <- 1
  15157. + 62 0030 1C0B jrge.d overflow
  15158. + 63 0032 1498 rr %r4, 1 ; (%r4) <- 0x8000 0000
  15159. + 64
  15160. + 65 ; isolate mantissa
  15161. + 66 0034 642E ld.w %r4,%r6 ; (%r4) <- (%r6)
  15162. + 67 0036 0FC0FFDF xand %r4,0x7fffff ; (%r4) <- (%r4) & 0x7fffff) clear first 9 bits of %r6
  15163. + 67 F473
  15164. + 68 003c 10C000C0 xoor %r4,0x800000 ; (%r4) <- ((%r4) | 0x800000) add implied bit
  15165. + 68 0474
  15166. + 69
  15167. + 70 0042 02C0686D xld.w %r8, 0x96 ;shift(%r8) <- 0x96
  15168. + 71
  15169. + 72 0046 872A cmp %r7, %r8 ; 0x7f + 31 - 8 = 0x96
  15170. + 73 0048 0908 jrgt shftleft ; if ؿ(%r7) > 0x96 then goto shftleft
  15171. + 74
  15172. + 75 ; case: exp <= 0x96
  15173. + 76 004a 7826 sub %r8, %r7 ; shift(%r8) = shift(%r8=0x96) - ؿ(%r7) (max = 23)
  15174. + 77
  15175. + 78 ; 32-bit variable right shift routine (faster than xsrl)
  15176. + 79 shift:
  15177. + 80 004c 8868 cmp %r8, 8 ; if shift(%r8) <= 8 then goto done
  15178. + 81 004e 040E jrle done
  15179. + 82
  15180. + 83 ; case: shift > 8
  15181. + 84 0050 8864 sub %r8, 8 ; shift(%r8) = shift(%r8) - 8
  15182. + 85 0052 FD1F jp.d shift
  15183. + 86 0054 8488 srl %r4, 8 ; (%r4) >> 8
  15184. + 87
  15185. + 88 done: ; case: shift(%r8) < 8
  15186. + 89 0056 041F jp.d finish
  15187. + 90 0058 8489 srl %r4, %r8 ; (%r4) >> shift(%r8) final shift of result
  15188. + 91
  15189. + 92 shftleft:
  15190. + 93 005a 8726 sub %r7, %r8 ; ؿ(%r7) = ؿ(%r7) - shift(%r8=0x96) (max = 8)
  15191. + 94
  15192. + 95 005c 748D sll %r4, %r7 ; (%r4) >> ؿ(%r7) shift mantissa to the left 8-shift bits
  15193. + 96
  15194. + 97 finish:
  15195. + 98 005e 0568 cmp %r5, 0 ; if ӥå(%r5) = 0 then goto end
  15196. + 99 0060 0818 jreq end
  15197. + 100
  15198. + 101 ; case: sign = 1
  15199. + 102 0062 443E not %r4, %r4 ; (%r4) = ~(%r4)
  15200. + 103 0064 061F jp.d end
  15201. + 104 0066 1460 add %r4, 1 ; (%r4) = (%r4) + 1 ()
  15202. + 105
  15203. + 106 overflow:
  15204. + 107 0068 0568 cmp %r5, 0 ; check sign
  15205. + 108 006a 031A jrne end ; if ӥå(%r5) = 1 then goto end
  15206. + 109 006c 046C ld.w %r4, 0 ; Сեϡ0xffffffff֤褦˽01/01/17 Hinokuchi
  15207. + GAS LISTING fixsfui.s page 3
  15208. +
  15209. +
  15210. + 110 006e 443E not %r4, %r4 ; (%r4) <- 0xffffffff
  15211. + 111
  15212. + 112 end:
  15213. + 113 0070 4006 ret
  15214. diff --git a/gcc/config/c33/libgcc/fixsfui.s b/gcc/config/c33/libgcc/fixsfui.s
  15215. new file mode 100644
  15216. index 0000000..f3ecb8c
  15217. --- /dev/null
  15218. +++ b/gcc/config/c33/libgcc/fixsfui.s
  15219. @@ -0,0 +1,113 @@
  15220. +;*********************************************
  15221. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  15222. +;* ALL RIGHTS RESERVED
  15223. +;*
  15224. +;* filename : fixsfui.s
  15225. +;*
  15226. +;* Change type: Single float --> Unsigned integer
  15227. +;* --> Signed integer
  15228. +;* input: %r6
  15229. +;* output: %r4
  15230. +;*
  15231. +;* Begin 1996/09/12 V. Chan
  15232. +;* ѹ 2001/01/17 O.Hinokuchi
  15233. +;* 쥸֤
  15234. +;* եʬ __fixsfsi -> fixsfis.s ˰ư
  15235. +;* ޥʥͤΥ㥹Ȥ Сեϡ
  15236. +;* 0xffffffff֤褦˽(gccνƱ)
  15237. +;* gasб 2001/10/15 watanabe
  15238. +;*********************************************
  15239. +
  15240. +.section .text
  15241. +.align 1
  15242. +.global __fixunssfsi
  15243. +
  15244. +;==============================================
  15245. +;쥸
  15246. +; %r4:(int or uint)
  15247. +; %r5:ӥå(0(+) or 1(-))
  15248. +; %r6:(float)
  15249. +; %r7:ؿ(8bit)
  15250. +; %r8:shift
  15251. +;
  15252. +;==============================================
  15253. +
  15254. +__fixunssfsi:
  15255. +
  15256. + ld.w %r4, %r6
  15257. + xand %r4, 0x80000000 ; if( ӥå == 0 )
  15258. +
  15259. + xjreq start ; goto __start
  15260. + ; else
  15261. + xld.w %r4, 0x0 ; return 0
  15262. + ret
  15263. +start:
  15264. +
  15265. + ld.w %r5, %r6 ; ӥå(%r5) <- (%r6)
  15266. + rl %r5, 1 ; ӥå(%r5) >> 31 Ʊ
  15267. + and %r5, 1 ; ӥå(%r5) = ӥå(%r5) & 1
  15268. +
  15269. + ld.w %r7, %r6 ; ؿ(%r7) <- (%r6)
  15270. + sll %r7, 1 ; ؿ(%r7) << 1
  15271. + xsrl %r7, 24 ; ؿ(%r7) >> 24
  15272. + ;
  15273. + ;
  15274. + ;
  15275. + xcmp %r7, 0x7f ; if ؿ(%r7) < 0x7f then goto end
  15276. + jrlt.d end ; round to zero case (integer underflow)
  15277. + ld.w %r4, 0 ; (%r4) <- 0
  15278. +
  15279. + xcmp %r7, 0x9f ; if ؿ(%r7) >= 0x9f then integer overflow
  15280. + ld.w %r4, 1 ; (%r4) <- 1
  15281. + jrge.d overflow
  15282. + rr %r4, 1 ; (%r4) <- 0x8000 0000
  15283. +
  15284. + ; isolate mantissa
  15285. + ld.w %r4,%r6 ; (%r4) <- (%r6)
  15286. + xand %r4,0x7fffff ; (%r4) <- (%r4) & 0x7fffff) clear first 9 bits of %r6
  15287. + xoor %r4,0x800000 ; (%r4) <- ((%r4) | 0x800000) add implied bit
  15288. +
  15289. + xld.w %r8, 0x96 ;shift(%r8) <- 0x96
  15290. +
  15291. + cmp %r7, %r8 ; 0x7f + 31 - 8 = 0x96
  15292. + jrgt shftleft ; if ؿ(%r7) > 0x96 then goto shftleft
  15293. +
  15294. + ; case: exp <= 0x96
  15295. + sub %r8, %r7 ; shift(%r8) = shift(%r8=0x96) - ؿ(%r7) (max = 23)
  15296. +
  15297. + ; 32-bit variable right shift routine (faster than xsrl)
  15298. +shift:
  15299. + cmp %r8, 8 ; if shift(%r8) <= 8 then goto done
  15300. + jrle done
  15301. +
  15302. + ; case: shift > 8
  15303. + sub %r8, 8 ; shift(%r8) = shift(%r8) - 8
  15304. + jp.d shift
  15305. + srl %r4, 8 ; (%r4) >> 8
  15306. +
  15307. +done: ; case: shift(%r8) < 8
  15308. + jp.d finish
  15309. + srl %r4, %r8 ; (%r4) >> shift(%r8) final shift of result
  15310. +
  15311. +shftleft:
  15312. + sub %r7, %r8 ; ؿ(%r7) = ؿ(%r7) - shift(%r8=0x96) (max = 8)
  15313. +
  15314. + sll %r4, %r7 ; (%r4) >> ؿ(%r7) shift mantissa to the left 8-shift bits
  15315. +
  15316. +finish:
  15317. + cmp %r5, 0 ; if ӥå(%r5) = 0 then goto end
  15318. + jreq end
  15319. +
  15320. + ; case: sign = 1
  15321. + not %r4, %r4 ; (%r4) = ~(%r4)
  15322. + jp.d end
  15323. + add %r4, 1 ; (%r4) = (%r4) + 1 ()
  15324. +
  15325. +overflow:
  15326. + cmp %r5, 0 ; check sign
  15327. + jrne end ; if ӥå(%r5) = 1 then goto end
  15328. + ld.w %r4, 0 ; Сեϡ0xffffffff֤褦˽01/01/17 Hinokuchi
  15329. + not %r4, %r4 ; (%r4) <- 0xffffffff
  15330. +
  15331. +end:
  15332. + ret
  15333. diff --git a/gcc/config/c33/libgcc/flosidf.lst b/gcc/config/c33/libgcc/flosidf.lst
  15334. new file mode 100644
  15335. index 0000000..dfe220f
  15336. --- /dev/null
  15337. +++ b/gcc/config/c33/libgcc/flosidf.lst
  15338. @@ -0,0 +1,107 @@
  15339. +GAS LISTING flosidf.s page 1
  15340. +
  15341. +
  15342. + 1 ;*********************************************
  15343. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  15344. + 3 ;* ALL RIGHTS RESERVED
  15345. + 4 ;*
  15346. + 5 ;* filename : flosidf.s
  15347. + 6 ;*
  15348. + 7 ;* Change type: Signed single integer --> Double float
  15349. + 8 ;* input: %r6
  15350. + 9 ;* output: (%r5, %r4)
  15351. + 10 ;*
  15352. + 11 ;* Begin 1996/09/12 V. Chan
  15353. + 12 ;* ѹ 2001/01/15 O.Hinokuchi
  15354. + 13 ;* 쥸ִ
  15355. + 14 ;* gasб 2001/10/15 watanabe
  15356. + 15 ;*
  15357. + 16 ;*********************************************
  15358. + 17
  15359. + 18 .section .text
  15360. + 19 .align 1
  15361. + 20 .global __floatsidf
  15362. + 21
  15363. + 22 ;==============================================
  15364. + 23 ;쥸
  15365. + 24 ; %r0:ӥå(0(+) or 1(-))
  15366. + 25 ; %r1:ؿ(8bit)
  15367. + 26 ; %r4:[L](double)
  15368. + 27 ; %r5:[H](double)
  15369. + 28 ; %r6:(int)/loop counter
  15370. + 29 ; %r8:temp
  15371. + 30 ; %r9:count/shift
  15372. + 31 ;==============================================
  15373. + 32
  15374. + 33 __floatsidf:
  15375. + 34 0000 0102 pushn %r1 ; %r0%r1
  15376. + 35
  15377. + 36 0002 056C ld.w %r5, 0 ; [H](%r5) <- 0
  15378. + 37
  15379. + 38 0004 0668 cmp %r6, 0 ; if (%r6) = 0 then goto end
  15380. + 39 0006 2819 jreq.d end
  15381. + 40 0008 046C ld.w %r4, 0 ; [L](%r4) <- 0
  15382. + 41
  15383. + 42 000a 006C ld.w %r0, 0 ; ӥå(%r0) <- 0
  15384. + 43 000c 652E ld.w %r5, %r6 ; [H](%r5) <- (%r6)
  15385. + 44 000e 582E ld.w %r8, %r5 ; temp(%r8) <- [H](%r5)
  15386. + 45
  15387. + 46 0010 0568 cmp %r5, 0 ; if [H](%r5) >= 0 then goto count
  15388. + 47 0012 060B jrge.d count
  15389. + 48 0014 066C ld.w %r6, 0 ; loop counter(%r6) <- 0
  15390. + 49
  15391. + 50 ; case: result1 < 0
  15392. + 51 0016 553E not %r5, %r5 ; [H](%r5) = ~[H](%r5) + 1
  15393. + 52 0018 1560 add %r5, 1
  15394. + 53 001a 106C ld.w %r0, 1 ; ӥå(%r0) <- 1
  15395. + 54 001c 582E ld.w %r8, %r5 ; temp(%r8) <- (%r4)
  15396. + 55
  15397. + 56 count: ; Ǿ̥ӥåȰָ
  15398. + 57 001e 898E scan1 %r9, %r8 ; count(%r9) <- temp(8)[b31b24]κǾ̥ӥåȰ
  15399. + GAS LISTING flosidf.s page 2
  15400. +
  15401. +
  15402. + 58 0020 0412 jruge continue ; Ǿ̥ӥåȤĤä->continue
  15403. + 59 0022 8660 add %r6, 8 ; loop counter(%r6) = loop counter(%r6) + 8
  15404. + 60 0024 FD1F jp.d count
  15405. + 61 0026 888C sll %r8, 8 ; temp(%r8) << 8
  15406. + 62
  15407. + 63 continue:
  15408. + 64 0028 6922 add %r9, %r6 ; count(%r9) = count(%r9) + loop counter(%r6)
  15409. + 65 002a F16D xld.w %r1, 31 ; ؿ(%r1) = 31 - count(%r9)
  15410. + 66 002c 9126 sub %r1, %r9
  15411. + 67
  15412. + 68 ; normalize result
  15413. + 69 002e 1960 add %r9, 1 ; shift(%r9) = count(%r9) + 1
  15414. + 70
  15415. + 71 ;xsll %r5, %r9 ; result1 << count + 1 (clear implied bit)
  15416. + 72 ; variable shift routine (faster than xsrl)
  15417. + 73 shift:
  15418. + 74 0030 8968 cmp %r9, 8 ; if shift <= 8 then goto done
  15419. + 75 0032 040E jrle done
  15420. + 76
  15421. + 77 ; case: shift > 8
  15422. + 78 0034 8964 sub %r9, 8 ; shift(%r9) = shift(%r9) - 8
  15423. + 79 0036 FD1F jp.d shift
  15424. + 80 0038 858C sll %r5, 8 ; [H](%r5) << 8
  15425. + 81
  15426. + 82 done: ; case: shift(%r9) <= 8
  15427. + 83 003a 958D sll %r5, %r9 ; [H](%r5) << shift(%r9)
  15428. + 84
  15429. + 85 003c 542E ld.w %r4, %r5 ; [L](%r4) <- [H](%r5)
  15430. + 86 003e 85884588 xsrl %r5, 12 ; [H](%r5) >> 12
  15431. + 87 0042 848C848C xsll %r4, 20 ; [L](%r4) << 20
  15432. + 87 448C
  15433. + 88
  15434. + 89 ; finishing steps
  15435. + 90 0048 0FC0F163 xadd %r1, 0x3ff ; ؿ(%r1) = ؿ(%r1) + 0x3ff(bias) (EXT33 Ve%r2)
  15436. + 91
  15437. + 92 004c 81984198 xrr %r1, 12 ; position exponent bits
  15438. + 93 0050 1536 or %r5, %r1 ; [H](%r5) | ؿ(%r1)
  15439. + 94
  15440. + 95 0052 1098 rr %r0, 1 ; position sign bit
  15441. + 96 0054 0536 or %r5, %r0 ; [H](%r5) | ӥå
  15442. + 97
  15443. + 98 end:
  15444. + 99 0056 4102 popn %r1 ; %r0%r1
  15445. + 100 0058 4006 ret
  15446. diff --git a/gcc/config/c33/libgcc/flosidf.s b/gcc/config/c33/libgcc/flosidf.s
  15447. new file mode 100644
  15448. index 0000000..4b7fb78
  15449. --- /dev/null
  15450. +++ b/gcc/config/c33/libgcc/flosidf.s
  15451. @@ -0,0 +1,100 @@
  15452. +;*********************************************
  15453. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  15454. +;* ALL RIGHTS RESERVED
  15455. +;*
  15456. +;* filename : flosidf.s
  15457. +;*
  15458. +;* Change type: Signed single integer --> Double float
  15459. +;* input: %r6
  15460. +;* output: (%r5, %r4)
  15461. +;*
  15462. +;* Begin 1996/09/12 V. Chan
  15463. +;* ѹ 2001/01/15 O.Hinokuchi
  15464. +;* 쥸ִ
  15465. +;* gasб 2001/10/15 watanabe
  15466. +;*
  15467. +;*********************************************
  15468. +
  15469. +.section .text
  15470. +.align 1
  15471. +.global __floatsidf
  15472. +
  15473. +;==============================================
  15474. +;쥸
  15475. +; %r0:ӥå(0(+) or 1(-))
  15476. +; %r1:ؿ(8bit)
  15477. +; %r4:[L](double)
  15478. +; %r5:[H](double)
  15479. +; %r6:(int)/loop counter
  15480. +; %r8:temp
  15481. +; %r9:count/shift
  15482. +;==============================================
  15483. +
  15484. +__floatsidf:
  15485. + pushn %r1 ; %r0%r1
  15486. +
  15487. + ld.w %r5, 0 ; [H](%r5) <- 0
  15488. +
  15489. + cmp %r6, 0 ; if (%r6) = 0 then goto end
  15490. + jreq.d end
  15491. + ld.w %r4, 0 ; [L](%r4) <- 0
  15492. +
  15493. + ld.w %r0, 0 ; ӥå(%r0) <- 0
  15494. + ld.w %r5, %r6 ; [H](%r5) <- (%r6)
  15495. + ld.w %r8, %r5 ; temp(%r8) <- [H](%r5)
  15496. +
  15497. + cmp %r5, 0 ; if [H](%r5) >= 0 then goto count
  15498. + jrge.d count
  15499. + ld.w %r6, 0 ; loop counter(%r6) <- 0
  15500. +
  15501. + ; case: result1 < 0
  15502. + not %r5, %r5 ; [H](%r5) = ~[H](%r5) + 1
  15503. + add %r5, 1
  15504. + ld.w %r0, 1 ; ӥå(%r0) <- 1
  15505. + ld.w %r8, %r5 ; temp(%r8) <- (%r4)
  15506. +
  15507. +count: ; Ǿ̥ӥåȰָ
  15508. + scan1 %r9, %r8 ; count(%r9) <- temp(8)[b31b24]κǾ̥ӥåȰ
  15509. + jruge continue ; Ǿ̥ӥåȤĤä->continue
  15510. + add %r6, 8 ; loop counter(%r6) = loop counter(%r6) + 8
  15511. + jp.d count
  15512. + sll %r8, 8 ; temp(%r8) << 8
  15513. +
  15514. +continue:
  15515. + add %r9, %r6 ; count(%r9) = count(%r9) + loop counter(%r6)
  15516. + xld.w %r1, 31 ; ؿ(%r1) = 31 - count(%r9)
  15517. + sub %r1, %r9
  15518. +
  15519. + ; normalize result
  15520. + add %r9, 1 ; shift(%r9) = count(%r9) + 1
  15521. +
  15522. + ;xsll %r5, %r9 ; result1 << count + 1 (clear implied bit)
  15523. + ; variable shift routine (faster than xsrl)
  15524. +shift:
  15525. + cmp %r9, 8 ; if shift <= 8 then goto done
  15526. + jrle done
  15527. +
  15528. + ; case: shift > 8
  15529. + sub %r9, 8 ; shift(%r9) = shift(%r9) - 8
  15530. + jp.d shift
  15531. + sll %r5, 8 ; [H](%r5) << 8
  15532. +
  15533. +done: ; case: shift(%r9) <= 8
  15534. + sll %r5, %r9 ; [H](%r5) << shift(%r9)
  15535. +
  15536. + ld.w %r4, %r5 ; [L](%r4) <- [H](%r5)
  15537. + xsrl %r5, 12 ; [H](%r5) >> 12
  15538. + xsll %r4, 20 ; [L](%r4) << 20
  15539. +
  15540. + ; finishing steps
  15541. + xadd %r1, 0x3ff ; ؿ(%r1) = ؿ(%r1) + 0x3ff(bias) (EXT33 Ve%r2)
  15542. +
  15543. + xrr %r1, 12 ; position exponent bits
  15544. + or %r5, %r1 ; [H](%r5) | ؿ(%r1)
  15545. +
  15546. + rr %r0, 1 ; position sign bit
  15547. + or %r5, %r0 ; [H](%r5) | ӥå
  15548. +
  15549. +end:
  15550. + popn %r1 ; %r0%r1
  15551. + ret
  15552. diff --git a/gcc/config/c33/libgcc/flosisf.lst b/gcc/config/c33/libgcc/flosisf.lst
  15553. new file mode 100644
  15554. index 0000000..de8877b
  15555. --- /dev/null
  15556. +++ b/gcc/config/c33/libgcc/flosisf.lst
  15557. @@ -0,0 +1,102 @@
  15558. +GAS LISTING flosisf.s page 1
  15559. +
  15560. +
  15561. + 1 ;*********************************************
  15562. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  15563. + 3 ;* ALL RIGHTS RESERVED
  15564. + 4 ;*
  15565. + 5 ;* filename : flosisf.s
  15566. + 6 ;*
  15567. + 7 ;* Change type: Signed single integer --> Single float
  15568. + 8 ;* input: %r6
  15569. + 9 ;* output: %r4
  15570. + 10 ;*
  15571. + 11 ;* Begin 1996/09/12 V. Chan
  15572. + 12 ;* ѹ 2001/01/15 O.Hinokuchi
  15573. + 13 ;* 쥸ִ
  15574. + 14 ;* gasб 2001/10/15 watanabe
  15575. + 15 ;*
  15576. + 16 ;*********************************************
  15577. + 17
  15578. + 18 .section .text
  15579. + 19 .align 1
  15580. + 20 .global __floatsisf
  15581. + 21
  15582. + 22 ;==============================================
  15583. + 23 ;쥸
  15584. + 24 ; %r0:ӥå(0(+) or 1(-))
  15585. + 25 ; %r1:ؿ(8bit)
  15586. + 26 ; %r4:(float)
  15587. + 27 ; %r6:(int)/loop counter
  15588. + 28 ; %r8:temp
  15589. + 29 ; %r9:count/shift
  15590. + 30 ;==============================================
  15591. + 31
  15592. + 32 __floatsisf:
  15593. + 33
  15594. + 34 0000 0102 pushn %r1 ; %r0%r1
  15595. + 35
  15596. + 36 0002 0668 cmp %r6, 0 ; if (6) = 0 then goto end
  15597. + 37 0004 2419 jreq.d end
  15598. + 38 0006 046C ld.w %r4, 0 ; (4) <- 0
  15599. + 39
  15600. + 40 0008 006C ld.w %r0, 0 ; ӥå(%r0) <- 0
  15601. + 41 000a 642E ld.w %r4, %r6 ; (%r4) <- (6)
  15602. + 42 000c 682E ld.w %r8, %r6 ; count(%r8) <- (6)
  15603. + 43
  15604. + 44 000e 0468 cmp %r4, 0 ; if (%r4) >= 0 then goto count
  15605. + 45 0010 060B jrge.d count
  15606. + 46 0012 066C ld.w %r6, 0 ; loop counter(%r6) <- 0
  15607. + 47
  15608. + 48 ; case: (%r4) < 0
  15609. + 49 0014 443E not %r4, %r4 ; (%r4) = ~(%r4) + 1
  15610. + 50 0016 1460 add %r4, 1
  15611. + 51 0018 106C ld.w %r0, 1 ; ӥå(%r0) <- 1
  15612. + 52 001a 482E ld.w %r8, %r4 ; temp(%r8) <- (%r4)
  15613. + 53
  15614. + 54 count: ; Ǿ̥ӥåȰָ
  15615. + 55 001c 898E scan1 %r9, %r8 ; count(%r9) <- temp(8)[b31b24]κǾ̥ӥåȰ
  15616. + 56 001e 0412 jruge continue ; Ǿ̥ӥåȤĤä->continue
  15617. + 57 0020 8660 add %r6, 8 ; loop counter(%r6) = loop counter(%r6) + 8
  15618. + GAS LISTING flosisf.s page 2
  15619. +
  15620. +
  15621. + 58 0022 FD1F jp.d count
  15622. + 59 0024 888C sll %r8, 8 ; temp(%r8) << 8
  15623. + 60
  15624. + 61 continue:
  15625. + 62 0026 6922 add %r9, %r6 ; count(%r9) = count(%r9) + loop counter(%r6)
  15626. + 63 0028 F16D ld.w %r1, 31 ; ؿ(%r1) = 31 - count(%r9)
  15627. + 64 002a 9126 sub %r1, %r9
  15628. + 65
  15629. + 66 ; normalize result
  15630. + 67 002c 1960 add %r9, 1 ; shift(%r9) = count(%r9) + 1
  15631. + 68
  15632. + 69 ;xsll %r4, %r7 ; result << count + 1 (clear implied bit)
  15633. + 70 ; variable shift routine (faster than xsrl)
  15634. + 71 shift:
  15635. + 72 002e 8968 cmp %r9, 8 ; if shift(%r9) <= 8 then goto done
  15636. + 73 0030 040E jrle done
  15637. + 74
  15638. + 75 ; case: shift(%r9) > 8
  15639. + 76 0032 8964 sub %r9, 8 ; shift(%r9) = shift(%r9) - 8
  15640. + 77 0034 FD1F jp.d shift
  15641. + 78 0036 848C sll %r4, 8 ; (%r4) << 8
  15642. + 79
  15643. + 80 done: ; case: shift(%r9) < 8
  15644. + 81 0038 948D sll %r4, %r9 ; (%r4) << shift(%r9)
  15645. + 82
  15646. + 83 003a 84881488 xsrl %r4, 9 ; (%r4) >> 9 (normal position)
  15647. + 84
  15648. + 85 ; finishing steps
  15649. + 86 003e 01C0F163 xadd %r1, 0x7f ; ؿ(%r1) = ؿ(%r1) + 0x7f(bias) (EXT33 Ve%r2)
  15650. + 87
  15651. + 88 0042 81981198 xrr %r1, 9 ; position exponent bits
  15652. + 89 0046 1436 or %r4, %r1 ; (%r4) | ؿ(%r1)
  15653. + 90
  15654. + 91 0048 1098 rr %r0, 1 ; position sign bit
  15655. + 92 004a 0436 or %r4, %r0 ; (%r4) | ӥå
  15656. + 93
  15657. + 94 end:
  15658. + 95 004c 4102 popn %r1 ; %r0%r1
  15659. + 96 004e 4006 ret
  15660. diff --git a/gcc/config/c33/libgcc/flosisf.s b/gcc/config/c33/libgcc/flosisf.s
  15661. new file mode 100644
  15662. index 0000000..580baba
  15663. --- /dev/null
  15664. +++ b/gcc/config/c33/libgcc/flosisf.s
  15665. @@ -0,0 +1,96 @@
  15666. +;*********************************************
  15667. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  15668. +;* ALL RIGHTS RESERVED
  15669. +;*
  15670. +;* filename : flosisf.s
  15671. +;*
  15672. +;* Change type: Signed single integer --> Single float
  15673. +;* input: %r6
  15674. +;* output: %r4
  15675. +;*
  15676. +;* Begin 1996/09/12 V. Chan
  15677. +;* ѹ 2001/01/15 O.Hinokuchi
  15678. +;* 쥸ִ
  15679. +;* gasб 2001/10/15 watanabe
  15680. +;*
  15681. +;*********************************************
  15682. +
  15683. +.section .text
  15684. +.align 1
  15685. +.global __floatsisf
  15686. +
  15687. +;==============================================
  15688. +;쥸
  15689. +; %r0:ӥå(0(+) or 1(-))
  15690. +; %r1:ؿ(8bit)
  15691. +; %r4:(float)
  15692. +; %r6:(int)/loop counter
  15693. +; %r8:temp
  15694. +; %r9:count/shift
  15695. +;==============================================
  15696. +
  15697. +__floatsisf:
  15698. +
  15699. + pushn %r1 ; %r0%r1
  15700. +
  15701. + cmp %r6, 0 ; if (6) = 0 then goto end
  15702. + jreq.d end
  15703. + ld.w %r4, 0 ; (4) <- 0
  15704. +
  15705. + ld.w %r0, 0 ; ӥå(%r0) <- 0
  15706. + ld.w %r4, %r6 ; (%r4) <- (6)
  15707. + ld.w %r8, %r6 ; count(%r8) <- (6)
  15708. +
  15709. + cmp %r4, 0 ; if (%r4) >= 0 then goto count
  15710. + jrge.d count
  15711. + ld.w %r6, 0 ; loop counter(%r6) <- 0
  15712. +
  15713. + ; case: (%r4) < 0
  15714. + not %r4, %r4 ; (%r4) = ~(%r4) + 1
  15715. + add %r4, 1
  15716. + ld.w %r0, 1 ; ӥå(%r0) <- 1
  15717. + ld.w %r8, %r4 ; temp(%r8) <- (%r4)
  15718. +
  15719. +count: ; Ǿ̥ӥåȰָ
  15720. + scan1 %r9, %r8 ; count(%r9) <- temp(8)[b31b24]κǾ̥ӥåȰ
  15721. + jruge continue ; Ǿ̥ӥåȤĤä->continue
  15722. + add %r6, 8 ; loop counter(%r6) = loop counter(%r6) + 8
  15723. + jp.d count
  15724. + sll %r8, 8 ; temp(%r8) << 8
  15725. +
  15726. +continue:
  15727. + add %r9, %r6 ; count(%r9) = count(%r9) + loop counter(%r6)
  15728. + ld.w %r1, 31 ; ؿ(%r1) = 31 - count(%r9)
  15729. + sub %r1, %r9
  15730. +
  15731. + ; normalize result
  15732. + add %r9, 1 ; shift(%r9) = count(%r9) + 1
  15733. +
  15734. + ;xsll %r4, %r7 ; result << count + 1 (clear implied bit)
  15735. + ; variable shift routine (faster than xsrl)
  15736. +shift:
  15737. + cmp %r9, 8 ; if shift(%r9) <= 8 then goto done
  15738. + jrle done
  15739. +
  15740. + ; case: shift(%r9) > 8
  15741. + sub %r9, 8 ; shift(%r9) = shift(%r9) - 8
  15742. + jp.d shift
  15743. + sll %r4, 8 ; (%r4) << 8
  15744. +
  15745. +done: ; case: shift(%r9) < 8
  15746. + sll %r4, %r9 ; (%r4) << shift(%r9)
  15747. +
  15748. + xsrl %r4, 9 ; (%r4) >> 9 (normal position)
  15749. +
  15750. + ; finishing steps
  15751. + xadd %r1, 0x7f ; ؿ(%r1) = ؿ(%r1) + 0x7f(bias) (EXT33 Ve%r2)
  15752. +
  15753. + xrr %r1, 9 ; position exponent bits
  15754. + or %r4, %r1 ; (%r4) | ؿ(%r1)
  15755. +
  15756. + rr %r0, 1 ; position sign bit
  15757. + or %r4, %r0 ; (%r4) | ӥå
  15758. +
  15759. +end:
  15760. + popn %r1 ; %r0%r1
  15761. + ret
  15762. diff --git a/gcc/config/c33/libgcc/libgcc.a b/gcc/config/c33/libgcc/libgcc.a
  15763. new file mode 100644
  15764. index 0000000000000000000000000000000000000000..ede81a7c5409425fc75ee043f60f721169ab364d
  15765. GIT binary patch
  15766. literal 21742
  15767. zcmeHPe{37qeSiEV(UdGp6eUrzCrY%$I9zg-D2Z0wlyz(;v0E>7Y&Uj_tfH)=Oxb5q
  15768. z7AeQcf-aIMiE5}cN$pr^<<0GcbtsA;%eu}Tf`Ti8q9}$o8-lF^g2fBEqU-uc>Lg3D
  15769. zuFXE*d-upEnpdB**xiOcfxP#*``)|9yYKh&ecyNAr_S4lCr6So&xbnJmfoI7-{8RD
  15770. zZPCGwjvoDx{N2&f--82siF+7hzr&dA75-Uwm@)d)z06qCi;T798Ebbl*6}^YHfI?N
  15771. zy}(#F$k?rIjP=AA>%(^7r;L60JB)3I%#I&1w(D1n-Tf)XKK3yG{9X@Z^!db(`Dgzz
  15772. z#`Yf@8X8trb+nHS4W*}!@Cx>%#U5T!$4>D>sPH|B)0xCL#MIFUP8}UNF`*jUG;POD
  15773. ztE1^LUYi<Emq1$HEr6C9&ZNiGQIhBNG}TW`Y5c0F@T-m|j`9nllGd-B9vL2w_Cq)`
  15774. zIW<0l>*#x_n`88wri!%_Db?6jtl?O)D8*|yX6!O*{O%|z@obCFbfBYSpogC4Kz~2J
  15775. zdwY7KROuZYh>B<Whj;G1%Vx9T(egsI5@KwhgYWOxH(QvSxfpwi71o`0*qL@xX;^8P
  15776. zc<%@Az505(VWMHVKH9MIl;U0SPQ3Szw9h*cT<(YlS0I<4&Q0g;&0TtxO#})*PuEBB
  15777. zeVi3+g+b5fmB##RZZ>xy_s*+<!t3ck;f?fczAxVsoz3;-oQiM7XI#TO;YEAi6-emk
  15778. zwt4uqeG|Ur?NQ%KZ@8v*O7SWEAyzneTve$3Mvu4stkSRe^nF>Srk0;0+9DZSyS=~)
  15779. zcFk6J@6|U`wxpx=?#NA12ex}6H%FaX^$+RSI0|p3v&&t$Qg)>a*BbE;xVtJI^C`Vb
  15780. z>6h*dIg|FbMwJyD$7*U%Db<=|bT;X%o6r3+FsnuvKid9gs!y3sR$<S=ayIu1eec$1
  15781. z`WJV`(vfKNLxH;^K9lS8ha70zhqj$)ds$hhIY+Z-JBPNj>h8sc_BT?ylq}lL<rbG`
  15782. z(KhYf^UTi0{@9tw?&xh1n=-x9x#GYx;dk1u1o8a3!p(kPvcAohT-WB**52g@W23R=
  15783. z_)QmG?a#z=F@Jo|#m=O=ZS7rEm27ZIIeXES^tqk2&g4FSz5A1~T`^zWu619eR-27h
  15784. zn<tu=<I(1oX63N52Tu%tn`{c{h%M=A`)2aiwp#)X+BcIo`&(<jsXiHYx*Jq`pjEk?
  15785. zdRm#s@0!bJS7!3R2+XUACH4G~rOmOOk%4Geq#^KR$d_x>4n!K4`=d>{hB#?lRqd~S
  15786. zzzQzS9dPPT`>pi!@*T@f(JBQ!Ku;3Uo%ZcjOi4d<A~Sph+sq{2CPgg+T4Bm$LK{|i
  15787. zRUOU@Gv!D+%`L^+_eO}3omCm)WM8k@4S<cPcB1Yq?Pi;*8S4V3^XPm!R*TOq1~$x<
  15788. zHH!-NQxP^DK^-K`#9=eJ21y20y}hkeF^Xu9wxX|e=m~V_CG12u83<qRUp=<#@DbNU
  15789. zmBsM`;2?@cv{&3wq2eh13VzVBrbTMssY`sT*dZJ9K=k=yTQ=5+`peSs7Q)i;4%B}l
  15790. z;Vr1YF5wTM{{3QSZEO%YBjJw#4@!6!@O}w@9Qcfc_X9sG;roHTQvW^;?2)hvT)N>l
  15791. z1_#Nyq~oN7_euC6;6Vw`0B0l&r_H`A;m-qqRl;8Yo|o{KfQ8Q1<8FTySQNs4Apo}Y
  15792. z+*#^WViFGXL6$h(tHEF*3_h8Sq{cI2<5LNCG?6(mJRV_i&WY0#3_f!>GnN`>`p$H6
  15793. zG;^YtrITZ$8QK6vIKpP^=s1aE4}JGCc)>CK)RENGc*bbyRDzACCQl4&V-F|T=-BvJ
  15794. zI>{#W_L#;ul?E4v!+rq2yJ{2vL7zsw+Nj4-cN=v+4yoXK;bANK-ag$G!~MoRSM$B!
  15795. zHS|LG-fFTY_}*&xUPs}rR9vZFsh@Bwle)(pHhe6+Y?u{T;VDnr@T;@A4&{KpFX!nE
  15796. zd)7ay_?5v>ZjAgRE6jU5?SqORIHR~~JM?{zv~PeXd^c5(<8F=o;nR_M-5;KdEJU00
  15797. zEqRyL8{XvK;I<|GieqE1(x}dcWS>?S=+@vrH~JO7ifh3mEx;q?)P=<+ts`9HuTNID
  15798. zx!}2&HX3sVn&S_~TH@Wn9m=VosyLG$Zgp!_Zt@o-Rj>JScPU36cY1U2Uk2v$GePnV
  15799. zGs&*D&F~E~YKOn6wlnOh+oH_iO4<A`12byZQd3|$)Sylqd!|+2Qf<J7mKx%8_wEh5
  15800. zYF~#haB8mhGm+`#hGk#0e%Wb}|KAVkSK|E9qV1Q=x)Ul#y9Hl<L6RYD6!0e0WiB_9
  15801. zE9Y{OBYz=^Xpgo<Q%C(0z;oD1_TGvQv`@F`axN#%e-6h)5$y?FX?rD?%U7n~&L!?C
  15802. zHpaR9zG7pX%Ren0CoWG)$2(AeM8d@7SqT%DzbIki@~=slxSaTp7aQA!%GU+NQy?yX
  15803. zMZ)_~|DlAbuYWJ$2T*@a!U@#hk?=U`|0UrJ>Q&P3`vYK~gy(?olQ41l4hf$H?vd~x
  15804. z0n6O|6<|?_yFVDN<|J*(&J&XfPSE@tq(728ekDm0*-su#W|*4b1dc$dJmy1egxKpE
  15805. zxOZ!><+vwq7@y3&rHF^eIGx-0m{&wTF3qX6<XdvpNoQMC(pHH3Tl1~CbwF;QkNZz5
  15806. z6a(E+76aJ|F+@NV|Lm+7|4^)BD{S*qZ1Oh7#O_wFW(O}<XY5*2;4ig|l2B}j#hkd#
  15807. zL1ORmJ07p{K04-XeKd~Ie%=;rQtq(R+3%(u$?Dbv3Z1<!(;WD^c1D@AaIRMs@z3S-
  15808. z%rZrEGb_QB1L5Yn1EEIsa%w=C!#I2)Kd+C&=hQ<>_nqIr)E!Gi4n;$e#&~leq6~zZ
  15809. z;+Ing^+;qfpVK9?>Yk<D=XWf1#j=q-(Jhhvv0&VRJJFY;2(UM_q44t&;FZmYPJn|v
  15810. zV*HBdy;uJx$qIj7*QhkE@Hn$^V)JrObn{9n=Bm_Vhi1bQa%qimR!AQo^fcvtD_(6!
  15811. zq&xbf^vTCt^36a;5cmBUce%=cF6^xTci(*Y-+c3-b1(Sf)yW^>slL|63M0qcJghLB
  15812. z>P19pJLastQ$Z{-`bMfjnKt5)S;QmLYSWVMeB)9iMpx*MIJCox6L;P{fmkrkBOD%U
  15813. zd6SN|ORw58c7^V%qi{JL33i5qZf`si@`k+V?UCcoT9-D6nB|RB5I(M|E}NUvqdEAw
  15814. z#qMV|FAl~IN3zj@h)pZqgO>KrPzg0AtNn63Bu7Iv#b}84i^oKEeO%#P?!Li3@mG>7
  15815. z5Y<i)6;YY+i4jpT2u#pixlc5cEBA>cXT>L;b|S{X#fV4!_yAV)iEap#d`Zb?8{MtA
  15816. zvFZ~khU10%#Mi}5!X2u^f$hdox@r^Za=g<H{Iqnu8}%0?d@Jg*&m#W&Pw6=M#M{Nq
  15817. zM*DXIs}jBkSd3fg`UikxQvZG*_#H`p6u4bFegb%}gdYT^@is3u-G4tX;m2?wE8#Q1
  15818. z|19Az0)Jn^f5IEmzjdGYaAGnA55&U~L?aZ16k`_MNA;G16pAeLScN+;3Q~9!0arAp
  15819. zCYY8=A%-ai9GI=lOb(A^*l8{$q8?oA^hEE_cxs48G5QHOFEcf+CMHFkLcJj0I5fl^
  15820. z9m57wjMw1rdZRS$XDQaWXgrg({*Ff&Jih4I=G2<=&ABRY?-%^lN%C~8@R)yC_i86|
  15821. zm_fpv+$^FF@?~jYnxmWZQzY?L%BxWv;cmSzLNP@Ze3v`0sHw^xV@#jTF9zL+7^+(j
  15822. z=@QkMb%CrlrFhkYh6Lt$f_uX2>-L0N)n#Q7qxyM_^B2{pm;CYdfjQ+&$QR!Y|AI&Z
  15823. z`?KoZOLMXAcyGuCFVY#L-VJ!3Job?dPHo49iO-E(7}O>{U;gJ;-)`$#b!fYljv`YJ
  15824. z1n&(uxSQheVDMpQ#~igA!IpCrRUo37Qx7h#M^xd}BB8FudqZ>`5m!{}QPi85VfxL)
  15825. z7NxOaX<Xk4&8J5#=<~BhTjYizU^$PP$(8dc$ywpimtd3IAxk{kh>sbM*5kk<yleWm
  15826. z=%2LfimFu}m17IcYO`&{#yO83DYndcl*Z@0*yu$FQw78w-HiH-gu|#mA>lsM=Oug_
  15827. z>d#7eC+aUs_+zNQCSjT<l4AjiC2o=WI|95(!Wys~3#5TX(Rq(%Va#}rXsj1=G;7(8
  15828. z_D1xHnKhgTR?=y&L~h1_y`0Z<9;0_8m_VhMGDRXQzOOKuGa2mb<uqnt&cturgGxN+
  15829. zGWhEgtxind@;4IGI&bkg;hi;3jo9ixF#fw`V?w!Kack!c_F2p?1nUYm?PTb$lD?WJ
  15830. z<Iii8p*K?IBe9miKx9&RUcG#hW+dkH8Hw(t+IF-N@6Qb^zme+8@iChnk~BIOGtu?S
  15831. zt{Xhw`i4*pY+;sq>BKkPO2HF9<-3dDLe<K7!c4B5CrHi;PxPQeFF}@gq81-Bo}i9?
  15832. z6vsso{S&y-)+$fPc1k>vFE(b=`*gd6y{O+MVVd(fE#WTIKP6$hfAX9~82HQ5@!n#c
  15833. z#+mq4WVaYSj3*xE23nd*rI1-mjAq#0UbZ(PMiE0p@@r6!{uZ=odGt=uc>il+d(nO)
  15834. zWVT>?VjL;kp530&-`|~8npT=7?hJ2kn^KzcbGf<PCv%9R^E0`b-2R*|>GXGpo7x=h
  15835. z`@`P0K;f<98}xYht<<5&{SjZ%g=nm*Z9eR5e<*BkONMvYw_A8e^Fhtgm7bTmeLOBb
  15836. zC#nklE4L3bxpMm;IV<+@GA=}ZhU|mp0?q70g&hTPTolnifh%pT+6T>Z@nWO5!>mU@
  15837. z+y$~(t`D@6&)Myhj<*%-l73@CpN8QWUgNcZKD|FYj$tr=gHPY-Yti7oQU=4-X57DS
  15838. z^k%IFtGWh5Z*>h0v?UA;p37lmtZVR$p}`Hh2G_M=e))KfG4j1HatIpi@Sh6X+mGI0
  15839. z&81O;C{O^sbmE(yzF_v!sDvLEno+K~W^(14OLA5;_iu3_E1FAhVXl|v-ot+~zO8BQ
  15840. zUP=C1H8%}LM#jllNp-Kry<0{2W`TPz89kFVm)R%uH$)}I-2lCetaoblg}26hTDZoy
  15841. zoKf_ghqS$bHzAq&!fhwchS$084^ezY@y(*@4V+m#8+s>2b9`CM@#QeLg{TK}e1{QX
  15842. zB_ao-^AU!*rCl*sz!ztDTeB;+{f6@MXNph7oS&bUWT<MU<z{l_T269Sw4CNTUV<#~
  15843. zGjX9AKhrzd5>J-;hf_?8RepZB*aFw`jD+h@|Cog79f~}jAuYd4I!<xVF$vRnMz$hi
  15844. z4T?>8u`wFYh*BKC6yuJ{LzcaLY%irti3}}$J5@5AqTOt*{El_7=Qhjn!kb3tWV^{I
  15845. z^p@2*!C(^(zf;>@RoRmIu8SqPVM$fGB{`6JbE9qPDe<tdHS-wXkz}Z9W=m#r<+em}
  15846. zR&1#j9l8YBDty-CV`fV~gB;CMiX!?aaHXwPTk;l9w&^)8G*08i#%fTR7Z7*Fhq`PF
  15847. zWIM90bO0a5hZjDF@Q8popKK>CVVavAmvCvEWsIHDnc>Nd9wAt_Fp>G_ft95zdM6Vr
  15848. zi{574$_hrWWh=ud3gfAxN=tqrM}M}$+sC_LQTD>y@J*ZGn^c9O@i)^nW9ZD-3&|4;
  15849. z@J*-nY=WGMIli1TkX>8|WtLn;|3ldVu$dbe9Z-gjC}tKTTNTL)jVvEynaPz~49Qus
  15850. zm>=Ro&q0<f#)FTU#pKX&nxPU!^iSYQTdNi$TL47|a<otfyt~-Ajgj}+CSkIeT@ntW
  15851. zzE{FG7wb~=aHZ}W^Hr(wVh)h*T=djluJ_mAUABq@9t)$gmyQ0(dXKD|GVfB!61v~F
  15852. zB?$lF!dpe%f80P@n3SG}nJxUOBtuo9Yvs0JCRc6?Bxl7IeufJbAX|kGF}0a3d<`AH
  15853. z9mhox{S&y-)~YRdizjpMF(F~<lROhd-s4l!ak2$j_csH}wzLJf#6>nn*)5{zBd=fQ
  15854. z9ZW0)&OtX4B=Ax0dogsm+6XMV)%uL>3q~hp8?o74T2*oj=4qLhKwhvbSyfY|eKOV*
  15855. zug6>TMa;?0BM&T>9}E8c#FL@cI7KUq@CbAHvr7k+x!j$(Y(AUcm8T2>{w|wlRqwFh
  15856. zNWV~ecIG3g(&&NT1fgr?wqPb#ZVM!5#TIDR=mKQP7ATv`%oZq9^mlPw6wyC{D{ZaX
  15857. zf~>pb7wFA2FMK3L`YbTnLTR*P(=&@@KM@e3*cPJ<{*G3>mf(4#OeH5!T*86n93EY_
  15858. z)7PNe1J=hq<a?>C)$OWem#*2Wl0>E>X*T6K*5j?Cxn^hcXO^-#A4W-}(c*pL_0s4{
  15859. znTq@PPtm{4xIHV$P*vzlxjvi8mFqLfS<z?8IJf}WtLby{I_k5`&7{wp@Zp8)b4Wnk
  15860. z71C!#!fmJzO8EWia~k^0S0ojwx-`RYGLG-<?=uwo>KVzqjR!C5v%{EW;yH00+gwHt
  15861. zoNJ>K9L@@tq%1gA_@`nP9M9(Zj$h=y@ijf)@_Y4l8I<Yf^4kkM&rM{n@jdG@_I7W)
  15862. zHwbn=+G%8keHmF{f0xv1?b^9#2UfdQ7oOd^nhADa+`Rhqvp21#gIyQ9FY-O}IKpvg
  15863. z)s@_^@i21c?BmX)XX9?nh1rpV;MzDyweh5~08cZcdzzb&alB#Og9%&K@j#>282UEe
  15864. z_dE949z7Xezrm)}APc!AT($n&nm6cGoyZ3`8JY~*lipgieQcl>ttG2#2NadsRc{SA
  15865. zv^%jPX++r)u#W~~-Z-+gkJY(JwyyS|VjtDBm@)fC*<ITLF669z1UU!qO1WQ)Sjoe4
  15866. zziwW9Dz-n;6%7T>M&3<rQF2BO+9KxZa_Zbt_Wa_~a%^7N9hpN0cTMY=2!AIzyF%@6
  15867. zK0gxa*Vkg1t&F*z?;|Vm%ufVqz#hzaW|KHz*o-)(oM+7B%6W$5tnf@6ljaw2G2)qD
  15868. zmk~{`LH@XC&m|s|c3n}m>NkVMGi~}CpG)G$gI8*CO!kwMS@AvTIB}9Ho!^Q2DG5_N
  15869. zCBLnV0L$53G%kKclHY;)k0neT=$5W`0Ju%U_X9Uecm#O6glT3mFX5BGQ3*c;d`!aA
  15870. zzy~Ev{zA?OUjU}D4lg!F<D(ZP{IocPtv+rT8=sg$h8MkLEzbqhSEOVTCnk`F%s{f4
  15871. zu?g)Vre|#F>s$D6qm=xGH&{nA4;#Y{eWFv(EnB<#1dC8cGkp;ZOZW(U&8u4qWO)J@
  15872. z=X9OhD`$Y2aeE|UIRk9PxG#d+X{D#bZk7SI;OCjntT3}C1MK9Q{I6pkk^O~?S}FId
  15873. zl;`Er9DzeoV)M=*#x_SOf9eySFC9CC`1jPa{i~tX-O8B0CWUP}tJsn?>zWe8zfXaG
  15874. z?=5m~6S()OBKO`K+7IqsuXArptt$A`SQXOMPK;|u9#=OwRc6{2td-O=I`Ec*GI(hX
  15875. zN$C7$WbhsVzeXb;L~hsrY~5fbzAR<<ujNapq}!_iUBJX!^qA=waRqT6VbGdhO193i
  15876. zFcsnfH$GRBE9X^eZ!2#~{}%1hR;KV*0QO;LHTDx{QUB`kDPL)F3l5a{>HYGm_!YPS
  15877. zidZ$cMRX2#gvM_^3D*J3GqugYa;#3zg}93s8|y^n2?5a_#ZZ4HVY;7xEnyn_eM7>;
  15878. ztN$S3J*dAf;eDvf*<Oc$Uz3i<QNJu<;#vJc>-%hMw0Mm3UTO^nSd$$l*659D!$&#u
  15879. zNja{TXwF!9S6s`%X-;1~&lk<7NAxA~Ib6Dm2FEC$#i!b+=TUbXbtDI1eZBSZZU0v5
  15880. z@BcNrFpA(nT5&g}&)2z5tIGE4GLu%xrpY!%5q3g4MJg$@ce@ZUwnAOY$3SLs<+e(4
  15881. z#0R2?_Gl~mK*zG!LHb8rLUw9qtK@fS&RG=Ep1_s1R>wf%T-|364RMvAL=pUJg&U_C
  15882. z#!T+%>!TNpRniRkj*6$!iQ7SUS7=5|+#X{q?tHmsn8}rE2Fd;3)eQP?8=PJ$Xa=aE
  15883. z(kk77{yxiZkh8{JmN|pgW4W;&Ygu29H7%{j%3(cLE7oIOADyYBF<p{2m}yMOw{c-J
  15884. zjWLre*BFwsqA@h)oPaEGiQtoZ)XV)oz4@hafheMX0$18v<r4Dkyx8<U$n!R`wdq`=
  15885. zXF8K}#J{59F3Xdd<p0w}XjgG=+(fsw_VfR+V`T;SPmG?e)h(XYQ~IAO>kHGz`mwH|
  15886. z0b^&rqWM-2&6vEMMz(QsquXAfS(NpKe>q;`USIgvR8xpnFU(=Sd?D8oIJAf(M_ZPf
  15887. z&%cxMFD=H#BI^U^qBv9CnvbqbX@~W7d^G3S63r;ILi&1XZ)L`t7mo*9GyN@%rNoou
  15888. z+j7P;lPlL>lCz?})S>4fOS((CV&)5<gB*W`5JLGN_4hNpNxfAXw~k7<7WMrSrqy7(
  15889. zBusp9kAyo=e?-D`|3uOCpH$yS?=R-=RC;$L{ih>ZwKP^~)sl&QMEk6B@2b%`**=b3
  15890. zn0Rcrwr;h;+MbP1T$nh=zPP=*YZX$T+kM3fAX@)JN3Z_>U#>m3xDq#)o`tz?pB4|m
  15891. z*b3b#*KISoa@{65E4uvxF7zm5Nw?|a#HSKB-wxfrUfDKoT$2~R0;kmPD>KXbAQ&>F
  15892. zbzSA_O~(3$h_r|J+t1>E+giJm>nKQF{4XvK{|8)x)1^H5-=Nm^|5~l>|E<>I>Hj~_
  15893. zTCRF)6?Cf7PQH({)~I=)$N1N9*0pwE(3l>ykjwIdVOuiS&gbXz#JA;Kdj&RF*O33*
  15894. z701g~V%|s&e!%!$v@siBJR!+Y)r^D9<jOgi<VsvtYLD6#eW2@53?0W-@UIyM_v0iV
  15895. zonREvKY=T4t&Weyxx}e7#_2J3lsI<nKPZGQ{x8<S{#ENbc;guLw>rp`%CScKX+~qM
  15896. PmYV1wS2=?SNgMwg6F6uY
  15897. literal 0
  15898. HcmV?d00001
  15899. diff --git a/gcc/config/c33/libgcc/modhi3.lst b/gcc/config/c33/libgcc/modhi3.lst
  15900. new file mode 100644
  15901. index 0000000..0045b88
  15902. --- /dev/null
  15903. +++ b/gcc/config/c33/libgcc/modhi3.lst
  15904. @@ -0,0 +1,105 @@
  15905. +GAS LISTING modhi3.s page 1
  15906. +
  15907. +
  15908. + 1 ; Function : __modhi3
  15909. + 2 ; Input : %r6 --- dividend
  15910. + 3 ; %r7 --- divisor
  15911. + 4 ; Output : %r4 --- remainder
  15912. + 5 ; Function : calculate signed integer modulo arithmetic
  15913. + 6
  15914. + 7 .section .text
  15915. + 8 .align 1
  15916. + 9 .global __modhi3
  15917. + 10 __modhi3:
  15918. + 11 0000 868C868C xsll %r6, 16
  15919. + 12 0004 62A0 ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  15920. + 13 0006 708B div0s %r7 ; initializer of signed division
  15921. + 14 ;ifdef FAST
  15922. + 15 0008 7093 div1 %r7 ; execute division ;1
  15923. + 16 000a 7093 div1 %r7 ; execute division ;2
  15924. + 17 000c 7093 div1 %r7 ; execute division ;3
  15925. + 18 000e 7093 div1 %r7 ; execute division ;4
  15926. + 19 0010 7093 div1 %r7 ; execute division ;5
  15927. + 20 0012 7093 div1 %r7 ; execute division ;6
  15928. + 21 0014 7093 div1 %r7 ; execute division ;7
  15929. + 22 0016 7093 div1 %r7 ; execute division ;8
  15930. + 23 0018 7093 div1 %r7 ; execute division ;9
  15931. + 24 001a 7093 div1 %r7 ; execute division ;10
  15932. + 25 001c 7093 div1 %r7 ; execute division ;11
  15933. + 26 001e 7093 div1 %r7 ; execute division ;12
  15934. + 27 0020 7093 div1 %r7 ; execute division ;13
  15935. + 28 0022 7093 div1 %r7 ; execute division ;14
  15936. + 29 0024 7093 div1 %r7 ; execute division ;15
  15937. + 30 0026 7093 div1 %r7 ; execute division ;16
  15938. + 31 ;else
  15939. + 32 ; ld.w %r8,0x2 ; set loop counter (N = 2)
  15940. + 33 ; ld.w %r9,%psr ; save flag register
  15941. + 34 ;__modhi3_loop_start:
  15942. + 35 ; div1 %r7 ; execute division ;1
  15943. + 36 ; div1 %r7 ; execute division ;2
  15944. + 37 ; div1 %r7 ; execute division ;3
  15945. + 38 ; div1 %r7 ; execute division ;4
  15946. + 39 ; div1 %r7 ; execute division ;5
  15947. + 40 ; div1 %r7 ; execute division ;6
  15948. + 41 ; div1 %r7 ; execute division ;7
  15949. + 42 ; div1 %r7 ; execute division ;8
  15950. + 43 ; sub %r8,0x1 ; decrement loop counter
  15951. + 44 ; jrne.d __modhi3_loop_start ; if (loop counter != 0) goto loop top
  15952. + 45 ; ld.w %psr,%r9 ; restore flag register (delayed slot)
  15953. + 46 ;endif
  15954. + 47 0028 7097 div2s %r7 ; post divistion process ;1
  15955. + 48 002a 009B div3s ; post divistion process ;2
  15956. + 49 002c 4007 ret.d ; return to the caller (use delayed return)
  15957. + 50 002e 34A4 ld.w %r4,%ahr ; set remainder to return reg (delayed slot)
  15958. + 51
  15959. + 52
  15960. + 53 ; Function : __umodhi3
  15961. + 54 ; Input : %r6 --- dividend
  15962. + 55 ; %r7 --- divisor
  15963. + 56 ; Output : %r4 --- remainder
  15964. + 57 ; Function : calculate unsigned integer modulo arithmetic
  15965. + GAS LISTING modhi3.s page 2
  15966. +
  15967. +
  15968. + 58
  15969. + 59 .section .text
  15970. + 60 .align 1
  15971. + 61 .global __umodhi3
  15972. + 62 __umodhi3:
  15973. + 63 0030 868C868C xsll %r6, 16
  15974. + 64 0034 62A0 ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  15975. + 65 0036 708F div0u %r7 ; initializer of signed division
  15976. + 66 ;ifdef FAST
  15977. + 67 0038 7093 div1 %r7 ; execute division ;1
  15978. + 68 003a 7093 div1 %r7 ; execute division ;2
  15979. + 69 003c 7093 div1 %r7 ; execute division ;3
  15980. + 70 003e 7093 div1 %r7 ; execute division ;4
  15981. + 71 0040 7093 div1 %r7 ; execute division ;5
  15982. + 72 0042 7093 div1 %r7 ; execute division ;6
  15983. + 73 0044 7093 div1 %r7 ; execute division ;7
  15984. + 74 0046 7093 div1 %r7 ; execute division ;8
  15985. + 75 0048 7093 div1 %r7 ; execute division ;9
  15986. + 76 004a 7093 div1 %r7 ; execute division ;10
  15987. + 77 004c 7093 div1 %r7 ; execute division ;11
  15988. + 78 004e 7093 div1 %r7 ; execute division ;12
  15989. + 79 0050 7093 div1 %r7 ; execute division ;13
  15990. + 80 0052 7093 div1 %r7 ; execute division ;14
  15991. + 81 0054 7093 div1 %r7 ; execute division ;15
  15992. + 82 0056 7093 div1 %r7 ; execute division ;16
  15993. + 83 ;else
  15994. + 84 ; ld.w %r8,0x2 ; set loop counter (N = 2)
  15995. + 85 ;__umodhi3_loop_start:
  15996. + 86 ; div1 %r7 ; execute division ;1
  15997. + 87 ; div1 %r7 ; execute division ;2
  15998. + 88 ; div1 %r7 ; execute division ;3
  15999. + 89 ; div1 %r7 ; execute division ;4
  16000. + 90 ; div1 %r7 ; execute division ;5
  16001. + 91 ; div1 %r7 ; execute division ;6
  16002. + 92 ; div1 %r7 ; execute division ;7
  16003. + 93 ; div1 %r7 ; execute division ;8
  16004. + 94 ; sub %r8,0x1 ; decrement loop counter
  16005. + 95 ; jrne __umodhi3_loop_start ; if (loop counter != 0) goto loop top
  16006. + 96 ;endif
  16007. + 97 0058 4007 ret.d ; return to the caller (use delayed return)
  16008. + 98 005a 34A4 ld.w %r4,%ahr ; set remainder to return reg (delayed slot)
  16009. + 99
  16010. diff --git a/gcc/config/c33/libgcc/modhi3.s b/gcc/config/c33/libgcc/modhi3.s
  16011. new file mode 100644
  16012. index 0000000..11063da
  16013. --- /dev/null
  16014. +++ b/gcc/config/c33/libgcc/modhi3.s
  16015. @@ -0,0 +1,99 @@
  16016. +; Function : __modhi3
  16017. +; Input : %r6 --- dividend
  16018. +; %r7 --- divisor
  16019. +; Output : %r4 --- remainder
  16020. +; Function : calculate signed integer modulo arithmetic
  16021. +
  16022. + .section .text
  16023. + .align 1
  16024. + .global __modhi3
  16025. +__modhi3:
  16026. + xsll %r6, 16
  16027. + ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  16028. + div0s %r7 ; initializer of signed division
  16029. +;ifdef FAST
  16030. + div1 %r7 ; execute division ;1
  16031. + div1 %r7 ; execute division ;2
  16032. + div1 %r7 ; execute division ;3
  16033. + div1 %r7 ; execute division ;4
  16034. + div1 %r7 ; execute division ;5
  16035. + div1 %r7 ; execute division ;6
  16036. + div1 %r7 ; execute division ;7
  16037. + div1 %r7 ; execute division ;8
  16038. + div1 %r7 ; execute division ;9
  16039. + div1 %r7 ; execute division ;10
  16040. + div1 %r7 ; execute division ;11
  16041. + div1 %r7 ; execute division ;12
  16042. + div1 %r7 ; execute division ;13
  16043. + div1 %r7 ; execute division ;14
  16044. + div1 %r7 ; execute division ;15
  16045. + div1 %r7 ; execute division ;16
  16046. +;else
  16047. +; ld.w %r8,0x2 ; set loop counter (N = 2)
  16048. +; ld.w %r9,%psr ; save flag register
  16049. +;__modhi3_loop_start:
  16050. +; div1 %r7 ; execute division ;1
  16051. +; div1 %r7 ; execute division ;2
  16052. +; div1 %r7 ; execute division ;3
  16053. +; div1 %r7 ; execute division ;4
  16054. +; div1 %r7 ; execute division ;5
  16055. +; div1 %r7 ; execute division ;6
  16056. +; div1 %r7 ; execute division ;7
  16057. +; div1 %r7 ; execute division ;8
  16058. +; sub %r8,0x1 ; decrement loop counter
  16059. +; jrne.d __modhi3_loop_start ; if (loop counter != 0) goto loop top
  16060. +; ld.w %psr,%r9 ; restore flag register (delayed slot)
  16061. +;endif
  16062. + div2s %r7 ; post divistion process ;1
  16063. + div3s ; post divistion process ;2
  16064. + ret.d ; return to the caller (use delayed return)
  16065. + ld.w %r4,%ahr ; set remainder to return reg (delayed slot)
  16066. +
  16067. +
  16068. +; Function : __umodhi3
  16069. +; Input : %r6 --- dividend
  16070. +; %r7 --- divisor
  16071. +; Output : %r4 --- remainder
  16072. +; Function : calculate unsigned integer modulo arithmetic
  16073. +
  16074. + .section .text
  16075. + .align 1
  16076. + .global __umodhi3
  16077. +__umodhi3:
  16078. + xsll %r6, 16
  16079. + ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  16080. + div0u %r7 ; initializer of signed division
  16081. +;ifdef FAST
  16082. + div1 %r7 ; execute division ;1
  16083. + div1 %r7 ; execute division ;2
  16084. + div1 %r7 ; execute division ;3
  16085. + div1 %r7 ; execute division ;4
  16086. + div1 %r7 ; execute division ;5
  16087. + div1 %r7 ; execute division ;6
  16088. + div1 %r7 ; execute division ;7
  16089. + div1 %r7 ; execute division ;8
  16090. + div1 %r7 ; execute division ;9
  16091. + div1 %r7 ; execute division ;10
  16092. + div1 %r7 ; execute division ;11
  16093. + div1 %r7 ; execute division ;12
  16094. + div1 %r7 ; execute division ;13
  16095. + div1 %r7 ; execute division ;14
  16096. + div1 %r7 ; execute division ;15
  16097. + div1 %r7 ; execute division ;16
  16098. +;else
  16099. +; ld.w %r8,0x2 ; set loop counter (N = 2)
  16100. +;__umodhi3_loop_start:
  16101. +; div1 %r7 ; execute division ;1
  16102. +; div1 %r7 ; execute division ;2
  16103. +; div1 %r7 ; execute division ;3
  16104. +; div1 %r7 ; execute division ;4
  16105. +; div1 %r7 ; execute division ;5
  16106. +; div1 %r7 ; execute division ;6
  16107. +; div1 %r7 ; execute division ;7
  16108. +; div1 %r7 ; execute division ;8
  16109. +; sub %r8,0x1 ; decrement loop counter
  16110. +; jrne __umodhi3_loop_start ; if (loop counter != 0) goto loop top
  16111. +;endif
  16112. + ret.d ; return to the caller (use delayed return)
  16113. + ld.w %r4,%ahr ; set remainder to return reg (delayed slot)
  16114. +
  16115. diff --git a/gcc/config/c33/libgcc/modsi3.lst b/gcc/config/c33/libgcc/modsi3.lst
  16116. new file mode 100644
  16117. index 0000000..ca9d2b2
  16118. --- /dev/null
  16119. +++ b/gcc/config/c33/libgcc/modsi3.lst
  16120. @@ -0,0 +1,138 @@
  16121. +GAS LISTING modsi3.s page 1
  16122. +
  16123. +
  16124. + 1 ; Function : __modsi3
  16125. + 2 ; Input : %r6 --- dividend
  16126. + 3 ; %r7 --- divisor
  16127. + 4 ; Output : %r4 --- remainder
  16128. + 5 ; Function : calculate signed integer modulo arithmetic
  16129. + 6
  16130. + 7 .section .text
  16131. + 8 .align 1
  16132. + 9 .global __modsi3
  16133. + 10 __modsi3:
  16134. + 11 0000 62A0 ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  16135. + 12 0002 708B div0s %r7 ; initializer of signed division
  16136. + 13 ;ifdef FAST
  16137. + 14 ; div1 %r7 ; execute division ;1
  16138. + 15 ; div1 %r7 ; execute division ;2
  16139. + 16 ; div1 %r7 ; execute division ;3
  16140. + 17 ; div1 %r7 ; execute division ;4
  16141. + 18 ; div1 %r7 ; execute division ;5
  16142. + 19 ; div1 %r7 ; execute division ;6
  16143. + 20 ; div1 %r7 ; execute division ;7
  16144. + 21 ; div1 %r7 ; execute division ;8
  16145. + 22 ; div1 %r7 ; execute division ;9
  16146. + 23 ; div1 %r7 ; execute division ;10
  16147. + 24 ; div1 %r7 ; execute division ;11
  16148. + 25 ; div1 %r7 ; execute division ;12
  16149. + 26 ; div1 %r7 ; execute division ;13
  16150. + 27 ; div1 %r7 ; execute division ;14
  16151. + 28 ; div1 %r7 ; execute division ;15
  16152. + 29 ; div1 %r7 ; execute division ;16
  16153. + 30 ; div1 %r7 ; execute division ;17
  16154. + 31 ; div1 %r7 ; execute division ;18
  16155. + 32 ; div1 %r7 ; execute division ;19
  16156. + 33 ; div1 %r7 ; execute division ;20
  16157. + 34 ; div1 %r7 ; execute division ;21
  16158. + 35 ; div1 %r7 ; execute division ;22
  16159. + 36 ; div1 %r7 ; execute division ;23
  16160. + 37 ; div1 %r7 ; execute division ;24
  16161. + 38 ; div1 %r7 ; execute division ;25
  16162. + 39 ; div1 %r7 ; execute division ;26
  16163. + 40 ; div1 %r7 ; execute division ;27
  16164. + 41 ; div1 %r7 ; execute division ;28
  16165. + 42 ; div1 %r7 ; execute division ;29
  16166. + 43 ; div1 %r7 ; execute division ;30
  16167. + 44 ; div1 %r7 ; execute division ;31
  16168. + 45 ; div1 %r7 ; execute division ;32
  16169. + 46 ;else
  16170. + 47 0004 486C ld.w %r8,0x4 ; set loop counter (N = 4)
  16171. + 48 0006 09A4 ld.w %r9,%psr ; save flag register
  16172. + 49 __modsi3_loop_start:
  16173. + 50 0008 7093 div1 %r7 ; execute division ;1
  16174. + 51 000a 7093 div1 %r7 ; execute division ;2
  16175. + 52 000c 7093 div1 %r7 ; execute division ;3
  16176. + 53 000e 7093 div1 %r7 ; execute division ;4
  16177. + 54 0010 7093 div1 %r7 ; execute division ;5
  16178. + 55 0012 7093 div1 %r7 ; execute division ;6
  16179. + 56 0014 7093 div1 %r7 ; execute division ;7
  16180. + 57 0016 7093 div1 %r7 ; execute division ;8
  16181. + GAS LISTING modsi3.s page 2
  16182. +
  16183. +
  16184. + 58 0018 1864 sub %r8,0x1 ; decrement loop counter
  16185. + 59 001a F71B jrne.d __modsi3_loop_start ; if (loop counter != 0) goto loop top
  16186. + 60 001c 90A0 ld.w %psr,%r9 ; restore flag register (delayed slot)
  16187. + 61 ;endif
  16188. + 62 001e 7097 div2s %r7 ; post divistion process ;1
  16189. + 63 0020 009B div3s ; post divistion process ;2
  16190. + 64 0022 4007 ret.d ; return to the caller (use delayed return)
  16191. + 65 0024 34A4 ld.w %r4,%ahr ; set remainder to return reg (delayed slot)
  16192. + 66
  16193. + 67
  16194. + 68 ; Function : __umodsi3
  16195. + 69 ; Input : %r6 --- dividend
  16196. + 70 ; %r7 --- divisor
  16197. + 71 ; Output : %r4 --- remainder
  16198. + 72 ; Function : calculate unsigned integer modulo arithmetic
  16199. + 73
  16200. + 74 .section .text
  16201. + 75 .align 1
  16202. + 76 .global __umodsi3
  16203. + 77 __umodsi3:
  16204. + 78 0026 62A0 ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  16205. + 79 0028 708F div0u %r7 ; initializer of signed division
  16206. + 80 ;ifdef FAST
  16207. + 81 ; div1 %r7 ; execute division ;1
  16208. + 82 ; div1 %r7 ; execute division ;2
  16209. + 83 ; div1 %r7 ; execute division ;3
  16210. + 84 ; div1 %r7 ; execute division ;4
  16211. + 85 ; div1 %r7 ; execute division ;5
  16212. + 86 ; div1 %r7 ; execute division ;6
  16213. + 87 ; div1 %r7 ; execute division ;7
  16214. + 88 ; div1 %r7 ; execute division ;8
  16215. + 89 ; div1 %r7 ; execute division ;9
  16216. + 90 ; div1 %r7 ; execute division ;10
  16217. + 91 ; div1 %r7 ; execute division ;11
  16218. + 92 ; div1 %r7 ; execute division ;12
  16219. + 93 ; div1 %r7 ; execute division ;13
  16220. + 94 ; div1 %r7 ; execute division ;14
  16221. + 95 ; div1 %r7 ; execute division ;15
  16222. + 96 ; div1 %r7 ; execute division ;16
  16223. + 97 ; div1 %r7 ; execute division ;17
  16224. + 98 ; div1 %r7 ; execute division ;18
  16225. + 99 ; div1 %r7 ; execute division ;19
  16226. + 100 ; div1 %r7 ; execute division ;20
  16227. + 101 ; div1 %r7 ; execute division ;21
  16228. + 102 ; div1 %r7 ; execute division ;22
  16229. + 103 ; div1 %r7 ; execute division ;23
  16230. + 104 ; div1 %r7 ; execute division ;24
  16231. + 105 ; div1 %r7 ; execute division ;25
  16232. + 106 ; div1 %r7 ; execute division ;26
  16233. + 107 ; div1 %r7 ; execute division ;27
  16234. + 108 ; div1 %r7 ; execute division ;28
  16235. + 109 ; div1 %r7 ; execute division ;29
  16236. + 110 ; div1 %r7 ; execute division ;30
  16237. + 111 ; div1 %r7 ; execute division ;31
  16238. + 112 ; div1 %r7 ; execute division ;32
  16239. + 113 ;else
  16240. + 114 002a 486C ld.w %r8,0x4 ; set loop counter (N = 4)
  16241. + GAS LISTING modsi3.s page 3
  16242. +
  16243. +
  16244. + 115 __umodsi3_loop_start:
  16245. + 116 002c 7093 div1 %r7 ; execute division ;1
  16246. + 117 002e 7093 div1 %r7 ; execute division ;2
  16247. + 118 0030 7093 div1 %r7 ; execute division ;3
  16248. + 119 0032 7093 div1 %r7 ; execute division ;4
  16249. + 120 0034 7093 div1 %r7 ; execute division ;5
  16250. + 121 0036 7093 div1 %r7 ; execute division ;6
  16251. + 122 0038 7093 div1 %r7 ; execute division ;7
  16252. + 123 003a 7093 div1 %r7 ; execute division ;8
  16253. + 124 003c 1864 sub %r8,0x1 ; decrement loop counter
  16254. + 125 003e F71A jrne __umodsi3_loop_start ; if (loop counter != 0) goto loop top
  16255. + 126 ;endif
  16256. + 127 0040 4007 ret.d ; return to the caller (use delayed return)
  16257. + 128 0042 34A4 ld.w %r4,%ahr ; set remainder to return reg (delayed slot)
  16258. + 129
  16259. diff --git a/gcc/config/c33/libgcc/modsi3.s b/gcc/config/c33/libgcc/modsi3.s
  16260. new file mode 100644
  16261. index 0000000..d47fec4
  16262. --- /dev/null
  16263. +++ b/gcc/config/c33/libgcc/modsi3.s
  16264. @@ -0,0 +1,129 @@
  16265. +; Function : __modsi3
  16266. +; Input : %r6 --- dividend
  16267. +; %r7 --- divisor
  16268. +; Output : %r4 --- remainder
  16269. +; Function : calculate signed integer modulo arithmetic
  16270. +
  16271. + .section .text
  16272. + .align 1
  16273. + .global __modsi3
  16274. +__modsi3:
  16275. + ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  16276. + div0s %r7 ; initializer of signed division
  16277. +;ifdef FAST
  16278. +; div1 %r7 ; execute division ;1
  16279. +; div1 %r7 ; execute division ;2
  16280. +; div1 %r7 ; execute division ;3
  16281. +; div1 %r7 ; execute division ;4
  16282. +; div1 %r7 ; execute division ;5
  16283. +; div1 %r7 ; execute division ;6
  16284. +; div1 %r7 ; execute division ;7
  16285. +; div1 %r7 ; execute division ;8
  16286. +; div1 %r7 ; execute division ;9
  16287. +; div1 %r7 ; execute division ;10
  16288. +; div1 %r7 ; execute division ;11
  16289. +; div1 %r7 ; execute division ;12
  16290. +; div1 %r7 ; execute division ;13
  16291. +; div1 %r7 ; execute division ;14
  16292. +; div1 %r7 ; execute division ;15
  16293. +; div1 %r7 ; execute division ;16
  16294. +; div1 %r7 ; execute division ;17
  16295. +; div1 %r7 ; execute division ;18
  16296. +; div1 %r7 ; execute division ;19
  16297. +; div1 %r7 ; execute division ;20
  16298. +; div1 %r7 ; execute division ;21
  16299. +; div1 %r7 ; execute division ;22
  16300. +; div1 %r7 ; execute division ;23
  16301. +; div1 %r7 ; execute division ;24
  16302. +; div1 %r7 ; execute division ;25
  16303. +; div1 %r7 ; execute division ;26
  16304. +; div1 %r7 ; execute division ;27
  16305. +; div1 %r7 ; execute division ;28
  16306. +; div1 %r7 ; execute division ;29
  16307. +; div1 %r7 ; execute division ;30
  16308. +; div1 %r7 ; execute division ;31
  16309. +; div1 %r7 ; execute division ;32
  16310. +;else
  16311. + ld.w %r8,0x4 ; set loop counter (N = 4)
  16312. + ld.w %r9,%psr ; save flag register
  16313. +__modsi3_loop_start:
  16314. + div1 %r7 ; execute division ;1
  16315. + div1 %r7 ; execute division ;2
  16316. + div1 %r7 ; execute division ;3
  16317. + div1 %r7 ; execute division ;4
  16318. + div1 %r7 ; execute division ;5
  16319. + div1 %r7 ; execute division ;6
  16320. + div1 %r7 ; execute division ;7
  16321. + div1 %r7 ; execute division ;8
  16322. + sub %r8,0x1 ; decrement loop counter
  16323. + jrne.d __modsi3_loop_start ; if (loop counter != 0) goto loop top
  16324. + ld.w %psr,%r9 ; restore flag register (delayed slot)
  16325. +;endif
  16326. + div2s %r7 ; post divistion process ;1
  16327. + div3s ; post divistion process ;2
  16328. + ret.d ; return to the caller (use delayed return)
  16329. + ld.w %r4,%ahr ; set remainder to return reg (delayed slot)
  16330. +
  16331. +
  16332. +; Function : __umodsi3
  16333. +; Input : %r6 --- dividend
  16334. +; %r7 --- divisor
  16335. +; Output : %r4 --- remainder
  16336. +; Function : calculate unsigned integer modulo arithmetic
  16337. +
  16338. + .section .text
  16339. + .align 1
  16340. + .global __umodsi3
  16341. +__umodsi3:
  16342. + ld.w %alr,%r6 ; set dividend to accumlator (%alr)
  16343. + div0u %r7 ; initializer of signed division
  16344. +;ifdef FAST
  16345. +; div1 %r7 ; execute division ;1
  16346. +; div1 %r7 ; execute division ;2
  16347. +; div1 %r7 ; execute division ;3
  16348. +; div1 %r7 ; execute division ;4
  16349. +; div1 %r7 ; execute division ;5
  16350. +; div1 %r7 ; execute division ;6
  16351. +; div1 %r7 ; execute division ;7
  16352. +; div1 %r7 ; execute division ;8
  16353. +; div1 %r7 ; execute division ;9
  16354. +; div1 %r7 ; execute division ;10
  16355. +; div1 %r7 ; execute division ;11
  16356. +; div1 %r7 ; execute division ;12
  16357. +; div1 %r7 ; execute division ;13
  16358. +; div1 %r7 ; execute division ;14
  16359. +; div1 %r7 ; execute division ;15
  16360. +; div1 %r7 ; execute division ;16
  16361. +; div1 %r7 ; execute division ;17
  16362. +; div1 %r7 ; execute division ;18
  16363. +; div1 %r7 ; execute division ;19
  16364. +; div1 %r7 ; execute division ;20
  16365. +; div1 %r7 ; execute division ;21
  16366. +; div1 %r7 ; execute division ;22
  16367. +; div1 %r7 ; execute division ;23
  16368. +; div1 %r7 ; execute division ;24
  16369. +; div1 %r7 ; execute division ;25
  16370. +; div1 %r7 ; execute division ;26
  16371. +; div1 %r7 ; execute division ;27
  16372. +; div1 %r7 ; execute division ;28
  16373. +; div1 %r7 ; execute division ;29
  16374. +; div1 %r7 ; execute division ;30
  16375. +; div1 %r7 ; execute division ;31
  16376. +; div1 %r7 ; execute division ;32
  16377. +;else
  16378. + ld.w %r8,0x4 ; set loop counter (N = 4)
  16379. +__umodsi3_loop_start:
  16380. + div1 %r7 ; execute division ;1
  16381. + div1 %r7 ; execute division ;2
  16382. + div1 %r7 ; execute division ;3
  16383. + div1 %r7 ; execute division ;4
  16384. + div1 %r7 ; execute division ;5
  16385. + div1 %r7 ; execute division ;6
  16386. + div1 %r7 ; execute division ;7
  16387. + div1 %r7 ; execute division ;8
  16388. + sub %r8,0x1 ; decrement loop counter
  16389. + jrne __umodsi3_loop_start ; if (loop counter != 0) goto loop top
  16390. +;endif
  16391. + ret.d ; return to the caller (use delayed return)
  16392. + ld.w %r4,%ahr ; set remainder to return reg (delayed slot)
  16393. +
  16394. diff --git a/gcc/config/c33/libgcc/muldf3.lst b/gcc/config/c33/libgcc/muldf3.lst
  16395. new file mode 100644
  16396. index 0000000..de6e691
  16397. --- /dev/null
  16398. +++ b/gcc/config/c33/libgcc/muldf3.lst
  16399. @@ -0,0 +1,475 @@
  16400. +GAS LISTING muldf3.s page 1
  16401. +
  16402. +
  16403. + 1 ;*********************************************
  16404. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  16405. + 3 ;* ALL RIGHTS RESERVED
  16406. + 4 ;*
  16407. + 5 ;* filename : muldf3.s
  16408. + 6 ;*
  16409. + 7 ;* Double floating point multiplication function
  16410. + 8 ;* input: (%r7, %r6) & (%r9, %r8)
  16411. + 9 ;* output: (%r5, %r4)
  16412. + 10 ;*
  16413. + 11 ;* Begin 1996/09/12 V. Chan
  16414. + 12 ;* Fixed bug at multiply: 1997/02/18 V. Chan
  16415. + 13 ;* ѹ 2001/01/30 O.Hinokuchi
  16416. + 14 ;* gasб 2001/10/15 watanabe
  16417. + 15 ;*
  16418. + 16 ;*****************************************
  16419. + 17
  16420. + 18 .section .text
  16421. + 19 .align 1
  16422. + 20 .global __muldf3
  16423. + 21
  16424. + 22 ;;macro SHFTROTSHFT $1, $2, $3, $4, $5, $6, $7
  16425. + 23 ; used in 64-bit variable shifting
  16426. + 24 ; $1 = shift amount
  16427. + 25 ; $2 = 1st input register (shifted)
  16428. + 26 ; $3 = 2nd input register (rotated)
  16429. + 27 ; $4 = 3rd input register (mask --> shifted)
  16430. + 28 ; $5 = shift instruction
  16431. + 29 ; $6 = rotate instruction
  16432. + 30 ; $7 = temp register
  16433. + 31 ; ld.w $7, $1 ; temp = shift amount
  16434. + 32
  16435. + 33 ;$$1:
  16436. + 34 ; cmp $7, 8 ; if temp <= 8 then goto $$2
  16437. + 35 ; jrle $$2
  16438. + 36
  16439. + 37 ; $5 $2, 8 ; shift 1st register
  16440. + 38 ; $6 $3, 8 ; rotate 2nd register
  16441. + 39 ; $5 $4, 8 ; shift 3rd register
  16442. + 40 ; jp.d $$1
  16443. + 41 ; sub $7, 8 ; temp = temp - 8
  16444. + 42
  16445. + 43 ;$$2:
  16446. + 44 ; $5 $2, $7 ; last shift
  16447. + 45 ; $6 $3, $7 ; last rotate
  16448. + 46 ; $5 $4, $7 ; last shift
  16449. + 47 ;;endm
  16450. + 48
  16451. + 49 __muldf3:
  16452. + 50 0000 0302 pushn %r3 ; save register values
  16453. + 51 ;@@@ 01/01/30 add start hinokuchi
  16454. + 52 ;sub %sp, 4
  16455. + 53 ;ld.w [%sp+0], %r10 ; %r10
  16456. + 54 ;ld.w [%sp+1], %r11 ; %r11
  16457. + 55 ;ld.w [%sp+2], %r12 ; %r12
  16458. + 56 ;ld.w [%sp+3], %r13 ; %r13
  16459. + 57 ;@@@ 01/01/30 add end
  16460. + GAS LISTING muldf3.s page 2
  16461. +
  16462. +
  16463. + 58
  16464. + 59 0002 702E ld.w %r0, %r7 ; put sign of input1 (%r7) into %r0
  16465. + 60 0004 109C rl %r0, 1
  16466. + 61 0006 1070 and %r0, 1
  16467. + 62
  16468. + 63 0008 922E ld.w %r2, %r9 ; put sign of input2 (%r9) into %r2
  16469. + 64 000a 129C rl %r2, 1
  16470. + 65 000c 1270 and %r2, 1
  16471. + 66
  16472. + 67 000e 203A xor %r0, %r2 ; put new sign into register %r0
  16473. + 68
  16474. + 69 0010 056C ld.w %r5, 0 ; clear output register
  16475. + 70 ;ld.w %r4, 0 ; moved to line 38 for a delayed jump
  16476. + 71
  16477. + 72 0012 178C sll %r7, 1 ; clear MSB
  16478. + 73 0014 1788 srl %r7, 1
  16479. + 74 0016 0768 cmp %r7, 0 ; checking if input1 = 0
  16480. + 75 0018 051B jrne.d input2
  16481. + 76 001a 046C ld.w %r4, 0
  16482. + 77 001c 0668 cmp %r6, 0
  16483. + 78 001e 00C0 ext end@rm
  16484. + 79 0020 E018 jreq end@rl ; if {%r7, %r6} = 0 then end
  16485. + 80
  16486. + 81 input2:
  16487. + 82 0022 198C sll %r9, 1 ; clear MSB
  16488. + 83 0024 1988 srl %r9, 1
  16489. + 84 0026 0968 cmp %r9, 0 ; checking if input2 = 0
  16490. + 85 0028 041A jrne getexp
  16491. + 86 002a 0868 cmp %r8, 0
  16492. + 87 002c 00C0 ext end@rm
  16493. + 88 002e D918 jreq end@rl ; if {%r9, %r8} = 0 then end
  16494. + 89
  16495. + 90 getexp:
  16496. + 91 0030 712E ld.w %r1, %r7 ; put exponent1 into %r1
  16497. + 92 0032 81888188 xsrl %r1, 20
  16498. + 92 4188
  16499. + 93
  16500. + 94 0038 1FC0F16B xcmp %r1, 0x7ff ; check exp1 for overflow value
  16501. + 95 003c 00C0 ext overflow@rm
  16502. + 96 003e C618 jreq overflow@rl
  16503. + 97
  16504. + 98 0040 932E ld.w %r3, %r9 ; put exponent2 into %r3
  16505. + 99 0042 83888388 xsrl %r3, 20
  16506. + 99 4388
  16507. + 100
  16508. + 101 0048 1FC0F36B xcmp %r3, 0x7ff ; check exp2 for overflow value
  16509. + 102 004c 00C0 ext overflow@rm
  16510. + 103 004e BE18 jreq overflow@rl
  16511. + 104
  16512. + 105 ; free %r2, %r11 - %r13
  16513. + 106 ; %r0 = sign, %r1 = sisu1, %r3 = sisu2
  16514. + 107 ; %r10 = implied bit
  16515. + 108
  16516. + 109 ;@@@ 01/02/16 del xld.w %r10, 0x100000 ; implied bit
  16517. + 110 0050 126C ld.w %r2, 1 ; temp = 1
  16518. + 111 ;@@@ 01/02/16 del xld.w %r13, 0xfffff
  16519. + 112
  16520. + GAS LISTING muldf3.s page 3
  16521. +
  16522. +
  16523. + 113 ; isolate mantissa1
  16524. + 114 0052 01C0FFDF xand %r7, 0xfffff ; clear first 12 bits of %r6
  16525. + 114 F773
  16526. + 115 0058 0168 cmp %r1, 0
  16527. + 116 005a 0518 jreq man2 ; if exp1 = 0 (denormal)
  16528. + 117 005c 02C000C0 xoor %r7, 0x100000 ; else add implied bit to mantissa
  16529. + 117 0774
  16530. + 118
  16531. + 119 0062 026C ld.w %r2, 0 ; temp = 0
  16532. + 120
  16533. + 121 man2:
  16534. + 122 ; isolate mantissa2
  16535. + 123 0064 01C0FFDF xand %r9, 0xfffff ; clear first 12 bits of %r7
  16536. + 123 F973
  16537. + 124
  16538. + 125 006a 0368 cmp %r3, 0
  16539. + 126 006c 0518 jreq tempadd ; if exp2 = 0 then jump to tempadd
  16540. + 127 006e 02C000C0 xoor %r9, 0x100000 ; else add implied bit
  16541. + 127 0974
  16542. + 128 0074 021E jp multiply ; delayed jump
  16543. + 129
  16544. + 130 tempadd:
  16545. + 131 0076 1260 add %r2, 1 ; temp = temp + 1 (2 if den * den : 1 if nor * den)
  16546. + 132
  16547. + 133 multiply:
  16548. + 134 ; %r0 = result sign, %r1 = result exponent
  16549. + 135
  16550. + 136 ; calculate and check new exponent
  16551. + 137 0078 3122 add %r1, %r3 ; sisu = sisu1 + sisu2 - bias + temp
  16552. + 138
  16553. + 139 007a 0FC0F167 xsub %r1, 0x3ff
  16554. + 140
  16555. + 141 007e 2122 add %r1, %r2
  16556. + 142
  16557. + 143 0080 1FC0F16B xcmp %r1, 0x7ff ; if exp >= 0x7ff then goto overflow
  16558. + 144 0084 00C0 ext overflow@rm
  16559. + 145 0086 A20A jrge overflow@rl
  16560. + 146
  16561. + 147 ; max. shift from normal to denormal = 52
  16562. + 148 ; min. exp = 1 - max. shift = -51
  16563. + 149 0088 FFDFD168 xcmp %r1, -51 ; if exp < -51 then goto underflow
  16564. + 150 008c 6C0C jrlt underflow
  16565. + 151
  16566. + 152 ; 64-bit * 64-bit = 128-bit
  16567. + 153 ; 1st(128 ~ 97), 2nd(96 ~ 65), 3rd(64 ~ 33), 4th(32 ~ 0)
  16568. + 154 ; (%r7,%r6) * (%r9,%r8)
  16569. + 155 ; %r7 * a15 --> 1st,2nd
  16570. + 156 ; %r7 * a14 --> 2nd,3rd
  16571. + 157 ; %r6 * a15 --> 2nd,3rd
  16572. + 158 ; %r6 * a14 --> 3rd,4th
  16573. + 159 ; %r5 = result1, %r4 = result2, %r10 = result3, %r11 = result4, %r12 = temp
  16574. + 160 008e 026C ld.w %r2, 0 ; temp variable for adc and loop counter
  16575. + 161 0090 97AE mltu.w %r7, %r9 ; kasu1 * kasu2
  16576. + 162 0092 35A4 ld.w %r5, %ahr ; %r5 = result1
  16577. + 163 0094 24A4 ld.w %r4, %alr ; %r4 = result2
  16578. + 164 0096 87AE mltu.w %r7, %r8 ; kasu1 * kasu2_2
  16579. + 165 0098 37A4 ld.w %r7, %ahr
  16580. + GAS LISTING muldf3.s page 4
  16581. +
  16582. +
  16583. + 166 009a 7422 add %r4, %r7
  16584. + 167 009c 25B8 adc %r5, %r2 ; add carry
  16585. + 168 009e 23A4 ld.w %r3, %alr ; %r10 = result3
  16586. + 169 00a0 96AE mltu.w %r6, %r9 ; kasu1_2 * kasu2
  16587. + 170 00a2 27A4 ld.w %r7, %alr
  16588. + 171 00a4 7322 add %r3, %r7
  16589. + 172 00a6 24B8 adc %r4, %r2 ; add carry
  16590. + 173 00a8 25B8 adc %r5, %r2 ; add carry
  16591. + 174 00aa 37A4 ld.w %r7, %ahr
  16592. + 175 00ac 7422 add %r4, %r7
  16593. + 176 00ae 25B8 adc %r5, %r2 ; add carry
  16594. + 177 00b0 86AE mltu.w %r6, %r8 ; kasu1_2 * kasu2_2
  16595. + 178 00b2 37A4 ld.w %r7, %ahr
  16596. + 179 00b4 7322 add %r3, %r7
  16597. + 180 00b6 24B8 adc %r4, %r2 ; add carry
  16598. + 181 00b8 25B8 adc %r5, %r2
  16599. + 182 00ba 26A4 ld.w %r6, %alr ; %r11 = result4
  16600. + 183
  16601. + 184 ; %r8 will be first result register > 0
  16602. + 185 00bc 0568 cmp %r5, 0 ; if %r5 !=0 then count it
  16603. + 186 00be 0F1B jrne.d count
  16604. + 187 00c0 582E ld.w %r8, %r5
  16605. + 188
  16606. + 189 00c2 00C0026E xld.w %r2, 32 ; %r2 = loop counter = 32
  16607. + 190 00c6 0468 cmp %r4, 0 ; elsif %r4 != 0 then count it
  16608. + 191 00c8 0A1B jrne.d count
  16609. + 192 00ca 482E ld.w %r8, %r4
  16610. + 193
  16611. + 194 00cc 01C0026C xld.w %r2, 64 ; %r2 = loop counter = 64
  16612. + 195 00d0 0368 cmp %r3, 0 ; elsif %r10 != 0 then count it
  16613. + 196 00d2 051B jrne.d count
  16614. + 197 00d4 382E ld.w %r8, %r3
  16615. + 198
  16616. + 199 00d6 01C0026E xld.w %r2, 96 ; %r2 = loop counter = 96
  16617. + 200 00da 682E ld.w %r8, %r6 ; else count 0's leading %r6
  16618. + 201
  16619. + 202 count:
  16620. + 203 00dc 878E scan1 %r7, %r8 ; %r7 = count
  16621. + 204 00de 0412 jruge normalize ; if count !=8 then goto normalize
  16622. + 205 00e0 8260 add %r2, 8 ; add 8 to loop counter
  16623. + 206 00e2 FD1F jp.d count
  16624. + 207 00e4 888C sll %r8, 8 ; shift register to the left 8 bits
  16625. + 208
  16626. + 209 normalize:
  16627. + 210 ; free %r2 - %r11, %r13
  16628. + 211 ; %r0 = sign, %r1 = exp, %r7 = count
  16629. + 212 ; note: max. count = 127, min. count = 22
  16630. + 213
  16631. + 214 00e6 2722 add %r7, %r2 ; count = count + loopcounter
  16632. + 215
  16633. + 216 00e8 0168 cmp %r1, 0 ; if exp > 0 then jump to expgtz
  16634. + 217 00ea 0F09 jrgt.d expgtz
  16635. + 218 00ec 7765 sub %r7, 23 ; count = count - 23
  16636. + 219
  16637. + 220 ; case: exp <= 0
  16638. + 221 00ee 0184 sub %sp, 1
  16639. + 222 00f0 035C ld.w [%sp+0x0], %r3 ; %r3
  16640. + GAS LISTING muldf3.s page 5
  16641. +
  16642. +
  16643. + 223 00f2 136C ld.w %r3, 1 ; %r3 = 1 - exp
  16644. + 224 00f4 1326 sub %r3, %r1
  16645. + 225 00f6 C26C ld.w %r2, 12 ; %r2 = shift
  16646. + 226 00f8 3226 sub %r2, %r3 ; shift = 12 - (1 - exp)
  16647. + 227 00fa 0350 ld.w %r3, [%sp+0x0] ; %r3
  16648. + 228 00fc 0180 add %sp, 1
  16649. + 229 00fe 712A cmp %r1, %r7
  16650. + 230 0100 0D0F jrle.d shift ; if exp <= count then jump to shift
  16651. + 231 0102 016C ld.w %r1, 0 ; exp = 0
  16652. + 232
  16653. + 233 ; case: exp > count - 23
  16654. + 234 0104 0B1F jp.d shift ; delayed jump
  16655. + 235 0106 116C ld.w %r1, 1 ; exp = 1
  16656. + 236
  16657. + 237 expgtz:
  16658. + 238 0108 172A cmp %r7, %r1 ; if count < exp then goto shftltexp
  16659. + 239 010a 060D jrlt.d shftltexp
  16660. + 240 010c C26C ld.w %r2, 12 ; shift = 12
  16661. + 241
  16662. + 242 ; case: original count - 23 >= exp
  16663. + 243 010e 1222 add %r2, %r1 ; shift = shift + exp - 1
  16664. + 244 0110 1264 sub %r2, 1 ; shift as much as exp allows (until denormal)
  16665. + 245 0112 041F jp.d shift
  16666. + 246 0114 016C ld.w %r1, 0 ; exp = 0
  16667. + 247
  16668. + 248 shftltexp:
  16669. + 249 0116 7126 sub %r1, %r7 ; exp = exp - count
  16670. + 250 0118 7222 add %r2, %r7 ; shift = shift + count
  16671. + 251
  16672. + 252 shift:
  16673. + 253 011a 0268 cmp %r2, 0 ;if shift < 0 then shift to the right
  16674. + 254 011c 120C jrlt rshift
  16675. + 255
  16676. + 256 011e 00C0026A xcmp %r2, 32 ; if 0 =< shift < 32 then goto lshift
  16677. + 257 0122 350C jrlt lshift
  16678. + 258
  16679. + 259 0124 01C00268 xcmp %r2, 64 ; if 32 =< shift < 64 then goto shft32
  16680. + 260 0128 070C jrlt lshft32
  16681. + 261
  16682. + 262 ; case: shift >= 64 (note: max. shift of norm * denormal = 87)
  16683. + 263 012a 352E ld.w %r5, %r3 ; result1 = result3
  16684. + 264 012c 642E ld.w %r4, %r6 ; result2 = result4
  16685. + 265
  16686. + 266 012e 01C00264 xsub %r2, 64 ; shift = shift - 64
  16687. + 267
  16688. + 268 0132 2D1F jp.d lshift
  16689. + 269 0134 036C ld.w %r3, 0 ; result3 = 0
  16690. + 270
  16691. + 271 lshft32:
  16692. + 272 0136 452E ld.w %r5, %r4 ; result1 = result2
  16693. + 273 0138 342E ld.w %r4, %r3 ; result2 = result3
  16694. + 274 013a 632E ld.w %r3, %r6 ; result3 = result4
  16695. + 275 013c 281F jp.d lshift
  16696. + 276 013e 0266 sub %r2, 32 ; shift = shift - 32
  16697. + 277
  16698. + 278 rshift:
  16699. + 279 ; case: shift < 0
  16700. + GAS LISTING muldf3.s page 6
  16701. +
  16702. +
  16703. + 280 0140 223E not %r2, %r2 ; shift = ~shift + 1
  16704. + 281 0142 1260 add %r2, 1
  16705. + 282
  16706. + 283 0144 00C0926A xcmp %r2, 41 ; if shift > 41 (64-min.count-1) then
  16707. + 284 0148 0E08 jrgt underflow
  16708. + 285
  16709. + 286 014a 00C0026A xcmp %r2, 32 ; if shift < 32 then shift right
  16710. + 287 014e 0E0C jrlt doshift
  16711. + 288
  16712. + 289 ; case: 40 => shift >= 32
  16713. + 290 0150 542E ld.w %r4, %r5 ; result2 = result1
  16714. + 291 0152 0266 sub %r2, 32 ; shift = shift - 32
  16715. + 292
  16716. + 293 ; xsrl %r4, %r2 ; result2 >> shift
  16717. + 294 ; 32-bit variable shift routine
  16718. + 295 L1:
  16719. + 296 0154 8268 cmp %r2, 8 ; if shift <= 8 then goto L2
  16720. + 297 0156 040E jrle L2
  16721. + 298
  16722. + 299 0158 8488 srl %r4, 8 ; result >> %r2
  16723. + 300 015a FD1F jp.d L1
  16724. + 301 015c 8264 sub %r2, 8 ; shift = shift - 8
  16725. + 302
  16726. + 303 L2:
  16727. + 304 015e 2489 srl %r4, %r2 ; last shift
  16728. + 305
  16729. + 306 0160 3A1F jp.d finish
  16730. + 307 0162 056C ld.w %r5, 0 ; result1 = 0
  16731. + 308
  16732. + 309 underflow:
  16733. + 310 0164 056C ld.w %r5, 0 ; result1 = 0
  16734. + 311 0166 3D1F jp.d end
  16735. + 312 0168 046C ld.w %r4, 0 ; result2 = 0
  16736. + 313
  16737. + 314 doshift:
  16738. + 315 ; {%r5, %r4} >> shift
  16739. + 316 ;xsrl %r4, %r2 ; shift low 32-bits to the right x bits (shift amount = x)
  16740. + 317 ;xrr %r5, %r2 ; rotate high 32-bits to the right x bits
  16741. + 318 ;xsrl %r3, %r2 ; make a mask for last 32-x bits --> %r2 = 000...111
  16742. + 319
  16743. + 320 016a F96F ld.w %r9, -1 ; %r2 = 0xffff ffff
  16744. + 321 ; used in 64-bit variable shifting ; SHFTROTSHFT %r2, %r4, %r5, %r9, srl, rr, %r2
  16745. + 322 ; $1 = shift amount
  16746. + 323 ; $2 = 1st input register (shifted)
  16747. + 324 ; $3 = 2nd input register (rotated)
  16748. + 325 ; $4 = 3rd input register (mask --> shifted)
  16749. + 326 ; $5 = shift instruction
  16750. + 327 ; $6 = rotate instruction
  16751. + 328 ; $7 = temp register
  16752. + 329 016c 222E ld.w %r2, %r2 ; temp = shift amount
  16753. + 330
  16754. + 331 __L0001:
  16755. + 332 016e 8268 cmp %r2, 8 ; if temp <= 8 then goto $$2
  16756. + 333 0170 060E jrle __L0002
  16757. + 334
  16758. + 335 0172 8488 srl %r4, 8 ; shift 1st register
  16759. + 336 0174 8598 rr %r5, 8 ; rotate 2nd register
  16760. + GAS LISTING muldf3.s page 7
  16761. +
  16762. +
  16763. + 337 0176 8988 srl %r9, 8 ; shift 3rd register
  16764. + 338 0178 FB1F jp.d __L0001
  16765. + 339 017a 8264 sub %r2, 8 ; temp = temp - 8
  16766. + 340
  16767. + 341 __L0002:
  16768. + 342 017c 2489 srl %r4, %r2 ; last shift
  16769. + 343 017e 2599 rr %r5, %r2 ; last rotate
  16770. + 344 0180 2989 srl %r9, %r2 ; last shift
  16771. + 345 0182 923E not %r2, %r9 ; flip mask for first x bits --> %r9 = 111...000 (mask)
  16772. + 346 0184 5232 and %r2, %r5 ; isolate first x bits of %r5
  16773. + 347 0186 2436 or %r4, %r2 ; add first x bits of %r5 to %r4
  16774. + 348 0188 261F jp.d finish
  16775. + 349 018a 9532 and %r5, %r9 ; keep the low 32-x bits of %r5
  16776. + 350
  16777. + 351 lshift: ; case: shift >= 0
  16778. + 352 ; {%r5, %r4, %r10} << shift
  16779. + 353 ;xsll %r5, %r2 ; shift high 32-bits to the left x bits (shift amount = %r3 = x)
  16780. + 354 ;xrl %r4, %r2 ; rotate mid 32-bits to the left x bits
  16781. + 355 ;xsll %r3, %r2 ; make a mask for first 32-x bits --> %r3 = 111...000
  16782. + 356
  16783. + 357 018c F96F ld.w %r9, -1 ; %r9 = 0xffff ffff
  16784. + 358 ; used in 64-bit variable shifting ; SHFTROTSHFT %r2, %r5, %r4, %r9, sll, rl, %r8 ; %r8 = temp
  16785. + 359 ; $1 = shift amount
  16786. + 360 ; $2 = 1st input register (shifted)
  16787. + 361 ; $3 = 2nd input register (rotated)
  16788. + 362 ; $4 = 3rd input register (mask --> shifted)
  16789. + 363 ; $5 = shift instruction
  16790. + 364 ; $6 = rotate instruction
  16791. + 365 ; $7 = temp register
  16792. + 366 018e 282E ld.w %r8, %r2 ; temp = shift amount
  16793. + 367
  16794. + 368 __L0003:
  16795. + 369 0190 8868 cmp %r8, 8 ; if temp <= 8 then goto $$2
  16796. + 370 0192 060E jrle __L0004
  16797. + 371
  16798. + 372 0194 858C sll %r5, 8 ; shift 1st register
  16799. + 373 0196 849C rl %r4, 8 ; rotate 2nd register
  16800. + 374 0198 898C sll %r9, 8 ; shift 3rd register
  16801. + 375 019a FB1F jp.d __L0003
  16802. + 376 019c 8864 sub %r8, 8 ; temp = temp - 8
  16803. + 377
  16804. + 378 __L0004:
  16805. + 379 019e 858D sll %r5, %r8 ; last shift
  16806. + 380 01a0 849D rl %r4, %r8 ; last rotate
  16807. + 381 01a2 898D sll %r9, %r8 ; last shift
  16808. + 382 01a4 983E not %r8, %r9 ; flip mask for last x bits --> %r8 = 000...111 (mask)
  16809. + 383 01a6 862E ld.w %r6, %r8 ; temp = %r8
  16810. + 384 01a8 4832 and %r8, %r4 ; isolate last x bits of %r4
  16811. + 385 01aa 8536 or %r5, %r8 ; add last x bits of %r4 to %r5
  16812. + 386
  16813. + 387 01ac 0368 cmp %r3, 0 ; if result3 = 0 then done shifting
  16814. + 388 01ae 0B19 jreq.d overchk
  16815. + 389 01b0 9432 and %r4 %r9 ; keep the high 32-x bits of %r4
  16816. + 390
  16817. + 391 ; case: result3 != 0
  16818. + 392 ; MXRL %r3, %r2 ; rotate last register to the left
  16819. + 393 __L0005:
  16820. + GAS LISTING muldf3.s page 8
  16821. +
  16822. +
  16823. + 394
  16824. + 395 ; sub %sp, 1
  16825. + 396 ; ld.w [%sp+0], $2 ; rså
  16826. + 397
  16827. + 398 01b2 F271 and %r2,0x1f ; ơȿ=
  16828. + 399 __L0006:
  16829. + 400 01b4 8268 cmp %r2,0x8 ; if rs <= 8
  16830. + 401 01b6 040E jrle __L0007 ; then $$3
  16831. + 402 01b8 839C rl %r3,0x8 ; rd << 8
  16832. + 403 01ba FD1F jp.d __L0006
  16833. + 404 01bc 8264 sub %r2,0x8 ; ĥơȲ׻
  16834. + 405 __L0007:
  16835. + 406 01be 239D rl %r3,%r2
  16836. + 407 ; ld.w $2, [%sp+0] ; rså
  16837. + 408 ; add %sp, 1
  16838. + 409
  16839. + 410 01c0 6332 and %r3, %r6 ; isolate last x bits of %r3
  16840. + 411 01c2 3436 or %r4, %r3 ; add last x bits to %r4
  16841. + 412
  16842. + 413 overchk:
  16843. + 414 01c4 1FC0F16B xcmp %r1, 0x7ff
  16844. + 415 01c8 060C jrlt finish ; if exp < 0xff then jump to finish
  16845. + 416
  16846. + 417 overflow:
  16847. + 418 01ca FECF00C0 xld.w %r5, 0x7ff00000 ; put infinity into result
  16848. + 418 056C
  16849. + 419 01d0 081F jp.d end ; delayed jump
  16850. + 420 01d2 046C ld.w %r4, 0
  16851. + 421
  16852. + 422 finish:
  16853. + 423 ; %r0 = sign, %r1 = exponent, %r5 = mantissa
  16854. + 424
  16855. + 425 01d4 01C0FFDF xand %r5, 0xfffff ; isolate mantissa
  16856. + 425 F573
  16857. + 426
  16858. + 427 01da 81984198 xrr %r1, 12 ; position exponent bits to [30:23]
  16859. + 428 01de 1536 or %r5, %r1
  16860. + 429
  16861. + 430 end:
  16862. + 431 01e0 1098 rr %r0, 1 ; position sign bit to MSB
  16863. + 432 01e2 0536 or %r5, %r0 ; add sign bit
  16864. + 433
  16865. + 434 ;@@@ 01/01/23 add start hinokuchi
  16866. + 435 ;ld.w %r13, [%sp+3] ; %r13
  16867. + 436 ;ld.w %r12, [%sp+2] ; %r12
  16868. + 437 ;ld.w %r11, [%sp+1] ; %r11
  16869. + 438 ;ld.w %r10, [%sp+0] ; %r10
  16870. + 439 ;add %sp, 4
  16871. + 440 ;@@@ 01/01/23 add end
  16872. + 441 01e4 4302 popn %r3 ; restore register values
  16873. + 442
  16874. + 443 01e6 4006 ret
  16875. diff --git a/gcc/config/c33/libgcc/muldf3.s b/gcc/config/c33/libgcc/muldf3.s
  16876. new file mode 100644
  16877. index 0000000..f84e65b
  16878. --- /dev/null
  16879. +++ b/gcc/config/c33/libgcc/muldf3.s
  16880. @@ -0,0 +1,443 @@
  16881. +;*********************************************
  16882. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  16883. +;* ALL RIGHTS RESERVED
  16884. +;*
  16885. +;* filename : muldf3.s
  16886. +;*
  16887. +;* Double floating point multiplication function
  16888. +;* input: (%r7, %r6) & (%r9, %r8)
  16889. +;* output: (%r5, %r4)
  16890. +;*
  16891. +;* Begin 1996/09/12 V. Chan
  16892. +;* Fixed bug at multiply: 1997/02/18 V. Chan
  16893. +;* ѹ 2001/01/30 O.Hinokuchi
  16894. +;* gasб 2001/10/15 watanabe
  16895. +;*
  16896. +;*****************************************
  16897. +
  16898. +.section .text
  16899. +.align 1
  16900. +.global __muldf3
  16901. +
  16902. +;;macro SHFTROTSHFT $1, $2, $3, $4, $5, $6, $7
  16903. + ; used in 64-bit variable shifting
  16904. + ; $1 = shift amount
  16905. + ; $2 = 1st input register (shifted)
  16906. + ; $3 = 2nd input register (rotated)
  16907. + ; $4 = 3rd input register (mask --> shifted)
  16908. + ; $5 = shift instruction
  16909. + ; $6 = rotate instruction
  16910. + ; $7 = temp register
  16911. +; ld.w $7, $1 ; temp = shift amount
  16912. +
  16913. +;$$1:
  16914. +; cmp $7, 8 ; if temp <= 8 then goto $$2
  16915. +; jrle $$2
  16916. +
  16917. +; $5 $2, 8 ; shift 1st register
  16918. +; $6 $3, 8 ; rotate 2nd register
  16919. +; $5 $4, 8 ; shift 3rd register
  16920. +; jp.d $$1
  16921. +; sub $7, 8 ; temp = temp - 8
  16922. +
  16923. +;$$2:
  16924. +; $5 $2, $7 ; last shift
  16925. +; $6 $3, $7 ; last rotate
  16926. +; $5 $4, $7 ; last shift
  16927. +;;endm
  16928. +
  16929. +__muldf3:
  16930. + pushn %r3 ; save register values
  16931. + ;@@@ 01/01/30 add start hinokuchi
  16932. + ;sub %sp, 4
  16933. + ;ld.w [%sp+0], %r10 ; %r10
  16934. + ;ld.w [%sp+1], %r11 ; %r11
  16935. + ;ld.w [%sp+2], %r12 ; %r12
  16936. + ;ld.w [%sp+3], %r13 ; %r13
  16937. + ;@@@ 01/01/30 add end
  16938. +
  16939. + ld.w %r0, %r7 ; put sign of input1 (%r7) into %r0
  16940. + rl %r0, 1
  16941. + and %r0, 1
  16942. +
  16943. + ld.w %r2, %r9 ; put sign of input2 (%r9) into %r2
  16944. + rl %r2, 1
  16945. + and %r2, 1
  16946. +
  16947. + xor %r0, %r2 ; put new sign into register %r0
  16948. +
  16949. + ld.w %r5, 0 ; clear output register
  16950. + ;ld.w %r4, 0 ; moved to line 38 for a delayed jump
  16951. +
  16952. + sll %r7, 1 ; clear MSB
  16953. + srl %r7, 1
  16954. + cmp %r7, 0 ; checking if input1 = 0
  16955. + jrne.d input2
  16956. + ld.w %r4, 0
  16957. + cmp %r6, 0
  16958. + ext end@rm
  16959. + jreq end@rl ; if {%r7, %r6} = 0 then end
  16960. +
  16961. +input2:
  16962. + sll %r9, 1 ; clear MSB
  16963. + srl %r9, 1
  16964. + cmp %r9, 0 ; checking if input2 = 0
  16965. + jrne getexp
  16966. + cmp %r8, 0
  16967. + ext end@rm
  16968. + jreq end@rl ; if {%r9, %r8} = 0 then end
  16969. +
  16970. +getexp:
  16971. + ld.w %r1, %r7 ; put exponent1 into %r1
  16972. + xsrl %r1, 20
  16973. +
  16974. + xcmp %r1, 0x7ff ; check exp1 for overflow value
  16975. + ext overflow@rm
  16976. + jreq overflow@rl
  16977. +
  16978. + ld.w %r3, %r9 ; put exponent2 into %r3
  16979. + xsrl %r3, 20
  16980. +
  16981. + xcmp %r3, 0x7ff ; check exp2 for overflow value
  16982. + ext overflow@rm
  16983. + jreq overflow@rl
  16984. +
  16985. + ; free %r2, %r11 - %r13
  16986. + ; %r0 = sign, %r1 = sisu1, %r3 = sisu2
  16987. + ; %r10 = implied bit
  16988. +
  16989. + ;@@@ 01/02/16 del xld.w %r10, 0x100000 ; implied bit
  16990. + ld.w %r2, 1 ; temp = 1
  16991. + ;@@@ 01/02/16 del xld.w %r13, 0xfffff
  16992. +
  16993. + ; isolate mantissa1
  16994. + xand %r7, 0xfffff ; clear first 12 bits of %r6
  16995. + cmp %r1, 0
  16996. + jreq man2 ; if exp1 = 0 (denormal)
  16997. + xoor %r7, 0x100000 ; else add implied bit to mantissa
  16998. +
  16999. + ld.w %r2, 0 ; temp = 0
  17000. +
  17001. +man2:
  17002. + ; isolate mantissa2
  17003. + xand %r9, 0xfffff ; clear first 12 bits of %r7
  17004. +
  17005. + cmp %r3, 0
  17006. + jreq tempadd ; if exp2 = 0 then jump to tempadd
  17007. + xoor %r9, 0x100000 ; else add implied bit
  17008. + jp multiply ; delayed jump
  17009. +
  17010. +tempadd:
  17011. + add %r2, 1 ; temp = temp + 1 (2 if den * den : 1 if nor * den)
  17012. +
  17013. +multiply:
  17014. + ; %r0 = result sign, %r1 = result exponent
  17015. +
  17016. + ; calculate and check new exponent
  17017. + add %r1, %r3 ; sisu = sisu1 + sisu2 - bias + temp
  17018. +
  17019. + xsub %r1, 0x3ff
  17020. +
  17021. + add %r1, %r2
  17022. +
  17023. + xcmp %r1, 0x7ff ; if exp >= 0x7ff then goto overflow
  17024. + ext overflow@rm
  17025. + jrge overflow@rl
  17026. +
  17027. + ; max. shift from normal to denormal = 52
  17028. + ; min. exp = 1 - max. shift = -51
  17029. + xcmp %r1, -51 ; if exp < -51 then goto underflow
  17030. + jrlt underflow
  17031. +
  17032. + ; 64-bit * 64-bit = 128-bit
  17033. + ; 1st(128 ~ 97), 2nd(96 ~ 65), 3rd(64 ~ 33), 4th(32 ~ 0)
  17034. + ; (%r7,%r6) * (%r9,%r8)
  17035. + ; %r7 * a15 --> 1st,2nd
  17036. + ; %r7 * a14 --> 2nd,3rd
  17037. + ; %r6 * a15 --> 2nd,3rd
  17038. + ; %r6 * a14 --> 3rd,4th
  17039. + ; %r5 = result1, %r4 = result2, %r10 = result3, %r11 = result4, %r12 = temp
  17040. + ld.w %r2, 0 ; temp variable for adc and loop counter
  17041. + mltu.w %r7, %r9 ; kasu1 * kasu2
  17042. + ld.w %r5, %ahr ; %r5 = result1
  17043. + ld.w %r4, %alr ; %r4 = result2
  17044. + mltu.w %r7, %r8 ; kasu1 * kasu2_2
  17045. + ld.w %r7, %ahr
  17046. + add %r4, %r7
  17047. + adc %r5, %r2 ; add carry
  17048. + ld.w %r3, %alr ; %r10 = result3
  17049. + mltu.w %r6, %r9 ; kasu1_2 * kasu2
  17050. + ld.w %r7, %alr
  17051. + add %r3, %r7
  17052. + adc %r4, %r2 ; add carry
  17053. + adc %r5, %r2 ; add carry
  17054. + ld.w %r7, %ahr
  17055. + add %r4, %r7
  17056. + adc %r5, %r2 ; add carry
  17057. + mltu.w %r6, %r8 ; kasu1_2 * kasu2_2
  17058. + ld.w %r7, %ahr
  17059. + add %r3, %r7
  17060. + adc %r4, %r2 ; add carry
  17061. + adc %r5, %r2
  17062. + ld.w %r6, %alr ; %r11 = result4
  17063. +
  17064. + ; %r8 will be first result register > 0
  17065. + cmp %r5, 0 ; if %r5 !=0 then count it
  17066. + jrne.d count
  17067. + ld.w %r8, %r5
  17068. +
  17069. + xld.w %r2, 32 ; %r2 = loop counter = 32
  17070. + cmp %r4, 0 ; elsif %r4 != 0 then count it
  17071. + jrne.d count
  17072. + ld.w %r8, %r4
  17073. +
  17074. + xld.w %r2, 64 ; %r2 = loop counter = 64
  17075. + cmp %r3, 0 ; elsif %r10 != 0 then count it
  17076. + jrne.d count
  17077. + ld.w %r8, %r3
  17078. +
  17079. + xld.w %r2, 96 ; %r2 = loop counter = 96
  17080. + ld.w %r8, %r6 ; else count 0's leading %r6
  17081. +
  17082. +count:
  17083. + scan1 %r7, %r8 ; %r7 = count
  17084. + jruge normalize ; if count !=8 then goto normalize
  17085. + add %r2, 8 ; add 8 to loop counter
  17086. + jp.d count
  17087. + sll %r8, 8 ; shift register to the left 8 bits
  17088. +
  17089. +normalize:
  17090. + ; free %r2 - %r11, %r13
  17091. + ; %r0 = sign, %r1 = exp, %r7 = count
  17092. + ; note: max. count = 127, min. count = 22
  17093. +
  17094. + add %r7, %r2 ; count = count + loopcounter
  17095. +
  17096. + cmp %r1, 0 ; if exp > 0 then jump to expgtz
  17097. + jrgt.d expgtz
  17098. + sub %r7, 23 ; count = count - 23
  17099. +
  17100. + ; case: exp <= 0
  17101. +sub %sp, 1
  17102. +ld.w [%sp+0x0], %r3 ; %r3
  17103. + ld.w %r3, 1 ; %r3 = 1 - exp
  17104. + sub %r3, %r1
  17105. + ld.w %r2, 12 ; %r2 = shift
  17106. + sub %r2, %r3 ; shift = 12 - (1 - exp)
  17107. +ld.w %r3, [%sp+0x0] ; %r3
  17108. +add %sp, 1
  17109. + cmp %r1, %r7
  17110. + jrle.d shift ; if exp <= count then jump to shift
  17111. + ld.w %r1, 0 ; exp = 0
  17112. +
  17113. + ; case: exp > count - 23
  17114. + jp.d shift ; delayed jump
  17115. + ld.w %r1, 1 ; exp = 1
  17116. +
  17117. +expgtz:
  17118. + cmp %r7, %r1 ; if count < exp then goto shftltexp
  17119. + jrlt.d shftltexp
  17120. + ld.w %r2, 12 ; shift = 12
  17121. +
  17122. + ; case: original count - 23 >= exp
  17123. + add %r2, %r1 ; shift = shift + exp - 1
  17124. + sub %r2, 1 ; shift as much as exp allows (until denormal)
  17125. + jp.d shift
  17126. + ld.w %r1, 0 ; exp = 0
  17127. +
  17128. +shftltexp:
  17129. + sub %r1, %r7 ; exp = exp - count
  17130. + add %r2, %r7 ; shift = shift + count
  17131. +
  17132. +shift:
  17133. + cmp %r2, 0 ;if shift < 0 then shift to the right
  17134. + jrlt rshift
  17135. +
  17136. + xcmp %r2, 32 ; if 0 =< shift < 32 then goto lshift
  17137. + jrlt lshift
  17138. +
  17139. + xcmp %r2, 64 ; if 32 =< shift < 64 then goto shft32
  17140. + jrlt lshft32
  17141. +
  17142. + ; case: shift >= 64 (note: max. shift of norm * denormal = 87)
  17143. + ld.w %r5, %r3 ; result1 = result3
  17144. + ld.w %r4, %r6 ; result2 = result4
  17145. +
  17146. + xsub %r2, 64 ; shift = shift - 64
  17147. +
  17148. + jp.d lshift
  17149. + ld.w %r3, 0 ; result3 = 0
  17150. +
  17151. +lshft32:
  17152. + ld.w %r5, %r4 ; result1 = result2
  17153. + ld.w %r4, %r3 ; result2 = result3
  17154. + ld.w %r3, %r6 ; result3 = result4
  17155. + jp.d lshift
  17156. + sub %r2, 32 ; shift = shift - 32
  17157. +
  17158. +rshift:
  17159. + ; case: shift < 0
  17160. + not %r2, %r2 ; shift = ~shift + 1
  17161. + add %r2, 1
  17162. +
  17163. + xcmp %r2, 41 ; if shift > 41 (64-min.count-1) then
  17164. + jrgt underflow
  17165. +
  17166. + xcmp %r2, 32 ; if shift < 32 then shift right
  17167. + jrlt doshift
  17168. +
  17169. + ; case: 40 => shift >= 32
  17170. + ld.w %r4, %r5 ; result2 = result1
  17171. + sub %r2, 32 ; shift = shift - 32
  17172. +
  17173. + ; xsrl %r4, %r2 ; result2 >> shift
  17174. + ; 32-bit variable shift routine
  17175. +L1:
  17176. + cmp %r2, 8 ; if shift <= 8 then goto L2
  17177. + jrle L2
  17178. +
  17179. + srl %r4, 8 ; result >> %r2
  17180. + jp.d L1
  17181. + sub %r2, 8 ; shift = shift - 8
  17182. +
  17183. +L2:
  17184. + srl %r4, %r2 ; last shift
  17185. +
  17186. + jp.d finish
  17187. + ld.w %r5, 0 ; result1 = 0
  17188. +
  17189. +underflow:
  17190. + ld.w %r5, 0 ; result1 = 0
  17191. + jp.d end
  17192. + ld.w %r4, 0 ; result2 = 0
  17193. +
  17194. +doshift:
  17195. + ; {%r5, %r4} >> shift
  17196. + ;xsrl %r4, %r2 ; shift low 32-bits to the right x bits (shift amount = x)
  17197. + ;xrr %r5, %r2 ; rotate high 32-bits to the right x bits
  17198. + ;xsrl %r3, %r2 ; make a mask for last 32-x bits --> %r2 = 000...111
  17199. +
  17200. + ld.w %r9, -1 ; %r2 = 0xffff ffff
  17201. + ; used in 64-bit variable shifting ; SHFTROTSHFT %r2, %r4, %r5, %r9, srl, rr, %r2
  17202. + ; $1 = shift amount
  17203. + ; $2 = 1st input register (shifted)
  17204. + ; $3 = 2nd input register (rotated)
  17205. + ; $4 = 3rd input register (mask --> shifted)
  17206. + ; $5 = shift instruction
  17207. + ; $6 = rotate instruction
  17208. + ; $7 = temp register
  17209. + ld.w %r2, %r2 ; temp = shift amount
  17210. +
  17211. +__L0001:
  17212. + cmp %r2, 8 ; if temp <= 8 then goto $$2
  17213. + jrle __L0002
  17214. +
  17215. + srl %r4, 8 ; shift 1st register
  17216. + rr %r5, 8 ; rotate 2nd register
  17217. + srl %r9, 8 ; shift 3rd register
  17218. + jp.d __L0001
  17219. + sub %r2, 8 ; temp = temp - 8
  17220. +
  17221. +__L0002:
  17222. + srl %r4, %r2 ; last shift
  17223. + rr %r5, %r2 ; last rotate
  17224. + srl %r9, %r2 ; last shift
  17225. + not %r2, %r9 ; flip mask for first x bits --> %r9 = 111...000 (mask)
  17226. + and %r2, %r5 ; isolate first x bits of %r5
  17227. + or %r4, %r2 ; add first x bits of %r5 to %r4
  17228. + jp.d finish
  17229. + and %r5, %r9 ; keep the low 32-x bits of %r5
  17230. +
  17231. +lshift: ; case: shift >= 0
  17232. + ; {%r5, %r4, %r10} << shift
  17233. + ;xsll %r5, %r2 ; shift high 32-bits to the left x bits (shift amount = %r3 = x)
  17234. + ;xrl %r4, %r2 ; rotate mid 32-bits to the left x bits
  17235. + ;xsll %r3, %r2 ; make a mask for first 32-x bits --> %r3 = 111...000
  17236. +
  17237. + ld.w %r9, -1 ; %r9 = 0xffff ffff
  17238. + ; used in 64-bit variable shifting ; SHFTROTSHFT %r2, %r5, %r4, %r9, sll, rl, %r8 ; %r8 = temp
  17239. + ; $1 = shift amount
  17240. + ; $2 = 1st input register (shifted)
  17241. + ; $3 = 2nd input register (rotated)
  17242. + ; $4 = 3rd input register (mask --> shifted)
  17243. + ; $5 = shift instruction
  17244. + ; $6 = rotate instruction
  17245. + ; $7 = temp register
  17246. + ld.w %r8, %r2 ; temp = shift amount
  17247. +
  17248. +__L0003:
  17249. + cmp %r8, 8 ; if temp <= 8 then goto $$2
  17250. + jrle __L0004
  17251. +
  17252. + sll %r5, 8 ; shift 1st register
  17253. + rl %r4, 8 ; rotate 2nd register
  17254. + sll %r9, 8 ; shift 3rd register
  17255. + jp.d __L0003
  17256. + sub %r8, 8 ; temp = temp - 8
  17257. +
  17258. +__L0004:
  17259. + sll %r5, %r8 ; last shift
  17260. + rl %r4, %r8 ; last rotate
  17261. + sll %r9, %r8 ; last shift
  17262. + not %r8, %r9 ; flip mask for last x bits --> %r8 = 000...111 (mask)
  17263. + ld.w %r6, %r8 ; temp = %r8
  17264. + and %r8, %r4 ; isolate last x bits of %r4
  17265. + or %r5, %r8 ; add last x bits of %r4 to %r5
  17266. +
  17267. + cmp %r3, 0 ; if result3 = 0 then done shifting
  17268. + jreq.d overchk
  17269. + and %r4 %r9 ; keep the high 32-x bits of %r4
  17270. +
  17271. + ; case: result3 != 0
  17272. + ; MXRL %r3, %r2 ; rotate last register to the left
  17273. +__L0005:
  17274. +
  17275. +; sub %sp, 1
  17276. +; ld.w [%sp+0], $2 ; rså
  17277. +
  17278. + and %r2,0x1f ; ơȿ=
  17279. +__L0006:
  17280. + cmp %r2,0x8 ; if rs <= 8
  17281. + jrle __L0007 ; then $$3
  17282. + rl %r3,0x8 ; rd << 8
  17283. + jp.d __L0006
  17284. + sub %r2,0x8 ; ĥơȲ׻
  17285. +__L0007:
  17286. + rl %r3,%r2
  17287. +; ld.w $2, [%sp+0] ; rså
  17288. +; add %sp, 1
  17289. +
  17290. + and %r3, %r6 ; isolate last x bits of %r3
  17291. + or %r4, %r3 ; add last x bits to %r4
  17292. +
  17293. +overchk:
  17294. + xcmp %r1, 0x7ff
  17295. + jrlt finish ; if exp < 0xff then jump to finish
  17296. +
  17297. +overflow:
  17298. + xld.w %r5, 0x7ff00000 ; put infinity into result
  17299. + jp.d end ; delayed jump
  17300. + ld.w %r4, 0
  17301. +
  17302. +finish:
  17303. + ; %r0 = sign, %r1 = exponent, %r5 = mantissa
  17304. +
  17305. + xand %r5, 0xfffff ; isolate mantissa
  17306. +
  17307. + xrr %r1, 12 ; position exponent bits to [30:23]
  17308. + or %r5, %r1
  17309. +
  17310. +end:
  17311. + rr %r0, 1 ; position sign bit to MSB
  17312. + or %r5, %r0 ; add sign bit
  17313. +
  17314. + ;@@@ 01/01/23 add start hinokuchi
  17315. + ;ld.w %r13, [%sp+3] ; %r13
  17316. + ;ld.w %r12, [%sp+2] ; %r12
  17317. + ;ld.w %r11, [%sp+1] ; %r11
  17318. + ;ld.w %r10, [%sp+0] ; %r10
  17319. + ;add %sp, 4
  17320. + ;@@@ 01/01/23 add end
  17321. + popn %r3 ; restore register values
  17322. +
  17323. + ret
  17324. diff --git a/gcc/config/c33/libgcc/mulsf3.lst b/gcc/config/c33/libgcc/mulsf3.lst
  17325. new file mode 100644
  17326. index 0000000..1df33d6
  17327. --- /dev/null
  17328. +++ b/gcc/config/c33/libgcc/mulsf3.lst
  17329. @@ -0,0 +1,327 @@
  17330. +GAS LISTING mulsf3.s page 1
  17331. +
  17332. +
  17333. + 1 ;*********************************************
  17334. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  17335. + 3 ;* ALL RIGHTS RESERVED
  17336. + 4 ;*
  17337. + 5 ;* filename : mulsf3.s
  17338. + 6 ;*
  17339. + 7 ;* Single floating point multiplication function
  17340. + 8 ;* input: %r6, %r7
  17341. + 9 ;* output: %r4
  17342. + 10 ;*
  17343. + 11 ;* Begin 1996/09/12 V. Chan
  17344. + 12 ;* ѹ 2001/01/26 O.Hinokuchi
  17345. + 13 ;* 쥸ִ
  17346. + 14 ;*
  17347. + 15 ;*****************************************
  17348. + 16
  17349. + 17 .section .text
  17350. + 18 .align 1
  17351. + 19 .global __mulsf3
  17352. + 20
  17353. + 21 ;==============================================
  17354. + 22 ;쥸
  17355. + 23 ; %r0:ӥåȣ(0(+) or 1(-))
  17356. + 24 ; %r1:ؿ(8bit)
  17357. + 25 ; %r2:ӥåȣ(0(+) or 1(-))/temp/shift
  17358. + 26 ; %r3:ؿ(8bit)/mask
  17359. + 27 ; %r4:(float)/軻[H]
  17360. + 28 ; %r5:implied bit/count
  17361. + 29 ; %r6:/軻[L]/[L]
  17362. + 30 ; %r7:
  17363. + 31 ; %r8:mask
  17364. + 32 ; %r9:overflow value
  17365. + 33 ; %r12:scan64
  17366. + 34 ; %r13:scan64
  17367. + 35 ;==============================================
  17368. + 36
  17369. + 37
  17370. + 38 ;;macro VARSHIFT $1, $2, $3
  17371. + 39 ; used in 32-bit variable shifting
  17372. + 40 ; $1 = input register
  17373. + 41 ; $2 = shift amount
  17374. + 42 ; $3 = shift instruction
  17375. + 43 ;$$1:
  17376. + 44 ; cmp $2, 8 ; if temp <= 8 then goto $$2
  17377. + 45 ; jrle $$2
  17378. + 46
  17379. + 47 ; $3 $1, 8 ; shift input register 8 bits
  17380. + 48 ; jp.d $$1
  17381. + 49 ; sub $2, 8 ; temp = temp - 8
  17382. + 50
  17383. + 51 ;$$2:
  17384. + 52 ; $3 $1, $2 ; last shift
  17385. + 53 ;;endm
  17386. + 54
  17387. + 55 __mulsf3:
  17388. + 56
  17389. + 57 0000 0302 pushn %r3 ; save register values
  17390. + GAS LISTING mulsf3.s page 2
  17391. +
  17392. +
  17393. + 58
  17394. + 59 ;@@@ 01/01/26 add start hinokuchi
  17395. + 60 ;sub %sp, 2
  17396. + 61 ;ld.w [%sp+0], %r12 ; %r12
  17397. + 62 ;ld.w [%sp+1], %r13 ; %r13
  17398. + 63 ;@@@ 01/01/26 add end
  17399. + 64
  17400. + 65
  17401. + 66 ;@@@ 01/02/15 del xld.w %r9, 0xff ; overflow value(%r9) <- 0xff
  17402. + 67
  17403. + 68 0002 602E ld.w %r0, %r6 ; ӥåȣ(%r0) <- (%r6)
  17404. + 69 0004 109C rl %r0, 1 ; ӥåȣ(%r0) rotate left 1 bit
  17405. + 70 0006 1070 and %r0, 1 ; ӥåȣ(%r0) & 1
  17406. + 71
  17407. + 72 0008 722E ld.w %r2, %r7 ; ӥåȣ(%r2) <- (%r7)
  17408. + 73 000a 129C rl %r2, 1 ; ӥåȣ(%r2) rotate left 1 bit
  17409. + 74 000c 1270 and %r2, 1 ; ӥåȣ(%r2) & 1
  17410. + 75
  17411. + 76 000e 203A xor %r0, %r2 ; ӥåȣ(%r0) = ~ӥåȣ(%r0)
  17412. + 77 0010 046C ld.w %r4, 0 ; (%r4) <- 0
  17413. + 78
  17414. + 79 0012 168C sll %r6, 1 ; (%r6) << 1 clear MSB
  17415. + 80 0014 1688 srl %r6, 1 ; (%r6) >> 1
  17416. + 81 0016 0668 cmp %r6, 0
  17417. + 82 0018 00C0 ext end@rm
  17418. + 83 001a 8718 jreq end@rl ; if (%r6) = 0 then end
  17419. + 84
  17420. + 85 001c 178C sll %r7, 1 ; (%r7) << 1 clear MSB
  17421. + 86 001e 1788 srl %r7, 1 ; (%r7) >> 1
  17422. + 87 0020 0768 cmp %r7, 0
  17423. + 88 0022 00C0 ext end@rm
  17424. + 89 0024 8218 jreq end@rl ; if (%r7) = 0 then end
  17425. + 90
  17426. + 91 0026 612E ld.w %r1, %r6 ; ؿ(%r1) <- (%r6)
  17427. + 92 0028 81888188 xsrl %r1, 23 ; ؿ(%r1) >> 23
  17428. + 92 7188
  17429. + 93
  17430. + 94 002e 03C0F16B xcmp %r1, 0xff ; if ؿ(%r1) >= overflow value
  17431. + 95 0032 710A jrge overflow ; then jump to overflow
  17432. + 96
  17433. + 97 0034 732E ld.w %r3, %r7 ; ؿ(%r3) <- (%r7)
  17434. + 98 0036 83888388 xsrl %r3, 23 ; ؿ(%r3) >> 23
  17435. + 98 7388
  17436. + 99
  17437. + 100 003c 03C0F36B xcmp %r3, 0xff ; if ؿ(%r3) >= overflow value
  17438. + 101 0040 6A0A jrge overflow ; then jump to overflow
  17439. + 102
  17440. + 103 ;@@@ 01/02/15 del xld.w %r8, 0x7fffff ; mask(%r8) <- 0x7fffff set mask for isolating mantissa
  17441. + 104 ;@@@ 01/02/15 del xld.w %r5, 0x800000 ; implied bit(%r5) <- 0x800000
  17442. + 105 0042 0FC0FFDF xld.w %r5, 0x7fffff ; mask(%r5) <- 0x7fffff set mask for isolating mantissa @@@ 01/02/15 add
  17443. + 105 F56F
  17444. + 106
  17445. + 107 0048 126C ld.w %r2, 1 ; temp(%r2) <- 1
  17446. + 108
  17447. + 109 ; isolate mantissa1
  17448. + 110 004a 0168 cmp %r1, 0
  17449. + 111 004c 0619 jreq.d getman2 ; if ؿ(%r1) = 0 (denormal)
  17450. + GAS LISTING mulsf3.s page 3
  17451. +
  17452. +
  17453. + 112 004e 5632 and %r6, %r5 ; clear first 9 bits of %r6
  17454. + 113 0050 10C000C0 xoor %r6, 0x800000 ; else add implied bit(0x800000) to mantissa
  17455. + 113 0674
  17456. + 114
  17457. + 115 0056 026C ld.w %r2, 0 ; temp(%r2) = 0
  17458. + 116
  17459. + 117 getman2:
  17460. + 118 ; isolate mantissa2
  17461. + 119 0058 0368 cmp %r3, 0
  17462. + 120 005a 0719 jreq.d flag ; if exp2 = 0 then jump to flag
  17463. + 121 005c 5732 and %r7, %r5 ; clear first 9 bits of %r7
  17464. + 122 005e 10C000C0 xld.w %r5, 0x800000 ; implied bit(%r5) <- 0x800000 @@@ 01/02/15 add
  17465. + 122 056C
  17466. + 123 0064 031F jp.d multi ; delayed jump
  17467. + 124 0066 5736 or %r7, %r5 ; else add implied bit(0x800000)
  17468. + 125
  17469. + 126 flag:
  17470. + 127 0068 1260 add %r2, 1 ; temp(%r2) = 2 or 1 (2 if den * den : 1 if nor * den)
  17471. + 128
  17472. + 129 multi:
  17473. + 130 ; check result exponent
  17474. + 131 006a 3122 add %r1, %r3 ; ؿ(%r1) = ؿ(%r1) + ؿ(%r3) + temp(%r2) - bias(0x7f)
  17475. + 132 006c 2122 add %r1, %r2
  17476. + 133
  17477. + 134 006e 01C0F167 xsub %r1, 0x7f ; ؿ(%r1) = ؿ(%r1) - 0x7f
  17478. + 135
  17479. + 136 0072 03C0F16B xcmp %r1, 0xff ; if ؿ(%r1) >= 0xff then goto overflow
  17480. + 137 0076 4F0A jrge overflow
  17481. + 138
  17482. + 139 0078 A16A xcmp %r1, -22 ; if ؿ(%r1) < -22 then goto end
  17483. + 140 007a 570D jrlt.d end
  17484. + 141 007c 046C ld.w %r4, 0 ; underflow value
  17485. + 142
  17486. + 143 007e 76AE mltu.w %r6, %r7 ; %ahr,%alr <- (%r6) * (%r7) multiply: 64-bit result is {%r4, %r6}
  17487. + 144 0080 34A4 ld.w %r4, %ahr ; 軻[H](%r4) <- %ahr
  17488. + 145 0082 26A4 ld.w %r6, %alr ; 軻[L](%r6) <- %alr
  17489. + 146
  17490. + 147 0084 482E ld.w %r8, %r4 ; scan64 (%r8) <- 軻[H](%r4)
  17491. + 148 0086 692E ld.w %r9, %r6 ; scan64 (%r9) <- 軻[L](%r6)
  17492. + 149 0088 00C000C0 xcall __scan64
  17493. + 149 001C
  17494. + 150 008e 952E ld.w %r5, %r9 ; %r5 = count (; of leading 0's in result)
  17495. + 151
  17496. + 152 normalize:
  17497. + 153 ; %r0 = result sign, %r1 = result exponent
  17498. + 154 ; %r5 = count, %r4 = result1, %r6 = result2
  17499. + 155 ; note: max. count = 63, min. count = 16
  17500. + 156
  17501. + 157 0090 0168 cmp %r1, 0 ; if ؿ(%r1) > 0 then jump to expgtz
  17502. + 158 0092 0B09 jrgt.d expgtz
  17503. + 159 0094 1565 sub %r5, 17 ; count(%r5) = count(%r5) - 17
  17504. + 160
  17505. + 161 ; case: exp <= 0
  17506. + 162 0096 136C ld.w %r3, 1 ; ؿ(%r3) = 1 - ؿ(%r1)
  17507. + 163 0098 1326 sub %r3, %r1
  17508. + 164 009a 926C ld.w %r2, 9 ; %r2 = shift
  17509. + 165 009c 3226 sub %r2, %r3 ; shift(%r2) = 9 - (1 - ؿ(%r1))
  17510. + GAS LISTING mulsf3.s page 4
  17511. +
  17512. +
  17513. + 166
  17514. + 167 009e 512A cmp %r1, %r5
  17515. + 168 00a0 0D0F jrle.d shift ; if ؿ(%r1) <= count then jump to shift
  17516. + 169 00a2 016C ld.w %r1, 0 ; ؿ(%r1) <- 0
  17517. + 170
  17518. + 171 ; case: exp > count - 17 (only when exp = 0 and original count = 16)
  17519. + 172 00a4 0B1F jp.d shift ; delayed jump
  17520. + 173 00a6 116C ld.w %r1, 1 ; ؿ(%r1) <- 1
  17521. + 174
  17522. + 175 expgtz:
  17523. + 176 00a8 152A cmp %r5, %r1 ; if count(%r5) < ؿ(%r1) then goto shftltexp
  17524. + 177 00aa 060D jrlt.d shftltexp
  17525. + 178 00ac 926C ld.w %r2, 9 ; shift(2) <- 9 (for positioning)
  17526. + 179
  17527. + 180 ; case: original count - 17 >= exp
  17528. + 181 00ae 1222 add %r2, %r1 ; shift(%r2) = shift(%r2) + ؿ(%r1) - 1
  17529. + 182 00b0 1264 sub %r2, 1 ; shift(%r2) as much as exp allows (until denormal)
  17530. + 183 00b2 041F jp.d shift
  17531. + 184 00b4 016C ld.w %r1, 0 ; ؿ(%r1) <- 0
  17532. + 185
  17533. + 186 shftltexp:
  17534. + 187 00b6 5126 sub %r1, %r5 ; ؿ(%r1) = ؿ(%r1) - count(%r5)
  17535. + 188 00b8 5222 add %r2, %r5 ; shift(2) = shift(%r2) + count(%r5)
  17536. + 189
  17537. + 190 shift:
  17538. + 191 ; max. shift < 64
  17539. + 192 00ba 0268 cmp %r2, 0 ; if shift(%r2) < 0 then shift to the right
  17540. + 193 00bc 0D0C jrlt rshift
  17541. + 194 00be 00C0026A xcmp %r2, 32 ; if shift(%r2) < 32 then goto lshift
  17542. + 195 00c2 170C jrlt lshift
  17543. + 196
  17544. + 197 ; case: shift >= 32 (at least one is denormal)
  17545. + 198 00c4 642E ld.w %r4, %r6 ; result1 = result2
  17546. + 199 00c6 0266 sub %r2, 32 ; shift(%r2) = shift(%r2) - 32
  17547. + 200 ;xsll %r4, %r2 ; result1 << shift
  17548. + 201 ; used in 32-bit variable shifting ; VARSHIFT %r4, %r2, sll
  17549. + 202 ; $1 = input register
  17550. + 203 ; $2 = shift amount
  17551. + 204 ; $3 = shift instruction
  17552. + 205 __L0001:
  17553. + 206 00c8 8268 cmp %r2, 8 ; if temp <= 8 then goto $$2
  17554. + 207 00ca 040E jrle __L0002
  17555. + 208
  17556. + 209 00cc 848C sll %r4, 8 ; shift input register 8 bits
  17557. + 210 00ce FD1F jp.d __L0001
  17558. + 211 00d0 8264 sub %r2, 8 ; temp = temp - 8
  17559. + 212
  17560. + 213 __L0002:
  17561. + 214 00d2 248D sll %r4, %r2 ; last shift
  17562. + 215 00d4 241E jp finish ; no overflow from norm * den
  17563. + 216
  17564. + 217 rshift:
  17565. + 218 ; case: shift < 0
  17566. + 219 00d6 223E not %r2, %r2 ; shift(%r2) = ~shift(%r2) + 1
  17567. + 220 00d8 1260 add %r2, 1
  17568. + 221
  17569. + 222 00da 0269 cmp %r2, 16 ; if shift(2) < 16 then shift
  17570. + GAS LISTING mulsf3.s page 5
  17571. +
  17572. +
  17573. + 223 00dc 030C jrlt denormal
  17574. + 224
  17575. + 225 ; case: shift >= 16
  17576. + 226 00de 251F jp.d end
  17577. + 227 00e0 046C ld.w %r4, 0 ; (%r4) <- 0
  17578. + 228
  17579. + 229 denormal:
  17580. + 230 ; case: shift < 16
  17581. + 231 ;xsrl %r4, %r2 ; result >> shift
  17582. + 232 ; used in 32-bit variable shifting ; VARSHIFT %r4, %r2, srl
  17583. + 233 ; $1 = input register
  17584. + 234 ; $2 = shift amount
  17585. + 235 ; $3 = shift instruction
  17586. + 236 __L0003:
  17587. + 237 00e2 8268 cmp %r2, 8 ; if temp <= 8 then goto $$2
  17588. + 238 00e4 040E jrle __L0004
  17589. + 239
  17590. + 240 00e6 8488 srl %r4, 8 ; shift input register 8 bits
  17591. + 241 00e8 FD1F jp.d __L0003
  17592. + 242 00ea 8264 sub %r2, 8 ; temp = temp - 8
  17593. + 243
  17594. + 244 __L0004:
  17595. + 245 00ec 2489 srl %r4, %r2 ; last shift
  17596. + 246 00ee 171E jp finish
  17597. + 247
  17598. + 248 lshift: ; case: 32 > shift >= 0
  17599. + 249 ; {%r4, %r6} << shift
  17600. + 250 ;xsll %r4, %r2 ; shift high 32-bits to the left x bits (shift amount = x)
  17601. + 251 ;xrl %r6, %r2 ; rotate low 32-bits to the left x bits
  17602. + 252 ;xsll %r3, %r2 ; make a mask for first 32-x bits --> %r3 = 111...000
  17603. + 253
  17604. + 254 00f0 F36F ld.w %r3, -1 ; %r3 = 0xffff ffff
  17605. + 255 ; 64-bit variable shift and rotate routine
  17606. + 256 L1:
  17607. + 257 00f2 8268 cmp %r2, 8 ; if shift(%r2) amount <= 8 then goto L2
  17608. + 258 00f4 060E jrle L2
  17609. + 259
  17610. + 260 00f6 848C sll %r4, 8 ; (%r4) << 8
  17611. + 261 00f8 869C rl %r6, 8 ; [L](%r6) rotate << 8
  17612. + 262 00fa 838C sll %r3, 8 ; mask(%r3) << 8
  17613. + 263 00fc FB1F jp.d L1
  17614. + 264 00fe 8264 sub %r2, 8 ; shift(%r2) = shift(%r2) - 8
  17615. + 265
  17616. + 266 L2:
  17617. + 267 0100 248D sll %r4, %r2 ; (%r4) << shift(%r2)
  17618. + 268 0102 269D rl %r6, %r2 ; [L] rotate << shift(%r2)
  17619. + 269 0104 238D sll %r3, %r2 ; mask(%r3) << shift(%r2)
  17620. + 270
  17621. + 271 0106 323E not %r2, %r3 ; flip mask for last x bits --> %r2 = 000...111 (mask)
  17622. + 272 0108 6232 and %r2, %r6 ; isolate last x bits of %r6
  17623. + 273 010a 2436 or %r4, %r2 ; add last x bits of %r4 to %r4
  17624. + 274 010c 3632 and %r6, %r3 ; keep the high 32-x bits of %r6
  17625. + 275
  17626. + 276 ; overflow check
  17627. + 277 010e 03C0F16B xcmp %r1, 0xff ; if ؿ(%r1) < overflow value(%r9)
  17628. + 278 0112 050C jrlt finish ; then jump to finish
  17629. + 279
  17630. + GAS LISTING mulsf3.s page 6
  17631. +
  17632. +
  17633. + 280 overflow:
  17634. + 281 0114 F0CF00C0 xld.w %r4, 0x7f800000 ; put infinity into result
  17635. + 281 046C
  17636. + 282 011a 071E jp end ; delayed jump
  17637. + 283
  17638. + 284 finish:
  17639. + 285 ; %r0 = sign, %r1 = exponent, %r4 = mantissa
  17640. + 286 011c 0FC0FFDF xand %r4, 0x7fffff ; isolate mantissa
  17641. + 286 F473
  17642. + 287 0122 81981198 xrr %r1, 9 ; position exponent bits to [30:23]
  17643. + 288 0126 1436 or %r4, %r1
  17644. + 289
  17645. + 290 end:
  17646. + 291 0128 1098 rr %r0, 1 ; position sign bit to MSB
  17647. + 292 012a 0436 or %r4, %r0 ; (%r4) | ӥåȣ(%r0)
  17648. + 293
  17649. + 294 ;@@@ 01/01/23 add start hinokuchi
  17650. + 295 ;ld.w %r13, [%sp+1] ; %r13
  17651. + 296 ;ld.w %r12, [%sp+0] ; %r12
  17652. + 297 ;add %sp, 2
  17653. + 298 ;@@@ 01/01/23 add end
  17654. + 299
  17655. + 300 012c 4302 popn %r3 ; restore register values
  17656. + 301 012e 4006 ret
  17657. diff --git a/gcc/config/c33/libgcc/mulsf3.s b/gcc/config/c33/libgcc/mulsf3.s
  17658. new file mode 100644
  17659. index 0000000..231c219
  17660. --- /dev/null
  17661. +++ b/gcc/config/c33/libgcc/mulsf3.s
  17662. @@ -0,0 +1,301 @@
  17663. +;*********************************************
  17664. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  17665. +;* ALL RIGHTS RESERVED
  17666. +;*
  17667. +;* filename : mulsf3.s
  17668. +;*
  17669. +;* Single floating point multiplication function
  17670. +;* input: %r6, %r7
  17671. +;* output: %r4
  17672. +;*
  17673. +;* Begin 1996/09/12 V. Chan
  17674. +;* ѹ 2001/01/26 O.Hinokuchi
  17675. +;* 쥸ִ
  17676. +;*
  17677. +;*****************************************
  17678. +
  17679. +.section .text
  17680. +.align 1
  17681. +.global __mulsf3
  17682. +
  17683. +;==============================================
  17684. +;쥸
  17685. +; %r0:ӥåȣ(0(+) or 1(-))
  17686. +; %r1:ؿ(8bit)
  17687. +; %r2:ӥåȣ(0(+) or 1(-))/temp/shift
  17688. +; %r3:ؿ(8bit)/mask
  17689. +; %r4:(float)/軻[H]
  17690. +; %r5:implied bit/count
  17691. +; %r6:/軻[L]/[L]
  17692. +; %r7:
  17693. +; %r8:mask
  17694. +; %r9:overflow value
  17695. +; %r12:scan64
  17696. +; %r13:scan64
  17697. +;==============================================
  17698. +
  17699. +
  17700. +;;macro VARSHIFT $1, $2, $3
  17701. + ; used in 32-bit variable shifting
  17702. + ; $1 = input register
  17703. + ; $2 = shift amount
  17704. + ; $3 = shift instruction
  17705. +;$$1:
  17706. +; cmp $2, 8 ; if temp <= 8 then goto $$2
  17707. +; jrle $$2
  17708. +
  17709. +; $3 $1, 8 ; shift input register 8 bits
  17710. +; jp.d $$1
  17711. +; sub $2, 8 ; temp = temp - 8
  17712. +
  17713. +;$$2:
  17714. +; $3 $1, $2 ; last shift
  17715. +;;endm
  17716. +
  17717. +__mulsf3:
  17718. +
  17719. + pushn %r3 ; save register values
  17720. +
  17721. + ;@@@ 01/01/26 add start hinokuchi
  17722. + ;sub %sp, 2
  17723. + ;ld.w [%sp+0], %r12 ; %r12
  17724. + ;ld.w [%sp+1], %r13 ; %r13
  17725. + ;@@@ 01/01/26 add end
  17726. +
  17727. +
  17728. + ;@@@ 01/02/15 del xld.w %r9, 0xff ; overflow value(%r9) <- 0xff
  17729. +
  17730. + ld.w %r0, %r6 ; ӥåȣ(%r0) <- (%r6)
  17731. + rl %r0, 1 ; ӥåȣ(%r0) rotate left 1 bit
  17732. + and %r0, 1 ; ӥåȣ(%r0) & 1
  17733. +
  17734. + ld.w %r2, %r7 ; ӥåȣ(%r2) <- (%r7)
  17735. + rl %r2, 1 ; ӥåȣ(%r2) rotate left 1 bit
  17736. + and %r2, 1 ; ӥåȣ(%r2) & 1
  17737. +
  17738. + xor %r0, %r2 ; ӥåȣ(%r0) = ~ӥåȣ(%r0)
  17739. + ld.w %r4, 0 ; (%r4) <- 0
  17740. +
  17741. + sll %r6, 1 ; (%r6) << 1 clear MSB
  17742. + srl %r6, 1 ; (%r6) >> 1
  17743. + cmp %r6, 0
  17744. + ext end@rm
  17745. + jreq end@rl ; if (%r6) = 0 then end
  17746. +
  17747. + sll %r7, 1 ; (%r7) << 1 clear MSB
  17748. + srl %r7, 1 ; (%r7) >> 1
  17749. + cmp %r7, 0
  17750. + ext end@rm
  17751. + jreq end@rl ; if (%r7) = 0 then end
  17752. +
  17753. + ld.w %r1, %r6 ; ؿ(%r1) <- (%r6)
  17754. + xsrl %r1, 23 ; ؿ(%r1) >> 23
  17755. +
  17756. + xcmp %r1, 0xff ; if ؿ(%r1) >= overflow value
  17757. + jrge overflow ; then jump to overflow
  17758. +
  17759. + ld.w %r3, %r7 ; ؿ(%r3) <- (%r7)
  17760. + xsrl %r3, 23 ; ؿ(%r3) >> 23
  17761. +
  17762. + xcmp %r3, 0xff ; if ؿ(%r3) >= overflow value
  17763. + jrge overflow ; then jump to overflow
  17764. +
  17765. + ;@@@ 01/02/15 del xld.w %r8, 0x7fffff ; mask(%r8) <- 0x7fffff set mask for isolating mantissa
  17766. + ;@@@ 01/02/15 del xld.w %r5, 0x800000 ; implied bit(%r5) <- 0x800000
  17767. + xld.w %r5, 0x7fffff ; mask(%r5) <- 0x7fffff set mask for isolating mantissa @@@ 01/02/15 add
  17768. +
  17769. + ld.w %r2, 1 ; temp(%r2) <- 1
  17770. +
  17771. + ; isolate mantissa1
  17772. + cmp %r1, 0
  17773. + jreq.d getman2 ; if ؿ(%r1) = 0 (denormal)
  17774. + and %r6, %r5 ; clear first 9 bits of %r6
  17775. + xoor %r6, 0x800000 ; else add implied bit(0x800000) to mantissa
  17776. +
  17777. + ld.w %r2, 0 ; temp(%r2) = 0
  17778. +
  17779. +getman2:
  17780. + ; isolate mantissa2
  17781. + cmp %r3, 0
  17782. + jreq.d flag ; if exp2 = 0 then jump to flag
  17783. + and %r7, %r5 ; clear first 9 bits of %r7
  17784. + xld.w %r5, 0x800000 ; implied bit(%r5) <- 0x800000 @@@ 01/02/15 add
  17785. + jp.d multi ; delayed jump
  17786. + or %r7, %r5 ; else add implied bit(0x800000)
  17787. +
  17788. +flag:
  17789. + add %r2, 1 ; temp(%r2) = 2 or 1 (2 if den * den : 1 if nor * den)
  17790. +
  17791. +multi:
  17792. + ; check result exponent
  17793. + add %r1, %r3 ; ؿ(%r1) = ؿ(%r1) + ؿ(%r3) + temp(%r2) - bias(0x7f)
  17794. + add %r1, %r2
  17795. +
  17796. + xsub %r1, 0x7f ; ؿ(%r1) = ؿ(%r1) - 0x7f
  17797. +
  17798. + xcmp %r1, 0xff ; if ؿ(%r1) >= 0xff then goto overflow
  17799. + jrge overflow
  17800. +
  17801. + xcmp %r1, -22 ; if ؿ(%r1) < -22 then goto end
  17802. + jrlt.d end
  17803. + ld.w %r4, 0 ; underflow value
  17804. +
  17805. + mltu.w %r6, %r7 ; %ahr,%alr <- (%r6) * (%r7) multiply: 64-bit result is {%r4, %r6}
  17806. + ld.w %r4, %ahr ; 軻[H](%r4) <- %ahr
  17807. + ld.w %r6, %alr ; 軻[L](%r6) <- %alr
  17808. +
  17809. + ld.w %r8, %r4 ; scan64 (%r8) <- 軻[H](%r4)
  17810. + ld.w %r9, %r6 ; scan64 (%r9) <- 軻[L](%r6)
  17811. + xcall __scan64
  17812. + ld.w %r5, %r9 ; %r5 = count (; of leading 0's in result)
  17813. +
  17814. +normalize:
  17815. + ; %r0 = result sign, %r1 = result exponent
  17816. + ; %r5 = count, %r4 = result1, %r6 = result2
  17817. + ; note: max. count = 63, min. count = 16
  17818. +
  17819. + cmp %r1, 0 ; if ؿ(%r1) > 0 then jump to expgtz
  17820. + jrgt.d expgtz
  17821. + sub %r5, 17 ; count(%r5) = count(%r5) - 17
  17822. +
  17823. + ; case: exp <= 0
  17824. + ld.w %r3, 1 ; ؿ(%r3) = 1 - ؿ(%r1)
  17825. + sub %r3, %r1
  17826. + ld.w %r2, 9 ; %r2 = shift
  17827. + sub %r2, %r3 ; shift(%r2) = 9 - (1 - ؿ(%r1))
  17828. +
  17829. + cmp %r1, %r5
  17830. + jrle.d shift ; if ؿ(%r1) <= count then jump to shift
  17831. + ld.w %r1, 0 ; ؿ(%r1) <- 0
  17832. +
  17833. + ; case: exp > count - 17 (only when exp = 0 and original count = 16)
  17834. + jp.d shift ; delayed jump
  17835. + ld.w %r1, 1 ; ؿ(%r1) <- 1
  17836. +
  17837. +expgtz:
  17838. + cmp %r5, %r1 ; if count(%r5) < ؿ(%r1) then goto shftltexp
  17839. + jrlt.d shftltexp
  17840. + ld.w %r2, 9 ; shift(2) <- 9 (for positioning)
  17841. +
  17842. + ; case: original count - 17 >= exp
  17843. + add %r2, %r1 ; shift(%r2) = shift(%r2) + ؿ(%r1) - 1
  17844. + sub %r2, 1 ; shift(%r2) as much as exp allows (until denormal)
  17845. + jp.d shift
  17846. + ld.w %r1, 0 ; ؿ(%r1) <- 0
  17847. +
  17848. +shftltexp:
  17849. + sub %r1, %r5 ; ؿ(%r1) = ؿ(%r1) - count(%r5)
  17850. + add %r2, %r5 ; shift(2) = shift(%r2) + count(%r5)
  17851. +
  17852. +shift:
  17853. + ; max. shift < 64
  17854. + cmp %r2, 0 ; if shift(%r2) < 0 then shift to the right
  17855. + jrlt rshift
  17856. + xcmp %r2, 32 ; if shift(%r2) < 32 then goto lshift
  17857. + jrlt lshift
  17858. +
  17859. + ; case: shift >= 32 (at least one is denormal)
  17860. + ld.w %r4, %r6 ; result1 = result2
  17861. + sub %r2, 32 ; shift(%r2) = shift(%r2) - 32
  17862. + ;xsll %r4, %r2 ; result1 << shift
  17863. + ; used in 32-bit variable shifting ; VARSHIFT %r4, %r2, sll
  17864. + ; $1 = input register
  17865. + ; $2 = shift amount
  17866. + ; $3 = shift instruction
  17867. +__L0001:
  17868. + cmp %r2, 8 ; if temp <= 8 then goto $$2
  17869. + jrle __L0002
  17870. +
  17871. + sll %r4, 8 ; shift input register 8 bits
  17872. + jp.d __L0001
  17873. + sub %r2, 8 ; temp = temp - 8
  17874. +
  17875. +__L0002:
  17876. + sll %r4, %r2 ; last shift
  17877. + jp finish ; no overflow from norm * den
  17878. +
  17879. +rshift:
  17880. + ; case: shift < 0
  17881. + not %r2, %r2 ; shift(%r2) = ~shift(%r2) + 1
  17882. + add %r2, 1
  17883. +
  17884. + cmp %r2, 16 ; if shift(2) < 16 then shift
  17885. + jrlt denormal
  17886. +
  17887. + ; case: shift >= 16
  17888. + jp.d end
  17889. + ld.w %r4, 0 ; (%r4) <- 0
  17890. +
  17891. +denormal:
  17892. + ; case: shift < 16
  17893. + ;xsrl %r4, %r2 ; result >> shift
  17894. + ; used in 32-bit variable shifting ; VARSHIFT %r4, %r2, srl
  17895. + ; $1 = input register
  17896. + ; $2 = shift amount
  17897. + ; $3 = shift instruction
  17898. +__L0003:
  17899. + cmp %r2, 8 ; if temp <= 8 then goto $$2
  17900. + jrle __L0004
  17901. +
  17902. + srl %r4, 8 ; shift input register 8 bits
  17903. + jp.d __L0003
  17904. + sub %r2, 8 ; temp = temp - 8
  17905. +
  17906. +__L0004:
  17907. + srl %r4, %r2 ; last shift
  17908. + jp finish
  17909. +
  17910. +lshift: ; case: 32 > shift >= 0
  17911. + ; {%r4, %r6} << shift
  17912. + ;xsll %r4, %r2 ; shift high 32-bits to the left x bits (shift amount = x)
  17913. + ;xrl %r6, %r2 ; rotate low 32-bits to the left x bits
  17914. + ;xsll %r3, %r2 ; make a mask for first 32-x bits --> %r3 = 111...000
  17915. +
  17916. + ld.w %r3, -1 ; %r3 = 0xffff ffff
  17917. + ; 64-bit variable shift and rotate routine
  17918. +L1:
  17919. + cmp %r2, 8 ; if shift(%r2) amount <= 8 then goto L2
  17920. + jrle L2
  17921. +
  17922. + sll %r4, 8 ; (%r4) << 8
  17923. + rl %r6, 8 ; [L](%r6) rotate << 8
  17924. + sll %r3, 8 ; mask(%r3) << 8
  17925. + jp.d L1
  17926. + sub %r2, 8 ; shift(%r2) = shift(%r2) - 8
  17927. +
  17928. +L2:
  17929. + sll %r4, %r2 ; (%r4) << shift(%r2)
  17930. + rl %r6, %r2 ; [L] rotate << shift(%r2)
  17931. + sll %r3, %r2 ; mask(%r3) << shift(%r2)
  17932. +
  17933. + not %r2, %r3 ; flip mask for last x bits --> %r2 = 000...111 (mask)
  17934. + and %r2, %r6 ; isolate last x bits of %r6
  17935. + or %r4, %r2 ; add last x bits of %r4 to %r4
  17936. + and %r6, %r3 ; keep the high 32-x bits of %r6
  17937. +
  17938. + ; overflow check
  17939. + xcmp %r1, 0xff ; if ؿ(%r1) < overflow value(%r9)
  17940. + jrlt finish ; then jump to finish
  17941. +
  17942. +overflow:
  17943. + xld.w %r4, 0x7f800000 ; put infinity into result
  17944. + jp end ; delayed jump
  17945. +
  17946. +finish:
  17947. + ; %r0 = sign, %r1 = exponent, %r4 = mantissa
  17948. + xand %r4, 0x7fffff ; isolate mantissa
  17949. + xrr %r1, 9 ; position exponent bits to [30:23]
  17950. + or %r4, %r1
  17951. +
  17952. +end:
  17953. + rr %r0, 1 ; position sign bit to MSB
  17954. + or %r4, %r0 ; (%r4) | ӥåȣ(%r0)
  17955. +
  17956. + ;@@@ 01/01/23 add start hinokuchi
  17957. + ;ld.w %r13, [%sp+1] ; %r13
  17958. + ;ld.w %r12, [%sp+0] ; %r12
  17959. + ;add %sp, 2
  17960. + ;@@@ 01/01/23 add end
  17961. +
  17962. + popn %r3 ; restore register values
  17963. + ret
  17964. diff --git a/gcc/config/c33/libgcc/negdf2.lst b/gcc/config/c33/libgcc/negdf2.lst
  17965. new file mode 100644
  17966. index 0000000..a41575f
  17967. --- /dev/null
  17968. +++ b/gcc/config/c33/libgcc/negdf2.lst
  17969. @@ -0,0 +1,41 @@
  17970. +GAS LISTING negdf2.s page 1
  17971. +
  17972. +
  17973. + 1 ;*********************************************
  17974. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  17975. + 3 ;* ALL RIGHTS RESERVED
  17976. + 4 ;*
  17977. + 5 ;* filename : negdfs.s
  17978. + 6 ;*
  17979. + 7 ;* Double floating point negative function
  17980. + 8 ;* input: (%r7, %r6)
  17981. + 9 ;* output: (%r5, %r4)
  17982. + 10 ;*
  17983. + 11 ;* Begin 1996/09/12 V. Chan
  17984. + 12 ;* ѹ 2001/01/15 O.Hinokuchi
  17985. + 13 ;* 쥸ִ
  17986. + 14 ;* gasб 2001/10/15 watanabe
  17987. + 15 ;*
  17988. + 16 ;*********************************************
  17989. + 17
  17990. + 18 .section .text
  17991. + 19 .align 1
  17992. + 20 .global __negdf2
  17993. + 21
  17994. + 22 ;==============================================
  17995. + 23 ;쥸
  17996. + 24 ; %r4:(L)(double)
  17997. + 25 ; %r5:(H)(double)
  17998. + 26 ; %r6:(L)(double)
  17999. + 27 ; %r7:(H)(double)
  18000. + 28 ;==============================================
  18001. + 29
  18002. + 30 __negdf2:
  18003. + 31
  18004. + 32 ; flip the MSB of %r5 and put result in %r6
  18005. + 33 0000 752E ld.w %r5,%r7 ;(H)(5) <- (H)(7)
  18006. + 34 0002 00D000C0 xxor %r5,0x80000000 ;(H)(5) <- (H)(5) | 0x80000000
  18007. + 34 0578
  18008. + 35 0008 642E ld.w %r4, %r6 ;(L)(4) <- (L)(6)
  18009. + 36
  18010. + 37 000a 4006 ret
  18011. diff --git a/gcc/config/c33/libgcc/negdf2.s b/gcc/config/c33/libgcc/negdf2.s
  18012. new file mode 100644
  18013. index 0000000..7d09153
  18014. --- /dev/null
  18015. +++ b/gcc/config/c33/libgcc/negdf2.s
  18016. @@ -0,0 +1,37 @@
  18017. +;*********************************************
  18018. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  18019. +;* ALL RIGHTS RESERVED
  18020. +;*
  18021. +;* filename : negdfs.s
  18022. +;*
  18023. +;* Double floating point negative function
  18024. +;* input: (%r7, %r6)
  18025. +;* output: (%r5, %r4)
  18026. +;*
  18027. +;* Begin 1996/09/12 V. Chan
  18028. +;* ѹ 2001/01/15 O.Hinokuchi
  18029. +;* 쥸ִ
  18030. +;* gasб 2001/10/15 watanabe
  18031. +;*
  18032. +;*********************************************
  18033. +
  18034. +.section .text
  18035. +.align 1
  18036. +.global __negdf2
  18037. +
  18038. +;==============================================
  18039. +;쥸
  18040. +; %r4:(L)(double)
  18041. +; %r5:(H)(double)
  18042. +; %r6:(L)(double)
  18043. +; %r7:(H)(double)
  18044. +;==============================================
  18045. +
  18046. +__negdf2:
  18047. +
  18048. + ; flip the MSB of %r5 and put result in %r6
  18049. + ld.w %r5,%r7 ;(H)(5) <- (H)(7)
  18050. + xxor %r5,0x80000000 ;(H)(5) <- (H)(5) | 0x80000000
  18051. + ld.w %r4, %r6 ;(L)(4) <- (L)(6)
  18052. +
  18053. + ret
  18054. diff --git a/gcc/config/c33/libgcc/negsf2.lst b/gcc/config/c33/libgcc/negsf2.lst
  18055. new file mode 100644
  18056. index 0000000..4a0ed61
  18057. --- /dev/null
  18058. +++ b/gcc/config/c33/libgcc/negsf2.lst
  18059. @@ -0,0 +1,38 @@
  18060. +GAS LISTING negsf2.s page 1
  18061. +
  18062. +
  18063. + 1 ;*********************************************
  18064. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  18065. + 3 ;* ALL RIGHTS RESERVED
  18066. + 4 ;*
  18067. + 5 ;* filename : negsf2.s
  18068. + 6 ;*
  18069. + 7 ;* Single floating point negate function
  18070. + 8 ;* input: %r6
  18071. + 9 ;* output: %r4
  18072. + 10 ;*
  18073. + 11 ;* Begin 1996/09/12 V. Chan
  18074. + 12 ;* ѹ 2001/01/15 O.Hinokuchi
  18075. + 13 ;* 쥸ִ
  18076. + 14 ;* gasб 2001/10/15 watanabe
  18077. + 15 ;*
  18078. + 16 ;*********************************************
  18079. + 17
  18080. + 18 .section .text
  18081. + 19 .align 1
  18082. + 20 .global __negsf2
  18083. + 21
  18084. + 22 ;==============================================
  18085. + 23 ;쥸
  18086. + 24 ; %r4:(floart)
  18087. + 25 ; %r6:(floart)
  18088. + 26 ;==============================================
  18089. + 27
  18090. + 28 __negsf2:
  18091. + 29
  18092. + 30 ; flip the MSB of %r6 and put result in %r4
  18093. + 31 0000 642E ld.w %r4,%r6 ;(4) <- (6)
  18094. + 32 0002 00D000C0 xxor %r4, 0x80000000 ;(4) <- (4) | 0x80000000
  18095. + 32 0478
  18096. + 33
  18097. + 34 0008 4006 ret
  18098. diff --git a/gcc/config/c33/libgcc/negsf2.s b/gcc/config/c33/libgcc/negsf2.s
  18099. new file mode 100644
  18100. index 0000000..859c0b5
  18101. --- /dev/null
  18102. +++ b/gcc/config/c33/libgcc/negsf2.s
  18103. @@ -0,0 +1,34 @@
  18104. +;*********************************************
  18105. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  18106. +;* ALL RIGHTS RESERVED
  18107. +;*
  18108. +;* filename : negsf2.s
  18109. +;*
  18110. +;* Single floating point negate function
  18111. +;* input: %r6
  18112. +;* output: %r4
  18113. +;*
  18114. +;* Begin 1996/09/12 V. Chan
  18115. +;* ѹ 2001/01/15 O.Hinokuchi
  18116. +;* 쥸ִ
  18117. +;* gasб 2001/10/15 watanabe
  18118. +;*
  18119. +;*********************************************
  18120. +
  18121. +.section .text
  18122. +.align 1
  18123. +.global __negsf2
  18124. +
  18125. +;==============================================
  18126. +;쥸
  18127. +; %r4:(floart)
  18128. +; %r6:(floart)
  18129. +;==============================================
  18130. +
  18131. +__negsf2:
  18132. +
  18133. + ; flip the MSB of %r6 and put result in %r4
  18134. + ld.w %r4,%r6 ;(4) <- (6)
  18135. + xxor %r4, 0x80000000 ;(4) <- (4) | 0x80000000
  18136. +
  18137. + ret
  18138. diff --git a/gcc/config/c33/libgcc/scan64.lst b/gcc/config/c33/libgcc/scan64.lst
  18139. new file mode 100644
  18140. index 0000000..4b2003f
  18141. --- /dev/null
  18142. +++ b/gcc/config/c33/libgcc/scan64.lst
  18143. @@ -0,0 +1,51 @@
  18144. +GAS LISTING scan64.s page 1
  18145. +
  18146. +
  18147. + 1 ;*********************************************
  18148. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  18149. + 3 ;* ALL RIGHTS RESERVED
  18150. + 4 ;*
  18151. + 5 ;* filename : scan64.s
  18152. + 6 ;*
  18153. + 7 ;* 64-bit scan function
  18154. + 8 ;* input: %r8, %r9
  18155. + 9 ;* output: %r9
  18156. + 10 ;*
  18157. + 11 ;* Begin 1996/09/12 V. Chan
  18158. + 12 ;* ѹ 2001/01/31 O.Hinokuchi
  18159. + 13 ;* gasб 2001/10/15 watanabe
  18160. + 14 ;*
  18161. + 15 ;*****************************************
  18162. + 16
  18163. + 17 .section .text
  18164. + 18 .align 1
  18165. + 19 .global __scan64
  18166. + 20
  18167. + 21 __scan64:
  18168. + 22
  18169. + 23 0000 0102 pushn %r1 ; save register values
  18170. + 24
  18171. + 25 0002 006C ld.w %r0, 0 ; loop counter = 0
  18172. + 26
  18173. + 27 0004 0868 cmp %r8, 0 ; if high 32-bits != 0 then count
  18174. + 28 0006 041A jrne loop
  18175. + 29
  18176. + 30 ; case: %r8 = 0
  18177. + 31 0008 982E ld.w %r8, %r9 ; count low 32-bits instead
  18178. + 32 000a 00C0006E xld.w %r0, 32 ; loop counter = 32
  18179. + 33
  18180. + 34 loop: ; count ; of leading 0's
  18181. + 35 000e 818E scan1 %r1, %r8 ; %r1 = count
  18182. + 36 0010 0612 jruge end ; if count != 8 then goto end
  18183. + 37 0012 8069 cmp %r0, 24
  18184. + 38 0014 0419 jreq.d end ; if count = 32 then jump to end
  18185. + 39 0016 8060 add %r0, 8 ; increment loop counter
  18186. + 40 0018 FB1F jp.d loop
  18187. + 41 001a 888C sll %r8, 8 ; shift register to the left 8 bits
  18188. + 42
  18189. + 43 end:
  18190. + 44 001c 0122 add %r1, %r0 ; count = count + loop counter
  18191. + 45 001e 192E ld.w %r9, %r1 ; put result into output register
  18192. + 46
  18193. + 47 0020 4102 popn %r1 ; restore register values
  18194. + 48 0022 4006 ret
  18195. diff --git a/gcc/config/c33/libgcc/scan64.s b/gcc/config/c33/libgcc/scan64.s
  18196. new file mode 100644
  18197. index 0000000..02ad4b8
  18198. --- /dev/null
  18199. +++ b/gcc/config/c33/libgcc/scan64.s
  18200. @@ -0,0 +1,48 @@
  18201. +;*********************************************
  18202. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  18203. +;* ALL RIGHTS RESERVED
  18204. +;*
  18205. +;* filename : scan64.s
  18206. +;*
  18207. +;* 64-bit scan function
  18208. +;* input: %r8, %r9
  18209. +;* output: %r9
  18210. +;*
  18211. +;* Begin 1996/09/12 V. Chan
  18212. +;* ѹ 2001/01/31 O.Hinokuchi
  18213. +;* gasб 2001/10/15 watanabe
  18214. +;*
  18215. +;*****************************************
  18216. +
  18217. +.section .text
  18218. +.align 1
  18219. +.global __scan64
  18220. +
  18221. +__scan64:
  18222. +
  18223. + pushn %r1 ; save register values
  18224. +
  18225. + ld.w %r0, 0 ; loop counter = 0
  18226. +
  18227. + cmp %r8, 0 ; if high 32-bits != 0 then count
  18228. + jrne loop
  18229. +
  18230. + ; case: %r8 = 0
  18231. + ld.w %r8, %r9 ; count low 32-bits instead
  18232. + xld.w %r0, 32 ; loop counter = 32
  18233. +
  18234. +loop: ; count ; of leading 0's
  18235. + scan1 %r1, %r8 ; %r1 = count
  18236. + jruge end ; if count != 8 then goto end
  18237. + cmp %r0, 24
  18238. + jreq.d end ; if count = 32 then jump to end
  18239. + add %r0, 8 ; increment loop counter
  18240. + jp.d loop
  18241. + sll %r8, 8 ; shift register to the left 8 bits
  18242. +
  18243. +end:
  18244. + add %r1, %r0 ; count = count + loop counter
  18245. + ld.w %r9, %r1 ; put result into output register
  18246. +
  18247. + popn %r1 ; restore register values
  18248. + ret
  18249. diff --git a/gcc/config/c33/libgcc/sedscr b/gcc/config/c33/libgcc/sedscr
  18250. new file mode 100644
  18251. index 0000000..913946a
  18252. --- /dev/null
  18253. +++ b/gcc/config/c33/libgcc/sedscr
  18254. @@ -0,0 +1,16 @@
  18255. +s/#/;/g
  18256. +s/___/__/g
  18257. +s/r0/%r0/g
  18258. +s/r1/%r1/g
  18259. +s/r2/%r2/g
  18260. +s/r3/%r3/g
  18261. +s/r4/%r4/g
  18262. +s/r5/%r5/g
  18263. +s/r6/%r6/g
  18264. +s/r7/%r7/g
  18265. +s/r8/%r8/g
  18266. +s/r9/%r9/g
  18267. +s/sp/%sp/g
  18268. +s/psr/%psr/g
  18269. +s/ahr/%ahr/g
  18270. +s/alr/%alr/g
  18271. diff --git a/gcc/config/c33/libgcc/trncdfsf.lst b/gcc/config/c33/libgcc/trncdfsf.lst
  18272. new file mode 100644
  18273. index 0000000..a7dc4b2
  18274. --- /dev/null
  18275. +++ b/gcc/config/c33/libgcc/trncdfsf.lst
  18276. @@ -0,0 +1,126 @@
  18277. +GAS LISTING trncdfsf.s page 1
  18278. +
  18279. +
  18280. + 1 ;*********************************************
  18281. + 2 ;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  18282. + 3 ;* ALL RIGHTS RESERVED
  18283. + 4 ;*
  18284. + 5 ;* filename : trncdfsf.s
  18285. + 6 ;*
  18286. + 7 ;* Change type: Double float --> Single float
  18287. + 8 ;* input: (%r7, %r6)
  18288. + 9 ;* output: %r4
  18289. + 10 ;*
  18290. + 11 ;* Begin 1996/09/12 V. Chan
  18291. + 12 ;* ѹ 2001/01/17 O.Hinokuchi
  18292. + 13 ;* gasб 2001/10/15 watanabe
  18293. + 14 ;*
  18294. + 15 ;*****************************************
  18295. + 16
  18296. + 17 .section .text
  18297. + 18 .align 1
  18298. + 19 .global __truncdfsf2
  18299. + 20
  18300. + 21 __truncdfsf2:
  18301. + 22
  18302. + 23 0000 0102 pushn %r1 ; save register values
  18303. + 24
  18304. + 25 0002 702E ld.w %r0, %r7 ; put sign of input (%r7) into %r0
  18305. + 26 0004 109C rl %r0, 1
  18306. + 27 0006 1070 and %r0, 1
  18307. + 28
  18308. + 29 0008 712E ld.w %r1, %r7 ; put exponent into %r1
  18309. + 30 000a 118C sll %r1, 1
  18310. + 31 000c 81888188 xsrl %r1, 21
  18311. + 31 5188
  18312. + 32
  18313. + 33 ; 0x368 - 0x3ff(bias) + 0x7f(bias) = -24
  18314. + 34 0012 0DC0816A xcmp %r1, 0x368 ; if exp < 0x368 then goto end
  18315. + 35 0016 340F jrle.d end ; round to zero case (result = 0)
  18316. + 36 0018 046C ld.w %r4, 0
  18317. + 37
  18318. + 38 ; 0x47f - 0x3ff(bias) + 0x7f(bias) = 255
  18319. + 39 001a 11C0F16B xcmp %r1, 0x47f ; if exp >= 0x47f then overflow
  18320. + 40 001e F0CF00C0 xld.w %r4, 0x7f800000 ; result = infinity
  18321. + 40 046C
  18322. + 41 0024 2D0A jrge end
  18323. + 42
  18324. + 43 ; isolate mantissa
  18325. + 44 0026 01C0FFDF xand %r7,0xfffff ; clear first 12 bits of %r7
  18326. + 44 F773
  18327. + 45
  18328. + 46 ; 0x380 - 0x3ff + 0x7f = 0
  18329. + 47 002c 0EC00168 xcmp %r1, 0x380 ; if exp > 0x380 then goto normal
  18330. + 48 0030 1B08 jrgt normal ; normal result
  18331. + 49
  18332. + 50 ; case: exp <= 0x380 (-127 --> denormal result)
  18333. + 51 0032 02C000C0 xoor %r7,0x100000 ; add implied bit
  18334. + 51 0774
  18335. + 52 ; 0x37e - 0x3ff + 0x7f = -2 (2 bit shift)
  18336. + 53 0038 0DC0E16B xcmp %r1, 0x37e ; if 0x380 > exp > 0x37e then goto shftleft
  18337. + GAS LISTING trncdfsf.s page 2
  18338. +
  18339. +
  18340. + 54 003c 0B08 jrgt shftleft
  18341. + 55
  18342. + 56 ; case: 0x368 =< exp <= 0x37e
  18343. + 57 003e 0DC0E56F xld.w %r5, 0x37e ; shift = 0x37e - exp
  18344. + 58 0042 1526 sub %r5, %r1
  18345. + 59
  18346. + 60 ;xsrl %r7, %r5 ; mantissa >> 0x37e - exp (max. shift = 22)
  18347. + 61 ; variable shift routine (faster than xsrl)
  18348. + 62 shift:
  18349. + 63 0044 8568 cmp %r5, 8 ; if shift <= 8 then goto done
  18350. + 64 0046 040E jrle done
  18351. + 65
  18352. + 66 ; case: shift > 8
  18353. + 67 0048 8564 sub %r5, 8 ; shift = shift - 8
  18354. + 68 004a FD1F jp.d shift
  18355. + 69 004c 8788 srl %r7, 8 ; result >> 8
  18356. + 70
  18357. + 71 done: ; case: %r5 < 8
  18358. + 72 004e 171F jp.d finish
  18359. + 73 0050 5789 srl %r7, %r5 ; final shift of result
  18360. + 74
  18361. + 75 shftleft:
  18362. + 76 ; case: 0x37e < exp <= 0x380
  18363. + 77 0052 0DC0E167 xsub %r1,0x37e ; shift = exp - 0x37e (max. shift = 2)
  18364. + 78
  18365. + 79 ; {man1, man1_2} << shift
  18366. + 80 0056 178D sll %r7, %r1 ; shift high 32-bits to the left x bits (x = shift)
  18367. + 81 0058 169D rl %r6, %r1 ; rotate low 32-bits to the left x bits
  18368. + 82 005a F86F ld.w %r8, -1 ; %r8 = 0xffff ffff
  18369. + 83 005c 188D sll %r8, %r1 ; make a mask for first 32-x bits --> %r8 = 111...000
  18370. + 84 005e 893E not %r9, %r8 ; flip mask for last x bits --> %r9 = 000...111 (mask)
  18371. + 85 0060 6932 and %r9, %r6 ; isolate last x bits of %r6
  18372. + 86 0062 0D1F jp.d finish
  18373. + 87 0064 9736 or %r7, %r9 ; add last x bits of %r6 to %r7
  18374. + 88
  18375. + 89 normal:
  18376. + 90 ; case: exp > 0x380 (normal single float result)
  18377. + 91 0066 0EC00164 xsub %r1,0x380 ; exp = exp - 0x3ff + 0x7f
  18378. + 92
  18379. + 93 ; {man1, man1_2} << 3
  18380. + 94 006a 378C sll %r7, 3 ; shift high 32-bits to the left 3 bits
  18381. + 95 006c 369C rl %r6, 3 ; rotate low 32-bits to the left 3 bits
  18382. + 96 006e 756C ld.w %r5, 0x7 ; make a mask for last 3 bits --> %r5 = 000...00111
  18383. + 97 0070 583E not %r8, %r5 ; flip mask for first 29 bits --> %r8 = 111...11000
  18384. + 98 0072 6532 and %r5, %r6 ; isolate last 3 bits of %r6
  18385. + 99 0074 5736 or %r7, %r5 ; add last 3 bits of %r6 to %r7
  18386. + 100
  18387. + 101 0076 81981198 xrr %r1, 9 ; position exp
  18388. + 102 007a 1736 or %r7, %r1 ; add exponent
  18389. + 103
  18390. + 104 finish:
  18391. + 105 007c 742E ld.w %r4, %r7 ; put result in output register
  18392. + 106
  18393. + 107 end:
  18394. + 108 007e 1098 rr %r0, 1 ; position sign bit
  18395. + 109 0080 0436 or %r4, %r0 ; add sign bit
  18396. + 110
  18397. + GAS LISTING trncdfsf.s page 3
  18398. +
  18399. +
  18400. + 111 0082 4102 popn %r1 ; restore register values
  18401. + 112
  18402. + 113 0084 4006 ret
  18403. diff --git a/gcc/config/c33/libgcc/trncdfsf.s b/gcc/config/c33/libgcc/trncdfsf.s
  18404. new file mode 100644
  18405. index 0000000..c19cf6b
  18406. --- /dev/null
  18407. +++ b/gcc/config/c33/libgcc/trncdfsf.s
  18408. @@ -0,0 +1,113 @@
  18409. +;*********************************************
  18410. +;* Copyright (C), 1996-2001 SEIKO EPSON Corp.
  18411. +;* ALL RIGHTS RESERVED
  18412. +;*
  18413. +;* filename : trncdfsf.s
  18414. +;*
  18415. +;* Change type: Double float --> Single float
  18416. +;* input: (%r7, %r6)
  18417. +;* output: %r4
  18418. +;*
  18419. +;* Begin 1996/09/12 V. Chan
  18420. +;* ѹ 2001/01/17 O.Hinokuchi
  18421. +;* gasб 2001/10/15 watanabe
  18422. +;*
  18423. +;*****************************************
  18424. +
  18425. +.section .text
  18426. +.align 1
  18427. +.global __truncdfsf2
  18428. +
  18429. +__truncdfsf2:
  18430. +
  18431. + pushn %r1 ; save register values
  18432. +
  18433. + ld.w %r0, %r7 ; put sign of input (%r7) into %r0
  18434. + rl %r0, 1
  18435. + and %r0, 1
  18436. +
  18437. + ld.w %r1, %r7 ; put exponent into %r1
  18438. + sll %r1, 1
  18439. + xsrl %r1, 21
  18440. +
  18441. + ; 0x368 - 0x3ff(bias) + 0x7f(bias) = -24
  18442. + xcmp %r1, 0x368 ; if exp < 0x368 then goto end
  18443. + jrle.d end ; round to zero case (result = 0)
  18444. + ld.w %r4, 0
  18445. +
  18446. + ; 0x47f - 0x3ff(bias) + 0x7f(bias) = 255
  18447. + xcmp %r1, 0x47f ; if exp >= 0x47f then overflow
  18448. + xld.w %r4, 0x7f800000 ; result = infinity
  18449. + jrge end
  18450. +
  18451. + ; isolate mantissa
  18452. + xand %r7,0xfffff ; clear first 12 bits of %r7
  18453. +
  18454. + ; 0x380 - 0x3ff + 0x7f = 0
  18455. + xcmp %r1, 0x380 ; if exp > 0x380 then goto normal
  18456. + jrgt normal ; normal result
  18457. +
  18458. + ; case: exp <= 0x380 (-127 --> denormal result)
  18459. + xoor %r7,0x100000 ; add implied bit
  18460. + ; 0x37e - 0x3ff + 0x7f = -2 (2 bit shift)
  18461. + xcmp %r1, 0x37e ; if 0x380 > exp > 0x37e then goto shftleft
  18462. + jrgt shftleft
  18463. +
  18464. + ; case: 0x368 =< exp <= 0x37e
  18465. + xld.w %r5, 0x37e ; shift = 0x37e - exp
  18466. + sub %r5, %r1
  18467. +
  18468. + ;xsrl %r7, %r5 ; mantissa >> 0x37e - exp (max. shift = 22)
  18469. + ; variable shift routine (faster than xsrl)
  18470. +shift:
  18471. + cmp %r5, 8 ; if shift <= 8 then goto done
  18472. + jrle done
  18473. +
  18474. + ; case: shift > 8
  18475. + sub %r5, 8 ; shift = shift - 8
  18476. + jp.d shift
  18477. + srl %r7, 8 ; result >> 8
  18478. +
  18479. +done: ; case: %r5 < 8
  18480. + jp.d finish
  18481. + srl %r7, %r5 ; final shift of result
  18482. +
  18483. +shftleft:
  18484. + ; case: 0x37e < exp <= 0x380
  18485. + xsub %r1,0x37e ; shift = exp - 0x37e (max. shift = 2)
  18486. +
  18487. + ; {man1, man1_2} << shift
  18488. + sll %r7, %r1 ; shift high 32-bits to the left x bits (x = shift)
  18489. + rl %r6, %r1 ; rotate low 32-bits to the left x bits
  18490. + ld.w %r8, -1 ; %r8 = 0xffff ffff
  18491. + sll %r8, %r1 ; make a mask for first 32-x bits --> %r8 = 111...000
  18492. + not %r9, %r8 ; flip mask for last x bits --> %r9 = 000...111 (mask)
  18493. + and %r9, %r6 ; isolate last x bits of %r6
  18494. + jp.d finish
  18495. + or %r7, %r9 ; add last x bits of %r6 to %r7
  18496. +
  18497. +normal:
  18498. + ; case: exp > 0x380 (normal single float result)
  18499. + xsub %r1,0x380 ; exp = exp - 0x3ff + 0x7f
  18500. +
  18501. + ; {man1, man1_2} << 3
  18502. + sll %r7, 3 ; shift high 32-bits to the left 3 bits
  18503. + rl %r6, 3 ; rotate low 32-bits to the left 3 bits
  18504. + ld.w %r5, 0x7 ; make a mask for last 3 bits --> %r5 = 000...00111
  18505. + not %r8, %r5 ; flip mask for first 29 bits --> %r8 = 111...11000
  18506. + and %r5, %r6 ; isolate last 3 bits of %r6
  18507. + or %r7, %r5 ; add last 3 bits of %r6 to %r7
  18508. +
  18509. + xrr %r1, 9 ; position exp
  18510. + or %r7, %r1 ; add exponent
  18511. +
  18512. +finish:
  18513. + ld.w %r4, %r7 ; put result in output register
  18514. +
  18515. +end:
  18516. + rr %r0, 1 ; position sign bit
  18517. + or %r4, %r0 ; add sign bit
  18518. +
  18519. + popn %r1 ; restore register values
  18520. +
  18521. + ret
  18522. diff --git a/gcc/config/c33/libgcc1.S b/gcc/config/c33/libgcc1.S
  18523. new file mode 100644
  18524. index 0000000..b49d189
  18525. --- /dev/null
  18526. +++ b/gcc/config/c33/libgcc1.S
  18527. @@ -0,0 +1,317 @@
  18528. +/* libgcc1 routines for EPSON C33.
  18529. + Copyright (C) 1996, 1997 Free Software Foundation, Inc.
  18530. +
  18531. +This file is part of GNU CC.
  18532. +
  18533. +GNU CC is free software; you can redistribute it and/or modify it
  18534. +under the terms of the GNU General Public License as published by the
  18535. +Free Software Foundation; either version 2, or (at your option) any
  18536. +later version.
  18537. +
  18538. +In addition to the permissions in the GNU General Public License, the
  18539. +Free Software Foundation gives you unlimited permission to link the
  18540. +compiled version of this file with other programs, and to distribute
  18541. +those programs without any restriction coming from the use of this
  18542. +file. (The General Public License restrictions do apply in other
  18543. +respects; for example, they cover modification of the file, and
  18544. +distribution when not linked into another program.)
  18545. +
  18546. +This file is distributed in the hope that it will be useful, but
  18547. +WITHOUT ANY WARRANTY; without even the implied warranty of
  18548. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18549. +General Public License for more details.
  18550. +
  18551. +You should have received a copy of the GNU General Public License
  18552. +along with this program; see the file COPYING. If not, write to
  18553. +the Free Software Foundation, 59 Temple Place - Suite 330,
  18554. +Boston, MA 02111-1307, USA. */
  18555. +
  18556. +/* As a special exception, if you link this library with files
  18557. + compiled with GCC to produce an executable, this does not cause
  18558. + the resulting executable to be covered by the GNU General Public License.
  18559. + This exception does not however invalidate any other reasons why
  18560. + the executable file might be covered by the GNU General Public License. */
  18561. +
  18562. +/*
  18563. + Copyright (C) SEIKO EPSON CORP. 1996
  18564. +
  18565. + Filename : divsi3.c
  18566. + Function :
  18567. + This module defines the functions
  18568. + that emulate signed and unsigned integer division.
  18569. + Revision :
  18570. + 10/18/1996 ESD T.Katahira start */
  18571. +
  18572. +#ifdef L_divsi3
  18573. +
  18574. +// Function : __divsi3
  18575. +// Input : r6 --- dividend
  18576. +// r7 --- divisor
  18577. +// Output : r4 --- quotient
  18578. +// Function : calculate signed integer division
  18579. +
  18580. + .section .text
  18581. + .align 1
  18582. + .global __divsi3
  18583. +__divsi3:
  18584. + ld.w %alr,%r6 ; set dividend to accumlator (alr)
  18585. +
  18586. + div0s %r7 ; initializer of signed division
  18587. +
  18588. +#ifdef FAST
  18589. + div1 %r7 ; execute division #1
  18590. + div1 %r7 ; execute division #2
  18591. + div1 %r7 ; execute division #3
  18592. + div1 %r7 ; execute division #4
  18593. + div1 %r7 ; execute division #5
  18594. + div1 %r7 ; execute division #6
  18595. + div1 %r7 ; execute division #7
  18596. + div1 %r7 ; execute division #8
  18597. + div1 %r7 ; execute division #9
  18598. + div1 %r7 ; execute division #10
  18599. + div1 %r7 ; execute division #11
  18600. + div1 %r7 ; execute division #12
  18601. + div1 %r7 ; execute division #13
  18602. + div1 %r7 ; execute division #14
  18603. + div1 %r7 ; execute division #15
  18604. + div1 %r7 ; execute division #16
  18605. + div1 %r7 ; execute division #17
  18606. + div1 %r7 ; execute division #18
  18607. + div1 %r7 ; execute division #19
  18608. + div1 %r7 ; execute division #20
  18609. + div1 %r7 ; execute division #21
  18610. + div1 %r7 ; execute division #22
  18611. + div1 %r7 ; execute division #23
  18612. + div1 %r7 ; execute division #24
  18613. + div1 %r7 ; execute division #25
  18614. + div1 %r7 ; execute division #26
  18615. + div1 %r7 ; execute division #27
  18616. + div1 %r7 ; execute division #28
  18617. + div1 %r7 ; execute division #29
  18618. + div1 %r7 ; execute division #30
  18619. + div1 %r7 ; execute division #31
  18620. + div1 %r7 ; execute division #32
  18621. +#else
  18622. + ld.w %r8,0x4 ; set loop counter (N = 4)
  18623. + ld.w %r9,%psr ; save flag register
  18624. +___divsi3_loop_start:
  18625. + div1 %r7 ; execute division #1
  18626. + div1 %r7 ; execute division #2
  18627. + div1 %r7 ; execute division #3
  18628. + div1 %r7 ; execute division #4
  18629. + div1 %r7 ; execute division #5
  18630. + div1 %r7 ; execute division #6
  18631. + div1 %r7 ; execute division #7
  18632. + div1 %r7 ; execute division #8
  18633. + sub %r8,0x1 ; decrement loop counter
  18634. + jrne.d ___divsi3_loop_start ; if (loop counter != 0) goto loop top
  18635. + ld.w %psr,%r9 ; restore flag register (delayed slot)
  18636. +#endif
  18637. + div2s %r7 ; post divistion process #1
  18638. + div3s ; post divistion process #2
  18639. + ret.d ; return to the caller (use delayed return)
  18640. + ld.w %r4,%alr ; set quotient to return reg (delayed slot)
  18641. +#endif /* L_divsi3 */
  18642. +
  18643. +#ifdef L_udivsi3
  18644. +
  18645. +// Function : __udivsi3
  18646. +// Input : r6 --- dividend
  18647. +// r7 --- divisor
  18648. +// Output : r4 --- quotient
  18649. +// Function : calculate unsigned integer division
  18650. +
  18651. + .section .text
  18652. + .align 1
  18653. + .global __udivsi3
  18654. +__udivsi3:
  18655. + ld.w %alr,%r6 ; set dividend to accumlator (alr)
  18656. + div0u %r7 ; initializer of signed division
  18657. +#ifdef FAST
  18658. + div1 %r7 ; execute division #1
  18659. + div1 %r7 ; execute division #2
  18660. + div1 %r7 ; execute division #3
  18661. + div1 %r7 ; execute division #4
  18662. + div1 %r7 ; execute division #5
  18663. + div1 %r7 ; execute division #6
  18664. + div1 %r7 ; execute division #7
  18665. + div1 %r7 ; execute division #8
  18666. + div1 %r7 ; execute division #9
  18667. + div1 %r7 ; execute division #10
  18668. + div1 %r7 ; execute division #11
  18669. + div1 %r7 ; execute division #12
  18670. + div1 %r7 ; execute division #13
  18671. + div1 %r7 ; execute division #14
  18672. + div1 %r7 ; execute division #15
  18673. + div1 %r7 ; execute division #16
  18674. + div1 %r7 ; execute division #17
  18675. + div1 %r7 ; execute division #18
  18676. + div1 %r7 ; execute division #19
  18677. + div1 %r7 ; execute division #20
  18678. + div1 %r7 ; execute division #21
  18679. + div1 %r7 ; execute division #22
  18680. + div1 %r7 ; execute division #23
  18681. + div1 %r7 ; execute division #24
  18682. + div1 %r7 ; execute division #25
  18683. + div1 %r7 ; execute division #26
  18684. + div1 %r7 ; execute division #27
  18685. + div1 %r7 ; execute division #28
  18686. + div1 %r7 ; execute division #29
  18687. + div1 %r7 ; execute division #30
  18688. + div1 %r7 ; execute division #31
  18689. + div1 %r7 ; execute division #32
  18690. +#else
  18691. + ld.w %r8,0x4 ; set loop counter (N = 4)
  18692. +___udivsi3_loop_start:
  18693. + div1 %r7 ; execute division #1
  18694. + div1 %r7 ; execute division #2
  18695. + div1 %r7 ; execute division #3
  18696. + div1 %r7 ; execute division #4
  18697. + div1 %r7 ; execute division #5
  18698. + div1 %r7 ; execute division #6
  18699. + div1 %r7 ; execute division #7
  18700. + div1 %r7 ; execute division #8
  18701. + sub %r8,0x1 ; decrement loop counter
  18702. + jrne ___udivsi3_loop_start ; if (loop counter != 0) goto loop top
  18703. +#endif
  18704. + ret.d ; return to the caller (use delayed return)
  18705. + ld.w %r4,%alr ; set quotient to return reg (delayed slot)
  18706. +
  18707. +#endif /* L_udivsi3 */
  18708. +
  18709. +
  18710. +#ifdef L_modsi3
  18711. +
  18712. +// Function : __modsi3
  18713. +// Input : r6 --- dividend
  18714. +// r7 --- divisor
  18715. +// Output : r4 --- remainder
  18716. +// Function : calculate signed integer modulo arithmetic
  18717. +
  18718. + .section .text
  18719. + .align 1
  18720. + .global __modsi3
  18721. +__modsi3:
  18722. + ld.w %alr,%r6 ; set dividend to accumlator (alr)
  18723. + div0s %r7 ; initializer of signed division
  18724. +#ifdef FAST
  18725. + div1 %r7 ; execute division #1
  18726. + div1 %r7 ; execute division #2
  18727. + div1 %r7 ; execute division #3
  18728. + div1 %r7 ; execute division #4
  18729. + div1 %r7 ; execute division #5
  18730. + div1 %r7 ; execute division #6
  18731. + div1 %r7 ; execute division #7
  18732. + div1 %r7 ; execute division #8
  18733. + div1 %r7 ; execute division #9
  18734. + div1 %r7 ; execute division #10
  18735. + div1 %r7 ; execute division #11
  18736. + div1 %r7 ; execute division #12
  18737. + div1 %r7 ; execute division #13
  18738. + div1 %r7 ; execute division #14
  18739. + div1 %r7 ; execute division #15
  18740. + div1 %r7 ; execute division #16
  18741. + div1 %r7 ; execute division #17
  18742. + div1 %r7 ; execute division #18
  18743. + div1 %r7 ; execute division #19
  18744. + div1 %r7 ; execute division #20
  18745. + div1 %r7 ; execute division #21
  18746. + div1 %r7 ; execute division #22
  18747. + div1 %r7 ; execute division #23
  18748. + div1 %r7 ; execute division #24
  18749. + div1 %r7 ; execute division #25
  18750. + div1 %r7 ; execute division #26
  18751. + div1 %r7 ; execute division #27
  18752. + div1 %r7 ; execute division #28
  18753. + div1 %r7 ; execute division #29
  18754. + div1 %r7 ; execute division #30
  18755. + div1 %r7 ; execute division #31
  18756. + div1 %r7 ; execute division #32
  18757. +#else
  18758. + ld.w %r8,0x4 ; set loop counter (N = 4)
  18759. + ld.w %r9,%psr ; save flag register
  18760. +___modsi3_loop_start:
  18761. + div1 %r7 ; execute division #1
  18762. + div1 %r7 ; execute division #2
  18763. + div1 %r7 ; execute division #3
  18764. + div1 %r7 ; execute division #4
  18765. + div1 %r7 ; execute division #5
  18766. + div1 %r7 ; execute division #6
  18767. + div1 %r7 ; execute division #7
  18768. + div1 %r7 ; execute division #8
  18769. + sub %r8,0x1 ; decrement loop counter
  18770. + jrne.d ___modsi3_loop_start ; if (loop counter != 0) goto loop top
  18771. + ld.w %psr,%r9 ; restore flag register (delayed slot)
  18772. +#endif
  18773. + div2s %r7 ; post divistion process #1
  18774. + div3s ; post divistion process #2
  18775. + ret.d ; return to the caller (use delayed return)
  18776. + ld.w %r4,%ahr ; set remainder to return reg (delayed slot)
  18777. +
  18778. +#endif /* L_modsi3 */
  18779. +
  18780. +#ifdef L_umodsi3
  18781. +
  18782. +// Function : __umodsi3
  18783. +// Input : r6 --- dividend
  18784. +// r7 --- divisor
  18785. +// Output : r4 --- remainder
  18786. +// Function : calculate unsigned integer modulo arithmetic
  18787. +
  18788. + .section .text
  18789. + .align 1
  18790. + .global __umodsi3
  18791. +__umodsi3:
  18792. + ld.w %alr,%r6 ; set dividend to accumlator (alr)
  18793. + div0u %r7 ; initializer of signed division
  18794. +#ifdef FAST
  18795. + div1 %r7 ; execute division #1
  18796. + div1 %r7 ; execute division #2
  18797. + div1 %r7 ; execute division #3
  18798. + div1 %r7 ; execute division #4
  18799. + div1 %r7 ; execute division #5
  18800. + div1 %r7 ; execute division #6
  18801. + div1 %r7 ; execute division #7
  18802. + div1 %r7 ; execute division #8
  18803. + div1 %r7 ; execute division #9
  18804. + div1 %r7 ; execute division #10
  18805. + div1 %r7 ; execute division #11
  18806. + div1 %r7 ; execute division #12
  18807. + div1 %r7 ; execute division #13
  18808. + div1 %r7 ; execute division #14
  18809. + div1 %r7 ; execute division #15
  18810. + div1 %r7 ; execute division #16
  18811. + div1 %r7 ; execute division #17
  18812. + div1 %r7 ; execute division #18
  18813. + div1 %r7 ; execute division #19
  18814. + div1 %r7 ; execute division #20
  18815. + div1 %r7 ; execute division #21
  18816. + div1 %r7 ; execute division #22
  18817. + div1 %r7 ; execute division #23
  18818. + div1 %r7 ; execute division #24
  18819. + div1 %r7 ; execute division #25
  18820. + div1 %r7 ; execute division #26
  18821. + div1 %r7 ; execute division #27
  18822. + div1 %r7 ; execute division #28
  18823. + div1 %r7 ; execute division #29
  18824. + div1 %r7 ; execute division #30
  18825. + div1 %r7 ; execute division #31
  18826. + div1 %r7 ; execute division #32
  18827. +#else
  18828. + ld.w %r8,0x4 ; set loop counter (N = 4)
  18829. +___umodsi3_loop_start:
  18830. + div1 %r7 ; execute division #1
  18831. + div1 %r7 ; execute division #2
  18832. + div1 %r7 ; execute division #3
  18833. + div1 %r7 ; execute division #4
  18834. + div1 %r7 ; execute division #5
  18835. + div1 %r7 ; execute division #6
  18836. + div1 %r7 ; execute division #7
  18837. + div1 %r7 ; execute division #8
  18838. + sub %r8,0x1 ; decrement loop counter
  18839. + jrne ___umodsi3_loop_start ; if (loop counter != 0) goto loop top
  18840. +#endif
  18841. + ret.d ; return to the caller (use delayed return)
  18842. + ld.w %r4,%ahr ; set remainder to return reg (delayed slot)
  18843. +
  18844. +#endif /* L_umodsi3 */
  18845. diff --git a/gcc/config/c33/t-c33 b/gcc/config/c33/t-c33
  18846. new file mode 100644
  18847. index 0000000..4a7a5d0
  18848. --- /dev/null
  18849. +++ b/gcc/config/c33/t-c33
  18850. @@ -0,0 +1,35 @@
  18851. +CROSS_LIBGCC1 = libgcc1-asm.a
  18852. +LIB1ASMSRC = c33/libgcc1.S
  18853. +LIB1ASMFUNCS = _divsi3 \
  18854. + _udivsi3 \
  18855. + _modsi3 \
  18856. + _umodsi3
  18857. +
  18858. +
  18859. +# These are really part of libgcc1, but this will cause them to be
  18860. +# built correctly, so...
  18861. +
  18862. +LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
  18863. +
  18864. +dp-bit.c: $(srcdir)/config/fp-bit.c
  18865. + echo '#ifdef __LITTLE_ENDIAN__' > dp-bit.c
  18866. + echo '#define FLOAT_BIT_ORDER_MISMATCH' >>dp-bit.c
  18867. + echo '#endif' >> dp-bit.c
  18868. + cat $(srcdir)/config/fp-bit.c >> dp-bit.c
  18869. +
  18870. +fp-bit.c: $(srcdir)/config/fp-bit.c
  18871. + echo '#define FLOAT' > fp-bit.c
  18872. + echo '#ifdef __LITTLE_ENDIAN__' >> fp-bit.c
  18873. + echo '#define FLOAT_BIT_ORDER_MISMATCH' >>fp-bit.c
  18874. + echo '#endif' >> fp-bit.c
  18875. + cat $(srcdir)/config/fp-bit.c >> fp-bit.c
  18876. +
  18877. +#debug_w
  18878. +#TCFLAGS = -Wa,-mwarn-signed-overflow -Wa,-mwarn-unsigned-overflow
  18879. +TCFLAGS =
  18880. +#debug_w
  18881. +TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc
  18882. +GCC_FOR_TARGET = d:/Epson/gnu33/xgcc -Bd:/Epson/gnu33/
  18883. +
  18884. +# 2002.2.13 watanabe
  18885. +# C33: It is necessary that "LIB2FUNCS_EH = _eh" is changed to "LIB2FUNCS_EH =".
  18886. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
  18887. index 03b9008..8beb78f 100644
  18888. --- a/gcc/cp/decl.c
  18889. +++ b/gcc/cp/decl.c
  18890. @@ -724,7 +724,19 @@ push_binding_level (newlevel, tag_transparent, keep)
  18891. are active. */
  18892. memset ((char*) newlevel, 0, sizeof (struct cp_binding_level));
  18893. newlevel->level_chain = current_binding_level;
  18894. +
  18895. + // CHG K.Watanabe V1.8 >>>>>>>
  18896. + #if 0
  18897. current_binding_level = newlevel;
  18898. + #endif
  18899. +
  18900. + if( cfun && cp_function_chain->bindings ){
  18901. + cp_function_chain->bindings = newlevel;
  18902. + } else {
  18903. + scope_chain->bindings = newlevel;
  18904. + }
  18905. + // CHG K.Watanabe V1.8 <<<<<<<
  18906. +
  18907. newlevel->tag_transparent = tag_transparent;
  18908. newlevel->more_cleanups_ok = 1;
  18909. @@ -780,7 +792,19 @@ pop_binding_level ()
  18910. }
  18911. {
  18912. register struct cp_binding_level *level = current_binding_level;
  18913. +
  18914. + // CHG K.Watanabe V1.8 >>>>>>>
  18915. + #if 0
  18916. current_binding_level = current_binding_level->level_chain;
  18917. + #endif
  18918. +
  18919. + if( cfun && cp_function_chain->bindings ){
  18920. + cp_function_chain->bindings = current_binding_level->level_chain;
  18921. + } else {
  18922. + scope_chain->bindings = current_binding_level->level_chain;
  18923. + }
  18924. + // CHG K.Watanabe V1.8 <<<<<<<
  18925. +
  18926. level->level_chain = free_binding_level;
  18927. if (level->parm_flag != 2)
  18928. binding_table_free (level->type_decls);
  18929. @@ -797,7 +821,20 @@ static void
  18930. suspend_binding_level ()
  18931. {
  18932. if (class_binding_level)
  18933. +
  18934. + // CHG K.Watanabe V1.8 >>>>>>>
  18935. + #if 0
  18936. current_binding_level = class_binding_level;
  18937. + #endif
  18938. +
  18939. + {
  18940. + if( cfun && cp_function_chain->bindings ){
  18941. + cp_function_chain->bindings = class_binding_level;
  18942. + } else {
  18943. + scope_chain->bindings = class_binding_level;
  18944. + }
  18945. + }
  18946. + // CHG K.Watanabe V1.8 <<<<<<<
  18947. if (NAMESPACE_LEVEL (global_namespace))
  18948. my_friendly_assert (!global_scope_p (current_binding_level), 20030527);
  18949. @@ -816,7 +853,20 @@ suspend_binding_level ()
  18950. }
  18951. is_class_level = 0;
  18952. }
  18953. +
  18954. + // CHG K.Watanabe V1.8 >>>>>>>
  18955. + #if 0
  18956. current_binding_level = current_binding_level->level_chain;
  18957. + #endif
  18958. +
  18959. + if( cfun && cp_function_chain->bindings ){
  18960. + cp_function_chain->bindings = current_binding_level->level_chain;
  18961. + } else {
  18962. + scope_chain->bindings = current_binding_level->level_chain;
  18963. + }
  18964. + // CHG K.Watanabe V1.8 <<<<<<<
  18965. +
  18966. +
  18967. find_class_binding_level ();
  18968. }
  18969. @@ -829,7 +879,19 @@ resume_binding_level (b)
  18970. my_friendly_assert(!class_binding_level, 386);
  18971. /* Also, resuming a non-directly nested namespace is a no-no. */
  18972. my_friendly_assert(b->level_chain == current_binding_level, 386);
  18973. +
  18974. + // CHG K.Watanabe V1.8 >>>>>>>
  18975. + #if 0
  18976. current_binding_level = b;
  18977. + #endif
  18978. +
  18979. + if( cfun && cp_function_chain->bindings ){
  18980. + cp_function_chain->bindings = b;
  18981. + } else {
  18982. + scope_chain->bindings = b;
  18983. + }
  18984. + // CHG K.Watanabe V1.8 <<<<<<<
  18985. +
  18986. if (ENABLE_SCOPE_CHECKING)
  18987. {
  18988. b->binding_depth = binding_depth;
  18989. @@ -4541,9 +4603,32 @@ pushdecl_with_scope (x, level)
  18990. else
  18991. {
  18992. b = current_binding_level;
  18993. +
  18994. + // CHG K.Watanabe V1.8 >>>>>>>
  18995. + #if 0
  18996. current_binding_level = level;
  18997. + #endif
  18998. +
  18999. + if( cfun && cp_function_chain->bindings ){
  19000. + cp_function_chain->bindings = level;
  19001. + } else {
  19002. + scope_chain->bindings = level;
  19003. + }
  19004. + // CHG K.Watanabe V1.8 <<<<<<<
  19005. +
  19006. x = pushdecl (x);
  19007. +
  19008. + // CHG K.Watanabe V1.8 >>>>>>>
  19009. + #if 0
  19010. current_binding_level = b;
  19011. + #endif
  19012. +
  19013. + if( cfun && cp_function_chain->bindings ){
  19014. + cp_function_chain->bindings = b;
  19015. + } else {
  19016. + scope_chain->bindings = b;
  19017. + }
  19018. + // CHG K.Watanabe V1.8 <<<<<<<
  19019. }
  19020. current_function_decl = function_decl;
  19021. POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
  19022. @@ -6942,7 +7027,19 @@ cxx_init_decl_processing ()
  19023. current_lang_name = lang_name_c;
  19024. current_function_decl = NULL_TREE;
  19025. +
  19026. + // CHG K.Watanabe V1.8 >>>>>>>
  19027. + #if 0
  19028. current_binding_level = NULL_BINDING_LEVEL;
  19029. + #endif
  19030. +
  19031. + if( cfun && cp_function_chain->bindings ){
  19032. + cp_function_chain->bindings = NULL_BINDING_LEVEL;
  19033. + } else {
  19034. + scope_chain->bindings = NULL_BINDING_LEVEL;
  19035. + }
  19036. + // CHG K.Watanabe V1.8 <<<<<<<
  19037. +
  19038. free_binding_level = NULL_BINDING_LEVEL;
  19039. build_common_tree_nodes (flag_signed_char);
  19040. @@ -10788,10 +10885,34 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
  19041. if (decl_context == NORMAL && !toplevel_bindings_p ())
  19042. {
  19043. struct cp_binding_level *b = current_binding_level;
  19044. +
  19045. + // CHG K.Watanabe V1.8 >>>>>>>
  19046. + #if 0
  19047. current_binding_level = b->level_chain;
  19048. + #endif
  19049. +
  19050. + if( cfun && cp_function_chain->bindings ){
  19051. + cp_function_chain->bindings = b->level_chain;
  19052. + } else {
  19053. + scope_chain->bindings = b->level_chain;
  19054. + }
  19055. + // CHG K.Watanabe V1.8 <<<<<<<
  19056. +
  19057. if (current_binding_level != 0 && toplevel_bindings_p ())
  19058. decl_context = PARM;
  19059. +
  19060. + // CHG K.Watanabe V1.8 >>>>>>>
  19061. + #if 0
  19062. current_binding_level = b;
  19063. + #endif
  19064. +
  19065. + if( cfun && cp_function_chain->bindings ){
  19066. + cp_function_chain->bindings = b;
  19067. + } else {
  19068. + scope_chain->bindings = b;
  19069. + }
  19070. + // CHG K.Watanabe V1.8 <<<<<<<
  19071. +
  19072. }
  19073. if (name == NULL)
  19074. @@ -14431,7 +14552,19 @@ start_function (declspecs, declarator, attrs, flags)
  19075. FIXME factor out the non-RTL stuff. */
  19076. bl = current_binding_level;
  19077. init_function_start (decl1, input_filename, lineno);
  19078. +
  19079. + // CHG K.Watanabe V1.8 >>>>>>>
  19080. + #if 0
  19081. current_binding_level = bl;
  19082. + #endif
  19083. +
  19084. + if( cfun && cp_function_chain->bindings ){
  19085. + cp_function_chain->bindings = bl;
  19086. + } else {
  19087. + scope_chain->bindings = bl;
  19088. + }
  19089. + // CHG K.Watanabe V1.8 <<<<<<<
  19090. +
  19091. /* Even though we're inside a function body, we still don't want to
  19092. call expand_expr to calculate the size of a variable-sized array.
  19093. diff --git a/gcc/cppinit.c b/gcc/cppinit.c
  19094. index d8e622b..b7f9f40 100644
  19095. --- a/gcc/cppinit.c
  19096. +++ b/gcc/cppinit.c
  19097. @@ -150,6 +150,17 @@ END
  19098. #undef END
  19099. #undef TRIGRAPH_MAP
  19100. +/* ADD K.Watanabe V1.7 >>>>>>> */
  19101. +/* C33: Output the same content with version 2.95.2, when the assembler source files are preprocessed. */
  19102. +/* This is because gdb can recognize as version 2.95.2. */
  19103. +int i_Line_Dummy_Output_Flg = 0; /* 0 -- normal */
  19104. + /* 1 -- dummy output */
  19105. +int i_Asm_Adjust_Line_Init_Flg = 0; /* 0 -- initial value */
  19106. + /* 1 -- Alignment has been done for new line of one line. */
  19107. +int i_Asm_CRLF_Line_Init_Flg = 0; /* 0 -- initial value */
  19108. + /* 1 -- Alignment has been done for new line of one line. */
  19109. +/* ADD K.Watanabe V1.7 <<<<<<< */
  19110. +
  19111. /* Given a colon-separated list of file names PATH,
  19112. add all the names to the search path for include files. */
  19113. static void
  19114. @@ -1042,6 +1053,8 @@ void
  19115. cpp_finish_options (pfile)
  19116. cpp_reader *pfile;
  19117. {
  19118. + int i_len; /* ADD K.Watanabe V1.7 */
  19119. +
  19120. /* Mark named operators before handling command line macros. */
  19121. if (CPP_OPTION (pfile, cplusplus) && CPP_OPTION (pfile, operator_names))
  19122. mark_named_operators (pfile);
  19123. @@ -1054,9 +1067,27 @@ cpp_finish_options (pfile)
  19124. /* Prevent -Wunused-macros with command-line redefinitions. */
  19125. pfile->first_unused_line = (unsigned int) -1;
  19126. - _cpp_do_file_change (pfile, LC_RENAME, _("<built-in>"), 1, 0);
  19127. +
  19128. + /* CHG K.Watanabe V1.7 >>>>>>> */
  19129. + /* C33: Output the same content with version 2.95.2, when the assembler source files are preprocessed. */
  19130. + /* _cpp_do_file_change (pfile, LC_RENAME, _("<built-in>"), 1, 0); */
  19131. + i_len = strlen( pfile->map->to_file );
  19132. + if( ( pfile->map->to_file[ i_len- 1 ] != 's' ) && ( pfile->map->to_file[ i_len- 1 ] != 'S' ) ){
  19133. + _cpp_do_file_change (pfile, LC_RENAME, _("<built-in>"), 1, 0);
  19134. + }
  19135. + /* CHG K.Watanabe V1.7 <<<<<<< */
  19136. +
  19137. init_builtins (pfile);
  19138. - _cpp_do_file_change (pfile, LC_RENAME, _("<command line>"), 1, 0);
  19139. +
  19140. + /* CHG K.Watanabe V1.7 >>>>>>> */
  19141. + /* C33: Output the same content with version 2.95.2, when the assembler source files are preprocessed. */
  19142. + /* _cpp_do_file_change (pfile, LC_RENAME, _("<command line>"), 1, 0); */
  19143. + i_len = strlen( pfile->map->to_file );
  19144. + if( ( pfile->map->to_file[ i_len- 1 ] != 's' ) && ( pfile->map->to_file[ i_len- 1 ] != 'S' ) ){
  19145. + _cpp_do_file_change (pfile, LC_RENAME, _("<command line>"), 1, 0);
  19146. + }
  19147. + /* CHG K.Watanabe V1.7 <<<<<<< */
  19148. +
  19149. for (p = CPP_OPTION (pfile, pending)->directive_head; p; p = p->next)
  19150. (*p->handler) (pfile, p->arg);
  19151. @@ -1064,11 +1095,20 @@ cpp_finish_options (pfile)
  19152. pfile->next_include_file is NULL, so _cpp_pop_buffer does not
  19153. push -include files. */
  19154. for (p = CPP_OPTION (pfile, pending)->imacros_head; p; p = p->next)
  19155. - if (push_include (pfile, p))
  19156. - cpp_scan_nooutput (pfile);
  19157. -
  19158. - pfile->next_include_file = &CPP_OPTION (pfile, pending)->include_head;
  19159. - _cpp_maybe_push_include_file (pfile);
  19160. + if (push_include (pfile, p))
  19161. + cpp_scan_nooutput (pfile);
  19162. +
  19163. + pfile->next_include_file = &CPP_OPTION (pfile, pending)->include_head;
  19164. + /* CHG K.Watanabe V1.7 >>>>>>> */
  19165. +/* _cpp_maybe_push_include_file (pfile); */
  19166. + /* C33: Output the same content with version 2.95.2, when the assembler source files are preprocessed. */
  19167. + i_len = strlen( pfile->map->to_file );
  19168. + if( ( pfile->map->to_file[ i_len- 1 ] == 's' ) || ( pfile->map->to_file[ i_len- 1 ] == 'S' ) ){
  19169. + i_Line_Dummy_Output_Flg = 1;
  19170. + }
  19171. + _cpp_maybe_push_include_file (pfile);
  19172. + i_Line_Dummy_Output_Flg = 0;
  19173. + /* CHG K.Watanabe V1.7 <<<<<<< */
  19174. }
  19175. pfile->first_unused_line = pfile->line;
  19176. @@ -1095,7 +1135,7 @@ _cpp_maybe_push_include_file (pfile)
  19177. {
  19178. /* All done; restore the line map from <command line>. */
  19179. _cpp_do_file_change (pfile, LC_RENAME,
  19180. - pfile->line_maps.maps[0].to_file, 1, 0);
  19181. + pfile->line_maps.maps[0].to_file, 1, 0);
  19182. /* Don't come back here again. */
  19183. pfile->next_include_file = NULL;
  19184. }
  19185. diff --git a/gcc/cpplib.c b/gcc/cpplib.c
  19186. index e18564e..7f0c3fb 100644
  19187. --- a/gcc/cpplib.c
  19188. +++ b/gcc/cpplib.c
  19189. @@ -26,6 +26,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  19190. #include "cpphash.h"
  19191. #include "obstack.h"
  19192. +
  19193. /* Chained list of answers to an assertion. */
  19194. struct answer
  19195. {
  19196. @@ -1359,7 +1360,7 @@ do_ifdef (pfile)
  19197. cpp_reader *pfile;
  19198. {
  19199. int skip = 1;
  19200. -
  19201. +
  19202. if (! pfile->state.skipping)
  19203. {
  19204. const cpp_hashnode *node = lex_macro_node (pfile);
  19205. @@ -1494,7 +1495,7 @@ do_endif (pfile)
  19206. {
  19207. cpp_buffer *buffer = pfile->buffer;
  19208. struct if_stack *ifs = buffer->if_stack;
  19209. -
  19210. +
  19211. if (ifs == NULL)
  19212. cpp_error (pfile, DL_ERROR, "#endif without #if");
  19213. else
  19214. diff --git a/gcc/cppmain.c b/gcc/cppmain.c
  19215. index d49c6f8..23a6128 100644
  19216. --- a/gcc/cppmain.c
  19217. +++ b/gcc/cppmain.c
  19218. @@ -52,6 +52,13 @@ static void cb_ident PARAMS ((cpp_reader *, unsigned int,
  19219. static void cb_file_change PARAMS ((cpp_reader *, const struct line_map *));
  19220. static void cb_def_pragma PARAMS ((cpp_reader *, unsigned int));
  19221. +/* ADD K.Watanabe V1.7 >>>>>>> */
  19222. +/* C33: Output the same content with version 2.95.2, when the assembler source files are preprocessed. */
  19223. +extern int i_Line_Dummy_Output_Flg;
  19224. +extern int i_Asm_CRLF_Line_Init_Flg;
  19225. +char c_Save_Pre_Filename[2000] = { 0 }; /* C33: Save the last output file name. */
  19226. +/* ADD K.Watanabe V1.7 <<<<<<< */
  19227. +
  19228. /* Preprocess and output. */
  19229. void
  19230. cpp_preprocess_file (pfile, in_fname, out_stream)
  19231. @@ -219,6 +226,8 @@ maybe_print_line (pfile, map, line)
  19232. const struct line_map *map;
  19233. unsigned int line;
  19234. {
  19235. + int i_len; /* ADD K.Watanabe V1.7 */
  19236. +
  19237. /* End the previous line of text. */
  19238. if (pfile->print.printed)
  19239. {
  19240. @@ -227,6 +236,11 @@ maybe_print_line (pfile, map, line)
  19241. pfile->print.printed = 0;
  19242. }
  19243. + /* CHG K.Watanabe V1.7 >>>>>>> */
  19244. + /* C33: In the assembler source files, let it output exactly at the new lines which continue 8 or more lines.
  19245. + The following process is necessary because gnu33 assember is version 2.95.2, and it can't correspond
  19246. + to the format of "#souce file line No." */
  19247. + #if 0
  19248. if (line >= pfile->print.line && line < pfile->print.line + 8)
  19249. {
  19250. while (line > pfile->print.line)
  19251. @@ -237,6 +251,34 @@ maybe_print_line (pfile, map, line)
  19252. }
  19253. else
  19254. print_line (pfile, map, line, "");
  19255. + #endif
  19256. +
  19257. + i_len = strlen( pfile->map->to_file );
  19258. + if( ( pfile->map->to_file[ i_len- 1 ] == 's' ) || ( pfile->map->to_file[ i_len- 1 ] == 'S' ) ){
  19259. + if ( line >= pfile->print.line && line )
  19260. + {
  19261. + while (line > pfile->print.line)
  19262. + {
  19263. + putc ('\n', pfile->print.outf);
  19264. + pfile->print.line++;
  19265. + }
  19266. + }
  19267. + else
  19268. + print_line (pfile, map, line, "");
  19269. + } else {
  19270. + if (line >= pfile->print.line && line < pfile->print.line + 8)
  19271. + {
  19272. + while (line > pfile->print.line)
  19273. + {
  19274. + putc ('\n', pfile->print.outf);
  19275. + pfile->print.line++;
  19276. + }
  19277. + }
  19278. + else
  19279. + print_line (pfile, map, line, "");
  19280. + }
  19281. + /* CHG K.Watanabe V1.7 <<<<<<< */
  19282. +
  19283. }
  19284. /* Output a line marker for logical line LINE. Special flags are "1"
  19285. @@ -248,6 +290,11 @@ print_line (pfile, map, line, special_flags)
  19286. unsigned int line;
  19287. const char *special_flags;
  19288. {
  19289. + /* ADD K.Watanabe V1.7 >>>>>>> */
  19290. + int i_len;
  19291. + int i_ret;
  19292. + /* ADD K.Watanabe V1.7 <<<<<<< */
  19293. +
  19294. /* End any previous line of text. */
  19295. if (pfile->print.printed)
  19296. putc ('\n', pfile->print.outf);
  19297. @@ -265,16 +312,46 @@ print_line (pfile, map, line, special_flags)
  19298. p = cpp_quote_string (to_file_quoted,
  19299. (unsigned char *)map->to_file, to_file_len);
  19300. *p = '\0';
  19301. - fprintf (pfile->print.outf, "# %u \"%s\"%s",
  19302. - SOURCE_LINE (map, pfile->print.line),
  19303. - to_file_quoted, special_flags);
  19304. -
  19305. - if (map->sysp == 2)
  19306. - fputs (" 3 4", pfile->print.outf);
  19307. - else if (map->sysp == 1)
  19308. - fputs (" 3", pfile->print.outf);
  19309. -
  19310. - putc ('\n', pfile->print.outf);
  19311. + /* ADD K.Watanabe V1.7 >>>>>>> */
  19312. + /* C33: Output the same content with version 2.95.2, when the assembler source files are preprocessed. */
  19313. +
  19314. + if( i_Line_Dummy_Output_Flg == 0 ){
  19315. + /* C33: Do not output the same name at the plural times, when it is the assember source file. */
  19316. + i_ret = strcmp( c_Save_Pre_Filename,to_file_quoted );
  19317. + i_len = strlen( to_file_quoted );
  19318. + if( ( ( to_file_quoted[ i_len- 1 ] == 's' ) || ( to_file_quoted[ i_len- 1 ] == 'S' ) )
  19319. + && ( i_ret == 0 ) ){
  19320. + ;
  19321. + } else {
  19322. + /* ADD K.Watanabe V1.7 <<<<<<< */
  19323. + fprintf (pfile->print.outf, "# %u \"%s\"%s",
  19324. + SOURCE_LINE (map, pfile->print.line),
  19325. + to_file_quoted, special_flags);
  19326. +
  19327. + if (map->sysp == 2)
  19328. + fputs (" 3 4", pfile->print.outf);
  19329. + else if (map->sysp == 1)
  19330. + fputs (" 3", pfile->print.outf);
  19331. +
  19332. + putc ('\n', pfile->print.outf);
  19333. +
  19334. + /* ADD K.Watanabe V1.7 >>>>>>> */
  19335. + /* C33: Output the same content with version 2.95.2, when the assembler source files are preprocessed. */
  19336. + if( ( ( to_file_quoted[ i_len- 1 ] == 's' ) || ( to_file_quoted[ i_len- 1 ] == 'S' ) )
  19337. + && ( i_Asm_CRLF_Line_Init_Flg == 0 ) ){
  19338. + i_Asm_CRLF_Line_Init_Flg = 1;
  19339. + } else if( ( ( to_file_quoted[ i_len- 1 ] == 's' ) || ( to_file_quoted[ i_len- 1 ] == 'S' ) )
  19340. + && ( i_Asm_CRLF_Line_Init_Flg == 1 ) ){
  19341. + putc ('\n', pfile->print.outf);
  19342. + } else {
  19343. + ;
  19344. + }
  19345. + /* C33: Do not output the same name at the plural times, when it is the assember source file. */
  19346. + memset( c_Save_Pre_Filename,0,sizeof( c_Save_Pre_Filename ) );
  19347. + strcpy( c_Save_Pre_Filename,to_file_quoted );
  19348. + }
  19349. + }
  19350. + /* ADD K.Watanabe V1.7 <<<<<<< */
  19351. }
  19352. }
  19353. diff --git a/gcc/final.c b/gcc/final.c
  19354. index 94a0f4c..efca8fc 100644
  19355. --- a/gcc/final.c
  19356. +++ b/gcc/final.c
  19357. @@ -899,6 +899,12 @@ insn_current_reference_address (branch)
  19358. rtx dest, seq;
  19359. int seq_uid;
  19360. +/* ADD K.Watanabe V1.7 >>>>>>> */
  19361. +#if 1 /* GNU-GCC-008 2001/6/28 watanabe */
  19362. + int insn_length;
  19363. +#endif /* GNU-GCC-008 2001/6/28 watanabe */
  19364. +/* ADD K.Watanabe V1.7 <<<<<<< */
  19365. +
  19366. if (! INSN_ADDRESSES_SET_P ())
  19367. return 0;
  19368. @@ -911,6 +917,18 @@ insn_current_reference_address (branch)
  19369. We assume here that FUNCTION_BOUNDARY / BITS_PER_UNIT is larger than
  19370. any alignment we'd encounter, so we skip the call to align_fuzz. */
  19371. return insn_current_address;
  19372. +
  19373. +/* ADD K.Watanabe V1.7 >>>>>>> */
  19374. +#if 1 /* GNU-GCC-008 2001/6/28 watanabe */
  19375. + insn_length = insn_lengths[seq_uid];
  19376. + if (GET_CODE (PATTERN (seq)) == SEQUENCE)
  19377. + {
  19378. + if (const_num_delay_slots (XVECEXP (PATTERN (seq), 0, 0)) == 1)
  19379. + insn_length -= 2;
  19380. + }
  19381. +#endif /* GNU-GCC-008 2001/6/28 watanabe */
  19382. +/* ADD K.Watanabe V1.7 <<<<<<< */
  19383. +
  19384. dest = JUMP_LABEL (branch);
  19385. /* BRANCH has no proper alignment chain set, so use SEQ.
  19386. @@ -918,15 +936,81 @@ insn_current_reference_address (branch)
  19387. if (INSN_SHUID (seq) < INSN_SHUID (dest))
  19388. {
  19389. /* Forward branch. */
  19390. +/* ADD K.Watanabe V1.7 >>>>>>> */
  19391. +#if 0 /* GNU-GCC-008 2001/6/27 watanabe */
  19392. return (insn_last_address + insn_lengths[seq_uid]
  19393. - align_fuzz (seq, dest, length_unit_log, ~0));
  19394. +#else /* GNU-GCC-008 2001/6/27 watanabe */
  19395. +/* ADD K.Watanabe V1.7 <<<<<<< */
  19396. + if (insn_length == 2)
  19397. + {
  19398. + return (insn_last_address
  19399. + - align_fuzz (seq, dest, length_unit_log, ~0));
  19400. + }
  19401. + else if (insn_length == 4)
  19402. + {
  19403. + return (insn_last_address + 2
  19404. + - align_fuzz (seq, dest, length_unit_log, ~0));
  19405. + }
  19406. + else if (insn_length == 6)
  19407. + {
  19408. + return (insn_last_address + 4
  19409. + - align_fuzz (seq, dest, length_unit_log, ~0));
  19410. + }
  19411. +/* ADD K.Watanabe V1.7 >>>>>>> */
  19412. +#if 1 /* GNU-GCC-042 2002/1/30 watanabe */
  19413. + else if (insn_length == 8)
  19414. + {
  19415. + return (insn_last_address + 6
  19416. + - align_fuzz (seq, dest, length_unit_log, ~0));
  19417. + }
  19418. +#endif /* GNU-GCC-042 2002/1/30 watanabe */
  19419. +/* ADD K.Watanabe V1.7 <<<<<<< */
  19420. + else
  19421. + {
  19422. + abort();
  19423. + }
  19424. +#endif /* GNU-GCC-008 2001/6/27 watanabe *//* ADD K.Watanabe V1.7 */
  19425. }
  19426. else
  19427. {
  19428. /* Backward branch. */
  19429. +/* ADD K.Watanabe V1.7 >>>>>>> */
  19430. +#if 0 /* GNU-GCC-008 2001/6/27 watanabe */
  19431. return (insn_current_address
  19432. + align_fuzz (dest, seq, length_unit_log, ~0));
  19433. +#else /* GNU-GCC-008 2001/6/27 watanabe */
  19434. +/* ADD K.Watanabe V1.7 <<<<<<< */
  19435. + if (insn_length == 2)
  19436. + {
  19437. + return (insn_last_address
  19438. + + align_fuzz (dest, seq, length_unit_log, ~0));
  19439. + }
  19440. + else if (insn_length == 4)
  19441. + {
  19442. + return (insn_last_address + 2
  19443. + + align_fuzz (dest, seq, length_unit_log, ~0));
  19444. + }
  19445. + else if (insn_length == 6)
  19446. + {
  19447. + return (insn_last_address + 4
  19448. + + align_fuzz (dest, seq, length_unit_log, ~0));
  19449. + }
  19450. +/* ADD K.Watanabe V1.7 >>>>>>> */
  19451. +#if 1 /* GNU-GCC-042 2002/1/30 watanabe */
  19452. + else if (insn_length == 8)
  19453. + {
  19454. + return (insn_last_address + 6
  19455. + + align_fuzz (dest, seq, length_unit_log, ~0));
  19456. + }
  19457. +#endif /* GNU-GCC-042 2002/1/30 watanabe */
  19458. +/* ADD K.Watanabe V1.7 <<<<<<< */
  19459. + else
  19460. + {
  19461. + abort();
  19462. + }
  19463. }
  19464. +#endif /* GNU-GCC-008 2001/6/27 watanabe *//* ADD K.Watanabe V1.7 */
  19465. }
  19466. #endif /* HAVE_ATTR_length */
  19467. diff --git a/gcc/gcc.c b/gcc/gcc.c
  19468. index 08a37cd..a5c9ed6 100644
  19469. --- a/gcc/gcc.c
  19470. +++ b/gcc/gcc.c
  19471. @@ -6184,7 +6184,12 @@ main (argc, argv)
  19472. if (! strncmp (version_string, compiler_version, n)
  19473. && compiler_version[n] == 0)
  19474. +#ifdef EPSON /* CHG K.Watanabe V1.7 >>>>>>> */
  19475. + /* xgcc prints its c33-compiler version. */
  19476. + notice ("gcc version %s%s\n", version_string, C33_TARGET_VERSION );
  19477. +#else
  19478. notice ("gcc version %s\n", version_string);
  19479. +#endif /* CHG K.Watanabe V1.7 <<<<<<< */
  19480. else
  19481. notice ("gcc driver version %s executing gcc version %s\n",
  19482. version_string, compiler_version);
  19483. diff --git a/gcc/line-map.c b/gcc/line-map.c
  19484. index a0f3ee5..a4e6c6c 100644
  19485. --- a/gcc/line-map.c
  19486. +++ b/gcc/line-map.c
  19487. @@ -25,6 +25,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19488. #include "line-map.h"
  19489. #include "intl.h"
  19490. +/* ADD K.Watanabe V1.7 >>>>>>> */
  19491. +/* C33: Output the same content with version 2.95.2, when the assembler source files are preprocessed. */
  19492. +extern int i_Asm_Adjust_Line_Init_Flg;
  19493. +/* ADD K.Watanabe V1.7 <<<<<<< */
  19494. +
  19495. static void trace_include
  19496. PARAMS ((const struct line_maps *, const struct line_map *));
  19497. @@ -80,7 +85,8 @@ add_line_map (set, reason, sysp, from_line, to_file, to_line)
  19498. unsigned int to_line;
  19499. {
  19500. struct line_map *map;
  19501. -
  19502. + int i_len; /* ADD K.Watanabe V1.7 */
  19503. +
  19504. if (set->used && from_line < set->maps[set->used - 1].from_line)
  19505. abort ();
  19506. @@ -124,7 +130,18 @@ add_line_map (set, reason, sysp, from_line, to_file, to_line)
  19507. if (error || to_file == NULL)
  19508. {
  19509. to_file = from->to_file;
  19510. - to_line = LAST_SOURCE_LINE (from) + 1;
  19511. + /* CHG K.Watanabe V1.7 >>>>>>> */
  19512. + /* C33: Output the same content with version 2.95.2, when the assembler source files are preprocessed. */
  19513. +/* to_line = LAST_SOURCE_LINE (from) + 1; */
  19514. + i_len = strlen( to_file );
  19515. + if( ( ( to_file[ i_len- 1 ] == 's' ) || ( to_file[ i_len- 1 ] == 'S' ) )
  19516. + && ( i_Asm_Adjust_Line_Init_Flg == 0 ) ){
  19517. + to_line = LAST_SOURCE_LINE (from);
  19518. + i_Asm_Adjust_Line_Init_Flg = 1;
  19519. + } else {
  19520. + to_line = LAST_SOURCE_LINE (from) + 1;
  19521. + }
  19522. + /* CHG K.Watanabe V1.7 <<<<<<< */
  19523. sysp = from->sysp;
  19524. }
  19525. }
  19526. diff --git a/gcc/protoize.c b/gcc/protoize.c
  19527. index e039d6d..4d2763d 100644
  19528. --- a/gcc/protoize.c
  19529. +++ b/gcc/protoize.c
  19530. @@ -592,6 +592,7 @@ safe_read (desc, ptr, len)
  19531. int len;
  19532. {
  19533. int left = len;
  19534. +
  19535. while (left > 0) {
  19536. int nchars = read (desc, ptr, left);
  19537. if (nchars < 0)
  19538. @@ -623,6 +624,7 @@ safe_write (desc, ptr, len, out_fname)
  19539. {
  19540. while (len > 0) {
  19541. int written = write (desc, ptr, len);
  19542. +
  19543. if (written < 0)
  19544. {
  19545. int errno_val = errno;
  19546. diff --git a/gcc/toplev.c b/gcc/toplev.c
  19547. index adccdc4..44125b3 100644
  19548. --- a/gcc/toplev.c
  19549. +++ b/gcc/toplev.c
  19550. @@ -4557,6 +4557,25 @@ print_version (file, indent)
  19551. FILE *file;
  19552. const char *indent;
  19553. {
  19554. +
  19555. +#ifdef EPSON /* CHG K.Watanabe V1.7 >>>>>>> */
  19556. + /* cc1 prints its c33-compiler version. */
  19557. +
  19558. +#ifndef __VERSION__
  19559. +#define __VERSION__ "[?]"
  19560. +#endif
  19561. + fnotice (file,
  19562. +#ifdef __GNUC__
  19563. + "%s%s%s version %s (%s) compiled by GNU C version %s%s.\n"
  19564. +#else
  19565. + "%s%s%s version %s (%s) compiled by CC.\n"
  19566. +#endif
  19567. + , indent, *indent != 0 ? " " : "",
  19568. + lang_hooks.name, version_string, TARGET_NAME, __VERSION__,
  19569. + C33_TARGET_VERSION );
  19570. +
  19571. +#else
  19572. +
  19573. #ifndef __VERSION__
  19574. #define __VERSION__ "[?]"
  19575. #endif
  19576. @@ -4569,6 +4588,8 @@ print_version (file, indent)
  19577. , indent, *indent != 0 ? " " : "",
  19578. lang_hooks.name, version_string, TARGET_NAME,
  19579. indent, __VERSION__);
  19580. +#endif /* #ifndef EPSON *//* CHG K.Watanabe V1.7 <<<<<<< */
  19581. +
  19582. fnotice (file, "%s%sGGC heuristics: --param ggc-min-expand=%d --param ggc-min-heapsize=%d\n",
  19583. indent, *indent != 0 ? " " : "",
  19584. PARAM_VALUE (GGC_MIN_EXPAND), PARAM_VALUE (GGC_MIN_HEAPSIZE));
  19585. @@ -4878,6 +4899,36 @@ parse_options_and_default_flags (argc, argv)
  19586. flag_crossjumping = 1;
  19587. flag_if_conversion = 1;
  19588. flag_if_conversion2 = 1;
  19589. +
  19590. + /* ADD K.Watanabe V1.7 >>>>>>> */
  19591. + /* C33: Correspondence to a bug. */
  19592. + /* Enable "-fforce-addr" which is the compiler option with default */
  19593. + /* only when it is "-O". */
  19594. + /* -fforce-addr -- This options means that the content of memory is loaded to */
  19595. + /* the register, and the register is referenced. */
  19596. + /* */
  19597. + /* The option above is set because the following bug is occurred */
  19598. + /* at the "-O" && ( Not "-medda32" or Advanced mode ). */
  19599. + /* */
  19600. + /* "-fforce-addr" is enabled with default at the "-O", because the state of */
  19601. + /* existence of "-medda32" / Advanced mode can not be checked in this function. */
  19602. + /* */
  19603. + /* xld.w [%sp+132],%r8 */
  19604. + /* ....... */
  19605. + /* xld.w [%sp+132],%r11 */
  19606. + /* ....... */
  19607. + /* ;;;;;;;;;;;;;;;;;;;;;;;;;;; */
  19608. + /* xld.w %r8,[%sp+132] ---- @ */
  19609. + /* ;;;;;;;;;;;;;;;;;;;;;;;;;;; */
  19610. + /* xld.w [%sp+176],%r8 ---- A */
  19611. + /* */
  19612. + /* The code of @ is deleted in the process of optimization, */
  19613. + /* and the right value is not set to [%sp+176]( which is A ). */
  19614. +
  19615. + if( optimize == 1 ){
  19616. + flag_force_addr = 1;
  19617. + }
  19618. + /* ADD K.Watanabe V1.7 <<<<<<< */
  19619. }
  19620. if (optimize >= 2)
  19621. diff --git a/gcc/tree.h b/gcc/tree.h
  19622. index 1ad4b14..56fcb5f 100644
  19623. --- a/gcc/tree.h
  19624. +++ b/gcc/tree.h
  19625. @@ -413,11 +413,9 @@ extern void tree_vec_elt_check_failed PARAMS ((int, int, const char *,
  19626. /* Nonzero if TYPE represents an integral type. Note that we do not
  19627. include COMPLEX types here. */
  19628. -
  19629. #define INTEGRAL_TYPE_P(TYPE) \
  19630. (TREE_CODE (TYPE) == INTEGER_TYPE || TREE_CODE (TYPE) == ENUMERAL_TYPE \
  19631. || TREE_CODE (TYPE) == BOOLEAN_TYPE || TREE_CODE (TYPE) == CHAR_TYPE)
  19632. -
  19633. /* Nonzero if TYPE represents a floating-point type, including complex
  19634. floating-point types. */
  19635. diff --git a/gcc/varasm.c b/gcc/varasm.c
  19636. index 9a76099..5bd5018 100644
  19637. --- a/gcc/varasm.c
  19638. +++ b/gcc/varasm.c
  19639. @@ -470,7 +470,7 @@ resolve_unique_section (decl, reloc, flag_function_or_data_sections)
  19640. && targetm.have_named_sections
  19641. && (flag_function_or_data_sections
  19642. || DECL_ONE_ONLY (decl)))
  19643. - (*targetm.asm_out.unique_section) (decl, reloc);
  19644. + (*targetm.asm_out.unique_section) (decl, reloc);
  19645. }
  19646. #ifdef BSS_SECTION_ASM_OP
  19647. @@ -563,7 +563,7 @@ function_section (decl)
  19648. {
  19649. if (decl != NULL_TREE
  19650. && DECL_SECTION_NAME (decl) != NULL_TREE)
  19651. - named_section (decl, (char *) 0, 0);
  19652. + named_section (decl, (char *) 0, 0);
  19653. else
  19654. text_section ();
  19655. }
  19656. @@ -1583,12 +1583,23 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
  19657. if (DECL_COMMON (decl))
  19658. sorry ("thread-local COMMON data not implemented");
  19659. }
  19660. +/* CHG K.Watanabe V1.7 >>>>>>> */
  19661. +/* C33: Allocate to ".data" section even when it is initizalized by 0. */
  19662. +#if 0
  19663. else if (DECL_INITIAL (decl) == 0
  19664. || DECL_INITIAL (decl) == error_mark_node
  19665. || (flag_zero_initialized_in_bss
  19666. /* Leave constant zeroes in .rodata so they can be shared. */
  19667. && !TREE_READONLY (decl)
  19668. && initializer_zerop (DECL_INITIAL (decl))))
  19669. +#endif
  19670. + else if (DECL_INITIAL (decl) == 0
  19671. + || DECL_INITIAL (decl) == error_mark_node
  19672. + || (flag_zero_initialized_in_bss
  19673. + /* Leave constant zeroes in .rodata so they can be shared. */
  19674. + && !TREE_READONLY (decl)
  19675. + && 0 ))
  19676. +/* CHG K.Watanabe V1.7 <<<<<<< */
  19677. {
  19678. unsigned HOST_WIDE_INT size = tree_low_cst (DECL_SIZE_UNIT (decl), 1);
  19679. unsigned HOST_WIDE_INT rounded = size;
  19680. diff --git a/include/obstack.h b/include/obstack.h
  19681. index d86d9f2..ab960e9 100644
  19682. --- a/include/obstack.h
  19683. +++ b/include/obstack.h
  19684. @@ -418,6 +418,9 @@ __extension__ \
  19685. and that the data added so far to the current object
  19686. shares that much alignment. */
  19687. +
  19688. +// CHG K.Watanabe V1.8 >>>>>>>
  19689. +#if 0
  19690. # define obstack_ptr_grow(OBSTACK,datum) \
  19691. __extension__ \
  19692. ({ struct obstack *__o = (OBSTACK); \
  19693. @@ -425,6 +428,19 @@ __extension__ \
  19694. _obstack_newchunk (__o, sizeof (void *)); \
  19695. *((void **)__o->next_free)++ = ((void *)datum); \
  19696. (void) 0; })
  19697. +#endif
  19698. +
  19699. +
  19700. +# define obstack_ptr_grow(OBSTACK,datum) \
  19701. +__extension__ \
  19702. +({ struct obstack *__o = (OBSTACK); \
  19703. + if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
  19704. + _obstack_newchunk (__o, sizeof (void *)); \
  19705. + *((void **)__o->next_free) = ((void *)datum); \
  19706. + __o->next_free += sizeof(void *); \
  19707. + (void) 0; })
  19708. +// CHG K.Watanabe V1.8 <<<<<<<
  19709. +
  19710. # define obstack_int_grow(OBSTACK,datum) \
  19711. __extension__ \
  19712. diff --git a/libstdc++-v3/include/c_std/std_cstring.h b/libstdc++-v3/include/c_std/std_cstring.h
  19713. index 066342a..4cbd121 100644
  19714. --- a/libstdc++-v3/include/c_std/std_cstring.h
  19715. +++ b/libstdc++-v3/include/c_std/std_cstring.h
  19716. @@ -101,25 +101,21 @@ namespace std
  19717. { return memchr(const_cast<const void*>(__p), __c, __n); }
  19718. using ::strchr;
  19719. -
  19720. inline char*
  19721. strchr(char* __s1, int __n)
  19722. { return __builtin_strchr(const_cast<const char*>(__s1), __n); }
  19723. using ::strpbrk;
  19724. -
  19725. inline char*
  19726. strpbrk(char* __s1, const char* __s2)
  19727. { return __builtin_strpbrk(const_cast<const char*>(__s1), __s2); }
  19728. using ::strrchr;
  19729. -
  19730. inline char*
  19731. strrchr(char* __s1, int __n)
  19732. { return __builtin_strrchr(const_cast<const char*>(__s1), __n); }
  19733. using ::strstr;
  19734. -
  19735. inline char*
  19736. strstr(char* __s1, const char* __s2)
  19737. { return __builtin_strstr(const_cast<const char*>(__s1), __s2); }
  19738. --
  19739. 1.5.4.3