Subject: Re: ldexp NetBSD 3.0 amd64 bug
To: None <bcosta@avdat.com.au, tnn+nbsd@nygren.pp.se>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: port-amd64
Date: 03/21/2006 12:42:07
This is a multipart MIME message.

--==_Exmh_11479062939890
Content-Type: text/plain; charset=us-ascii

Hi -
Thanks for the report.
I've just applied the appended patch to -current.
Can you give it a try?

best regards
Matthias



--==_Exmh_11479062939890
Content-Type: text/plain ; name="scalb.txt"; charset=us-ascii
Content-Description: scalb.txt
Content-Disposition: attachment; filename="scalb.txt"

Index: s_scalbn.S
===================================================================
RCS file: /cvsroot/src/lib/libm/arch/i387/s_scalbn.S,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- s_scalbn.S	26 Jul 2003 19:25:03 -0000	1.7
+++ s_scalbn.S	21 Mar 2006 11:35:21 -0000	1.8
@@ -5,15 +5,22 @@
 
 #include <machine/asm.h>
 
-#include "abi.h"
-
-RCSID("$NetBSD: s_scalbn.S,v 1.7 2003/07/26 19:25:03 salo Exp $")
+RCSID("$NetBSD: s_scalbn.S,v 1.8 2006/03/21 11:35:21 drochner Exp $")
 
 ENTRY(scalbn)
-	XMM_TWO_ARG_DOUBLE_PROLOGUE
-	fildl	ARG_DOUBLE_TWO
-	fldl	ARG_DOUBLE_ONE
+#ifdef __x86_64__
+	movl %edi,-12(%rsp)
+	fildl -12(%rsp)
+	movsd %xmm0,-8(%rsp)
+	fldl -8(%rsp)
+	fscale
+	fstpl -8(%rsp)
+	movsd -8(%rsp),%xmm0
+	fstp %st(0)
+#else
+	fildl 12(%esp)
+	fldl 4(%esp)
 	fscale
-	fstp	%st(1)		/* bug fix for fp stack overflow */
-	XMM_DOUBLE_EPILOGUE
+	fstp %st(1)		/* clean up stack */
+#endif
 	ret
Index: s_scalbnf.S
===================================================================
RCS file: /cvsroot/src/lib/libm/arch/i387/s_scalbnf.S,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- s_scalbnf.S	26 Jul 2003 19:25:03 -0000	1.6
+++ s_scalbnf.S	21 Mar 2006 11:35:21 -0000	1.7
@@ -5,15 +5,22 @@
 
 #include <machine/asm.h>
 
-#include "abi.h"
-
-RCSID("$NetBSD: s_scalbnf.S,v 1.6 2003/07/26 19:25:03 salo Exp $")
+RCSID("$NetBSD: s_scalbnf.S,v 1.7 2006/03/21 11:35:21 drochner Exp $")
 
 ENTRY(scalbnf)
-	XMM_TWO_ARG_FLOAT_PROLOGUE
-	fildl	ARG_FLOAT_TWO
-	flds	ARG_FLOAT_ONE
+#ifdef __x86_64__
+	movl %edi,-8(%rsp)
+	fildl -8(%rsp)
+	movss %xmm0,-4(%rsp)
+	flds -4(%rsp)
+	fscale
+	fstps -4(%rsp)
+	movss -4(%rsp),%xmm0
+	fstp %st(0)
+#else
+	fildl 8(%esp)
+	flds 4(%esp)
 	fscale
-	fstp	%st(1)		/* bug fix for fp stack overflow */
-	XMM_FLOAT_EPILOGUE
+	fstp %st(1)		/* clean up stack */
+#endif
 	ret

--==_Exmh_11479062939890--