milli.S 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071
  1. /* 32 and 64-bit millicode, original author Hewlett-Packard
  2. adapted for gcc by Paul Bame <bame@debian.org>
  3. and Alan Modra <alan@linuxcare.com.au>.
  4. Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
  5. This file is part of GCC and is released under the terms of
  6. of the GNU General Public License as published by the Free Software
  7. Foundation; either version 2, or (at your option) any later version.
  8. See the file COPYING in the top-level GCC source directory for a copy
  9. of the license. */
  10. #ifdef CONFIG_64BIT
  11. .level 2.0w
  12. #endif
  13. /* Hardware General Registers. */
  14. r0: .reg %r0
  15. r1: .reg %r1
  16. r2: .reg %r2
  17. r3: .reg %r3
  18. r4: .reg %r4
  19. r5: .reg %r5
  20. r6: .reg %r6
  21. r7: .reg %r7
  22. r8: .reg %r8
  23. r9: .reg %r9
  24. r10: .reg %r10
  25. r11: .reg %r11
  26. r12: .reg %r12
  27. r13: .reg %r13
  28. r14: .reg %r14
  29. r15: .reg %r15
  30. r16: .reg %r16
  31. r17: .reg %r17
  32. r18: .reg %r18
  33. r19: .reg %r19
  34. r20: .reg %r20
  35. r21: .reg %r21
  36. r22: .reg %r22
  37. r23: .reg %r23
  38. r24: .reg %r24
  39. r25: .reg %r25
  40. r26: .reg %r26
  41. r27: .reg %r27
  42. r28: .reg %r28
  43. r29: .reg %r29
  44. r30: .reg %r30
  45. r31: .reg %r31
  46. /* Hardware Space Registers. */
  47. sr0: .reg %sr0
  48. sr1: .reg %sr1
  49. sr2: .reg %sr2
  50. sr3: .reg %sr3
  51. sr4: .reg %sr4
  52. sr5: .reg %sr5
  53. sr6: .reg %sr6
  54. sr7: .reg %sr7
  55. /* Hardware Floating Point Registers. */
  56. fr0: .reg %fr0
  57. fr1: .reg %fr1
  58. fr2: .reg %fr2
  59. fr3: .reg %fr3
  60. fr4: .reg %fr4
  61. fr5: .reg %fr5
  62. fr6: .reg %fr6
  63. fr7: .reg %fr7
  64. fr8: .reg %fr8
  65. fr9: .reg %fr9
  66. fr10: .reg %fr10
  67. fr11: .reg %fr11
  68. fr12: .reg %fr12
  69. fr13: .reg %fr13
  70. fr14: .reg %fr14
  71. fr15: .reg %fr15
  72. /* Hardware Control Registers. */
  73. cr11: .reg %cr11
  74. sar: .reg %cr11 /* Shift Amount Register */
  75. /* Software Architecture General Registers. */
  76. rp: .reg r2 /* return pointer */
  77. #ifdef CONFIG_64BIT
  78. mrp: .reg r2 /* millicode return pointer */
  79. #else
  80. mrp: .reg r31 /* millicode return pointer */
  81. #endif
  82. ret0: .reg r28 /* return value */
  83. ret1: .reg r29 /* return value (high part of double) */
  84. sp: .reg r30 /* stack pointer */
  85. dp: .reg r27 /* data pointer */
  86. arg0: .reg r26 /* argument */
  87. arg1: .reg r25 /* argument or high part of double argument */
  88. arg2: .reg r24 /* argument */
  89. arg3: .reg r23 /* argument or high part of double argument */
  90. /* Software Architecture Space Registers. */
  91. /* sr0 ; return link from BLE */
  92. sret: .reg sr1 /* return value */
  93. sarg: .reg sr1 /* argument */
  94. /* sr4 ; PC SPACE tracker */
  95. /* sr5 ; process private data */
  96. /* Frame Offsets (millicode convention!) Used when calling other
  97. millicode routines. Stack unwinding is dependent upon these
  98. definitions. */
  99. r31_slot: .equ -20 /* "current RP" slot */
  100. sr0_slot: .equ -16 /* "static link" slot */
  101. #if defined(CONFIG_64BIT)
  102. mrp_slot: .equ -16 /* "current RP" slot */
  103. psp_slot: .equ -8 /* "previous SP" slot */
  104. #else
  105. mrp_slot: .equ -20 /* "current RP" slot (replacing "r31_slot") */
  106. #endif
  107. #define DEFINE(name,value)name: .EQU value
  108. #define RDEFINE(name,value)name: .REG value
  109. #ifdef milliext
  110. #define MILLI_BE(lbl) BE lbl(sr7,r0)
  111. #define MILLI_BEN(lbl) BE,n lbl(sr7,r0)
  112. #define MILLI_BLE(lbl) BLE lbl(sr7,r0)
  113. #define MILLI_BLEN(lbl) BLE,n lbl(sr7,r0)
  114. #define MILLIRETN BE,n 0(sr0,mrp)
  115. #define MILLIRET BE 0(sr0,mrp)
  116. #define MILLI_RETN BE,n 0(sr0,mrp)
  117. #define MILLI_RET BE 0(sr0,mrp)
  118. #else
  119. #define MILLI_BE(lbl) B lbl
  120. #define MILLI_BEN(lbl) B,n lbl
  121. #define MILLI_BLE(lbl) BL lbl,mrp
  122. #define MILLI_BLEN(lbl) BL,n lbl,mrp
  123. #define MILLIRETN BV,n 0(mrp)
  124. #define MILLIRET BV 0(mrp)
  125. #define MILLI_RETN BV,n 0(mrp)
  126. #define MILLI_RET BV 0(mrp)
  127. #endif
  128. #define CAT(a,b) a##b
  129. #define SUBSPA_MILLI .section .text
  130. #define SUBSPA_MILLI_DIV .section .text.div,"ax",@progbits! .align 16
  131. #define SUBSPA_MILLI_MUL .section .text.mul,"ax",@progbits! .align 16
  132. #define ATTR_MILLI
  133. #define SUBSPA_DATA .section .data
  134. #define ATTR_DATA
  135. #define GLOBAL $global$
  136. #define GSYM(sym) !sym:
  137. #define LSYM(sym) !CAT(.L,sym:)
  138. #define LREF(sym) CAT(.L,sym)
  139. #ifdef L_dyncall
  140. SUBSPA_MILLI
  141. ATTR_DATA
  142. GSYM($$dyncall)
  143. .export $$dyncall,millicode
  144. .proc
  145. .callinfo millicode
  146. .entry
  147. bb,>=,n %r22,30,LREF(1) ; branch if not plabel address
  148. depi 0,31,2,%r22 ; clear the two least significant bits
  149. ldw 4(%r22),%r19 ; load new LTP value
  150. ldw 0(%r22),%r22 ; load address of target
  151. LSYM(1)
  152. bv %r0(%r22) ; branch to the real target
  153. stw %r2,-24(%r30) ; save return address into frame marker
  154. .exit
  155. .procend
  156. #endif
  157. #ifdef L_divI
  158. /* ROUTINES: $$divI, $$divoI
  159. Single precision divide for signed binary integers.
  160. The quotient is truncated towards zero.
  161. The sign of the quotient is the XOR of the signs of the dividend and
  162. divisor.
  163. Divide by zero is trapped.
  164. Divide of -2**31 by -1 is trapped for $$divoI but not for $$divI.
  165. INPUT REGISTERS:
  166. . arg0 == dividend
  167. . arg1 == divisor
  168. . mrp == return pc
  169. . sr0 == return space when called externally
  170. OUTPUT REGISTERS:
  171. . arg0 = undefined
  172. . arg1 = undefined
  173. . ret1 = quotient
  174. OTHER REGISTERS AFFECTED:
  175. . r1 = undefined
  176. SIDE EFFECTS:
  177. . Causes a trap under the following conditions:
  178. . divisor is zero (traps with ADDIT,= 0,25,0)
  179. . dividend==-2**31 and divisor==-1 and routine is $$divoI
  180. . (traps with ADDO 26,25,0)
  181. . Changes memory at the following places:
  182. . NONE
  183. PERMISSIBLE CONTEXT:
  184. . Unwindable.
  185. . Suitable for internal or external millicode.
  186. . Assumes the special millicode register conventions.
  187. DISCUSSION:
  188. . Branchs to other millicode routines using BE
  189. . $$div_# for # being 2,3,4,5,6,7,8,9,10,12,14,15
  190. .
  191. . For selected divisors, calls a divide by constant routine written by
  192. . Karl Pettis. Eligible divisors are 1..15 excluding 11 and 13.
  193. .
  194. . The only overflow case is -2**31 divided by -1.
  195. . Both routines return -2**31 but only $$divoI traps. */
  196. RDEFINE(temp,r1)
  197. RDEFINE(retreg,ret1) /* r29 */
  198. RDEFINE(temp1,arg0)
  199. SUBSPA_MILLI_DIV
  200. ATTR_MILLI
  201. .import $$divI_2,millicode
  202. .import $$divI_3,millicode
  203. .import $$divI_4,millicode
  204. .import $$divI_5,millicode
  205. .import $$divI_6,millicode
  206. .import $$divI_7,millicode
  207. .import $$divI_8,millicode
  208. .import $$divI_9,millicode
  209. .import $$divI_10,millicode
  210. .import $$divI_12,millicode
  211. .import $$divI_14,millicode
  212. .import $$divI_15,millicode
  213. .export $$divI,millicode
  214. .export $$divoI,millicode
  215. .proc
  216. .callinfo millicode
  217. .entry
  218. GSYM($$divoI)
  219. comib,=,n -1,arg1,LREF(negative1) /* when divisor == -1 */
  220. GSYM($$divI)
  221. ldo -1(arg1),temp /* is there at most one bit set ? */
  222. and,<> arg1,temp,r0 /* if not, don't use power of 2 divide */
  223. addi,> 0,arg1,r0 /* if divisor > 0, use power of 2 divide */
  224. b,n LREF(neg_denom)
  225. LSYM(pow2)
  226. addi,>= 0,arg0,retreg /* if numerator is negative, add the */
  227. add arg0,temp,retreg /* (denominaotr -1) to correct for shifts */
  228. extru,= arg1,15,16,temp /* test denominator with 0xffff0000 */
  229. extrs retreg,15,16,retreg /* retreg = retreg >> 16 */
  230. or arg1,temp,arg1 /* arg1 = arg1 | (arg1 >> 16) */
  231. ldi 0xcc,temp1 /* setup 0xcc in temp1 */
  232. extru,= arg1,23,8,temp /* test denominator with 0xff00 */
  233. extrs retreg,23,24,retreg /* retreg = retreg >> 8 */
  234. or arg1,temp,arg1 /* arg1 = arg1 | (arg1 >> 8) */
  235. ldi 0xaa,temp /* setup 0xaa in temp */
  236. extru,= arg1,27,4,r0 /* test denominator with 0xf0 */
  237. extrs retreg,27,28,retreg /* retreg = retreg >> 4 */
  238. and,= arg1,temp1,r0 /* test denominator with 0xcc */
  239. extrs retreg,29,30,retreg /* retreg = retreg >> 2 */
  240. and,= arg1,temp,r0 /* test denominator with 0xaa */
  241. extrs retreg,30,31,retreg /* retreg = retreg >> 1 */
  242. MILLIRETN
  243. LSYM(neg_denom)
  244. addi,< 0,arg1,r0 /* if arg1 >= 0, it's not power of 2 */
  245. b,n LREF(regular_seq)
  246. sub r0,arg1,temp /* make denominator positive */
  247. comb,=,n arg1,temp,LREF(regular_seq) /* test against 0x80000000 and 0 */
  248. ldo -1(temp),retreg /* is there at most one bit set ? */
  249. and,= temp,retreg,r0 /* if so, the denominator is power of 2 */
  250. b,n LREF(regular_seq)
  251. sub r0,arg0,retreg /* negate numerator */
  252. comb,=,n arg0,retreg,LREF(regular_seq) /* test against 0x80000000 */
  253. copy retreg,arg0 /* set up arg0, arg1 and temp */
  254. copy temp,arg1 /* before branching to pow2 */
  255. b LREF(pow2)
  256. ldo -1(arg1),temp
  257. LSYM(regular_seq)
  258. comib,>>=,n 15,arg1,LREF(small_divisor)
  259. add,>= 0,arg0,retreg /* move dividend, if retreg < 0, */
  260. LSYM(normal)
  261. subi 0,retreg,retreg /* make it positive */
  262. sub 0,arg1,temp /* clear carry, */
  263. /* negate the divisor */
  264. ds 0,temp,0 /* set V-bit to the comple- */
  265. /* ment of the divisor sign */
  266. add retreg,retreg,retreg /* shift msb bit into carry */
  267. ds r0,arg1,temp /* 1st divide step, if no carry */
  268. addc retreg,retreg,retreg /* shift retreg with/into carry */
  269. ds temp,arg1,temp /* 2nd divide step */
  270. addc retreg,retreg,retreg /* shift retreg with/into carry */
  271. ds temp,arg1,temp /* 3rd divide step */
  272. addc retreg,retreg,retreg /* shift retreg with/into carry */
  273. ds temp,arg1,temp /* 4th divide step */
  274. addc retreg,retreg,retreg /* shift retreg with/into carry */
  275. ds temp,arg1,temp /* 5th divide step */
  276. addc retreg,retreg,retreg /* shift retreg with/into carry */
  277. ds temp,arg1,temp /* 6th divide step */
  278. addc retreg,retreg,retreg /* shift retreg with/into carry */
  279. ds temp,arg1,temp /* 7th divide step */
  280. addc retreg,retreg,retreg /* shift retreg with/into carry */
  281. ds temp,arg1,temp /* 8th divide step */
  282. addc retreg,retreg,retreg /* shift retreg with/into carry */
  283. ds temp,arg1,temp /* 9th divide step */
  284. addc retreg,retreg,retreg /* shift retreg with/into carry */
  285. ds temp,arg1,temp /* 10th divide step */
  286. addc retreg,retreg,retreg /* shift retreg with/into carry */
  287. ds temp,arg1,temp /* 11th divide step */
  288. addc retreg,retreg,retreg /* shift retreg with/into carry */
  289. ds temp,arg1,temp /* 12th divide step */
  290. addc retreg,retreg,retreg /* shift retreg with/into carry */
  291. ds temp,arg1,temp /* 13th divide step */
  292. addc retreg,retreg,retreg /* shift retreg with/into carry */
  293. ds temp,arg1,temp /* 14th divide step */
  294. addc retreg,retreg,retreg /* shift retreg with/into carry */
  295. ds temp,arg1,temp /* 15th divide step */
  296. addc retreg,retreg,retreg /* shift retreg with/into carry */
  297. ds temp,arg1,temp /* 16th divide step */
  298. addc retreg,retreg,retreg /* shift retreg with/into carry */
  299. ds temp,arg1,temp /* 17th divide step */
  300. addc retreg,retreg,retreg /* shift retreg with/into carry */
  301. ds temp,arg1,temp /* 18th divide step */
  302. addc retreg,retreg,retreg /* shift retreg with/into carry */
  303. ds temp,arg1,temp /* 19th divide step */
  304. addc retreg,retreg,retreg /* shift retreg with/into carry */
  305. ds temp,arg1,temp /* 20th divide step */
  306. addc retreg,retreg,retreg /* shift retreg with/into carry */
  307. ds temp,arg1,temp /* 21st divide step */
  308. addc retreg,retreg,retreg /* shift retreg with/into carry */
  309. ds temp,arg1,temp /* 22nd divide step */
  310. addc retreg,retreg,retreg /* shift retreg with/into carry */
  311. ds temp,arg1,temp /* 23rd divide step */
  312. addc retreg,retreg,retreg /* shift retreg with/into carry */
  313. ds temp,arg1,temp /* 24th divide step */
  314. addc retreg,retreg,retreg /* shift retreg with/into carry */
  315. ds temp,arg1,temp /* 25th divide step */
  316. addc retreg,retreg,retreg /* shift retreg with/into carry */
  317. ds temp,arg1,temp /* 26th divide step */
  318. addc retreg,retreg,retreg /* shift retreg with/into carry */
  319. ds temp,arg1,temp /* 27th divide step */
  320. addc retreg,retreg,retreg /* shift retreg with/into carry */
  321. ds temp,arg1,temp /* 28th divide step */
  322. addc retreg,retreg,retreg /* shift retreg with/into carry */
  323. ds temp,arg1,temp /* 29th divide step */
  324. addc retreg,retreg,retreg /* shift retreg with/into carry */
  325. ds temp,arg1,temp /* 30th divide step */
  326. addc retreg,retreg,retreg /* shift retreg with/into carry */
  327. ds temp,arg1,temp /* 31st divide step */
  328. addc retreg,retreg,retreg /* shift retreg with/into carry */
  329. ds temp,arg1,temp /* 32nd divide step, */
  330. addc retreg,retreg,retreg /* shift last retreg bit into retreg */
  331. xor,>= arg0,arg1,0 /* get correct sign of quotient */
  332. sub 0,retreg,retreg /* based on operand signs */
  333. MILLIRETN
  334. nop
  335. LSYM(small_divisor)
  336. #if defined(CONFIG_64BIT)
  337. /* Clear the upper 32 bits of the arg1 register. We are working with */
  338. /* small divisors (and 32-bit integers) We must not be mislead */
  339. /* by "1" bits left in the upper 32 bits. */
  340. depd %r0,31,32,%r25
  341. #endif
  342. blr,n arg1,r0
  343. nop
  344. /* table for divisor == 0,1, ... ,15 */
  345. addit,= 0,arg1,r0 /* trap if divisor == 0 */
  346. nop
  347. MILLIRET /* divisor == 1 */
  348. copy arg0,retreg
  349. MILLI_BEN($$divI_2) /* divisor == 2 */
  350. nop
  351. MILLI_BEN($$divI_3) /* divisor == 3 */
  352. nop
  353. MILLI_BEN($$divI_4) /* divisor == 4 */
  354. nop
  355. MILLI_BEN($$divI_5) /* divisor == 5 */
  356. nop
  357. MILLI_BEN($$divI_6) /* divisor == 6 */
  358. nop
  359. MILLI_BEN($$divI_7) /* divisor == 7 */
  360. nop
  361. MILLI_BEN($$divI_8) /* divisor == 8 */
  362. nop
  363. MILLI_BEN($$divI_9) /* divisor == 9 */
  364. nop
  365. MILLI_BEN($$divI_10) /* divisor == 10 */
  366. nop
  367. b LREF(normal) /* divisor == 11 */
  368. add,>= 0,arg0,retreg
  369. MILLI_BEN($$divI_12) /* divisor == 12 */
  370. nop
  371. b LREF(normal) /* divisor == 13 */
  372. add,>= 0,arg0,retreg
  373. MILLI_BEN($$divI_14) /* divisor == 14 */
  374. nop
  375. MILLI_BEN($$divI_15) /* divisor == 15 */
  376. nop
  377. LSYM(negative1)
  378. sub 0,arg0,retreg /* result is negation of dividend */
  379. MILLIRET
  380. addo arg0,arg1,r0 /* trap iff dividend==0x80000000 && divisor==-1 */
  381. .exit
  382. .procend
  383. .end
  384. #endif
  385. #ifdef L_divU
  386. /* ROUTINE: $$divU
  387. .
  388. . Single precision divide for unsigned integers.
  389. .
  390. . Quotient is truncated towards zero.
  391. . Traps on divide by zero.
  392. INPUT REGISTERS:
  393. . arg0 == dividend
  394. . arg1 == divisor
  395. . mrp == return pc
  396. . sr0 == return space when called externally
  397. OUTPUT REGISTERS:
  398. . arg0 = undefined
  399. . arg1 = undefined
  400. . ret1 = quotient
  401. OTHER REGISTERS AFFECTED:
  402. . r1 = undefined
  403. SIDE EFFECTS:
  404. . Causes a trap under the following conditions:
  405. . divisor is zero
  406. . Changes memory at the following places:
  407. . NONE
  408. PERMISSIBLE CONTEXT:
  409. . Unwindable.
  410. . Does not create a stack frame.
  411. . Suitable for internal or external millicode.
  412. . Assumes the special millicode register conventions.
  413. DISCUSSION:
  414. . Branchs to other millicode routines using BE:
  415. . $$divU_# for 3,5,6,7,9,10,12,14,15
  416. .
  417. . For selected small divisors calls the special divide by constant
  418. . routines written by Karl Pettis. These are: 3,5,6,7,9,10,12,14,15. */
  419. RDEFINE(temp,r1)
  420. RDEFINE(retreg,ret1) /* r29 */
  421. RDEFINE(temp1,arg0)
  422. SUBSPA_MILLI_DIV
  423. ATTR_MILLI
  424. .export $$divU,millicode
  425. .import $$divU_3,millicode
  426. .import $$divU_5,millicode
  427. .import $$divU_6,millicode
  428. .import $$divU_7,millicode
  429. .import $$divU_9,millicode
  430. .import $$divU_10,millicode
  431. .import $$divU_12,millicode
  432. .import $$divU_14,millicode
  433. .import $$divU_15,millicode
  434. .proc
  435. .callinfo millicode
  436. .entry
  437. GSYM($$divU)
  438. /* The subtract is not nullified since it does no harm and can be used
  439. by the two cases that branch back to "normal". */
  440. ldo -1(arg1),temp /* is there at most one bit set ? */
  441. and,= arg1,temp,r0 /* if so, denominator is power of 2 */
  442. b LREF(regular_seq)
  443. addit,= 0,arg1,0 /* trap for zero dvr */
  444. copy arg0,retreg
  445. extru,= arg1,15,16,temp /* test denominator with 0xffff0000 */
  446. extru retreg,15,16,retreg /* retreg = retreg >> 16 */
  447. or arg1,temp,arg1 /* arg1 = arg1 | (arg1 >> 16) */
  448. ldi 0xcc,temp1 /* setup 0xcc in temp1 */
  449. extru,= arg1,23,8,temp /* test denominator with 0xff00 */
  450. extru retreg,23,24,retreg /* retreg = retreg >> 8 */
  451. or arg1,temp,arg1 /* arg1 = arg1 | (arg1 >> 8) */
  452. ldi 0xaa,temp /* setup 0xaa in temp */
  453. extru,= arg1,27,4,r0 /* test denominator with 0xf0 */
  454. extru retreg,27,28,retreg /* retreg = retreg >> 4 */
  455. and,= arg1,temp1,r0 /* test denominator with 0xcc */
  456. extru retreg,29,30,retreg /* retreg = retreg >> 2 */
  457. and,= arg1,temp,r0 /* test denominator with 0xaa */
  458. extru retreg,30,31,retreg /* retreg = retreg >> 1 */
  459. MILLIRETN
  460. nop
  461. LSYM(regular_seq)
  462. comib,>= 15,arg1,LREF(special_divisor)
  463. subi 0,arg1,temp /* clear carry, negate the divisor */
  464. ds r0,temp,r0 /* set V-bit to 1 */
  465. LSYM(normal)
  466. add arg0,arg0,retreg /* shift msb bit into carry */
  467. ds r0,arg1,temp /* 1st divide step, if no carry */
  468. addc retreg,retreg,retreg /* shift retreg with/into carry */
  469. ds temp,arg1,temp /* 2nd divide step */
  470. addc retreg,retreg,retreg /* shift retreg with/into carry */
  471. ds temp,arg1,temp /* 3rd divide step */
  472. addc retreg,retreg,retreg /* shift retreg with/into carry */
  473. ds temp,arg1,temp /* 4th divide step */
  474. addc retreg,retreg,retreg /* shift retreg with/into carry */
  475. ds temp,arg1,temp /* 5th divide step */
  476. addc retreg,retreg,retreg /* shift retreg with/into carry */
  477. ds temp,arg1,temp /* 6th divide step */
  478. addc retreg,retreg,retreg /* shift retreg with/into carry */
  479. ds temp,arg1,temp /* 7th divide step */
  480. addc retreg,retreg,retreg /* shift retreg with/into carry */
  481. ds temp,arg1,temp /* 8th divide step */
  482. addc retreg,retreg,retreg /* shift retreg with/into carry */
  483. ds temp,arg1,temp /* 9th divide step */
  484. addc retreg,retreg,retreg /* shift retreg with/into carry */
  485. ds temp,arg1,temp /* 10th divide step */
  486. addc retreg,retreg,retreg /* shift retreg with/into carry */
  487. ds temp,arg1,temp /* 11th divide step */
  488. addc retreg,retreg,retreg /* shift retreg with/into carry */
  489. ds temp,arg1,temp /* 12th divide step */
  490. addc retreg,retreg,retreg /* shift retreg with/into carry */
  491. ds temp,arg1,temp /* 13th divide step */
  492. addc retreg,retreg,retreg /* shift retreg with/into carry */
  493. ds temp,arg1,temp /* 14th divide step */
  494. addc retreg,retreg,retreg /* shift retreg with/into carry */
  495. ds temp,arg1,temp /* 15th divide step */
  496. addc retreg,retreg,retreg /* shift retreg with/into carry */
  497. ds temp,arg1,temp /* 16th divide step */
  498. addc retreg,retreg,retreg /* shift retreg with/into carry */
  499. ds temp,arg1,temp /* 17th divide step */
  500. addc retreg,retreg,retreg /* shift retreg with/into carry */
  501. ds temp,arg1,temp /* 18th divide step */
  502. addc retreg,retreg,retreg /* shift retreg with/into carry */
  503. ds temp,arg1,temp /* 19th divide step */
  504. addc retreg,retreg,retreg /* shift retreg with/into carry */
  505. ds temp,arg1,temp /* 20th divide step */
  506. addc retreg,retreg,retreg /* shift retreg with/into carry */
  507. ds temp,arg1,temp /* 21st divide step */
  508. addc retreg,retreg,retreg /* shift retreg with/into carry */
  509. ds temp,arg1,temp /* 22nd divide step */
  510. addc retreg,retreg,retreg /* shift retreg with/into carry */
  511. ds temp,arg1,temp /* 23rd divide step */
  512. addc retreg,retreg,retreg /* shift retreg with/into carry */
  513. ds temp,arg1,temp /* 24th divide step */
  514. addc retreg,retreg,retreg /* shift retreg with/into carry */
  515. ds temp,arg1,temp /* 25th divide step */
  516. addc retreg,retreg,retreg /* shift retreg with/into carry */
  517. ds temp,arg1,temp /* 26th divide step */
  518. addc retreg,retreg,retreg /* shift retreg with/into carry */
  519. ds temp,arg1,temp /* 27th divide step */
  520. addc retreg,retreg,retreg /* shift retreg with/into carry */
  521. ds temp,arg1,temp /* 28th divide step */
  522. addc retreg,retreg,retreg /* shift retreg with/into carry */
  523. ds temp,arg1,temp /* 29th divide step */
  524. addc retreg,retreg,retreg /* shift retreg with/into carry */
  525. ds temp,arg1,temp /* 30th divide step */
  526. addc retreg,retreg,retreg /* shift retreg with/into carry */
  527. ds temp,arg1,temp /* 31st divide step */
  528. addc retreg,retreg,retreg /* shift retreg with/into carry */
  529. ds temp,arg1,temp /* 32nd divide step, */
  530. MILLIRET
  531. addc retreg,retreg,retreg /* shift last retreg bit into retreg */
  532. /* Handle the cases where divisor is a small constant or has high bit on. */
  533. LSYM(special_divisor)
  534. /* blr arg1,r0 */
  535. /* comib,>,n 0,arg1,LREF(big_divisor) ; nullify previous instruction */
  536. /* Pratap 8/13/90. The 815 Stirling chip set has a bug that prevents us from
  537. generating such a blr, comib sequence. A problem in nullification. So I
  538. rewrote this code. */
  539. #if defined(CONFIG_64BIT)
  540. /* Clear the upper 32 bits of the arg1 register. We are working with
  541. small divisors (and 32-bit unsigned integers) We must not be mislead
  542. by "1" bits left in the upper 32 bits. */
  543. depd %r0,31,32,%r25
  544. #endif
  545. comib,> 0,arg1,LREF(big_divisor)
  546. nop
  547. blr arg1,r0
  548. nop
  549. LSYM(zero_divisor) /* this label is here to provide external visibility */
  550. addit,= 0,arg1,0 /* trap for zero dvr */
  551. nop
  552. MILLIRET /* divisor == 1 */
  553. copy arg0,retreg
  554. MILLIRET /* divisor == 2 */
  555. extru arg0,30,31,retreg
  556. MILLI_BEN($$divU_3) /* divisor == 3 */
  557. nop
  558. MILLIRET /* divisor == 4 */
  559. extru arg0,29,30,retreg
  560. MILLI_BEN($$divU_5) /* divisor == 5 */
  561. nop
  562. MILLI_BEN($$divU_6) /* divisor == 6 */
  563. nop
  564. MILLI_BEN($$divU_7) /* divisor == 7 */
  565. nop
  566. MILLIRET /* divisor == 8 */
  567. extru arg0,28,29,retreg
  568. MILLI_BEN($$divU_9) /* divisor == 9 */
  569. nop
  570. MILLI_BEN($$divU_10) /* divisor == 10 */
  571. nop
  572. b LREF(normal) /* divisor == 11 */
  573. ds r0,temp,r0 /* set V-bit to 1 */
  574. MILLI_BEN($$divU_12) /* divisor == 12 */
  575. nop
  576. b LREF(normal) /* divisor == 13 */
  577. ds r0,temp,r0 /* set V-bit to 1 */
  578. MILLI_BEN($$divU_14) /* divisor == 14 */
  579. nop
  580. MILLI_BEN($$divU_15) /* divisor == 15 */
  581. nop
  582. /* Handle the case where the high bit is on in the divisor.
  583. Compute: if( dividend>=divisor) quotient=1; else quotient=0;
  584. Note: dividend>==divisor iff dividend-divisor does not borrow
  585. and not borrow iff carry. */
  586. LSYM(big_divisor)
  587. sub arg0,arg1,r0
  588. MILLIRET
  589. addc r0,r0,retreg
  590. .exit
  591. .procend
  592. .end
  593. #endif
  594. #ifdef L_remI
  595. /* ROUTINE: $$remI
  596. DESCRIPTION:
  597. . $$remI returns the remainder of the division of two signed 32-bit
  598. . integers. The sign of the remainder is the same as the sign of
  599. . the dividend.
  600. INPUT REGISTERS:
  601. . arg0 == dividend
  602. . arg1 == divisor
  603. . mrp == return pc
  604. . sr0 == return space when called externally
  605. OUTPUT REGISTERS:
  606. . arg0 = destroyed
  607. . arg1 = destroyed
  608. . ret1 = remainder
  609. OTHER REGISTERS AFFECTED:
  610. . r1 = undefined
  611. SIDE EFFECTS:
  612. . Causes a trap under the following conditions: DIVIDE BY ZERO
  613. . Changes memory at the following places: NONE
  614. PERMISSIBLE CONTEXT:
  615. . Unwindable
  616. . Does not create a stack frame
  617. . Is usable for internal or external microcode
  618. DISCUSSION:
  619. . Calls other millicode routines via mrp: NONE
  620. . Calls other millicode routines: NONE */
  621. RDEFINE(tmp,r1)
  622. RDEFINE(retreg,ret1)
  623. SUBSPA_MILLI
  624. ATTR_MILLI
  625. .proc
  626. .callinfo millicode
  627. .entry
  628. GSYM($$remI)
  629. GSYM($$remoI)
  630. .export $$remI,MILLICODE
  631. .export $$remoI,MILLICODE
  632. ldo -1(arg1),tmp /* is there at most one bit set ? */
  633. and,<> arg1,tmp,r0 /* if not, don't use power of 2 */
  634. addi,> 0,arg1,r0 /* if denominator > 0, use power */
  635. /* of 2 */
  636. b,n LREF(neg_denom)
  637. LSYM(pow2)
  638. comb,>,n 0,arg0,LREF(neg_num) /* is numerator < 0 ? */
  639. and arg0,tmp,retreg /* get the result */
  640. MILLIRETN
  641. LSYM(neg_num)
  642. subi 0,arg0,arg0 /* negate numerator */
  643. and arg0,tmp,retreg /* get the result */
  644. subi 0,retreg,retreg /* negate result */
  645. MILLIRETN
  646. LSYM(neg_denom)
  647. addi,< 0,arg1,r0 /* if arg1 >= 0, it's not power */
  648. /* of 2 */
  649. b,n LREF(regular_seq)
  650. sub r0,arg1,tmp /* make denominator positive */
  651. comb,=,n arg1,tmp,LREF(regular_seq) /* test against 0x80000000 and 0 */
  652. ldo -1(tmp),retreg /* is there at most one bit set ? */
  653. and,= tmp,retreg,r0 /* if not, go to regular_seq */
  654. b,n LREF(regular_seq)
  655. comb,>,n 0,arg0,LREF(neg_num_2) /* if arg0 < 0, negate it */
  656. and arg0,retreg,retreg
  657. MILLIRETN
  658. LSYM(neg_num_2)
  659. subi 0,arg0,tmp /* test against 0x80000000 */
  660. and tmp,retreg,retreg
  661. subi 0,retreg,retreg
  662. MILLIRETN
  663. LSYM(regular_seq)
  664. addit,= 0,arg1,0 /* trap if div by zero */
  665. add,>= 0,arg0,retreg /* move dividend, if retreg < 0, */
  666. sub 0,retreg,retreg /* make it positive */
  667. sub 0,arg1, tmp /* clear carry, */
  668. /* negate the divisor */
  669. ds 0, tmp,0 /* set V-bit to the comple- */
  670. /* ment of the divisor sign */
  671. or 0,0, tmp /* clear tmp */
  672. add retreg,retreg,retreg /* shift msb bit into carry */
  673. ds tmp,arg1, tmp /* 1st divide step, if no carry */
  674. /* out, msb of quotient = 0 */
  675. addc retreg,retreg,retreg /* shift retreg with/into carry */
  676. LSYM(t1)
  677. ds tmp,arg1, tmp /* 2nd divide step */
  678. addc retreg,retreg,retreg /* shift retreg with/into carry */
  679. ds tmp,arg1, tmp /* 3rd divide step */
  680. addc retreg,retreg,retreg /* shift retreg with/into carry */
  681. ds tmp,arg1, tmp /* 4th divide step */
  682. addc retreg,retreg,retreg /* shift retreg with/into carry */
  683. ds tmp,arg1, tmp /* 5th divide step */
  684. addc retreg,retreg,retreg /* shift retreg with/into carry */
  685. ds tmp,arg1, tmp /* 6th divide step */
  686. addc retreg,retreg,retreg /* shift retreg with/into carry */
  687. ds tmp,arg1, tmp /* 7th divide step */
  688. addc retreg,retreg,retreg /* shift retreg with/into carry */
  689. ds tmp,arg1, tmp /* 8th divide step */
  690. addc retreg,retreg,retreg /* shift retreg with/into carry */
  691. ds tmp,arg1, tmp /* 9th divide step */
  692. addc retreg,retreg,retreg /* shift retreg with/into carry */
  693. ds tmp,arg1, tmp /* 10th divide step */
  694. addc retreg,retreg,retreg /* shift retreg with/into carry */
  695. ds tmp,arg1, tmp /* 11th divide step */
  696. addc retreg,retreg,retreg /* shift retreg with/into carry */
  697. ds tmp,arg1, tmp /* 12th divide step */
  698. addc retreg,retreg,retreg /* shift retreg with/into carry */
  699. ds tmp,arg1, tmp /* 13th divide step */
  700. addc retreg,retreg,retreg /* shift retreg with/into carry */
  701. ds tmp,arg1, tmp /* 14th divide step */
  702. addc retreg,retreg,retreg /* shift retreg with/into carry */
  703. ds tmp,arg1, tmp /* 15th divide step */
  704. addc retreg,retreg,retreg /* shift retreg with/into carry */
  705. ds tmp,arg1, tmp /* 16th divide step */
  706. addc retreg,retreg,retreg /* shift retreg with/into carry */
  707. ds tmp,arg1, tmp /* 17th divide step */
  708. addc retreg,retreg,retreg /* shift retreg with/into carry */
  709. ds tmp,arg1, tmp /* 18th divide step */
  710. addc retreg,retreg,retreg /* shift retreg with/into carry */
  711. ds tmp,arg1, tmp /* 19th divide step */
  712. addc retreg,retreg,retreg /* shift retreg with/into carry */
  713. ds tmp,arg1, tmp /* 20th divide step */
  714. addc retreg,retreg,retreg /* shift retreg with/into carry */
  715. ds tmp,arg1, tmp /* 21st divide step */
  716. addc retreg,retreg,retreg /* shift retreg with/into carry */
  717. ds tmp,arg1, tmp /* 22nd divide step */
  718. addc retreg,retreg,retreg /* shift retreg with/into carry */
  719. ds tmp,arg1, tmp /* 23rd divide step */
  720. addc retreg,retreg,retreg /* shift retreg with/into carry */
  721. ds tmp,arg1, tmp /* 24th divide step */
  722. addc retreg,retreg,retreg /* shift retreg with/into carry */
  723. ds tmp,arg1, tmp /* 25th divide step */
  724. addc retreg,retreg,retreg /* shift retreg with/into carry */
  725. ds tmp,arg1, tmp /* 26th divide step */
  726. addc retreg,retreg,retreg /* shift retreg with/into carry */
  727. ds tmp,arg1, tmp /* 27th divide step */
  728. addc retreg,retreg,retreg /* shift retreg with/into carry */
  729. ds tmp,arg1, tmp /* 28th divide step */
  730. addc retreg,retreg,retreg /* shift retreg with/into carry */
  731. ds tmp,arg1, tmp /* 29th divide step */
  732. addc retreg,retreg,retreg /* shift retreg with/into carry */
  733. ds tmp,arg1, tmp /* 30th divide step */
  734. addc retreg,retreg,retreg /* shift retreg with/into carry */
  735. ds tmp,arg1, tmp /* 31st divide step */
  736. addc retreg,retreg,retreg /* shift retreg with/into carry */
  737. ds tmp,arg1, tmp /* 32nd divide step, */
  738. addc retreg,retreg,retreg /* shift last bit into retreg */
  739. movb,>=,n tmp,retreg,LREF(finish) /* branch if pos. tmp */
  740. add,< arg1,0,0 /* if arg1 > 0, add arg1 */
  741. add,tr tmp,arg1,retreg /* for correcting remainder tmp */
  742. sub tmp,arg1,retreg /* else add absolute value arg1 */
  743. LSYM(finish)
  744. add,>= arg0,0,0 /* set sign of remainder */
  745. sub 0,retreg,retreg /* to sign of dividend */
  746. MILLIRET
  747. nop
  748. .exit
  749. .procend
  750. #ifdef milliext
  751. .origin 0x00000200
  752. #endif
  753. .end
  754. #endif
  755. #ifdef L_remU
  756. /* ROUTINE: $$remU
  757. . Single precision divide for remainder with unsigned binary integers.
  758. .
  759. . The remainder must be dividend-(dividend/divisor)*divisor.
  760. . Divide by zero is trapped.
  761. INPUT REGISTERS:
  762. . arg0 == dividend
  763. . arg1 == divisor
  764. . mrp == return pc
  765. . sr0 == return space when called externally
  766. OUTPUT REGISTERS:
  767. . arg0 = undefined
  768. . arg1 = undefined
  769. . ret1 = remainder
  770. OTHER REGISTERS AFFECTED:
  771. . r1 = undefined
  772. SIDE EFFECTS:
  773. . Causes a trap under the following conditions: DIVIDE BY ZERO
  774. . Changes memory at the following places: NONE
  775. PERMISSIBLE CONTEXT:
  776. . Unwindable.
  777. . Does not create a stack frame.
  778. . Suitable for internal or external millicode.
  779. . Assumes the special millicode register conventions.
  780. DISCUSSION:
  781. . Calls other millicode routines using mrp: NONE
  782. . Calls other millicode routines: NONE */
  783. RDEFINE(temp,r1)
  784. RDEFINE(rmndr,ret1) /* r29 */
  785. SUBSPA_MILLI
  786. ATTR_MILLI
  787. .export $$remU,millicode
  788. .proc
  789. .callinfo millicode
  790. .entry
  791. GSYM($$remU)
  792. ldo -1(arg1),temp /* is there at most one bit set ? */
  793. and,= arg1,temp,r0 /* if not, don't use power of 2 */
  794. b LREF(regular_seq)
  795. addit,= 0,arg1,r0 /* trap on div by zero */
  796. and arg0,temp,rmndr /* get the result for power of 2 */
  797. MILLIRETN
  798. LSYM(regular_seq)
  799. comib,>=,n 0,arg1,LREF(special_case)
  800. subi 0,arg1,rmndr /* clear carry, negate the divisor */
  801. ds r0,rmndr,r0 /* set V-bit to 1 */
  802. add arg0,arg0,temp /* shift msb bit into carry */
  803. ds r0,arg1,rmndr /* 1st divide step, if no carry */
  804. addc temp,temp,temp /* shift temp with/into carry */
  805. ds rmndr,arg1,rmndr /* 2nd divide step */
  806. addc temp,temp,temp /* shift temp with/into carry */
  807. ds rmndr,arg1,rmndr /* 3rd divide step */
  808. addc temp,temp,temp /* shift temp with/into carry */
  809. ds rmndr,arg1,rmndr /* 4th divide step */
  810. addc temp,temp,temp /* shift temp with/into carry */
  811. ds rmndr,arg1,rmndr /* 5th divide step */
  812. addc temp,temp,temp /* shift temp with/into carry */
  813. ds rmndr,arg1,rmndr /* 6th divide step */
  814. addc temp,temp,temp /* shift temp with/into carry */
  815. ds rmndr,arg1,rmndr /* 7th divide step */
  816. addc temp,temp,temp /* shift temp with/into carry */
  817. ds rmndr,arg1,rmndr /* 8th divide step */
  818. addc temp,temp,temp /* shift temp with/into carry */
  819. ds rmndr,arg1,rmndr /* 9th divide step */
  820. addc temp,temp,temp /* shift temp with/into carry */
  821. ds rmndr,arg1,rmndr /* 10th divide step */
  822. addc temp,temp,temp /* shift temp with/into carry */
  823. ds rmndr,arg1,rmndr /* 11th divide step */
  824. addc temp,temp,temp /* shift temp with/into carry */
  825. ds rmndr,arg1,rmndr /* 12th divide step */
  826. addc temp,temp,temp /* shift temp with/into carry */
  827. ds rmndr,arg1,rmndr /* 13th divide step */
  828. addc temp,temp,temp /* shift temp with/into carry */
  829. ds rmndr,arg1,rmndr /* 14th divide step */
  830. addc temp,temp,temp /* shift temp with/into carry */
  831. ds rmndr,arg1,rmndr /* 15th divide step */
  832. addc temp,temp,temp /* shift temp with/into carry */
  833. ds rmndr,arg1,rmndr /* 16th divide step */
  834. addc temp,temp,temp /* shift temp with/into carry */
  835. ds rmndr,arg1,rmndr /* 17th divide step */
  836. addc temp,temp,temp /* shift temp with/into carry */
  837. ds rmndr,arg1,rmndr /* 18th divide step */
  838. addc temp,temp,temp /* shift temp with/into carry */
  839. ds rmndr,arg1,rmndr /* 19th divide step */
  840. addc temp,temp,temp /* shift temp with/into carry */
  841. ds rmndr,arg1,rmndr /* 20th divide step */
  842. addc temp,temp,temp /* shift temp with/into carry */
  843. ds rmndr,arg1,rmndr /* 21st divide step */
  844. addc temp,temp,temp /* shift temp with/into carry */
  845. ds rmndr,arg1,rmndr /* 22nd divide step */
  846. addc temp,temp,temp /* shift temp with/into carry */
  847. ds rmndr,arg1,rmndr /* 23rd divide step */
  848. addc temp,temp,temp /* shift temp with/into carry */
  849. ds rmndr,arg1,rmndr /* 24th divide step */
  850. addc temp,temp,temp /* shift temp with/into carry */
  851. ds rmndr,arg1,rmndr /* 25th divide step */
  852. addc temp,temp,temp /* shift temp with/into carry */
  853. ds rmndr,arg1,rmndr /* 26th divide step */
  854. addc temp,temp,temp /* shift temp with/into carry */
  855. ds rmndr,arg1,rmndr /* 27th divide step */
  856. addc temp,temp,temp /* shift temp with/into carry */
  857. ds rmndr,arg1,rmndr /* 28th divide step */
  858. addc temp,temp,temp /* shift temp with/into carry */
  859. ds rmndr,arg1,rmndr /* 29th divide step */
  860. addc temp,temp,temp /* shift temp with/into carry */
  861. ds rmndr,arg1,rmndr /* 30th divide step */
  862. addc temp,temp,temp /* shift temp with/into carry */
  863. ds rmndr,arg1,rmndr /* 31st divide step */
  864. addc temp,temp,temp /* shift temp with/into carry */
  865. ds rmndr,arg1,rmndr /* 32nd divide step, */
  866. comiclr,<= 0,rmndr,r0
  867. add rmndr,arg1,rmndr /* correction */
  868. MILLIRETN
  869. nop
  870. /* Putting >= on the last DS and deleting COMICLR does not work! */
  871. LSYM(special_case)
  872. sub,>>= arg0,arg1,rmndr
  873. copy arg0,rmndr
  874. MILLIRETN
  875. nop
  876. .exit
  877. .procend
  878. .end
  879. #endif
  880. #ifdef L_div_const
  881. /* ROUTINE: $$divI_2
  882. . $$divI_3 $$divU_3
  883. . $$divI_4
  884. . $$divI_5 $$divU_5
  885. . $$divI_6 $$divU_6
  886. . $$divI_7 $$divU_7
  887. . $$divI_8
  888. . $$divI_9 $$divU_9
  889. . $$divI_10 $$divU_10
  890. .
  891. . $$divI_12 $$divU_12
  892. .
  893. . $$divI_14 $$divU_14
  894. . $$divI_15 $$divU_15
  895. . $$divI_16
  896. . $$divI_17 $$divU_17
  897. .
  898. . Divide by selected constants for single precision binary integers.
  899. INPUT REGISTERS:
  900. . arg0 == dividend
  901. . mrp == return pc
  902. . sr0 == return space when called externally
  903. OUTPUT REGISTERS:
  904. . arg0 = undefined
  905. . arg1 = undefined
  906. . ret1 = quotient
  907. OTHER REGISTERS AFFECTED:
  908. . r1 = undefined
  909. SIDE EFFECTS:
  910. . Causes a trap under the following conditions: NONE
  911. . Changes memory at the following places: NONE
  912. PERMISSIBLE CONTEXT:
  913. . Unwindable.
  914. . Does not create a stack frame.
  915. . Suitable for internal or external millicode.
  916. . Assumes the special millicode register conventions.
  917. DISCUSSION:
  918. . Calls other millicode routines using mrp: NONE
  919. . Calls other millicode routines: NONE */
  920. /* TRUNCATED DIVISION BY SMALL INTEGERS
  921. We are interested in q(x) = floor(x/y), where x >= 0 and y > 0
  922. (with y fixed).
  923. Let a = floor(z/y), for some choice of z. Note that z will be
  924. chosen so that division by z is cheap.
  925. Let r be the remainder(z/y). In other words, r = z - ay.
  926. Now, our method is to choose a value for b such that
  927. q'(x) = floor((ax+b)/z)
  928. is equal to q(x) over as large a range of x as possible. If the
  929. two are equal over a sufficiently large range, and if it is easy to
  930. form the product (ax), and it is easy to divide by z, then we can
  931. perform the division much faster than the general division algorithm.
  932. So, we want the following to be true:
  933. . For x in the following range:
  934. .
  935. . ky <= x < (k+1)y
  936. .
  937. . implies that
  938. .
  939. . k <= (ax+b)/z < (k+1)
  940. We want to determine b such that this is true for all k in the
  941. range {0..K} for some maximum K.
  942. Since (ax+b) is an increasing function of x, we can take each
  943. bound separately to determine the "best" value for b.
  944. (ax+b)/z < (k+1) implies
  945. (a((k+1)y-1)+b < (k+1)z implies
  946. b < a + (k+1)(z-ay) implies
  947. b < a + (k+1)r
  948. This needs to be true for all k in the range {0..K}. In
  949. particular, it is true for k = 0 and this leads to a maximum
  950. acceptable value for b.
  951. b < a+r or b <= a+r-1
  952. Taking the other bound, we have
  953. k <= (ax+b)/z implies
  954. k <= (aky+b)/z implies
  955. k(z-ay) <= b implies
  956. kr <= b
  957. Clearly, the largest range for k will be achieved by maximizing b,
  958. when r is not zero. When r is zero, then the simplest choice for b
  959. is 0. When r is not 0, set
  960. . b = a+r-1
  961. Now, by construction, q'(x) = floor((ax+b)/z) = q(x) = floor(x/y)
  962. for all x in the range:
  963. . 0 <= x < (K+1)y
  964. We need to determine what K is. Of our two bounds,
  965. . b < a+(k+1)r is satisfied for all k >= 0, by construction.
  966. The other bound is
  967. . kr <= b
  968. This is always true if r = 0. If r is not 0 (the usual case), then
  969. K = floor((a+r-1)/r), is the maximum value for k.
  970. Therefore, the formula q'(x) = floor((ax+b)/z) yields the correct
  971. answer for q(x) = floor(x/y) when x is in the range
  972. (0,(K+1)y-1) K = floor((a+r-1)/r)
  973. To be most useful, we want (K+1)y-1 = (max x) >= 2**32-1 so that
  974. the formula for q'(x) yields the correct value of q(x) for all x
  975. representable by a single word in HPPA.
  976. We are also constrained in that computing the product (ax), adding
  977. b, and dividing by z must all be done quickly, otherwise we will be
  978. better off going through the general algorithm using the DS
  979. instruction, which uses approximately 70 cycles.
  980. For each y, there is a choice of z which satisfies the constraints
  981. for (K+1)y >= 2**32. We may not, however, be able to satisfy the
  982. timing constraints for arbitrary y. It seems that z being equal to
  983. a power of 2 or a power of 2 minus 1 is as good as we can do, since
  984. it minimizes the time to do division by z. We want the choice of z
  985. to also result in a value for (a) that minimizes the computation of
  986. the product (ax). This is best achieved if (a) has a regular bit
  987. pattern (so the multiplication can be done with shifts and adds).
  988. The value of (a) also needs to be less than 2**32 so the product is
  989. always guaranteed to fit in 2 words.
  990. In actual practice, the following should be done:
  991. 1) For negative x, you should take the absolute value and remember
  992. . the fact so that the result can be negated. This obviously does
  993. . not apply in the unsigned case.
  994. 2) For even y, you should factor out the power of 2 that divides y
  995. . and divide x by it. You can then proceed by dividing by the
  996. . odd factor of y.
  997. Here is a table of some odd values of y, and corresponding choices
  998. for z which are "good".
  999. y z r a (hex) max x (hex)
  1000. 3 2**32 1 55555555 100000001
  1001. 5 2**32 1 33333333 100000003
  1002. 7 2**24-1 0 249249 (infinite)
  1003. 9 2**24-1 0 1c71c7 (infinite)
  1004. 11 2**20-1 0 1745d (infinite)
  1005. 13 2**24-1 0 13b13b (infinite)
  1006. 15 2**32 1 11111111 10000000d
  1007. 17 2**32 1 f0f0f0f 10000000f
  1008. If r is 1, then b = a+r-1 = a. This simplifies the computation
  1009. of (ax+b), since you can compute (x+1)(a) instead. If r is 0,
  1010. then b = 0 is ok to use which simplifies (ax+b).
  1011. The bit patterns for 55555555, 33333333, and 11111111 are obviously
  1012. very regular. The bit patterns for the other values of a above are:
  1013. y (hex) (binary)
  1014. 7 249249 001001001001001001001001 << regular >>
  1015. 9 1c71c7 000111000111000111000111 << regular >>
  1016. 11 1745d 000000010111010001011101 << irregular >>
  1017. 13 13b13b 000100111011000100111011 << irregular >>
  1018. The bit patterns for (a) corresponding to (y) of 11 and 13 may be
  1019. too irregular to warrant using this method.
  1020. When z is a power of 2 minus 1, then the division by z is slightly
  1021. more complicated, involving an iterative solution.
  1022. The code presented here solves division by 1 through 17, except for
  1023. 11 and 13. There are algorithms for both signed and unsigned
  1024. quantities given.
  1025. TIMINGS (cycles)
  1026. divisor positive negative unsigned
  1027. . 1 2 2 2
  1028. . 2 4 4 2
  1029. . 3 19 21 19
  1030. . 4 4 4 2
  1031. . 5 18 22 19
  1032. . 6 19 22 19
  1033. . 8 4 4 2
  1034. . 10 18 19 17
  1035. . 12 18 20 18
  1036. . 15 16 18 16
  1037. . 16 4 4 2
  1038. . 17 16 18 16
  1039. Now, the algorithm for 7, 9, and 14 is an iterative one. That is,
  1040. a loop body is executed until the tentative quotient is 0. The
  1041. number of times the loop body is executed varies depending on the
  1042. dividend, but is never more than two times. If the dividend is
  1043. less than the divisor, then the loop body is not executed at all.
  1044. Each iteration adds 4 cycles to the timings.
  1045. divisor positive negative unsigned
  1046. . 7 19+4n 20+4n 20+4n n = number of iterations
  1047. . 9 21+4n 22+4n 21+4n
  1048. . 14 21+4n 22+4n 20+4n
  1049. To give an idea of how the number of iterations varies, here is a
  1050. table of dividend versus number of iterations when dividing by 7.
  1051. smallest largest required
  1052. dividend dividend iterations
  1053. . 0 6 0
  1054. . 7 0x6ffffff 1
  1055. 0x1000006 0xffffffff 2
  1056. There is some overlap in the range of numbers requiring 1 and 2
  1057. iterations. */
  1058. RDEFINE(t2,r1)
  1059. RDEFINE(x2,arg0) /* r26 */
  1060. RDEFINE(t1,arg1) /* r25 */
  1061. RDEFINE(x1,ret1) /* r29 */
  1062. SUBSPA_MILLI_DIV
  1063. ATTR_MILLI
  1064. .proc
  1065. .callinfo millicode
  1066. .entry
  1067. /* NONE of these routines require a stack frame
  1068. ALL of these routines are unwindable from millicode */
  1069. GSYM($$divide_by_constant)
  1070. .export $$divide_by_constant,millicode
  1071. /* Provides a "nice" label for the code covered by the unwind descriptor
  1072. for things like gprof. */
  1073. /* DIVISION BY 2 (shift by 1) */
  1074. GSYM($$divI_2)
  1075. .export $$divI_2,millicode
  1076. comclr,>= arg0,0,0
  1077. addi 1,arg0,arg0
  1078. MILLIRET
  1079. extrs arg0,30,31,ret1
  1080. /* DIVISION BY 4 (shift by 2) */
  1081. GSYM($$divI_4)
  1082. .export $$divI_4,millicode
  1083. comclr,>= arg0,0,0
  1084. addi 3,arg0,arg0
  1085. MILLIRET
  1086. extrs arg0,29,30,ret1
  1087. /* DIVISION BY 8 (shift by 3) */
  1088. GSYM($$divI_8)
  1089. .export $$divI_8,millicode
  1090. comclr,>= arg0,0,0
  1091. addi 7,arg0,arg0
  1092. MILLIRET
  1093. extrs arg0,28,29,ret1
  1094. /* DIVISION BY 16 (shift by 4) */
  1095. GSYM($$divI_16)
  1096. .export $$divI_16,millicode
  1097. comclr,>= arg0,0,0
  1098. addi 15,arg0,arg0
  1099. MILLIRET
  1100. extrs arg0,27,28,ret1
  1101. /****************************************************************************
  1102. *
  1103. * DIVISION BY DIVISORS OF FFFFFFFF, and powers of 2 times these
  1104. *
  1105. * includes 3,5,15,17 and also 6,10,12
  1106. *
  1107. ****************************************************************************/
  1108. /* DIVISION BY 3 (use z = 2**32; a = 55555555) */
  1109. GSYM($$divI_3)
  1110. .export $$divI_3,millicode
  1111. comb,<,N x2,0,LREF(neg3)
  1112. addi 1,x2,x2 /* this cannot overflow */
  1113. extru x2,1,2,x1 /* multiply by 5 to get started */
  1114. sh2add x2,x2,x2
  1115. b LREF(pos)
  1116. addc x1,0,x1
  1117. LSYM(neg3)
  1118. subi 1,x2,x2 /* this cannot overflow */
  1119. extru x2,1,2,x1 /* multiply by 5 to get started */
  1120. sh2add x2,x2,x2
  1121. b LREF(neg)
  1122. addc x1,0,x1
  1123. GSYM($$divU_3)
  1124. .export $$divU_3,millicode
  1125. addi 1,x2,x2 /* this CAN overflow */
  1126. addc 0,0,x1
  1127. shd x1,x2,30,t1 /* multiply by 5 to get started */
  1128. sh2add x2,x2,x2
  1129. b LREF(pos)
  1130. addc x1,t1,x1
  1131. /* DIVISION BY 5 (use z = 2**32; a = 33333333) */
  1132. GSYM($$divI_5)
  1133. .export $$divI_5,millicode
  1134. comb,<,N x2,0,LREF(neg5)
  1135. addi 3,x2,t1 /* this cannot overflow */
  1136. sh1add x2,t1,x2 /* multiply by 3 to get started */
  1137. b LREF(pos)
  1138. addc 0,0,x1
  1139. LSYM(neg5)
  1140. sub 0,x2,x2 /* negate x2 */
  1141. addi 1,x2,x2 /* this cannot overflow */
  1142. shd 0,x2,31,x1 /* get top bit (can be 1) */
  1143. sh1add x2,x2,x2 /* multiply by 3 to get started */
  1144. b LREF(neg)
  1145. addc x1,0,x1
  1146. GSYM($$divU_5)
  1147. .export $$divU_5,millicode
  1148. addi 1,x2,x2 /* this CAN overflow */
  1149. addc 0,0,x1
  1150. shd x1,x2,31,t1 /* multiply by 3 to get started */
  1151. sh1add x2,x2,x2
  1152. b LREF(pos)
  1153. addc t1,x1,x1
  1154. /* DIVISION BY 6 (shift to divide by 2 then divide by 3) */
  1155. GSYM($$divI_6)
  1156. .export $$divI_6,millicode
  1157. comb,<,N x2,0,LREF(neg6)
  1158. extru x2,30,31,x2 /* divide by 2 */
  1159. addi 5,x2,t1 /* compute 5*(x2+1) = 5*x2+5 */
  1160. sh2add x2,t1,x2 /* multiply by 5 to get started */
  1161. b LREF(pos)
  1162. addc 0,0,x1
  1163. LSYM(neg6)
  1164. subi 2,x2,x2 /* negate, divide by 2, and add 1 */
  1165. /* negation and adding 1 are done */
  1166. /* at the same time by the SUBI */
  1167. extru x2,30,31,x2
  1168. shd 0,x2,30,x1
  1169. sh2add x2,x2,x2 /* multiply by 5 to get started */
  1170. b LREF(neg)
  1171. addc x1,0,x1
  1172. GSYM($$divU_6)
  1173. .export $$divU_6,millicode
  1174. extru x2,30,31,x2 /* divide by 2 */
  1175. addi 1,x2,x2 /* cannot carry */
  1176. shd 0,x2,30,x1 /* multiply by 5 to get started */
  1177. sh2add x2,x2,x2
  1178. b LREF(pos)
  1179. addc x1,0,x1
  1180. /* DIVISION BY 10 (shift to divide by 2 then divide by 5) */
  1181. GSYM($$divU_10)
  1182. .export $$divU_10,millicode
  1183. extru x2,30,31,x2 /* divide by 2 */
  1184. addi 3,x2,t1 /* compute 3*(x2+1) = (3*x2)+3 */
  1185. sh1add x2,t1,x2 /* multiply by 3 to get started */
  1186. addc 0,0,x1
  1187. LSYM(pos)
  1188. shd x1,x2,28,t1 /* multiply by 0x11 */
  1189. shd x2,0,28,t2
  1190. add x2,t2,x2
  1191. addc x1,t1,x1
  1192. LSYM(pos_for_17)
  1193. shd x1,x2,24,t1 /* multiply by 0x101 */
  1194. shd x2,0,24,t2
  1195. add x2,t2,x2
  1196. addc x1,t1,x1
  1197. shd x1,x2,16,t1 /* multiply by 0x10001 */
  1198. shd x2,0,16,t2
  1199. add x2,t2,x2
  1200. MILLIRET
  1201. addc x1,t1,x1
  1202. GSYM($$divI_10)
  1203. .export $$divI_10,millicode
  1204. comb,< x2,0,LREF(neg10)
  1205. copy 0,x1
  1206. extru x2,30,31,x2 /* divide by 2 */
  1207. addib,TR 1,x2,LREF(pos) /* add 1 (cannot overflow) */
  1208. sh1add x2,x2,x2 /* multiply by 3 to get started */
  1209. LSYM(neg10)
  1210. subi 2,x2,x2 /* negate, divide by 2, and add 1 */
  1211. /* negation and adding 1 are done */
  1212. /* at the same time by the SUBI */
  1213. extru x2,30,31,x2
  1214. sh1add x2,x2,x2 /* multiply by 3 to get started */
  1215. LSYM(neg)
  1216. shd x1,x2,28,t1 /* multiply by 0x11 */
  1217. shd x2,0,28,t2
  1218. add x2,t2,x2
  1219. addc x1,t1,x1
  1220. LSYM(neg_for_17)
  1221. shd x1,x2,24,t1 /* multiply by 0x101 */
  1222. shd x2,0,24,t2
  1223. add x2,t2,x2
  1224. addc x1,t1,x1
  1225. shd x1,x2,16,t1 /* multiply by 0x10001 */
  1226. shd x2,0,16,t2
  1227. add x2,t2,x2
  1228. addc x1,t1,x1
  1229. MILLIRET
  1230. sub 0,x1,x1
  1231. /* DIVISION BY 12 (shift to divide by 4 then divide by 3) */
  1232. GSYM($$divI_12)
  1233. .export $$divI_12,millicode
  1234. comb,< x2,0,LREF(neg12)
  1235. copy 0,x1
  1236. extru x2,29,30,x2 /* divide by 4 */
  1237. addib,tr 1,x2,LREF(pos) /* compute 5*(x2+1) = 5*x2+5 */
  1238. sh2add x2,x2,x2 /* multiply by 5 to get started */
  1239. LSYM(neg12)
  1240. subi 4,x2,x2 /* negate, divide by 4, and add 1 */
  1241. /* negation and adding 1 are done */
  1242. /* at the same time by the SUBI */
  1243. extru x2,29,30,x2
  1244. b LREF(neg)
  1245. sh2add x2,x2,x2 /* multiply by 5 to get started */
  1246. GSYM($$divU_12)
  1247. .export $$divU_12,millicode
  1248. extru x2,29,30,x2 /* divide by 4 */
  1249. addi 5,x2,t1 /* cannot carry */
  1250. sh2add x2,t1,x2 /* multiply by 5 to get started */
  1251. b LREF(pos)
  1252. addc 0,0,x1
  1253. /* DIVISION BY 15 (use z = 2**32; a = 11111111) */
  1254. GSYM($$divI_15)
  1255. .export $$divI_15,millicode
  1256. comb,< x2,0,LREF(neg15)
  1257. copy 0,x1
  1258. addib,tr 1,x2,LREF(pos)+4
  1259. shd x1,x2,28,t1
  1260. LSYM(neg15)
  1261. b LREF(neg)
  1262. subi 1,x2,x2
  1263. GSYM($$divU_15)
  1264. .export $$divU_15,millicode
  1265. addi 1,x2,x2 /* this CAN overflow */
  1266. b LREF(pos)
  1267. addc 0,0,x1
  1268. /* DIVISION BY 17 (use z = 2**32; a = f0f0f0f) */
  1269. GSYM($$divI_17)
  1270. .export $$divI_17,millicode
  1271. comb,<,n x2,0,LREF(neg17)
  1272. addi 1,x2,x2 /* this cannot overflow */
  1273. shd 0,x2,28,t1 /* multiply by 0xf to get started */
  1274. shd x2,0,28,t2
  1275. sub t2,x2,x2
  1276. b LREF(pos_for_17)
  1277. subb t1,0,x1
  1278. LSYM(neg17)
  1279. subi 1,x2,x2 /* this cannot overflow */
  1280. shd 0,x2,28,t1 /* multiply by 0xf to get started */
  1281. shd x2,0,28,t2
  1282. sub t2,x2,x2
  1283. b LREF(neg_for_17)
  1284. subb t1,0,x1
  1285. GSYM($$divU_17)
  1286. .export $$divU_17,millicode
  1287. addi 1,x2,x2 /* this CAN overflow */
  1288. addc 0,0,x1
  1289. shd x1,x2,28,t1 /* multiply by 0xf to get started */
  1290. LSYM(u17)
  1291. shd x2,0,28,t2
  1292. sub t2,x2,x2
  1293. b LREF(pos_for_17)
  1294. subb t1,x1,x1
  1295. /* DIVISION BY DIVISORS OF FFFFFF, and powers of 2 times these
  1296. includes 7,9 and also 14
  1297. z = 2**24-1
  1298. r = z mod x = 0
  1299. so choose b = 0
  1300. Also, in order to divide by z = 2**24-1, we approximate by dividing
  1301. by (z+1) = 2**24 (which is easy), and then correcting.
  1302. (ax) = (z+1)q' + r
  1303. . = zq' + (q'+r)
  1304. So to compute (ax)/z, compute q' = (ax)/(z+1) and r = (ax) mod (z+1)
  1305. Then the true remainder of (ax)/z is (q'+r). Repeat the process
  1306. with this new remainder, adding the tentative quotients together,
  1307. until a tentative quotient is 0 (and then we are done). There is
  1308. one last correction to be done. It is possible that (q'+r) = z.
  1309. If so, then (q'+r)/(z+1) = 0 and it looks like we are done. But,
  1310. in fact, we need to add 1 more to the quotient. Now, it turns
  1311. out that this happens if and only if the original value x is
  1312. an exact multiple of y. So, to avoid a three instruction test at
  1313. the end, instead use 1 instruction to add 1 to x at the beginning. */
  1314. /* DIVISION BY 7 (use z = 2**24-1; a = 249249) */
  1315. GSYM($$divI_7)
  1316. .export $$divI_7,millicode
  1317. comb,<,n x2,0,LREF(neg7)
  1318. LSYM(7)
  1319. addi 1,x2,x2 /* cannot overflow */
  1320. shd 0,x2,29,x1
  1321. sh3add x2,x2,x2
  1322. addc x1,0,x1
  1323. LSYM(pos7)
  1324. shd x1,x2,26,t1
  1325. shd x2,0,26,t2
  1326. add x2,t2,x2
  1327. addc x1,t1,x1
  1328. shd x1,x2,20,t1
  1329. shd x2,0,20,t2
  1330. add x2,t2,x2
  1331. addc x1,t1,t1
  1332. /* computed <t1,x2>. Now divide it by (2**24 - 1) */
  1333. copy 0,x1
  1334. shd,= t1,x2,24,t1 /* tentative quotient */
  1335. LSYM(1)
  1336. addb,tr t1,x1,LREF(2) /* add to previous quotient */
  1337. extru x2,31,24,x2 /* new remainder (unadjusted) */
  1338. MILLIRETN
  1339. LSYM(2)
  1340. addb,tr t1,x2,LREF(1) /* adjust remainder */
  1341. extru,= x2,7,8,t1 /* new quotient */
  1342. LSYM(neg7)
  1343. subi 1,x2,x2 /* negate x2 and add 1 */
  1344. LSYM(8)
  1345. shd 0,x2,29,x1
  1346. sh3add x2,x2,x2
  1347. addc x1,0,x1
  1348. LSYM(neg7_shift)
  1349. shd x1,x2,26,t1
  1350. shd x2,0,26,t2
  1351. add x2,t2,x2
  1352. addc x1,t1,x1
  1353. shd x1,x2,20,t1
  1354. shd x2,0,20,t2
  1355. add x2,t2,x2
  1356. addc x1,t1,t1
  1357. /* computed <t1,x2>. Now divide it by (2**24 - 1) */
  1358. copy 0,x1
  1359. shd,= t1,x2,24,t1 /* tentative quotient */
  1360. LSYM(3)
  1361. addb,tr t1,x1,LREF(4) /* add to previous quotient */
  1362. extru x2,31,24,x2 /* new remainder (unadjusted) */
  1363. MILLIRET
  1364. sub 0,x1,x1 /* negate result */
  1365. LSYM(4)
  1366. addb,tr t1,x2,LREF(3) /* adjust remainder */
  1367. extru,= x2,7,8,t1 /* new quotient */
  1368. GSYM($$divU_7)
  1369. .export $$divU_7,millicode
  1370. addi 1,x2,x2 /* can carry */
  1371. addc 0,0,x1
  1372. shd x1,x2,29,t1
  1373. sh3add x2,x2,x2
  1374. b LREF(pos7)
  1375. addc t1,x1,x1
  1376. /* DIVISION BY 9 (use z = 2**24-1; a = 1c71c7) */
  1377. GSYM($$divI_9)
  1378. .export $$divI_9,millicode
  1379. comb,<,n x2,0,LREF(neg9)
  1380. addi 1,x2,x2 /* cannot overflow */
  1381. shd 0,x2,29,t1
  1382. shd x2,0,29,t2
  1383. sub t2,x2,x2
  1384. b LREF(pos7)
  1385. subb t1,0,x1
  1386. LSYM(neg9)
  1387. subi 1,x2,x2 /* negate and add 1 */
  1388. shd 0,x2,29,t1
  1389. shd x2,0,29,t2
  1390. sub t2,x2,x2
  1391. b LREF(neg7_shift)
  1392. subb t1,0,x1
  1393. GSYM($$divU_9)
  1394. .export $$divU_9,millicode
  1395. addi 1,x2,x2 /* can carry */
  1396. addc 0,0,x1
  1397. shd x1,x2,29,t1
  1398. shd x2,0,29,t2
  1399. sub t2,x2,x2
  1400. b LREF(pos7)
  1401. subb t1,x1,x1
  1402. /* DIVISION BY 14 (shift to divide by 2 then divide by 7) */
  1403. GSYM($$divI_14)
  1404. .export $$divI_14,millicode
  1405. comb,<,n x2,0,LREF(neg14)
  1406. GSYM($$divU_14)
  1407. .export $$divU_14,millicode
  1408. b LREF(7) /* go to 7 case */
  1409. extru x2,30,31,x2 /* divide by 2 */
  1410. LSYM(neg14)
  1411. subi 2,x2,x2 /* negate (and add 2) */
  1412. b LREF(8)
  1413. extru x2,30,31,x2 /* divide by 2 */
  1414. .exit
  1415. .procend
  1416. .end
  1417. #endif
  1418. #ifdef L_mulI
  1419. /* VERSION "@(#)$$mulI $ Revision: 12.4 $ $ Date: 94/03/17 17:18:51 $" */
  1420. /******************************************************************************
  1421. This routine is used on PA2.0 processors when gcc -mno-fpregs is used
  1422. ROUTINE: $$mulI
  1423. DESCRIPTION:
  1424. $$mulI multiplies two single word integers, giving a single
  1425. word result.
  1426. INPUT REGISTERS:
  1427. arg0 = Operand 1
  1428. arg1 = Operand 2
  1429. r31 == return pc
  1430. sr0 == return space when called externally
  1431. OUTPUT REGISTERS:
  1432. arg0 = undefined
  1433. arg1 = undefined
  1434. ret1 = result
  1435. OTHER REGISTERS AFFECTED:
  1436. r1 = undefined
  1437. SIDE EFFECTS:
  1438. Causes a trap under the following conditions: NONE
  1439. Changes memory at the following places: NONE
  1440. PERMISSIBLE CONTEXT:
  1441. Unwindable
  1442. Does not create a stack frame
  1443. Is usable for internal or external microcode
  1444. DISCUSSION:
  1445. Calls other millicode routines via mrp: NONE
  1446. Calls other millicode routines: NONE
  1447. ***************************************************************************/
  1448. #define a0 %arg0
  1449. #define a1 %arg1
  1450. #define t0 %r1
  1451. #define r %ret1
  1452. #define a0__128a0 zdep a0,24,25,a0
  1453. #define a0__256a0 zdep a0,23,24,a0
  1454. #define a1_ne_0_b_l0 comb,<> a1,0,LREF(l0)
  1455. #define a1_ne_0_b_l1 comb,<> a1,0,LREF(l1)
  1456. #define a1_ne_0_b_l2 comb,<> a1,0,LREF(l2)
  1457. #define b_n_ret_t0 b,n LREF(ret_t0)
  1458. #define b_e_shift b LREF(e_shift)
  1459. #define b_e_t0ma0 b LREF(e_t0ma0)
  1460. #define b_e_t0 b LREF(e_t0)
  1461. #define b_e_t0a0 b LREF(e_t0a0)
  1462. #define b_e_t02a0 b LREF(e_t02a0)
  1463. #define b_e_t04a0 b LREF(e_t04a0)
  1464. #define b_e_2t0 b LREF(e_2t0)
  1465. #define b_e_2t0a0 b LREF(e_2t0a0)
  1466. #define b_e_2t04a0 b LREF(e2t04a0)
  1467. #define b_e_3t0 b LREF(e_3t0)
  1468. #define b_e_4t0 b LREF(e_4t0)
  1469. #define b_e_4t0a0 b LREF(e_4t0a0)
  1470. #define b_e_4t08a0 b LREF(e4t08a0)
  1471. #define b_e_5t0 b LREF(e_5t0)
  1472. #define b_e_8t0 b LREF(e_8t0)
  1473. #define b_e_8t0a0 b LREF(e_8t0a0)
  1474. #define r__r_a0 add r,a0,r
  1475. #define r__r_2a0 sh1add a0,r,r
  1476. #define r__r_4a0 sh2add a0,r,r
  1477. #define r__r_8a0 sh3add a0,r,r
  1478. #define r__r_t0 add r,t0,r
  1479. #define r__r_2t0 sh1add t0,r,r
  1480. #define r__r_4t0 sh2add t0,r,r
  1481. #define r__r_8t0 sh3add t0,r,r
  1482. #define t0__3a0 sh1add a0,a0,t0
  1483. #define t0__4a0 sh2add a0,0,t0
  1484. #define t0__5a0 sh2add a0,a0,t0
  1485. #define t0__8a0 sh3add a0,0,t0
  1486. #define t0__9a0 sh3add a0,a0,t0
  1487. #define t0__16a0 zdep a0,27,28,t0
  1488. #define t0__32a0 zdep a0,26,27,t0
  1489. #define t0__64a0 zdep a0,25,26,t0
  1490. #define t0__128a0 zdep a0,24,25,t0
  1491. #define t0__t0ma0 sub t0,a0,t0
  1492. #define t0__t0_a0 add t0,a0,t0
  1493. #define t0__t0_2a0 sh1add a0,t0,t0
  1494. #define t0__t0_4a0 sh2add a0,t0,t0
  1495. #define t0__t0_8a0 sh3add a0,t0,t0
  1496. #define t0__2t0_a0 sh1add t0,a0,t0
  1497. #define t0__3t0 sh1add t0,t0,t0
  1498. #define t0__4t0 sh2add t0,0,t0
  1499. #define t0__4t0_a0 sh2add t0,a0,t0
  1500. #define t0__5t0 sh2add t0,t0,t0
  1501. #define t0__8t0 sh3add t0,0,t0
  1502. #define t0__8t0_a0 sh3add t0,a0,t0
  1503. #define t0__9t0 sh3add t0,t0,t0
  1504. #define t0__16t0 zdep t0,27,28,t0
  1505. #define t0__32t0 zdep t0,26,27,t0
  1506. #define t0__256a0 zdep a0,23,24,t0
  1507. SUBSPA_MILLI
  1508. ATTR_MILLI
  1509. .align 16
  1510. .proc
  1511. .callinfo millicode
  1512. .export $$mulI,millicode
  1513. GSYM($$mulI)
  1514. combt,<<= a1,a0,LREF(l4) /* swap args if unsigned a1>a0 */
  1515. copy 0,r /* zero out the result */
  1516. xor a0,a1,a0 /* swap a0 & a1 using the */
  1517. xor a0,a1,a1 /* old xor trick */
  1518. xor a0,a1,a0
  1519. LSYM(l4)
  1520. combt,<= 0,a0,LREF(l3) /* if a0>=0 then proceed like unsigned */
  1521. zdep a1,30,8,t0 /* t0 = (a1&0xff)<<1 ********* */
  1522. sub,> 0,a1,t0 /* otherwise negate both and */
  1523. combt,<=,n a0,t0,LREF(l2) /* swap back if |a0|<|a1| */
  1524. sub 0,a0,a1
  1525. movb,tr,n t0,a0,LREF(l2) /* 10th inst. */
  1526. LSYM(l0) r__r_t0 /* add in this partial product */
  1527. LSYM(l1) a0__256a0 /* a0 <<= 8 ****************** */
  1528. LSYM(l2) zdep a1,30,8,t0 /* t0 = (a1&0xff)<<1 ********* */
  1529. LSYM(l3) blr t0,0 /* case on these 8 bits ****** */
  1530. extru a1,23,24,a1 /* a1 >>= 8 ****************** */
  1531. /*16 insts before this. */
  1532. /* a0 <<= 8 ************************** */
  1533. LSYM(x0) a1_ne_0_b_l2 ! a0__256a0 ! MILLIRETN ! nop
  1534. LSYM(x1) a1_ne_0_b_l1 ! r__r_a0 ! MILLIRETN ! nop
  1535. LSYM(x2) a1_ne_0_b_l1 ! r__r_2a0 ! MILLIRETN ! nop
  1536. LSYM(x3) a1_ne_0_b_l0 ! t0__3a0 ! MILLIRET ! r__r_t0
  1537. LSYM(x4) a1_ne_0_b_l1 ! r__r_4a0 ! MILLIRETN ! nop
  1538. LSYM(x5) a1_ne_0_b_l0 ! t0__5a0 ! MILLIRET ! r__r_t0
  1539. LSYM(x6) t0__3a0 ! a1_ne_0_b_l1 ! r__r_2t0 ! MILLIRETN
  1540. LSYM(x7) t0__3a0 ! a1_ne_0_b_l0 ! r__r_4a0 ! b_n_ret_t0
  1541. LSYM(x8) a1_ne_0_b_l1 ! r__r_8a0 ! MILLIRETN ! nop
  1542. LSYM(x9) a1_ne_0_b_l0 ! t0__9a0 ! MILLIRET ! r__r_t0
  1543. LSYM(x10) t0__5a0 ! a1_ne_0_b_l1 ! r__r_2t0 ! MILLIRETN
  1544. LSYM(x11) t0__3a0 ! a1_ne_0_b_l0 ! r__r_8a0 ! b_n_ret_t0
  1545. LSYM(x12) t0__3a0 ! a1_ne_0_b_l1 ! r__r_4t0 ! MILLIRETN
  1546. LSYM(x13) t0__5a0 ! a1_ne_0_b_l0 ! r__r_8a0 ! b_n_ret_t0
  1547. LSYM(x14) t0__3a0 ! t0__2t0_a0 ! b_e_shift ! r__r_2t0
  1548. LSYM(x15) t0__5a0 ! a1_ne_0_b_l0 ! t0__3t0 ! b_n_ret_t0
  1549. LSYM(x16) t0__16a0 ! a1_ne_0_b_l1 ! r__r_t0 ! MILLIRETN
  1550. LSYM(x17) t0__9a0 ! a1_ne_0_b_l0 ! t0__t0_8a0 ! b_n_ret_t0
  1551. LSYM(x18) t0__9a0 ! a1_ne_0_b_l1 ! r__r_2t0 ! MILLIRETN
  1552. LSYM(x19) t0__9a0 ! a1_ne_0_b_l0 ! t0__2t0_a0 ! b_n_ret_t0
  1553. LSYM(x20) t0__5a0 ! a1_ne_0_b_l1 ! r__r_4t0 ! MILLIRETN
  1554. LSYM(x21) t0__5a0 ! a1_ne_0_b_l0 ! t0__4t0_a0 ! b_n_ret_t0
  1555. LSYM(x22) t0__5a0 ! t0__2t0_a0 ! b_e_shift ! r__r_2t0
  1556. LSYM(x23) t0__5a0 ! t0__2t0_a0 ! b_e_t0 ! t0__2t0_a0
  1557. LSYM(x24) t0__3a0 ! a1_ne_0_b_l1 ! r__r_8t0 ! MILLIRETN
  1558. LSYM(x25) t0__5a0 ! a1_ne_0_b_l0 ! t0__5t0 ! b_n_ret_t0
  1559. LSYM(x26) t0__3a0 ! t0__4t0_a0 ! b_e_shift ! r__r_2t0
  1560. LSYM(x27) t0__3a0 ! a1_ne_0_b_l0 ! t0__9t0 ! b_n_ret_t0
  1561. LSYM(x28) t0__3a0 ! t0__2t0_a0 ! b_e_shift ! r__r_4t0
  1562. LSYM(x29) t0__3a0 ! t0__2t0_a0 ! b_e_t0 ! t0__4t0_a0
  1563. LSYM(x30) t0__5a0 ! t0__3t0 ! b_e_shift ! r__r_2t0
  1564. LSYM(x31) t0__32a0 ! a1_ne_0_b_l0 ! t0__t0ma0 ! b_n_ret_t0
  1565. LSYM(x32) t0__32a0 ! a1_ne_0_b_l1 ! r__r_t0 ! MILLIRETN
  1566. LSYM(x33) t0__8a0 ! a1_ne_0_b_l0 ! t0__4t0_a0 ! b_n_ret_t0
  1567. LSYM(x34) t0__16a0 ! t0__t0_a0 ! b_e_shift ! r__r_2t0
  1568. LSYM(x35) t0__9a0 ! t0__3t0 ! b_e_t0 ! t0__t0_8a0
  1569. LSYM(x36) t0__9a0 ! a1_ne_0_b_l1 ! r__r_4t0 ! MILLIRETN
  1570. LSYM(x37) t0__9a0 ! a1_ne_0_b_l0 ! t0__4t0_a0 ! b_n_ret_t0
  1571. LSYM(x38) t0__9a0 ! t0__2t0_a0 ! b_e_shift ! r__r_2t0
  1572. LSYM(x39) t0__9a0 ! t0__2t0_a0 ! b_e_t0 ! t0__2t0_a0
  1573. LSYM(x40) t0__5a0 ! a1_ne_0_b_l1 ! r__r_8t0 ! MILLIRETN
  1574. LSYM(x41) t0__5a0 ! a1_ne_0_b_l0 ! t0__8t0_a0 ! b_n_ret_t0
  1575. LSYM(x42) t0__5a0 ! t0__4t0_a0 ! b_e_shift ! r__r_2t0
  1576. LSYM(x43) t0__5a0 ! t0__4t0_a0 ! b_e_t0 ! t0__2t0_a0
  1577. LSYM(x44) t0__5a0 ! t0__2t0_a0 ! b_e_shift ! r__r_4t0
  1578. LSYM(x45) t0__9a0 ! a1_ne_0_b_l0 ! t0__5t0 ! b_n_ret_t0
  1579. LSYM(x46) t0__9a0 ! t0__5t0 ! b_e_t0 ! t0__t0_a0
  1580. LSYM(x47) t0__9a0 ! t0__5t0 ! b_e_t0 ! t0__t0_2a0
  1581. LSYM(x48) t0__3a0 ! a1_ne_0_b_l0 ! t0__16t0 ! b_n_ret_t0
  1582. LSYM(x49) t0__9a0 ! t0__5t0 ! b_e_t0 ! t0__t0_4a0
  1583. LSYM(x50) t0__5a0 ! t0__5t0 ! b_e_shift ! r__r_2t0
  1584. LSYM(x51) t0__9a0 ! t0__t0_8a0 ! b_e_t0 ! t0__3t0
  1585. LSYM(x52) t0__3a0 ! t0__4t0_a0 ! b_e_shift ! r__r_4t0
  1586. LSYM(x53) t0__3a0 ! t0__4t0_a0 ! b_e_t0 ! t0__4t0_a0
  1587. LSYM(x54) t0__9a0 ! t0__3t0 ! b_e_shift ! r__r_2t0
  1588. LSYM(x55) t0__9a0 ! t0__3t0 ! b_e_t0 ! t0__2t0_a0
  1589. LSYM(x56) t0__3a0 ! t0__2t0_a0 ! b_e_shift ! r__r_8t0
  1590. LSYM(x57) t0__9a0 ! t0__2t0_a0 ! b_e_t0 ! t0__3t0
  1591. LSYM(x58) t0__3a0 ! t0__2t0_a0 ! b_e_2t0 ! t0__4t0_a0
  1592. LSYM(x59) t0__9a0 ! t0__2t0_a0 ! b_e_t02a0 ! t0__3t0
  1593. LSYM(x60) t0__5a0 ! t0__3t0 ! b_e_shift ! r__r_4t0
  1594. LSYM(x61) t0__5a0 ! t0__3t0 ! b_e_t0 ! t0__4t0_a0
  1595. LSYM(x62) t0__32a0 ! t0__t0ma0 ! b_e_shift ! r__r_2t0
  1596. LSYM(x63) t0__64a0 ! a1_ne_0_b_l0 ! t0__t0ma0 ! b_n_ret_t0
  1597. LSYM(x64) t0__64a0 ! a1_ne_0_b_l1 ! r__r_t0 ! MILLIRETN
  1598. LSYM(x65) t0__8a0 ! a1_ne_0_b_l0 ! t0__8t0_a0 ! b_n_ret_t0
  1599. LSYM(x66) t0__32a0 ! t0__t0_a0 ! b_e_shift ! r__r_2t0
  1600. LSYM(x67) t0__8a0 ! t0__4t0_a0 ! b_e_t0 ! t0__2t0_a0
  1601. LSYM(x68) t0__8a0 ! t0__2t0_a0 ! b_e_shift ! r__r_4t0
  1602. LSYM(x69) t0__8a0 ! t0__2t0_a0 ! b_e_t0 ! t0__4t0_a0
  1603. LSYM(x70) t0__64a0 ! t0__t0_4a0 ! b_e_t0 ! t0__t0_2a0
  1604. LSYM(x71) t0__9a0 ! t0__8t0 ! b_e_t0 ! t0__t0ma0
  1605. LSYM(x72) t0__9a0 ! a1_ne_0_b_l1 ! r__r_8t0 ! MILLIRETN
  1606. LSYM(x73) t0__9a0 ! t0__8t0_a0 ! b_e_shift ! r__r_t0
  1607. LSYM(x74) t0__9a0 ! t0__4t0_a0 ! b_e_shift ! r__r_2t0
  1608. LSYM(x75) t0__9a0 ! t0__4t0_a0 ! b_e_t0 ! t0__2t0_a0
  1609. LSYM(x76) t0__9a0 ! t0__2t0_a0 ! b_e_shift ! r__r_4t0
  1610. LSYM(x77) t0__9a0 ! t0__2t0_a0 ! b_e_t0 ! t0__4t0_a0
  1611. LSYM(x78) t0__9a0 ! t0__2t0_a0 ! b_e_2t0 ! t0__2t0_a0
  1612. LSYM(x79) t0__16a0 ! t0__5t0 ! b_e_t0 ! t0__t0ma0
  1613. LSYM(x80) t0__16a0 ! t0__5t0 ! b_e_shift ! r__r_t0
  1614. LSYM(x81) t0__9a0 ! t0__9t0 ! b_e_shift ! r__r_t0
  1615. LSYM(x82) t0__5a0 ! t0__8t0_a0 ! b_e_shift ! r__r_2t0
  1616. LSYM(x83) t0__5a0 ! t0__8t0_a0 ! b_e_t0 ! t0__2t0_a0
  1617. LSYM(x84) t0__5a0 ! t0__4t0_a0 ! b_e_shift ! r__r_4t0
  1618. LSYM(x85) t0__8a0 ! t0__2t0_a0 ! b_e_t0 ! t0__5t0
  1619. LSYM(x86) t0__5a0 ! t0__4t0_a0 ! b_e_2t0 ! t0__2t0_a0
  1620. LSYM(x87) t0__9a0 ! t0__9t0 ! b_e_t02a0 ! t0__t0_4a0
  1621. LSYM(x88) t0__5a0 ! t0__2t0_a0 ! b_e_shift ! r__r_8t0
  1622. LSYM(x89) t0__5a0 ! t0__2t0_a0 ! b_e_t0 ! t0__8t0_a0
  1623. LSYM(x90) t0__9a0 ! t0__5t0 ! b_e_shift ! r__r_2t0
  1624. LSYM(x91) t0__9a0 ! t0__5t0 ! b_e_t0 ! t0__2t0_a0
  1625. LSYM(x92) t0__5a0 ! t0__2t0_a0 ! b_e_4t0 ! t0__2t0_a0
  1626. LSYM(x93) t0__32a0 ! t0__t0ma0 ! b_e_t0 ! t0__3t0
  1627. LSYM(x94) t0__9a0 ! t0__5t0 ! b_e_2t0 ! t0__t0_2a0
  1628. LSYM(x95) t0__9a0 ! t0__2t0_a0 ! b_e_t0 ! t0__5t0
  1629. LSYM(x96) t0__8a0 ! t0__3t0 ! b_e_shift ! r__r_4t0
  1630. LSYM(x97) t0__8a0 ! t0__3t0 ! b_e_t0 ! t0__4t0_a0
  1631. LSYM(x98) t0__32a0 ! t0__3t0 ! b_e_t0 ! t0__t0_2a0
  1632. LSYM(x99) t0__8a0 ! t0__4t0_a0 ! b_e_t0 ! t0__3t0
  1633. LSYM(x100) t0__5a0 ! t0__5t0 ! b_e_shift ! r__r_4t0
  1634. LSYM(x101) t0__5a0 ! t0__5t0 ! b_e_t0 ! t0__4t0_a0
  1635. LSYM(x102) t0__32a0 ! t0__t0_2a0 ! b_e_t0 ! t0__3t0
  1636. LSYM(x103) t0__5a0 ! t0__5t0 ! b_e_t02a0 ! t0__4t0_a0
  1637. LSYM(x104) t0__3a0 ! t0__4t0_a0 ! b_e_shift ! r__r_8t0
  1638. LSYM(x105) t0__5a0 ! t0__4t0_a0 ! b_e_t0 ! t0__5t0
  1639. LSYM(x106) t0__3a0 ! t0__4t0_a0 ! b_e_2t0 ! t0__4t0_a0
  1640. LSYM(x107) t0__9a0 ! t0__t0_4a0 ! b_e_t02a0 ! t0__8t0_a0
  1641. LSYM(x108) t0__9a0 ! t0__3t0 ! b_e_shift ! r__r_4t0
  1642. LSYM(x109) t0__9a0 ! t0__3t0 ! b_e_t0 ! t0__4t0_a0
  1643. LSYM(x110) t0__9a0 ! t0__3t0 ! b_e_2t0 ! t0__2t0_a0
  1644. LSYM(x111) t0__9a0 ! t0__4t0_a0 ! b_e_t0 ! t0__3t0
  1645. LSYM(x112) t0__3a0 ! t0__2t0_a0 ! b_e_t0 ! t0__16t0
  1646. LSYM(x113) t0__9a0 ! t0__4t0_a0 ! b_e_t02a0 ! t0__3t0
  1647. LSYM(x114) t0__9a0 ! t0__2t0_a0 ! b_e_2t0 ! t0__3t0
  1648. LSYM(x115) t0__9a0 ! t0__2t0_a0 ! b_e_2t0a0 ! t0__3t0
  1649. LSYM(x116) t0__3a0 ! t0__2t0_a0 ! b_e_4t0 ! t0__4t0_a0
  1650. LSYM(x117) t0__3a0 ! t0__4t0_a0 ! b_e_t0 ! t0__9t0
  1651. LSYM(x118) t0__3a0 ! t0__4t0_a0 ! b_e_t0a0 ! t0__9t0
  1652. LSYM(x119) t0__3a0 ! t0__4t0_a0 ! b_e_t02a0 ! t0__9t0
  1653. LSYM(x120) t0__5a0 ! t0__3t0 ! b_e_shift ! r__r_8t0
  1654. LSYM(x121) t0__5a0 ! t0__3t0 ! b_e_t0 ! t0__8t0_a0
  1655. LSYM(x122) t0__5a0 ! t0__3t0 ! b_e_2t0 ! t0__4t0_a0
  1656. LSYM(x123) t0__5a0 ! t0__8t0_a0 ! b_e_t0 ! t0__3t0
  1657. LSYM(x124) t0__32a0 ! t0__t0ma0 ! b_e_shift ! r__r_4t0
  1658. LSYM(x125) t0__5a0 ! t0__5t0 ! b_e_t0 ! t0__5t0
  1659. LSYM(x126) t0__64a0 ! t0__t0ma0 ! b_e_shift ! r__r_2t0
  1660. LSYM(x127) t0__128a0 ! a1_ne_0_b_l0 ! t0__t0ma0 ! b_n_ret_t0
  1661. LSYM(x128) t0__128a0 ! a1_ne_0_b_l1 ! r__r_t0 ! MILLIRETN
  1662. LSYM(x129) t0__128a0 ! a1_ne_0_b_l0 ! t0__t0_a0 ! b_n_ret_t0
  1663. LSYM(x130) t0__64a0 ! t0__t0_a0 ! b_e_shift ! r__r_2t0
  1664. LSYM(x131) t0__8a0 ! t0__8t0_a0 ! b_e_t0 ! t0__2t0_a0
  1665. LSYM(x132) t0__8a0 ! t0__4t0_a0 ! b_e_shift ! r__r_4t0
  1666. LSYM(x133) t0__8a0 ! t0__4t0_a0 ! b_e_t0 ! t0__4t0_a0
  1667. LSYM(x134) t0__8a0 ! t0__4t0_a0 ! b_e_2t0 ! t0__2t0_a0
  1668. LSYM(x135) t0__9a0 ! t0__5t0 ! b_e_t0 ! t0__3t0
  1669. LSYM(x136) t0__8a0 ! t0__2t0_a0 ! b_e_shift ! r__r_8t0
  1670. LSYM(x137) t0__8a0 ! t0__2t0_a0 ! b_e_t0 ! t0__8t0_a0
  1671. LSYM(x138) t0__8a0 ! t0__2t0_a0 ! b_e_2t0 ! t0__4t0_a0
  1672. LSYM(x139) t0__8a0 ! t0__2t0_a0 ! b_e_2t0a0 ! t0__4t0_a0
  1673. LSYM(x140) t0__3a0 ! t0__2t0_a0 ! b_e_4t0 ! t0__5t0
  1674. LSYM(x141) t0__8a0 ! t0__2t0_a0 ! b_e_4t0a0 ! t0__2t0_a0
  1675. LSYM(x142) t0__9a0 ! t0__8t0 ! b_e_2t0 ! t0__t0ma0
  1676. LSYM(x143) t0__16a0 ! t0__9t0 ! b_e_t0 ! t0__t0ma0
  1677. LSYM(x144) t0__9a0 ! t0__8t0 ! b_e_shift ! r__r_2t0
  1678. LSYM(x145) t0__9a0 ! t0__8t0 ! b_e_t0 ! t0__2t0_a0
  1679. LSYM(x146) t0__9a0 ! t0__8t0_a0 ! b_e_shift ! r__r_2t0
  1680. LSYM(x147) t0__9a0 ! t0__8t0_a0 ! b_e_t0 ! t0__2t0_a0
  1681. LSYM(x148) t0__9a0 ! t0__4t0_a0 ! b_e_shift ! r__r_4t0
  1682. LSYM(x149) t0__9a0 ! t0__4t0_a0 ! b_e_t0 ! t0__4t0_a0
  1683. LSYM(x150) t0__9a0 ! t0__4t0_a0 ! b_e_2t0 ! t0__2t0_a0
  1684. LSYM(x151) t0__9a0 ! t0__4t0_a0 ! b_e_2t0a0 ! t0__2t0_a0
  1685. LSYM(x152) t0__9a0 ! t0__2t0_a0 ! b_e_shift ! r__r_8t0
  1686. LSYM(x153) t0__9a0 ! t0__2t0_a0 ! b_e_t0 ! t0__8t0_a0
  1687. LSYM(x154) t0__9a0 ! t0__2t0_a0 ! b_e_2t0 ! t0__4t0_a0
  1688. LSYM(x155) t0__32a0 ! t0__t0ma0 ! b_e_t0 ! t0__5t0
  1689. LSYM(x156) t0__9a0 ! t0__2t0_a0 ! b_e_4t0 ! t0__2t0_a0
  1690. LSYM(x157) t0__32a0 ! t0__t0ma0 ! b_e_t02a0 ! t0__5t0
  1691. LSYM(x158) t0__16a0 ! t0__5t0 ! b_e_2t0 ! t0__t0ma0
  1692. LSYM(x159) t0__32a0 ! t0__5t0 ! b_e_t0 ! t0__t0ma0
  1693. LSYM(x160) t0__5a0 ! t0__4t0 ! b_e_shift ! r__r_8t0
  1694. LSYM(x161) t0__8a0 ! t0__5t0 ! b_e_t0 ! t0__4t0_a0
  1695. LSYM(x162) t0__9a0 ! t0__9t0 ! b_e_shift ! r__r_2t0
  1696. LSYM(x163) t0__9a0 ! t0__9t0 ! b_e_t0 ! t0__2t0_a0
  1697. LSYM(x164) t0__5a0 ! t0__8t0_a0 ! b_e_shift ! r__r_4t0
  1698. LSYM(x165) t0__8a0 ! t0__4t0_a0 ! b_e_t0 ! t0__5t0
  1699. LSYM(x166) t0__5a0 ! t0__8t0_a0 ! b_e_2t0 ! t0__2t0_a0
  1700. LSYM(x167) t0__5a0 ! t0__8t0_a0 ! b_e_2t0a0 ! t0__2t0_a0
  1701. LSYM(x168) t0__5a0 ! t0__4t0_a0 ! b_e_shift ! r__r_8t0
  1702. LSYM(x169) t0__5a0 ! t0__4t0_a0 ! b_e_t0 ! t0__8t0_a0
  1703. LSYM(x170) t0__32a0 ! t0__t0_2a0 ! b_e_t0 ! t0__5t0
  1704. LSYM(x171) t0__9a0 ! t0__2t0_a0 ! b_e_t0 ! t0__9t0
  1705. LSYM(x172) t0__5a0 ! t0__4t0_a0 ! b_e_4t0 ! t0__2t0_a0
  1706. LSYM(x173) t0__9a0 ! t0__2t0_a0 ! b_e_t02a0 ! t0__9t0
  1707. LSYM(x174) t0__32a0 ! t0__t0_2a0 ! b_e_t04a0 ! t0__5t0
  1708. LSYM(x175) t0__8a0 ! t0__2t0_a0 ! b_e_5t0 ! t0__2t0_a0
  1709. LSYM(x176) t0__5a0 ! t0__4t0_a0 ! b_e_8t0 ! t0__t0_a0
  1710. LSYM(x177) t0__5a0 ! t0__4t0_a0 ! b_e_8t0a0 ! t0__t0_a0
  1711. LSYM(x178) t0__5a0 ! t0__2t0_a0 ! b_e_2t0 ! t0__8t0_a0
  1712. LSYM(x179) t0__5a0 ! t0__2t0_a0 ! b_e_2t0a0 ! t0__8t0_a0
  1713. LSYM(x180) t0__9a0 ! t0__5t0 ! b_e_shift ! r__r_4t0
  1714. LSYM(x181) t0__9a0 ! t0__5t0 ! b_e_t0 ! t0__4t0_a0
  1715. LSYM(x182) t0__9a0 ! t0__5t0 ! b_e_2t0 ! t0__2t0_a0
  1716. LSYM(x183) t0__9a0 ! t0__5t0 ! b_e_2t0a0 ! t0__2t0_a0
  1717. LSYM(x184) t0__5a0 ! t0__9t0 ! b_e_4t0 ! t0__t0_a0
  1718. LSYM(x185) t0__9a0 ! t0__4t0_a0 ! b_e_t0 ! t0__5t0
  1719. LSYM(x186) t0__32a0 ! t0__t0ma0 ! b_e_2t0 ! t0__3t0
  1720. LSYM(x187) t0__9a0 ! t0__4t0_a0 ! b_e_t02a0 ! t0__5t0
  1721. LSYM(x188) t0__9a0 ! t0__5t0 ! b_e_4t0 ! t0__t0_2a0
  1722. LSYM(x189) t0__5a0 ! t0__4t0_a0 ! b_e_t0 ! t0__9t0
  1723. LSYM(x190) t0__9a0 ! t0__2t0_a0 ! b_e_2t0 ! t0__5t0
  1724. LSYM(x191) t0__64a0 ! t0__3t0 ! b_e_t0 ! t0__t0ma0
  1725. LSYM(x192) t0__8a0 ! t0__3t0 ! b_e_shift ! r__r_8t0
  1726. LSYM(x193) t0__8a0 ! t0__3t0 ! b_e_t0 ! t0__8t0_a0
  1727. LSYM(x194) t0__8a0 ! t0__3t0 ! b_e_2t0 ! t0__4t0_a0
  1728. LSYM(x195) t0__8a0 ! t0__8t0_a0 ! b_e_t0 ! t0__3t0
  1729. LSYM(x196) t0__8a0 ! t0__3t0 ! b_e_4t0 ! t0__2t0_a0
  1730. LSYM(x197) t0__8a0 ! t0__3t0 ! b_e_4t0a0 ! t0__2t0_a0
  1731. LSYM(x198) t0__64a0 ! t0__t0_2a0 ! b_e_t0 ! t0__3t0
  1732. LSYM(x199) t0__8a0 ! t0__4t0_a0 ! b_e_2t0a0 ! t0__3t0
  1733. LSYM(x200) t0__5a0 ! t0__5t0 ! b_e_shift ! r__r_8t0
  1734. LSYM(x201) t0__5a0 ! t0__5t0 ! b_e_t0 ! t0__8t0_a0
  1735. LSYM(x202) t0__5a0 ! t0__5t0 ! b_e_2t0 ! t0__4t0_a0
  1736. LSYM(x203) t0__5a0 ! t0__5t0 ! b_e_2t0a0 ! t0__4t0_a0
  1737. LSYM(x204) t0__8a0 ! t0__2t0_a0 ! b_e_4t0 ! t0__3t0
  1738. LSYM(x205) t0__5a0 ! t0__8t0_a0 ! b_e_t0 ! t0__5t0
  1739. LSYM(x206) t0__64a0 ! t0__t0_4a0 ! b_e_t02a0 ! t0__3t0
  1740. LSYM(x207) t0__8a0 ! t0__2t0_a0 ! b_e_3t0 ! t0__4t0_a0
  1741. LSYM(x208) t0__5a0 ! t0__5t0 ! b_e_8t0 ! t0__t0_a0
  1742. LSYM(x209) t0__5a0 ! t0__5t0 ! b_e_8t0a0 ! t0__t0_a0
  1743. LSYM(x210) t0__5a0 ! t0__4t0_a0 ! b_e_2t0 ! t0__5t0
  1744. LSYM(x211) t0__5a0 ! t0__4t0_a0 ! b_e_2t0a0 ! t0__5t0
  1745. LSYM(x212) t0__3a0 ! t0__4t0_a0 ! b_e_4t0 ! t0__4t0_a0
  1746. LSYM(x213) t0__3a0 ! t0__4t0_a0 ! b_e_4t0a0 ! t0__4t0_a0
  1747. LSYM(x214) t0__9a0 ! t0__t0_4a0 ! b_e_2t04a0 ! t0__8t0_a0
  1748. LSYM(x215) t0__5a0 ! t0__4t0_a0 ! b_e_5t0 ! t0__2t0_a0
  1749. LSYM(x216) t0__9a0 ! t0__3t0 ! b_e_shift ! r__r_8t0
  1750. LSYM(x217) t0__9a0 ! t0__3t0 ! b_e_t0 ! t0__8t0_a0
  1751. LSYM(x218) t0__9a0 ! t0__3t0 ! b_e_2t0 ! t0__4t0_a0
  1752. LSYM(x219) t0__9a0 ! t0__8t0_a0 ! b_e_t0 ! t0__3t0
  1753. LSYM(x220) t0__3a0 ! t0__9t0 ! b_e_4t0 ! t0__2t0_a0
  1754. LSYM(x221) t0__3a0 ! t0__9t0 ! b_e_4t0a0 ! t0__2t0_a0
  1755. LSYM(x222) t0__9a0 ! t0__4t0_a0 ! b_e_2t0 ! t0__3t0
  1756. LSYM(x223) t0__9a0 ! t0__4t0_a0 ! b_e_2t0a0 ! t0__3t0
  1757. LSYM(x224) t0__9a0 ! t0__3t0 ! b_e_8t0 ! t0__t0_a0
  1758. LSYM(x225) t0__9a0 ! t0__5t0 ! b_e_t0 ! t0__5t0
  1759. LSYM(x226) t0__3a0 ! t0__2t0_a0 ! b_e_t02a0 ! t0__32t0
  1760. LSYM(x227) t0__9a0 ! t0__5t0 ! b_e_t02a0 ! t0__5t0
  1761. LSYM(x228) t0__9a0 ! t0__2t0_a0 ! b_e_4t0 ! t0__3t0
  1762. LSYM(x229) t0__9a0 ! t0__2t0_a0 ! b_e_4t0a0 ! t0__3t0
  1763. LSYM(x230) t0__9a0 ! t0__5t0 ! b_e_5t0 ! t0__t0_a0
  1764. LSYM(x231) t0__9a0 ! t0__2t0_a0 ! b_e_3t0 ! t0__4t0_a0
  1765. LSYM(x232) t0__3a0 ! t0__2t0_a0 ! b_e_8t0 ! t0__4t0_a0
  1766. LSYM(x233) t0__3a0 ! t0__2t0_a0 ! b_e_8t0a0 ! t0__4t0_a0
  1767. LSYM(x234) t0__3a0 ! t0__4t0_a0 ! b_e_2t0 ! t0__9t0
  1768. LSYM(x235) t0__3a0 ! t0__4t0_a0 ! b_e_2t0a0 ! t0__9t0
  1769. LSYM(x236) t0__9a0 ! t0__2t0_a0 ! b_e_4t08a0 ! t0__3t0
  1770. LSYM(x237) t0__16a0 ! t0__5t0 ! b_e_3t0 ! t0__t0ma0
  1771. LSYM(x238) t0__3a0 ! t0__4t0_a0 ! b_e_2t04a0 ! t0__9t0
  1772. LSYM(x239) t0__16a0 ! t0__5t0 ! b_e_t0ma0 ! t0__3t0
  1773. LSYM(x240) t0__9a0 ! t0__t0_a0 ! b_e_8t0 ! t0__3t0
  1774. LSYM(x241) t0__9a0 ! t0__t0_a0 ! b_e_8t0a0 ! t0__3t0
  1775. LSYM(x242) t0__5a0 ! t0__3t0 ! b_e_2t0 ! t0__8t0_a0
  1776. LSYM(x243) t0__9a0 ! t0__9t0 ! b_e_t0 ! t0__3t0
  1777. LSYM(x244) t0__5a0 ! t0__3t0 ! b_e_4t0 ! t0__4t0_a0
  1778. LSYM(x245) t0__8a0 ! t0__3t0 ! b_e_5t0 ! t0__2t0_a0
  1779. LSYM(x246) t0__5a0 ! t0__8t0_a0 ! b_e_2t0 ! t0__3t0
  1780. LSYM(x247) t0__5a0 ! t0__8t0_a0 ! b_e_2t0a0 ! t0__3t0
  1781. LSYM(x248) t0__32a0 ! t0__t0ma0 ! b_e_shift ! r__r_8t0
  1782. LSYM(x249) t0__32a0 ! t0__t0ma0 ! b_e_t0 ! t0__8t0_a0
  1783. LSYM(x250) t0__5a0 ! t0__5t0 ! b_e_2t0 ! t0__5t0
  1784. LSYM(x251) t0__5a0 ! t0__5t0 ! b_e_2t0a0 ! t0__5t0
  1785. LSYM(x252) t0__64a0 ! t0__t0ma0 ! b_e_shift ! r__r_4t0
  1786. LSYM(x253) t0__64a0 ! t0__t0ma0 ! b_e_t0 ! t0__4t0_a0
  1787. LSYM(x254) t0__128a0 ! t0__t0ma0 ! b_e_shift ! r__r_2t0
  1788. LSYM(x255) t0__256a0 ! a1_ne_0_b_l0 ! t0__t0ma0 ! b_n_ret_t0
  1789. /*1040 insts before this. */
  1790. LSYM(ret_t0) MILLIRET
  1791. LSYM(e_t0) r__r_t0
  1792. LSYM(e_shift) a1_ne_0_b_l2
  1793. a0__256a0 /* a0 <<= 8 *********** */
  1794. MILLIRETN
  1795. LSYM(e_t0ma0) a1_ne_0_b_l0
  1796. t0__t0ma0
  1797. MILLIRET
  1798. r__r_t0
  1799. LSYM(e_t0a0) a1_ne_0_b_l0
  1800. t0__t0_a0
  1801. MILLIRET
  1802. r__r_t0
  1803. LSYM(e_t02a0) a1_ne_0_b_l0
  1804. t0__t0_2a0
  1805. MILLIRET
  1806. r__r_t0
  1807. LSYM(e_t04a0) a1_ne_0_b_l0
  1808. t0__t0_4a0
  1809. MILLIRET
  1810. r__r_t0
  1811. LSYM(e_2t0) a1_ne_0_b_l1
  1812. r__r_2t0
  1813. MILLIRETN
  1814. LSYM(e_2t0a0) a1_ne_0_b_l0
  1815. t0__2t0_a0
  1816. MILLIRET
  1817. r__r_t0
  1818. LSYM(e2t04a0) t0__t0_2a0
  1819. a1_ne_0_b_l1
  1820. r__r_2t0
  1821. MILLIRETN
  1822. LSYM(e_3t0) a1_ne_0_b_l0
  1823. t0__3t0
  1824. MILLIRET
  1825. r__r_t0
  1826. LSYM(e_4t0) a1_ne_0_b_l1
  1827. r__r_4t0
  1828. MILLIRETN
  1829. LSYM(e_4t0a0) a1_ne_0_b_l0
  1830. t0__4t0_a0
  1831. MILLIRET
  1832. r__r_t0
  1833. LSYM(e4t08a0) t0__t0_2a0
  1834. a1_ne_0_b_l1
  1835. r__r_4t0
  1836. MILLIRETN
  1837. LSYM(e_5t0) a1_ne_0_b_l0
  1838. t0__5t0
  1839. MILLIRET
  1840. r__r_t0
  1841. LSYM(e_8t0) a1_ne_0_b_l1
  1842. r__r_8t0
  1843. MILLIRETN
  1844. LSYM(e_8t0a0) a1_ne_0_b_l0
  1845. t0__8t0_a0
  1846. MILLIRET
  1847. r__r_t0
  1848. .procend
  1849. .end
  1850. #endif