table 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852
  1. "$Header$"
  2. /********************************************************
  3. * Back end tables for pdp 11 *
  4. * Authors : Ceriel J.H. Jacobs,Hans van Staveren *
  5. * *
  6. * wordsize = 2 bytes, pointersize = 2 bytes. *
  7. * *
  8. * Register r5 is used for the LB, the stack pointer *
  9. * is used for SP. Also some global variables are used: *
  10. * - reghp~ : the heap pointer *
  11. * - trpim~ : trap ignore mask *
  12. * - trppc~ : address of user defined trap handler *
  13. * - retar : function return area for size>4 *
  14. * *
  15. * Timing is based on the timing information available *
  16. * for the 11/45. Hardware floating point processor is *
  17. * assumed. *
  18. ********************************************************/
  19. /*
  20. * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
  21. *
  22. * This product is part of the Amsterdam Compiler Kit.
  23. *
  24. * Permission to use, sell, duplicate or disclose this software must be
  25. * obtained in writing. Requests for such permissions may be sent to
  26. *
  27. * Dr. Andrew S. Tanenbaum
  28. * Wiskundig Seminarium
  29. * Vrije Universiteit
  30. * Postbox 7161
  31. * 1007 MC Amsterdam
  32. * The Netherlands
  33. *
  34. */
  35. /* #define REGPATCH \* save all registers in link block */
  36. /* #define UNTESTED \* include untested rules */
  37. #ifdef REGPATCH
  38. #define SL 8
  39. #define SSL "010"
  40. #else REGPATCH
  41. #define SL 4
  42. #define SSL "4"
  43. #endif REGPATCH
  44. #define NC nocoercions:
  45. /* options */
  46. /* #define DORCK \* rck is expanded instead of thrown away */
  47. #define REGVARS /* use register variables */
  48. EM_WSIZE=2
  49. EM_PSIZE=2
  50. EM_BSIZE=SL
  51. TIMEFACTOR= 1/300
  52. FORMAT="0%o"
  53. REGISTERS:
  54. r0 = ("r0", 2), REG.
  55. r1 = ("r1", 2), REG, ODD_REG.
  56. #ifdef REGVARS
  57. r2 = ("r2", 2) regvar, REG.
  58. #else
  59. /* r2 = ("r2", 2), REG. */
  60. #endif
  61. r3 = ("r3", 2), REG, ODD_REG.
  62. #ifdef REGVARS
  63. r4 = ("r4", 2) regvar, REG.
  64. #else
  65. /* r4 = ("r4", 2), REG. */
  66. #endif
  67. lb = ("r5", 2), localbase.
  68. r01 = ("r0", 4, r0, r1), REG_PAIR.
  69. #ifndef REGVARS
  70. /* r23 = ("r2", 4, r2, r3), REG_PAIR. */
  71. #endif
  72. fr0 = ("fr0", 4), FLT_REG.
  73. fr1 = ("fr1", 4), FLT_REG.
  74. fr2 = ("fr2", 4), FLT_REG.
  75. fr3 = ("fr3", 4), FLT_REG.
  76. fr01 = ("fr0", 8, fr0, fr1), FLT_REG_PAIR.
  77. fr23 = ("fr2", 8, fr2, fr3), FLT_REG_PAIR.
  78. dr0 = ("fr0", 8, fr0), DBL_REG.
  79. dr1 = ("fr1", 8, fr1), DBL_REG.
  80. dr2 = ("fr2", 8, fr2), DBL_REG.
  81. dr3 = ("fr3", 8, fr3), DBL_REG.
  82. dr01 = ("fr0", 16, dr0, dr1), DBL_REG_PAIR.
  83. dr23 = ("fr2", 16, dr2, dr3), DBL_REG_PAIR.
  84. TOKENS:
  85. /********************************
  86. * Types on the EM-machine *
  87. ********************************/
  88. CONST2 = {INT num;} 2 cost=(2,300) "$%[num]"
  89. LOCAL2 = {INT ind,size;} 2 cost=(2,600) "%[ind](r5)"
  90. LOCAL4 = {INT ind,size;} 4 cost=(2,1200) "%[ind](r5)"
  91. ADDR_LOCAL = {INT ind;} 2
  92. ADDR_EXTERNAL = {STRING ind;} 2 cost=(2,300) "$%[ind]"
  93. /********************************************************
  94. * Now mostly addressing modes of target machine *
  95. ********************************************************/
  96. regdef2 = {REGISTER reg;} 2 cost=(0,300) "*%[reg]"
  97. regind2 = {REGISTER reg; STRING ind;} 2 cost=(2,600) "%[ind](%[reg])"
  98. reginddef2 = {REGISTER reg; STRING ind;} 2 cost=(2,1050) "*%[ind](%[reg])"
  99. regconst2 = {REGISTER reg; STRING ind;} 2
  100. /********************************************************
  101. * This means : add "reg" and "ind" to get address. *
  102. * Not really addressable on the PDP 11 *
  103. ********************************************************/
  104. relative2 = {STRING ind;} 2 cost=(2,600) "%[ind]"
  105. reldef2 = {STRING ind;} 2 cost=(2,1050) "*%[ind]"
  106. regdef1 = {REGISTER reg;} 2 cost=(0,300) "*%[reg]"
  107. regind1 = {REGISTER reg; STRING ind;} 2 cost=(2,600) "%[ind](%[reg])"
  108. reginddef1 = {REGISTER reg; STRING ind;} 2 cost=(2,1050) "*%[ind](%[reg])"
  109. relative1 = {STRING ind;} 2 cost=(2,600) "%[ind]"
  110. reldef1 = {STRING ind;} 2 cost=(2,1050) "*%[ind]"
  111. /************************************************************************
  112. * fto* are floats converted to *, conversion is delayed to be combined *
  113. * with store. *
  114. ************************************************************************/
  115. ftoint = {REGISTER reg;} 2
  116. ftolong = {REGISTER reg;} 4
  117. /************************************************************************
  118. * ...4 and ...8 are only addressable by the floating point processor. *
  119. ************************************************************************/
  120. regind4 = {REGISTER reg; STRING ind; } 4 cost=(2,3630) "%[ind](%[reg])"
  121. relative4 = {STRING ind; } 4 cost=(2,3630) "%[ind]"
  122. regdef4 = {REGISTER reg;} 4 cost=(2,3240) "*%[reg]"
  123. regdef8 = {REGISTER reg;} 8 cost=(2,5220) "*%[reg]"
  124. relative8 = {STRING ind; } 8 cost=(2,5610) "%[ind]"
  125. regind8 = {REGISTER reg; STRING ind;} 8 cost=(2,5610) "%[ind](%[reg])"
  126. TOKENEXPRESSIONS:
  127. SCR_REG = REG * SCRATCH
  128. SCR_FLT_REG = FLT_REG * SCRATCH
  129. SCR_DBL_REG = DBL_REG * SCRATCH
  130. SCR_ODD_REG = ODD_REG * SCRATCH
  131. SCR_REG_PAIR = REG_PAIR * SCRATCH
  132. all= ALL
  133. source2 = REG + regdef2 + regind2 + reginddef2 + localbase +
  134. relative2 + reldef2 + ADDR_EXTERNAL + CONST2 + LOCAL2
  135. xsource2 = source2 + ftoint
  136. source1 = regdef1 + regind1 + reginddef1 + relative1 +
  137. reldef1
  138. source1or2 = source1 + source2
  139. long4 = relative4 + regdef4 + LOCAL4 + regind4 + REG_PAIR
  140. longf4 = long4 + FLT_REG - REG_PAIR
  141. double8 = relative8 + regdef8 + regind8 + DBL_REG
  142. indexed2 = regind2 + reginddef2
  143. indexed4 = regind4
  144. indexed8 = regind8
  145. indexed = indexed2 + indexed4 + indexed8
  146. regdeferred = regdef2 + regdef4 + regdef8
  147. indordef = indexed + regdeferred
  148. locals = LOCAL2 + LOCAL4
  149. variable2 = relative2 + reldef2
  150. variable4 = relative4
  151. variable8 = relative8
  152. variable = variable2 + variable4 + variable8
  153. dadres2 = relative2 + REG + regind2
  154. regs = REG + REG_PAIR + FLT_REG + FLT_REG_PAIR +
  155. DBL_REG + DBL_REG_PAIR
  156. noconst2 = source2 - CONST2 - ADDR_EXTERNAL
  157. allexeptcon = all - regs - CONST2 - ADDR_LOCAL - ADDR_EXTERNAL
  158. externals = relative1 + relative2 + relative4 + relative8
  159. posextern = variable + regdeferred + indexed + externals
  160. diradr2 = regconst2 + ADDR_EXTERNAL
  161. #ifdef REGVARS
  162. #define INDSTORE remove(allexeptcon-locals) remove(locals, inreg(%[ind])==0)
  163. #else
  164. #define INDSTORE remove(allexeptcon)
  165. #endif
  166. CODE:
  167. /********************************************************
  168. * Group 1 : load instructions. *
  169. * *
  170. * For most load instructions no code is generated. *
  171. * Action : put something on the fake-stack. *
  172. ********************************************************/
  173. loc | | | {CONST2, $1} | |
  174. ldc | | | {CONST2, loww(1)} {CONST2, highw(1)} | |
  175. #ifdef REGVARS
  176. lol inreg($1)==2| | | regvar($1) | |
  177. #endif
  178. lol | | | {LOCAL2, $1,2} | |
  179. loe | | | {relative2, $1} | |
  180. #ifdef REGVARS
  181. lil inreg($1)==2| | | {regdef2, regvar($1)} | |
  182. #endif
  183. lil | | | {reginddef2, lb, tostring($1)} | |
  184. lof | REG | | {regind2,%[1],tostring($1)} | |
  185. ... | NC regconst2 |
  186. | {regind2,%[1.reg],tostring($1)+"+"+%[1.ind]} | |
  187. ... | NC ADDR_EXTERNAL |
  188. | {relative2,tostring($1)+"+"+%[1.ind]} | |
  189. ... | NC ADDR_LOCAL | | {LOCAL2, %[1.ind] + $1,2} | |
  190. #ifdef REGVARS
  191. lol lof inreg($1)!=2 | |
  192. allocate(REG={LOCAL2, $1,2})
  193. | {regind2,%[a],tostring($2)} | |
  194. #endif
  195. lal | | | {ADDR_LOCAL, $1} | |
  196. lae | | | {ADDR_EXTERNAL, $1} | |
  197. lpb | | | | adp SL |
  198. lxl $1==0 | | | lb | |
  199. lxl $1==1 | | | {LOCAL2 ,SL,2} | |
  200. lxl $1==2 | | allocate(REG={LOCAL2, SL, 2})
  201. | {regind2,%[a], SSL} | |
  202. lxl $1==3 | | allocate(REG={LOCAL2, SL, 2})
  203. move({regind2,%[a], SSL},%[a])
  204. | {regind2,%[a], SSL} | |
  205. lxl $1>3 | | allocate(REG={LOCAL2, SL, 2}, REG={CONST2,$1-1})
  206. "1:"
  207. move({regind2,%[a], SSL},%[a])
  208. "sob %[b],1b"
  209. setcc(%[a]) erase(%[a]) erase(%[b])
  210. | %[a] | |
  211. lxa $1==0 | | | {ADDR_LOCAL, SL} | |
  212. lxa $1==1 | | allocate(REG={LOCAL2, SL, 2 })
  213. | {regconst2, %[a], SSL } | |
  214. lxa $1==2 | | allocate(REG={LOCAL2, SL, 2 })
  215. move({regind2, %[a], SSL }, %[a])
  216. | {regconst2, %[a], SSL } | |
  217. lxa $1==3 | | allocate(REG={LOCAL2, SL, 2 })
  218. move({regind2, %[a], SSL }, %[a])
  219. move({regind2, %[a], SSL }, %[a])
  220. | {regconst2, %[a], SSL } | |
  221. lxa $1 > 3 | | allocate(REG={LOCAL2, SL, 2}, REG={CONST2,$1-1})
  222. "1:"
  223. move({regind2,%[a], SSL},%[a])
  224. "sob %[b],1b"
  225. setcc(%[a]) erase(%[a]) erase(%[b])
  226. | {regconst2, %[a], SSL } | |
  227. dch | | | | loi 2 |
  228. loi $1==2 | REG | | {regdef2, %[1]} | |
  229. ... | NC regconst2 | | {regind2, %[1.reg], %[1.ind]} | |
  230. ... | NC relative2 | | {reldef2, %[1.ind]} | |
  231. ... | NC regind2 | | {reginddef2, %[1.reg], %[1.ind]} | |
  232. ... | NC regdef2 | | {reginddef2, %[1.reg], "0"}| |
  233. ... | NC ADDR_LOCAL | | {LOCAL2, %[1.ind],2} | |
  234. ... | NC ADDR_EXTERNAL | | {relative2, %[1.ind]} | |
  235. ... | NC LOCAL2 |
  236. |{reginddef2, lb, tostring(%[1.ind])}| |
  237. loi $1==1 | REG | | {regdef1, %[1]} | |
  238. ... | NC regconst2 | | {regind1, %[1.reg], %[1.ind]} | |
  239. ... | NC ADDR_EXTERNAL | | {relative1, %[1.ind]} | |
  240. ... | NC ADDR_LOCAL| |{regind1, lb, tostring(%[1.ind])} | |
  241. ... | NC relative2 | | {reldef1, %[1.ind]} | |
  242. ... | NC regind2 | | {reginddef1, %[1.reg], %[1.ind]} | |
  243. ... | NC regdef2 | | {reginddef1, %[1.reg], "0"}| |
  244. ... | NC LOCAL2 | |{reginddef1, lb, tostring(%[1.ind])} | |
  245. loi $1==4 | REG | | {regdef4, %[1]} | |
  246. ... | NC regconst2 | | {regind4, %[1.reg], %[1.ind]} | |
  247. ... | NC ADDR_LOCAL | | {LOCAL4,%[1.ind],4} | |
  248. ... | NC ADDR_EXTERNAL | | {relative4, %[1.ind]} | |
  249. loi $1==8 | REG | | {regdef8, %[1]} | |
  250. ... | NC regconst2 | | {regind8, %[1.reg], %[1.ind]} | |
  251. ... | NC ADDR_LOCAL |
  252. | {regind8, lb , tostring(%[1.ind])} | |
  253. ... | NC ADDR_EXTERNAL | | {relative8, %[1.ind]} | |
  254. loi | NC ADDR_LOCAL |
  255. remove(all)
  256. allocate(REG={CONST2,$1/2},REG)
  257. move(lb,%[b])
  258. "add $$%(%[1.ind]+$1%),%[b]"
  259. "1:\tmov -(%[b]),-(sp)"
  260. "sob %[a],1b"
  261. erase(%[a]) erase(%[b]) | | |
  262. ... | NC ADDR_EXTERNAL |
  263. remove(all)
  264. allocate(REG={CONST2,$1/2},REG)
  265. "mov $$%[1.ind]+$1,%[b]"
  266. "1:\tmov -(%[b]),-(sp)"
  267. "sob %[a],1b"
  268. erase(%[a]) erase(%[b]) | | |
  269. ... | SCR_REG |
  270. remove(all)
  271. allocate(REG={CONST2,$1})
  272. "add %[a],%[1]"
  273. "asr %[a]"
  274. "1:\tmov -(%[1]),-(sp)"
  275. "sob %[a],1b"
  276. erase(%[1]) erase(%[a]) | | |
  277. los $1==2 | |
  278. remove(all)
  279. "mov (sp)+,r0"
  280. "mov (sp)+,r1"
  281. "jsr pc,los2~" | | |
  282. #ifdef UNTESTED
  283. los !defined($1)| source2 |
  284. remove(all)
  285. "cmp %[1],$$2"
  286. "beq 1f;jmp unknown~;1:"
  287. "mov (sp)+,r0"
  288. "mov (sp)+,r1"
  289. "jsr pc,los2~" | | |
  290. #endif
  291. ldl | | | {LOCAL4, $1,4} | |
  292. lde | | | {relative4, $1} | |
  293. ldf | regconst2 |
  294. | {regind4,%[1.reg], tostring($1)+"+"+%[1.ind]} | |
  295. ... | NC ADDR_EXTERNAL |
  296. | {relative4, tostring($1)+"+"+%[1.ind]} | |
  297. ... | NC ADDR_LOCAL | | {LOCAL4, %[1.ind]+$1,4} | |
  298. lpi | | | {ADDR_EXTERNAL, $1} | |
  299. /****************************************************************
  300. * Group 2 : Store instructions. *
  301. * *
  302. * These instructions are likely to ruin the fake-stack. *
  303. * We don't expect many items on the fake-stack anyway *
  304. * because we seem to have evaluated an expression just now. *
  305. ****************************************************************/
  306. #ifdef REGVARS
  307. stl inreg($1)==2| xsource2 |
  308. remove(regvar($1))
  309. move(%[1],regvar($1)) | | |
  310. #endif
  311. stl | xsource2 |
  312. remove(indordef)
  313. remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
  314. move(%[1],{LOCAL2,$1,2}) | | |
  315. ste | xsource2 |
  316. remove(posextern)
  317. move(%[1], {relative2, $1 }) | | |
  318. #ifdef REGVARS
  319. sil inreg($1)==2| xsource2 |
  320. INDSTORE
  321. move(%[1], {regdef2,regvar($1)}) | | |
  322. #endif
  323. sil | xsource2 |
  324. INDSTORE
  325. move(%[1], {reginddef2,lb,tostring($1)}) | | |
  326. stf | regconst2 xsource2 |
  327. INDSTORE
  328. move(%[2],{regind2,%[1.reg],tostring($1)+"+"+%[1.ind]}) | | |
  329. ... | ADDR_EXTERNAL xsource2 |
  330. INDSTORE
  331. move(%[2],{relative2,tostring($1)+"+"+%[1.ind]})| | |
  332. #ifdef REGVARS
  333. lol stf inreg($1)!=2 | xsource2 |
  334. INDSTORE
  335. allocate(REG={LOCAL2, $1,2})
  336. move(%[1],{regind2,%[a],tostring($2)}) | | |
  337. lae lol ads sti $3==2 && inreg($2)==2 | |
  338. | {regconst2, regvar($2), $1} | sti $4 |
  339. lae lol ads loi $3==2 && inreg($2)==2 | |
  340. | {regconst2, regvar($2), $1} | loi $4 |
  341. #endif
  342. sti $1==2 | REG xsource2 |
  343. INDSTORE
  344. move(%[2],{regdef2,%[1]}) | | |
  345. ... | regconst2 xsource2 |
  346. INDSTORE
  347. move(%[2],{regind2,%[1.reg],%[1.ind]}) | | |
  348. ... | ADDR_EXTERNAL xsource2 |
  349. INDSTORE
  350. move(%[2],{relative2,%[1.ind]}) | | |
  351. ... | ADDR_LOCAL xsource2 |
  352. INDSTORE
  353. move(%[2],{LOCAL2, %[1.ind], 2}) | | |
  354. ... | relative2 xsource2 |
  355. INDSTORE
  356. move(%[2],{reldef2,%[1.ind]}) | | |
  357. ... | regind2 xsource2 |
  358. INDSTORE
  359. move(%[2],{reginddef2,%[1.reg],%[1.ind]}) | | |
  360. sti $1==1 | REG source1or2 |
  361. INDSTORE
  362. move(%[2],{regdef1,%[1]}) | | |
  363. ... | regconst2 source1or2 |
  364. INDSTORE
  365. move(%[2],{regind1,%[1.reg],%[1.ind]}) | | |
  366. ... | ADDR_EXTERNAL source1or2 |
  367. INDSTORE
  368. move(%[2],{relative1,%[1.ind]}) | | |
  369. ... | ADDR_LOCAL source1or2 |
  370. INDSTORE
  371. move(%[2],{regind1, lb, tostring(%[1.ind])}) | | |
  372. ... | relative2 source1or2 |
  373. INDSTORE
  374. move(%[2],{reldef1,%[1.ind]}) | | |
  375. ... | regind2 source1or2 |
  376. INDSTORE
  377. move(%[2],{reginddef1,%[1.reg],%[1.ind]}) | | |
  378. sti $1==4 | dadres2 FLT_REG |
  379. INDSTORE
  380. "movfo %[2],*%[1]"
  381. samecc | | |
  382. ... | dadres2 ftolong |
  383. INDSTORE
  384. "setl\nmovfi %[2.reg],*%[1]\nseti"
  385. samecc | | |
  386. ... | regconst2 FLT_REG |
  387. INDSTORE
  388. "movfo %[2],%[1.ind](%[1.reg])"
  389. samecc | | |
  390. ... | regconst2 ftolong |
  391. INDSTORE
  392. "setl\nmovfi %[2.reg],%[1.ind](%[1.reg])\nseti"
  393. samecc | | |
  394. ... | ADDR_LOCAL FLT_REG |
  395. INDSTORE
  396. "movfo %[2],%[1.ind](r5)"
  397. samecc | | |
  398. ... | ADDR_LOCAL ftolong |
  399. INDSTORE
  400. "setl\nmovfi %[2.reg],%[1.ind](r5)\nseti"
  401. samecc | | |
  402. ... | ADDR_EXTERNAL FLT_REG |
  403. INDSTORE
  404. "movfo %[2],%[1.ind]"
  405. samecc | | |
  406. ... | ADDR_EXTERNAL ftolong |
  407. INDSTORE
  408. "setl\nmovfi %[2.reg],%[1.ind]\nseti"
  409. samecc | | |
  410. ... | REG source2 source2 |
  411. INDSTORE
  412. move(%[2],{regdef2,%[1]})
  413. move(%[3],{regind2,%[1],"2"}) | | |
  414. ... | SCR_REG STACK |
  415. "mov (sp)+,(%[1])+"
  416. "mov (sp)+,(%[1])"
  417. erase(%[1]) | | | (4,2040)
  418. sti $1==8 | dadres2 DBL_REG |
  419. INDSTORE
  420. "movf %[2],*%[1]"
  421. samecc | | |
  422. ... | regconst2 DBL_REG |
  423. INDSTORE
  424. "movf %[2],%[1.ind](%[1.reg])"
  425. samecc | | |
  426. ... | ADDR_LOCAL DBL_REG |
  427. INDSTORE
  428. "movf %[2],%[1.ind](r5)"
  429. samecc | | |
  430. ... | ADDR_EXTERNAL DBL_REG |
  431. INDSTORE
  432. "movf %[2],%[1.ind]"
  433. samecc | | |
  434. ... | SCR_REG regdef8 |
  435. INDSTORE
  436. "mov (%[2.reg]),(%[1])+"
  437. "mov 2(%[2.reg]),(%[1])+"
  438. "mov 4(%[2.reg]),(%[1])+"
  439. "mov 6(%[2.reg]),(%[1])"
  440. erase(%[1]) | | |
  441. ... | SCR_REG regind8 |
  442. INDSTORE
  443. "mov %[2.ind](%[2.reg]),(%[1])+"
  444. "mov 2+%[2.ind](%[2.reg]),(%[1])+"
  445. "mov 4+%[2.ind](%[2.reg]),(%[1])+"
  446. "mov 6+%[2.ind](%[2.reg]),(%[1])"
  447. erase(%[1]) | | |
  448. ... | SCR_REG relative8 |
  449. INDSTORE
  450. allocate(REG={ADDR_EXTERNAL,%[2.ind]})
  451. "mov (%[a])+,(%[1])+"
  452. "mov (%[a])+,(%[1])+"
  453. "mov (%[a])+,(%[1])+"
  454. "mov (%[a]),(%[1])"
  455. erase(%[1]) erase(%[a]) | | |
  456. ... | SCR_REG |
  457. remove(all)
  458. "mov (sp)+,(%[1])+"
  459. "mov (sp)+,(%[1])+"
  460. "mov (sp)+,(%[1])+"
  461. "mov (sp)+,(%[1])"
  462. erase(%[1]) | | | (8,4080)
  463. sti | SCR_REG |
  464. remove(all)
  465. allocate(REG={CONST2,$1/2})
  466. "1:\tmov (sp)+,(%[1])+"
  467. "sob %[a],1b"
  468. erase(%[1]) erase(%[a]) | | | (8,1500+$1*825)
  469. lal sti $2>2 && $2<=8 | NC xsource2 | | %[1] | stl $1 lal $1+2 sti $2-2 |
  470. ... | | | {ADDR_LOCAL,$1} | sti $2 |
  471. sts $1==2 | |
  472. remove(all)
  473. "mov (sp)+,r0"
  474. "mov (sp)+,r1"
  475. "jsr pc,sto2~"
  476. erase(r01) | | |
  477. sdl | NC FLT_REG |
  478. remove(indordef)
  479. remove(locals, %[ind] <= $1+2 && %[ind]+%[size] > $1)
  480. move(%[1],{LOCAL4,$1,4}) | | |
  481. ... | NC ftolong |
  482. remove(indordef)
  483. remove(locals, %[ind] <= $1+2 && %[ind]+%[size] > $1)
  484. "setl\nmovfi %[1.reg],$1(r5)\nseti"
  485. samecc | | |
  486. ... | source2 source2 |
  487. remove(indordef)
  488. remove(locals, %[ind] <= $1+2 && %[ind]+%[size] > $1)
  489. move(%[1],{LOCAL2,$1,2})
  490. move(%[2],{LOCAL2,$1+2,2}) | | |
  491. sde | NC FLT_REG |
  492. remove(posextern)
  493. move(%[1],{relative4,$1}) | | |
  494. ... | NC ftolong |
  495. remove(posextern)
  496. "setl\nmovfi %[1.reg],$1\nseti"
  497. samecc | | |
  498. ... | source2 source2 |
  499. remove(posextern)
  500. move(%[1], {relative2, $1 })
  501. move(%[2], {relative2, $1+"+2" }) | | |
  502. sdf | NC regconst2 FLT_REG |
  503. INDSTORE
  504. move(%[2],{regind4,%[1.reg],tostring($1)+"+"+%[1.ind]}) | | |
  505. ... | NC regconst2 ftolong |
  506. INDSTORE
  507. "setl\nmovfi %[2.reg],$1+%[1.ind](%[1.reg])\nseti"
  508. samecc | | |
  509. ... | NC ADDR_EXTERNAL FLT_REG |
  510. INDSTORE
  511. move(%[2],{relative4,tostring($1)+"+"+%[1.ind]})| | |
  512. ... | NC ADDR_EXTERNAL ftolong |
  513. INDSTORE
  514. "setl\nmovfi %[2.reg],$1+%[1.ind]\nseti"
  515. samecc | | |
  516. ... | regconst2 source2 source2 |
  517. INDSTORE
  518. move(%[2],{regind2,%[1.reg],tostring($1)+"+"+%[1.ind]})
  519. move(%[3],{regind2,%[1.reg],tostring($1+2)+"+"+%[1.ind]}) | | |
  520. ... | ADDR_EXTERNAL source2 source2 |
  521. INDSTORE
  522. move(%[2],{relative2,tostring($1)+"+"+%[1.ind]})
  523. move(%[3],{relative2,tostring($1+2)+"+"+%[1.ind]}) | | |
  524. /****************************************************************
  525. * Group 3 : Integer arithmetic. *
  526. * *
  527. * Implemented (sometimes with the use of subroutines) : *
  528. * all 2 and 4 byte arithmetic. *
  529. ****************************************************************/
  530. adi $1==2 | NC SCR_REG CONST2 | | {regconst2,%[1],tostring(%[2.num])} | |
  531. ... | NC SCR_REG ADDR_EXTERNAL | | {regconst2,%[1],%[2.ind]} | |
  532. ... | NC SCR_REG ADDR_LOCAL |
  533. "add r5,%[1]" erase(%[1]) |
  534. {regconst2,%[1],tostring(%[2.ind])} | | (2,450)
  535. ... | NC REG ADDR_LOCAL |
  536. allocate(REG)
  537. "mov r5,%[a]"
  538. "add %[1],%[a]"
  539. erase(%[a]) | {regconst2,%[a],tostring(%[2.ind])} | | (4,900)
  540. ... | NC SCR_REG regconst2 |
  541. "add %[2.reg],%[1]" erase(%[1]) |
  542. {regconst2,%[1],%[2.ind]} | | (2,450)
  543. ... | NC CONST2+ADDR_EXTERNAL+ADDR_LOCAL+regconst2 SCR_REG |
  544. | %[1] %[2] | adi 2 |
  545. ... | NC source2-REG CONST2+ADDR_EXTERNAL+ADDR_LOCAL |
  546. allocate(%[1],REG=%[1]) | %[2] %[a] | adi 2 |
  547. ... | NC source1 CONST2+ADDR_EXTERNAL+ADDR_LOCAL |
  548. allocate(%[1],REG={CONST2, 0})
  549. "bisb %[1],%[a]" | %[2] %[a] | adi 2 |
  550. ... | NC regconst2 CONST2 | |
  551. {regconst2,%[1.reg],
  552. tostring(%[2.num])+"+"+%[1.ind]} | |
  553. ... | NC regconst2 ADDR_EXTERNAL | |
  554. {regconst2,%[1.reg],
  555. %[2.ind]+"+"+%[1.ind]} | |
  556. ... | NC regconst2 ADDR_LOCAL |
  557. "add r5,%[1.reg]" erase(%[1.reg]) |
  558. {regconst2,%[1.reg],
  559. tostring(%[2.ind])+"+"+%[1.ind]} | | (2,450)
  560. ... | NC regconst2 regconst2 |
  561. "add %[2.reg],%[1.reg]" erase(%[1.reg]) |
  562. {regconst2,%[1.reg],%[2.ind]+"+"+%[1.ind]} | | (2,450)
  563. ... | NC regconst2 noconst2 |
  564. "add %[2],%[1.reg]" erase(%[1.reg]) | %[1] | | (2,450)+%[2]
  565. ... | NC SCR_REG noconst2 |
  566. "add %[2],%[1]"
  567. setcc(%[1]) erase(%[1]) | %[1] | | (2,450)+%[2]
  568. ... | NC source2 regconst2 |
  569. "add %[1],%[2.reg]"
  570. erase(%[2.reg]) | %[2] | | (2,450)+%[1]
  571. ... | NC regconst2 source2 |
  572. "add %[2],%[1.reg]"
  573. erase(%[1.reg]) | %[1] | | (2,450)+%[2]
  574. ... | source2 SCR_REG |
  575. "add %[1],%[2]"
  576. setcc(%[2]) erase(%[2]) | %[2] | | (2,450)+%[1]
  577. ldc adi $2==4 && highw(1)==0 | SCR_REG SCR_REG |
  578. "add $$%(loww(1)%),%[2]"
  579. "adc %[1]"
  580. erase(%[1]) erase(%[2]) | %[2] %[1] | |
  581. ldc adi $2==4 | SCR_REG SCR_REG |
  582. "add $$%(loww(1)%),%[2]"
  583. "adc %[1]"
  584. "add $$%(highw(1)%),%[1]"
  585. erase(%[1]) erase(%[2]) | %[2] %[1] | |
  586. adi $1==4 | SCR_REG SCR_REG source2 source2 |
  587. "add %[4],%[2]"
  588. "adc %[1]"
  589. "add %[3],%[1]"
  590. setcc(%[1]) erase(%[1]) erase(%[2])
  591. | %[2] %[1] | | (6,1200)+%[4]+%[3]
  592. ... | SCR_REG SCR_REG source2 STACK |
  593. "add (sp)+,%[2]"
  594. "adc %[1]"
  595. "add %[3],%[1]"
  596. setcc(%[1]) erase(%[1]) erase(%[2])
  597. | %[2] %[1] | | (6,1900)+%[3]
  598. ... | SCR_REG SCR_REG STACK |
  599. "add (sp)+,%[1]"
  600. "add (sp)+,%[2]"
  601. "adc %[1]"
  602. setcc(%[1]) erase(%[1]) erase(%[2])
  603. | %[2] %[1] | | (6,2800)
  604. ... | source2 source2 SCR_REG SCR_REG |
  605. "add %[2],%[4]"
  606. "adc %[3]"
  607. "add %[1],%[3]"
  608. setcc(%[3]) erase(%[3]) erase(%[4])
  609. | %[4] %[3] | | (6,1200)+%[1]+%[2]
  610. #ifdef UNTESTED
  611. adi !defined($1)| source2 |
  612. remove(all)
  613. move(%[1],r0)
  614. "jsr pc,adi~" | | |
  615. #endif
  616. loc sbi $2==2 | | | | loc 0-$1 adi 2 |
  617. sbi $1==2 | source2 SCR_REG |
  618. "sub %[1],%[2]"
  619. setcc(%[2]) erase(%[2]) | %[2] | | (2,450)+%[1]
  620. ... | NC SCR_REG source2-REG |
  621. "sub %[2],%[1]"
  622. "neg %[1]"
  623. setcc(%[1]) erase(%[1]) | %[1] | | (4,750)+%[2]
  624. ldc sbi $2==4 && highw(1)==0 | SCR_REG SCR_REG |
  625. "sub $$%(loww(1)%),%[2]"
  626. "sbc %[1]"
  627. erase(%[1]) erase(%[2]) | %[2] %[1] | |
  628. ldc sbi $2==4 | SCR_REG SCR_REG |
  629. "sub $$%(loww(1)%),%[2]"
  630. "sbc %[1]"
  631. "sub $$%(highw(1)%),%[1]"
  632. erase(%[1]) erase(%[2]) | %[2] %[1] | |
  633. sbi $1==4 | source2-REG source2-REG SCR_REG SCR_REG |
  634. "sub %[2],%[4]"
  635. "sbc %[3]"
  636. "sub %[1],%[3]"
  637. setcc(%[3]) erase(%[3]) erase(%[4])
  638. | %[4] %[3] | | (6,1200)+%[1]+%[2]
  639. ... | source2 source2 STACK |
  640. "sub %[2],2(sp)"
  641. "sbc (sp)"
  642. "sub %[1],(sp)" | | | (10,2800)+%[1]+%[2]
  643. #ifdef UNTESTED
  644. sbi !defined($1)| source2 |
  645. remove(all)
  646. move(%[1],r0)
  647. "jsr pc,sbi~" | | |
  648. #endif
  649. mli $1==2 | SCR_ODD_REG source2 |
  650. "mul %[2],%[1]"
  651. setcc(%[1]) erase(%[1]) | %[1] | |(2,3300)+%[2]
  652. ... | source2 SCR_ODD_REG |
  653. "mul %[1],%[2]"
  654. setcc(%[2]) erase(%[2]) | %[2] | |(2,3300)+%[1]
  655. mli $1==4 | | remove(all)
  656. "jsr pc,mli4~"
  657. | r1 r0 | |
  658. #ifdef UNTESTED
  659. mli !defined($1)| source2 |
  660. remove(all)
  661. move(%[1],r0)
  662. "jsr pc,mli~" | | |
  663. #endif
  664. dvi $1==2 | source2 source2 |
  665. allocate(%[2],REG_PAIR)
  666. "mov %[2],%[a.2]"
  667. "sxt %[a.1]"
  668. "div %[1],%[a.1]" | %[a.1] | |
  669. ... | source2 source2 |
  670. INDSTORE
  671. "mov %[1],-(sp)"
  672. "mov %[2],r1"
  673. "sxt r0"
  674. "div (sp)+,r0" | r0 | |(100,10000)
  675. dvi $1==4 | | remove(all)
  676. "jsr pc,dvi4~" | r1 r0 | |
  677. #ifdef UNTESTED
  678. dvi !defined($1)| source2 |
  679. remove(all)
  680. move(%[1],r0)
  681. "jsr pc,dvi~" | | |
  682. #endif
  683. rmi $1==2 | source2 source2 |
  684. allocate(%[2],REG_PAIR)
  685. "mov %[2],%[a.2]"
  686. "sxt %[a.1]"
  687. "div %[1],%[a.1]" | %[a.2] | |
  688. ... | source2 source2 |
  689. INDSTORE
  690. "mov %[1],-(sp)"
  691. "mov %[2],r1"
  692. "sxt r0"
  693. "div (sp)+,r0" | r1 | |(100,10000)
  694. rmi $1==4 | | remove(all)
  695. "jsr pc,rmi4~" | r1 r0 | |
  696. #ifdef UNTESTED
  697. rmi !defined($1)| source2 |
  698. remove(all)
  699. move(%[1],r0)
  700. "jsr pc,rmi~" | | |
  701. #endif
  702. ngi $1==2 | SCR_REG |
  703. "neg %[1]"
  704. setcc(%[1]) erase(%[1]) | %[1] | | (2,750)
  705. ngi $1==4 | SCR_REG SCR_REG |
  706. "neg %[1]"
  707. "neg %[2]"
  708. "sbc %[1]"
  709. setcc(%[1]) erase(%[1]) erase(%[2])
  710. | %[2] %[1] | | (6,1800)
  711. #ifdef UNTESTED
  712. ngi !defined($1)| source2 |
  713. remove(all)
  714. move(%[1],r0)
  715. "jsr pc,ngi~" | | |
  716. #endif
  717. loc sli $1==1 && $2==2 | SCR_REG |
  718. "asl %[1]"
  719. setcc(%[1]) erase(%[1]) | %[1]| |
  720. sli $1==2 | source2 SCR_REG |
  721. "ash %[1],%[2]"
  722. setcc(%[2]) erase(%[2]) | %[2] | |
  723. sli $1==4 | source2 SCR_REG_PAIR |
  724. "ashc %[1],%[2]"
  725. setcc(%[2]) erase(%[2]) | %[2] | |
  726. #ifdef UNTESTED
  727. sli !defined($1)| source2 |
  728. remove(all)
  729. move(%[1],r0)
  730. "jsr pc,sli~" | | |
  731. #endif
  732. loc sri $1==1 && $2==2 | SCR_REG |
  733. "asr %[1]"
  734. setcc(%[1]) erase(%[1]) | %[1]| |
  735. loc sri $2==2 | SCR_REG |
  736. "ash $$%(0-$1%),%[1]"
  737. setcc(%[1]) erase(%[1]) | %[1]| |
  738. sri $1==2 | SCR_REG SCR_REG |
  739. "neg %[1]"
  740. "ash %[1], %[2]"
  741. setcc(%[2]) erase(%[1]) erase(%[2]) | %[2] | |
  742. loc sri $2==4 | SCR_REG_PAIR |
  743. "ashc $$%(0-$1%),%[1]"
  744. setcc(%[1]) erase(%[1]) | %[1] | |
  745. sri $1==4 | SCR_REG SCR_REG_PAIR |
  746. "neg %[1]"
  747. "ashc %[1],%[2]"
  748. setcc(%[2]) erase(%[1]) erase(%[2]) | %[2] | |
  749. #ifdef UNTESTED
  750. sri !defined($1)| source2 |
  751. remove(all)
  752. move(%[1],r0)
  753. "jsr pc,sri~" | | |
  754. #endif
  755. /************************************************
  756. * Group 4 : unsigned arithmetic *
  757. * *
  758. * adu = adi *
  759. * sbu = sbi *
  760. * slu = sli *
  761. * *
  762. * Supported : 2- and 4 byte arithmetic. *
  763. ************************************************/
  764. adu | | | | adi $1 |
  765. sbu | | | | sbi $1 |
  766. mlu $1==2 | | | | mli $1 |
  767. mlu $1==4 | | remove(all)
  768. "jsr pc,mlu4~" | r1 r0 | |
  769. #ifdef UNTESTED
  770. mlu !defined($1)| source2 |
  771. remove(all)
  772. move(%[1],r0)
  773. "jsr pc,mlu~" | | |
  774. #endif
  775. loc dvu $1>0 && $1<=32767 && $2==2 | source2 |
  776. allocate(%[1],REG_PAIR)
  777. move(%[1],%[a.2])
  778. "clr %[a.1]"
  779. "div $$$1,%[a.1]" | %[a.1] | |
  780. dvu $1==2 | | remove(all)
  781. "jsr pc,dvu2~" | r0 | |
  782. dvu $1==4 | | remove(all)
  783. "jsr pc,dvu4~" | r1 r0 | |
  784. #ifdef UNTESTED
  785. dvu !defined($1)| source2 |
  786. remove(all)
  787. move(%[1],r0)
  788. "jsr pc,dvu~" | | |
  789. #endif
  790. loc rmu $1>0 && $1<=32767 && $2==2 | source2 |
  791. allocate(%[1],REG_PAIR)
  792. move(%[1],%[a.2])
  793. "clr %[a.1]"
  794. "div $$$1,%[a.1]" | %[a.2] | |
  795. rmu $1==2 | | remove(all)
  796. "jsr pc,rmu2~" | r1 | |
  797. rmu $1==4 | | remove(all)
  798. "jsr pc,rmu4~" | r1 r0 | |
  799. #ifdef UNTESTED
  800. rmu !defined($1)| source2 |
  801. remove(all)
  802. move(%[1],r0)
  803. "jsr pc,rmu~" | | |
  804. #endif
  805. slu | | | | sli $1 |
  806. loc slu | | | | loc $1 sli $2 |
  807. sru $1==2 | SCR_REG xsource2 |
  808. allocate(%[2],REG_PAIR)
  809. move(%[2],%[a.2])
  810. move({CONST2,0},%[a.1])
  811. "neg %[1]"
  812. "ashc %[1],%[a]"
  813. erase(%[a]) | %[a.2] | |
  814. loc sru $2==2 | xsource2 |
  815. allocate(%[1],REG_PAIR)
  816. move(%[1],%[a.2])
  817. move({CONST2,0},%[a.1])
  818. "ashc $$%(0-$1%),%[a]"
  819. erase(%[a]) | %[a.2] | |
  820. sru $1==4 | | remove(all)
  821. move({CONST2,$1},r0)
  822. "jsr pc,sru~"
  823. erase(r0) | | |
  824. #ifdef UNTESTED
  825. sru !defined($1)| source2 |
  826. remove(all)
  827. move(%[1],r0)
  828. "jsr pc,sru~" | | |
  829. #endif
  830. /************************************************
  831. * Group 5 : Floating point arithmetic *
  832. * *
  833. * Supported : 4- and 8 byte arithmetic. *
  834. ************************************************/
  835. adf $1==4 | FLT_REG SCR_FLT_REG |
  836. "addf %[1],%[2]"
  837. samecc erase(%[2]) | %[2] | | (2,5000)+%[1]
  838. ... | SCR_FLT_REG FLT_REG |
  839. "addf %[2],%[1]"
  840. samecc erase(%[1]) | %[1] | | (2,5000)+%[2]
  841. adf $1==8 | double8 SCR_DBL_REG |
  842. "addf %[1],%[2]"
  843. samecc erase(%[2]) | %[2] | | (2,6000)+%[1]
  844. ... | SCR_DBL_REG double8 |
  845. "addf %[2],%[1]"
  846. samecc erase(%[1]) | %[1] | | (2,6000)+%[2]
  847. #ifdef UNTESTED
  848. adf !defined($1)| source2 |
  849. remove(ALL)
  850. move(%[1],r0)
  851. "jsr pc,adf~" | | |
  852. #endif
  853. sbf $1==4 | FLT_REG SCR_FLT_REG |
  854. "subf %[1],%[2]"
  855. samecc erase(%[2]) | %[2] | | (2,5000)+%[1]
  856. sbf $1==8 | double8 SCR_DBL_REG |
  857. "subf %[1],%[2]"
  858. samecc erase(%[2]) | %[2] | | (2,6000)+%[1]
  859. #ifdef UNTESTED
  860. sbf !defined($1)| source2 |
  861. remove(ALL)
  862. move(%[1],r0)
  863. "jsr pc,sbf~" | | |
  864. #endif
  865. mlf $1==4 | FLT_REG SCR_FLT_REG |
  866. "mulf %[1],%[2]"
  867. samecc erase(%[2]) | %[2] | | (2,7000)+%[1]
  868. ... | SCR_FLT_REG FLT_REG |
  869. "mulf %[2],%[1]"
  870. samecc erase(%[1]) | %[1] | | (2,7000)+%[2]
  871. mlf $1==8 | double8 SCR_DBL_REG |
  872. "mulf %[1],%[2]"
  873. samecc erase(%[2]) | %[2] | | (2,10000)+%[1]
  874. ... | SCR_DBL_REG double8 |
  875. "mulf %[2],%[1]"
  876. samecc erase(%[1]) | %[1] | | (2,10000)+%[2]
  877. #ifdef UNTESTED
  878. mlf !defined($1)| source2 |
  879. remove(ALL)
  880. move(%[1],r0)
  881. "jsr pc,mlf~" | | |
  882. #endif
  883. dvf $1==4 | FLT_REG SCR_FLT_REG |
  884. "divf %[1],%[2]"
  885. samecc erase(%[2]) | %[2] | | (2,8000)+%[1]
  886. dvf $1==8 | double8 SCR_DBL_REG |
  887. "divf %[1],%[2]"
  888. samecc erase(%[2]) | %[2] | | (2,12000)+%[1]
  889. #ifdef UNTESTED
  890. dvf !defined($1)| source2 |
  891. remove(ALL)
  892. move(%[1],r0)
  893. "jsr pc,dvf~" | | |
  894. #endif
  895. ngf $1==4 | SCR_FLT_REG |
  896. "negf %[1]"
  897. samecc erase(%[1]) | %[1] | |(2,2700)
  898. ngf $1==8 | SCR_DBL_REG |
  899. "negf %[1]"
  900. samecc erase(%[1]) | %[1] | |(2,2700)
  901. #ifdef UNTESTED
  902. ngf !defined($1)| source2 |
  903. remove(ALL)
  904. move(%[1],r0)
  905. "jsr pc,ngf~" | | |
  906. #endif
  907. fif $1==4 | longf4 FLT_REG |
  908. allocate(FLT_REG_PAIR)
  909. move(%[1],%[a.1])
  910. "modf %[2],%[a]"
  911. samecc erase(%[a.1]) | %[a.1] %[a.2] | | (2,7500)+%[2]
  912. fif $1==8 | double8 double8 |
  913. allocate(DBL_REG_PAIR)
  914. move(%[1],%[a.1])
  915. "modf %[2],%[a]"
  916. samecc erase(%[a.1]) | %[a.1] %[a.2] | | (2,15000)+%[2]
  917. #ifdef UNTESTED
  918. fif !defined($1)| source2 |
  919. remove(ALL)
  920. move(%[1],r0)
  921. "jsr pc,fif~" | | |
  922. #endif
  923. fef $1==4 | FLT_REG |
  924. allocate(REG)
  925. "movei %[1],%[a]"
  926. "movie $$0,%[1]"
  927. samecc
  928. erase(%[1]) |%[1] %[a] | | (4,5000)
  929. fef $1==8 | DBL_REG |
  930. allocate(REG)
  931. "movei %[1],%[a]"
  932. "movie $$0,%[1]"
  933. samecc
  934. erase(%[1]) |%[1] %[a] | | (4,5000)
  935. #ifdef UNTESTED
  936. fef !defined($1)| source2 |
  937. remove(ALL)
  938. move(%[1],r0)
  939. "jsr pc,fef~" | | |
  940. #endif
  941. /****************************************
  942. * Group 6 : pointer arithmetic. *
  943. * *
  944. * Pointers have size 2 bytes. *
  945. ****************************************/
  946. adp | SCR_REG | | {regconst2, %[1], tostring($1)} | |
  947. ... | NC regconst2 | | {regconst2, %[1.reg], tostring($1)+"+"+%[1.ind]} | |
  948. ... | NC ADDR_EXTERNAL | | {ADDR_EXTERNAL, tostring($1)+"+"+%[1.ind]} | |
  949. ... | NC ADDR_LOCAL | | {ADDR_LOCAL,%[1.ind]+$1} | |
  950. ads $1==2 | | | | adi $1 |
  951. sbs $1==2 | | | | sbi $1 |
  952. /****************************************
  953. * Group 7 : increment/decrement/zero *
  954. ****************************************/
  955. inc | SCR_REG |
  956. "inc %[1]"
  957. setcc(%[1]) erase(%[1]) | %[1] | |
  958. #ifdef REGVARS
  959. inl inreg($1)==2| | remove(regvar($1))
  960. "inc %(regvar($1)%)"
  961. erase(regvar($1)) | | |
  962. #endif
  963. inl | | remove(indordef)
  964. remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
  965. "inc $1(r5)"
  966. setcc({LOCAL2,$1,2}) | | |
  967. ldl ldc adi sdl $1==$4 && $3==4 && highw(2)==0 | |
  968. remove(indordef)
  969. remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
  970. "add $$%(loww(2)%),2+$1(r5)"
  971. "adc $1(r5)" | | |
  972. ldl ldc adi sdl $1==$4 && $3==4 | |
  973. remove(indordef)
  974. remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
  975. "add $$%(loww(2)%),2+$1(r5)"
  976. "adc $1(r5)"
  977. "add $$%(highw(2)%),$1(r5)" | | |
  978. ine | | remove(posextern)
  979. "inc $1"
  980. setcc({relative2,$1}) | | |
  981. lde ldc adi sde $1==$4 && $3==4 && highw(2)==0 | |
  982. remove(posextern)
  983. "add $$%(loww(2)%),2+$1"
  984. "adc $1" | | |
  985. lde ldc adi sde $1==$4 && $3==4 | |
  986. remove(posextern)
  987. "add $$%(loww(2)%),2+$1"
  988. "adc $1"
  989. "add $$%(highw(2)%),$1" | | |
  990. dec | SCR_REG |
  991. "dec %[1]"
  992. setcc(%[1]) erase(%[1]) | %[1] | |
  993. #ifdef REGVARS
  994. del inreg($1)==2| | remove(regvar($1))
  995. "dec %(regvar($1)%)"
  996. erase(regvar($1)) | | |
  997. #endif
  998. del | | remove(indordef)
  999. remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
  1000. "dec $1(r5)"
  1001. setcc({LOCAL2,$1,2}) | | |
  1002. dee | | remove(posextern)
  1003. "dec $1"
  1004. setcc({relative2,$1}) | | | (4,900)
  1005. #ifdef REGVARS
  1006. lol loc sbi stl $1==$4 && $3==2 && inreg($1)==2 | |
  1007. remove(regvar($1))
  1008. "sub $$$2,%(regvar($1)%)"
  1009. erase(regvar($1)) | | |
  1010. lol ngi stl $1==$3 && $2==2 && inreg($1)==2 | |
  1011. remove(regvar($1))
  1012. "neg %(regvar($1)%)"
  1013. erase(regvar($1)) | | |
  1014. lil ngi sil $1==$3 && $2==2 && inreg($1)==2 | |
  1015. INDSTORE
  1016. "neg *%(regvar($1)%)" | | |
  1017. lil inc sil $1==$3 && inreg($1)==2 | | INDSTORE
  1018. "inc *%(regvar($1)%)"
  1019. setcc({regdef2, regvar($1)}) | | |
  1020. lil dec sil $1==$3 && inreg($1)==2 | | INDSTORE
  1021. "dec *%(regvar($1)%)"
  1022. setcc({regdef2, regvar($1)}) | | |
  1023. lol adi stl $2==2 && $1==$3 && inreg($1)==2 | source2 |
  1024. remove(regvar($1))
  1025. "add %[1],%(regvar($1)%)"
  1026. erase(regvar($1)) | | |
  1027. lol lol adp stl loi $1==$2 && $2==$4 && inreg($1)==2 && $3==1 && $5==1 | |
  1028. allocate(REG={CONST2, 0})
  1029. remove(regvar($1))
  1030. "bisb (%(regvar($1)%))+,%[a]" | %[a] | |
  1031. lol lol adp stl loi $1==$2 && $2==$4 && inreg($1)==2 && $3==2 && $5==2 | |
  1032. allocate(REG)
  1033. remove(regvar($1))
  1034. "mov (%(regvar($1)%))+,%[a]" | %[a] | |
  1035. lol sti lol adp stl $1==$3 && $3==$5 && inreg($1)==2 && $2==1 && $4==1 | source1or2|
  1036. remove(regvar($1))
  1037. "movb %[1],(%(regvar($1)%))+" | | |
  1038. sil lol adp stl $1==$2 && $2==$4 && inreg($1)==2 && $3==2 | source2 |
  1039. remove(regvar($1))
  1040. "mov %[1],(%(regvar($1)%))+" | | |
  1041. lol lol adp stl $1==$2 && $2==$4 && inreg($1)==2 | |
  1042. allocate(REG=regvar($1)) | %[a]
  1043. | lol $2 adp $3 stl $2 |
  1044. lol lol adp stl $1==$2 && $2==$4 | |
  1045. allocate(REG={LOCAL2, $1, 2}) | %[a]
  1046. | lol $2 adp $3 stl $2 |
  1047. lol inl $1==$2 && inreg($1)==2 | |
  1048. allocate(REG=regvar($1)) | %[a]
  1049. | inl $2 |
  1050. lol inl $1==$2 | |
  1051. allocate(REG={LOCAL2, $1, 2}) | %[a]
  1052. | inl $2 |
  1053. lol del $1==$2 && inreg($1)==2 | |
  1054. allocate(REG=regvar($1)) | %[a]
  1055. | del $2 |
  1056. lol del $1==$2 | |
  1057. allocate(REG={LOCAL2, $1, 2}) | %[a]
  1058. | del $2 |
  1059. lol adp stl $1==$3 && $2==1 && inreg($1)==2 | |
  1060. remove(regvar($1))
  1061. "inc %(regvar($1)%)"
  1062. erase(regvar($1)) | | |
  1063. lol adp stl $1==$3 && $2==0-1 && inreg($1)==2 | |
  1064. remove(regvar($1))
  1065. "dec %(regvar($1)%)"
  1066. erase(regvar($1)) | | |
  1067. lol adp stl $1==$3 && inreg($1)==2 | |
  1068. remove(regvar($1))
  1069. "add $$$2,%(regvar($1)%)"
  1070. erase(regvar($1)) | | |
  1071. lil lil adp sil $2==$4 && inreg($1)==2 | |
  1072. allocate(REG={regdef2, regvar($1)})
  1073. | %[a] | lil $2 adp $3 sil $2 |
  1074. lil adp sil $1==$3 && $2==1 && inreg($1)==2 | |
  1075. INDSTORE
  1076. "inc *%(regvar($1)%)" | | |
  1077. lil adp sil $1==$3 && $2==0-1 && inreg($1)==2 | |
  1078. INDSTORE
  1079. "dec *%(regvar($1)%)" | | |
  1080. lil adp sil $1==$3 && inreg($1)==2 | |
  1081. INDSTORE
  1082. "add $$$2,*%(regvar($1)%)" | | |
  1083. lol lof inc lol stf $1==$4 && $2==$5 && inreg($1)==2 | |
  1084. INDSTORE
  1085. "inc $2(%(regvar($1)%))"
  1086. setcc({regind2, regvar($1), tostring($2)}) | | |
  1087. lol lof dec lol stf $1==$4 && $2==$5 && inreg($1)==2 | |
  1088. INDSTORE
  1089. "dec $2(%(regvar($1)%))"
  1090. setcc({regind2, regvar($1), tostring($2)}) | | |
  1091. lol lof adp lol stf $1==$4 && $2==$5 && inreg($1)==2 && $3==1 | |
  1092. INDSTORE
  1093. "inc $2(%(regvar($1)%))"
  1094. setcc({regind2, regvar($1), tostring($2)}) | | |
  1095. lol lof adp lol stf $1==$4 && $2==$5 && inreg($1)==2 && $3==0-1 | |
  1096. INDSTORE
  1097. "dec $2(%(regvar($1)%))"
  1098. setcc({regind2, regvar($1), tostring($2)}) | | |
  1099. lol lof adp lol stf $1==$4 && $2==$5 && inreg($1)==2 | |
  1100. INDSTORE
  1101. "add $3,$2(%(regvar($1)%))"
  1102. setcc({regind2, regvar($1), tostring($2)}) | | |
  1103. #endif
  1104. lol loc sbi stl $1==$4 && $3==2 | |
  1105. remove(indordef)
  1106. remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
  1107. "sub $$$2,$1(r5)"
  1108. setcc({LOCAL2,$1,2}) | | |
  1109. lol ngi stl $1==$3 && $2==2 | |
  1110. remove(indordef)
  1111. remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
  1112. "neg $1(r5)"
  1113. setcc({LOCAL2,$1,2}) | | |
  1114. lil ngi sil $1==$3 && $2==2 | | INDSTORE
  1115. "neg *$1(r5)" | | |
  1116. lil inc sil $1==$3 | | INDSTORE
  1117. "inc *$1(r5)"
  1118. setcc({reginddef2, lb, tostring($1)}) | | |
  1119. lil dec sil $1==$3 | | INDSTORE
  1120. "dec *$1(r5)"
  1121. setcc({reginddef2, lb, tostring($1)}) | | |
  1122. lol adi stl $2==2 && $1==$3 | source2 |
  1123. remove(indordef)
  1124. remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
  1125. "add %[1],$1(r5)"
  1126. setcc({LOCAL2,$1,2}) | | |
  1127. lol adp stl $1==$3 && $2==1 | |
  1128. remove(indordef)
  1129. remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
  1130. "inc $1(r5)"
  1131. setcc({LOCAL2,$1,2}) | | |
  1132. lol adp stl $1==$3 && $2==0-1 | |
  1133. remove(indordef)
  1134. remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
  1135. "dec $1(r5)"
  1136. setcc({LOCAL2,$1,2}) | | |
  1137. lol adp stl $1==$3 | |
  1138. remove(indordef)
  1139. remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
  1140. "add $$$2,$1(r5)"
  1141. setcc({LOCAL2,$1,2}) | | |
  1142. lil lil adp sil $2==$4 | |
  1143. allocate(REG={reginddef2, lb, tostring($1)})
  1144. | %[a] | lil $2 adp $3 sil $2 |
  1145. lil adp sil $1==$3 && $2==1 | |
  1146. INDSTORE
  1147. "inc *$1(r5)"
  1148. setcc({LOCAL2,$1,2}) | | |
  1149. lil adp sil $1==$3 && $2==0-1 | |
  1150. INDSTORE
  1151. "dec *$1(r5)"
  1152. setcc({LOCAL2,$1,2}) | | |
  1153. lil adp sil $1==$3 | |
  1154. INDSTORE
  1155. "add $$$2,*$1(r5)"
  1156. setcc({LOCAL2,$1,2}) | | |
  1157. loe adi ste $2==2 && $1==$3 | source2 |
  1158. remove(posextern)
  1159. "add %[1],$1"
  1160. setcc({relative2,$1}) | | |
  1161. loe adp ste $1==$3 && $2==1 | |
  1162. remove(posextern)
  1163. "inc $1"
  1164. setcc({relative2,$1}) | | |
  1165. loe adp ste $1==$3 && $2==0-1 | |
  1166. remove(posextern)
  1167. "dec $1"
  1168. setcc({relative2,$1}) | | |
  1169. loe adp ste $1==$3 | |
  1170. remove(posextern)
  1171. "add $$$2,$1"
  1172. setcc({relative2,$1}) | | |
  1173. loe loi loe loi adp loe sti $3==$6 && $2==2 && $4==2 && $7==2 | |
  1174. allocate(REG={reldef2, $1})
  1175. | %[a] | loe $3 loi $4 adp $5 loe $6 sti $7 |
  1176. loe loi adp loe sti $1==$4 && $2==2 && $5==2 && $3==1 | |
  1177. INDSTORE
  1178. "inc *$1"
  1179. setcc({reldef2,$1}) | | |
  1180. loe loi adp loe sti $1==$4 && $2==2 && $5==2 && $3==0-1 | |
  1181. INDSTORE
  1182. "dec *$1"
  1183. setcc({reldef2,$1}) | | |
  1184. loe loi adp loe sti $1==$4 && $2==2 && $5==2 | |
  1185. INDSTORE
  1186. "add $$$3,*$1"
  1187. setcc({reldef2,$1}) | | |
  1188. lol lof inc lol stf $1==$4 && $2==$5 | |
  1189. INDSTORE
  1190. allocate(REG={LOCAL2, $1, 2})
  1191. "inc $2(%[a])"
  1192. setcc({regind2, %[a], tostring($2)}) | | |
  1193. lol lof dec lol stf $1==$4 && $2==$5 | |
  1194. INDSTORE
  1195. allocate(REG={LOCAL2, $1, 2})
  1196. "dec $2(%[a])"
  1197. setcc({regind2, %[a], tostring($2)}) | | |
  1198. lol lof adp lol stf $1==$4 && $2==$5 && $3==1 | |
  1199. INDSTORE
  1200. allocate(REG={LOCAL2, $1, 2})
  1201. "inc $2(%[a])"
  1202. setcc({regind2, %[a], tostring($2)}) | | |
  1203. lol lof adp lol stf $1==$4 && $2==$5 && $3==0-1 | |
  1204. INDSTORE
  1205. allocate(REG={LOCAL2, $1, 2})
  1206. "dec $2(%[a])"
  1207. setcc({regind2, %[a], tostring($2)}) | | |
  1208. lol lof adp lol stf $1==$4 && $2==$5 | |
  1209. INDSTORE
  1210. allocate(REG={LOCAL2, $1, 2})
  1211. "add $3,$2(%[a])"
  1212. setcc({regind2, %[a], tostring($2)}) | | |
  1213. loe lof inc loe stf $1==$4 && $2==$5 | |
  1214. INDSTORE
  1215. allocate(REG={relative2, $1})
  1216. "inc $2(%[a])"
  1217. setcc({regind2, %[a], tostring($2)}) | | |
  1218. loe lof dec loe stf $1==$4 && $2==$5 | |
  1219. INDSTORE
  1220. allocate(REG={relative2, $1})
  1221. "dec $2(%[a])"
  1222. setcc({regind2, %[a], tostring($2)}) | | |
  1223. loe lof adp loe stf $1==$4 && $2==$5 && $3==1 | |
  1224. INDSTORE
  1225. allocate(REG={relative2, $1})
  1226. "inc $2(%[a])"
  1227. setcc({regind2, %[a], tostring($2)}) | | |
  1228. loe lof adp loe stf $1==$4 && $2==$5 && $3==0-1 | |
  1229. INDSTORE
  1230. allocate(REG={relative2, $1})
  1231. "dec $2(%[a])"
  1232. setcc({regind2, %[a], tostring($2)}) | | |
  1233. loe lof adp loe stf $1==$4 && $2==$5 | |
  1234. INDSTORE
  1235. allocate(REG={relative2, $1})
  1236. "add $3,$2(%[a])"
  1237. setcc({regind2, %[a], tostring($2)}) | | |
  1238. loe ine $1==$2 | |
  1239. allocate(REG={relative2, $1}) | %[a]
  1240. | ine $2 |
  1241. loe dee $1==$2 | |
  1242. allocate(REG={relative2, $1}) | %[a]
  1243. | dee $2 |
  1244. loe loe adp ste $1==$2 && $2==$4 | |
  1245. allocate(REG={relative2, $1}) | %[a]
  1246. | loe $2 adp $3 ste $2 |
  1247. #ifdef REGVARS
  1248. lol ior stl $2==2 && $1==$3 && inreg($1)==2 | source2 |
  1249. remove(regvar($1))
  1250. "bis %[1],%(regvar($1)%)"
  1251. erase(regvar($1)) | | |
  1252. #endif
  1253. lol ior stl $2==2 && $1==$3 | source2 |
  1254. remove(indordef)
  1255. remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
  1256. "bis %[1],$1(r5)"
  1257. setcc({LOCAL2,$1,2}) | | |
  1258. loe ior ste $2==2 && $1==$3 | source2 |
  1259. remove(posextern)
  1260. "bis %[1],$1"
  1261. setcc({relative2,$1}) | | |
  1262. #ifdef REGVARS
  1263. lol and stl $2==2 && $1==$3 && inreg($1)==2 | SCR_REG |
  1264. remove(regvar($1))
  1265. "com %[1]"
  1266. "bic %[1],%(regvar($1)%)"
  1267. erase(%[1])
  1268. erase(regvar($1)) | | |
  1269. #endif
  1270. lol and stl $2==2 && $1==$3 | SCR_REG |
  1271. remove(indordef)
  1272. remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
  1273. "com %[1]"
  1274. "bic %[1],$1(r5)"
  1275. erase(%[1])
  1276. setcc({LOCAL2,$1,2}) | | |
  1277. loe and ste $2==2 && $1==$3 | SCR_REG |
  1278. remove(posextern)
  1279. "com %[1]"
  1280. "bic %[1],$1"
  1281. erase(%[1])
  1282. setcc({relative2,$1}) | | |
  1283. #ifdef REGVARS
  1284. loc lol and stl $3==2 && $2==$4 && inreg($2)==2 | |
  1285. remove(regvar($2))
  1286. "bic $$%(~$1%),%(regvar($2)%)"
  1287. erase(regvar($2)) | | |
  1288. #endif
  1289. loc lol and stl $3==2 && $2==$4 | |
  1290. remove(indordef)
  1291. remove(locals, %[ind] <= $2 && %[ind]+%[size] > $2)
  1292. "bic $$%(~$1%),$2(r5)"
  1293. setcc({LOCAL2,$2,2}) | | |
  1294. loc loe and ste $3==2 && $2==$4 | |
  1295. remove(posextern)
  1296. "bic $$%(~$1%),$2"
  1297. setcc({relative2,$2}) | | |
  1298. #ifdef REGVARS
  1299. zrl inreg($1)==2| | remove(regvar($1))
  1300. "clr %(regvar($1)%)"
  1301. erase(regvar($1)) | | | (4,900)
  1302. #endif
  1303. zrl | | remove(indordef)
  1304. remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
  1305. "clr $1(r5)"
  1306. setcc({LOCAL2,$1,2}) | | | (4,900)
  1307. zre | | remove(posextern)
  1308. "clr $1"
  1309. setcc({relative2,$1}) | | | (4,900)
  1310. zrf $1==4 | | allocate(FLT_REG)
  1311. "clrf %[a]" | %[a] | | (2,2200)
  1312. zrf $1==8 | | allocate(DBL_REG)
  1313. "clrf %[a]" | %[a] | | (2,2400)
  1314. zrf !defined($1)| | | | zer |
  1315. zrf defined($1) | | | | zer $1 |
  1316. zer $1==2 | | | {CONST2, 0} | |
  1317. zer $1==4 | | | {CONST2,0} {CONST2,0} | |
  1318. zer $1==6 | | | {CONST2,0} {CONST2,0}
  1319. {CONST2,0} | |
  1320. zer $1==8 | | | {CONST2,0} {CONST2,0}
  1321. {CONST2, 0} {CONST2,0} | |
  1322. zer defined($1) | | remove(all)
  1323. move({CONST2,$1/2},r0)
  1324. "1:\tclr -(sp)"
  1325. "sob r0,1b"
  1326. erase(r0) | | |(8,1500+$1*375)
  1327. zer !defined($1)| SCR_REG |
  1328. remove(all)
  1329. "asr %[1]"
  1330. "1:\tclr -(sp)"
  1331. "sob %[1],1b"
  1332. erase(%[1]) | | |
  1333. /****************************************
  1334. * Group 8 : Convert instructions *
  1335. ****************************************/
  1336. #ifdef UNTESTED
  1337. cii | | remove(all)
  1338. "jsr pc,cii~" | | |
  1339. cfi | | | | cfu |
  1340. cfu | | remove(ALL)
  1341. "jsr pc,cfi~" | | |
  1342. cif | | remove(ALL)
  1343. "jsr pc,cif~" | | |
  1344. cuf | | remove(ALL)
  1345. "jsr pc,cuf~" | | |
  1346. cff | | remove(ALL)
  1347. "jsr pc,cff~" | | |
  1348. ciu | | | | cuu |
  1349. cui | | | | cuu |
  1350. cuu | | remove(all)
  1351. "jsr pc,cuu~" | | |
  1352. #endif
  1353. loc loc cii $1==1 && $2==2 | source1or2 |
  1354. allocate(%[1],REG)
  1355. "movb %[1],%[a]"
  1356. /* movb does sign extend if dest is register */
  1357. | %[a] | |
  1358. loc loc cii $1==1 && $2==4 | source1or2 |
  1359. allocate(%[1],REG,REG)
  1360. "movb %[1],%[a]"
  1361. "sxt %[b]"
  1362. | %[a] %[b] | |
  1363. loc loc cii $1==2 && $2==4 | source2 |
  1364. allocate(%[1],REG,REG)
  1365. move(%[1],%[a])
  1366. test(%[a])
  1367. "sxt %[b]"
  1368. | %[a] %[b] | |
  1369. loc loc loc cii $1>=0 && $2==2 && $3==4 | | | | loc $1 loc 0 |
  1370. loc loc loc cii $1< 0 && $2==2 && $3==4 | | | | loc $1 loc 0-1 |
  1371. loc loc cii $1==4 && $2==2 | source2 source2 | | %[2] | |
  1372. loc loc ciu | | | | loc $1 loc $2 cuu |
  1373. loc loc cui | | | | loc $1 loc $2 cuu |
  1374. loc loc cuu $1==2 && $2==4 | | | {CONST2,0} | |
  1375. loc loc cuu $1==4 && $2==2 | source2 | | | |
  1376. loc loc cuu $1==$2 | | | | |
  1377. loc loc cfi | | | | loc $1 loc $2 cfu |
  1378. loc loc cfu $1==4 && $2==2 | FLT_REG | | {ftoint,%[1]} | |
  1379. loc loc cfu $1==4 && $2==4 | FLT_REG | | {ftolong,%[1]} | |
  1380. loc loc cfu $1==8 && $2==2 | DBL_REG | | {ftoint,%[1]} | |
  1381. loc loc cfu $1==8 && $2==4 | DBL_REG | | {ftolong,%[1]} | |
  1382. loc loc cif $1==2 && $2==4 | source2 |
  1383. allocate(FLT_REG)
  1384. "movif %[1],%[a]"
  1385. samecc
  1386. | %[a] | |
  1387. loc loc cif $1==2 && $2==8 | source2 |
  1388. allocate(DBL_REG)
  1389. "movif %[1],%[a]"
  1390. samecc
  1391. | %[a] | |
  1392. loc loc cif $1==4 && $2==4 | NC long4-REG_PAIR |
  1393. allocate(FLT_REG)
  1394. "setl"
  1395. "movif %[1],%[a]"
  1396. "seti"
  1397. samecc
  1398. | %[a] | |
  1399. ... | | remove(all)
  1400. allocate(FLT_REG)
  1401. "setl"
  1402. "movif (sp)+,%[a]"
  1403. "seti"
  1404. samecc
  1405. | %[a] | |
  1406. loc loc cif $1==4 && $2==8 | NC long4-REG_PAIR |
  1407. allocate(DBL_REG)
  1408. "setl"
  1409. "movif %[1],%[a]"
  1410. "seti"
  1411. samecc
  1412. | %[a] | |
  1413. ... | | remove(all)
  1414. allocate(DBL_REG)
  1415. "setl"
  1416. "movif (sp)+,%[a]"
  1417. "seti"
  1418. samecc
  1419. | %[a] | |
  1420. loc loc cuf $1==2 && $2==4 | |
  1421. remove(all)
  1422. allocate(FLT_REG)
  1423. "clr -(sp)"
  1424. "setl"
  1425. "movif (sp)+,%[a]"
  1426. "seti"
  1427. | %[a] | |
  1428. loc loc cuf $1==2 && $2==8 | |
  1429. remove(all)
  1430. allocate(DBL_REG)
  1431. "clr -(sp)"
  1432. "setl"
  1433. "movif (sp)+,%[a]"
  1434. "seti"
  1435. | %[a] | |
  1436. loc loc cuf $1==4 && ($2==8 || $2==4) | | | | loc $1 loc $2 cif |
  1437. loc loc cff $1==4 && $2==8 | longf4 - FLT_REG |
  1438. allocate(DBL_REG)
  1439. "movof %[1],%[a]"
  1440. samecc
  1441. | %[a] | |
  1442. ... | FLT_REG |
  1443. allocate(DBL_REG)
  1444. move(%[1],%[a.1])
  1445. samecc | %[a] | |
  1446. loc loc cff $1==8 && $2==4 | DBL_REG | | %[1.1] | |
  1447. /****************************************
  1448. * Group 9 : Logical instructions *
  1449. ****************************************/
  1450. and $1==2 | CONST2 SCR_REG |
  1451. "bic $$%(~%[1.num]%),%[2]"
  1452. setcc(%[2])
  1453. erase(%[2]) | %[2] | | (4,750)
  1454. ... | SCR_REG CONST2 |
  1455. "bic $$%(~%[2.num]%),%[1]"
  1456. setcc(%[1])
  1457. erase(%[1]) | %[1] | | (4,750)
  1458. ... | SCR_REG SCR_REG |
  1459. "com %[1]"
  1460. "bic %[1],%[2]"
  1461. setcc(%[2])
  1462. erase(%[1]) erase(%[2]) | %[2] | | (4,600)
  1463. ldc and $2==4 && highw(1)==0 | source2 SCR_REG |
  1464. "bic $$%(~loww(1)%),%[2]"
  1465. erase(%[2]) | %[2] {CONST2, 0} | |
  1466. ldc and $2==4 && highw(1)==0-1 | source2 SCR_REG |
  1467. "bic $$%(~loww(1)%),%[2]"
  1468. erase(%[2]) | %[2] %[1] | |
  1469. ldc and $2==4 | SCR_REG SCR_REG |
  1470. "bic $$%(~highw(1)%),%[1]"
  1471. "bic $$%(~loww(1)%),%[2]"
  1472. erase(%[1]) erase(%[2]) | %[2] %[1] | |
  1473. and defined($1) | | remove(all)
  1474. move({CONST2,$1}, r0)
  1475. "jsr pc,and~"
  1476. erase(r0) | | |
  1477. and !defined($1)| source2 |
  1478. remove(all)
  1479. move(%[1],r0)
  1480. "jsr pc,and~"
  1481. erase(r0) | | |
  1482. ior $1==2 | SCR_REG source2 |
  1483. "bis %[2],%[1]"
  1484. setcc(%[1])
  1485. erase(%[1]) | %[1] | | (2,450)+%[2]
  1486. ... | source2 SCR_REG |
  1487. "bis %[1],%[2]"
  1488. setcc(%[2])
  1489. erase(%[2]) | %[2] | | (2,450)+%[1]
  1490. ldc ior $2==4 && highw(1)==0 | source2 SCR_REG |
  1491. "bis $$%(loww(1)%),%[2]"
  1492. erase(%[2]) | %[2] %[1] | |
  1493. ldc ior $2==4 && highw(1)==0-1 | source2 SCR_REG |
  1494. "bis $$%(loww(1)%),%[2]"
  1495. erase(%[2]) | {CONST2, 0-1} %[1] | |
  1496. ldc ior $2==4 | SCR_REG SCR_REG |
  1497. "bis $$%(highw(1)%),%[1]"
  1498. "bis $$%(loww(1)%),%[2]"
  1499. erase(%[1]) erase(%[2]) | %[2] %[1] | |
  1500. ior $1==8 | NC source2 source2 source2 source2 |
  1501. remove(all)
  1502. "bis %[1],(sp)"
  1503. "bis %[2],2(sp)"
  1504. "bis %[3],4(sp)"
  1505. "bis %[4],6(sp)" | | |
  1506. ... | | remove(all)
  1507. allocate(REG={CONST2,$1})
  1508. "add sp,%[a]"
  1509. "bis (sp)+,(%[a])+"
  1510. "bis (sp)+,(%[a])+"
  1511. "bis (sp)+,(%[a])+"
  1512. "bis (sp)+,(%[a])+"
  1513. erase(%[a]) | | |
  1514. ior defined($1) | | remove(all)
  1515. allocate(REG={CONST2,$1},REG={CONST2,$1/2})
  1516. "add sp,%[a]"
  1517. "1:\tbis (sp)+,(%[a])+"
  1518. "sob %[b],1b"
  1519. erase(%[a]) erase(%[b]) | | | (12,2100+$1*975)
  1520. ior !defined($1)| SCR_REG |
  1521. remove(all)
  1522. allocate(REG=%[1])
  1523. "asr %[1]"
  1524. "add sp,%[a]"
  1525. "1:\tbis (sp)+,(%[a])+"
  1526. "sob %[1],1b"
  1527. erase(%[1]) erase(%[a]) | | |
  1528. xor $1==2 | REG SCR_REG |
  1529. "xor %[1],%[2]"
  1530. setcc(%[2])
  1531. erase(%[2]) | %[2] | | (2,300)
  1532. ... | SCR_REG REG |
  1533. "xor %[2],%[1]"
  1534. setcc(%[1])
  1535. erase(%[1]) | %[1] | | (2,300)
  1536. xor defined($1) | | remove(all)
  1537. move({CONST2,$1},r0)
  1538. "jsr pc,xor~"
  1539. erase(r0) | | |
  1540. xor !defined($1)| source2 |
  1541. remove(all)
  1542. move(%[1],r0)
  1543. "jsr pc,xor~"
  1544. erase(r0) | | |
  1545. com $1==2 | SCR_REG |
  1546. "com %[1]"
  1547. setcc(%[1])
  1548. erase(%[1]) | %[1] | | (2,300)
  1549. com defined($1) | | remove(all)
  1550. allocate(REG={CONST2,$1/2},REG)
  1551. "mov sp,%[b]"
  1552. "1:\tcom (%[b])+"
  1553. "sob %[a],1b"
  1554. erase(%[a]) | | | (10,1800+$1*825)
  1555. com !defined($1)| SCR_REG |
  1556. remove(all)
  1557. allocate(REG)
  1558. "asr %[1]"
  1559. "mov sp,%[a]"
  1560. "1:\tcom (%[a])+"
  1561. "sob %[1],1b"
  1562. erase(%[1]) | | |
  1563. rol $1==2 | CONST2 SCR_ODD_REG |
  1564. "ashc $$%(%[1.num]-16%),%[2]"
  1565. setcc(%[2])
  1566. erase(%[2]) | %[2] | |
  1567. ... | SCR_REG SCR_ODD_REG |
  1568. "sub $$16,%[1]"
  1569. "ashc %[1],%[2]"
  1570. setcc(%[2])
  1571. erase(%[1]) erase(%[2]) | %[2] | |
  1572. rol defined($1) | | remove(all)
  1573. move({CONST2,$1},r0)
  1574. "jsr pc,rol~"
  1575. erase(r0) | | |
  1576. #ifdef UNTESTED
  1577. rol !defined($1)| source2 |
  1578. remove(all)
  1579. move(%[1],r0)
  1580. "jsr pc,rol~"
  1581. erase(r0) | | |
  1582. #endif
  1583. ror $1==2 | CONST2 SCR_ODD_REG |
  1584. "ashc $$%(0-%[1.num]%),%[2]"
  1585. setcc(%[2])
  1586. erase(%[2]) | %[2] | |
  1587. ... | SCR_REG SCR_ODD_REG |
  1588. "neg %[1]"
  1589. "ashc %[1],%[2]"
  1590. setcc(%[2]) erase(%[1]) erase(%[2]) | %[2] | |
  1591. ror defined($1) | | remove(all)
  1592. move({CONST2,$1},r0)
  1593. "jsr pc,ror~"
  1594. erase(r0) | | |
  1595. #ifdef UNTESTED
  1596. ror !defined($1)| source2 |
  1597. remove(all)
  1598. move(%[1],r0)
  1599. "jsr pc,ror~"
  1600. erase(r0) | | |
  1601. #endif
  1602. com and $1==2 && $2==2 | source2 SCR_REG |
  1603. "bic %[1],%[2]"
  1604. setcc(%[2])
  1605. erase(%[2]) | %[2] | | (2,450)+%[1]
  1606. com and $1==$2 | | remove(all)
  1607. allocate(REG={CONST2,$1},REG)
  1608. "mov sp,%[b]"
  1609. "add %[a],%[b]"
  1610. "asr %[a]"
  1611. "1:\tbic (sp)+,(%[b])+"
  1612. "sob %[a],1b"
  1613. erase(%[a]) | | | (12,2100+$1*975)
  1614. /********************************
  1615. * Group 10 : Set instructions *
  1616. ********************************/
  1617. inn $1==2 | SCR_REG SCR_REG |
  1618. "neg %[1]"
  1619. "ash %[1],%[2]"
  1620. "bic $$177776,%[2]"
  1621. erase(%[1]) erase(%[2]) | %[2] | |
  1622. loc inn $2==2 && $1==0 | SCR_REG |
  1623. "bic $$177776,%[1]"
  1624. erase(%[1]) | %[1] | |
  1625. loc inn $2==2 && $1==1 | SCR_REG |
  1626. "asr %[1]"
  1627. "bic $$177776,%[1]"
  1628. erase(%[1]) | %[1] | |
  1629. loc inn $2==2 | SCR_REG |
  1630. "ash $$%(0-$1%),%[1]"
  1631. "bic $$177776,%[1]"
  1632. erase(%[1]) | %[1] | |
  1633. loc inn zeq $2==2 | | | {CONST2, 1<<$1} | and 2 zeq $3 |
  1634. inn zeq $1==2 | source2 |
  1635. allocate(REG={CONST2,1})
  1636. "ash %[1],%[a]" | %[a] | and 2 zeq $2 |
  1637. loc inn zne $2==2 | | | {CONST2, 1<<$1} | and 2 zne $3 |
  1638. inn zne $1==2 | source2 |
  1639. allocate(REG={CONST2,1})
  1640. "ash %[1],%[a]" | %[a] | and 2 zne $2 |
  1641. inn defined($1) | source2 |
  1642. remove(all)
  1643. move(%[1],r1)
  1644. move({CONST2,$1},r0)
  1645. "jsr pc,inn~"
  1646. erase(r01) | r0 | |
  1647. #ifdef UNTESTED
  1648. inn !defined($1)| source2 |
  1649. remove(all)
  1650. move(%[1],r0)
  1651. "mov (sp)+,r1"
  1652. "jsr pc,inn~"
  1653. erase(r01) | r0 | |
  1654. #endif
  1655. set $1==2 | REG |
  1656. allocate(REG={CONST2,1})
  1657. "ash %[1],%[a]"
  1658. erase(%[a]) | %[a] | |
  1659. set defined($1) | source2 |
  1660. remove(all)
  1661. move(%[1],r1)
  1662. move({CONST2,$1},r0)
  1663. "jsr pc,set~"
  1664. erase(r01) | | |
  1665. set !defined($1)| source2 |
  1666. remove(all)
  1667. move(%[1],r0)
  1668. "mov (sp)+,r1"
  1669. "jsr pc,set~"
  1670. erase(r01) | | |
  1671. /****************************************
  1672. * Group 11 : Array instructions *
  1673. ****************************************/
  1674. lae aar $2==2 && rom(1,3)==1 && rom(1,1)==0 | | | | adi 2 |
  1675. lae aar $2==2 && rom(1,3)==1 && rom(1,1)!=0 | | | | adi 2 adp 0-rom(1,1) |
  1676. lae aar $2==2 && rom(1,3)==2 && rom(1,1)==0 | SCR_REG |
  1677. "asl %[1]"
  1678. erase(%[1]) | %[1] | adi 2 |
  1679. lae aar $2==2 && rom(1,3)==2 && rom(1,1)!=0 | SCR_REG |
  1680. "asl %[1]"
  1681. erase(%[1]) |
  1682. {regconst2,%[1],tostring((0-2)*rom(1,1))} |
  1683. adi 2 |
  1684. lae aar $2==2 && rom(1,3)==4 && rom(1,1)==0 | SCR_REG |
  1685. "ash $$2,%[1]"
  1686. erase(%[1]) |
  1687. %[1] |
  1688. adi 2 |
  1689. lae aar $2==2 && rom(1,3)==4 && rom(1,1)!=0 | SCR_REG |
  1690. "ash $$2,%[1]"
  1691. erase(%[1]) |
  1692. {regconst2,%[1],tostring((0-4)*rom(1,1))} |
  1693. adi 2 |
  1694. lae aar $2==2 && rom(1,3)==8 && rom(1,1)==0 | SCR_REG |
  1695. "ash $$3,%[1]"
  1696. erase(%[1]) |
  1697. %[1] |
  1698. adi 2 |
  1699. lae aar $2==2 && rom(1,3)==8 && rom(1,1)!=0 | SCR_REG |
  1700. "ash $$3,%[1]"
  1701. erase(%[1]) |
  1702. {regconst2,%[1],tostring((0-8)*rom(1,1))} |
  1703. adi 2 |
  1704. lae aar $2==2 && rom(1,1)==0 | SCR_ODD_REG |
  1705. "mul $$%(rom(1,3)%),%[1]"
  1706. erase(%[1]) |
  1707. %[1] |
  1708. adi 2 |
  1709. lae aar $2==2 && defined(rom(1,1)) | SCR_ODD_REG |
  1710. "mul $$%(rom(1,3)%),%[1]"
  1711. erase(%[1]) |
  1712. {regconst2,%[1],tostring((0-rom(1,3))*rom(1,1))} |
  1713. adi 2 |
  1714. aar $1==2 | |
  1715. remove(all)
  1716. "mov (sp)+,r0"
  1717. "mov (sp)+,r1"
  1718. "jsr pc,aar~"
  1719. erase(r01) | | |
  1720. #ifdef UNTESTED
  1721. aar !defined($1) | | remove(all)
  1722. "jsr pc,iaar~" | | |
  1723. #endif
  1724. lae sar defined(rom(1,3)) | | | | lae $1 aar $2 sti rom(1,3) |
  1725. lae lar defined(rom(1,3)) | | | | lae $1 aar $2 loi rom(1,3) |
  1726. sar $1==2 | |
  1727. remove(all)
  1728. "mov (sp)+,r0"
  1729. "mov (sp)+,r1"
  1730. "jsr pc,sar~"
  1731. erase(r01) | | |
  1732. #ifdef UNTESTED
  1733. sar !defined($1) | | remove(all)
  1734. "jsr pc,isar~" | | |
  1735. #endif
  1736. lar $1==2 | |
  1737. remove(all)
  1738. "mov (sp)+,r0"
  1739. "mov (sp)+,r1"
  1740. "jsr pc,lar~"
  1741. erase(r01) | | |
  1742. #ifdef UNTESTED
  1743. lar !defined($1) | | remove(all)
  1744. "jsr pc,ilar~" | | |
  1745. #endif
  1746. /****************************************
  1747. * group 12 : Compare instructions *
  1748. ****************************************/
  1749. cmi $1==2 | source2 SCR_REG |
  1750. "sub %[1],%[2]"
  1751. setcc(%[2])
  1752. erase(%[2]) | %[2] | |
  1753. ... | SCR_REG source2 |
  1754. "sub %[2],%[1]"
  1755. "neg %[1]"
  1756. setcc(%[1])
  1757. erase(%[1]) | %[1] | |
  1758. ldc cmi zlt highw(1)==0 && loww(1)==0 && $2==4 | source2 source2 |
  1759. | %[1] | zlt $3 |
  1760. ldc cmi zge highw(1)==0 && loww(1)==0 && $2==4 | source2 source2 |
  1761. | %[1] | zge $3 |
  1762. cmi $1==4 | | remove(all)
  1763. "jsr pc,cmi4~" | r0 | |
  1764. #ifdef UNTESTED
  1765. cmi !defined($1) | source2 |
  1766. remove(all)
  1767. move(%[1],r0)
  1768. "jsr pc,cmi~"
  1769. erase(r0) | r0 | |
  1770. #endif
  1771. cmf defined($1) | | remove(ALL)
  1772. move({CONST2,$1},r0)
  1773. "jsr pc,cmf~"
  1774. erase(r0) | r0 | |
  1775. #ifdef UNTESTED
  1776. cmf !defined($1)| source2 |
  1777. remove(ALL)
  1778. move(%[1],r0)
  1779. "jsr pc,cmf~"
  1780. erase(r0) | r0 | |
  1781. #endif
  1782. cmu $1==2 | | | | cmp |
  1783. cmu $1==4 | | remove(all)
  1784. "jsr pc,cmu4~" | r0 | |
  1785. cmu defined($1) | | remove(all)
  1786. move({CONST2,$1},r0)
  1787. "jsr pc,cmu~" | r0 | |
  1788. #ifdef UNTESTED
  1789. cmu !defined($1)| source2 |
  1790. remove(all)
  1791. move(%[1],r0)
  1792. "jsr pc,cmu~"
  1793. erase(r0) | r0 | |
  1794. #endif
  1795. cms $1==2 | | | | cmi $1 |
  1796. ldc cms zeq $2==4 && loww(1)==0 && highw(1)==0 | source2 SCR_REG |
  1797. remove(all)
  1798. "bis %[1],%[2]"
  1799. "jeq $3" | | |
  1800. ldc cms zne $2==4 && loww(1)==0 && highw(1)==0 | source2 SCR_REG |
  1801. remove(all)
  1802. "bis %[1],%[2]"
  1803. "jne $3" | | |
  1804. ldc cms zeq $2==4 | source2 source2 |
  1805. remove(all)
  1806. "cmp $$%(loww(1)%),%[2]"
  1807. "bne 1f"
  1808. "cmp $$%(highw(1)%),%[1]"
  1809. "jeq $3"
  1810. "1:" | | |
  1811. ldc cms zne $2==4 | source2 source2 |
  1812. remove(all)
  1813. "cmp $$%(loww(1)%),%[2]"
  1814. "jne $3"
  1815. "cmp $$%(highw(1)%),%[1]"
  1816. "jne $3" | | |
  1817. cms defined($1) | | remove(all)
  1818. move({CONST2,$1},r0)
  1819. "jsr pc,cms~"
  1820. erase(r0) | r0 | |
  1821. #ifdef UNTESTED
  1822. cms !defined($1)| source2 |
  1823. remove(all)
  1824. move(%[1],r0)
  1825. "jsr pc,cms~"
  1826. erase(r0) | r0 | |
  1827. #endif
  1828. cmp | source2 source2 |
  1829. allocate(REG = {CONST2,0})
  1830. "cmp %[1],%[2]"
  1831. "beq 2f"
  1832. "bhi 1f"
  1833. "inc %[a]"
  1834. "br 2f"
  1835. "1:\tdec %[a]\n2:"
  1836. setcc(%[a])
  1837. erase(%[a]) | %[a] | |
  1838. tlt and $2==2 | source2 SCR_REG |
  1839. test(%[1])
  1840. "blt 1f"
  1841. "clr %[2]\n1:"
  1842. erase(%[2]) | %[2] | |
  1843. tlt ior $2==2 | source2 SCR_REG |
  1844. test(%[1])
  1845. "bge 1f"
  1846. "bis $$1,%[2]\n1:"
  1847. erase(%[2]) | %[2] | |
  1848. tlt | source2 |
  1849. allocate(REG={CONST2,0})
  1850. test(%[1])
  1851. "bge 1f"
  1852. "inc %[a]\n1:"
  1853. erase(%[a]) | %[a] | |
  1854. tle and $2==2 | source2 SCR_REG |
  1855. test(%[1])
  1856. "ble 1f"
  1857. "clr %[2]\n1:"
  1858. erase(%[2]) | %[2] | |
  1859. tle ior $2==2 | source2 SCR_REG |
  1860. test(%[1])
  1861. "bgt 1f"
  1862. "bis $$1,%[2]\n1:"
  1863. erase(%[2]) | %[2] | |
  1864. tle | source2 |
  1865. allocate(REG={CONST2,0})
  1866. test(%[1])
  1867. "bgt 1f"
  1868. "inc %[a]\n1:"
  1869. erase(%[a]) | %[a] | |
  1870. teq and $2==2 | source1or2 SCR_REG |
  1871. test(%[1])
  1872. "beq 1f"
  1873. "clr %[2]\n1:"
  1874. erase(%[2]) | %[2] | |
  1875. teq ior $2==2 | source1or2 SCR_REG |
  1876. test(%[1])
  1877. "bne 1f"
  1878. "bis $$1,%[2]\n1:"
  1879. erase(%[2]) | %[2] | |
  1880. teq | source1or2 |
  1881. allocate(REG={CONST2,0})
  1882. test(%[1])
  1883. "bne 1f"
  1884. "inc %[a]\n1:"
  1885. erase(%[a]) | %[a] | |
  1886. tne and $2==2 | source1or2 SCR_REG |
  1887. test(%[1])
  1888. "bne 1f"
  1889. "clr %[2]\n1:"
  1890. erase(%[2]) | %[2] | |
  1891. tne ior $2==2 | source1or2 SCR_REG |
  1892. test(%[1])
  1893. "beq 1f"
  1894. "bis $$1,%[2]\n1:"
  1895. erase(%[2]) | %[2] | |
  1896. tne | source1or2 |
  1897. allocate(REG={CONST2,0})
  1898. test(%[1])
  1899. "beq 1f"
  1900. "inc %[a]\n1:"
  1901. erase(%[a]) | %[a] | |
  1902. tgt and $2==2 | source2 SCR_REG |
  1903. test(%[1])
  1904. "bgt 1f"
  1905. "clr %[2]\n1:"
  1906. erase(%[2]) | %[2] | |
  1907. tgt ior $2==2 | source2 SCR_REG |
  1908. test(%[1])
  1909. "ble 1f"
  1910. "bis $$1,%[2]\n1:"
  1911. erase(%[2]) | %[2] | |
  1912. tgt | source2 |
  1913. allocate(REG={CONST2,0})
  1914. test(%[1])
  1915. "ble 1f"
  1916. "inc %[a]\n1:"
  1917. erase(%[a]) | %[a] | |
  1918. tge and $2==2 | source2 SCR_REG |
  1919. test(%[1])
  1920. "bge 1f"
  1921. "clr %[2]\n1:"
  1922. erase(%[2]) | %[2] | |
  1923. tge ior $2==2 | source2 SCR_REG |
  1924. test(%[1])
  1925. "blt 1f"
  1926. "bis $$1,%[2]\n1:"
  1927. erase(%[2]) | %[2] | |
  1928. tge | source2 |
  1929. allocate(REG={CONST2,0})
  1930. test(%[1])
  1931. "blt 1f"
  1932. "inc %[a]\n1:"
  1933. erase(%[a]) | %[a] | |
  1934. and tne $1==2 | source2 source2 |
  1935. allocate(REG={CONST2,0})
  1936. "bit %[1],%[2]"
  1937. "beq 1f"
  1938. "inc %[a]\n1:"
  1939. erase(%[a]) | %[a] | |
  1940. and teq $1==2 | source2 source2 |
  1941. allocate(REG={CONST2,0})
  1942. "bit %[1],%[2]"
  1943. "bne 1f"
  1944. "inc %[a]\n1:"
  1945. erase(%[a]) | %[a] | |
  1946. cmi tlt and $1==2 && $3==2 | source2 source2 SCR_REG |
  1947. "cmp %[2],%[1]"
  1948. "blt 1f"
  1949. "clr %[3]\n1:"
  1950. erase(%[3]) | %[3] | |
  1951. cmi tlt ior $1==2 && $3==2 | source2 source2 SCR_REG |
  1952. "cmp %[2],%[1]"
  1953. "bge 1f"
  1954. "bis $$1,%[3]\n1:"
  1955. erase(%[3]) | %[3] | |
  1956. cmi tlt $1==2 | source2 source2 |
  1957. allocate(REG={CONST2,0})
  1958. "cmp %[2],%[1]"
  1959. "bge 1f"
  1960. "inc %[a]\n1:"
  1961. erase(%[a]) | %[a] | |
  1962. cmi tle and $1==2 && $3==2 | source2 source2 SCR_REG |
  1963. "cmp %[2],%[1]"
  1964. "ble 1f"
  1965. "clr %[3]\n1:"
  1966. erase(%[3]) | %[3] | |
  1967. cmi tle ior $1==2 && $3==2 | source2 source2 SCR_REG |
  1968. "cmp %[2],%[1]"
  1969. "bgt 1f"
  1970. "bis $$1,%[3]\n1:"
  1971. erase(%[3]) | %[3] | |
  1972. cmi tle $1==2 | source2 source2 |
  1973. allocate(REG={CONST2,0})
  1974. "cmp %[2],%[1]"
  1975. "bgt 1f"
  1976. "inc %[a]\n1:"
  1977. erase(%[a]) | %[a] | |
  1978. cmi teq and $1==2 && $3==2 | source2 source2 SCR_REG |
  1979. "cmp %[2],%[1]"
  1980. "beq 1f"
  1981. "clr %[3]\n1:"
  1982. erase(%[3]) | %[3] | |
  1983. cmi teq ior $1==2 && $3==2 | source2 source2 SCR_REG |
  1984. "cmp %[2],%[1]"
  1985. "bne 1f"
  1986. "bis $$1,%[3]\n1:"
  1987. erase(%[3]) | %[3] | |
  1988. cmi teq $1==2 | source2 source2 |
  1989. allocate(REG={CONST2,0})
  1990. "cmp %[2],%[1]"
  1991. "bne 1f"
  1992. "inc %[a]\n1:"
  1993. erase(%[a]) | %[a] | |
  1994. loc cmi teq and $1>=0 && $1<=127 && $2==2 && $4==2 | NC source1 SCR_REG |
  1995. "cmpb %[1],$$$1"
  1996. "beq 1f"
  1997. "clr %[2]\n1:"
  1998. erase(%[2]) | %[2] | |
  1999. ... | | | {CONST2, $1} | cmi 2 teq and 2 |
  2000. loc cmi teq ior $1>=0 && $1<=127 && $2==2 && $4==2 | NC source1 SCR_REG |
  2001. "cmpb %[1],$$$1"
  2002. "bne 1f"
  2003. "bis $$1,%[2]\n1:"
  2004. erase(%[2]) | %[2] | |
  2005. ... | | | {CONST2, $1} | cmi 2 teq ior 2 |
  2006. loc cmi teq $1>=0 && $1<=127 && $2==2 | NC source1 |
  2007. allocate(REG={CONST2,0})
  2008. "cmpb %[1],$$$1"
  2009. "bne 1f"
  2010. "inc %[a]\n1:"
  2011. erase(%[a]) | %[a] | |
  2012. ... | | | {CONST2, $1} | cmi 2 teq |
  2013. cmi tne and $1==2 && $3==2 | source2 source2 SCR_REG |
  2014. "cmp %[2],%[1]"
  2015. "bne 1f"
  2016. "clr %[3]\n1:"
  2017. erase(%[3]) | %[3] | |
  2018. cmi tne ior $1==2 && $3==2 | source2 source2 SCR_REG |
  2019. "cmp %[2],%[1]"
  2020. "beq 1f"
  2021. "bis $$1,%[3]\n1:"
  2022. erase(%[3]) | %[3] | |
  2023. cmi tne $1==2 | source2 source2 |
  2024. allocate(REG={CONST2,0})
  2025. "cmp %[2],%[1]"
  2026. "beq 1f"
  2027. "inc %[a]\n1:"
  2028. erase(%[a]) | %[a] | |
  2029. loc cmi tne and $1>=0 && $1<=127 && $2==2 && $4==2 | NC source1 SCR_REG |
  2030. "cmpb %[1],$$$1"
  2031. "bne 1f"
  2032. "clr %[2]\n1:"
  2033. erase(%[2]) | %[2] | |
  2034. ... | | | {CONST2, $1} | cmi 2 tne and 2 |
  2035. loc cmi tne ior $1>=0 && $1<=127 && $2==2 && $4==2 | NC source1 SCR_REG |
  2036. "cmpb %[1],$$$1"
  2037. "beq 1f"
  2038. "bis $$1,%[2]\n1:"
  2039. erase(%[2]) | %[2] | |
  2040. ... | | | {CONST2, $1} | cmi 2 tne ior 2 |
  2041. loc cmi tne $1>=0 && $1<=127 && $2==2 | NC source1 |
  2042. allocate(REG={CONST2,0})
  2043. "cmpb %[1],$$$1"
  2044. "beq 1f"
  2045. "inc %[a]\n1:"
  2046. erase(%[a]) | %[a] | |
  2047. ... | | | {CONST2, $1} | cmi 2 tne |
  2048. cmi tge and $1==2 && $3==2 | source2 source2 SCR_REG |
  2049. "cmp %[2],%[1]"
  2050. "bge 1f"
  2051. "clr %[3]\n1:"
  2052. erase(%[3]) | %[3] | |
  2053. cmi tge ior $1==2 && $3==2 | source2 source2 SCR_REG |
  2054. "cmp %[2],%[1]"
  2055. "blt 1f"
  2056. "bis $$1,%[3]\n1:"
  2057. erase(%[3]) | %[3] | |
  2058. cmi tge $1==2 | source2 source2 |
  2059. allocate(REG={CONST2,0})
  2060. "cmp %[2],%[1]"
  2061. "blt 1f"
  2062. "inc %[a]\n1:"
  2063. erase(%[a]) | %[a] | |
  2064. cmi tgt and $1==2 && $3==2 | source2 source2 SCR_REG |
  2065. "cmp %[2],%[1]"
  2066. "bgt 1f"
  2067. "clr %[3]\n1:"
  2068. erase(%[3]) | %[3] | |
  2069. cmi tgt ior $1==2 && $3==2 | source2 source2 SCR_REG |
  2070. "cmp %[2],%[1]"
  2071. "ble 1f"
  2072. "bis $$1,%[3]\n1:"
  2073. erase(%[3]) | %[3] | |
  2074. cmi tgt $1==2 | source2 source2 |
  2075. allocate(REG={CONST2,0})
  2076. "cmp %[2],%[1]"
  2077. "ble 1f"
  2078. "inc %[a]\n1:"
  2079. erase(%[a]) | %[a] | |
  2080. cmp tlt | source2 source2 |
  2081. allocate(REG={CONST2,0})
  2082. "cmp %[2],%[1]"
  2083. "bhis 1f"
  2084. "inc %[a]\n1:"
  2085. erase(%[a]) | %[a] | |
  2086. cmp tle | source2 source2 |
  2087. allocate(REG={CONST2,0})
  2088. "cmp %[2],%[1]"
  2089. "bhi 1f"
  2090. "inc %[a]\n1:"
  2091. erase(%[a]) | %[a] | |
  2092. cmp teq | source2 source2 |
  2093. allocate(REG={CONST2,0})
  2094. "cmp %[2],%[1]"
  2095. "bne 1f"
  2096. "inc %[a]\n1:"
  2097. erase(%[a]) | %[a] | |
  2098. cmp tne | source2 source2 |
  2099. allocate(REG={CONST2,0})
  2100. "cmp %[2],%[1]"
  2101. "beq 1f"
  2102. "inc %[a]\n1:"
  2103. erase(%[a]) | %[a] | |
  2104. cmp tge | source2 source2 |
  2105. allocate(REG={CONST2,0})
  2106. "cmp %[2],%[1]"
  2107. "blo 1f"
  2108. "inc %[a]\n1:"
  2109. erase(%[a]) | %[a] | |
  2110. cmp tgt | source2 source2 |
  2111. allocate(REG={CONST2,0})
  2112. "cmp %[2],%[1]"
  2113. "blos 1f"
  2114. "inc %[a]\n1:"
  2115. erase(%[a]) | %[a] | |
  2116. cmf tlt $1==4 | FLT_REG FLT_REG |
  2117. allocate(REG={CONST2,0})
  2118. "cmpf %[2],%[1]\ncfcc"
  2119. "bge 1f"
  2120. "inc %[a]\n1:"
  2121. erase(%[a]) | %[a] | |
  2122. cmf tle $1==4 | FLT_REG FLT_REG |
  2123. allocate(REG={CONST2,0})
  2124. "cmpf %[2],%[1]\ncfcc"
  2125. "bgt 1f"
  2126. "inc %[a]\n1:"
  2127. erase(%[a]) | %[a] | |
  2128. cmf teq $1==4 | FLT_REG FLT_REG |
  2129. allocate(REG={CONST2,0})
  2130. "cmpf %[2],%[1]\ncfcc"
  2131. "bne 1f"
  2132. "inc %[a]\n1:"
  2133. erase(%[a]) | %[a] | |
  2134. cmf tne $1==4 | FLT_REG FLT_REG |
  2135. allocate(REG={CONST2,0})
  2136. "cmpf %[2],%[1]\ncfcc"
  2137. "beq 1f"
  2138. "inc %[a]\n1:"
  2139. erase(%[a]) | %[a] | |
  2140. cmf tgt $1==4 | FLT_REG FLT_REG |
  2141. allocate(REG={CONST2,0})
  2142. "cmpf %[2],%[1]\ncfcc"
  2143. "ble 1f"
  2144. "inc %[a]\n1:"
  2145. erase(%[a]) | %[a] | |
  2146. cmf tge $1==4 | FLT_REG FLT_REG |
  2147. allocate(REG={CONST2,0})
  2148. "cmpf %[2],%[1]\ncfcc"
  2149. "blt 1f"
  2150. "inc %[a]\n1:"
  2151. erase(%[a]) | %[a] | |
  2152. cmf tlt $1==8 | DBL_REG double8 |
  2153. allocate(REG={CONST2,0})
  2154. "cmpf %[2],%[1]\ncfcc"
  2155. "bge 1f"
  2156. "inc %[a]\n1:"
  2157. erase(%[a]) | %[a] | |
  2158. ... | double8 DBL_REG |
  2159. allocate(REG={CONST2,0})
  2160. "cmpf %[1],%[2]\ncfcc"
  2161. "ble 1f"
  2162. "inc %[a]\n1:"
  2163. erase(%[a]) | %[a] | |
  2164. cmf tle $1==8 | DBL_REG double8 |
  2165. allocate(REG={CONST2,0})
  2166. "cmpf %[2],%[1]\ncfcc"
  2167. "bgt 1f"
  2168. "inc %[a]\n1:"
  2169. erase(%[a]) | %[a] | |
  2170. ... | double8 DBL_REG |
  2171. allocate(REG={CONST2,0})
  2172. "cmpf %[1],%[2]\ncfcc"
  2173. "blt 1f"
  2174. "inc %[a]\n1:"
  2175. erase(%[a]) | %[a] | |
  2176. cmf teq $1==8 | DBL_REG double8 |
  2177. allocate(REG={CONST2,0})
  2178. "cmpf %[2],%[1]\ncfcc"
  2179. "bne 1f"
  2180. "inc %[a]\n1:"
  2181. erase(%[a]) | %[a] | |
  2182. ... | double8 DBL_REG |
  2183. allocate(REG={CONST2,0})
  2184. "cmpf %[1],%[2]\ncfcc"
  2185. "bne 1f"
  2186. "inc %[a]\n1:"
  2187. erase(%[a]) | %[a] | |
  2188. cmf tne $1==8 | DBL_REG double8 |
  2189. allocate(REG={CONST2,0})
  2190. "cmpf %[2],%[1]\ncfcc"
  2191. "beq 1f"
  2192. "inc %[a]\n1:"
  2193. erase(%[a]) | %[a] | |
  2194. ... | double8 DBL_REG |
  2195. allocate(REG={CONST2,0})
  2196. "cmpf %[1],%[2]\ncfcc"
  2197. "beq 1f"
  2198. "inc %[a]\n1:"
  2199. erase(%[a]) | %[a] | |
  2200. cmf tgt $1==8 | DBL_REG double8 |
  2201. allocate(REG={CONST2,0})
  2202. "cmpf %[2],%[1]\ncfcc"
  2203. "ble 1f"
  2204. "inc %[a]\n1:"
  2205. erase(%[a]) | %[a] | |
  2206. ... | double8 DBL_REG |
  2207. allocate(REG={CONST2,0})
  2208. "cmpf %[1],%[2]\ncfcc"
  2209. "bge 1f"
  2210. "inc %[a]\n1:"
  2211. erase(%[a]) | %[a] | |
  2212. cmf tge $1==8 | DBL_REG double8 |
  2213. allocate(REG={CONST2,0})
  2214. "cmpf %[2],%[1]\ncfcc"
  2215. "blt 1f"
  2216. "inc %[a]\n1:"
  2217. erase(%[a]) | %[a] | |
  2218. ... | double8 DBL_REG |
  2219. allocate(REG={CONST2,0})
  2220. "cmpf %[1],%[2]\ncfcc"
  2221. "bgt 1f"
  2222. "inc %[a]\n1:"
  2223. erase(%[a]) | %[a] | |
  2224. /****************************************
  2225. * Group 13 : Branch instructions *
  2226. ****************************************/
  2227. bra | | remove(all)
  2228. "jbr $1"
  2229. samecc | | |
  2230. blt | source2 source2 |
  2231. remove(all)
  2232. "cmp %[2],%[1]"
  2233. "jlt $1" | | |
  2234. ble | source2 source2 |
  2235. remove(all)
  2236. "cmp %[2],%[1]"
  2237. "jle $1" | | |
  2238. beq | NC source1 source1 |
  2239. remove(all)
  2240. "cmpb %[2],%[1]"
  2241. "jeq $1" | | |
  2242. ... | source2 source2 |
  2243. remove(all)
  2244. "cmp %[2],%[1]"
  2245. "jeq $1" | | |
  2246. bne | NC source1 source1 |
  2247. remove(all)
  2248. "cmpb %[2],%[1]"
  2249. "jne $1" | | |
  2250. ... | source2 source2 |
  2251. remove(all)
  2252. "cmp %[2],%[1]"
  2253. "jne $1" | | |
  2254. bge | source2 source2 |
  2255. remove(all)
  2256. "cmp %[2],%[1]"
  2257. "jge $1" | | |
  2258. bgt | source2 source2 |
  2259. remove(all)
  2260. "cmp %[2],%[1]"
  2261. "jgt $1" | | |
  2262. loc beq $1>=0 && $1<=127 | NC source1 |
  2263. remove(all)
  2264. "cmpb %[1],$$$1"
  2265. "jeq $2" | | |
  2266. ... | | | {CONST2, $1} | beq $2 |
  2267. loc bne $1>=0 && $1<=127 | NC source1 |
  2268. remove(all)
  2269. "cmpb %[1],$$$1"
  2270. "jne $2" | | |
  2271. ... | | | {CONST2, $1} | bne $2 |
  2272. zlt | source2 |
  2273. remove(all)
  2274. test(%[1])
  2275. "jlt $1"
  2276. samecc | | |
  2277. zle | source2 |
  2278. remove(all)
  2279. test(%[1])
  2280. "jle $1"
  2281. samecc | | |
  2282. zeq | source1or2 |
  2283. remove(all)
  2284. test(%[1])
  2285. "jeq $1"
  2286. samecc | | |
  2287. zne | source1or2 |
  2288. remove(all)
  2289. test(%[1])
  2290. "jne $1"
  2291. samecc | | |
  2292. zge | source2 |
  2293. remove(all)
  2294. test(%[1])
  2295. "jge $1"
  2296. samecc | | |
  2297. zgt | source2 |
  2298. remove(all)
  2299. test(%[1])
  2300. "jgt $1"
  2301. samecc | | |
  2302. cmp zlt | source2 source2 |
  2303. remove(all)
  2304. "cmp %[2],%[1]"
  2305. "jlo $2" | | |
  2306. cmp zle | source2 source2 |
  2307. remove(all)
  2308. "cmp %[2],%[1]"
  2309. "jlos $2" | | |
  2310. cmp zeq | source2 source2 |
  2311. remove(all)
  2312. "cmp %[2],%[1]"
  2313. "jeq $2" | | |
  2314. cmp zne | source2 source2 |
  2315. remove(all)
  2316. "cmp %[2],%[1]"
  2317. "jne $2" | | |
  2318. cmp zgt | source2 source2 |
  2319. remove(all)
  2320. "cmp %[2],%[1]"
  2321. "jhi $2" | | |
  2322. cmp zge | source2 source2 |
  2323. remove(all)
  2324. "cmp %[2],%[1]"
  2325. "jhis $2" | | |
  2326. cmf zlt $1==4 | FLT_REG FLT_REG |
  2327. remove(all)
  2328. "cmpf %[2],%[1]\ncfcc"
  2329. "jlt $2" | | |
  2330. cmf zle $1==4 | FLT_REG FLT_REG |
  2331. remove(all)
  2332. "cmpf %[2],%[1]\ncfcc"
  2333. "jle $2" | | |
  2334. cmf zeq $1==4 | FLT_REG FLT_REG |
  2335. remove(all)
  2336. "cmpf %[2],%[1]\ncfcc"
  2337. "jeq $2" | | |
  2338. cmf zne $1==4 | FLT_REG FLT_REG |
  2339. remove(all)
  2340. "cmpf %[2],%[1]\ncfcc"
  2341. "jne $2" | | |
  2342. cmf zgt $1==4 | FLT_REG FLT_REG |
  2343. remove(all)
  2344. "cmpf %[2],%[1]\ncfcc"
  2345. "jgt $2" | | |
  2346. cmf zge $1==4 | FLT_REG FLT_REG |
  2347. remove(all)
  2348. "cmpf %[2],%[1]\ncfcc"
  2349. "jge $2" | | |
  2350. cmf zlt $1==8 | DBL_REG double8 |
  2351. remove(all)
  2352. "cmpf %[2],%[1]\ncfcc"
  2353. "jlt $2" | | |
  2354. ... | double8 DBL_REG |
  2355. remove(all)
  2356. "cmpf %[1],%[2]\ncfcc"
  2357. "jgt $2" | | |
  2358. cmf zle $1==8 | DBL_REG double8 |
  2359. remove(all)
  2360. "cmpf %[2],%[1]\ncfcc"
  2361. "jle $2" | | |
  2362. ... | double8 DBL_REG |
  2363. remove(all)
  2364. "cmpf %[1],%[2]\ncfcc"
  2365. "jge $2" | | |
  2366. cmf zeq $1==8 | DBL_REG double8 |
  2367. remove(all)
  2368. "cmpf %[2],%[1]\ncfcc"
  2369. "jeq $2" | | |
  2370. ... | double8 DBL_REG |
  2371. remove(all)
  2372. "cmpf %[1],%[2]\ncfcc"
  2373. "jeq $2" | | |
  2374. cmf zne $1==8 | DBL_REG double8 |
  2375. remove(all)
  2376. "cmpf %[2],%[1]\ncfcc"
  2377. "jne $2" | | |
  2378. ... | double8 DBL_REG |
  2379. remove(all)
  2380. "cmpf %[1],%[2]\ncfcc"
  2381. "jne $2" | | |
  2382. cmf zgt $1==8 | DBL_REG double8 |
  2383. remove(all)
  2384. "cmpf %[2],%[1]\ncfcc"
  2385. "jgt $2" | | |
  2386. ... | double8 DBL_REG |
  2387. remove(all)
  2388. "cmpf %[1],%[2]\ncfcc"
  2389. "jlt $2" | | |
  2390. cmf zge $1==8 | DBL_REG double8 |
  2391. remove(all)
  2392. "cmpf %[2],%[1]\ncfcc"
  2393. "jge $2" | | |
  2394. ... | double8 DBL_REG |
  2395. remove(all)
  2396. "cmpf %[1],%[2]\ncfcc"
  2397. "jle $2" | | |
  2398. and zeq $1==2 | source1 source1or2 |
  2399. remove(all)
  2400. "bitb %[1],%[2]"
  2401. "jeq $2" | | |
  2402. ... | source1or2 source1 |
  2403. remove(all)
  2404. "bitb %[1],%[2]"
  2405. "jeq $2" | | |
  2406. ... | source2 source2 |
  2407. remove(all)
  2408. "bit %[1],%[2]"
  2409. "jeq $2" | | |
  2410. and zne $1==2 | source1 source1or2 |
  2411. remove(all)
  2412. "bitb %[1],%[2]"
  2413. "jne $2" | | |
  2414. ... | source1or2 source1 |
  2415. remove(all)
  2416. "bitb %[1],%[2]"
  2417. "jne $2" | | |
  2418. ... | source2 source2 |
  2419. remove(all)
  2420. "bit %[1],%[2]"
  2421. "jne $2" | | |
  2422. /************************************************
  2423. * group 14 : Procedure call instructions *
  2424. ************************************************/
  2425. cal | | remove(ALL)
  2426. "jsr pc,$1" | | |
  2427. cai | REG | remove(ALL)
  2428. "jsr pc,(%[1])" | | |
  2429. lfr $1==2 | | | r0 | |
  2430. lfr $1==4 | | | r1 r0 | |
  2431. lfr $1==8 | | | {relative8,"retar"} | |
  2432. lfr | | remove(all)
  2433. move({CONST2,$1},r0)
  2434. "jsr pc,lfr~"
  2435. erase(r0) | | |
  2436. lfr ret $1==$2 | | | | ret 0 |
  2437. #ifndef REGVARS
  2438. asp lfr ret $2==$3 | | | | ret 0 |
  2439. asp ret $2==0 | | | | ret 0 |
  2440. #endif
  2441. ret $1==0 | | remove(all)
  2442. #ifdef REGVARS
  2443. return | | |
  2444. #else
  2445. "mov r5,sp\nmov (sp)+,r5\nrts pc" | | |
  2446. #endif
  2447. ret $1==2 | source2 |
  2448. remove(all)
  2449. move(%[1],r0)
  2450. #ifdef REGVARS
  2451. return | | |
  2452. #else
  2453. "mov r5,sp\nmov (sp)+,r5\nrts pc" | | |
  2454. #endif
  2455. ret $1==4 | |
  2456. remove(all)
  2457. "mov (sp)+,r0"
  2458. "mov (sp)+,r1"
  2459. #ifdef REGVARS
  2460. return | | |
  2461. #else
  2462. "mov r5,sp\nmov (sp)+,r5\nrts pc" | | |
  2463. #endif
  2464. ret $1==8 | | | {ADDR_EXTERNAL, "retar"} | sti 8 ret 0 |
  2465. ret | | remove(all)
  2466. move({CONST2,$1},r0)
  2467. "jmp ret~" | | |
  2468. /************************************************
  2469. * Group 15 : Miscellaneous instructions *
  2470. ************************************************/
  2471. asp $1==2 | NC xsource2 | | | |
  2472. ... | | remove(all)
  2473. "tst (sp)+" | | |
  2474. asp $1==4 | | remove(all)
  2475. "cmp (sp)+,(sp)+" | | |
  2476. asp $1==0-2 | | remove(all)
  2477. "tst -(sp)" | | |
  2478. asp | | remove(all)
  2479. "add $$$1,sp" | | |
  2480. ass $1==2 | | remove(all)
  2481. "add (sp)+,sp" | | |
  2482. #ifdef UNTESTED
  2483. ass !defined($1)| source2 |
  2484. remove(all)
  2485. "cmp %[1],$$2"
  2486. "beq 1f;jmp unknown~;1:"
  2487. "add (sp)+,sp" | | |
  2488. #endif
  2489. blm $1==4 | SCR_REG SCR_REG |
  2490. "mov (%[2])+,(%[1])+"
  2491. "mov (%[2]),(%[1])"
  2492. erase(%[1]) erase(%[2]) | | |
  2493. blm $1==6 | SCR_REG SCR_REG |
  2494. "mov (%[2])+,(%[1])+"
  2495. "mov (%[2])+,(%[1])+"
  2496. "mov (%[2]),(%[1])"
  2497. erase(%[1]) erase(%[2]) | | |
  2498. blm $1==8 | SCR_REG SCR_REG |
  2499. "mov (%[2])+,(%[1])+"
  2500. "mov (%[2])+,(%[1])+"
  2501. "mov (%[2])+,(%[1])+"
  2502. "mov (%[2]),(%[1])"
  2503. erase(%[1]) erase(%[2]) | | |
  2504. blm | SCR_REG SCR_REG |
  2505. allocate(REG={CONST2,$1/2})
  2506. "1:mov (%[2])+,(%[1])+\nsob %[a],1b"
  2507. erase(%[1]) erase (%[2]) erase(%[a]) | | |
  2508. bls $1==2 | SCR_REG SCR_REG SCR_REG |
  2509. "asr %[1]\nbeq 2f"
  2510. "1:mov (%[3])+,(%[2])+\nsob %[1],1b\n2:"
  2511. erase(%[1]) erase (%[2]) erase(%[3]) | | |
  2512. #ifdef UNTESTED
  2513. bls !defined($1)| source2 SCR_REG SCR_REG SCR_REG |
  2514. remove(all)
  2515. "cmp %[1],$$2"
  2516. "beq 1f;jmp unknown~;1:"
  2517. "asr %[2]\nbeq 2f"
  2518. "1:mov (%[4])+,(%[3])+\nsob %[2],1b\n2:"
  2519. erase(%[2]) erase (%[3]) erase(%[4]) | | |
  2520. #endif
  2521. lae csa $2==2 | source2 |
  2522. remove(all)
  2523. move(%[1],r1)
  2524. move({ADDR_EXTERNAL,$1},r0)
  2525. "jmp csa~" | | |
  2526. csa $1==2 | |
  2527. remove(all)
  2528. "mov (sp)+,r0"
  2529. "mov (sp)+,r1"
  2530. "jmp csa~" | | |
  2531. #ifdef UNTESTED
  2532. csa !defined($1)| source2 |
  2533. remove(all)
  2534. "cmp %[1],$$2"
  2535. "beq 1f;jmp unknown~;1:"
  2536. "mov (sp)+,r0"
  2537. "mov (sp)+,r1"
  2538. "jmp csa~" | | |
  2539. #endif
  2540. lae csb $2==2 | NC source2 |
  2541. remove(all)
  2542. move(%[1],r1)
  2543. move({ADDR_EXTERNAL,$1},r0)
  2544. "jmp csb~" | | |
  2545. ... | |
  2546. remove(all)
  2547. move({ADDR_EXTERNAL,$1},r0)
  2548. "mov (sp)+,r1"
  2549. "jmp csb~" | | |
  2550. csb $1==2 | |
  2551. remove(all)
  2552. "mov (sp)+,r0"
  2553. "mov (sp)+,r1"
  2554. "jmp csb~" | | |
  2555. #ifdef UNTESTED
  2556. csb !defined($1)| source2 |
  2557. remove(all)
  2558. "cmp %[1],$$2"
  2559. "beq 1f;jmp unknown~;1:"
  2560. "mov (sp)+,r0"
  2561. "mov (sp)+,r1"
  2562. "jmp csb~" | | |
  2563. #endif
  2564. dup $1==2 | REG | | %[1] %[1] | |
  2565. dup $1==4 | NC longf4 | | %[1] %[1] | |
  2566. ... | source2 source2 | | %[2] %[1] %[2] %[1] | |
  2567. dup $1==8 | NC double8| | %[1] %[1] | |
  2568. ... | | remove(all)
  2569. move({CONST2, $1}, r0)
  2570. "jsr pc,dup~"
  2571. erase(r01) | | |
  2572. dup | | remove(all)
  2573. move({CONST2, $1}, r0)
  2574. "jsr pc,dup~"
  2575. erase(r01) | | |
  2576. dus $1==2 | source2 |
  2577. remove(all)
  2578. move(%[1],r0)
  2579. "jsr pc,dup~"
  2580. erase(r01) | | |
  2581. #ifdef UNTESTED
  2582. dus !defined($1)| source2 |
  2583. remove(all)
  2584. "cmp %[1],$$2"
  2585. "beq 1f;jmp unknown~;1:"
  2586. "mov (sp)+,r0"
  2587. "jsr pc,dup~"
  2588. erase(r01) | | |
  2589. #endif
  2590. gto | | remove(all)
  2591. "mov $$$1,-(sp)"
  2592. "jmp gto~" | | |
  2593. fil | | "mov $$$1,hol0+4" | | |
  2594. lim | | | { relative2, "trpim~"} | |
  2595. lin | | "mov $$$1,hol0"
  2596. "jsr pc,_u_LiB" | | |
  2597. lni | | "inc hol0"
  2598. "jsr pc,_u_LiB" | | |
  2599. lor $1==0 | | | lb | |
  2600. lor $1==1 | | remove(all)
  2601. allocate(REG)
  2602. "mov sp,%[a]" | %[a] | |
  2603. lor $1==2 | | | {relative2,"reghp~"} | |
  2604. mon | | remove(all)
  2605. "jsr pc,mon~" | | |
  2606. nop | | remove(all)
  2607. "jsr pc,nop~" | | |
  2608. #ifdef DORCK
  2609. rck $1==2 | source2 |
  2610. remove(all)
  2611. move(%[1],r0)
  2612. "jsr pc,rck~" | | |
  2613. #ifdef UNTESTED
  2614. rck !defined($1)| source2 source2 |
  2615. remove(all)
  2616. "cmp %[1],$$2"
  2617. "beq 1f;jmp unknown~;1:"
  2618. move(%[2],r0)
  2619. "jsr pc,rck~" | | |
  2620. #endif
  2621. #else
  2622. rck $1==2 | source2 | | | |
  2623. rck !defined($1)| source2 source2 | | | |
  2624. #endif
  2625. rtt | | | | ret 0 |
  2626. sig | source2 |
  2627. allocate(REG)
  2628. move({relative2,"trppc~"},%[a])
  2629. "mov %[1],trppc~" | %[a] | |
  2630. sim | | remove(all)
  2631. "jsr pc,sim~" | | |
  2632. str $1==0 | source2 |
  2633. "mov %[1],r5" | | |
  2634. str $1==1 | source2 |
  2635. remove(all)
  2636. "mov %[1],sp" | | |
  2637. str $1==2 | | remove(all)
  2638. "jsr pc,strhp~" | | |
  2639. trp | | remove(all)
  2640. "jsr pc,trp~" | | |
  2641. exg $1==2 | source2 source2 | | %[1] %[2] | |
  2642. exg defined($1) | | remove(all)
  2643. move({CONST2,$1},r0)
  2644. "jsr pc,exg~" | | |
  2645. exg | source2 | remove(all)
  2646. move(%[1],r0)
  2647. "jsr pc,exg" | | |
  2648. lol lal sti $1==$2 && $3==1| | | | | /* throw away funny C-proc-prolog */
  2649. /********************************
  2650. * Coercions *
  2651. * *
  2652. * From EM-tokens to PDP-tokens *
  2653. ********************************/
  2654. | LOCAL2 | | {regind2,lb,tostring(%[1.ind])} | |
  2655. | LOCAL4 | | {regind4,lb,tostring(%[1.ind])} | |
  2656. /********************************
  2657. * From source to register *
  2658. ********************************/
  2659. | regconst2 | allocate(%[1],REG=%[1.reg])
  2660. "add $$%[1.ind],%[a]"
  2661. setcc(%[a]) | %[a] | |(6,1050)
  2662. | ADDR_LOCAL | allocate(REG)
  2663. "mov r5,%[a]"
  2664. "add $$%[1.ind],%[a]"
  2665. setcc(%[a]) | %[a] | |(6,1050)
  2666. | REG | | {regconst2, %[1], "0"} | | (2,600)
  2667. | xsource2 | allocate(%[1], REG=%[1]) | %[a] | |
  2668. | xsource2 | allocate(%[1], REG=%[1]) | {regconst2, %[a], "0"} | |
  2669. | longf4 | allocate(FLT_REG)
  2670. move( %[1],%[a]) | %[a] | | (20,20000) + %[1]
  2671. | double8 | allocate(DBL_REG)
  2672. move(%[1],%[a]) | %[a] | | (20,30000) + %[1]
  2673. /********************************
  2674. * From source1 to source2 *
  2675. ********************************/
  2676. | source1 | allocate(REG={CONST2,0})
  2677. "bisb %[1],%[a]"
  2678. erase(%[a]) setcc(%[a]) | %[a] | | (6,1050)+%[1]
  2679. /********************************
  2680. * From long4 to source2 *
  2681. ********************************/
  2682. | REG_PAIR | | %[1.2] %[1.1] | |
  2683. | regind4 | | {regind2,%[1.reg],"2+"+%[1.ind]} {regind2,%[1.reg],%[1.ind]} | |
  2684. | relative4 | | {relative2,"2+"+%[1.ind]} {relative2,%[1.ind]} | |
  2685. | regdef4 | | {regind2,%[1.reg],"2"} {regdef2,%[1.reg]} | |
  2686. | LOCAL4 | | {LOCAL2, %[1.ind]+2, 2} {LOCAL2, %[1.ind], 2} | |
  2687. /********************************
  2688. * from double8 to long4 *
  2689. ********************************/
  2690. | regind8 | | {regind4,%[1.reg],"4+"+%[1.ind]} {regind4,%[1.reg],%[1.ind]} | |
  2691. | relative8 | | {relative4,"4+"+%[1.ind]} {relative4,%[1.ind]} | |
  2692. | regdef8 | | {regdef4,%[1.reg]} {regind4,%[1.reg],"4"} | |
  2693. /************************
  2694. * From STACK coercions *
  2695. ************************/
  2696. | STACK | allocate(REG)
  2697. "mov (sp)+,%[a]"
  2698. setcc(%[a]) | %[a] | | (2,750)
  2699. | STACK | allocate(REG)
  2700. "mov (sp)+,%[a]"
  2701. setcc(%[a]) | {regconst2, %[a], "0"} | | (2,750)
  2702. | STACK | allocate(FLT_REG)
  2703. "movof (sp)+,%[a]"
  2704. samecc | %[a] | | (20,47400) /* /10 */
  2705. | STACK | allocate(DBL_REG)
  2706. "movf (sp)+,%[a]"
  2707. samecc | %[a] | | (20,69200) /* /10 */
  2708. | STACK | allocate(REG_PAIR)
  2709. "mov (sp)+,%[a.1]"
  2710. "mov (sp)+,%[a.2]"
  2711. setcc(%[a.2]) | %[a] | | (4,1500)
  2712. MOVES:
  2713. (CONST2 %[num] == 0, source2, "clr %[2]" setcc(%[2]),(2,300))
  2714. (source2, source2, "mov %[1],%[2]" setcc(%[2]),(2,300)+%[1]+%[2])
  2715. (FLT_REG, longf4-FLT_REG,"movfo %[1],%[2]" samecc, (2,880) + %[2])
  2716. (longf4-FLT_REG,FLT_REG, "movof %[1],%[2]" samecc, (2,1500) + %[2])
  2717. (FLT_REG, FLT_REG, "movf %[1],%[2]" samecc,(2,880))
  2718. (DBL_REG,double8, "movf %[1],%[2]" samecc,(2,880) + %[2])
  2719. (double8,DBL_REG, "movf %[1],%[2]" samecc,(2,1700) + %[1])
  2720. (CONST2 %[num] == 0,source1, "clrb %[2]" setcc(%[2]),(2,450)+%[2])
  2721. (source1or2,source1, "movb %[1],%[2]" setcc(%[2]),(2,300)+%[1]+%[2])
  2722. (ftoint,source2, "movfi %[1.reg],%[2]" samecc)
  2723. TESTS:
  2724. (source2, "tst %[1]" ,(2,300) + %[1])
  2725. (source1, "tstb %[1]",(2,400) + %[1])
  2726. (FLT_REG+DBL_REG, "tstf %[1]\ncfcc" ,(4,2600))
  2727. /* (DBL_REG, "tstf %[1]\ncfcc" ,(4,2600)) */
  2728. STACKS:
  2729. ( CONST2 %[num]==0 ,, "clr -(sp)" )
  2730. ( source2 ,, "mov %[1],-(sp)" setcc(%[1]), (2,900)+%[1])
  2731. ( regconst2 ,, "mov %[1.reg],-(sp)\nadd $$%[1.ind],(sp)" , (6,2250))
  2732. ( ADDR_LOCAL,, "mov r5,-(sp)" "add $$%[1.ind],(sp)", (6,2250))
  2733. ( DBL_REG ,, "movf %[1],-(sp)" samecc , (2,6100))
  2734. ( FLT_REG ,, "movfo %[1],-(sp)" samecc , (2,4120))
  2735. ( REG_PAIR ,, "mov %[1.2],-(sp)" "mov %[1.1],-(sp)" , (4,1800))
  2736. ( regind4 ,, "mov 2+%[1.ind](%[1.reg]),-(sp)"
  2737. "mov %[1.ind](%[1.reg]),-(sp)" , (8,3000))
  2738. ( relative4 ,, "mov 2+%[1.ind],-(sp)"
  2739. "mov %[1.ind],-(sp)" , (8,3000))
  2740. ( regdef4 ,, "mov 2(%[1.reg]),-(sp)"
  2741. "mov (%[1.reg]),-(sp)" , (6,2700))
  2742. ( regind8 ,REG, move(%[1.reg],%[a])
  2743. "add $$%(8%)+%[1.ind],%[a]"
  2744. "mov -(%[a]),-(sp)"
  2745. "mov -(%[a]),-(sp)"
  2746. "mov -(%[a]),-(sp)"
  2747. "mov -(%[a]),-(sp)"
  2748. erase(%[a]) , (14,6000))
  2749. ( regind8 ,, "mov 6+%[1.ind](%[1.reg]),-(sp)"
  2750. "mov 4+%[1.ind](%[1.reg]),-(sp)"
  2751. "mov 2+%[1.ind](%[1.reg]),-(sp)"
  2752. "mov %[1.ind](%[1.reg]),-(sp)" , (16,6000))
  2753. ( relative8 ,REG,"mov $$%(8%)+%[1.ind],%[a]"
  2754. "mov -(%[a]),-(sp)"
  2755. "mov -(%[a]),-(sp)"
  2756. "mov -(%[a]),-(sp)"
  2757. "mov -(%[a]),-(sp)" , (12,5000))
  2758. ( relative8 ,, "mov 6+%[1.ind],-(sp)"
  2759. "mov 4+%[1.ind],-(sp)"
  2760. "mov 2+%[1.ind],-(sp)"
  2761. "mov %[1.ind],-(sp)" , (16,6000))
  2762. ( regdef8 ,, "mov 6(%[1.reg]),-(sp)"
  2763. "mov 4(%[1.reg]),-(sp)"
  2764. "mov 2(%[1.reg]),-(sp)"
  2765. "mov (%[1.reg]),-(sp)" , (14,5700))
  2766. ( LOCAL4 ,, "mov 2+%[1.ind](r5),-(sp)"
  2767. "mov %[1.ind](r5),-(sp)" , (8,3000))
  2768. ( source1 ,, "clr -(sp)"
  2769. "movb %[1],(sp)" , (4,1800)+%[1])
  2770. ( ftoint ,, "movfi %[1.reg],-(sp)" )
  2771. ( ftolong ,, "setl\nmovfi %[1.reg],-(sp)\nseti" )