Home | History | Annotate | Line # | Download | only in fpsp
sto_res.sa revision 1.2
      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 *	sto_res.sa 3.1 12/10/90
     33 *
     34 *	Takes the result and puts it in where the user expects it.
     35 *	Library functions return result in fp0.	If fp0 is not the
     36 *	users destination register then fp0 is moved to the the
     37 *	correct floating-point destination register.  fp0 and fp1
     38 *	are then restored to the original contents. 
     39 *
     40 *	Input:	result in fp0,fp1 
     41 *
     42 *		d2 & a0 should be kept unmodified
     43 *
     44 *	Output:	moves the result to the true destination reg or mem
     45 *
     46 *	Modifies: destination floating point register
     47 *
     48 
     49 STO_RES	IDNT	2,1 Motorola 040 Floating Point Software Package
     50 
     51 
     52 	section	8
     53 
     54 	include	fpsp.h
     55 
     56 	xdef	sto_cos
     57 sto_cos:
     58 	bfextu		CMDREG1B(a6){13:3},d0	;extract cos destination
     59 	cmpi.b		#3,d0		;check for fp0/fp1 cases
     60 	ble.b		c_fp0123
     61 	fmovem.x	fp1,-(a7)
     62 	moveq.l		#7,d1
     63 	sub.l		d0,d1		;d1 = 7- (dest. reg. no.)
     64 	clr.l		d0
     65 	bset.l		d1,d0		;d0 is dynamic register mask
     66 	fmovem.x	(a7)+,d0
     67 	rts
     68 c_fp0123:
     69 	tst.b		d0
     70 	beq.b		c_is_fp0
     71 	cmpi.b		#1,d0
     72 	beq.b		c_is_fp1
     73 	cmpi.b		#2,d0
     74 	beq.b		c_is_fp2
     75 c_is_fp3:
     76 	fmovem.x	fp1,USER_FP3(a6)
     77 	rts
     78 c_is_fp2:
     79 	fmovem.x	fp1,USER_FP2(a6)
     80 	rts
     81 c_is_fp1:
     82 	fmovem.x	fp1,USER_FP1(a6)
     83 	rts
     84 c_is_fp0:
     85 	fmovem.x	fp1,USER_FP0(a6)
     86 	rts
     87 
     88 
     89 	xdef	sto_res
     90 sto_res:
     91 	bfextu		CMDREG1B(a6){6:3},d0	;extract destination register
     92 	cmpi.b		#3,d0		;check for fp0/fp1 cases
     93 	ble.b		fp0123
     94 	fmovem.x	fp0,-(a7)
     95 	moveq.l		#7,d1
     96 	sub.l		d0,d1		;d1 = 7- (dest. reg. no.)
     97 	clr.l		d0
     98 	bset.l		d1,d0		;d0 is dynamic register mask
     99 	fmovem.x	(a7)+,d0
    100 	rts
    101 fp0123:
    102 	tst.b		d0
    103 	beq.b		is_fp0
    104 	cmpi.b		#1,d0
    105 	beq.b		is_fp1
    106 	cmpi.b		#2,d0
    107 	beq.b		is_fp2
    108 is_fp3:
    109 	fmovem.x	fp0,USER_FP3(a6)
    110 	rts
    111 is_fp2:
    112 	fmovem.x	fp0,USER_FP2(a6)
    113 	rts
    114 is_fp1:
    115 	fmovem.x	fp0,USER_FP1(a6)
    116 	rts
    117 is_fp0:
    118 	fmovem.x	fp0,USER_FP0(a6)
    119 	rts
    120 
    121 	end
    122