Blame sysdeps/i386/fpu/s_frexpf.S

Packit 6c4009
/* ix87 specific frexp implementation for float.
Packit 6c4009
   Copyright (C) 1997-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#include <machine/asm.h>
Packit 6c4009
#include <libm-alias-float.h>
Packit 6c4009
Packit 6c4009
	.section .rodata
Packit 6c4009
Packit 6c4009
	.align ALIGNARG(4)
Packit 6c4009
	.type two25,@object
Packit 6c4009
two25:	.byte 0, 0, 0, 0x4c
Packit 6c4009
	ASM_SIZE_DIRECTIVE(two25)
Packit 6c4009
Packit 6c4009
#ifdef PIC
Packit 6c4009
#define MO(op) op##@GOTOFF(%edx)
Packit 6c4009
#else
Packit 6c4009
#define MO(op) op
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#define PARMS	4		/* no space for saved regs */
Packit 6c4009
#define VAL	PARMS
Packit 6c4009
#define EXPP	VAL+4
Packit 6c4009
Packit 6c4009
	.text
Packit 6c4009
ENTRY (__frexpf)
Packit 6c4009
Packit 6c4009
	movl	VAL(%esp), %eax
Packit 6c4009
	xorl	%ecx, %ecx
Packit 6c4009
	movl	%eax, %edx
Packit 6c4009
	andl	$0x7fffffff, %eax
Packit 6c4009
	jz	1f
Packit 6c4009
	cmpl	$0x7f800000, %eax
Packit 6c4009
	jae	1f
Packit 6c4009
Packit 6c4009
	cmpl	$0x00800000, %eax
Packit 6c4009
	jae	2f
Packit 6c4009
Packit 6c4009
	flds	VAL(%esp)
Packit 6c4009
#ifdef	PIC
Packit 6c4009
	LOAD_PIC_REG (dx)
Packit 6c4009
#endif
Packit 6c4009
	fmuls	MO(two25)
Packit 6c4009
	movl	$-25, %ecx
Packit 6c4009
	fstps	VAL(%esp)
Packit 6c4009
	fwait
Packit 6c4009
	movl	VAL(%esp), %eax
Packit 6c4009
	movl	%eax, %edx
Packit 6c4009
	andl	$0x7fffffff, %eax
Packit 6c4009
Packit 6c4009
2:	shrl	$23, %eax
Packit 6c4009
	andl	$0x807fffff, %edx
Packit 6c4009
	subl	$126, %eax
Packit 6c4009
	orl	$0x3f000000, %edx
Packit 6c4009
	addl	%eax, %ecx
Packit 6c4009
	movl	%edx, VAL(%esp)
Packit 6c4009
Packit 6c4009
	/* Store %ecx in the variable pointed to by the second argument,
Packit 6c4009
	   get the factor from the stack and return.  */
Packit 6c4009
1:	movl	EXPP(%esp), %eax
Packit 6c4009
	flds	VAL(%esp)
Packit 6c4009
	movl	%ecx, (%eax)
Packit 6c4009
Packit 6c4009
	ret
Packit 6c4009
END (__frexpf)
Packit 6c4009
libm_alias_float (__frexp, frexp)