Implement optimized libc_fe*() math routines on sparc.
[glibc.git] / sysdeps / x86_64 / fpu / s_sinl.S
blob79fc4af95b41c47583f3ad3aaa8e519ace286bc1
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 ENTRY(__sinl)
15         fldt    8(%rsp)
16         fxam
17         fstsw   %ax
18         movb    $0x45, %dh
19         andb    %ah, %dh
20         cmpb    $0x05, %dh
21         je      3f
22 4:      fsin
23         fnstsw  %ax
24         testl   $0x400,%eax
25         jnz     1f
26         ret
27         .align ALIGNARG(4)
28 1:      fldpi
29         fadd    %st(0)
30         fxch    %st(1)
31 2:      fprem1
32         fnstsw  %ax
33         testl   $0x400,%eax
34         jnz     2b
35         fstp    %st(1)
36         fsin
37         ret
38 3:      call    __errno_location@PLT
39         movl    $EDOM, (%rax)
40         jmp     4b
41 END (__sinl)
42 weak_alias (__sinl, sinl)