1/*	$OpenBSD: s_tan.S,v 1.2 2005/08/02 11:17:31 espie Exp $ */
2/*
3 * Written by J.T. Conklin <jtc@NetBSD.org>.
4 * Public domain.
5 */
6
7#include <machine/asm.h>
8
9#include "abi.h"
10
11ENTRY(tan)
12	XMM_ONE_ARG_DOUBLE_PROLOGUE
13	fldl	ARG_DOUBLE_ONE
14	fptan
15	fnstsw	%ax
16	andw	$0x400,%ax
17	jnz	1f
18	fstp	%st(0)
19	XMM_DOUBLE_EPILOGUE
20	ret
211:	fldpi
22	fadd	%st(0)
23	fxch	%st(1)
242:	fprem1
25	fstsw	%ax
26	andw	$0x400,%ax
27	jnz	2b
28	fstp	%st(1)
29	fptan
30	fstp	%st(0)
31	XMM_DOUBLE_EPILOGUE
32	ret
33END(tan)
34
35	.section .note.GNU-stack,"",%progbits
36