18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci	.file	"div_Xsig.S"
38c2ecf20Sopenharmony_ci/*---------------------------------------------------------------------------+
48c2ecf20Sopenharmony_ci |  div_Xsig.S                                                               |
58c2ecf20Sopenharmony_ci |                                                                           |
68c2ecf20Sopenharmony_ci | Division subroutine for 96 bit quantities                                 |
78c2ecf20Sopenharmony_ci |                                                                           |
88c2ecf20Sopenharmony_ci | Copyright (C) 1994,1995                                                   |
98c2ecf20Sopenharmony_ci |                       W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
108c2ecf20Sopenharmony_ci |                       Australia.  E-mail billm@jacobi.maths.monash.edu.au |
118c2ecf20Sopenharmony_ci |                                                                           |
128c2ecf20Sopenharmony_ci |                                                                           |
138c2ecf20Sopenharmony_ci +---------------------------------------------------------------------------*/
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/*---------------------------------------------------------------------------+
168c2ecf20Sopenharmony_ci | Divide the 96 bit quantity pointed to by a, by that pointed to by b, and  |
178c2ecf20Sopenharmony_ci | put the 96 bit result at the location d.                                  |
188c2ecf20Sopenharmony_ci |                                                                           |
198c2ecf20Sopenharmony_ci | The result may not be accurate to 96 bits. It is intended for use where   |
208c2ecf20Sopenharmony_ci | a result better than 64 bits is required. The result should usually be    |
218c2ecf20Sopenharmony_ci | good to at least 94 bits.                                                 |
228c2ecf20Sopenharmony_ci | The returned result is actually divided by one half. This is done to      |
238c2ecf20Sopenharmony_ci | prevent overflow.                                                         |
248c2ecf20Sopenharmony_ci |                                                                           |
258c2ecf20Sopenharmony_ci |  .aaaaaaaaaaaaaa / .bbbbbbbbbbbbb  ->  .dddddddddddd                      |
268c2ecf20Sopenharmony_ci |                                                                           |
278c2ecf20Sopenharmony_ci |  void div_Xsig(Xsig *a, Xsig *b, Xsig *dest)                              |
288c2ecf20Sopenharmony_ci |                                                                           |
298c2ecf20Sopenharmony_ci +---------------------------------------------------------------------------*/
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#include "exception.h"
328c2ecf20Sopenharmony_ci#include "fpu_emu.h"
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define	XsigLL(x)	(x)
368c2ecf20Sopenharmony_ci#define	XsigL(x)	4(x)
378c2ecf20Sopenharmony_ci#define	XsigH(x)	8(x)
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#ifndef NON_REENTRANT_FPU
418c2ecf20Sopenharmony_ci/*
428c2ecf20Sopenharmony_ci	Local storage on the stack:
438c2ecf20Sopenharmony_ci	Accumulator:	FPU_accum_3:FPU_accum_2:FPU_accum_1:FPU_accum_0
448c2ecf20Sopenharmony_ci */
458c2ecf20Sopenharmony_ci#define FPU_accum_3	-4(%ebp)
468c2ecf20Sopenharmony_ci#define FPU_accum_2	-8(%ebp)
478c2ecf20Sopenharmony_ci#define FPU_accum_1	-12(%ebp)
488c2ecf20Sopenharmony_ci#define FPU_accum_0	-16(%ebp)
498c2ecf20Sopenharmony_ci#define FPU_result_3	-20(%ebp)
508c2ecf20Sopenharmony_ci#define FPU_result_2	-24(%ebp)
518c2ecf20Sopenharmony_ci#define FPU_result_1	-28(%ebp)
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#else
548c2ecf20Sopenharmony_ci.data
558c2ecf20Sopenharmony_ci/*
568c2ecf20Sopenharmony_ci	Local storage in a static area:
578c2ecf20Sopenharmony_ci	Accumulator:	FPU_accum_3:FPU_accum_2:FPU_accum_1:FPU_accum_0
588c2ecf20Sopenharmony_ci */
598c2ecf20Sopenharmony_ci	.align 4,0
608c2ecf20Sopenharmony_ciFPU_accum_3:
618c2ecf20Sopenharmony_ci	.long	0
628c2ecf20Sopenharmony_ciFPU_accum_2:
638c2ecf20Sopenharmony_ci	.long	0
648c2ecf20Sopenharmony_ciFPU_accum_1:
658c2ecf20Sopenharmony_ci	.long	0
668c2ecf20Sopenharmony_ciFPU_accum_0:
678c2ecf20Sopenharmony_ci	.long	0
688c2ecf20Sopenharmony_ciFPU_result_3:
698c2ecf20Sopenharmony_ci	.long	0
708c2ecf20Sopenharmony_ciFPU_result_2:
718c2ecf20Sopenharmony_ci	.long	0
728c2ecf20Sopenharmony_ciFPU_result_1:
738c2ecf20Sopenharmony_ci	.long	0
748c2ecf20Sopenharmony_ci#endif /* NON_REENTRANT_FPU */
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci.text
788c2ecf20Sopenharmony_ciSYM_FUNC_START(div_Xsig)
798c2ecf20Sopenharmony_ci	pushl	%ebp
808c2ecf20Sopenharmony_ci	movl	%esp,%ebp
818c2ecf20Sopenharmony_ci#ifndef NON_REENTRANT_FPU
828c2ecf20Sopenharmony_ci	subl	$28,%esp
838c2ecf20Sopenharmony_ci#endif /* NON_REENTRANT_FPU */
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci	pushl	%esi
868c2ecf20Sopenharmony_ci	pushl	%edi
878c2ecf20Sopenharmony_ci	pushl	%ebx
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci	movl	PARAM1,%esi	/* pointer to num */
908c2ecf20Sopenharmony_ci	movl	PARAM2,%ebx	/* pointer to denom */
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#ifdef PARANOID
938c2ecf20Sopenharmony_ci	testl	$0x80000000, XsigH(%ebx)	/* Divisor */
948c2ecf20Sopenharmony_ci	je	L_bugged
958c2ecf20Sopenharmony_ci#endif /* PARANOID */
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/*---------------------------------------------------------------------------+
998c2ecf20Sopenharmony_ci |  Divide:   Return  arg1/arg2 to arg3.                                     |
1008c2ecf20Sopenharmony_ci |                                                                           |
1018c2ecf20Sopenharmony_ci |  The maximum returned value is (ignoring exponents)                       |
1028c2ecf20Sopenharmony_ci |               .ffffffff ffffffff                                          |
1038c2ecf20Sopenharmony_ci |               ------------------  =  1.ffffffff fffffffe                  |
1048c2ecf20Sopenharmony_ci |               .80000000 00000000                                          |
1058c2ecf20Sopenharmony_ci | and the minimum is                                                        |
1068c2ecf20Sopenharmony_ci |               .80000000 00000000                                          |
1078c2ecf20Sopenharmony_ci |               ------------------  =  .80000000 00000001   (rounded)       |
1088c2ecf20Sopenharmony_ci |               .ffffffff ffffffff                                          |
1098c2ecf20Sopenharmony_ci |                                                                           |
1108c2ecf20Sopenharmony_ci +---------------------------------------------------------------------------*/
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci	/* Save extended dividend in local register */
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci	/* Divide by 2 to prevent overflow */
1158c2ecf20Sopenharmony_ci	clc
1168c2ecf20Sopenharmony_ci	movl	XsigH(%esi),%eax
1178c2ecf20Sopenharmony_ci	rcrl	%eax
1188c2ecf20Sopenharmony_ci	movl	%eax,FPU_accum_3
1198c2ecf20Sopenharmony_ci	movl	XsigL(%esi),%eax
1208c2ecf20Sopenharmony_ci	rcrl	%eax
1218c2ecf20Sopenharmony_ci	movl	%eax,FPU_accum_2
1228c2ecf20Sopenharmony_ci	movl	XsigLL(%esi),%eax
1238c2ecf20Sopenharmony_ci	rcrl	%eax
1248c2ecf20Sopenharmony_ci	movl	%eax,FPU_accum_1
1258c2ecf20Sopenharmony_ci	movl	$0,%eax
1268c2ecf20Sopenharmony_ci	rcrl	%eax
1278c2ecf20Sopenharmony_ci	movl	%eax,FPU_accum_0
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci	movl	FPU_accum_2,%eax	/* Get the current num */
1308c2ecf20Sopenharmony_ci	movl	FPU_accum_3,%edx
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/
1338c2ecf20Sopenharmony_ci/* Initialization done.
1348c2ecf20Sopenharmony_ci   Do the first 32 bits. */
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci	/* We will divide by a number which is too large */
1378c2ecf20Sopenharmony_ci	movl	XsigH(%ebx),%ecx
1388c2ecf20Sopenharmony_ci	addl	$1,%ecx
1398c2ecf20Sopenharmony_ci	jnc	LFirst_div_not_1
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci	/* here we need to divide by 100000000h,
1428c2ecf20Sopenharmony_ci	   i.e., no division at all.. */
1438c2ecf20Sopenharmony_ci	mov	%edx,%eax
1448c2ecf20Sopenharmony_ci	jmp	LFirst_div_done
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ciLFirst_div_not_1:
1478c2ecf20Sopenharmony_ci	divl	%ecx		/* Divide the numerator by the augmented
1488c2ecf20Sopenharmony_ci				   denom ms dw */
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ciLFirst_div_done:
1518c2ecf20Sopenharmony_ci	movl	%eax,FPU_result_3	/* Put the result in the answer */
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci	mull	XsigH(%ebx)	/* mul by the ms dw of the denom */
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci	subl	%eax,FPU_accum_2	/* Subtract from the num local reg */
1568c2ecf20Sopenharmony_ci	sbbl	%edx,FPU_accum_3
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci	movl	FPU_result_3,%eax	/* Get the result back */
1598c2ecf20Sopenharmony_ci	mull	XsigL(%ebx)	/* now mul the ls dw of the denom */
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci	subl	%eax,FPU_accum_1	/* Subtract from the num local reg */
1628c2ecf20Sopenharmony_ci	sbbl	%edx,FPU_accum_2
1638c2ecf20Sopenharmony_ci	sbbl	$0,FPU_accum_3
1648c2ecf20Sopenharmony_ci	je	LDo_2nd_32_bits		/* Must check for non-zero result here */
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci#ifdef PARANOID
1678c2ecf20Sopenharmony_ci	jb	L_bugged_1
1688c2ecf20Sopenharmony_ci#endif /* PARANOID */
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci	/* need to subtract another once of the denom */
1718c2ecf20Sopenharmony_ci	incl	FPU_result_3	/* Correct the answer */
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci	movl	XsigL(%ebx),%eax
1748c2ecf20Sopenharmony_ci	movl	XsigH(%ebx),%edx
1758c2ecf20Sopenharmony_ci	subl	%eax,FPU_accum_1	/* Subtract from the num local reg */
1768c2ecf20Sopenharmony_ci	sbbl	%edx,FPU_accum_2
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci#ifdef PARANOID
1798c2ecf20Sopenharmony_ci	sbbl	$0,FPU_accum_3
1808c2ecf20Sopenharmony_ci	jne	L_bugged_1	/* Must check for non-zero result here */
1818c2ecf20Sopenharmony_ci#endif /* PARANOID */
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/
1848c2ecf20Sopenharmony_ci/* Half of the main problem is done, there is just a reduced numerator
1858c2ecf20Sopenharmony_ci   to handle now.
1868c2ecf20Sopenharmony_ci   Work with the second 32 bits, FPU_accum_0 not used from now on */
1878c2ecf20Sopenharmony_ciLDo_2nd_32_bits:
1888c2ecf20Sopenharmony_ci	movl	FPU_accum_2,%edx	/* get the reduced num */
1898c2ecf20Sopenharmony_ci	movl	FPU_accum_1,%eax
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci	/* need to check for possible subsequent overflow */
1928c2ecf20Sopenharmony_ci	cmpl	XsigH(%ebx),%edx
1938c2ecf20Sopenharmony_ci	jb	LDo_2nd_div
1948c2ecf20Sopenharmony_ci	ja	LPrevent_2nd_overflow
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci	cmpl	XsigL(%ebx),%eax
1978c2ecf20Sopenharmony_ci	jb	LDo_2nd_div
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ciLPrevent_2nd_overflow:
2008c2ecf20Sopenharmony_ci/* The numerator is greater or equal, would cause overflow */
2018c2ecf20Sopenharmony_ci	/* prevent overflow */
2028c2ecf20Sopenharmony_ci	subl	XsigL(%ebx),%eax
2038c2ecf20Sopenharmony_ci	sbbl	XsigH(%ebx),%edx
2048c2ecf20Sopenharmony_ci	movl	%edx,FPU_accum_2
2058c2ecf20Sopenharmony_ci	movl	%eax,FPU_accum_1
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci	incl	FPU_result_3	/* Reflect the subtraction in the answer */
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci#ifdef PARANOID
2108c2ecf20Sopenharmony_ci	je	L_bugged_2	/* Can't bump the result to 1.0 */
2118c2ecf20Sopenharmony_ci#endif /* PARANOID */
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ciLDo_2nd_div:
2148c2ecf20Sopenharmony_ci	cmpl	$0,%ecx		/* augmented denom msw */
2158c2ecf20Sopenharmony_ci	jnz	LSecond_div_not_1
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ci	/* %ecx == 0, we are dividing by 1.0 */
2188c2ecf20Sopenharmony_ci	mov	%edx,%eax
2198c2ecf20Sopenharmony_ci	jmp	LSecond_div_done
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ciLSecond_div_not_1:
2228c2ecf20Sopenharmony_ci	divl	%ecx		/* Divide the numerator by the denom ms dw */
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ciLSecond_div_done:
2258c2ecf20Sopenharmony_ci	movl	%eax,FPU_result_2	/* Put the result in the answer */
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci	mull	XsigH(%ebx)	/* mul by the ms dw of the denom */
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci	subl	%eax,FPU_accum_1	/* Subtract from the num local reg */
2308c2ecf20Sopenharmony_ci	sbbl	%edx,FPU_accum_2
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci#ifdef PARANOID
2338c2ecf20Sopenharmony_ci	jc	L_bugged_2
2348c2ecf20Sopenharmony_ci#endif /* PARANOID */
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci	movl	FPU_result_2,%eax	/* Get the result back */
2378c2ecf20Sopenharmony_ci	mull	XsigL(%ebx)	/* now mul the ls dw of the denom */
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci	subl	%eax,FPU_accum_0	/* Subtract from the num local reg */
2408c2ecf20Sopenharmony_ci	sbbl	%edx,FPU_accum_1	/* Subtract from the num local reg */
2418c2ecf20Sopenharmony_ci	sbbl	$0,FPU_accum_2
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ci#ifdef PARANOID
2448c2ecf20Sopenharmony_ci	jc	L_bugged_2
2458c2ecf20Sopenharmony_ci#endif /* PARANOID */
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci	jz	LDo_3rd_32_bits
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci#ifdef PARANOID
2508c2ecf20Sopenharmony_ci	cmpl	$1,FPU_accum_2
2518c2ecf20Sopenharmony_ci	jne	L_bugged_2
2528c2ecf20Sopenharmony_ci#endif /* PARANOID */
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci	/* need to subtract another once of the denom */
2558c2ecf20Sopenharmony_ci	movl	XsigL(%ebx),%eax
2568c2ecf20Sopenharmony_ci	movl	XsigH(%ebx),%edx
2578c2ecf20Sopenharmony_ci	subl	%eax,FPU_accum_0	/* Subtract from the num local reg */
2588c2ecf20Sopenharmony_ci	sbbl	%edx,FPU_accum_1
2598c2ecf20Sopenharmony_ci	sbbl	$0,FPU_accum_2
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_ci#ifdef PARANOID
2628c2ecf20Sopenharmony_ci	jc	L_bugged_2
2638c2ecf20Sopenharmony_ci	jne	L_bugged_2
2648c2ecf20Sopenharmony_ci#endif /* PARANOID */
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci	addl	$1,FPU_result_2	/* Correct the answer */
2678c2ecf20Sopenharmony_ci	adcl	$0,FPU_result_3
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci#ifdef PARANOID
2708c2ecf20Sopenharmony_ci	jc	L_bugged_2	/* Must check for non-zero result here */
2718c2ecf20Sopenharmony_ci#endif /* PARANOID */
2728c2ecf20Sopenharmony_ci
2738c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/
2748c2ecf20Sopenharmony_ci/* The division is essentially finished here, we just need to perform
2758c2ecf20Sopenharmony_ci   tidying operations.
2768c2ecf20Sopenharmony_ci   Deal with the 3rd 32 bits */
2778c2ecf20Sopenharmony_ciLDo_3rd_32_bits:
2788c2ecf20Sopenharmony_ci	/* We use an approximation for the third 32 bits.
2798c2ecf20Sopenharmony_ci	To take account of the 3rd 32 bits of the divisor
2808c2ecf20Sopenharmony_ci	(call them del), we subtract  del * (a/b) */
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci	movl	FPU_result_3,%eax	/* a/b */
2838c2ecf20Sopenharmony_ci	mull	XsigLL(%ebx)		/* del */
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_ci	subl	%edx,FPU_accum_1
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci	/* A borrow indicates that the result is negative */
2888c2ecf20Sopenharmony_ci	jnb	LTest_over
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ci	movl	XsigH(%ebx),%edx
2918c2ecf20Sopenharmony_ci	addl	%edx,FPU_accum_1
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci	subl	$1,FPU_result_2		/* Adjust the answer */
2948c2ecf20Sopenharmony_ci	sbbl	$0,FPU_result_3
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_ci	/* The above addition might not have been enough, check again. */
2978c2ecf20Sopenharmony_ci	movl	FPU_accum_1,%edx	/* get the reduced num */
2988c2ecf20Sopenharmony_ci	cmpl	XsigH(%ebx),%edx	/* denom */
2998c2ecf20Sopenharmony_ci	jb	LDo_3rd_div
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci	movl	XsigH(%ebx),%edx
3028c2ecf20Sopenharmony_ci	addl	%edx,FPU_accum_1
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci	subl	$1,FPU_result_2		/* Adjust the answer */
3058c2ecf20Sopenharmony_ci	sbbl	$0,FPU_result_3
3068c2ecf20Sopenharmony_ci	jmp	LDo_3rd_div
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ciLTest_over:
3098c2ecf20Sopenharmony_ci	movl	FPU_accum_1,%edx	/* get the reduced num */
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci	/* need to check for possible subsequent overflow */
3128c2ecf20Sopenharmony_ci	cmpl	XsigH(%ebx),%edx	/* denom */
3138c2ecf20Sopenharmony_ci	jb	LDo_3rd_div
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci	/* prevent overflow */
3168c2ecf20Sopenharmony_ci	subl	XsigH(%ebx),%edx
3178c2ecf20Sopenharmony_ci	movl	%edx,FPU_accum_1
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci	addl	$1,FPU_result_2	/* Reflect the subtraction in the answer */
3208c2ecf20Sopenharmony_ci	adcl	$0,FPU_result_3
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_ciLDo_3rd_div:
3238c2ecf20Sopenharmony_ci	movl	FPU_accum_0,%eax
3248c2ecf20Sopenharmony_ci	movl	FPU_accum_1,%edx
3258c2ecf20Sopenharmony_ci	divl	XsigH(%ebx)
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci	movl    %eax,FPU_result_1       /* Rough estimate of third word */
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci	movl	PARAM3,%esi		/* pointer to answer */
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci	movl	FPU_result_1,%eax
3328c2ecf20Sopenharmony_ci	movl	%eax,XsigLL(%esi)
3338c2ecf20Sopenharmony_ci	movl	FPU_result_2,%eax
3348c2ecf20Sopenharmony_ci	movl	%eax,XsigL(%esi)
3358c2ecf20Sopenharmony_ci	movl	FPU_result_3,%eax
3368c2ecf20Sopenharmony_ci	movl	%eax,XsigH(%esi)
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_ciL_exit:
3398c2ecf20Sopenharmony_ci	popl	%ebx
3408c2ecf20Sopenharmony_ci	popl	%edi
3418c2ecf20Sopenharmony_ci	popl	%esi
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci	leave
3448c2ecf20Sopenharmony_ci	RET
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ci#ifdef PARANOID
3488c2ecf20Sopenharmony_ci/* The logic is wrong if we got here */
3498c2ecf20Sopenharmony_ciL_bugged:
3508c2ecf20Sopenharmony_ci	pushl	EX_INTERNAL|0x240
3518c2ecf20Sopenharmony_ci	call	EXCEPTION
3528c2ecf20Sopenharmony_ci	pop	%ebx
3538c2ecf20Sopenharmony_ci	jmp	L_exit
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_ciL_bugged_1:
3568c2ecf20Sopenharmony_ci	pushl	EX_INTERNAL|0x241
3578c2ecf20Sopenharmony_ci	call	EXCEPTION
3588c2ecf20Sopenharmony_ci	pop	%ebx
3598c2ecf20Sopenharmony_ci	jmp	L_exit
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_ciL_bugged_2:
3628c2ecf20Sopenharmony_ci	pushl	EX_INTERNAL|0x242
3638c2ecf20Sopenharmony_ci	call	EXCEPTION
3648c2ecf20Sopenharmony_ci	pop	%ebx
3658c2ecf20Sopenharmony_ci	jmp	L_exit
3668c2ecf20Sopenharmony_ci#endif /* PARANOID */
3678c2ecf20Sopenharmony_ciSYM_FUNC_END(div_Xsig)
368