about summary refs log tree commit diff
path: root/sysdeps/alpha/soft-fp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /sysdeps/alpha/soft-fp
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.xz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
Diffstat (limited to 'sysdeps/alpha/soft-fp')
-rw-r--r--sysdeps/alpha/soft-fp/Dist14
-rw-r--r--sysdeps/alpha/soft-fp/Makefile4
-rw-r--r--sysdeps/alpha/soft-fp/e_sqrtl.c40
-rw-r--r--sysdeps/alpha/soft-fp/ots_add.c8
-rw-r--r--sysdeps/alpha/soft-fp/ots_cvtqux.c6
-rw-r--r--sysdeps/alpha/soft-fp/ots_cvtqx.c6
-rw-r--r--sysdeps/alpha/soft-fp/ots_cvttx.c10
-rw-r--r--sysdeps/alpha/soft-fp/ots_cvtxq.c7
-rw-r--r--sysdeps/alpha/soft-fp/ots_cvtxt.c10
-rw-r--r--sysdeps/alpha/soft-fp/ots_nintxq.c12
-rw-r--r--sysdeps/alpha/soft-fp/ots_sub.c8
11 files changed, 79 insertions, 46 deletions
diff --git a/sysdeps/alpha/soft-fp/Dist b/sysdeps/alpha/soft-fp/Dist
deleted file mode 100644
index 3d75ee78b5..0000000000
--- a/sysdeps/alpha/soft-fp/Dist
+++ /dev/null
@@ -1,14 +0,0 @@
-local-soft-fp.h
-ots_add.c
-ots_cmp.c
-ots_cmpe.c
-ots_cvtqux.c
-ots_cvtqx.c
-ots_cvttx.c
-ots_cvtxq.c
-ots_cvtxt.c
-ots_div.c
-ots_mul.c
-ots_nintxq.c
-ots_sub.c
-sfp-machine.h
diff --git a/sysdeps/alpha/soft-fp/Makefile b/sysdeps/alpha/soft-fp/Makefile
index d7e7e2684a..5410a78984 100644
--- a/sysdeps/alpha/soft-fp/Makefile
+++ b/sysdeps/alpha/soft-fp/Makefile
@@ -4,3 +4,7 @@ ifeq ($(subdir),soft-fp)
 sysdep_routines += ots_add ots_sub ots_mul ots_div ots_cmp ots_cmpe	\
 	ots_cvtxq ots_cvtqx ots_cvtqux ots_cvttx ots_cvtxt ots_nintxq
 endif
+
+ifeq ($(subdir),math)
+CPPFLAGS += -I../soft-fp
+endif
diff --git a/sysdeps/alpha/soft-fp/e_sqrtl.c b/sysdeps/alpha/soft-fp/e_sqrtl.c
new file mode 100644
index 0000000000..717d170127
--- /dev/null
+++ b/sysdeps/alpha/soft-fp/e_sqrtl.c
@@ -0,0 +1,40 @@
+/* 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;
+  long _round = 4;	/* dynamic rounding */
+
+  FP_INIT_ROUNDMODE;
+  FP_UNPACK_Q(A, a);
+  FP_SQRT_Q(C, A);
+  FP_PACK_Q(c, C);
+  FP_HANDLE_EXCEPTIONS;
+  return c;
+}
diff --git a/sysdeps/alpha/soft-fp/ots_add.c b/sysdeps/alpha/soft-fp/ots_add.c
index b4f6c28f3d..acf66f316b 100644
--- a/sysdeps/alpha/soft-fp/ots_add.c
+++ b/sysdeps/alpha/soft-fp/ots_add.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: addition.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,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).
@@ -29,10 +29,10 @@ _OtsAddX(long al, long ah, long bl, long bh, long _round)
   FP_DECL_RETURN(c);
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
-  FP_UNPACK_Q(B, b);
+  FP_UNPACK_SEMIRAW_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(B, b);
   FP_ADD_Q(C, A, B);
-  FP_PACK_Q(c, C);
+  FP_PACK_SEMIRAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
 
   FP_RETURN(c);
diff --git a/sysdeps/alpha/soft-fp/ots_cvtqux.c b/sysdeps/alpha/soft-fp/ots_cvtqux.c
index d7ab5bae43..82c50806c4 100644
--- a/sysdeps/alpha/soft-fp/ots_cvtqux.c
+++ b/sysdeps/alpha/soft-fp/ots_cvtqux.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: unsigned integer to float conversion.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,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).
@@ -33,8 +33,8 @@ _OtsCvtQUX (unsigned long a)
   FP_DECL_Q(C);
   FP_DECL_RETURN(c);
 
-  FP_FROM_INT_Q(C, a, 64, long);
-  FP_PACK_Q(c, C);
+  FP_FROM_INT_Q(C, a, 64, unsigned long);
+  FP_PACK_RAW_Q(c, C);
 
   FP_RETURN(c);
 }
diff --git a/sysdeps/alpha/soft-fp/ots_cvtqx.c b/sysdeps/alpha/soft-fp/ots_cvtqx.c
index 0e1c6bdc41..dc80291506 100644
--- a/sysdeps/alpha/soft-fp/ots_cvtqx.c
+++ b/sysdeps/alpha/soft-fp/ots_cvtqx.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: signed integer to float conversion.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,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).
@@ -33,7 +33,7 @@ _OtsCvtQX (long a)
   FP_DECL_Q(C);
   FP_DECL_RETURN(c);
 
