Home | History | Annotate | Line # | Download | only in fpsp
MONADIC.R3V6 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.R3V6 1.3 4/30/91
     33 *
     34 *	MONADIC.R3V6 --- MONADIC template for MCD R3V6 native C compiler
     35 *
     36 *	The MCD compiler is old.  It returns float and double values
     37 *	as a double stored in d0/d1.  There is no support for single or extended
     38 *	precision operations.  It's not clear whether the float registers
     39 *	should be preserved, so for speed, they're not.
     40 *
     41 
     42 	xref	tag
     43 	xref	_OPr_
     44 	xref	_OPz_
     45 	xref	_OPi_
     46 	xref	_OPn_
     47 	xref	_OPm_
     48 
     49 	xdef	_OPd_
     50 _OPd_:
     51 	link	a6,#-LOCAL_SIZE
     52 	fmove.l	fpcr,d1		; user's rounding mode/precision
     53 	fmove.l	#0,fpcr		; force rounding mode/prec to extended,rn
     54 *
     55 *	copy, convert and tag input argument
     56 *
     57 	fmove.d	8(a6),fp0
     58 	fmove.x	fp0,ETEMP(a6)
     59 	lea	ETEMP(a6),a0
     60 	bsr	tag
     61 	move.b	d0,STAG(a6)
     62 	tst.b	d0
     63 	bne.b	_TMP_2
     64 	bsr	_OPr_		; normalized (regular) number
     65 	bra.b	_TMP_6
     66 _TMP_2:
     67 	cmp.b	#$20,d0		; zero?
     68 	bne.b	_TMP_3
     69 	bsr	_OPz_
     70 	bra.b	_TMP_6
     71 _TMP_3:
     72 	cmp.b	#$40,d0		; infinity?
     73 	bne.b	_TMP_4
     74 	bsr	_OPi_
     75 	bra.b	_TMP_6
     76 _TMP_4:
     77 	cmp.b	#$60,d0		; NaN?
     78 	bne.b	_TMP_5
     79 	bsr	_OPn_
     80 	bra.b	_TMP_6
     81 _TMP_5:
     82 	bsr	_OPm_		; assuming a denorm...
     83 
     84 _TMP_6:
     85 	fmove.d	fp0,USER_D0(a6)	; result goes into d0/d1 pair
     86 	movem.l	USER_D0(a6),d0-d1
     87 	unlk	a6
     88 	rts
     89 
     90