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

📄 mathhardalib.s

📁 Vxworks OS source code
💻 S
📖 第 1 页 / 共 2 页
字号:
	fmulp	%st, %st(1)	call	powerOftwo	jmp	powErrExitpowOne:	fld1	jmp	powErrExitpowNan:	fldz	jmp	powErrExitpowNegX:				/* x < 0 */	fldl	DARG2(%ebp)	frndint	fcompl	DARG2(%ebp)	fstsw	%ax	sahf	jne	powNan			/* if (y != int(y)), (x**y = 0) */	fldl	DARG2(%ebp)		/* x**y = 2**(y * log2(|x|)) */	fldl	DARG1(%ebp)	fabs	fyl2x	call	powerOftwo	fld1				/* if ((y % 2) != 0)              */	fld1				/*   x**y = -(%st)                */	faddp				/* else                           */	fldl	DARG2(%ebp)             /*   x**y = %st	                  */	fprem	fldz	fcompp	fstsw	%ax	sahf	je	powExit0	fcomp	%st			/* pop, fincstp + ffree might work */	fchs				/* x**y = -(%st) */	jmp	powExitpowExit0:	fcomp	%st			/* pop, fincstp + ffree might work */	jmp	powExitpowErrExit:powExit:	leave	ret/********************************************************************************* 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 ***/	.balign 16,0x90FUNC_LABEL(mathHardSin)	pushl	%ebp	movl	%esp,%ebp	fldl	DARG1(%ebp)	fsin	leave	ret/********************************************************************************* 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 ***/	.balign 16,0x90FUNC_LABEL(mathHardSqrt)	pushl	%ebp	movl	%esp,%ebp	fldl	DARG1(%ebp)	fsqrt	leave	ret/********************************************************************************* 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 ***/	.balign 16,0x90FUNC_LABEL(mathHardTan)	pushl	%ebp	movl	%esp,%ebp	fldl	DARG1(%ebp)	fptan	fstp	%st	leave	ret/********************************************************************************* 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 HD648132 only.** SEE ALSO: floatLib (1), "HD648132 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 ***/	.balign 16,0x90FUNC_LABEL(mathHardSincos)	pushl	%ebp	movl	%esp,%ebp	fldl	DARG1(%ebp)	fsincos	movl	DARG2L(%ebp),%eax	fstpl	(%eax)	movl	DARG2(%ebp),%edx	fstpl	(%edx)	leave	ret/********************************************************************************* mathHardFmod - ANSI-compatable hardware floating-point modulus (fprem)** 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 ***/	.balign 16,0x90FUNC_LABEL(mathHardFmod)	pushl	%ebp	movl	%esp,%ebp	fldl	DARG2(%ebp)	fldl	DARG1(%ebp)reducePartial:	fprem			/* fprem for non IEEE */	fstsw	%ax		/* put the FPU status word in AX */	test	$0x0400,%ax	/* is there a partial remainder at ST(0) ? */	jnz	reducePartial	fstp	%st(1)	leave	ret/********************************************************************************* mathHardFmodIeee - ANSI-compatable hardware floating-point modulus (fprem1)** RETURNS: * Floating-point modulus of (dblParam / dblDivisor) with the sign of dblParam.  ** SEE ALSO: * floatLib (1), "The C Programming Language - Second Edition"** double mathHardFmodIeee (dblParam, dblDivisor)*     double dblParam;		/* argument **     double dblDivisor;	/* divisor ***/	.balign 16,0x90FUNC_LABEL(mathHardFmodIeee)	pushl	%ebp	movl	%esp,%ebp	fldl	DARG2(%ebp)	fldl	DARG1(%ebp)reducePartialIeee:	fprem1			/* fprem1 for IEEE */	fstsw	%ax		/* put the FPU status word in AX */	test	$0x0400,%ax	/* is there a partial remainder at ST(0) ? */	jnz	reducePartialIeee	fstp	%st(1)	leave	ret/********************************************************************************* 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 ***/	.balign 16,0x90FUNC_LABEL(mathHardFloor)	pushl	%ebp	movl	%esp,%ebp	subl	$8,%esp	fstcw	-4(%ebp)	fwait	movw	-4(%ebp),%ax	andw	$ FPCR_RC_MASK,%ax	orw	$ FPCR_RC_DOWN,%ax	movw	%ax,-8(%ebp)	fldcw	-8(%ebp)	fldl	DARG1(%ebp)	frndint	fldcw	-4(%ebp)	addl	$8,%esp	leave	ret/********************************************************************************* 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 ***/	.balign 16,0x90FUNC_LABEL(mathHardCeil)	pushl	%ebp	movl	%esp,%ebp	subl	$8,%esp	fstcw	-4(%ebp)	fwait	movw	-4(%ebp),%ax	andw	$ FPCR_RC_MASK,%ax	orw	$ FPCR_RC_UP,%ax	movw	%ax,-8(%ebp)	fldcw	-8(%ebp)	fldl	DARG1(%ebp)	frndint	fldcw	-4(%ebp)	addl	$8,%esp	leave	ret/********************************************************************************* 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 ***/	.balign 16,0x90FUNC_LABEL(mathHardTrunc)	pushl	%ebp	movl	%esp,%ebp	subl	$8,%esp	fstcw	-4(%ebp)	fwait	movw	-4(%ebp),%ax	andw	$ FPCR_RC_MASK,%ax	orw	$ FPCR_RC_ZERO,%ax	movw	%ax,-8(%ebp)	fldcw	-8(%ebp)	fldl	DARG1(%ebp)	frndint	fldcw	-4(%ebp)	addl	$8,%esp	leave	ret/********************************************************************************* mathHardRound - hardware floating-point rounding** Performs a 'round-to-nearest'.** SEE ALSO: floatLib (1)** double mathHardRound (dblParam)*     double dblParam;	/* argument ***/	.balign 16,0x90FUNC_LABEL(mathHardRound)	pushl	%ebp	movl	%esp,%ebp	subl	$8,%esp	fstcw	-4(%ebp)	fwait	movw	-4(%ebp),%ax	andw	$ FPCR_RC_MASK,%ax	orw	$ FPCR_RC_NEAREST,%ax	movw	%ax,-8(%ebp)	fldcw	-8(%ebp)	fldl	DARG1(%ebp)	frndint	fldcw	-4(%ebp)	addl	$8,%esp	leave	ret/********************************************************************************* mathHardIround - hardware floating-point rounding to nearest integer** Performs a 'round-to-nearest' function.** NOTE:* If dblParam is spaced evenly between two integers,* then the  even integer will be returned.** int mathHardIround (dblParam)*     double dblParam;	/* argument ***/	.balign 16,0x90FUNC_LABEL(mathHardIround)	pushl	%ebp	movl	%esp,%ebp	subl	$8,%esp	fstcw	-4(%ebp)	fwait	movw	-4(%ebp),%ax	andw	$0xf3ff,%ax	orw	$0x0,%ax	movw	%ax,-8(%ebp)	fldcw	-8(%ebp)	fldl	DARG1(%ebp)	frndint	fistpl	DARG1(%ebp)	fwait	movl	DARG1(%ebp),%eax	fldcw	-4(%ebp)	addl	$8,%esp	leave	ret/********************************************************************************* mathHardIrint - hardware floating-point double to integer conversion** Convert dblParam to an integer using the selected IEEE* rounding direction.** CAVEAT:* The rounding direction is not pre-selectable* and is fixed for 'round-to-the-nearest'.** SEE ALSO: floatLib (1)* * int mathHardIrint (dblParam)*     double dblParam;	/* argument ***/ 	.balign 16,0x90FUNC_LABEL(mathHardIrint)	pushl	%ebp	movl	%esp,%ebp	fldl	DARG1(%ebp)	frndint	fistpl	DARG1(%ebp)	fwait	movl	DARG1(%ebp),%eax	leave	ret/********************************************************************************* mathHardInfinity - hardware floating-point return of a very large double** SEE ALSO: floatLib(1)* * double mathHardInfinity ()**/ 	.balign 16mathHardInfinity0:	.double 0d4.09600000000000000000e+03	.balign 16FUNC_LABEL(mathHardInfinity)		/* 10**4096 = 2**(4096 * log2(10)) */	pushl	%ebp	movl	%esp,%ebp	fldl	mathHardInfinity0	fldl2t	fmulp	%st,%st(1)	call	powerOftwo	leave	ret

⌨️ 快捷键说明

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