]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/i386/fpu/s_frexpl.S
* sysdeps/m68k/fpu/fegetexcept.c: New file. * sysdeps/m68k/fpu/fedisblxcpt.c: New...
[thirdparty/glibc.git] / sysdeps / i386 / fpu / s_frexpl.S
CommitLineData
26dee9c4
UD
1/* ix87 specific frexp implementation for long double.
2 Copyright (C) 1997 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21#include <machine/asm.h>
22
23#ifdef __ELF__
24 .section .rodata
25#else
26 .text
27#endif
28
29 .align ALIGNARG(4)
30 ASM_TYPE_DIRECTIVE(two64,@object)
31two64: .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x43
32 ASM_SIZE_DIRECTIVE(two64)
33
34#ifdef PIC
35#define MO(op) op##@GOTOFF(%edx)
36#else
37#define MO(op) op
38#endif
39
40 .text
41ENTRY(__frexpl)
42 movl 4(%esp), %ecx
43 movl 12(%esp), %eax
44 orl 8(%esp), %ecx
45 movl %eax, %edx
46 andl $0x7fff, %eax
47 orl %eax, %ecx
48 jz 1f
49 xorl %ecx, %ecx
50 cmpl $0x7fff, %eax
51 je 1f
52
53 cmpl $0, %eax
54 je 2f
55
56 fldt 4(%esp)
57#ifdef PIC
58 call 3f
593: popl %edx
60 addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %edx
61#endif
62 fmull MO(two64) /* It's not necessary to use a 80bit factor */
63 movl $-64, %ecx
64 fstpt 4(%esp)
65 movl 12(%esp), %eax
66 movl %eax, %edx
67 andl $0x7fff, %eax
68
692: andl $0x8000, %edx
70 subl $16382, %eax
71 orl $0x3ffe, %edx
72 addl %eax, %ecx
73 movl %edx, 12(%esp)
74
75 /* Store %ecx in the variable pointed to by the second argument,
76 get the factor from the stack and return. */
771: movl 16(%esp), %eax
78 fldt 4(%esp)
79 movl %ecx, (%eax)
80 ret
81END(__frexpl)
82weak_alias (__frexpl, frexpl)