1997-04-05 01:26:47 +00:00
|
|
|
/* ix87 specific frexp implementation for float.
|
2013-01-02 19:01:50 +00:00
|
|
|
Copyright (C) 1997-2013 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 two25,@object
|
1997-04-05 01:26:47 +00:00
|
|
|
two25: .byte 0, 0, 0, 0x4c
|
|
|
|
ASM_SIZE_DIRECTIVE(two25)
|
|
|
|
|
|
|
|
#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 VAL PARMS
|
|
|
|
#define EXPP VAL+4
|
|
|
|
|
1997-04-05 01:26:47 +00:00
|
|
|
.text
|
2013-02-21 22:21:52 +00:00
|
|
|
ENTRY (__frexpf)
|
2000-08-17 07:36:19 +00:00
|
|
|
|
|
|
|
movl VAL(%esp), %eax
|
1997-04-05 01:26:47 +00:00
|
|
|
xorl %ecx, %ecx
|
|
|
|
movl %eax, %edx
|
|
|
|
andl $0x7fffffff, %eax
|
|
|
|
jz 1f
|
|
|
|
cmpl $0x7f800000, %eax
|
|
|
|
jae 1f
|
|
|
|
|
|
|
|
cmpl $0x00800000, %eax
|
|
|
|
jae 2f
|
|
|
|
|
2000-08-17 07:36:19 +00:00
|
|
|
flds VAL(%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
|
|
|
|
fmuls MO(two25)
|
|
|
|
movl $-25, %ecx
|
2000-08-17 07:36:19 +00:00
|
|
|
fstps VAL(%esp)
|
2000-12-02 18:22:43 +00:00
|
|
|
fwait
|
2000-08-17 07:36:19 +00:00
|
|
|
movl VAL(%esp), %eax
|
1997-04-05 01:26:47 +00:00
|
|
|
movl %eax, %edx
|
|
|
|
andl $0x7fffffff, %eax
|
|
|
|
|
|
|
|
2: shrl $23, %eax
|
|
|
|
andl $0x807fffff, %edx
|
|
|
|
subl $126, %eax
|
|
|
|
orl $0x3f000000, %edx
|
|
|
|
addl %eax, %ecx
|
2000-08-17 07:36:19 +00:00
|
|
|
movl %edx, VAL(%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
|
|
|
|
flds VAL(%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 (__frexpf)
|
|
|
|
weak_alias (__frexpf, frexpf)
|