]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/i386/fpu/s_frexp.S
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / i386 / fpu / s_frexp.S
CommitLineData
26dee9c4 1/* ix87 specific frexp implementation for double.
04277e02 2 Copyright (C) 1997-2019 Free Software Foundation, Inc.
26dee9c4
UD
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
41bdb6e2
AJ
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
26dee9c4
UD
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
41bdb6e2 14 Lesser General Public License for more details.
26dee9c4 15
41bdb6e2 16 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
26dee9c4
UD
19
20#include <machine/asm.h>
bc4e8f9b 21#include <libm-alias-double.h>
26dee9c4 22
26dee9c4 23 .section .rodata
26dee9c4
UD
24
25 .align ALIGNARG(4)
b67e9372 26 .type two54,@object
26dee9c4
UD
27two54: .byte 0, 0, 0, 0, 0, 0, 0x50, 0x43
28 ASM_SIZE_DIRECTIVE(two54)
29
30#ifdef PIC
31#define MO(op) op##@GOTOFF(%edx)
32#else
33#define MO(op) op
34#endif
35
2366713d 36#define PARMS 4 /* no space for saved regs */
9e25f6e2
GM
37#define VAL0 PARMS
38#define VAL1 VAL0+4
39#define EXPP VAL1+4
40
26dee9c4 41 .text
2366713d 42ENTRY (__frexp)
9e25f6e2
GM
43
44 movl VAL0(%esp), %ecx
45 movl VAL1(%esp), %eax
26dee9c4
UD
46 movl %eax, %edx
47 andl $0x7fffffff, %eax
48 orl %eax, %ecx
49 jz 1f
50 xorl %ecx, %ecx
51 cmpl $0x7ff00000, %eax
52 jae 1f
53
54 cmpl $0x00100000, %eax
55 jae 2f
56
9e25f6e2 57 fldl VAL0(%esp)
26dee9c4 58#ifdef PIC
fee732e5 59 LOAD_PIC_REG (dx)
26dee9c4
UD
60#endif
61 fmull MO(two54)
62 movl $-54, %ecx
9e25f6e2 63 fstpl VAL0(%esp)
00f5fcbb 64 fwait
9e25f6e2 65 movl VAL1(%esp), %eax
26dee9c4
UD
66 movl %eax, %edx
67 andl $0x7fffffff, %eax
68
692: shrl $20, %eax
70 andl $0x800fffff, %edx
71 subl $1022, %eax
72 orl $0x3fe00000, %edx
73 addl %eax, %ecx
9e25f6e2 74 movl %edx, VAL1(%esp)
26dee9c4
UD
75
76 /* Store %ecx in the variable pointed to by the second argument,
77 get the factor from the stack and return. */
9e25f6e2 781: movl EXPP(%esp), %eax
9e25f6e2 79 fldl VAL0(%esp)
26dee9c4 80 movl %ecx, (%eax)
9e25f6e2 81
26dee9c4 82 ret
2366713d 83END (__frexp)
bc4e8f9b 84libm_alias_double (__frexp, frexp)