1997-04-05 01:26:47 +00:00
|
|
|
/* ix87 specific frexp implementation for double.
|
2015-01-02 16:28:19 +00:00
|
|
|
Copyright (C) 1997-2015 Free Software Foundation, Inc.
|
1997-04-05 01:26:47 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:58:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1997-04-05 01:26:47 +00:00
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:58:11 +00:00
|
|
|
Lesser General Public License for more details.
|
1997-04-05 01:26:47 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1997-04-05 01:26:47 +00:00
|
|
|
|
|
|
|
#include <machine/asm.h>
|
|
|
|
|
|
|
|
.section .rodata
|
|
|
|
|
|
|
|
.align ALIGNARG(4)
|
2012-08-02 19:04:29 +00:00
|
|
|
.type two54,@object
|
1997-04-05 01:26:47 +00:00
|
|
|
two54: .byte 0, 0, 0, 0, 0, 0, 0x50, 0x43
|
|
|
|
ASM_SIZE_DIRECTIVE(two54)
|
|
|
|
|
|
|
|
#ifdef PIC
|
|
|
|
#define MO(op) op##@GOTOFF(%edx)
|
|
|
|
#else
|
|
|
|
#define MO(op) op
|
|
|
|
#endif
|
|
|
|
|
2013-02-21 22:21:52 +00:00
|
|
|
#define PARMS 4 /* no space for saved regs */
|
2000-08-17 07:36:19 +00:00
|
|
|
#define VAL0 PARMS
|
|
|
|
#define VAL1 VAL0+4
|
|
|
|
#define EXPP VAL1+4
|
|
|
|
|
1997-04-05 01:26:47 +00:00
|
|
|
.text
|
2013-02-21 22:21:52 +00:00
|
|
|
ENTRY (__frexp)
|
2000-08-17 07:36:19 +00:00
|
|
|
|
|
|
|
movl VAL0(%esp), %ecx
|
|
|
|
movl VAL1(%esp), %eax
|
1997-04-05 01:26:47 +00:00
|
|
|
movl %eax, %edx
|
|
|
|
andl $0x7fffffff, %eax
|
|
|
|
orl %eax, %ecx
|
|
|
|
jz 1f
|
|
|
|
xorl %ecx, %ecx
|
|
|
|
cmpl $0x7ff00000, %eax
|
|
|
|
jae 1f
|
|
|
|
|
|
|
|
cmpl $0x00100000, %eax
|
|
|
|
jae 2f
|
|
|
|
|
2000-08-17 07:36:19 +00:00
|
|
|
fldl VAL0(%esp)
|
1997-04-05 01:26:47 +00:00
|
|
|
#ifdef PIC
|
2005-05-04 17:58:13 +00:00
|
|
|
LOAD_PIC_REG (dx)
|
1997-04-05 01:26:47 +00:00
|
|
|
#endif
|
|
|
|
fmull MO(two54)
|
|
|
|
movl $-54, %ecx
|
2000-08-17 07:36:19 +00:00
|
|
|
fstpl VAL0(%esp)
|
2000-12-02 18:22:43 +00:00
|
|
|
fwait
|
2000-08-17 07:36:19 +00:00
|
|
|
movl VAL1(%esp), %eax
|
1997-04-05 01:26:47 +00:00
|
|
|
movl %eax, %edx
|
|
|
|
andl $0x7fffffff, %eax
|
|
|
|
|
|
|
|
2: shrl $20, %eax
|
|
|
|
andl $0x800fffff, %edx
|
|
|
|
subl $1022, %eax
|
|
|
|
orl $0x3fe00000, %edx
|
|
|
|
addl %eax, %ecx
|
2000-08-17 07:36:19 +00:00
|
|
|
movl %edx, VAL1(%esp)
|
1997-04-05 01:26:47 +00:00
|
|
|
|
|
|
|
/* Store %ecx in the variable pointed to by the second argument,
|
|
|
|
get the factor from the stack and return. */
|
2000-08-17 07:36:19 +00:00
|
|
|
1: movl EXPP(%esp), %eax
|
|
|
|
fldl VAL0(%esp)
|
1997-04-05 01:26:47 +00:00
|
|
|
movl %ecx, (%eax)
|
2000-08-17 07:36:19 +00:00
|
|
|
|
1997-04-05 01:26:47 +00:00
|
|
|
ret
|
2013-02-21 22:21:52 +00:00
|
|
|
END (__frexp)
|
|
|
|
weak_alias (__frexp, frexp)
|