18c2ecf20Sopenharmony_ci|
28c2ecf20Sopenharmony_ci|	util.sa 3.7 7/29/91
38c2ecf20Sopenharmony_ci|
48c2ecf20Sopenharmony_ci|	This file contains routines used by other programs.
58c2ecf20Sopenharmony_ci|
68c2ecf20Sopenharmony_ci|	ovf_res: used by overflow to force the correct
78c2ecf20Sopenharmony_ci|		 result. ovf_r_k, ovf_r_x2, ovf_r_x3 are
88c2ecf20Sopenharmony_ci|		 derivatives of this routine.
98c2ecf20Sopenharmony_ci|	get_fline: get user's opcode word
108c2ecf20Sopenharmony_ci|	g_dfmtou: returns the destination format.
118c2ecf20Sopenharmony_ci|	g_opcls: returns the opclass of the float instruction.
128c2ecf20Sopenharmony_ci|	g_rndpr: returns the rounding precision.
138c2ecf20Sopenharmony_ci|	reg_dest: write byte, word, or long data to Dn
148c2ecf20Sopenharmony_ci|
158c2ecf20Sopenharmony_ci|
168c2ecf20Sopenharmony_ci|		Copyright (C) Motorola, Inc. 1990
178c2ecf20Sopenharmony_ci|			All Rights Reserved
188c2ecf20Sopenharmony_ci|
198c2ecf20Sopenharmony_ci|       For details on the license for this file, please see the
208c2ecf20Sopenharmony_ci|       file, README, in this same directory.
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci|UTIL	idnt    2,1 | Motorola 040 Floating Point Software Package
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci	|section	8
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#include "fpsp.h"
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci	|xref	mem_read
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	.global	g_dfmtou
318c2ecf20Sopenharmony_ci	.global	g_opcls
328c2ecf20Sopenharmony_ci	.global	g_rndpr
338c2ecf20Sopenharmony_ci	.global	get_fline
348c2ecf20Sopenharmony_ci	.global	reg_dest
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci|
378c2ecf20Sopenharmony_ci| Final result table for ovf_res. Note that the negative counterparts
388c2ecf20Sopenharmony_ci| are unnecessary as ovf_res always returns the sign separately from
398c2ecf20Sopenharmony_ci| the exponent.
408c2ecf20Sopenharmony_ci|					;+inf
418c2ecf20Sopenharmony_ciEXT_PINF:	.long	0x7fff0000,0x00000000,0x00000000,0x00000000
428c2ecf20Sopenharmony_ci|					;largest +ext
438c2ecf20Sopenharmony_ciEXT_PLRG:	.long	0x7ffe0000,0xffffffff,0xffffffff,0x00000000
448c2ecf20Sopenharmony_ci|					;largest magnitude +sgl in ext
458c2ecf20Sopenharmony_ciSGL_PLRG:	.long	0x407e0000,0xffffff00,0x00000000,0x00000000
468c2ecf20Sopenharmony_ci|					;largest magnitude +dbl in ext
478c2ecf20Sopenharmony_ciDBL_PLRG:	.long	0x43fe0000,0xffffffff,0xfffff800,0x00000000
488c2ecf20Sopenharmony_ci|					;largest -ext
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_citblovfl:
518c2ecf20Sopenharmony_ci	.long	EXT_RN
528c2ecf20Sopenharmony_ci	.long	EXT_RZ
538c2ecf20Sopenharmony_ci	.long	EXT_RM
548c2ecf20Sopenharmony_ci	.long	EXT_RP
558c2ecf20Sopenharmony_ci	.long	SGL_RN
568c2ecf20Sopenharmony_ci	.long	SGL_RZ
578c2ecf20Sopenharmony_ci	.long	SGL_RM
588c2ecf20Sopenharmony_ci	.long	SGL_RP
598c2ecf20Sopenharmony_ci	.long	DBL_RN
608c2ecf20Sopenharmony_ci	.long	DBL_RZ
618c2ecf20Sopenharmony_ci	.long	DBL_RM
628c2ecf20Sopenharmony_ci	.long	DBL_RP
638c2ecf20Sopenharmony_ci	.long	error
648c2ecf20Sopenharmony_ci	.long	error
658c2ecf20Sopenharmony_ci	.long	error
668c2ecf20Sopenharmony_ci	.long	error
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci|
708c2ecf20Sopenharmony_ci|	ovf_r_k --- overflow result calculation
718c2ecf20Sopenharmony_ci|
728c2ecf20Sopenharmony_ci| This entry point is used by kernel_ex.
738c2ecf20Sopenharmony_ci|
748c2ecf20Sopenharmony_ci| This forces the destination precision to be extended
758c2ecf20Sopenharmony_ci|
768c2ecf20Sopenharmony_ci| Input:	operand in ETEMP
778c2ecf20Sopenharmony_ci| Output:	a result is in ETEMP (internal extended format)
788c2ecf20Sopenharmony_ci|
798c2ecf20Sopenharmony_ci	.global	ovf_r_k
808c2ecf20Sopenharmony_ciovf_r_k:
818c2ecf20Sopenharmony_ci	lea	ETEMP(%a6),%a0	|a0 points to source operand
828c2ecf20Sopenharmony_ci	bclrb	#sign_bit,ETEMP_EX(%a6)
838c2ecf20Sopenharmony_ci	sne	ETEMP_SGN(%a6)	|convert to internal IEEE format
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci|
868c2ecf20Sopenharmony_ci|	ovf_r_x2 --- overflow result calculation
878c2ecf20Sopenharmony_ci|
888c2ecf20Sopenharmony_ci| This entry point used by x_ovfl.  (opclass 0 and 2)
898c2ecf20Sopenharmony_ci|
908c2ecf20Sopenharmony_ci| Input		a0  points to an operand in the internal extended format
918c2ecf20Sopenharmony_ci| Output	a0  points to the result in the internal extended format
928c2ecf20Sopenharmony_ci|
938c2ecf20Sopenharmony_ci| This sets the round precision according to the user's FPCR unless the
948c2ecf20Sopenharmony_ci| instruction is fsgldiv or fsglmul or fsadd, fdadd, fsub, fdsub, fsmul,
958c2ecf20Sopenharmony_ci| fdmul, fsdiv, fddiv, fssqrt, fsmove, fdmove, fsabs, fdabs, fsneg, fdneg.
968c2ecf20Sopenharmony_ci| If the instruction is fsgldiv of fsglmul, the rounding precision must be
978c2ecf20Sopenharmony_ci| extended.  If the instruction is not fsgldiv or fsglmul but a force-
988c2ecf20Sopenharmony_ci| precision instruction, the rounding precision is then set to the force
998c2ecf20Sopenharmony_ci| precision.
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci	.global	ovf_r_x2
1028c2ecf20Sopenharmony_ciovf_r_x2:
1038c2ecf20Sopenharmony_ci	btstb	#E3,E_BYTE(%a6)		|check for nu exception
1048c2ecf20Sopenharmony_ci	beql	ovf_e1_exc		|it is cu exception
1058c2ecf20Sopenharmony_ciovf_e3_exc:
1068c2ecf20Sopenharmony_ci	movew	CMDREG3B(%a6),%d0		|get the command word
1078c2ecf20Sopenharmony_ci	andiw	#0x00000060,%d0		|clear all bits except 6 and 5
1088c2ecf20Sopenharmony_ci	cmpil	#0x00000040,%d0
1098c2ecf20Sopenharmony_ci	beql	ovff_sgl		|force precision is single
1108c2ecf20Sopenharmony_ci	cmpil	#0x00000060,%d0
1118c2ecf20Sopenharmony_ci	beql	ovff_dbl		|force precision is double
1128c2ecf20Sopenharmony_ci	movew	CMDREG3B(%a6),%d0		|get the command word again
1138c2ecf20Sopenharmony_ci	andil	#0x7f,%d0			|clear all except operation
1148c2ecf20Sopenharmony_ci	cmpil	#0x33,%d0
1158c2ecf20Sopenharmony_ci	beql	ovf_fsgl		|fsglmul or fsgldiv
1168c2ecf20Sopenharmony_ci	cmpil	#0x30,%d0
1178c2ecf20Sopenharmony_ci	beql	ovf_fsgl
1188c2ecf20Sopenharmony_ci	bra	ovf_fpcr		|instruction is none of the above
1198c2ecf20Sopenharmony_ci|					;use FPCR
1208c2ecf20Sopenharmony_ciovf_e1_exc:
1218c2ecf20Sopenharmony_ci	movew	CMDREG1B(%a6),%d0		|get command word
1228c2ecf20Sopenharmony_ci	andil	#0x00000044,%d0		|clear all bits except 6 and 2
1238c2ecf20Sopenharmony_ci	cmpil	#0x00000040,%d0
1248c2ecf20Sopenharmony_ci	beql	ovff_sgl		|the instruction is force single
1258c2ecf20Sopenharmony_ci	cmpil	#0x00000044,%d0
1268c2ecf20Sopenharmony_ci	beql	ovff_dbl		|the instruction is force double
1278c2ecf20Sopenharmony_ci	movew	CMDREG1B(%a6),%d0		|again get the command word
1288c2ecf20Sopenharmony_ci	andil	#0x0000007f,%d0		|clear all except the op code
1298c2ecf20Sopenharmony_ci	cmpil	#0x00000027,%d0
1308c2ecf20Sopenharmony_ci	beql	ovf_fsgl		|fsglmul
1318c2ecf20Sopenharmony_ci	cmpil	#0x00000024,%d0
1328c2ecf20Sopenharmony_ci	beql	ovf_fsgl		|fsgldiv
1338c2ecf20Sopenharmony_ci	bra	ovf_fpcr		|none of the above, use FPCR
1348c2ecf20Sopenharmony_ci|
1358c2ecf20Sopenharmony_ci|
1368c2ecf20Sopenharmony_ci| Inst is either fsgldiv or fsglmul.  Force extended precision.
1378c2ecf20Sopenharmony_ci|
1388c2ecf20Sopenharmony_ciovf_fsgl:
1398c2ecf20Sopenharmony_ci	clrl	%d0
1408c2ecf20Sopenharmony_ci	bra	ovf_res
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ciovff_sgl:
1438c2ecf20Sopenharmony_ci	movel	#0x00000001,%d0		|set single
1448c2ecf20Sopenharmony_ci	bra	ovf_res
1458c2ecf20Sopenharmony_ciovff_dbl:
1468c2ecf20Sopenharmony_ci	movel	#0x00000002,%d0		|set double
1478c2ecf20Sopenharmony_ci	bra	ovf_res
1488c2ecf20Sopenharmony_ci|
1498c2ecf20Sopenharmony_ci| The precision is in the fpcr.
1508c2ecf20Sopenharmony_ci|
1518c2ecf20Sopenharmony_ciovf_fpcr:
1528c2ecf20Sopenharmony_ci	bfextu	FPCR_MODE(%a6){#0:#2},%d0 |set round precision
1538c2ecf20Sopenharmony_ci	bra	ovf_res
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci|
1568c2ecf20Sopenharmony_ci|
1578c2ecf20Sopenharmony_ci|	ovf_r_x3 --- overflow result calculation
1588c2ecf20Sopenharmony_ci|
1598c2ecf20Sopenharmony_ci| This entry point used by x_ovfl. (opclass 3 only)
1608c2ecf20Sopenharmony_ci|
1618c2ecf20Sopenharmony_ci| Input		a0  points to an operand in the internal extended format
1628c2ecf20Sopenharmony_ci| Output	a0  points to the result in the internal extended format
1638c2ecf20Sopenharmony_ci|
1648c2ecf20Sopenharmony_ci| This sets the round precision according to the destination size.
1658c2ecf20Sopenharmony_ci|
1668c2ecf20Sopenharmony_ci	.global	ovf_r_x3
1678c2ecf20Sopenharmony_ciovf_r_x3:
1688c2ecf20Sopenharmony_ci	bsr	g_dfmtou	|get dest fmt in d0{1:0}
1698c2ecf20Sopenharmony_ci|				;for fmovout, the destination format
1708c2ecf20Sopenharmony_ci|				;is the rounding precision
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci|
1738c2ecf20Sopenharmony_ci|	ovf_res --- overflow result calculation
1748c2ecf20Sopenharmony_ci|
1758c2ecf20Sopenharmony_ci| Input:
1768c2ecf20Sopenharmony_ci|	a0	points to operand in internal extended format
1778c2ecf20Sopenharmony_ci| Output:
1788c2ecf20Sopenharmony_ci|	a0	points to result in internal extended format
1798c2ecf20Sopenharmony_ci|
1808c2ecf20Sopenharmony_ci	.global	ovf_res
1818c2ecf20Sopenharmony_ciovf_res:
1828c2ecf20Sopenharmony_ci	lsll	#2,%d0		|move round precision to d0{3:2}
1838c2ecf20Sopenharmony_ci	bfextu	FPCR_MODE(%a6){#2:#2},%d1 |set round mode
1848c2ecf20Sopenharmony_ci	orl	%d1,%d0		|index is fmt:mode in d0{3:0}
1858c2ecf20Sopenharmony_ci	leal	tblovfl,%a1	|load a1 with table address
1868c2ecf20Sopenharmony_ci	movel	%a1@(%d0:l:4),%a1	|use d0 as index to the table
1878c2ecf20Sopenharmony_ci	jmp	(%a1)		|go to the correct routine
1888c2ecf20Sopenharmony_ci|
1898c2ecf20Sopenharmony_ci|case DEST_FMT = EXT
1908c2ecf20Sopenharmony_ci|
1918c2ecf20Sopenharmony_ciEXT_RN:
1928c2ecf20Sopenharmony_ci	leal	EXT_PINF,%a1	|answer is +/- infinity
1938c2ecf20Sopenharmony_ci	bsetb	#inf_bit,FPSR_CC(%a6)
1948c2ecf20Sopenharmony_ci	bra	set_sign	|now go set the sign
1958c2ecf20Sopenharmony_ciEXT_RZ:
1968c2ecf20Sopenharmony_ci	leal	EXT_PLRG,%a1	|answer is +/- large number
1978c2ecf20Sopenharmony_ci	bra	set_sign	|now go set the sign
1988c2ecf20Sopenharmony_ciEXT_RM:
1998c2ecf20Sopenharmony_ci	tstb	LOCAL_SGN(%a0)	|if negative overflow
2008c2ecf20Sopenharmony_ci	beqs	e_rm_pos
2018c2ecf20Sopenharmony_cie_rm_neg:
2028c2ecf20Sopenharmony_ci	leal	EXT_PINF,%a1	|answer is negative infinity
2038c2ecf20Sopenharmony_ci	orl	#neginf_mask,USER_FPSR(%a6)
2048c2ecf20Sopenharmony_ci	bra	end_ovfr
2058c2ecf20Sopenharmony_cie_rm_pos:
2068c2ecf20Sopenharmony_ci	leal	EXT_PLRG,%a1	|answer is large positive number
2078c2ecf20Sopenharmony_ci	bra	end_ovfr
2088c2ecf20Sopenharmony_ciEXT_RP:
2098c2ecf20Sopenharmony_ci	tstb	LOCAL_SGN(%a0)	|if negative overflow
2108c2ecf20Sopenharmony_ci	beqs	e_rp_pos
2118c2ecf20Sopenharmony_cie_rp_neg:
2128c2ecf20Sopenharmony_ci	leal	EXT_PLRG,%a1	|answer is large negative number
2138c2ecf20Sopenharmony_ci	bsetb	#neg_bit,FPSR_CC(%a6)
2148c2ecf20Sopenharmony_ci	bra	end_ovfr
2158c2ecf20Sopenharmony_cie_rp_pos:
2168c2ecf20Sopenharmony_ci	leal	EXT_PINF,%a1	|answer is positive infinity
2178c2ecf20Sopenharmony_ci	bsetb	#inf_bit,FPSR_CC(%a6)
2188c2ecf20Sopenharmony_ci	bra	end_ovfr
2198c2ecf20Sopenharmony_ci|
2208c2ecf20Sopenharmony_ci|case DEST_FMT = DBL
2218c2ecf20Sopenharmony_ci|
2228c2ecf20Sopenharmony_ciDBL_RN:
2238c2ecf20Sopenharmony_ci	leal	EXT_PINF,%a1	|answer is +/- infinity
2248c2ecf20Sopenharmony_ci	bsetb	#inf_bit,FPSR_CC(%a6)
2258c2ecf20Sopenharmony_ci	bra	set_sign
2268c2ecf20Sopenharmony_ciDBL_RZ:
2278c2ecf20Sopenharmony_ci	leal	DBL_PLRG,%a1	|answer is +/- large number
2288c2ecf20Sopenharmony_ci	bra	set_sign	|now go set the sign
2298c2ecf20Sopenharmony_ciDBL_RM:
2308c2ecf20Sopenharmony_ci	tstb	LOCAL_SGN(%a0)	|if negative overflow
2318c2ecf20Sopenharmony_ci	beqs	d_rm_pos
2328c2ecf20Sopenharmony_cid_rm_neg:
2338c2ecf20Sopenharmony_ci	leal	EXT_PINF,%a1	|answer is negative infinity
2348c2ecf20Sopenharmony_ci	orl	#neginf_mask,USER_FPSR(%a6)
2358c2ecf20Sopenharmony_ci	bra	end_ovfr	|inf is same for all precisions (ext,dbl,sgl)
2368c2ecf20Sopenharmony_cid_rm_pos:
2378c2ecf20Sopenharmony_ci	leal	DBL_PLRG,%a1	|answer is large positive number
2388c2ecf20Sopenharmony_ci	bra	end_ovfr
2398c2ecf20Sopenharmony_ciDBL_RP:
2408c2ecf20Sopenharmony_ci	tstb	LOCAL_SGN(%a0)	|if negative overflow
2418c2ecf20Sopenharmony_ci	beqs	d_rp_pos
2428c2ecf20Sopenharmony_cid_rp_neg:
2438c2ecf20Sopenharmony_ci	leal	DBL_PLRG,%a1	|answer is large negative number
2448c2ecf20Sopenharmony_ci	bsetb	#neg_bit,FPSR_CC(%a6)
2458c2ecf20Sopenharmony_ci	bra	end_ovfr
2468c2ecf20Sopenharmony_cid_rp_pos:
2478c2ecf20Sopenharmony_ci	leal	EXT_PINF,%a1	|answer is positive infinity
2488c2ecf20Sopenharmony_ci	bsetb	#inf_bit,FPSR_CC(%a6)
2498c2ecf20Sopenharmony_ci	bra	end_ovfr
2508c2ecf20Sopenharmony_ci|
2518c2ecf20Sopenharmony_ci|case DEST_FMT = SGL
2528c2ecf20Sopenharmony_ci|
2538c2ecf20Sopenharmony_ciSGL_RN:
2548c2ecf20Sopenharmony_ci	leal	EXT_PINF,%a1	|answer is +/-  infinity
2558c2ecf20Sopenharmony_ci	bsetb	#inf_bit,FPSR_CC(%a6)
2568c2ecf20Sopenharmony_ci	bras	set_sign
2578c2ecf20Sopenharmony_ciSGL_RZ:
2588c2ecf20Sopenharmony_ci	leal	SGL_PLRG,%a1	|answer is +/- large number
2598c2ecf20Sopenharmony_ci	bras	set_sign
2608c2ecf20Sopenharmony_ciSGL_RM:
2618c2ecf20Sopenharmony_ci	tstb	LOCAL_SGN(%a0)	|if negative overflow
2628c2ecf20Sopenharmony_ci	beqs	s_rm_pos
2638c2ecf20Sopenharmony_cis_rm_neg:
2648c2ecf20Sopenharmony_ci	leal	EXT_PINF,%a1	|answer is negative infinity
2658c2ecf20Sopenharmony_ci	orl	#neginf_mask,USER_FPSR(%a6)
2668c2ecf20Sopenharmony_ci	bras	end_ovfr
2678c2ecf20Sopenharmony_cis_rm_pos:
2688c2ecf20Sopenharmony_ci	leal	SGL_PLRG,%a1	|answer is large positive number
2698c2ecf20Sopenharmony_ci	bras	end_ovfr
2708c2ecf20Sopenharmony_ciSGL_RP:
2718c2ecf20Sopenharmony_ci	tstb	LOCAL_SGN(%a0)	|if negative overflow
2728c2ecf20Sopenharmony_ci	beqs	s_rp_pos
2738c2ecf20Sopenharmony_cis_rp_neg:
2748c2ecf20Sopenharmony_ci	leal	SGL_PLRG,%a1	|answer is large negative number
2758c2ecf20Sopenharmony_ci	bsetb	#neg_bit,FPSR_CC(%a6)
2768c2ecf20Sopenharmony_ci	bras	end_ovfr
2778c2ecf20Sopenharmony_cis_rp_pos:
2788c2ecf20Sopenharmony_ci	leal	EXT_PINF,%a1	|answer is positive infinity
2798c2ecf20Sopenharmony_ci	bsetb	#inf_bit,FPSR_CC(%a6)
2808c2ecf20Sopenharmony_ci	bras	end_ovfr
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ciset_sign:
2838c2ecf20Sopenharmony_ci	tstb	LOCAL_SGN(%a0)	|if negative overflow
2848c2ecf20Sopenharmony_ci	beqs	end_ovfr
2858c2ecf20Sopenharmony_cineg_sign:
2868c2ecf20Sopenharmony_ci	bsetb	#neg_bit,FPSR_CC(%a6)
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ciend_ovfr:
2898c2ecf20Sopenharmony_ci	movew	LOCAL_EX(%a1),LOCAL_EX(%a0) |do not overwrite sign
2908c2ecf20Sopenharmony_ci	movel	LOCAL_HI(%a1),LOCAL_HI(%a0)
2918c2ecf20Sopenharmony_ci	movel	LOCAL_LO(%a1),LOCAL_LO(%a0)
2928c2ecf20Sopenharmony_ci	rts
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ci|
2968c2ecf20Sopenharmony_ci|	ERROR
2978c2ecf20Sopenharmony_ci|
2988c2ecf20Sopenharmony_cierror:
2998c2ecf20Sopenharmony_ci	rts
3008c2ecf20Sopenharmony_ci|
3018c2ecf20Sopenharmony_ci|	get_fline --- get f-line opcode of interrupted instruction
3028c2ecf20Sopenharmony_ci|
3038c2ecf20Sopenharmony_ci|	Returns opcode in the low word of d0.
3048c2ecf20Sopenharmony_ci|
3058c2ecf20Sopenharmony_ciget_fline:
3068c2ecf20Sopenharmony_ci	movel	USER_FPIAR(%a6),%a0	|opcode address
3078c2ecf20Sopenharmony_ci	movel	#0,-(%a7)	|reserve a word on the stack
3088c2ecf20Sopenharmony_ci	leal	2(%a7),%a1	|point to low word of temporary
3098c2ecf20Sopenharmony_ci	movel	#2,%d0		|count
3108c2ecf20Sopenharmony_ci	bsrl	mem_read
3118c2ecf20Sopenharmony_ci	movel	(%a7)+,%d0
3128c2ecf20Sopenharmony_ci	rts
3138c2ecf20Sopenharmony_ci|
3148c2ecf20Sopenharmony_ci|	g_rndpr --- put rounding precision in d0{1:0}
3158c2ecf20Sopenharmony_ci|
3168c2ecf20Sopenharmony_ci|	valid return codes are:
3178c2ecf20Sopenharmony_ci|		00 - extended
3188c2ecf20Sopenharmony_ci|		01 - single
3198c2ecf20Sopenharmony_ci|		10 - double
3208c2ecf20Sopenharmony_ci|
3218c2ecf20Sopenharmony_ci| begin
3228c2ecf20Sopenharmony_ci| get rounding precision (cmdreg3b{6:5})
3238c2ecf20Sopenharmony_ci| begin
3248c2ecf20Sopenharmony_ci|  case	opclass = 011 (move out)
3258c2ecf20Sopenharmony_ci|	get destination format - this is the also the rounding precision
3268c2ecf20Sopenharmony_ci|
3278c2ecf20Sopenharmony_ci|  case	opclass = 0x0
3288c2ecf20Sopenharmony_ci|	if E3
3298c2ecf20Sopenharmony_ci|	    *case RndPr(from cmdreg3b{6:5} = 11  then RND_PREC = DBL
3308c2ecf20Sopenharmony_ci|	    *case RndPr(from cmdreg3b{6:5} = 10  then RND_PREC = SGL
3318c2ecf20Sopenharmony_ci|	     case RndPr(from cmdreg3b{6:5} = 00 | 01
3328c2ecf20Sopenharmony_ci|		use precision from FPCR{7:6}
3338c2ecf20Sopenharmony_ci|			case 00 then RND_PREC = EXT
3348c2ecf20Sopenharmony_ci|			case 01 then RND_PREC = SGL
3358c2ecf20Sopenharmony_ci|			case 10 then RND_PREC = DBL
3368c2ecf20Sopenharmony_ci|	else E1
3378c2ecf20Sopenharmony_ci|	     use precision in FPCR{7:6}
3388c2ecf20Sopenharmony_ci|	     case 00 then RND_PREC = EXT
3398c2ecf20Sopenharmony_ci|	     case 01 then RND_PREC = SGL
3408c2ecf20Sopenharmony_ci|	     case 10 then RND_PREC = DBL
3418c2ecf20Sopenharmony_ci| end
3428c2ecf20Sopenharmony_ci|
3438c2ecf20Sopenharmony_cig_rndpr:
3448c2ecf20Sopenharmony_ci	bsr	g_opcls		|get opclass in d0{2:0}
3458c2ecf20Sopenharmony_ci	cmpw	#0x0003,%d0	|check for opclass 011
3468c2ecf20Sopenharmony_ci	bnes	op_0x0
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci|
3498c2ecf20Sopenharmony_ci| For move out instructions (opclass 011) the destination format
3508c2ecf20Sopenharmony_ci| is the same as the rounding precision.  Pass results from g_dfmtou.
3518c2ecf20Sopenharmony_ci|
3528c2ecf20Sopenharmony_ci	bsr	g_dfmtou
3538c2ecf20Sopenharmony_ci	rts
3548c2ecf20Sopenharmony_ciop_0x0:
3558c2ecf20Sopenharmony_ci	btstb	#E3,E_BYTE(%a6)
3568c2ecf20Sopenharmony_ci	beql	unf_e1_exc	|branch to e1 underflow
3578c2ecf20Sopenharmony_ciunf_e3_exc:
3588c2ecf20Sopenharmony_ci	movel	CMDREG3B(%a6),%d0	|rounding precision in d0{10:9}
3598c2ecf20Sopenharmony_ci	bfextu	%d0{#9:#2},%d0	|move the rounding prec bits to d0{1:0}
3608c2ecf20Sopenharmony_ci	cmpil	#0x2,%d0
3618c2ecf20Sopenharmony_ci	beql	unff_sgl	|force precision is single
3628c2ecf20Sopenharmony_ci	cmpil	#0x3,%d0		|force precision is double
3638c2ecf20Sopenharmony_ci	beql	unff_dbl
3648c2ecf20Sopenharmony_ci	movew	CMDREG3B(%a6),%d0	|get the command word again
3658c2ecf20Sopenharmony_ci	andil	#0x7f,%d0		|clear all except operation
3668c2ecf20Sopenharmony_ci	cmpil	#0x33,%d0
3678c2ecf20Sopenharmony_ci	beql	unf_fsgl	|fsglmul or fsgldiv
3688c2ecf20Sopenharmony_ci	cmpil	#0x30,%d0
3698c2ecf20Sopenharmony_ci	beql	unf_fsgl	|fsgldiv or fsglmul
3708c2ecf20Sopenharmony_ci	bra	unf_fpcr
3718c2ecf20Sopenharmony_ciunf_e1_exc:
3728c2ecf20Sopenharmony_ci	movel	CMDREG1B(%a6),%d0	|get 32 bits off the stack, 1st 16 bits
3738c2ecf20Sopenharmony_ci|				;are the command word
3748c2ecf20Sopenharmony_ci	andil	#0x00440000,%d0	|clear all bits except bits 6 and 2
3758c2ecf20Sopenharmony_ci	cmpil	#0x00400000,%d0
3768c2ecf20Sopenharmony_ci	beql	unff_sgl	|force single
3778c2ecf20Sopenharmony_ci	cmpil	#0x00440000,%d0	|force double
3788c2ecf20Sopenharmony_ci	beql	unff_dbl
3798c2ecf20Sopenharmony_ci	movel	CMDREG1B(%a6),%d0	|get the command word again
3808c2ecf20Sopenharmony_ci	andil	#0x007f0000,%d0	|clear all bits except the operation
3818c2ecf20Sopenharmony_ci	cmpil	#0x00270000,%d0
3828c2ecf20Sopenharmony_ci	beql	unf_fsgl	|fsglmul
3838c2ecf20Sopenharmony_ci	cmpil	#0x00240000,%d0
3848c2ecf20Sopenharmony_ci	beql	unf_fsgl	|fsgldiv
3858c2ecf20Sopenharmony_ci	bra	unf_fpcr
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ci|
3888c2ecf20Sopenharmony_ci| Convert to return format.  The values from cmdreg3b and the return
3898c2ecf20Sopenharmony_ci| values are:
3908c2ecf20Sopenharmony_ci|	cmdreg3b	return	     precision
3918c2ecf20Sopenharmony_ci|	--------	------	     ---------
3928c2ecf20Sopenharmony_ci|	  00,01		  0		ext
3938c2ecf20Sopenharmony_ci|	   10		  1		sgl
3948c2ecf20Sopenharmony_ci|	   11		  2		dbl
3958c2ecf20Sopenharmony_ci| Force single
3968c2ecf20Sopenharmony_ci|
3978c2ecf20Sopenharmony_ciunff_sgl:
3988c2ecf20Sopenharmony_ci	movel	#1,%d0		|return 1
3998c2ecf20Sopenharmony_ci	rts
4008c2ecf20Sopenharmony_ci|
4018c2ecf20Sopenharmony_ci| Force double
4028c2ecf20Sopenharmony_ci|
4038c2ecf20Sopenharmony_ciunff_dbl:
4048c2ecf20Sopenharmony_ci	movel	#2,%d0		|return 2
4058c2ecf20Sopenharmony_ci	rts
4068c2ecf20Sopenharmony_ci|
4078c2ecf20Sopenharmony_ci| Force extended
4088c2ecf20Sopenharmony_ci|
4098c2ecf20Sopenharmony_ciunf_fsgl:
4108c2ecf20Sopenharmony_ci	movel	#0,%d0
4118c2ecf20Sopenharmony_ci	rts
4128c2ecf20Sopenharmony_ci|
4138c2ecf20Sopenharmony_ci| Get rounding precision set in FPCR{7:6}.
4148c2ecf20Sopenharmony_ci|
4158c2ecf20Sopenharmony_ciunf_fpcr:
4168c2ecf20Sopenharmony_ci	movel	USER_FPCR(%a6),%d0 |rounding precision bits in d0{7:6}
4178c2ecf20Sopenharmony_ci	bfextu	%d0{#24:#2},%d0	|move the rounding prec bits to d0{1:0}
4188c2ecf20Sopenharmony_ci	rts
4198c2ecf20Sopenharmony_ci|
4208c2ecf20Sopenharmony_ci|	g_opcls --- put opclass in d0{2:0}
4218c2ecf20Sopenharmony_ci|
4228c2ecf20Sopenharmony_cig_opcls:
4238c2ecf20Sopenharmony_ci	btstb	#E3,E_BYTE(%a6)
4248c2ecf20Sopenharmony_ci	beqs	opc_1b		|if set, go to cmdreg1b
4258c2ecf20Sopenharmony_ciopc_3b:
4268c2ecf20Sopenharmony_ci	clrl	%d0		|if E3, only opclass 0x0 is possible
4278c2ecf20Sopenharmony_ci	rts
4288c2ecf20Sopenharmony_ciopc_1b:
4298c2ecf20Sopenharmony_ci	movel	CMDREG1B(%a6),%d0
4308c2ecf20Sopenharmony_ci	bfextu	%d0{#0:#3},%d0	|shift opclass bits d0{31:29} to d0{2:0}
4318c2ecf20Sopenharmony_ci	rts
4328c2ecf20Sopenharmony_ci|
4338c2ecf20Sopenharmony_ci|	g_dfmtou --- put destination format in d0{1:0}
4348c2ecf20Sopenharmony_ci|
4358c2ecf20Sopenharmony_ci|	If E1, the format is from cmdreg1b{12:10}
4368c2ecf20Sopenharmony_ci|	If E3, the format is extended.
4378c2ecf20Sopenharmony_ci|
4388c2ecf20Sopenharmony_ci|	Dest. Fmt.
4398c2ecf20Sopenharmony_ci|		extended  010 -> 00
4408c2ecf20Sopenharmony_ci|		single    001 -> 01
4418c2ecf20Sopenharmony_ci|		double    101 -> 10
4428c2ecf20Sopenharmony_ci|
4438c2ecf20Sopenharmony_cig_dfmtou:
4448c2ecf20Sopenharmony_ci	btstb	#E3,E_BYTE(%a6)
4458c2ecf20Sopenharmony_ci	beqs	op011
4468c2ecf20Sopenharmony_ci	clrl	%d0		|if E1, size is always ext
4478c2ecf20Sopenharmony_ci	rts
4488c2ecf20Sopenharmony_ciop011:
4498c2ecf20Sopenharmony_ci	movel	CMDREG1B(%a6),%d0
4508c2ecf20Sopenharmony_ci	bfextu	%d0{#3:#3},%d0	|dest fmt from cmdreg1b{12:10}
4518c2ecf20Sopenharmony_ci	cmpb	#1,%d0		|check for single
4528c2ecf20Sopenharmony_ci	bnes	not_sgl
4538c2ecf20Sopenharmony_ci	movel	#1,%d0
4548c2ecf20Sopenharmony_ci	rts
4558c2ecf20Sopenharmony_cinot_sgl:
4568c2ecf20Sopenharmony_ci	cmpb	#5,%d0		|check for double
4578c2ecf20Sopenharmony_ci	bnes	not_dbl
4588c2ecf20Sopenharmony_ci	movel	#2,%d0
4598c2ecf20Sopenharmony_ci	rts
4608c2ecf20Sopenharmony_cinot_dbl:
4618c2ecf20Sopenharmony_ci	clrl	%d0		|must be extended
4628c2ecf20Sopenharmony_ci	rts
4638c2ecf20Sopenharmony_ci
4648c2ecf20Sopenharmony_ci|
4658c2ecf20Sopenharmony_ci|
4668c2ecf20Sopenharmony_ci| Final result table for unf_sub. Note that the negative counterparts
4678c2ecf20Sopenharmony_ci| are unnecessary as unf_sub always returns the sign separately from
4688c2ecf20Sopenharmony_ci| the exponent.
4698c2ecf20Sopenharmony_ci|					;+zero
4708c2ecf20Sopenharmony_ciEXT_PZRO:	.long	0x00000000,0x00000000,0x00000000,0x00000000
4718c2ecf20Sopenharmony_ci|					;+zero
4728c2ecf20Sopenharmony_ciSGL_PZRO:	.long	0x3f810000,0x00000000,0x00000000,0x00000000
4738c2ecf20Sopenharmony_ci|					;+zero
4748c2ecf20Sopenharmony_ciDBL_PZRO:	.long	0x3c010000,0x00000000,0x00000000,0x00000000
4758c2ecf20Sopenharmony_ci|					;smallest +ext denorm
4768c2ecf20Sopenharmony_ciEXT_PSML:	.long	0x00000000,0x00000000,0x00000001,0x00000000
4778c2ecf20Sopenharmony_ci|					;smallest +sgl denorm
4788c2ecf20Sopenharmony_ciSGL_PSML:	.long	0x3f810000,0x00000100,0x00000000,0x00000000
4798c2ecf20Sopenharmony_ci|					;smallest +dbl denorm
4808c2ecf20Sopenharmony_ciDBL_PSML:	.long	0x3c010000,0x00000000,0x00000800,0x00000000
4818c2ecf20Sopenharmony_ci|
4828c2ecf20Sopenharmony_ci|	UNF_SUB --- underflow result calculation
4838c2ecf20Sopenharmony_ci|
4848c2ecf20Sopenharmony_ci| Input:
4858c2ecf20Sopenharmony_ci|	d0	contains round precision
4868c2ecf20Sopenharmony_ci|	a0	points to input operand in the internal extended format
4878c2ecf20Sopenharmony_ci|
4888c2ecf20Sopenharmony_ci| Output:
4898c2ecf20Sopenharmony_ci|	a0	points to correct internal extended precision result.
4908c2ecf20Sopenharmony_ci|
4918c2ecf20Sopenharmony_ci
4928c2ecf20Sopenharmony_citblunf:
4938c2ecf20Sopenharmony_ci	.long	uEXT_RN
4948c2ecf20Sopenharmony_ci	.long	uEXT_RZ
4958c2ecf20Sopenharmony_ci	.long	uEXT_RM
4968c2ecf20Sopenharmony_ci	.long	uEXT_RP
4978c2ecf20Sopenharmony_ci	.long	uSGL_RN
4988c2ecf20Sopenharmony_ci	.long	uSGL_RZ
4998c2ecf20Sopenharmony_ci	.long	uSGL_RM
5008c2ecf20Sopenharmony_ci	.long	uSGL_RP
5018c2ecf20Sopenharmony_ci	.long	uDBL_RN
5028c2ecf20Sopenharmony_ci	.long	uDBL_RZ
5038c2ecf20Sopenharmony_ci	.long	uDBL_RM
5048c2ecf20Sopenharmony_ci	.long	uDBL_RP
5058c2ecf20Sopenharmony_ci	.long	uDBL_RN
5068c2ecf20Sopenharmony_ci	.long	uDBL_RZ
5078c2ecf20Sopenharmony_ci	.long	uDBL_RM
5088c2ecf20Sopenharmony_ci	.long	uDBL_RP
5098c2ecf20Sopenharmony_ci
5108c2ecf20Sopenharmony_ci	.global	unf_sub
5118c2ecf20Sopenharmony_ciunf_sub:
5128c2ecf20Sopenharmony_ci	lsll	#2,%d0		|move round precision to d0{3:2}
5138c2ecf20Sopenharmony_ci	bfextu	FPCR_MODE(%a6){#2:#2},%d1 |set round mode
5148c2ecf20Sopenharmony_ci	orl	%d1,%d0		|index is fmt:mode in d0{3:0}
5158c2ecf20Sopenharmony_ci	leal	tblunf,%a1	|load a1 with table address
5168c2ecf20Sopenharmony_ci	movel	%a1@(%d0:l:4),%a1	|use d0 as index to the table
5178c2ecf20Sopenharmony_ci	jmp	(%a1)		|go to the correct routine
5188c2ecf20Sopenharmony_ci|
5198c2ecf20Sopenharmony_ci|case DEST_FMT = EXT
5208c2ecf20Sopenharmony_ci|
5218c2ecf20Sopenharmony_ciuEXT_RN:
5228c2ecf20Sopenharmony_ci	leal	EXT_PZRO,%a1	|answer is +/- zero
5238c2ecf20Sopenharmony_ci	bsetb	#z_bit,FPSR_CC(%a6)
5248c2ecf20Sopenharmony_ci	bra	uset_sign	|now go set the sign
5258c2ecf20Sopenharmony_ciuEXT_RZ:
5268c2ecf20Sopenharmony_ci	leal	EXT_PZRO,%a1	|answer is +/- zero
5278c2ecf20Sopenharmony_ci	bsetb	#z_bit,FPSR_CC(%a6)
5288c2ecf20Sopenharmony_ci	bra	uset_sign	|now go set the sign
5298c2ecf20Sopenharmony_ciuEXT_RM:
5308c2ecf20Sopenharmony_ci	tstb	LOCAL_SGN(%a0)	|if negative underflow
5318c2ecf20Sopenharmony_ci	beqs	ue_rm_pos
5328c2ecf20Sopenharmony_ciue_rm_neg:
5338c2ecf20Sopenharmony_ci	leal	EXT_PSML,%a1	|answer is negative smallest denorm
5348c2ecf20Sopenharmony_ci	bsetb	#neg_bit,FPSR_CC(%a6)
5358c2ecf20Sopenharmony_ci	bra	end_unfr
5368c2ecf20Sopenharmony_ciue_rm_pos:
5378c2ecf20Sopenharmony_ci	leal	EXT_PZRO,%a1	|answer is positive zero
5388c2ecf20Sopenharmony_ci	bsetb	#z_bit,FPSR_CC(%a6)
5398c2ecf20Sopenharmony_ci	bra	end_unfr
5408c2ecf20Sopenharmony_ciuEXT_RP:
5418c2ecf20Sopenharmony_ci	tstb	LOCAL_SGN(%a0)	|if negative underflow
5428c2ecf20Sopenharmony_ci	beqs	ue_rp_pos
5438c2ecf20Sopenharmony_ciue_rp_neg:
5448c2ecf20Sopenharmony_ci	leal	EXT_PZRO,%a1	|answer is negative zero
5458c2ecf20Sopenharmony_ci	oril	#negz_mask,USER_FPSR(%a6)
5468c2ecf20Sopenharmony_ci	bra	end_unfr
5478c2ecf20Sopenharmony_ciue_rp_pos:
5488c2ecf20Sopenharmony_ci	leal	EXT_PSML,%a1	|answer is positive smallest denorm
5498c2ecf20Sopenharmony_ci	bra	end_unfr
5508c2ecf20Sopenharmony_ci|
5518c2ecf20Sopenharmony_ci|case DEST_FMT = DBL
5528c2ecf20Sopenharmony_ci|
5538c2ecf20Sopenharmony_ciuDBL_RN:
5548c2ecf20Sopenharmony_ci	leal	DBL_PZRO,%a1	|answer is +/- zero
5558c2ecf20Sopenharmony_ci	bsetb	#z_bit,FPSR_CC(%a6)
5568c2ecf20Sopenharmony_ci	bra	uset_sign
5578c2ecf20Sopenharmony_ciuDBL_RZ:
5588c2ecf20Sopenharmony_ci	leal	DBL_PZRO,%a1	|answer is +/- zero
5598c2ecf20Sopenharmony_ci	bsetb	#z_bit,FPSR_CC(%a6)
5608c2ecf20Sopenharmony_ci	bra	uset_sign	|now go set the sign
5618c2ecf20Sopenharmony_ciuDBL_RM:
5628c2ecf20Sopenharmony_ci	tstb	LOCAL_SGN(%a0)	|if negative overflow
5638c2ecf20Sopenharmony_ci	beqs	ud_rm_pos
5648c2ecf20Sopenharmony_ciud_rm_neg:
5658c2ecf20Sopenharmony_ci	leal	DBL_PSML,%a1	|answer is smallest denormalized negative
5668c2ecf20Sopenharmony_ci	bsetb	#neg_bit,FPSR_CC(%a6)
5678c2ecf20Sopenharmony_ci	bra	end_unfr
5688c2ecf20Sopenharmony_ciud_rm_pos:
5698c2ecf20Sopenharmony_ci	leal	DBL_PZRO,%a1	|answer is positive zero
5708c2ecf20Sopenharmony_ci	bsetb	#z_bit,FPSR_CC(%a6)
5718c2ecf20Sopenharmony_ci	bra	end_unfr
5728c2ecf20Sopenharmony_ciuDBL_RP:
5738c2ecf20Sopenharmony_ci	tstb	LOCAL_SGN(%a0)	|if negative overflow
5748c2ecf20Sopenharmony_ci	beqs	ud_rp_pos
5758c2ecf20Sopenharmony_ciud_rp_neg:
5768c2ecf20Sopenharmony_ci	leal	DBL_PZRO,%a1	|answer is negative zero
5778c2ecf20Sopenharmony_ci	oril	#negz_mask,USER_FPSR(%a6)
5788c2ecf20Sopenharmony_ci	bra	end_unfr
5798c2ecf20Sopenharmony_ciud_rp_pos:
5808c2ecf20Sopenharmony_ci	leal	DBL_PSML,%a1	|answer is smallest denormalized negative
5818c2ecf20Sopenharmony_ci	bra	end_unfr
5828c2ecf20Sopenharmony_ci|
5838c2ecf20Sopenharmony_ci|case DEST_FMT = SGL
5848c2ecf20Sopenharmony_ci|
5858c2ecf20Sopenharmony_ciuSGL_RN:
5868c2ecf20Sopenharmony_ci	leal	SGL_PZRO,%a1	|answer is +/- zero
5878c2ecf20Sopenharmony_ci	bsetb	#z_bit,FPSR_CC(%a6)
5888c2ecf20Sopenharmony_ci	bras	uset_sign
5898c2ecf20Sopenharmony_ciuSGL_RZ:
5908c2ecf20Sopenharmony_ci	leal	SGL_PZRO,%a1	|answer is +/- zero
5918c2ecf20Sopenharmony_ci	bsetb	#z_bit,FPSR_CC(%a6)
5928c2ecf20Sopenharmony_ci	bras	uset_sign
5938c2ecf20Sopenharmony_ciuSGL_RM:
5948c2ecf20Sopenharmony_ci	tstb	LOCAL_SGN(%a0)	|if negative overflow
5958c2ecf20Sopenharmony_ci	beqs	us_rm_pos
5968c2ecf20Sopenharmony_cius_rm_neg:
5978c2ecf20Sopenharmony_ci	leal	SGL_PSML,%a1	|answer is smallest denormalized negative
5988c2ecf20Sopenharmony_ci	bsetb	#neg_bit,FPSR_CC(%a6)
5998c2ecf20Sopenharmony_ci	bras	end_unfr
6008c2ecf20Sopenharmony_cius_rm_pos:
6018c2ecf20Sopenharmony_ci	leal	SGL_PZRO,%a1	|answer is positive zero
6028c2ecf20Sopenharmony_ci	bsetb	#z_bit,FPSR_CC(%a6)
6038c2ecf20Sopenharmony_ci	bras	end_unfr
6048c2ecf20Sopenharmony_ciuSGL_RP:
6058c2ecf20Sopenharmony_ci	tstb	LOCAL_SGN(%a0)	|if negative overflow
6068c2ecf20Sopenharmony_ci	beqs	us_rp_pos
6078c2ecf20Sopenharmony_cius_rp_neg:
6088c2ecf20Sopenharmony_ci	leal	SGL_PZRO,%a1	|answer is negative zero
6098c2ecf20Sopenharmony_ci	oril	#negz_mask,USER_FPSR(%a6)
6108c2ecf20Sopenharmony_ci	bras	end_unfr
6118c2ecf20Sopenharmony_cius_rp_pos:
6128c2ecf20Sopenharmony_ci	leal	SGL_PSML,%a1	|answer is smallest denormalized positive
6138c2ecf20Sopenharmony_ci	bras	end_unfr
6148c2ecf20Sopenharmony_ci
6158c2ecf20Sopenharmony_ciuset_sign:
6168c2ecf20Sopenharmony_ci	tstb	LOCAL_SGN(%a0)	|if negative overflow
6178c2ecf20Sopenharmony_ci	beqs	end_unfr
6188c2ecf20Sopenharmony_ciuneg_sign:
6198c2ecf20Sopenharmony_ci	bsetb	#neg_bit,FPSR_CC(%a6)
6208c2ecf20Sopenharmony_ci
6218c2ecf20Sopenharmony_ciend_unfr:
6228c2ecf20Sopenharmony_ci	movew	LOCAL_EX(%a1),LOCAL_EX(%a0) |be careful not to overwrite sign
6238c2ecf20Sopenharmony_ci	movel	LOCAL_HI(%a1),LOCAL_HI(%a0)
6248c2ecf20Sopenharmony_ci	movel	LOCAL_LO(%a1),LOCAL_LO(%a0)
6258c2ecf20Sopenharmony_ci	rts
6268c2ecf20Sopenharmony_ci|
6278c2ecf20Sopenharmony_ci|	reg_dest --- write byte, word, or long data to Dn
6288c2ecf20Sopenharmony_ci|
6298c2ecf20Sopenharmony_ci|
6308c2ecf20Sopenharmony_ci| Input:
6318c2ecf20Sopenharmony_ci|	L_SCR1: Data
6328c2ecf20Sopenharmony_ci|	d1:     data size and dest register number formatted as:
6338c2ecf20Sopenharmony_ci|
6348c2ecf20Sopenharmony_ci|	32		5    4     3     2     1     0
6358c2ecf20Sopenharmony_ci|       -----------------------------------------------
6368c2ecf20Sopenharmony_ci|       |        0        |    Size   |  Dest Reg #   |
6378c2ecf20Sopenharmony_ci|       -----------------------------------------------
6388c2ecf20Sopenharmony_ci|
6398c2ecf20Sopenharmony_ci|	Size is:
6408c2ecf20Sopenharmony_ci|		0 - Byte
6418c2ecf20Sopenharmony_ci|		1 - Word
6428c2ecf20Sopenharmony_ci|		2 - Long/Single
6438c2ecf20Sopenharmony_ci|
6448c2ecf20Sopenharmony_cipregdst:
6458c2ecf20Sopenharmony_ci	.long	byte_d0
6468c2ecf20Sopenharmony_ci	.long	byte_d1
6478c2ecf20Sopenharmony_ci	.long	byte_d2
6488c2ecf20Sopenharmony_ci	.long	byte_d3
6498c2ecf20Sopenharmony_ci	.long	byte_d4
6508c2ecf20Sopenharmony_ci	.long	byte_d5
6518c2ecf20Sopenharmony_ci	.long	byte_d6
6528c2ecf20Sopenharmony_ci	.long	byte_d7
6538c2ecf20Sopenharmony_ci	.long	word_d0
6548c2ecf20Sopenharmony_ci	.long	word_d1
6558c2ecf20Sopenharmony_ci	.long	word_d2
6568c2ecf20Sopenharmony_ci	.long	word_d3
6578c2ecf20Sopenharmony_ci	.long	word_d4
6588c2ecf20Sopenharmony_ci	.long	word_d5
6598c2ecf20Sopenharmony_ci	.long	word_d6
6608c2ecf20Sopenharmony_ci	.long	word_d7
6618c2ecf20Sopenharmony_ci	.long	long_d0
6628c2ecf20Sopenharmony_ci	.long	long_d1
6638c2ecf20Sopenharmony_ci	.long	long_d2
6648c2ecf20Sopenharmony_ci	.long	long_d3
6658c2ecf20Sopenharmony_ci	.long	long_d4
6668c2ecf20Sopenharmony_ci	.long	long_d5
6678c2ecf20Sopenharmony_ci	.long	long_d6
6688c2ecf20Sopenharmony_ci	.long	long_d7
6698c2ecf20Sopenharmony_ci
6708c2ecf20Sopenharmony_cireg_dest:
6718c2ecf20Sopenharmony_ci	leal	pregdst,%a0
6728c2ecf20Sopenharmony_ci	movel	%a0@(%d1:l:4),%a0
6738c2ecf20Sopenharmony_ci	jmp	(%a0)
6748c2ecf20Sopenharmony_ci
6758c2ecf20Sopenharmony_cibyte_d0:
6768c2ecf20Sopenharmony_ci	moveb	L_SCR1(%a6),USER_D0+3(%a6)
6778c2ecf20Sopenharmony_ci	rts
6788c2ecf20Sopenharmony_cibyte_d1:
6798c2ecf20Sopenharmony_ci	moveb	L_SCR1(%a6),USER_D1+3(%a6)
6808c2ecf20Sopenharmony_ci	rts
6818c2ecf20Sopenharmony_cibyte_d2:
6828c2ecf20Sopenharmony_ci	moveb	L_SCR1(%a6),%d2
6838c2ecf20Sopenharmony_ci	rts
6848c2ecf20Sopenharmony_cibyte_d3:
6858c2ecf20Sopenharmony_ci	moveb	L_SCR1(%a6),%d3
6868c2ecf20Sopenharmony_ci	rts
6878c2ecf20Sopenharmony_cibyte_d4:
6888c2ecf20Sopenharmony_ci	moveb	L_SCR1(%a6),%d4
6898c2ecf20Sopenharmony_ci	rts
6908c2ecf20Sopenharmony_cibyte_d5:
6918c2ecf20Sopenharmony_ci	moveb	L_SCR1(%a6),%d5
6928c2ecf20Sopenharmony_ci	rts
6938c2ecf20Sopenharmony_cibyte_d6:
6948c2ecf20Sopenharmony_ci	moveb	L_SCR1(%a6),%d6
6958c2ecf20Sopenharmony_ci	rts
6968c2ecf20Sopenharmony_cibyte_d7:
6978c2ecf20Sopenharmony_ci	moveb	L_SCR1(%a6),%d7
6988c2ecf20Sopenharmony_ci	rts
6998c2ecf20Sopenharmony_ciword_d0:
7008c2ecf20Sopenharmony_ci	movew	L_SCR1(%a6),USER_D0+2(%a6)
7018c2ecf20Sopenharmony_ci	rts
7028c2ecf20Sopenharmony_ciword_d1:
7038c2ecf20Sopenharmony_ci	movew	L_SCR1(%a6),USER_D1+2(%a6)
7048c2ecf20Sopenharmony_ci	rts
7058c2ecf20Sopenharmony_ciword_d2:
7068c2ecf20Sopenharmony_ci	movew	L_SCR1(%a6),%d2
7078c2ecf20Sopenharmony_ci	rts
7088c2ecf20Sopenharmony_ciword_d3:
7098c2ecf20Sopenharmony_ci	movew	L_SCR1(%a6),%d3
7108c2ecf20Sopenharmony_ci	rts
7118c2ecf20Sopenharmony_ciword_d4:
7128c2ecf20Sopenharmony_ci	movew	L_SCR1(%a6),%d4
7138c2ecf20Sopenharmony_ci	rts
7148c2ecf20Sopenharmony_ciword_d5:
7158c2ecf20Sopenharmony_ci	movew	L_SCR1(%a6),%d5
7168c2ecf20Sopenharmony_ci	rts
7178c2ecf20Sopenharmony_ciword_d6:
7188c2ecf20Sopenharmony_ci	movew	L_SCR1(%a6),%d6
7198c2ecf20Sopenharmony_ci	rts
7208c2ecf20Sopenharmony_ciword_d7:
7218c2ecf20Sopenharmony_ci	movew	L_SCR1(%a6),%d7
7228c2ecf20Sopenharmony_ci	rts
7238c2ecf20Sopenharmony_cilong_d0:
7248c2ecf20Sopenharmony_ci	movel	L_SCR1(%a6),USER_D0(%a6)
7258c2ecf20Sopenharmony_ci	rts
7268c2ecf20Sopenharmony_cilong_d1:
7278c2ecf20Sopenharmony_ci	movel	L_SCR1(%a6),USER_D1(%a6)
7288c2ecf20Sopenharmony_ci	rts
7298c2ecf20Sopenharmony_cilong_d2:
7308c2ecf20Sopenharmony_ci	movel	L_SCR1(%a6),%d2
7318c2ecf20Sopenharmony_ci	rts
7328c2ecf20Sopenharmony_cilong_d3:
7338c2ecf20Sopenharmony_ci	movel	L_SCR1(%a6),%d3
7348c2ecf20Sopenharmony_ci	rts
7358c2ecf20Sopenharmony_cilong_d4:
7368c2ecf20Sopenharmony_ci	movel	L_SCR1(%a6),%d4
7378c2ecf20Sopenharmony_ci	rts
7388c2ecf20Sopenharmony_cilong_d5:
7398c2ecf20Sopenharmony_ci	movel	L_SCR1(%a6),%d5
7408c2ecf20Sopenharmony_ci	rts
7418c2ecf20Sopenharmony_cilong_d6:
7428c2ecf20Sopenharmony_ci	movel	L_SCR1(%a6),%d6
7438c2ecf20Sopenharmony_ci	rts
7448c2ecf20Sopenharmony_cilong_d7:
7458c2ecf20Sopenharmony_ci	movel	L_SCR1(%a6),%d7
7468c2ecf20Sopenharmony_ci	rts
7478c2ecf20Sopenharmony_ci	|end
748