1 /* SPDX-License-Identifier: GPL-2.0 */
3 /*---------------------------------------------------------------------------+
6 | Core multiplication routine |
8 | Copyright (C) 1992,1993,1995,1997 |
9 | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, Australia |
10 | E-mail billm@suburbia.net |
13 +---------------------------------------------------------------------------*/
15 /*---------------------------------------------------------------------------+
16 | Basic multiplication routine. |
17 | Does not check the resulting exponent for overflow/underflow |
19 | FPU_u_mul(FPU_REG *a, FPU_REG *b, FPU_REG *c, unsigned int cw); |
21 | Internal working is at approx 128 bits. |
22 | Result is rounded to nearest 53 or 64 bits, using "nearest or even". |
23 +---------------------------------------------------------------------------*/
25 #include "exception.h"
27 #include "control_w.h"
31 #ifndef NON_REENTRANT_FPU
32 /* Local storage on the stack: */
33 #define FPU_accum_0 -4(%ebp) /* ms word */
34 #define FPU_accum_1 -8(%ebp)
37 /* Local storage in a static area: */
44 #endif /* NON_REENTRANT_FPU */
48 SYM_FUNC_START(FPU_u_mul)
51 #ifndef NON_REENTRANT_FPU
53 #endif /* NON_REENTRANT_FPU */
63 testl $0x80000000,SIGH(%esi)
65 testl $0x80000000,SIGH(%edi)
81 /* adcl $0,%ecx // overflow here is not possible */
94 /* Get the sum of the exponents. */
98 /* Two denormals can cause an exponent underflow */
99 cmpl EXP_WAY_UNDER,%eax
102 /* Set to a really low value allow correct handling */
103 movl EXP_WAY_UNDER,%eax
107 /* Have now finished with the sources */
108 movl PARAM3,%edi /* Point to the destination */
111 /* Now make sure that the result is normalized */
112 testl $0x80000000,%ecx
113 jnz LResult_Normalised
115 /* Normalize by shifting left one bit */
123 movl FPU_accum_0,%eax
124 movl FPU_accum_1,%edx
137 pushl EX_INTERNAL|0x205
148 #endif /* PARANOID */
150 SYM_FUNC_END(FPU_u_mul)