Set errno for ±Inf.
[glibc/history.git] / sysdeps / i386 / fpu / s_sin.S
blob6b913992dc76ee49094e5502703cf08759c57d18
1 /*
2  * Written by J.T. Conklin <jtc@netbsd.org>.
3  * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
4  * Public domain.
5  */
7 #define __need_Emath
8 #include <bits/errno.h>
9 #include <machine/asm.h>
11 RCSID("$NetBSD: s_sin.S,v 1.5 1995/05/09 00:25:54 jtc Exp $")
13 ENTRY(__sin)
14         fldl    4(%esp)
15         fxam
16         fstsw   %ax
17         movb    $0x45, %dh
18         andb    %ah, %dh
19         cmpb    $0x05, %dh
20         je      3f
21 4:      fsin
22         fnstsw  %ax
23         testl   $0x400,%eax
24         jnz     1f
25         ret
26         .align ALIGNARG(4)
27 1:      fldpi
28         fadd    %st(0)
29         fxch    %st(1)
30 2:      fprem1
31         fnstsw  %ax
32         testl   $0x400,%eax
33         jnz     2b
34         fstp    %st(1)
35         fsin
36         ret
38 #ifdef PIC
39         pushl   %ebx
40         cfi_adjust_cfa_offset (4)
41         cfi_rel_offset (ebx, 0)
42         LOAD_PIC_REG (bx)
43         call    __errno_location@PLT
44         movl    $EDOM, (%eax)
45         popl    %ebx
46         cfi_adjust_cfa_offset (-4)
47         cfi_restore (ebx)
48 #else
49         call    __errno_location@PLT
50         movl    $EDOM, (%eax)
51 #endif
52         jmp     4b
53 END (__sin)
54 weak_alias (__sin, sin)