Merge branch 'vendor/OPENSSL'
[dragonfly.git] / lib / libm / arch / i386 / s_tan.S
1 /*
2  * Written by J.T. Conklin <jtc@NetBSD.org>.
3  * Public domain.
4  *
5  * $NetBSD: s_tan.S,v 1.7 2003/07/26 19:25:04 salo Exp $
6  * $DragonFly: src/lib/libm/arch/i386/s_tan.S,v 1.1 2005/07/26 21:15:19 joerg Exp $
7  */
8
9 #include <machine/asm.h>
10
11 #include "abi.h"
12
13 ENTRY(tan)
14         XMM_ONE_ARG_DOUBLE_PROLOGUE
15         fldl    ARG_DOUBLE_ONE
16         fptan
17         fnstsw  %ax
18         andw    $0x400,%ax
19         jnz     1f
20         fstp    %st(0)
21         XMM_DOUBLE_EPILOGUE
22         ret
23 1:      fldpi
24         fadd    %st(0)
25         fxch    %st(1)
26 2:      fprem1
27         fstsw   %ax
28         andw    $0x400,%ax
29         jnz     2b
30         fstp    %st(1)
31         fptan
32         fstp    %st(0)
33         XMM_DOUBLE_EPILOGUE
34         ret