summaryrefslogtreecommitdiff
path: root/lib/libm/arch/amd64/s_cos.S
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-02-08 18:03:51 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-02-08 18:03:51 +0000
commitf9d4dbafe850675850558e2c8597b232b8be0e88 (patch)
treec7db9cbea87fe13a78bd1aa5a591a820d663b9dc /lib/libm/arch/amd64/s_cos.S
parentd1b83f8bb6e1bc54b2b16eace08563acb5e968a0 (diff)
add libm parts for amd64; much from netbsd, integration by mickey.
Instead of mixing the i387 & xmm register components, we decide to explicitly seperate them. libm is already confusing enough as it is, thank you very much
Diffstat (limited to 'lib/libm/arch/amd64/s_cos.S')
-rw-r--r--lib/libm/arch/amd64/s_cos.S31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/libm/arch/amd64/s_cos.S b/lib/libm/arch/amd64/s_cos.S
new file mode 100644
index 00000000000..b70c5cb3069
--- /dev/null
+++ b/lib/libm/arch/amd64/s_cos.S
@@ -0,0 +1,31 @@
+/*
+ * Written by J.T. Conklin <jtc@NetBSD.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+#include "abi.h"
+
+RCSID("$NetBSD: s_cos.S,v 1.8 2003/07/26 19:25:01 salo Exp $")
+
+ENTRY(cos)
+ XMM_ONE_ARG_DOUBLE_PROLOGUE
+ fldl ARG_DOUBLE_ONE
+ fcos
+ fnstsw %ax
+ andw $0x400,%ax
+ jnz 1f
+ XMM_DOUBLE_EPILOGUE
+ ret
+1: fldpi
+ fadd %st(0)
+ fxch %st(1)
+2: fprem1
+ fnstsw %ax
+ andw $0x400,%ax
+ jnz 2b
+ fstp %st(1)
+ fcos
+ XMM_DOUBLE_EPILOGUE
+ ret