xref: /linux/arch/m68k/fpsp040/sto_res.S (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
11da177e4SLinus Torvalds|
21da177e4SLinus Torvalds|	sto_res.sa 3.1 12/10/90
31da177e4SLinus Torvalds|
41da177e4SLinus Torvalds|	Takes the result and puts it in where the user expects it.
51da177e4SLinus Torvalds|	Library functions return result in fp0.	If fp0 is not the
61da177e4SLinus Torvalds|	users destination register then fp0 is moved to the
71da177e4SLinus Torvalds|	correct floating-point destination register.  fp0 and fp1
81da177e4SLinus Torvalds|	are then restored to the original contents.
91da177e4SLinus Torvalds|
101da177e4SLinus Torvalds|	Input:	result in fp0,fp1
111da177e4SLinus Torvalds|
121da177e4SLinus Torvalds|		d2 & a0 should be kept unmodified
131da177e4SLinus Torvalds|
141da177e4SLinus Torvalds|	Output:	moves the result to the true destination reg or mem
151da177e4SLinus Torvalds|
161da177e4SLinus Torvalds|	Modifies: destination floating point register
171da177e4SLinus Torvalds|
181da177e4SLinus Torvalds
191da177e4SLinus Torvalds|		Copyright (C) Motorola, Inc. 1990
201da177e4SLinus Torvalds|			All Rights Reserved
211da177e4SLinus Torvalds|
22*e00d82d0SMatt Waddel|       For details on the license for this file, please see the
23*e00d82d0SMatt Waddel|       file, README, in this same directory.
241da177e4SLinus Torvalds
251da177e4SLinus TorvaldsSTO_RES:	|idnt	2,1 | Motorola 040 Floating Point Software Package
261da177e4SLinus Torvalds
271da177e4SLinus Torvalds
281da177e4SLinus Torvalds	|section	8
291da177e4SLinus Torvalds
301da177e4SLinus Torvalds#include "fpsp.h"
311da177e4SLinus Torvalds
321da177e4SLinus Torvalds	.global	sto_cos
331da177e4SLinus Torvaldssto_cos:
341da177e4SLinus Torvalds	bfextu		CMDREG1B(%a6){#13:#3},%d0	|extract cos destination
351da177e4SLinus Torvalds	cmpib		#3,%d0		|check for fp0/fp1 cases
361da177e4SLinus Torvalds	bles		c_fp0123
371da177e4SLinus Torvalds	fmovemx	%fp1-%fp1,-(%a7)
381da177e4SLinus Torvalds	moveql		#7,%d1
391da177e4SLinus Torvalds	subl		%d0,%d1		|d1 = 7- (dest. reg. no.)
401da177e4SLinus Torvalds	clrl		%d0
411da177e4SLinus Torvalds	bsetl		%d1,%d0		|d0 is dynamic register mask
421da177e4SLinus Torvalds	fmovemx	(%a7)+,%d0
431da177e4SLinus Torvalds	rts
441da177e4SLinus Torvaldsc_fp0123:
451da177e4SLinus Torvalds	cmpib		#0,%d0
461da177e4SLinus Torvalds	beqs		c_is_fp0
471da177e4SLinus Torvalds	cmpib		#1,%d0
481da177e4SLinus Torvalds	beqs		c_is_fp1
491da177e4SLinus Torvalds	cmpib		#2,%d0
501da177e4SLinus Torvalds	beqs		c_is_fp2
511da177e4SLinus Torvaldsc_is_fp3:
521da177e4SLinus Torvalds	fmovemx	%fp1-%fp1,USER_FP3(%a6)
531da177e4SLinus Torvalds	rts
541da177e4SLinus Torvaldsc_is_fp2:
551da177e4SLinus Torvalds	fmovemx	%fp1-%fp1,USER_FP2(%a6)
561da177e4SLinus Torvalds	rts
571da177e4SLinus Torvaldsc_is_fp1:
581da177e4SLinus Torvalds	fmovemx	%fp1-%fp1,USER_FP1(%a6)
591da177e4SLinus Torvalds	rts
601da177e4SLinus Torvaldsc_is_fp0:
611da177e4SLinus Torvalds	fmovemx	%fp1-%fp1,USER_FP0(%a6)
621da177e4SLinus Torvalds	rts
631da177e4SLinus Torvalds
641da177e4SLinus Torvalds
651da177e4SLinus Torvalds	.global	sto_res
661da177e4SLinus Torvaldssto_res:
671da177e4SLinus Torvalds	bfextu		CMDREG1B(%a6){#6:#3},%d0	|extract destination register
681da177e4SLinus Torvalds	cmpib		#3,%d0		|check for fp0/fp1 cases
691da177e4SLinus Torvalds	bles		fp0123
701da177e4SLinus Torvalds	fmovemx	%fp0-%fp0,-(%a7)
711da177e4SLinus Torvalds	moveql		#7,%d1
721da177e4SLinus Torvalds	subl		%d0,%d1		|d1 = 7- (dest. reg. no.)
731da177e4SLinus Torvalds	clrl		%d0
741da177e4SLinus Torvalds	bsetl		%d1,%d0		|d0 is dynamic register mask
751da177e4SLinus Torvalds	fmovemx	(%a7)+,%d0
761da177e4SLinus Torvalds	rts
771da177e4SLinus Torvaldsfp0123:
781da177e4SLinus Torvalds	cmpib		#0,%d0
791da177e4SLinus Torvalds	beqs		is_fp0
801da177e4SLinus Torvalds	cmpib		#1,%d0
811da177e4SLinus Torvalds	beqs		is_fp1
821da177e4SLinus Torvalds	cmpib		#2,%d0
831da177e4SLinus Torvalds	beqs		is_fp2
841da177e4SLinus Torvaldsis_fp3:
851da177e4SLinus Torvalds	fmovemx	%fp0-%fp0,USER_FP3(%a6)
861da177e4SLinus Torvalds	rts
871da177e4SLinus Torvaldsis_fp2:
881da177e4SLinus Torvalds	fmovemx	%fp0-%fp0,USER_FP2(%a6)
891da177e4SLinus Torvalds	rts
901da177e4SLinus Torvaldsis_fp1:
911da177e4SLinus Torvalds	fmovemx	%fp0-%fp0,USER_FP1(%a6)
921da177e4SLinus Torvalds	rts
931da177e4SLinus Torvaldsis_fp0:
941da177e4SLinus Torvalds	fmovemx	%fp0-%fp0,USER_FP0(%a6)
951da177e4SLinus Torvalds	rts
961da177e4SLinus Torvalds
971da177e4SLinus Torvalds	|end
98