* sysdeps/i386/fpu/s_tan.S: Set errno for ±Inf.
[glibc.git] / sysdeps / x86_64 / fpu / s_tanl.S
blob6427e3f6f0fdfc2c261d25c29a63c4240a5d5586
1 /*
2  * Written by J.T. Conklin <jtc@netbsd.org>.
3  * Public domain.
4  *
5  * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
6  * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
7  * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
8  */
10 #define __need_Emath
11 #include <bits/errno.h>
12 #include <machine/asm.h>
14 RCSID("$NetBSD: $")
16 ENTRY(__tanl)
17         fldt    8(%rsp)
18         fxam
19         fstsw   %ax
20         movb    $0x45, %dh
21         andb    %ah, %dh
22         cmpb    $0x05, %dh
23         je      3f
24 4:      fptan
25         fnstsw  %ax
26         testl   $0x400,%eax
27         jnz     1f
28         fstp    %st(0)
29         ret
30 1:      fldpi
31         fadd    %st(0)
32         fxch    %st(1)
33 2:      fprem1
34         fstsw   %ax
35         testl   $0x400,%eax
36         jnz     2b
37         fstp    %st(1)
38         fptan
39         fstp    %st(0)
40         ret
41 3:      call    __errno_location@PLT
42         movl    $EDOM, (%rax)
43         jmp     4b
44 END (__tanl)
45 weak_alias (__tanl, tanl)