/arch/m68k/ifpsp060/src/fplsp.S

https://bitbucket.org/cresqo/cm7-p500-kernel · Assembly · 10980 lines · 9796 code · 1184 blank · 0 comment · 71 complexity · c8c88f2e1c605f8e83e2ae51cdf83207 MD5 · raw file

Large files are truncated click here to view the full file

  1. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2. MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
  3. M68000 Hi-Performance Microprocessor Division
  4. M68060 Software Package
  5. Production Release P1.00 -- October 10, 1994
  6. M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
  7. THE SOFTWARE is provided on an "AS IS" basis and without warranty.
  8. To the maximum extent permitted by applicable law,
  9. MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
  10. INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
  11. and any warranty against infringement with regard to the SOFTWARE
  12. (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
  13. To the maximum extent permitted by applicable law,
  14. IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
  15. (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
  16. BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
  17. ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
  18. Motorola assumes no responsibility for the maintenance and support of the SOFTWARE.
  19. You are hereby granted a copyright license to use, modify, and distribute the SOFTWARE
  20. so long as this entire notice is retained without alteration in any modified and/or
  21. redistributed versions, and that such modified versions are clearly identified as such.
  22. No licenses are granted by implication, estoppel or otherwise under any patents
  23. or trademarks of Motorola, Inc.
  24. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  25. #
  26. # lfptop.s:
  27. # This file is appended to the top of the 060ILSP package
  28. # and contains the entry points into the package. The user, in
  29. # effect, branches to one of the branch table entries located here.
  30. #
  31. bra.l _facoss_
  32. short 0x0000
  33. bra.l _facosd_
  34. short 0x0000
  35. bra.l _facosx_
  36. short 0x0000
  37. bra.l _fasins_
  38. short 0x0000
  39. bra.l _fasind_
  40. short 0x0000
  41. bra.l _fasinx_
  42. short 0x0000
  43. bra.l _fatans_
  44. short 0x0000
  45. bra.l _fatand_
  46. short 0x0000
  47. bra.l _fatanx_
  48. short 0x0000
  49. bra.l _fatanhs_
  50. short 0x0000
  51. bra.l _fatanhd_
  52. short 0x0000
  53. bra.l _fatanhx_
  54. short 0x0000
  55. bra.l _fcoss_
  56. short 0x0000
  57. bra.l _fcosd_
  58. short 0x0000
  59. bra.l _fcosx_
  60. short 0x0000
  61. bra.l _fcoshs_
  62. short 0x0000
  63. bra.l _fcoshd_
  64. short 0x0000
  65. bra.l _fcoshx_
  66. short 0x0000
  67. bra.l _fetoxs_
  68. short 0x0000
  69. bra.l _fetoxd_
  70. short 0x0000
  71. bra.l _fetoxx_
  72. short 0x0000
  73. bra.l _fetoxm1s_
  74. short 0x0000
  75. bra.l _fetoxm1d_
  76. short 0x0000
  77. bra.l _fetoxm1x_
  78. short 0x0000
  79. bra.l _fgetexps_
  80. short 0x0000
  81. bra.l _fgetexpd_
  82. short 0x0000
  83. bra.l _fgetexpx_
  84. short 0x0000
  85. bra.l _fgetmans_
  86. short 0x0000
  87. bra.l _fgetmand_
  88. short 0x0000
  89. bra.l _fgetmanx_
  90. short 0x0000
  91. bra.l _flog10s_
  92. short 0x0000
  93. bra.l _flog10d_
  94. short 0x0000
  95. bra.l _flog10x_
  96. short 0x0000
  97. bra.l _flog2s_
  98. short 0x0000
  99. bra.l _flog2d_
  100. short 0x0000
  101. bra.l _flog2x_
  102. short 0x0000
  103. bra.l _flogns_
  104. short 0x0000
  105. bra.l _flognd_
  106. short 0x0000
  107. bra.l _flognx_
  108. short 0x0000
  109. bra.l _flognp1s_
  110. short 0x0000
  111. bra.l _flognp1d_
  112. short 0x0000
  113. bra.l _flognp1x_
  114. short 0x0000
  115. bra.l _fmods_
  116. short 0x0000
  117. bra.l _fmodd_
  118. short 0x0000
  119. bra.l _fmodx_
  120. short 0x0000
  121. bra.l _frems_
  122. short 0x0000
  123. bra.l _fremd_
  124. short 0x0000
  125. bra.l _fremx_
  126. short 0x0000
  127. bra.l _fscales_
  128. short 0x0000
  129. bra.l _fscaled_
  130. short 0x0000
  131. bra.l _fscalex_
  132. short 0x0000
  133. bra.l _fsins_
  134. short 0x0000
  135. bra.l _fsind_
  136. short 0x0000
  137. bra.l _fsinx_
  138. short 0x0000
  139. bra.l _fsincoss_
  140. short 0x0000
  141. bra.l _fsincosd_
  142. short 0x0000
  143. bra.l _fsincosx_
  144. short 0x0000
  145. bra.l _fsinhs_
  146. short 0x0000
  147. bra.l _fsinhd_
  148. short 0x0000
  149. bra.l _fsinhx_
  150. short 0x0000
  151. bra.l _ftans_
  152. short 0x0000
  153. bra.l _ftand_
  154. short 0x0000
  155. bra.l _ftanx_
  156. short 0x0000
  157. bra.l _ftanhs_
  158. short 0x0000
  159. bra.l _ftanhd_
  160. short 0x0000
  161. bra.l _ftanhx_
  162. short 0x0000
  163. bra.l _ftentoxs_
  164. short 0x0000
  165. bra.l _ftentoxd_
  166. short 0x0000
  167. bra.l _ftentoxx_
  168. short 0x0000
  169. bra.l _ftwotoxs_
  170. short 0x0000
  171. bra.l _ftwotoxd_
  172. short 0x0000
  173. bra.l _ftwotoxx_
  174. short 0x0000
  175. bra.l _fabss_
  176. short 0x0000
  177. bra.l _fabsd_
  178. short 0x0000
  179. bra.l _fabsx_
  180. short 0x0000
  181. bra.l _fadds_
  182. short 0x0000
  183. bra.l _faddd_
  184. short 0x0000
  185. bra.l _faddx_
  186. short 0x0000
  187. bra.l _fdivs_
  188. short 0x0000
  189. bra.l _fdivd_
  190. short 0x0000
  191. bra.l _fdivx_
  192. short 0x0000
  193. bra.l _fints_
  194. short 0x0000
  195. bra.l _fintd_
  196. short 0x0000
  197. bra.l _fintx_
  198. short 0x0000
  199. bra.l _fintrzs_
  200. short 0x0000
  201. bra.l _fintrzd_
  202. short 0x0000
  203. bra.l _fintrzx_
  204. short 0x0000
  205. bra.l _fmuls_
  206. short 0x0000
  207. bra.l _fmuld_
  208. short 0x0000
  209. bra.l _fmulx_
  210. short 0x0000
  211. bra.l _fnegs_
  212. short 0x0000
  213. bra.l _fnegd_
  214. short 0x0000
  215. bra.l _fnegx_
  216. short 0x0000
  217. bra.l _fsqrts_
  218. short 0x0000
  219. bra.l _fsqrtd_
  220. short 0x0000
  221. bra.l _fsqrtx_
  222. short 0x0000
  223. bra.l _fsubs_
  224. short 0x0000
  225. bra.l _fsubd_
  226. short 0x0000
  227. bra.l _fsubx_
  228. short 0x0000
  229. # leave room for future possible additions
  230. align 0x400
  231. #
  232. # This file contains a set of define statements for constants
  233. # in order to promote readability within the corecode itself.
  234. #
  235. set LOCAL_SIZE, 192 # stack frame size(bytes)
  236. set LV, -LOCAL_SIZE # stack offset
  237. set EXC_SR, 0x4 # stack status register
  238. set EXC_PC, 0x6 # stack pc
  239. set EXC_VOFF, 0xa # stacked vector offset
  240. set EXC_EA, 0xc # stacked <ea>
  241. set EXC_FP, 0x0 # frame pointer
  242. set EXC_AREGS, -68 # offset of all address regs
  243. set EXC_DREGS, -100 # offset of all data regs
  244. set EXC_FPREGS, -36 # offset of all fp regs
  245. set EXC_A7, EXC_AREGS+(7*4) # offset of saved a7
  246. set OLD_A7, EXC_AREGS+(6*4) # extra copy of saved a7
  247. set EXC_A6, EXC_AREGS+(6*4) # offset of saved a6
  248. set EXC_A5, EXC_AREGS+(5*4)
  249. set EXC_A4, EXC_AREGS+(4*4)
  250. set EXC_A3, EXC_AREGS+(3*4)
  251. set EXC_A2, EXC_AREGS+(2*4)
  252. set EXC_A1, EXC_AREGS+(1*4)
  253. set EXC_A0, EXC_AREGS+(0*4)
  254. set EXC_D7, EXC_DREGS+(7*4)
  255. set EXC_D6, EXC_DREGS+(6*4)
  256. set EXC_D5, EXC_DREGS+(5*4)
  257. set EXC_D4, EXC_DREGS+(4*4)
  258. set EXC_D3, EXC_DREGS+(3*4)
  259. set EXC_D2, EXC_DREGS+(2*4)
  260. set EXC_D1, EXC_DREGS+(1*4)
  261. set EXC_D0, EXC_DREGS+(0*4)
  262. set EXC_FP0, EXC_FPREGS+(0*12) # offset of saved fp0
  263. set EXC_FP1, EXC_FPREGS+(1*12) # offset of saved fp1
  264. set EXC_FP2, EXC_FPREGS+(2*12) # offset of saved fp2 (not used)
  265. set FP_SCR1, LV+80 # fp scratch 1
  266. set FP_SCR1_EX, FP_SCR1+0
  267. set FP_SCR1_SGN, FP_SCR1+2
  268. set FP_SCR1_HI, FP_SCR1+4
  269. set FP_SCR1_LO, FP_SCR1+8
  270. set FP_SCR0, LV+68 # fp scratch 0
  271. set FP_SCR0_EX, FP_SCR0+0
  272. set FP_SCR0_SGN, FP_SCR0+2
  273. set FP_SCR0_HI, FP_SCR0+4
  274. set FP_SCR0_LO, FP_SCR0+8
  275. set FP_DST, LV+56 # fp destination operand
  276. set FP_DST_EX, FP_DST+0
  277. set FP_DST_SGN, FP_DST+2
  278. set FP_DST_HI, FP_DST+4
  279. set FP_DST_LO, FP_DST+8
  280. set FP_SRC, LV+44 # fp source operand
  281. set FP_SRC_EX, FP_SRC+0
  282. set FP_SRC_SGN, FP_SRC+2
  283. set FP_SRC_HI, FP_SRC+4
  284. set FP_SRC_LO, FP_SRC+8
  285. set USER_FPIAR, LV+40 # FP instr address register
  286. set USER_FPSR, LV+36 # FP status register
  287. set FPSR_CC, USER_FPSR+0 # FPSR condition codes
  288. set FPSR_QBYTE, USER_FPSR+1 # FPSR qoutient byte
  289. set FPSR_EXCEPT, USER_FPSR+2 # FPSR exception status byte
  290. set FPSR_AEXCEPT, USER_FPSR+3 # FPSR accrued exception byte
  291. set USER_FPCR, LV+32 # FP control register
  292. set FPCR_ENABLE, USER_FPCR+2 # FPCR exception enable
  293. set FPCR_MODE, USER_FPCR+3 # FPCR rounding mode control
  294. set L_SCR3, LV+28 # integer scratch 3
  295. set L_SCR2, LV+24 # integer scratch 2
  296. set L_SCR1, LV+20 # integer scratch 1
  297. set STORE_FLG, LV+19 # flag: operand store (ie. not fcmp/ftst)
  298. set EXC_TEMP2, LV+24 # temporary space
  299. set EXC_TEMP, LV+16 # temporary space
  300. set DTAG, LV+15 # destination operand type
  301. set STAG, LV+14 # source operand type
  302. set SPCOND_FLG, LV+10 # flag: special case (see below)
  303. set EXC_CC, LV+8 # saved condition codes
  304. set EXC_EXTWPTR, LV+4 # saved current PC (active)
  305. set EXC_EXTWORD, LV+2 # saved extension word
  306. set EXC_CMDREG, LV+2 # saved extension word
  307. set EXC_OPWORD, LV+0 # saved operation word
  308. ################################
  309. # Helpful macros
  310. set FTEMP, 0 # offsets within an
  311. set FTEMP_EX, 0 # extended precision
  312. set FTEMP_SGN, 2 # value saved in memory.
  313. set FTEMP_HI, 4
  314. set FTEMP_LO, 8
  315. set FTEMP_GRS, 12
  316. set LOCAL, 0 # offsets within an
  317. set LOCAL_EX, 0 # extended precision
  318. set LOCAL_SGN, 2 # value saved in memory.
  319. set LOCAL_HI, 4
  320. set LOCAL_LO, 8
  321. set LOCAL_GRS, 12
  322. set DST, 0 # offsets within an
  323. set DST_EX, 0 # extended precision
  324. set DST_HI, 4 # value saved in memory.
  325. set DST_LO, 8
  326. set SRC, 0 # offsets within an
  327. set SRC_EX, 0 # extended precision
  328. set SRC_HI, 4 # value saved in memory.
  329. set SRC_LO, 8
  330. set SGL_LO, 0x3f81 # min sgl prec exponent
  331. set SGL_HI, 0x407e # max sgl prec exponent
  332. set DBL_LO, 0x3c01 # min dbl prec exponent
  333. set DBL_HI, 0x43fe # max dbl prec exponent
  334. set EXT_LO, 0x0 # min ext prec exponent
  335. set EXT_HI, 0x7ffe # max ext prec exponent
  336. set EXT_BIAS, 0x3fff # extended precision bias
  337. set SGL_BIAS, 0x007f # single precision bias
  338. set DBL_BIAS, 0x03ff # double precision bias
  339. set NORM, 0x00 # operand type for STAG/DTAG
  340. set ZERO, 0x01 # operand type for STAG/DTAG
  341. set INF, 0x02 # operand type for STAG/DTAG
  342. set QNAN, 0x03 # operand type for STAG/DTAG
  343. set DENORM, 0x04 # operand type for STAG/DTAG
  344. set SNAN, 0x05 # operand type for STAG/DTAG
  345. set UNNORM, 0x06 # operand type for STAG/DTAG
  346. ##################
  347. # FPSR/FPCR bits #
  348. ##################
  349. set neg_bit, 0x3 # negative result
  350. set z_bit, 0x2 # zero result
  351. set inf_bit, 0x1 # infinite result
  352. set nan_bit, 0x0 # NAN result
  353. set q_sn_bit, 0x7 # sign bit of quotient byte
  354. set bsun_bit, 7 # branch on unordered
  355. set snan_bit, 6 # signalling NAN
  356. set operr_bit, 5 # operand error
  357. set ovfl_bit, 4 # overflow
  358. set unfl_bit, 3 # underflow
  359. set dz_bit, 2 # divide by zero
  360. set inex2_bit, 1 # inexact result 2
  361. set inex1_bit, 0 # inexact result 1
  362. set aiop_bit, 7 # accrued inexact operation bit
  363. set aovfl_bit, 6 # accrued overflow bit
  364. set aunfl_bit, 5 # accrued underflow bit
  365. set adz_bit, 4 # accrued dz bit
  366. set ainex_bit, 3 # accrued inexact bit
  367. #############################
  368. # FPSR individual bit masks #
  369. #############################
  370. set neg_mask, 0x08000000 # negative bit mask (lw)
  371. set inf_mask, 0x02000000 # infinity bit mask (lw)
  372. set z_mask, 0x04000000 # zero bit mask (lw)
  373. set nan_mask, 0x01000000 # nan bit mask (lw)
  374. set neg_bmask, 0x08 # negative bit mask (byte)
  375. set inf_bmask, 0x02 # infinity bit mask (byte)
  376. set z_bmask, 0x04 # zero bit mask (byte)
  377. set nan_bmask, 0x01 # nan bit mask (byte)
  378. set bsun_mask, 0x00008000 # bsun exception mask
  379. set snan_mask, 0x00004000 # snan exception mask
  380. set operr_mask, 0x00002000 # operr exception mask
  381. set ovfl_mask, 0x00001000 # overflow exception mask
  382. set unfl_mask, 0x00000800 # underflow exception mask
  383. set dz_mask, 0x00000400 # dz exception mask
  384. set inex2_mask, 0x00000200 # inex2 exception mask
  385. set inex1_mask, 0x00000100 # inex1 exception mask
  386. set aiop_mask, 0x00000080 # accrued illegal operation
  387. set aovfl_mask, 0x00000040 # accrued overflow
  388. set aunfl_mask, 0x00000020 # accrued underflow
  389. set adz_mask, 0x00000010 # accrued divide by zero
  390. set ainex_mask, 0x00000008 # accrued inexact
  391. ######################################
  392. # FPSR combinations used in the FPSP #
  393. ######################################
  394. set dzinf_mask, inf_mask+dz_mask+adz_mask
  395. set opnan_mask, nan_mask+operr_mask+aiop_mask
  396. set nzi_mask, 0x01ffffff #clears N, Z, and I
  397. set unfinx_mask, unfl_mask+inex2_mask+aunfl_mask+ainex_mask
  398. set unf2inx_mask, unfl_mask+inex2_mask+ainex_mask
  399. set ovfinx_mask, ovfl_mask+inex2_mask+aovfl_mask+ainex_mask
  400. set inx1a_mask, inex1_mask+ainex_mask
  401. set inx2a_mask, inex2_mask+ainex_mask
  402. set snaniop_mask, nan_mask+snan_mask+aiop_mask
  403. set snaniop2_mask, snan_mask+aiop_mask
  404. set naniop_mask, nan_mask+aiop_mask
  405. set neginf_mask, neg_mask+inf_mask
  406. set infaiop_mask, inf_mask+aiop_mask
  407. set negz_mask, neg_mask+z_mask
  408. set opaop_mask, operr_mask+aiop_mask
  409. set unfl_inx_mask, unfl_mask+aunfl_mask+ainex_mask
  410. set ovfl_inx_mask, ovfl_mask+aovfl_mask+ainex_mask
  411. #########
  412. # misc. #
  413. #########
  414. set rnd_stky_bit, 29 # stky bit pos in longword
  415. set sign_bit, 0x7 # sign bit
  416. set signan_bit, 0x6 # signalling nan bit
  417. set sgl_thresh, 0x3f81 # minimum sgl exponent
  418. set dbl_thresh, 0x3c01 # minimum dbl exponent
  419. set x_mode, 0x0 # extended precision
  420. set s_mode, 0x4 # single precision
  421. set d_mode, 0x8 # double precision
  422. set rn_mode, 0x0 # round-to-nearest
  423. set rz_mode, 0x1 # round-to-zero
  424. set rm_mode, 0x2 # round-tp-minus-infinity
  425. set rp_mode, 0x3 # round-to-plus-infinity
  426. set mantissalen, 64 # length of mantissa in bits
  427. set BYTE, 1 # len(byte) == 1 byte
  428. set WORD, 2 # len(word) == 2 bytes
  429. set LONG, 4 # len(longword) == 2 bytes
  430. set BSUN_VEC, 0xc0 # bsun vector offset
  431. set INEX_VEC, 0xc4 # inexact vector offset
  432. set DZ_VEC, 0xc8 # dz vector offset
  433. set UNFL_VEC, 0xcc # unfl vector offset
  434. set OPERR_VEC, 0xd0 # operr vector offset
  435. set OVFL_VEC, 0xd4 # ovfl vector offset
  436. set SNAN_VEC, 0xd8 # snan vector offset
  437. ###########################
  438. # SPecial CONDition FLaGs #
  439. ###########################
  440. set ftrapcc_flg, 0x01 # flag bit: ftrapcc exception
  441. set fbsun_flg, 0x02 # flag bit: bsun exception
  442. set mia7_flg, 0x04 # flag bit: (a7)+ <ea>
  443. set mda7_flg, 0x08 # flag bit: -(a7) <ea>
  444. set fmovm_flg, 0x40 # flag bit: fmovm instruction
  445. set immed_flg, 0x80 # flag bit: &<data> <ea>
  446. set ftrapcc_bit, 0x0
  447. set fbsun_bit, 0x1
  448. set mia7_bit, 0x2
  449. set mda7_bit, 0x3
  450. set immed_bit, 0x7
  451. ##################################
  452. # TRANSCENDENTAL "LAST-OP" FLAGS #
  453. ##################################
  454. set FMUL_OP, 0x0 # fmul instr performed last
  455. set FDIV_OP, 0x1 # fdiv performed last
  456. set FADD_OP, 0x2 # fadd performed last
  457. set FMOV_OP, 0x3 # fmov performed last
  458. #############
  459. # CONSTANTS #
  460. #############
  461. T1: long 0x40C62D38,0xD3D64634 # 16381 LOG2 LEAD
  462. T2: long 0x3D6F90AE,0xB1E75CC7 # 16381 LOG2 TRAIL
  463. PI: long 0x40000000,0xC90FDAA2,0x2168C235,0x00000000
  464. PIBY2: long 0x3FFF0000,0xC90FDAA2,0x2168C235,0x00000000
  465. TWOBYPI:
  466. long 0x3FE45F30,0x6DC9C883
  467. #########################################################################
  468. # MONADIC TEMPLATE #
  469. #########################################################################
  470. global _fsins_
  471. _fsins_:
  472. link %a6,&-LOCAL_SIZE
  473. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  474. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  475. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  476. fmov.l &0x0,%fpcr # zero FPCR
  477. #
  478. # copy, convert, and tag input argument
  479. #
  480. fmov.s 0x8(%a6),%fp0 # load sgl input
  481. fmov.x %fp0,FP_SRC(%a6)
  482. lea FP_SRC(%a6),%a0
  483. bsr.l tag # fetch operand type
  484. mov.b %d0,STAG(%a6)
  485. mov.b %d0,%d1
  486. andi.l &0x00ff00ff,USER_FPSR(%a6)
  487. clr.l %d0
  488. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  489. tst.b %d1
  490. bne.b _L0_2s
  491. bsr.l ssin # operand is a NORM
  492. bra.b _L0_6s
  493. _L0_2s:
  494. cmpi.b %d1,&ZERO # is operand a ZERO?
  495. bne.b _L0_3s # no
  496. bsr.l src_zero # yes
  497. bra.b _L0_6s
  498. _L0_3s:
  499. cmpi.b %d1,&INF # is operand an INF?
  500. bne.b _L0_4s # no
  501. bsr.l t_operr # yes
  502. bra.b _L0_6s
  503. _L0_4s:
  504. cmpi.b %d1,&QNAN # is operand a QNAN?
  505. bne.b _L0_5s # no
  506. bsr.l src_qnan # yes
  507. bra.b _L0_6s
  508. _L0_5s:
  509. bsr.l ssind # operand is a DENORM
  510. _L0_6s:
  511. #
  512. # Result is now in FP0
  513. #
  514. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  515. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  516. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  517. unlk %a6
  518. rts
  519. global _fsind_
  520. _fsind_:
  521. link %a6,&-LOCAL_SIZE
  522. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  523. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  524. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  525. fmov.l &0x0,%fpcr # zero FPCR
  526. #
  527. # copy, convert, and tag input argument
  528. #
  529. fmov.d 0x8(%a6),%fp0 # load dbl input
  530. fmov.x %fp0,FP_SRC(%a6)
  531. lea FP_SRC(%a6),%a0
  532. bsr.l tag # fetch operand type
  533. mov.b %d0,STAG(%a6)
  534. mov.b %d0,%d1
  535. andi.l &0x00ff00ff,USER_FPSR(%a6)
  536. clr.l %d0
  537. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  538. mov.b %d1,STAG(%a6)
  539. tst.b %d1
  540. bne.b _L0_2d
  541. bsr.l ssin # operand is a NORM
  542. bra.b _L0_6d
  543. _L0_2d:
  544. cmpi.b %d1,&ZERO # is operand a ZERO?
  545. bne.b _L0_3d # no
  546. bsr.l src_zero # yes
  547. bra.b _L0_6d
  548. _L0_3d:
  549. cmpi.b %d1,&INF # is operand an INF?
  550. bne.b _L0_4d # no
  551. bsr.l t_operr # yes
  552. bra.b _L0_6d
  553. _L0_4d:
  554. cmpi.b %d1,&QNAN # is operand a QNAN?
  555. bne.b _L0_5d # no
  556. bsr.l src_qnan # yes
  557. bra.b _L0_6d
  558. _L0_5d:
  559. bsr.l ssind # operand is a DENORM
  560. _L0_6d:
  561. #
  562. # Result is now in FP0
  563. #
  564. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  565. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  566. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  567. unlk %a6
  568. rts
  569. global _fsinx_
  570. _fsinx_:
  571. link %a6,&-LOCAL_SIZE
  572. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  573. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  574. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  575. fmov.l &0x0,%fpcr # zero FPCR
  576. #
  577. # copy, convert, and tag input argument
  578. #
  579. lea FP_SRC(%a6),%a0
  580. mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
  581. mov.l 0x8+0x4(%a6),0x4(%a0)
  582. mov.l 0x8+0x8(%a6),0x8(%a0)
  583. bsr.l tag # fetch operand type
  584. mov.b %d0,STAG(%a6)
  585. mov.b %d0,%d1
  586. andi.l &0x00ff00ff,USER_FPSR(%a6)
  587. clr.l %d0
  588. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  589. tst.b %d1
  590. bne.b _L0_2x
  591. bsr.l ssin # operand is a NORM
  592. bra.b _L0_6x
  593. _L0_2x:
  594. cmpi.b %d1,&ZERO # is operand a ZERO?
  595. bne.b _L0_3x # no
  596. bsr.l src_zero # yes
  597. bra.b _L0_6x
  598. _L0_3x:
  599. cmpi.b %d1,&INF # is operand an INF?
  600. bne.b _L0_4x # no
  601. bsr.l t_operr # yes
  602. bra.b _L0_6x
  603. _L0_4x:
  604. cmpi.b %d1,&QNAN # is operand a QNAN?
  605. bne.b _L0_5x # no
  606. bsr.l src_qnan # yes
  607. bra.b _L0_6x
  608. _L0_5x:
  609. bsr.l ssind # operand is a DENORM
  610. _L0_6x:
  611. #
  612. # Result is now in FP0
  613. #
  614. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  615. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  616. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  617. unlk %a6
  618. rts
  619. #########################################################################
  620. # MONADIC TEMPLATE #
  621. #########################################################################
  622. global _fcoss_
  623. _fcoss_:
  624. link %a6,&-LOCAL_SIZE
  625. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  626. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  627. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  628. fmov.l &0x0,%fpcr # zero FPCR
  629. #
  630. # copy, convert, and tag input argument
  631. #
  632. fmov.s 0x8(%a6),%fp0 # load sgl input
  633. fmov.x %fp0,FP_SRC(%a6)
  634. lea FP_SRC(%a6),%a0
  635. bsr.l tag # fetch operand type
  636. mov.b %d0,STAG(%a6)
  637. mov.b %d0,%d1
  638. andi.l &0x00ff00ff,USER_FPSR(%a6)
  639. clr.l %d0
  640. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  641. tst.b %d1
  642. bne.b _L1_2s
  643. bsr.l scos # operand is a NORM
  644. bra.b _L1_6s
  645. _L1_2s:
  646. cmpi.b %d1,&ZERO # is operand a ZERO?
  647. bne.b _L1_3s # no
  648. bsr.l ld_pone # yes
  649. bra.b _L1_6s
  650. _L1_3s:
  651. cmpi.b %d1,&INF # is operand an INF?
  652. bne.b _L1_4s # no
  653. bsr.l t_operr # yes
  654. bra.b _L1_6s
  655. _L1_4s:
  656. cmpi.b %d1,&QNAN # is operand a QNAN?
  657. bne.b _L1_5s # no
  658. bsr.l src_qnan # yes
  659. bra.b _L1_6s
  660. _L1_5s:
  661. bsr.l scosd # operand is a DENORM
  662. _L1_6s:
  663. #
  664. # Result is now in FP0
  665. #
  666. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  667. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  668. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  669. unlk %a6
  670. rts
  671. global _fcosd_
  672. _fcosd_:
  673. link %a6,&-LOCAL_SIZE
  674. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  675. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  676. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  677. fmov.l &0x0,%fpcr # zero FPCR
  678. #
  679. # copy, convert, and tag input argument
  680. #
  681. fmov.d 0x8(%a6),%fp0 # load dbl input
  682. fmov.x %fp0,FP_SRC(%a6)
  683. lea FP_SRC(%a6),%a0
  684. bsr.l tag # fetch operand type
  685. mov.b %d0,STAG(%a6)
  686. mov.b %d0,%d1
  687. andi.l &0x00ff00ff,USER_FPSR(%a6)
  688. clr.l %d0
  689. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  690. mov.b %d1,STAG(%a6)
  691. tst.b %d1
  692. bne.b _L1_2d
  693. bsr.l scos # operand is a NORM
  694. bra.b _L1_6d
  695. _L1_2d:
  696. cmpi.b %d1,&ZERO # is operand a ZERO?
  697. bne.b _L1_3d # no
  698. bsr.l ld_pone # yes
  699. bra.b _L1_6d
  700. _L1_3d:
  701. cmpi.b %d1,&INF # is operand an INF?
  702. bne.b _L1_4d # no
  703. bsr.l t_operr # yes
  704. bra.b _L1_6d
  705. _L1_4d:
  706. cmpi.b %d1,&QNAN # is operand a QNAN?
  707. bne.b _L1_5d # no
  708. bsr.l src_qnan # yes
  709. bra.b _L1_6d
  710. _L1_5d:
  711. bsr.l scosd # operand is a DENORM
  712. _L1_6d:
  713. #
  714. # Result is now in FP0
  715. #
  716. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  717. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  718. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  719. unlk %a6
  720. rts
  721. global _fcosx_
  722. _fcosx_:
  723. link %a6,&-LOCAL_SIZE
  724. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  725. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  726. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  727. fmov.l &0x0,%fpcr # zero FPCR
  728. #
  729. # copy, convert, and tag input argument
  730. #
  731. lea FP_SRC(%a6),%a0
  732. mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
  733. mov.l 0x8+0x4(%a6),0x4(%a0)
  734. mov.l 0x8+0x8(%a6),0x8(%a0)
  735. bsr.l tag # fetch operand type
  736. mov.b %d0,STAG(%a6)
  737. mov.b %d0,%d1
  738. andi.l &0x00ff00ff,USER_FPSR(%a6)
  739. clr.l %d0
  740. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  741. tst.b %d1
  742. bne.b _L1_2x
  743. bsr.l scos # operand is a NORM
  744. bra.b _L1_6x
  745. _L1_2x:
  746. cmpi.b %d1,&ZERO # is operand a ZERO?
  747. bne.b _L1_3x # no
  748. bsr.l ld_pone # yes
  749. bra.b _L1_6x
  750. _L1_3x:
  751. cmpi.b %d1,&INF # is operand an INF?
  752. bne.b _L1_4x # no
  753. bsr.l t_operr # yes
  754. bra.b _L1_6x
  755. _L1_4x:
  756. cmpi.b %d1,&QNAN # is operand a QNAN?
  757. bne.b _L1_5x # no
  758. bsr.l src_qnan # yes
  759. bra.b _L1_6x
  760. _L1_5x:
  761. bsr.l scosd # operand is a DENORM
  762. _L1_6x:
  763. #
  764. # Result is now in FP0
  765. #
  766. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  767. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  768. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  769. unlk %a6
  770. rts
  771. #########################################################################
  772. # MONADIC TEMPLATE #
  773. #########################################################################
  774. global _fsinhs_
  775. _fsinhs_:
  776. link %a6,&-LOCAL_SIZE
  777. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  778. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  779. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  780. fmov.l &0x0,%fpcr # zero FPCR
  781. #
  782. # copy, convert, and tag input argument
  783. #
  784. fmov.s 0x8(%a6),%fp0 # load sgl input
  785. fmov.x %fp0,FP_SRC(%a6)
  786. lea FP_SRC(%a6),%a0
  787. bsr.l tag # fetch operand type
  788. mov.b %d0,STAG(%a6)
  789. mov.b %d0,%d1
  790. andi.l &0x00ff00ff,USER_FPSR(%a6)
  791. clr.l %d0
  792. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  793. tst.b %d1
  794. bne.b _L2_2s
  795. bsr.l ssinh # operand is a NORM
  796. bra.b _L2_6s
  797. _L2_2s:
  798. cmpi.b %d1,&ZERO # is operand a ZERO?
  799. bne.b _L2_3s # no
  800. bsr.l src_zero # yes
  801. bra.b _L2_6s
  802. _L2_3s:
  803. cmpi.b %d1,&INF # is operand an INF?
  804. bne.b _L2_4s # no
  805. bsr.l src_inf # yes
  806. bra.b _L2_6s
  807. _L2_4s:
  808. cmpi.b %d1,&QNAN # is operand a QNAN?
  809. bne.b _L2_5s # no
  810. bsr.l src_qnan # yes
  811. bra.b _L2_6s
  812. _L2_5s:
  813. bsr.l ssinhd # operand is a DENORM
  814. _L2_6s:
  815. #
  816. # Result is now in FP0
  817. #
  818. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  819. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  820. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  821. unlk %a6
  822. rts
  823. global _fsinhd_
  824. _fsinhd_:
  825. link %a6,&-LOCAL_SIZE
  826. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  827. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  828. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  829. fmov.l &0x0,%fpcr # zero FPCR
  830. #
  831. # copy, convert, and tag input argument
  832. #
  833. fmov.d 0x8(%a6),%fp0 # load dbl input
  834. fmov.x %fp0,FP_SRC(%a6)
  835. lea FP_SRC(%a6),%a0
  836. bsr.l tag # fetch operand type
  837. mov.b %d0,STAG(%a6)
  838. mov.b %d0,%d1
  839. andi.l &0x00ff00ff,USER_FPSR(%a6)
  840. clr.l %d0
  841. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  842. mov.b %d1,STAG(%a6)
  843. tst.b %d1
  844. bne.b _L2_2d
  845. bsr.l ssinh # operand is a NORM
  846. bra.b _L2_6d
  847. _L2_2d:
  848. cmpi.b %d1,&ZERO # is operand a ZERO?
  849. bne.b _L2_3d # no
  850. bsr.l src_zero # yes
  851. bra.b _L2_6d
  852. _L2_3d:
  853. cmpi.b %d1,&INF # is operand an INF?
  854. bne.b _L2_4d # no
  855. bsr.l src_inf # yes
  856. bra.b _L2_6d
  857. _L2_4d:
  858. cmpi.b %d1,&QNAN # is operand a QNAN?
  859. bne.b _L2_5d # no
  860. bsr.l src_qnan # yes
  861. bra.b _L2_6d
  862. _L2_5d:
  863. bsr.l ssinhd # operand is a DENORM
  864. _L2_6d:
  865. #
  866. # Result is now in FP0
  867. #
  868. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  869. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  870. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  871. unlk %a6
  872. rts
  873. global _fsinhx_
  874. _fsinhx_:
  875. link %a6,&-LOCAL_SIZE
  876. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  877. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  878. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  879. fmov.l &0x0,%fpcr # zero FPCR
  880. #
  881. # copy, convert, and tag input argument
  882. #
  883. lea FP_SRC(%a6),%a0
  884. mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
  885. mov.l 0x8+0x4(%a6),0x4(%a0)
  886. mov.l 0x8+0x8(%a6),0x8(%a0)
  887. bsr.l tag # fetch operand type
  888. mov.b %d0,STAG(%a6)
  889. mov.b %d0,%d1
  890. andi.l &0x00ff00ff,USER_FPSR(%a6)
  891. clr.l %d0
  892. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  893. tst.b %d1
  894. bne.b _L2_2x
  895. bsr.l ssinh # operand is a NORM
  896. bra.b _L2_6x
  897. _L2_2x:
  898. cmpi.b %d1,&ZERO # is operand a ZERO?
  899. bne.b _L2_3x # no
  900. bsr.l src_zero # yes
  901. bra.b _L2_6x
  902. _L2_3x:
  903. cmpi.b %d1,&INF # is operand an INF?
  904. bne.b _L2_4x # no
  905. bsr.l src_inf # yes
  906. bra.b _L2_6x
  907. _L2_4x:
  908. cmpi.b %d1,&QNAN # is operand a QNAN?
  909. bne.b _L2_5x # no
  910. bsr.l src_qnan # yes
  911. bra.b _L2_6x
  912. _L2_5x:
  913. bsr.l ssinhd # operand is a DENORM
  914. _L2_6x:
  915. #
  916. # Result is now in FP0
  917. #
  918. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  919. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  920. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  921. unlk %a6
  922. rts
  923. #########################################################################
  924. # MONADIC TEMPLATE #
  925. #########################################################################
  926. global _flognp1s_
  927. _flognp1s_:
  928. link %a6,&-LOCAL_SIZE
  929. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  930. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  931. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  932. fmov.l &0x0,%fpcr # zero FPCR
  933. #
  934. # copy, convert, and tag input argument
  935. #
  936. fmov.s 0x8(%a6),%fp0 # load sgl input
  937. fmov.x %fp0,FP_SRC(%a6)
  938. lea FP_SRC(%a6),%a0
  939. bsr.l tag # fetch operand type
  940. mov.b %d0,STAG(%a6)
  941. mov.b %d0,%d1
  942. andi.l &0x00ff00ff,USER_FPSR(%a6)
  943. clr.l %d0
  944. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  945. tst.b %d1
  946. bne.b _L3_2s
  947. bsr.l slognp1 # operand is a NORM
  948. bra.b _L3_6s
  949. _L3_2s:
  950. cmpi.b %d1,&ZERO # is operand a ZERO?
  951. bne.b _L3_3s # no
  952. bsr.l src_zero # yes
  953. bra.b _L3_6s
  954. _L3_3s:
  955. cmpi.b %d1,&INF # is operand an INF?
  956. bne.b _L3_4s # no
  957. bsr.l sopr_inf # yes
  958. bra.b _L3_6s
  959. _L3_4s:
  960. cmpi.b %d1,&QNAN # is operand a QNAN?
  961. bne.b _L3_5s # no
  962. bsr.l src_qnan # yes
  963. bra.b _L3_6s
  964. _L3_5s:
  965. bsr.l slognp1d # operand is a DENORM
  966. _L3_6s:
  967. #
  968. # Result is now in FP0
  969. #
  970. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  971. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  972. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  973. unlk %a6
  974. rts
  975. global _flognp1d_
  976. _flognp1d_:
  977. link %a6,&-LOCAL_SIZE
  978. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  979. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  980. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  981. fmov.l &0x0,%fpcr # zero FPCR
  982. #
  983. # copy, convert, and tag input argument
  984. #
  985. fmov.d 0x8(%a6),%fp0 # load dbl input
  986. fmov.x %fp0,FP_SRC(%a6)
  987. lea FP_SRC(%a6),%a0
  988. bsr.l tag # fetch operand type
  989. mov.b %d0,STAG(%a6)
  990. mov.b %d0,%d1
  991. andi.l &0x00ff00ff,USER_FPSR(%a6)
  992. clr.l %d0
  993. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  994. mov.b %d1,STAG(%a6)
  995. tst.b %d1
  996. bne.b _L3_2d
  997. bsr.l slognp1 # operand is a NORM
  998. bra.b _L3_6d
  999. _L3_2d:
  1000. cmpi.b %d1,&ZERO # is operand a ZERO?
  1001. bne.b _L3_3d # no
  1002. bsr.l src_zero # yes
  1003. bra.b _L3_6d
  1004. _L3_3d:
  1005. cmpi.b %d1,&INF # is operand an INF?
  1006. bne.b _L3_4d # no
  1007. bsr.l sopr_inf # yes
  1008. bra.b _L3_6d
  1009. _L3_4d:
  1010. cmpi.b %d1,&QNAN # is operand a QNAN?
  1011. bne.b _L3_5d # no
  1012. bsr.l src_qnan # yes
  1013. bra.b _L3_6d
  1014. _L3_5d:
  1015. bsr.l slognp1d # operand is a DENORM
  1016. _L3_6d:
  1017. #
  1018. # Result is now in FP0
  1019. #
  1020. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1021. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1022. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1023. unlk %a6
  1024. rts
  1025. global _flognp1x_
  1026. _flognp1x_:
  1027. link %a6,&-LOCAL_SIZE
  1028. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1029. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1030. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1031. fmov.l &0x0,%fpcr # zero FPCR
  1032. #
  1033. # copy, convert, and tag input argument
  1034. #
  1035. lea FP_SRC(%a6),%a0
  1036. mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
  1037. mov.l 0x8+0x4(%a6),0x4(%a0)
  1038. mov.l 0x8+0x8(%a6),0x8(%a0)
  1039. bsr.l tag # fetch operand type
  1040. mov.b %d0,STAG(%a6)
  1041. mov.b %d0,%d1
  1042. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1043. clr.l %d0
  1044. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1045. tst.b %d1
  1046. bne.b _L3_2x
  1047. bsr.l slognp1 # operand is a NORM
  1048. bra.b _L3_6x
  1049. _L3_2x:
  1050. cmpi.b %d1,&ZERO # is operand a ZERO?
  1051. bne.b _L3_3x # no
  1052. bsr.l src_zero # yes
  1053. bra.b _L3_6x
  1054. _L3_3x:
  1055. cmpi.b %d1,&INF # is operand an INF?
  1056. bne.b _L3_4x # no
  1057. bsr.l sopr_inf # yes
  1058. bra.b _L3_6x
  1059. _L3_4x:
  1060. cmpi.b %d1,&QNAN # is operand a QNAN?
  1061. bne.b _L3_5x # no
  1062. bsr.l src_qnan # yes
  1063. bra.b _L3_6x
  1064. _L3_5x:
  1065. bsr.l slognp1d # operand is a DENORM
  1066. _L3_6x:
  1067. #
  1068. # Result is now in FP0
  1069. #
  1070. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1071. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1072. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1073. unlk %a6
  1074. rts
  1075. #########################################################################
  1076. # MONADIC TEMPLATE #
  1077. #########################################################################
  1078. global _fetoxm1s_
  1079. _fetoxm1s_:
  1080. link %a6,&-LOCAL_SIZE
  1081. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1082. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1083. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1084. fmov.l &0x0,%fpcr # zero FPCR
  1085. #
  1086. # copy, convert, and tag input argument
  1087. #
  1088. fmov.s 0x8(%a6),%fp0 # load sgl input
  1089. fmov.x %fp0,FP_SRC(%a6)
  1090. lea FP_SRC(%a6),%a0
  1091. bsr.l tag # fetch operand type
  1092. mov.b %d0,STAG(%a6)
  1093. mov.b %d0,%d1
  1094. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1095. clr.l %d0
  1096. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1097. tst.b %d1
  1098. bne.b _L4_2s
  1099. bsr.l setoxm1 # operand is a NORM
  1100. bra.b _L4_6s
  1101. _L4_2s:
  1102. cmpi.b %d1,&ZERO # is operand a ZERO?
  1103. bne.b _L4_3s # no
  1104. bsr.l src_zero # yes
  1105. bra.b _L4_6s
  1106. _L4_3s:
  1107. cmpi.b %d1,&INF # is operand an INF?
  1108. bne.b _L4_4s # no
  1109. bsr.l setoxm1i # yes
  1110. bra.b _L4_6s
  1111. _L4_4s:
  1112. cmpi.b %d1,&QNAN # is operand a QNAN?
  1113. bne.b _L4_5s # no
  1114. bsr.l src_qnan # yes
  1115. bra.b _L4_6s
  1116. _L4_5s:
  1117. bsr.l setoxm1d # operand is a DENORM
  1118. _L4_6s:
  1119. #
  1120. # Result is now in FP0
  1121. #
  1122. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1123. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1124. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1125. unlk %a6
  1126. rts
  1127. global _fetoxm1d_
  1128. _fetoxm1d_:
  1129. link %a6,&-LOCAL_SIZE
  1130. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1131. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1132. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1133. fmov.l &0x0,%fpcr # zero FPCR
  1134. #
  1135. # copy, convert, and tag input argument
  1136. #
  1137. fmov.d 0x8(%a6),%fp0 # load dbl input
  1138. fmov.x %fp0,FP_SRC(%a6)
  1139. lea FP_SRC(%a6),%a0
  1140. bsr.l tag # fetch operand type
  1141. mov.b %d0,STAG(%a6)
  1142. mov.b %d0,%d1
  1143. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1144. clr.l %d0
  1145. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1146. mov.b %d1,STAG(%a6)
  1147. tst.b %d1
  1148. bne.b _L4_2d
  1149. bsr.l setoxm1 # operand is a NORM
  1150. bra.b _L4_6d
  1151. _L4_2d:
  1152. cmpi.b %d1,&ZERO # is operand a ZERO?
  1153. bne.b _L4_3d # no
  1154. bsr.l src_zero # yes
  1155. bra.b _L4_6d
  1156. _L4_3d:
  1157. cmpi.b %d1,&INF # is operand an INF?
  1158. bne.b _L4_4d # no
  1159. bsr.l setoxm1i # yes
  1160. bra.b _L4_6d
  1161. _L4_4d:
  1162. cmpi.b %d1,&QNAN # is operand a QNAN?
  1163. bne.b _L4_5d # no
  1164. bsr.l src_qnan # yes
  1165. bra.b _L4_6d
  1166. _L4_5d:
  1167. bsr.l setoxm1d # operand is a DENORM
  1168. _L4_6d:
  1169. #
  1170. # Result is now in FP0
  1171. #
  1172. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1173. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1174. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1175. unlk %a6
  1176. rts
  1177. global _fetoxm1x_
  1178. _fetoxm1x_:
  1179. link %a6,&-LOCAL_SIZE
  1180. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1181. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1182. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1183. fmov.l &0x0,%fpcr # zero FPCR
  1184. #
  1185. # copy, convert, and tag input argument
  1186. #
  1187. lea FP_SRC(%a6),%a0
  1188. mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
  1189. mov.l 0x8+0x4(%a6),0x4(%a0)
  1190. mov.l 0x8+0x8(%a6),0x8(%a0)
  1191. bsr.l tag # fetch operand type
  1192. mov.b %d0,STAG(%a6)
  1193. mov.b %d0,%d1
  1194. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1195. clr.l %d0
  1196. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1197. tst.b %d1
  1198. bne.b _L4_2x
  1199. bsr.l setoxm1 # operand is a NORM
  1200. bra.b _L4_6x
  1201. _L4_2x:
  1202. cmpi.b %d1,&ZERO # is operand a ZERO?
  1203. bne.b _L4_3x # no
  1204. bsr.l src_zero # yes
  1205. bra.b _L4_6x
  1206. _L4_3x:
  1207. cmpi.b %d1,&INF # is operand an INF?
  1208. bne.b _L4_4x # no
  1209. bsr.l setoxm1i # yes
  1210. bra.b _L4_6x
  1211. _L4_4x:
  1212. cmpi.b %d1,&QNAN # is operand a QNAN?
  1213. bne.b _L4_5x # no
  1214. bsr.l src_qnan # yes
  1215. bra.b _L4_6x
  1216. _L4_5x:
  1217. bsr.l setoxm1d # operand is a DENORM
  1218. _L4_6x:
  1219. #
  1220. # Result is now in FP0
  1221. #
  1222. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1223. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1224. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1225. unlk %a6
  1226. rts
  1227. #########################################################################
  1228. # MONADIC TEMPLATE #
  1229. #########################################################################
  1230. global _ftanhs_
  1231. _ftanhs_:
  1232. link %a6,&-LOCAL_SIZE
  1233. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1234. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1235. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1236. fmov.l &0x0,%fpcr # zero FPCR
  1237. #
  1238. # copy, convert, and tag input argument
  1239. #
  1240. fmov.s 0x8(%a6),%fp0 # load sgl input
  1241. fmov.x %fp0,FP_SRC(%a6)
  1242. lea FP_SRC(%a6),%a0
  1243. bsr.l tag # fetch operand type
  1244. mov.b %d0,STAG(%a6)
  1245. mov.b %d0,%d1
  1246. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1247. clr.l %d0
  1248. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1249. tst.b %d1
  1250. bne.b _L5_2s
  1251. bsr.l stanh # operand is a NORM
  1252. bra.b _L5_6s
  1253. _L5_2s:
  1254. cmpi.b %d1,&ZERO # is operand a ZERO?
  1255. bne.b _L5_3s # no
  1256. bsr.l src_zero # yes
  1257. bra.b _L5_6s
  1258. _L5_3s:
  1259. cmpi.b %d1,&INF # is operand an INF?
  1260. bne.b _L5_4s # no
  1261. bsr.l src_one # yes
  1262. bra.b _L5_6s
  1263. _L5_4s:
  1264. cmpi.b %d1,&QNAN # is operand a QNAN?
  1265. bne.b _L5_5s # no
  1266. bsr.l src_qnan # yes
  1267. bra.b _L5_6s
  1268. _L5_5s:
  1269. bsr.l stanhd # operand is a DENORM
  1270. _L5_6s:
  1271. #
  1272. # Result is now in FP0
  1273. #
  1274. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1275. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1276. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1277. unlk %a6
  1278. rts
  1279. global _ftanhd_
  1280. _ftanhd_:
  1281. link %a6,&-LOCAL_SIZE
  1282. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1283. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1284. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1285. fmov.l &0x0,%fpcr # zero FPCR
  1286. #
  1287. # copy, convert, and tag input argument
  1288. #
  1289. fmov.d 0x8(%a6),%fp0 # load dbl input
  1290. fmov.x %fp0,FP_SRC(%a6)
  1291. lea FP_SRC(%a6),%a0
  1292. bsr.l tag # fetch operand type
  1293. mov.b %d0,STAG(%a6)
  1294. mov.b %d0,%d1
  1295. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1296. clr.l %d0
  1297. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1298. mov.b %d1,STAG(%a6)
  1299. tst.b %d1
  1300. bne.b _L5_2d
  1301. bsr.l stanh # operand is a NORM
  1302. bra.b _L5_6d
  1303. _L5_2d:
  1304. cmpi.b %d1,&ZERO # is operand a ZERO?
  1305. bne.b _L5_3d # no
  1306. bsr.l src_zero # yes
  1307. bra.b _L5_6d
  1308. _L5_3d:
  1309. cmpi.b %d1,&INF # is operand an INF?
  1310. bne.b _L5_4d # no
  1311. bsr.l src_one # yes
  1312. bra.b _L5_6d
  1313. _L5_4d:
  1314. cmpi.b %d1,&QNAN # is operand a QNAN?
  1315. bne.b _L5_5d # no
  1316. bsr.l src_qnan # yes
  1317. bra.b _L5_6d
  1318. _L5_5d:
  1319. bsr.l stanhd # operand is a DENORM
  1320. _L5_6d:
  1321. #
  1322. # Result is now in FP0
  1323. #
  1324. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1325. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1326. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1327. unlk %a6
  1328. rts
  1329. global _ftanhx_
  1330. _ftanhx_:
  1331. link %a6,&-LOCAL_SIZE
  1332. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1333. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1334. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1335. fmov.l &0x0,%fpcr # zero FPCR
  1336. #
  1337. # copy, convert, and tag input argument
  1338. #
  1339. lea FP_SRC(%a6),%a0
  1340. mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
  1341. mov.l 0x8+0x4(%a6),0x4(%a0)
  1342. mov.l 0x8+0x8(%a6),0x8(%a0)
  1343. bsr.l tag # fetch operand type
  1344. mov.b %d0,STAG(%a6)
  1345. mov.b %d0,%d1
  1346. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1347. clr.l %d0
  1348. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1349. tst.b %d1
  1350. bne.b _L5_2x
  1351. bsr.l stanh # operand is a NORM
  1352. bra.b _L5_6x
  1353. _L5_2x:
  1354. cmpi.b %d1,&ZERO # is operand a ZERO?
  1355. bne.b _L5_3x # no
  1356. bsr.l src_zero # yes
  1357. bra.b _L5_6x
  1358. _L5_3x:
  1359. cmpi.b %d1,&INF # is operand an INF?
  1360. bne.b _L5_4x # no
  1361. bsr.l src_one # yes
  1362. bra.b _L5_6x
  1363. _L5_4x:
  1364. cmpi.b %d1,&QNAN # is operand a QNAN?
  1365. bne.b _L5_5x # no
  1366. bsr.l src_qnan # yes
  1367. bra.b _L5_6x
  1368. _L5_5x:
  1369. bsr.l stanhd # operand is a DENORM
  1370. _L5_6x:
  1371. #
  1372. # Result is now in FP0
  1373. #
  1374. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1375. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1376. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1377. unlk %a6
  1378. rts
  1379. #########################################################################
  1380. # MONADIC TEMPLATE #
  1381. #########################################################################
  1382. global _fatans_
  1383. _fatans_:
  1384. link %a6,&-LOCAL_SIZE
  1385. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1386. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1387. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1388. fmov.l &0x0,%fpcr # zero FPCR
  1389. #
  1390. # copy, convert, and tag input argument
  1391. #
  1392. fmov.s 0x8(%a6),%fp0 # load sgl input
  1393. fmov.x %fp0,FP_SRC(%a6)
  1394. lea FP_SRC(%a6),%a0
  1395. bsr.l tag # fetch operand type
  1396. mov.b %d0,STAG(%a6)
  1397. mov.b %d0,%d1
  1398. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1399. clr.l %d0
  1400. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1401. tst.b %d1
  1402. bne.b _L6_2s
  1403. bsr.l satan # operand is a NORM
  1404. bra.b _L6_6s
  1405. _L6_2s:
  1406. cmpi.b %d1,&ZERO # is operand a ZERO?
  1407. bne.b _L6_3s # no
  1408. bsr.l src_zero # yes
  1409. bra.b _L6_6s
  1410. _L6_3s:
  1411. cmpi.b %d1,&INF # is operand an INF?
  1412. bne.b _L6_4s # no
  1413. bsr.l spi_2 # yes
  1414. bra.b _L6_6s
  1415. _L6_4s:
  1416. cmpi.b %d1,&QNAN # is operand a QNAN?
  1417. bne.b _L6_5s # no
  1418. bsr.l src_qnan # yes
  1419. bra.b _L6_6s
  1420. _L6_5s:
  1421. bsr.l satand # operand is a DENORM
  1422. _L6_6s:
  1423. #
  1424. # Result is now in FP0
  1425. #
  1426. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1427. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1428. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1429. unlk %a6
  1430. rts
  1431. global _fatand_
  1432. _fatand_:
  1433. link %a6,&-LOCAL_SIZE
  1434. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1435. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1436. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1437. fmov.l &0x0,%fpcr # zero FPCR
  1438. #
  1439. # copy, convert, and tag input argument
  1440. #
  1441. fmov.d 0x8(%a6),%fp0 # load dbl input
  1442. fmov.x %fp0,FP_SRC(%a6)
  1443. lea FP_SRC(%a6),%a0
  1444. bsr.l tag # fetch operand type
  1445. mov.b %d0,STAG(%a6)
  1446. mov.b %d0,%d1
  1447. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1448. clr.l %d0
  1449. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1450. mov.b %d1,STAG(%a6)
  1451. tst.b %d1
  1452. bne.b _L6_2d
  1453. bsr.l satan # operand is a NORM
  1454. bra.b _L6_6d
  1455. _L6_2d:
  1456. cmpi.b %d1,&ZERO # is operand a ZERO?
  1457. bne.b _L6_3d # no
  1458. bsr.l src_zero # yes
  1459. bra.b _L6_6d
  1460. _L6_3d:
  1461. cmpi.b %d1,&INF # is operand an INF?
  1462. bne.b _L6_4d # no
  1463. bsr.l spi_2 # yes
  1464. bra.b _L6_6d
  1465. _L6_4d:
  1466. cmpi.b %d1,&QNAN # is operand a QNAN?
  1467. bne.b _L6_5d # no
  1468. bsr.l src_qnan # yes
  1469. bra.b _L6_6d
  1470. _L6_5d:
  1471. bsr.l satand # operand is a DENORM
  1472. _L6_6d:
  1473. #
  1474. # Result is now in FP0
  1475. #
  1476. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1477. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1478. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1479. unlk %a6
  1480. rts
  1481. global _fatanx_
  1482. _fatanx_:
  1483. link %a6,&-LOCAL_SIZE
  1484. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1485. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1486. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1487. fmov.l &0x0,%fpcr # zero FPCR
  1488. #
  1489. # copy, convert, and tag input argument
  1490. #
  1491. lea FP_SRC(%a6),%a0
  1492. mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
  1493. mov.l 0x8+0x4(%a6),0x4(%a0)
  1494. mov.l 0x8+0x8(%a6),0x8(%a0)
  1495. bsr.l tag # fetch operand type
  1496. mov.b %d0,STAG(%a6)
  1497. mov.b %d0,%d1
  1498. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1499. clr.l %d0
  1500. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1501. tst.b %d1
  1502. bne.b _L6_2x
  1503. bsr.l satan # operand is a NORM
  1504. bra.b _L6_6x
  1505. _L6_2x:
  1506. cmpi.b %d1,&ZERO # is operand a ZERO?
  1507. bne.b _L6_3x # no
  1508. bsr.l src_zero # yes
  1509. bra.b _L6_6x
  1510. _L6_3x:
  1511. cmpi.b %d1,&INF # is operand an INF?
  1512. bne.b _L6_4x # no
  1513. bsr.l spi_2 # yes
  1514. bra.b _L6_6x
  1515. _L6_4x:
  1516. cmpi.b %d1,&QNAN # is operand a QNAN?
  1517. bne.b _L6_5x # no
  1518. bsr.l src_qnan # yes
  1519. bra.b _L6_6x
  1520. _L6_5x:
  1521. bsr.l satand # operand is a DENORM
  1522. _L6_6x:
  1523. #
  1524. # Result is now in FP0
  1525. #
  1526. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1527. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1528. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1529. unlk %a6
  1530. rts
  1531. #########################################################################
  1532. # MONADIC TEMPLATE #
  1533. #########################################################################
  1534. global _fasins_
  1535. _fasins_:
  1536. link %a6,&-LOCAL_SIZE
  1537. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1538. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1539. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1540. fmov.l &0x0,%fpcr # zero FPCR
  1541. #
  1542. # copy, convert, and tag input argument
  1543. #
  1544. fmov.s 0x8(%a6),%fp0 # load sgl input
  1545. fmov.x %fp0,FP_SRC(%a6)
  1546. lea FP_SRC(%a6),%a0
  1547. bsr.l tag # fetch operand type
  1548. mov.b %d0,STAG(%a6)
  1549. mov.b %d0,%d1
  1550. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1551. clr.l %d0
  1552. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1553. tst.b %d1
  1554. bne.b _L7_2s
  1555. bsr.l sasin # operand is a NORM
  1556. bra.b _L7_6s
  1557. _L7_2s:
  1558. cmpi.b %d1,&ZERO # is operand a ZERO?
  1559. bne.b _L7_3s # no
  1560. bsr.l src_zero # yes
  1561. bra.b _L7_6s
  1562. _L7_3s:
  1563. cmpi.b %d1,&INF # is operand an INF?
  1564. bne.b _L7_4s # no
  1565. bsr.l t_operr # yes
  1566. bra.b _L7_6s
  1567. _L7_4s:
  1568. cmpi.b %d1,&QNAN # is operand a QNAN?
  1569. bne.b _L7_5s # no
  1570. bsr.l src_qnan # yes
  1571. bra.b _L7_6s
  1572. _L7_5s:
  1573. bsr.l sasind # operand is a DENORM
  1574. _L7_6s:
  1575. #
  1576. # Result is now in FP0
  1577. #
  1578. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1579. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1580. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1581. unlk %a6
  1582. rts
  1583. global _fasind_
  1584. _fasind_:
  1585. link %a6,&-LOCAL_SIZE
  1586. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1587. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1588. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1589. fmov.l &0x0,%fpcr # zero FPCR
  1590. #
  1591. # copy, convert, and tag input argument
  1592. #
  1593. fmov.d 0x8(%a6),%fp0 # load dbl input
  1594. fmov.x %fp0,FP_SRC(%a6)
  1595. lea FP_SRC(%a6),%a0
  1596. bsr.l tag # fetch operand type
  1597. mov.b %d0,STAG(%a6)
  1598. mov.b %d0,%d1
  1599. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1600. clr.l %d0
  1601. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1602. mov.b %d1,STAG(%a6)
  1603. tst.b %d1
  1604. bne.b _L7_2d
  1605. bsr.l sasin # operand is a NORM
  1606. bra.b _L7_6d
  1607. _L7_2d:
  1608. cmpi.b %d1,&ZERO # is operand a ZERO?
  1609. bne.b _L7_3d # no
  1610. bsr.l src_zero # yes
  1611. bra.b _L7_6d
  1612. _L7_3d:
  1613. cmpi.b %d1,&INF # is operand an INF?
  1614. bne.b _L7_4d # no
  1615. bsr.l t_operr # yes
  1616. bra.b _L7_6d
  1617. _L7_4d:
  1618. cmpi.b %d1,&QNAN # is operand a QNAN?
  1619. bne.b _L7_5d # no
  1620. bsr.l src_qnan # yes
  1621. bra.b _L7_6d
  1622. _L7_5d:
  1623. bsr.l sasind # operand is a DENORM
  1624. _L7_6d:
  1625. #
  1626. # Result is now in FP0
  1627. #
  1628. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1629. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1630. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1631. unlk %a6
  1632. rts
  1633. global _fasinx_
  1634. _fasinx_:
  1635. link %a6,&-LOCAL_SIZE
  1636. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1637. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1638. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1639. fmov.l &0x0,%fpcr # zero FPCR
  1640. #
  1641. # copy, convert, and tag input argument
  1642. #
  1643. lea FP_SRC(%a6),%a0
  1644. mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
  1645. mov.l 0x8+0x4(%a6),0x4(%a0)
  1646. mov.l 0x8+0x8(%a6),0x8(%a0)
  1647. bsr.l tag # fetch operand type
  1648. mov.b %d0,STAG(%a6)
  1649. mov.b %d0,%d1
  1650. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1651. clr.l %d0
  1652. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1653. tst.b %d1
  1654. bne.b _L7_2x
  1655. bsr.l sasin # operand is a NORM
  1656. bra.b _L7_6x
  1657. _L7_2x:
  1658. cmpi.b %d1,&ZERO # is operand a ZERO?
  1659. bne.b _L7_3x # no
  1660. bsr.l src_zero # yes
  1661. bra.b _L7_6x
  1662. _L7_3x:
  1663. cmpi.b %d1,&INF # is operand an INF?
  1664. bne.b _L7_4x # no
  1665. bsr.l t_operr # yes
  1666. bra.b _L7_6x
  1667. _L7_4x:
  1668. cmpi.b %d1,&QNAN # is operand a QNAN?
  1669. bne.b _L7_5x # no
  1670. bsr.l src_qnan # yes
  1671. bra.b _L7_6x
  1672. _L7_5x:
  1673. bsr.l sasind # operand is a DENORM
  1674. _L7_6x:
  1675. #
  1676. # Result is now in FP0
  1677. #
  1678. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1679. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1680. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1681. unlk %a6
  1682. rts
  1683. #########################################################################
  1684. # MONADIC TEMPLATE #
  1685. #########################################################################
  1686. global _fatanhs_
  1687. _fatanhs_:
  1688. link %a6,&-LOCAL_SIZE
  1689. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1690. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1691. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1692. fmov.l &0x0,%fpcr # zero FPCR
  1693. #
  1694. # copy, convert, and tag input argument
  1695. #
  1696. fmov.s 0x8(%a6),%fp0 # load sgl input
  1697. fmov.x %fp0,FP_SRC(%a6)
  1698. lea FP_SRC(%a6),%a0
  1699. bsr.l tag # fetch operand type
  1700. mov.b %d0,STAG(%a6)
  1701. mov.b %d0,%d1
  1702. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1703. clr.l %d0
  1704. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1705. tst.b %d1
  1706. bne.b _L8_2s
  1707. bsr.l satanh # operand is a NORM
  1708. bra.b _L8_6s
  1709. _L8_2s:
  1710. cmpi.b %d1,&ZERO # is operand a ZERO?
  1711. bne.b _L8_3s # no
  1712. bsr.l src_zero # yes
  1713. bra.b _L8_6s
  1714. _L8_3s:
  1715. cmpi.b %d1,&INF # is operand an INF?
  1716. bne.b _L8_4s # no
  1717. bsr.l t_operr # yes
  1718. bra.b _L8_6s
  1719. _L8_4s:
  1720. cmpi.b %d1,&QNAN # is operand a QNAN?
  1721. bne.b _L8_5s # no
  1722. bsr.l src_qnan # yes
  1723. bra.b _L8_6s
  1724. _L8_5s:
  1725. bsr.l satanhd # operand is a DENORM
  1726. _L8_6s:
  1727. #
  1728. # Result is now in FP0
  1729. #
  1730. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1731. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1732. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1733. unlk %a6
  1734. rts
  1735. global _fatanhd_
  1736. _fatanhd_:
  1737. link %a6,&-LOCAL_SIZE
  1738. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1739. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1740. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1741. fmov.l &0x0,%fpcr # zero FPCR
  1742. #
  1743. # copy, convert, and tag input argument
  1744. #
  1745. fmov.d 0x8(%a6),%fp0 # load dbl input
  1746. fmov.x %fp0,FP_SRC(%a6)
  1747. lea FP_SRC(%a6),%a0
  1748. bsr.l tag # fetch operand type
  1749. mov.b %d0,STAG(%a6)
  1750. mov.b %d0,%d1
  1751. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1752. clr.l %d0
  1753. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1754. mov.b %d1,STAG(%a6)
  1755. tst.b %d1
  1756. bne.b _L8_2d
  1757. bsr.l satanh # operand is a NORM
  1758. bra.b _L8_6d
  1759. _L8_2d:
  1760. cmpi.b %d1,&ZERO # is operand a ZERO?
  1761. bne.b _L8_3d # no
  1762. bsr.l src_zero # yes
  1763. bra.b _L8_6d
  1764. _L8_3d:
  1765. cmpi.b %d1,&INF # is operand an INF?
  1766. bne.b _L8_4d # no
  1767. bsr.l t_operr # yes
  1768. bra.b _L8_6d
  1769. _L8_4d:
  1770. cmpi.b %d1,&QNAN # is operand a QNAN?
  1771. bne.b _L8_5d # no
  1772. bsr.l src_qnan # yes
  1773. bra.b _L8_6d
  1774. _L8_5d:
  1775. bsr.l satanhd # operand is a DENORM
  1776. _L8_6d:
  1777. #
  1778. # Result is now in FP0
  1779. #
  1780. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1781. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1782. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1783. unlk %a6
  1784. rts
  1785. global _fatanhx_
  1786. _fatanhx_:
  1787. link %a6,&-LOCAL_SIZE
  1788. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1789. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1790. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1791. fmov.l &0x0,%fpcr # zero FPCR
  1792. #
  1793. # copy, convert, and tag input argument
  1794. #
  1795. lea FP_SRC(%a6),%a0
  1796. mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
  1797. mov.l 0x8+0x4(%a6),0x4(%a0)
  1798. mov.l 0x8+0x8(%a6),0x8(%a0)
  1799. bsr.l tag # fetch operand type
  1800. mov.b %d0,STAG(%a6)
  1801. mov.b %d0,%d1
  1802. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1803. clr.l %d0
  1804. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1805. tst.b %d1
  1806. bne.b _L8_2x
  1807. bsr.l satanh # operand is a NORM
  1808. bra.b _L8_6x
  1809. _L8_2x:
  1810. cmpi.b %d1,&ZERO # is operand a ZERO?
  1811. bne.b _L8_3x # no
  1812. bsr.l src_zero # yes
  1813. bra.b _L8_6x
  1814. _L8_3x:
  1815. cmpi.b %d1,&INF # is operand an INF?
  1816. bne.b _L8_4x # no
  1817. bsr.l t_operr # yes
  1818. bra.b _L8_6x
  1819. _L8_4x:
  1820. cmpi.b %d1,&QNAN # is operand a QNAN?
  1821. bne.b _L8_5x # no
  1822. bsr.l src_qnan # yes
  1823. bra.b _L8_6x
  1824. _L8_5x:
  1825. bsr.l satanhd # operand is a DENORM
  1826. _L8_6x:
  1827. #
  1828. # Result is now in FP0
  1829. #
  1830. movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
  1831. fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
  1832. fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
  1833. unlk %a6
  1834. rts
  1835. #########################################################################
  1836. # MONADIC TEMPLATE #
  1837. #########################################################################
  1838. global _ftans_
  1839. _ftans_:
  1840. link %a6,&-LOCAL_SIZE
  1841. movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
  1842. fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
  1843. fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
  1844. fmov.l &0x0,%fpcr # zero FPCR
  1845. #
  1846. # copy, convert, and tag input argument
  1847. #
  1848. fmov.s 0x8(%a6),%fp0 # load sgl input
  1849. fmov.x %fp0,FP_SRC(%a6)
  1850. lea FP_SRC(%a6),%a0
  1851. bsr.l tag # fetch operand type
  1852. mov.b %d0,STAG(%a6)
  1853. mov.b %d0,%d1
  1854. andi.l &0x00ff00ff,USER_FPSR(%a6)
  1855. clr.l %d0
  1856. mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
  1857. tst.b %d1
  1858. bne.b _L9_2s
  1859. bsr.l stan # operand is a NORM
  1860. bra.b _L9_6s
  1861. _L9_2s:
  1862. cmpi.b %d1,&ZERO # is operand a ZERO?
  1863. bne.b _L9_3s # no
  1864. bsr.l src_zero # yes
  1865. bra.b _L9_6s
  1866. _L9_3s:
  1867. cmpi.b %d1,&INF # is operand an INF?
  1868. bne.b _L9_4s # no
  1869. bsr.l t_operr # yes
  1870. bra.b _L9_6s
  1871. _L9_4s:
  1872. cmpi.b %d1,&QNAN # is operand a QNAN?
  1873. bne.b _L9_5s # no
  1874. bsr.l src_qnan # yes
  1875. bra.b _L9_6s
  1876. _L9_5s:
  1877. bsr.l stand # operand is a DENO