From 64ce6b0ef4bb75b07f924014d3a04aa433b83bed Mon Sep 17 00:00:00 2001
From: ceriel <none@none>
Date: Fri, 15 Nov 1991 09:47:44 +0000
Subject: [PATCH] Fixed fef.s: did not work for unnormalized numbers

---
 mach/sparc/libem/fef.s | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/mach/sparc/libem/fef.s b/mach/sparc/libem/fef.s
index 382b5379f..64647bc5e 100644
--- a/mach/sparc/libem/fef.s
+++ b/mach/sparc/libem/fef.s
@@ -13,15 +13,28 @@ fef8:
 	st	%g0,[%l0]
 	retl
 	nop
-1:	ld	[%l0+4],%o0
-	srl	%o0, 20, %o1
-	and	%o1, 0x7ff, %o1
-	dec	0x3fe, %o1
+1:	
+	fdtox	%f0,%f0
+	st	%f0,[%l0+4]
+	ld	[%l0+4],%o0
+	srl	%o0,16,%o0
+	set	0x7fff,%o2
+	and	%o0,%o2,%o1
+	set	16382,%o3
+	sub	%o1,%o3,%o1
 	st	%o1,[%l0]
-	set	0x7ff00000, %o1
-	andn	%o0, %o1, %o0
-	set	0x3fe00000, %o1
-	or	%o0, %o1, %o0
+	set	0x8000,%o2
+	and	%o0,%o2,%o0
+	or	%o0,%o3,%o0
+	sll	%o0,16,%o0
+	ld	[%l0+4],%o1
+	set	0xffff,%o2
+	and	%o1,%o2,%o1
+	or	%o1,%o0,%o0
 	st	%o0,[%l0+4]
+	ld	[%l0+4],%f0
+	fxtod	%f0,%f0
+	st	%f0,[%l0+4]
+	st	%f1,[%l0+8]
 	retl
 	nop