table 88 KB

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