Home | History | Annotate | Line # | Download | only in fpsp
MONADIC.CI5 revision 1.1
      1 *	MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
      2 *	M68000 Hi-Performance Microprocessor Division
      3 *	M68040 Software Package 
      4 *
      5 *	M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
      6 *	All rights reserved.
      7 *
      8 *	THE SOFTWARE is provided on an "AS IS" basis and without warranty.
      9 *	To the maximum extent permitted by applicable law,
     10 *	MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
     11 *	INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
     12 *	PARTICULAR PURPOSE and any warranty against infringement with
     13 *	regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
     14 *	and any accompanying written materials. 
     15 *
     16 *	To the maximum extent permitted by applicable law,
     17 *	IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
     18 *	(INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
     19 *	PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
     20 *	OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
     21 *	SOFTWARE.  Motorola assumes no responsibility for the maintenance
     22 *	and support of the SOFTWARE.  
     23 *
     24 *	You are hereby granted a copyright license to use, modify, and
     25 *	distribute the SOFTWARE so long as this entire notice is retained
     26 *	without alteration in any modified and/or redistributed versions,
     27 *	and that such modified versions are clearly identified as such.
     28 *	No licenses are granted by implication, estoppel or otherwise
     29 *	under any patents or trademarks of Motorola, Inc.
     30 
     31 *
     32 *	MONADIC.CI5 1.3 4/30/91
     33 *
     34 *	MONADIC.CI5 --- MONADIC template for CI5 compiler
     35 *
     36 
     37 	xref	tag
     38 	xref	_OPr_
     39 	xref	_OPz_
     40 	xref	_OPi_
     41 	xref	_OPn_
     42 	xref	_OPm_
     43 
     44 
     45 	xdef	_OPd_
     46 _OPd_:
     47 	link	a6,#-LOCAL_SIZE
     48 	fmovem.x fp2-fp3,USER_FP2(a6)
     49 	fmove.l	fpsr,USER_FPSR(a6)
     50 	fmove.l	fpcr,d1		; user's rounding mode/precision
     51 	fmove.l	#0,fpcr		; force rounding mode/prec to extended,rn
     52 *
     53 *	copy, convert and tag input argument
     54 *
     55 	fmove.d	8(a6),fp0
     56 	fmove.x	fp0,ETEMP(a6)
     57 	lea	ETEMP(a6),a0
     58 	bsr	tag
     59 	move.b	d0,STAG(a6)
     60 	tst.b	d0
     61 	bne.b	_TMP_2
     62 	bsr	_OPr_		; normalized (regular) number
     63 	bra.b	_TMP_6
     64 _TMP_2:
     65 	cmp.b	#$20,d0		; zero?
     66 	bne.b	_TMP_3
     67 	bsr	_OPz_
     68 	bra.b	_TMP_6
     69 _TMP_3:
     70 	cmp.b	#$40,d0		; infinity?
     71 	bne.b	_TMP_4
     72 	bsr	_OPi_
     73 	bra.b	_TMP_6
     74 _TMP_4:
     75 	cmp.b	#$60,d0		; NaN?
     76 	bne.b	_TMP_5
     77 	bsr	_OPn_
     78 	bra.b	_TMP_6
     79 _TMP_5:
     80 	bsr	_OPm_		; assuming a denorm...
     81 
     82 _TMP_6:
     83 	fmove.l	fpsr,d0		; update status register
     84 	or.b	USER_FPSR+3(a6),d0	;add previously accrued exceptions
     85 	move.l	d0,USER_FPSR(a6)
     86 *
     87 *	Result is now in FP0
     88 *
     89 	fmovem.x USER_FP2(a6),fp2-fp3	; note: FP1 not restored
     90 	unlk	a6
     91 	rts
     92