2 /*---------------------------------------------------------------------------+
5 | Core multiplication routine |
7 | Copyright (C) 1992,1993,1995,1997 |
8 | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, Australia |
9 | E-mail billm@suburbia.net |
12 +---------------------------------------------------------------------------*/
14 /*---------------------------------------------------------------------------+
15 | Basic multiplication routine. |
16 | Does not check the resulting exponent for overflow/underflow |
18 | FPU_u_mul(FPU_REG *a, FPU_REG *b, FPU_REG *c, unsigned int cw); |
20 | Internal working is at approx 128 bits. |
21 | Result is rounded to nearest 53 or 64 bits, using "nearest or even". |
22 +---------------------------------------------------------------------------*/
24 #include "exception.h"
26 #include "control_w.h"
30 #ifndef NON_REENTRANT_FPU
31 /* Local storage on the stack: */
32 #define FPU_accum_0 -4(%ebp) /* ms word */
33 #define FPU_accum_1 -8(%ebp)
36 /* Local storage in a static area: */
43 #endif /* NON_REENTRANT_FPU */
50 #ifndef NON_REENTRANT_FPU
52 #endif /* NON_REENTRANT_FPU */
62 testl $0x80000000,SIGH(%esi)
64 testl $0x80000000,SIGH(%edi)
80 /* adcl $0,%ecx // overflow here is not possible */
93 /* Get the sum of the exponents. */
97 /* Two denormals can cause an exponent underflow */
98 cmpl EXP_WAY_UNDER,%eax
101 /* Set to a really low value allow correct handling */
102 movl EXP_WAY_UNDER,%eax
106 /* Have now finished with the sources */
107 movl PARAM3,%edi /* Point to the destination */
110 /* Now make sure that the result is normalized */
111 testl $0x80000000,%ecx
112 jnz LResult_Normalised
114 /* Normalize by shifting left one bit */
122 movl FPU_accum_0,%eax
123 movl FPU_accum_1,%edx
136 pushl EX_INTERNAL|0x205
147 #endif /* PARANOID */