* sysdeps/mips/mips64/n32/Implies: Add mips/mips64/soft-fp.

* sysdeps/mips/mips64/n64/Implies: Likewise.
	* sysdeps/mips/mips64/soft-fp/Makefile: New.
	* sysdeps/mips/mips64/soft-fp/e_sqrtl.c: New.
	* sysdeps/mips/mips64/soft-fp/sfp-machine.h: Include <fenv.h> and
	<fpu_control.h>.  Use hardware exception and rounding mode
	settings.
This commit is contained in:
Daniel Jacobowitz 2007-05-23 17:13:59 +00:00
parent 388fc51bf4
commit 384fa30ddd
6 changed files with 86 additions and 5 deletions

View File

@ -1,3 +1,13 @@
2007-05-23 Joseph Myers <joseph@codesourcery.com>
* sysdeps/mips/mips64/n32/Implies: Add mips/mips64/soft-fp.
* sysdeps/mips/mips64/n64/Implies: Likewise.
* sysdeps/mips/mips64/soft-fp/Makefile: New.
* sysdeps/mips/mips64/soft-fp/e_sqrtl.c: New.
* sysdeps/mips/mips64/soft-fp/sfp-machine.h: Include <fenv.h> and
<fpu_control.h>. Use hardware exception and rounding mode
settings.
2007-05-23 Richard Sandiford <rsandifo@nildram.co.uk>
* sysdeps/mips/dl-machine.h (elf_machine_reloc): Change type of

View File

@ -1,4 +1,5 @@
ieee754/ldbl-128
mips/mips64/soft-fp
mips/mips64
mips
wordsize-32

View File

@ -1,4 +1,5 @@
ieee754/ldbl-128
mips/mips64/soft-fp
mips/mips64
mips
wordsize-64

View File

@ -0,0 +1,3 @@
ifeq ($(subdir),math)
CPPFLAGS += -I../soft-fp
endif

View File

@ -0,0 +1,39 @@
/* long double square root in software floating-point emulation.
Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
The GNU C Library is free software; you can redistribute it and/or
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.
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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <stdlib.h>
#include <soft-fp.h>
#include <quad.h>
long double
__ieee754_sqrtl (const long double a)
{
FP_DECL_EX;
FP_DECL_Q(A); FP_DECL_Q(C);
long double c;
FP_INIT_ROUNDMODE;
FP_UNPACK_Q(A, a);
FP_SQRT_Q(C, A);
FP_PACK_Q(c, C);
FP_HANDLE_EXCEPTIONS;
return c;
}

View File

@ -1,3 +1,6 @@
#include <fenv.h>
#include <fpu_control.h>
#define _FP_W_TYPE_SIZE 64
#define _FP_W_TYPE unsigned long long
#define _FP_WS_TYPE signed long long
@ -40,8 +43,32 @@
R##_c = FP_CLS_NAN; \
} while (0)
#define FP_EX_INVALID (1 << 4)
#define FP_EX_DIVZERO (1 << 3)
#define FP_EX_OVERFLOW (1 << 2)
#define FP_EX_UNDERFLOW (1 << 1)
#define FP_EX_INEXACT (1 << 0)
#define _FP_DECL_EX fpu_control_t _fcw
#define FP_ROUNDMODE (_fcw & 0x3)
#define FP_RND_NEAREST FE_TONEAREST
#define FP_RND_ZERO FE_TOWARDZERO
#define FP_RND_PINF FE_UPWARD
#define FP_RND_MINF FE_DOWNWARD
#define FP_EX_INVALID FE_INVALID
#define FP_EX_OVERFLOW FE_OVERFLOW
#define FP_EX_UNDERFLOW FE_UNDERFLOW
#define FP_EX_DIVZERO FE_DIVBYZERO
#define FP_EX_INEXACT FE_INEXACT
#ifdef __mips_hard_float
#define FP_INIT_ROUNDMODE \
do { \
_FPU_GETCW (_fcw); \
} while (0)
#define FP_HANDLE_EXCEPTIONS \
do { \
if (__builtin_expect (_fex, 0)) \
_FPU_SETCW (_fcw | _fex | (_fex << 10)); \
} while (0)
#else
#define FP_INIT_ROUNDMODE _fcw = FP_RND_NEAREST
#endif