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