PageRenderTime 87ms CodeModel.GetById 11ms app.highlight 38ms RepoModel.GetById 0ms app.codeStats 2ms

/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
Possible License(s): LGPL-2.0, AGPL-1.0, GPL-2.0

Large files files are truncated, but you can click here to view the full file

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

Large files files are truncated, but you can click here to view the full file