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

📄 mathhardalib.s

📁 VxWorks BSP框架源代码包含头文件和驱动
💻 S
📖 第 1 页 / 共 2 页
字号:
	movel	a6@(DARG2),sp@-	jsr	__l_fintd		/* returns in fp0 */	addql	#8,sp	fmovex	fp0,fp1			/* copy result to fp1 */	fmovex	sp@+,fp0		/* restore fp0 */#else	fabsx	fp0, fp0#if (CPU == MC68060)	fmovex	fp0,sp@-	jsr	FPLSP_060__FLOGNX_	/* ln(|x|) */	addql	#8,sp#else	/* (CPU == MC68060) */    	flognx	fp0, fp0		/* ln(|x|) */#endif	/* (CPU == MC68060) */	fintd	a6@(DARG2), fp1#endif	fcmpd	a6@(DARG2), fp1		/* y == int(y) ? */	fbne	powNaN	fmulx	fp1, fp0		/* y * ln(|x|) */#if (CPU==MC68040 || CPU==MC68060)	movel	a6@(DARG1L),sp@-	movel	a6@(DARG1),sp@-#if (CPU == MC68040)	jsr	__l_fetoxx		/* exp(y * ln(|x|)) -- returns in fp0 */#else /* (CPU == MC68060) */	jsr	FPLSP_060__FETOXX_	/* exp(y * ln(|x|)) -- returns in fp0 */#endif /* (CPU == MC68060) */	addql	#8,sp#else	fetoxx	fp0, fp0		/* exp( y * ln(|x|) ) */#endif	fmodw	#2, fp1			/* modulus 2 */	fbeq	powExit			/* All done */pow_odd_y:	fnegx	fp0, fp0		/* inverse mantissa (negate) */	jra	powExitpowNaN:	fmovecr	#0x0f, fp0		/* Zero fp register */	jra	powErrExitpowErrExit:	pea	EDOM			/* Domain Error	*/	jsr	_errnoSet		/* Set the error */	addqw	#0x4, sp		/* tidy up */powExit:	fmoved	fp0, a6@(DARG1)	movl	a6@(DARG1), d0		/* return result in d0:d1 */	movl	a6@(DARG1L), d1	unlk	a6	rts/********************************************************************************* mathHardSin - ANSI-compatable hardware floating-point sine** RETURNS: The floating-point sine of dblParam.** SEE ALSO:*   floatLib (1), cos (2), tan (2),*   "The C Programming Language - Second Edition"* double mathHardSin (dblParam)*     double dblParam;	/* angle in radians ***/_mathHardSin:	link    a6,#0	fmovex  fp0,sp@-#if (CPU==MC68040 || CPU==MC68060)	movel	a6@(DARG1L),sp@-	movel	a6@(DARG1),sp@-#if (CPU == MC68040)	jsr	__l_fsind		/* returns in fp0 */#else /* (CPU == MC68060) */	jsr	FPLSP_060__FSIND_	/* returns in fp0 */#endif /* (CPU == MC68060) */	addql	#8,sp#else	fsind   a6@(DARG1),fp0#endif	fmoved  fp0,a6@(DARG1)	movel   a6@(DARG1),d0	movel   a6@(DARG1L),d1	fmovex  sp@+,fp0	unlk    a6	rts/********************************************************************************* mathHardSinh - ANSI-compatable hardware floating-point hyperbolic sine** RETURNS: The floating-point hyperbolic sine of dblParam.** SEE ALSO:* floatLib (1), "The C Programming Language - Second Edition"* double mathHardSinh (dblParam)*     double dblParam;	/* angle in radians ***/_mathHardSinh:	link    a6,#0	fmovex  fp0,sp@-#if (CPU==MC68040 || CPU==MC68060)	movel	a6@(DARG1L),sp@-	movel	a6@(DARG1),sp@-#if (CPU == MC68040)	jsr	__l_fsinhd		/* returns in fp0 */#else /* (CPU == MC68060) */	jsr	FPLSP_060__FSINHD_	/* returns in fp0 */#endif /* (CPU == MC68060) */	addql	#8,sp#else	fsinhd  a6@(DARG1),fp0#endif	fmoved  fp0,a6@(DARG1)	movel   a6@(DARG1),d0	movel   a6@(DARG1L),d1	fmovex  sp@+,fp0	unlk    a6	rts/********************************************************************************* mathHardSqrt - ANSI-compatable hardware floating-point square root** RETURNS: The floating-point square root of dblParam.** SEE ALSO: floatLib(1), pow (2)* double mathHardSqrt (dblParam)*     double dblParam;	/* argument ***/_mathHardSqrt:	link    a6,#0	fmovex  fp0,sp@-#if (CPU==MC68040)	movel	a6@(DARG1L),sp@-	movel	a6@(DARG1),sp@-	jsr	__l_fsqrtd		/* returns in fp0 */	addql	#8,sp#else	fsqrtd  a6@(DARG1),fp0#endif	fmoved  fp0,a6@(DARG1)	movel   a6@(DARG1),d0	movel   a6@(DARG1L),d1	fmovex  sp@+,fp0	unlk    a6	rts/********************************************************************************* mathHardTan - ANSI-compatable hardware floating-point tangent** RETURNS: Floating-point tangent of dblParam.** SEE ALSO: floatLib (1), cos (2), sin (2),* "The C Programming Language - Second Edition"* double mathHardTan (dblParam)*     double dblParam;	/* angle in radians ***/_mathHardTan:	link    a6,#0	fmovex  fp0,sp@-#if (CPU==MC68040 || CPU==MC68060)	movel	a6@(DARG1L),sp@-	movel	a6@(DARG1),sp@-#if (CPU == MC68040)	jsr	__l_ftand		/* returns in fp0 */#else /* (CPU == MC68060) */	jsr	FPLSP_060__FTAND_	/* returns in fp0 */#endif /* (CPU == MC68060) */	addql	#8,sp#else	ftand   a6@(DARG1),fp0#endif	fmoved  fp0,a6@(DARG1)	movel   a6@(DARG1),d0	movel   a6@(DARG1L),d1	fmovex  sp@+,fp0	unlk    a6	rts/********************************************************************************* mathHardTanh - ANSI-compatable hardware floating-point hyperbolic tangent** RETURNS: Floating-point hyperbolic tangent of dblParam.** SEE ALSO:* floatLib (1), cosh (2), sinh (2)* "The C Programming Language - Second Edition"* double mathHardTanh (dblParam)*     double dblParam;	/* angle in radians ***/_mathHardTanh:	link    a6,#0	fmovex  fp0,sp@-#if (CPU==MC68040 || CPU==MC68060)	movel	a6@(DARG1L),sp@-	movel	a6@(DARG1),sp@-#if (CPU == MC68040)	jsr	__l_ftanhd		/* returns in fp0 */#else /* (CPU == MC68060) */	jsr	FPLSP_060__FTANHD_	/* returns in fp0 */#endif /* (CPU == MC68060) */	addql	#8,sp#else	ftanhd  a6@(DARG1),fp0#endif	fmoved  fp0,a6@(DARG1)	movel   a6@(DARG1),d0	movel   a6@(DARG1L),d1	fmovex  sp@+,fp0	unlk    a6	rts/********************************************************************************* mathHardSincos - simultaneous hardware floating-point sine and cosine** RETURNS:* The simultaeous floating point results of sine and cosine of the* radian argument  The dblParam must be in range of -1.0 to +1.0.** CAVEAT:* Supported for the MC68881/68882 only.** SEE ALSO: floatLib (1), "MC68881/68882 Floating-Point User's Manual"* VOID mathHardSincos (dblParam, sinResult, cosResult)*     double dblParam;		/* angle in radians **     double *sinResult;	/* sine result buffer **     double *cosResult;	/* cosine result buffer ***/_mathHardSincos:	link    a6,#0#if (CPU == MC68060)	fmovex	 fp0,sp@-	fmovex	 fp1,sp@-#else /* (CPU == MC68060) */	fmovemx  fp0/fp1,sp@-#endif /* (CPU == MC68060) */#if (CPU==MC68040 || CPU==MC68060)	movel	a6@(DARG1L),sp@-	movel	a6@(DARG1),sp@-#if (CPU == MC68040)	jsr	__l_fcosd		/* returns in fp0 */#else /* (CPU == MC68060) */	jsr	FPLSP_060__FCOSD_	/* returns in fp0 */#endif /* (CPU == MC68060) */	fmovex	fp0,fp1			/* put cosine in fp1 */	addql	#8,sp	movel	a6@(DARG1L),sp@-	movel	a6@(DARG1),sp@-#if (CPU == MC68040)	jsr	__l_fsind		/* get sine in fp0 */#else /* (CPU == MC68060) */	jsr	FPLSP_060__FSIND_	/* get sine in fp0 */#endif /* (CPU == MC68060) */	addql	#8,sp#else	fsincosd  a6@(DARG1),fp1:fp0	/* fp0 gets sine; fp1 gets cosine */#endif	movel   a6@(ARG3),a0		/* because of double, it's like ARG3 */	fmoved  fp0,a0@			/* copy sine result */	movel   a6@(ARG4),a0	fmoved  fp1,a0@			/* copy cosine result */#if (CPU == MC68060)	fmovex	sp@+,fp1	fmovex	sp@+,fp0#else /* (CPU == MC68060) */	fmovemx sp@+,fp0/fp1#endif /* (CPU == MC68060) */	unlk    a6	rts/********************************************************************************* mathHardFmod - ANSI-compatable hardware floating-point modulus** RETURNS:* Floating-point modulus of (dblParam / dblDivisor) with the sign of dblParam.** SEE ALSO:* floatLib (1), "The C Programming Language - Second Edition"* double mathHardFmod (dblParam, dblDivisor)*     double dblParam;		/* argument **     double dblDivisor;	/* divisor ***/_mathHardFmod:	link    a6,#0	fmovex  fp0,sp@-#if (CPU==MC68040 || CPU==MC68060)	movel	a6@(DARG2L),sp@-	movel	a6@(DARG2),sp@-	movel	a6@(DARG1L),sp@-	movel	a6@(DARG1),sp@-#if (CPU == MC68040)	jsr	__l_fmodd		/* returns in fp0 */#else /* (CPU == MC68060) */	jsr	FPLSP_060__FMODD_	/* returns in fp0 */#endif /* (CPU == MC68060) */	addl	#16,sp#else	fmoved  a6@(DARG1),fp0	fmodd   a6@(DARG2),fp0#endif	fmoved  fp0,a6@(DARG1)	movel   a6@(DARG1),d0	movel   a6@(DARG1L),d1	fmovex  sp@+,fp0	unlk    a6	rts/* MC68881/68882 Rounding modes */#define	tonearest	0x0#define	tozero		0x10#define	minusinf	0x20#define	plusinf		0x30/********************************************************************************* mathHardFloor - ANSI-compatable hardware floating-point floor** Performs a 'round-to-negative-infinity'.** RETURNS:* The largest integral value less than or equal to dblParam,* result is returned in double precision.** SEE ALSO:* floatLib (1), "The C Programming Language - Second Edition"* double mathHardFloor (dblParam)*     double dblParam;	/* argument ***/_mathHardFloor:	link    a6,#0	fmovex  fp0,sp@-	fmovel  fpcr,d0		/* set FPCR for round-to-minus-infinity */        movel   d0,d1        movb    #minusinf,d1        fmovel  d1,fpcr#if (CPU==MC68040)	movel	a6@(DARG1L),sp@-	movel	a6@(DARG1),sp@-	jsr	__l_fintd		/* returns in fp0 */	addql	#8,sp#else        fintd   a6@(DARG1),fp0#endif        fmoved  fp0,a6@(DARG1)        fmovex  sp@+,fp0        fmovel  d0,fpcr        movel   a6@(DARG1),d0        movel   a6@(DARG1L),d1	unlk    a6	rts/********************************************************************************* mathHardCeil - ANSI-compatable hardware floating-point ceiling** Performs a 'round-to-positive-infinity'** RETURNS:* The least integral value greater than or equal to dblParam,* result is returned in double precision.** SEE ALSO:* floatLib (1), "The C Programming Language - Second Edition"* double mathHardCeil (dblParam)*     double dblParam;	/* argument ***/_mathHardCeil:	link    a6,#0	fmovex  fp0,sp@-	fmovel  fpcr,d0		/* set FPCR for round-to-plus-infinity */        movel   d0,d1        movb    #plusinf,d1        fmovel  d1,fpcr#if (CPU==MC68040)	movel	a6@(DARG1L),sp@-	movel	a6@(DARG1),sp@-	jsr	__l_fintd		/* returns in fp0 */	addql	#8,sp#else        fintd   a6@(DARG1),fp0#endif        fmoved  fp0,a6@(DARG1)        fmovex  sp@+,fp0        fmovel  d0,fpcr        movel   a6@(DARG1),d0        movel   a6@(DARG1L),d1	unlk    a6	rts/********************************************************************************* mathHardTrunc - hardware floating-point truncation** Performs FINTRZ.** RETURNS:* The integer portion of a double-precision number,* result is in double-precision.** SEE ALSO: floatLib (1)* double mathHardTrunc (dblParam)*     double dblParam;	/* argument ***/_mathHardTrunc:	link    a6,#0	fmovex  fp0,sp@-#if (CPU==MC68040)	movel	a6@(DARG1L),sp@-	movel	a6@(DARG1),sp@-	jsr	__l_fintrzd		/* returns in fp0 */	addql	#8,sp#else	fintrzd a6@(DARG1),fp0#endif        fmoved  fp0,a6@(DARG1)        fmovex  sp@+,fp0        movel   a6@(DARG1),d0        movel   a6@(DARG1L),d1	unlk    a6	rts/********************************************************************************* mathHardRound - hardware floating-point rounding** Performs a 'round-to-nearest'.** SEE ALSO: floatLib (1)* double mathHardRound (dblParam)*     double dblParam;	/* argument ***/_mathHardRound:	link    a6,#0	fmovex  fp0,sp@-	fmovel  fpcr,d0		/* set FPCR for round-to-nearest */        movel   d0,d1        movb    #tonearest,d1        fmovel  d1,fpcr#if (CPU==MC68040)	movel	a6@(DARG1L),sp@-	movel	a6@(DARG1),sp@-	jsr	__l_fintd		/* returns in fp0 */	addql	#8,sp#else        fintd   a6@(DARG1),fp0#endif        fmoved  fp0,a6@(DARG1)        fmovex  sp@+,fp0        fmovel  d0,fpcr        movel   a6@(DARG1),d0        movel   a6@(DARG1L),d1	unlk    a6	rts/********************************************************************************* mathHardIround - hardware floating-point rounding to nearest integer** Performs a 'round-to-the-nearest' function.** NOTE:* If dblParam is spaced evenly between two integers,* then the  even integer will be returned.* int mathHardIround (dblParam)*     double dblParam;	/* argument ***/_mathHardIround:	link    a6,#0	fmovex  fp0,sp@-	fmovel  fpcr,d0		/* set FPCR for round-to-the-nearest */        movel   d0,d1        movb    #tonearest,d0        fmovel  d0,fpcr        fmoved  a6@(DARG1),fp0        fmovel  fp0,d0        fmovex  sp@+,fp0        fmovel  d1,fpcr	unlk    a6	rts/********************************************************************************* mathHardIrint - hardware floating-point double to integer conversion** Convert dblParam to an integer using the selected IEEE* rounding direction.*** SEE ALSO: floatLib (1)* int mathHardIrint (dblParam)*     double dblParam;	/* argument ***/_mathHardIrint:        link    a6,#0	fmovex  fp0,sp@-        fmoved  a6@(DARG1),fp0        fmovel  fp0,a6@(DARG1)        movel   a6@(DARG1),d0        fmovex  sp@+,fp0        unlk    a6        rts/********************************************************************************* mathHardInfinity - hardware floating-point return of a very large double** SEE ALSO: floatLib(1)** double mathHardInfinity ()**/_mathHardInfinity:        link    a6,#0	addl	#-8,sp	fmovecr	#0x3f, fp0	/* 688881/2 rom-based inf. constant */	fmoved	fp0, sp@	movl	a6@(-8), d0	movl	a6@(-4), d1	addl	#8,sp        unlk    a6        rts

⌨️ 快捷键说明

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