diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1998-03-03 01:22:27 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1998-03-03 01:22:27 +0000 |
commit | f9bbe9da79dbc8557c74efeb158b431cd67ace52 (patch) | |
tree | 3220d014a35f9d88a48668a1468524e988daebff /arch/i386/math-emu/reg_u_sub.S | |
parent | 3d697109c1ff85ef563aec3d5e113ef225ed2792 (diff) |
Upgrade to 2.1.73.
Diffstat (limited to 'arch/i386/math-emu/reg_u_sub.S')
-rw-r--r-- | arch/i386/math-emu/reg_u_sub.S | 74 |
1 files changed, 28 insertions, 46 deletions
diff --git a/arch/i386/math-emu/reg_u_sub.S b/arch/i386/math-emu/reg_u_sub.S index 891670260..092f956c0 100644 --- a/arch/i386/math-emu/reg_u_sub.S +++ b/arch/i386/math-emu/reg_u_sub.S @@ -4,21 +4,23 @@ | | | Core floating point subtraction routine. | | | - | Copyright (C) 1992,1993,1995 | - | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, | - | Australia. E-mail billm@jacobi.maths.monash.edu.au | + | Copyright (C) 1992,1993,1995,1997 | + | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, Australia | + | E-mail billm@suburbia.net | | | | Call from C as: | - | void reg_u_sub(FPU_REG *arg1, FPU_REG *arg2, FPU_REG *answ, | + | int FPU_u_sub(FPU_REG *arg1, FPU_REG *arg2, FPU_REG *answ, | | int control_w) | + | Return value is the tag of the answer, or-ed with FPU_Exception if | + | one was raised, or -1 on internal error. | | | +---------------------------------------------------------------------------*/ /* - | Kernel subtraction routine reg_u_sub(reg *arg1, reg *arg2, reg *answ). - | Takes two valid reg f.p. numbers (TW_Valid), which are + | Kernel subtraction routine FPU_u_sub(reg *arg1, reg *arg2, reg *answ). + | Takes two valid reg f.p. numbers (TAG_Valid), which are | treated as unsigned numbers, - | and returns their difference as a TW_Valid or TW_Zero f.p. + | and returns their difference as a TAG_Valid or TAG_Zero f.p. | number. | The first number (arg1) must be the larger. | The returned number is normalized. @@ -30,7 +32,7 @@ #include "control_w.h" .text -ENTRY(reg_u_sub) +ENTRY(FPU_u_sub) pushl %ebp movl %esp,%ebp pushl %esi @@ -39,28 +41,9 @@ ENTRY(reg_u_sub) movl PARAM1,%esi /* source 1 */ movl PARAM2,%edi /* source 2 */ - -#ifdef DENORM_OPERAND - cmpl EXP_UNDER,EXP(%esi) - jg xOp1_not_denorm - - call SYMBOL_NAME(denormal_operand) - orl %eax,%eax - jnz fpu_Arith_exit - -xOp1_not_denorm: - cmpl EXP_UNDER,EXP(%edi) - jg xOp2_not_denorm - - call SYMBOL_NAME(denormal_operand) - orl %eax,%eax - jnz fpu_Arith_exit - -xOp2_not_denorm: -#endif DENORM_OPERAND - - movl EXP(%esi),%ecx - subl EXP(%edi),%ecx /* exp1 - exp2 */ + + movl PARAM6,%ecx + subl PARAM7,%ecx /* exp1 - exp2 */ #ifdef PARANOID /* source 2 is always smaller than source 1 */ @@ -81,10 +64,8 @@ xOp2_not_denorm: movl SIGL(%edi),%ebx /* register ls word */ movl PARAM3,%edi /* destination */ - movl EXP(%esi),%edx - movl %edx,EXP(%edi) /* Copy exponent to destination */ -/* movb SIGN(%esi),%dl - movb %dl,SIGN(%edi) */ /* Copy the sign from the first arg */ + movl PARAM6,%edx + movw %dx,EXP(%edi) /* Copy exponent to destination */ xorl %edx,%edx /* register extension */ @@ -93,8 +74,8 @@ xOp2_not_denorm: | right the required number of | | places. | +--------------------------------------*/ -L_shift_r: - cmpl $32,%ecx /* shrd only works for 0..31 bits */ + + cmpw $32,%cx /* shrd only works for 0..31 bits */ jnc L_more_than_31 /* less than 32 bits */ @@ -104,7 +85,7 @@ L_shift_r: jmp L_shift_done L_more_than_31: - cmpl $64,%ecx + cmpw $64,%cx jnc L_more_than_63 subb $32,%cl @@ -210,7 +191,7 @@ L_subtr: jnz L_must_be_zero /* Shift left 64 bits */ - subl $64,EXP(%edi) + subw $64,EXP(%edi) xchg %edx,%eax jmp fpu_reg_round @@ -221,17 +202,17 @@ L_must_be_zero: #endif PARANOID /* The result is zero */ - movb TW_Zero,TAG(%edi) - movl $0,EXP(%edi) /* exponent */ + movw $0,EXP(%edi) /* exponent */ movl $0,SIGL(%edi) movl $0,SIGH(%edi) - jmp L_exit /* %eax contains zero */ + movl TAG_Zero,%eax + jmp L_exit L_shift_32: movl %ebx,%eax movl %edx,%ebx movl $0,%edx - subl $32,EXP(%edi) /* Can get underflow here */ + subw $32,EXP(%edi) /* Can get underflow here */ /* We need to shift left by 1 - 31 bits */ L_shift_1: @@ -241,7 +222,7 @@ L_shift_1: shld %cl,%ebx,%eax shld %cl,%edx,%ebx shl %cl,%edx - subl %ecx,EXP(%edi) /* Can get underflow here */ + subw %cx,EXP(%edi) /* Can get underflow here */ L_round: jmp fpu_reg_round /* Round the result */ @@ -277,11 +258,12 @@ L_bugged: call EXCEPTION pop %ebx jmp L_error_exit -#endif PARANOID - L_error_exit: - movl $1,%eax + movl $-1,%eax + +#endif PARANOID + L_exit: popl %ebx popl %edi |