ceill for x86-64
Andreas Jaeger
aj@suse.de
Thu Nov 13 09:08:00 GMT 2003
Looking at the assembly of s_ceill, I decided to rewrite the i386
version for x86-64. This one also passes the testsuite.
I think we should add Gwenole's patch to ldbl-96 and my patches.
Ok to commit this one?
Andreas
2003-11-13 Andreas Jaeger <aj@suse.de>
* sysdeps/x86_64/fpu/s_ceill.S: New file.
============================================================
Index: sysdeps/x86_64/fpu/s_ceill.S
--- sysdeps/x86_64/fpu/s_ceill.S created
+++ sysdeps/x86_64/fpu/s_ceill.S 2003-11-12 19:30:58.000000000 +0100 1.1
@@ -0,0 +1,31 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
+ * Changes for x86-64 by Andreas Jaeger <aj@suse.de>
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+
+ENTRY(__ceill)
+ fldt 8(%rsp)
+
+ fstcw -4(%rsp) /* store fpu control word */
+
+ /* We use here %edx although only the low 1 bits are defined.
+ But none of the operations should care and they are faster
+ than the 16 bit operations. */
+ movl $0x0800,%edx /* round towards +oo */
+ orl -4(%rsp),%edx
+ andl $0xfbff,%edx
+ movl %edx,-8(%rsp)
+ fldcw -8(%rsp) /* load modified control word */
+
+ frndint /* round */
+
+ fldcw -4(%rsp) /* restore original control word */
+
+ ret
+END (__ceill)
+weak_alias (__ceill, ceill)
--
Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20031113/030602c0/attachment.sig>
More information about the Libc-alpha
mailing list