-  FP_FROM_INT_Q(C, a, 64, long);
-  FP_PACK_Q(c, C);
+  FP_FROM_INT_Q(C, a, 64, unsigned long);
+  FP_PACK_RAW_Q(c, C);
   FP_RETURN(c);
 }
diff --git a/sysdeps/alpha/soft-fp/ots_cvttx.c b/sysdeps/alpha/soft-fp/ots_cvttx.c
index ee5ac324cd..2d0bc9bca9 100644
--- a/sysdeps/alpha/soft-fp/ots_cvttx.c
+++ b/sysdeps/alpha/soft-fp/ots_cvttx.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: floating point extension.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,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).
@@ -35,13 +35,13 @@ _OtsConvertFloatTX(double a)
   FP_DECL_Q(C);
   FP_DECL_RETURN(c);
 
-  FP_UNPACK_D(A, a);
+  FP_UNPACK_RAW_D(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(Q,D,4,2,C,A);
+  FP_EXTEND(Q,D,4,2,C,A);
 #else
-  FP_CONV(Q,D,2,1,C,A);
+  FP_EXTEND(Q,D,2,1,C,A);
 #endif
-  FP_PACK_Q(c, C);
+  FP_PACK_RAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
 
   FP_RETURN(c);
diff --git a/sysdeps/alpha/soft-fp/ots_cvtxq.c b/sysdeps/alpha/soft-fp/ots_cvtxq.c
index 1fd47da4f7..2c9df529d5 100644
--- a/sysdeps/alpha/soft-fp/ots_cvtxq.c
+++ b/sysdeps/alpha/soft-fp/ots_cvtxq.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: float to integer conversion.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,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).
@@ -26,14 +26,15 @@ _OtsCvtXQ (long al, long ah, long _round)
 {
   FP_DECL_EX;
   FP_DECL_Q(A);
-  long r, s;
+  unsigned long r;
+  long s;
 
   /* If bit 3 is set, then integer overflow detection is requested.  */
   s = _round & 8 ? 1 : -1;
   _round = _round & 3;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_RAW_Q(A, a);
   FP_TO_INT_Q(r, A, 64, s);
 
   if (s > 0 && (_fex &= FP_EX_INVALID))
diff --git a/sysdeps/alpha/soft-fp/ots_cvtxt.c b/sysdeps/alpha/soft-fp/ots_cvtxt.c
index 2629dd9e40..6221a2365c 100644
--- a/sysdeps/alpha/soft-fp/ots_cvtxt.c
+++ b/sysdeps/alpha/soft-fp/ots_cvtxt.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: floating point truncation.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,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).
@@ -31,13 +31,13 @@ _OtsConvertFloatXT (long al, long ah, long _round)
   double r;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(D,Q,2,4,R,A);
+  FP_TRUNC(D,Q,2,4,R,A);
 #else
-  FP_CONV(D,Q,1,2,R,A);
+  FP_TRUNC(D,Q,1,2,R,A);
 #endif
-  FP_PACK_D(r, R);
+  FP_PACK_SEMIRAW_D(r, R);
   FP_HANDLE_EXCEPTIONS;
 
   return r;
diff --git a/sysdeps/alpha/soft-fp/ots_nintxq.c b/sysdeps/alpha/soft-fp/ots_nintxq.c
index 2cb1ca4c2a..a718372af7 100644
--- a/sysdeps/alpha/soft-fp/ots_nintxq.c
+++ b/sysdeps/alpha/soft-fp/ots_nintxq.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: convert to fortran nearest.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,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).
@@ -26,22 +26,24 @@ _OtsNintXQ (long al, long ah, long _round)
 {
   FP_DECL_EX;
   FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C);
-  long r, s;
+  unsigned long r;
+  long s;
 
   /* If bit 3 is set, then integer overflow detection is requested.  */
   s = _round & 8 ? 1 : -1;
   _round = _round & 3;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(A, a);
 
   /* Build 0.5 * sign(A) */
   B_e = _FP_EXPBIAS_Q;
-  __FP_FRAC_SET_2 (B, _FP_IMPLBIT_Q, 0);
+  __FP_FRAC_SET_2 (B, 0, 0);
   B_s = A_s;
-  _FP_UNPACK_CANONICAL(Q,2,B);
 
   FP_ADD_Q(C, A, B);
+  _FP_FRAC_SRL_2(C, _FP_WORKBITS);
+  _FP_FRAC_HIGH_RAW_Q(C) &= ~(_FP_W_TYPE)_FP_IMPLBIT_Q;
   FP_TO_INT_Q(r, C, 64, s);
   if (s > 0 && (_fex &= FP_EX_INVALID))
     FP_HANDLE_EXCEPTIONS;
diff --git a/sysdeps/alpha/soft-fp/ots_sub.c b/sysdeps/alpha/soft-fp/ots_sub.c
index c10043f071..5147266a04 100644
--- a/sysdeps/alpha/soft-fp/ots_sub.c
+++ b/sysdeps/alpha/soft-fp/ots_sub.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: subtraction.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,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).
@@ -29,10 +29,10 @@ _OtsSubX(long al, long ah, long bl, long bh, long _round)
   FP_DECL_RETURN(c);
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
-  FP_UNPACK_Q(B, b);
+  FP_UNPACK_SEMIRAW_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(B, b);
   FP_SUB_Q(C, A, B);
-  FP_PACK_Q(c, C);
+  FP_PACK_SEMIRAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
 
   FP_RETURN(c);