chiark / gitweb /
eglibc (2.11.3-4+deb6u3) squeeze-lts; urgency=medium
[eglibc.git] / sysdeps / i386 / fpu / s_cosf.S
1 /*
2  * Written by J.T. Conklin <jtc@netbsd.org>.
3  * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
4  * Public domain.
5  */
6
7 #define __need_Emath
8 #include <bits/errno.h>
9 #include <machine/asm.h>
10
11 RCSID("$NetBSD: s_cosf.S,v 1.3 1995/05/08 23:55:16 jtc Exp $")
12
13 ENTRY(__cosf)
14         flds    4(%esp)
15         fxam
16         fstsw   %ax
17         movb    $0x45, %dh
18         andb    %ah, %dh
19         cmpb    $0x05, %dh
20         je      3f
21 4:      fcos
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         fcos
36         ret
37 3:
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 (__cosf)
54 weak_alias (__cosf, cosf)