⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 get_op.s

📁 VXWORKS源代码
💻 S
📖 第 1 页 / 共 2 页
字号:
/* get_op.s - Motorola 68040 FP get opclass routine (EXC) *//* Copyright 1991-1993 Wind River Systems, Inc. */	.data	.globl	_copyright_wind_river	.long	_copyright_wind_river/*modification history--------------------01f,31may96,ms   updated to mototorola version 2.301e,21jul93,kdl  added .text (SPR #2372).01d,23aug92,jcf  changed bxxx to jxx.01c,26may92,rrr  the tree shuffle01b,10jan92,kdl  added modification history; general cleanup.01a,15aug91,kdl  original version, from Motorola FPSP v2.0.*//*DESCRIPTION	get_opsa 3.5 4/26/91 Description: This routine is called by the unsupported format/datatype exception handler ('unsupp' - vector 55) and the unimplementedinstruction exception handler ('unimp' - vector 11).  'get_op'determines the opclass (0, 2, or 3) and branches to theopclass handler routine.  See 68881/2 User's Manual table 4-11for a description of the opclasses.For UNSUPPORTED data/format (exception vector 55) and forUNIMPLEMENTED instructions (exception vector 11) the followingapplies:- For unnormormalized numbers (opclass 0, 2, or 3) thenumber(s) is normalized and the operand type tag is updated.- For a packed number (opclass 2) the number is unpacked and theoperand type tag is updated.- For denormalized numbers (opclass 0 or 2) the number(s) is notchanged but passed to the next module.  The next module forunimp is __x_do_func, the next module for unsupp is __x_res_func.For UNSUPPORTED data/format (exception vector 55) only thefollowing applies:- If there is a move out with a packed number (opclass 3) thenumber is packed and written to user memory.  For the otheropclasses the number(s) are written back to the fsave stackand the instruction is then restored back into the '040.  The'040 is then able to complete the instruction.For example:faddx fpm,fpn where the fpm contains an unnormalized number.The '040 takes an unsupported data trap and gets to thisroutine.  The number is normalized, put back on the stack andthen an frestore is done to restore the instruction back intothe '040.  The '040 then re-executes the faddx fpm,fpn witha normalized number in the source and the instruction issuccessful.Next consider if in the process of normalizing the un-normalized number it becomes a denormalized number.  Theroutine which converts the unnorm to a norm (called mk_norm)detects this and tags the number as a denorm.  The routine__x_res_func sees the denorm tag and converts the denorm to anorm.  The instruction is then restored back into the '040which re_executess the instruction.		Copyright (C) Motorola, Inc. 1990			All Rights Reserved	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA	The copyright notice above does not evidence any	actual or intended publication of such source code.GET_OP    idnt    2,1 Motorola 040 Floating Point Software Package	section	8NOMANUAL*/#include "fpsp040E.h"	.globl	__x_PIRN,__x_PIRZRM,__x_PIRP	.globl	__x_SMALRN,__x_SMALRZRM,__x_SMALRP	.globl	__x_BIGRN,__x_BIGRZRM,__x_BIGRP__x_PIRN:	.long 0x40000000,0xc90fdaa2,0x2168c235    | pi__x_PIRZRM:	.long 0x40000000,0xc90fdaa2,0x2168c234    | pi__x_PIRP:	.long 0x40000000,0xc90fdaa2,0x2168c235    | pi|round to nearest__x_SMALRN:	.long 0x3ffd0000,0x9a209a84,0xfbcff798    | log10(2)	.long 0x40000000,0xadf85458,0xa2bb4a9a    | e	.long 0x3fff0000,0xb8aa3b29,0x5c17f0bc    | log2(e)	.long 0x3ffd0000,0xde5bd8a9,0x37287195    | log10(e)	.long 0x00000000,0x00000000,0x00000000    | 0.0| round to zero; round to negative infinity__x_SMALRZRM:	.long 0x3ffd0000,0x9a209a84,0xfbcff798    | log10(2)	.long 0x40000000,0xadf85458,0xa2bb4a9a    | e	.long 0x3fff0000,0xb8aa3b29,0x5c17f0bb    | log2(e)	.long 0x3ffd0000,0xde5bd8a9,0x37287195    | log10(e)	.long 0x00000000,0x00000000,0x00000000    | 0.0| round to positive infinity__x_SMALRP:	.long 0x3ffd0000,0x9a209a84,0xfbcff799    | log10(2)	.long 0x40000000,0xadf85458,0xa2bb4a9b    | e	.long 0x3fff0000,0xb8aa3b29,0x5c17f0bc    | log2(e)	.long 0x3ffd0000,0xde5bd8a9,0x37287195    | log10(e)	.long 0x00000000,0x00000000,0x00000000    | 0.0|round to nearest__x_BIGRN:	.long 0x3ffe0000,0xb17217f7,0xd1cf79ac    | ln(2)	.long 0x40000000,0x935d8ddd,0xaaa8ac17    | ln(10)	.long 0x3fff0000,0x80000000,0x00000000    | 10 ^ 0	.globl	__x_PTENRN__x_PTENRN:	.long 0x40020000,0xA0000000,0x00000000    | 10 ^ 1	.long 0x40050000,0xC8000000,0x00000000    | 10 ^ 2	.long 0x400C0000,0x9C400000,0x00000000    | 10 ^ 4	.long 0x40190000,0xBEBC2000,0x00000000    | 10 ^ 8	.long 0x40340000,0x8E1BC9BF,0x04000000    | 10 ^ 16	.long 0x40690000,0x9DC5ADA8,0x2B70B59E    | 10 ^ 32	.long 0x40D30000,0xC2781F49,0xFFCFA6D5    | 10 ^ 64	.long 0x41A80000,0x93BA47C9,0x80E98CE0    | 10 ^ 128	.long 0x43510000,0xAA7EEBFB,0x9DF9DE8E    | 10 ^ 256	.long 0x46A30000,0xE319A0AE,0xA60E91C7    | 10 ^ 512	.long 0x4D480000,0xC9767586,0x81750C17    | 10 ^ 1024	.long 0x5A920000,0x9E8B3B5D,0xC53D5DE5    | 10 ^ 2048	.long 0x75250000,0xC4605202,0x8A20979B    | 10 ^ 4096|round to minus infinity__x_BIGRZRM:	.long 0x3ffe0000,0xb17217f7,0xd1cf79ab    | ln(2)	.long 0x40000000,0x935d8ddd,0xaaa8ac16    | ln(10)	.long 0x3fff0000,0x80000000,0x00000000    | 10 ^ 0	.globl	__x_PTENRM__x_PTENRM:	.long 0x40020000,0xA0000000,0x00000000    | 10 ^ 1	.long 0x40050000,0xC8000000,0x00000000    | 10 ^ 2	.long 0x400C0000,0x9C400000,0x00000000    | 10 ^ 4	.long 0x40190000,0xBEBC2000,0x00000000    | 10 ^ 8	.long 0x40340000,0x8E1BC9BF,0x04000000    | 10 ^ 16	.long 0x40690000,0x9DC5ADA8,0x2B70B59D    | 10 ^ 32	.long 0x40D30000,0xC2781F49,0xFFCFA6D5    | 10 ^ 64	.long 0x41A80000,0x93BA47C9,0x80E98CDF    | 10 ^ 128	.long 0x43510000,0xAA7EEBFB,0x9DF9DE8D    | 10 ^ 256	.long 0x46A30000,0xE319A0AE,0xA60E91C6    | 10 ^ 512	.long 0x4D480000,0xC9767586,0x81750C17    | 10 ^ 1024	.long 0x5A920000,0x9E8B3B5D,0xC53D5DE5    | 10 ^ 2048	.long 0x75250000,0xC4605202,0x8A20979A    | 10 ^ 4096|round to positive infinity__x_BIGRP:	.long 0x3ffe0000,0xb17217f7,0xd1cf79ac    | ln(2)	.long 0x40000000,0x935d8ddd,0xaaa8ac17    | ln(10)	.long 0x3fff0000,0x80000000,0x00000000    | 10 ^ 0	.globl	__x_PTENRP__x_PTENRP:	.long 0x40020000,0xA0000000,0x00000000    | 10 ^ 1	.long 0x40050000,0xC8000000,0x00000000    | 10 ^ 2	.long 0x400C0000,0x9C400000,0x00000000    | 10 ^ 4	.long 0x40190000,0xBEBC2000,0x00000000    | 10 ^ 8	.long 0x40340000,0x8E1BC9BF,0x04000000    | 10 ^ 16	.long 0x40690000,0x9DC5ADA8,0x2B70B59E    | 10 ^ 32	.long 0x40D30000,0xC2781F49,0xFFCFA6D6    | 10 ^ 64	.long 0x41A80000,0x93BA47C9,0x80E98CE0    | 10 ^ 128	.long 0x43510000,0xAA7EEBFB,0x9DF9DE8E    | 10 ^ 256	.long 0x46A30000,0xE319A0AE,0xA60E91C7    | 10 ^ 512	.long 0x4D480000,0xC9767586,0x81750C18    | 10 ^ 1024	.long 0x5A920000,0x9E8B3B5D,0xC53D5DE6    | 10 ^ 2048	.long 0x75250000,0xC4605202,0x8A20979B    | 10 ^ 4096|	xref	__x_nrm_zero|	xref	__x_decbin|	xref	__x_round	.globl    __x_get_op	.globl    __x_uns_getop	.globl    __x_uni_getop	.text__x_get_op:	clrb	a6@(DY_MO_FLG)	tstb	a6@(UFLG_TMP)	| test flag for unsupp/unimp state	jeq 	__x_uni_getop__x_uns_getop:	btst	#direction_bit,a6@(CMDREG1B)	jne 	opclass3	| branch if a fmovel out (any kind)	btst	#6,a6@(CMDREG1B)	jeq 	uns_notpacked	bfextu	a6@(CMDREG1B){#3:#3},d0	cmpb	#3,d0	jeq 	pack_source	| check for a packed src op, branch if souns_notpacked:	bsrl	chk_dy_mo	| set the dyadic/monadic flag	tstb	a6@(DY_MO_FLG)	jeq 	src_op_ck	| if monadic, go check src op|				| else, check dst op (fall through)	btst	#7,a6@(DTAG)	jeq 	src_op_ck	| if dst op is norm, check src op	jra 	dst_ex_dnrm	| else, handle destination unnorm/dnrm__x_uni_getop:	bfextu	a6@(CMDREG1B){#0:#6},d0 | get opclass and src fields	cmpil	#0x17,d0		| if op class and size fields are 0x17,|				| it is FMOVECR|  if not, continue|| If the instruction is fmovecr, exit __x_get_op.  It is handled| in __x_do_func and smovecrsa.|	jne 	not_fmovecr	| handle fmovecr as an unimplemented inst	rtsnot_fmovecr:	btst	#E1,a6@(E_BYTE)	| if set, there is a packed operand	jne 	pack_source	| check for packed src op, branch if so| The following lines of are coded to optimize on normalized operands	moveb	a6@(STAG),d0	orb	a6@(DTAG),d0	| check if either of STAG/DTAG msb set	jmi 	dest_op_ck	| if so, some op needs to be fixed	rtsdest_op_ck:	btst	#7,a6@(DTAG)	| check for unsupported data types in	jeq 	src_op_ck	| the destination, if not, check src op	bsrl	chk_dy_mo	| set dyadic/monadic flag	tstb	a6@(DY_MO_FLG)	|	jeq 	src_op_ck	| if monadic, check src op|| At this point, destination has an extended denorm or unnorm.|dst_ex_dnrm:	movew	a6@(FPTEMP_EX),d0 | get destination exponent	andiw	#0x7fff,d0	| mask sign, check if exp = 0000	jeq 	src_op_ck	| if denorm then check source op.|				| denorms are taken care of in __x_res_func|				| (unsupp) or __x_do_func (unimp)|				| else unnorm fall through	lea	a6@(FPTEMP),a0	| point a0 to dop - used in mk_norm	bsrl	mk_norm		| go normalize - mk_norm returns:|				| L_SCR1{7:5} = operand tag|				| 	(000 = norm, 100 = denorm)|				| L_SCR1{4} = fpte15 or ete15|				| 	0 = exp >  0x3fff|				| 	1 = exp <= 0x3fff|				| and puts the normalized num back|				| on the fsave stack|	moveb	a6@(L_SCR1),a6@(DTAG) | write the new tag # fpte15|				| to the fsave stack and fall|				| through to check source operand|src_op_ck:	btst	#7,a6@(STAG)	jeq 	end_getop	| check for unsupported data types on the|				| source operand	btst	#5,a6@(STAG)	jne 	src_sd_dnrm	| if bit 5 set, handle sgl/dbl denorms|| At this point only unnorms or extended denorms are possible.|src_ex_dnrm:	movew	a6@(ETEMP_EX),d0 | get source exponent	andiw	#0x7fff,d0	| mask sign, check if exp = 0000	jeq 	end_getop	| if denorm then exit, denorms are|				| handled in __x_do_func	lea	a6@(ETEMP),a0	| point a0 to sop - used in mk_norm	bsrl	mk_norm		| go normalize - mk_norm returns:|				| L_SCR1{7:5} = operand tag|				| 	(000 = norm, 100 = denorm)|				| L_SCR1{4} = fpte15 or ete15|				| 	0 = exp >  0x3fff|				| 	1 = exp <= 0x3fff|				| and puts the normalized num back|				| on the fsave stack|	moveb	a6@(L_SCR1),a6@(STAG) | write the new tag # ete15	rts			| end_getop|| At this point, only single or double denorms are possible.| If the inst is not fmove, normalize the source.  If it is,| do nothing to the input.|src_sd_dnrm:	btst	#4,a6@(CMDREG1B)	| differentiate between sgl/dbl denorm	jne 	is_doubleis_single:	movew	#0x3f81,d1	| write bias for sgl denorm	jra 	common		| goto the common codeis_double:	movew	#0x3c01,d1	| write the bias for a dbl denormcommon:	btst	#sign_bit,a6@(ETEMP_EX) | grab sign bit of mantissa	jeq 	pos	bset	#15,d1		| set sign bit because it is negativepos:	movew	d1,a6@(ETEMP_EX)|				| put exponent on stack	movew	a6@(CMDREG1B),d1	andw	#0xe3ff,d1	| clear out source specifier	orw	#0x0800,d1	| set source specifier to extended prec	movew	d1,a6@(CMDREG1B)	| write back to the command word in stack|				| this is needed to fix unsupp data stack	lea	a6@(ETEMP),a0	| point a0 to sop	bsrl	mk_norm		| convert sgl/dbl denorm to norm	moveb	a6@(L_SCR1),a6@(STAG) | put tag into source tag reg - d0	rts			| end_getop|| At this point, the source is definitely packed, whether| instruction is dyadic or monadic is still unknown|pack_source:	movel	a6@(FPTEMP_LO),a6@(ETEMP)	| write ms part of packed|				| number to etemp slot	bsrl	chk_dy_mo	| set dyadic/monadic flag	bsrl	unpack	tstb	a6@(DY_MO_FLG)	jeq 	end_getop	| if monadic, exit|				| else, fix FPTEMPpack_dya:	bfextu	a6@(CMDREG1B){#6:#3},d0 | extract dest fp reg	movel	#7,d1	subl	d0,d1	clrl	d0	bset	d1,d0		| set up d0 as a dynamic register mask	fmovemx d0,a6@(FPTEMP)	| write to FPTEMP	btst	#7,a6@(DTAG)	| check dest tag for unnorm or denorm	jne 	dst_ex_dnrm	| else, handle the unnorm or ext denorm

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -