* soft-fp/Makefile (gcc-single-routines): Add unordsf2,
authorRoland McGrath <roland@gnu.org>
Fri, 6 Jan 2006 10:47:57 +0000 (10:47 +0000)
committerRoland McGrath <roland@gnu.org>
Fri, 6 Jan 2006 10:47:57 +0000 (10:47 +0000)
floatunsisf, floatundisf.
(gcc-double-routines): Add unorddf2, floatunsidf, floatundidf.
(gcc-quad-routines): Add unordtf2, floatunsitf, floatunditf.
* soft-fp/op-common.h (_FP_CMP_UNORD): Define.
* soft-fp/single.h (FP_CMP_UNORD_S): Define.
* soft-fp/double.h (FP_CMP_UNORD_D): Define.
* soft-fp/quad.h (FP_CMP_UNORD_Q): Define.
* soft-fp/extended.h (FP_CMP_UNORD_E): Define.
* soft-fp/unordsf2.c: New file.
* soft-fp/unorddf2.c: New file.
* soft-fp/unordtf2.c: New file.
* soft-fp/floatunsisf.c: New file.
* soft-fp/floatundisf.c: New file.
* soft-fp/floatunsidf.c: New file.
* soft-fp/floatundidf.c: New file.
* soft-fp/floatunsitf.c: New file.
* soft-fp/floatunditf.c: New file.

16 files changed:
ChangeLog
soft-fp/Makefile
soft-fp/double.h
soft-fp/extended.h
soft-fp/floatundidf.c [new file with mode: 0644]
soft-fp/floatundisf.c [new file with mode: 0644]
soft-fp/floatunditf.c [new file with mode: 0644]
soft-fp/floatunsidf.c [new file with mode: 0644]
soft-fp/floatunsisf.c [new file with mode: 0644]
soft-fp/floatunsitf.c [new file with mode: 0644]
soft-fp/op-common.h
soft-fp/quad.h
soft-fp/single.h
soft-fp/unorddf2.c [new file with mode: 0644]
soft-fp/unordsf2.c [new file with mode: 0644]
soft-fp/unordtf2.c [new file with mode: 0644]

index c0607e4..b016443 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
 2005-12-04  Joseph S. Myers  <joseph@codesourcery.com>
 
+       * soft-fp/Makefile (gcc-single-routines): Add unordsf2,
+       floatunsisf, floatundisf.
+       (gcc-double-routines): Add unorddf2, floatunsidf, floatundidf.
+       (gcc-quad-routines): Add unordtf2, floatunsitf, floatunditf.
+       * soft-fp/op-common.h (_FP_CMP_UNORD): Define.
+       * soft-fp/single.h (FP_CMP_UNORD_S): Define.
+       * soft-fp/double.h (FP_CMP_UNORD_D): Define.
+       * soft-fp/quad.h (FP_CMP_UNORD_Q): Define.
+       * soft-fp/extended.h (FP_CMP_UNORD_E): Define.
+       * soft-fp/unordsf2.c: New file.
+       * soft-fp/unorddf2.c: New file.
+       * soft-fp/unordtf2.c: New file.
+       * soft-fp/floatunsisf.c: New file.
+       * soft-fp/floatundisf.c: New file.
+       * soft-fp/floatunsidf.c: New file.
+       * soft-fp/floatundidf.c: New file.
+       * soft-fp/floatunsitf.c: New file.
+       * soft-fp/floatunditf.c: New file.
+
        * soft-fp/op-common.h (__FP_CLZ): Define using __builtin_clz,
        __builtin_clzl and __builtin_clzll.
 
index e0a3cfb..8eb89c5 100644 (file)
 subdir := soft-fp
 
 gcc-single-routines := negsf2 addsf3 subsf3 mulsf3 divsf3 eqsf2 \
-       lesf2 gesf2 fixsfsi fixunssfsi floatsisf fixsfdi        \
-       fixunssfdi floatdisf sqrtsf2
+       lesf2 gesf2 unordsf2 fixsfsi fixunssfsi floatsisf fixsfdi        \
+       fixunssfdi floatdisf sqrtsf2 floatunsisf floatundisf
 
 gcc-double-routines := negdf2 adddf3 subdf3 muldf3 divdf3 eqdf2 \
-       ledf2 gedf2 fixdfsi fixunsdfsi floatsidf fixdfdi        \
-       fixunsdfdi floatdidf extendsfdf2 truncdfsf2 sqrtdf2
+       ledf2 gedf2 unorddf2 fixdfsi fixunsdfsi floatsidf fixdfdi        \
+       fixunsdfdi floatdidf extendsfdf2 truncdfsf2 sqrtdf2 floatunsidf \
+       floatundidf
 
 gcc-quad-routines := negtf2 addtf3 subtf3 multf3 divtf3 eqtf2 \
-       letf2 getf2 fixtfsi fixunstfsi floatsitf fixtfdi      \
+       letf2 getf2 unordtf2 fixtfsi fixunstfsi floatsitf fixtfdi      \
        fixunstfdi floatditf extendsftf2 trunctfsf2 extenddftf2 \
-       trunctfdf2 sqrttf2
+       trunctfdf2 sqrttf2 floatunsitf floatunditf
 
 distribute := double.h op-1.h op-2.h op-4.h op-common.h quad.h \
        single.h soft-fp.h extended.h Banner op-8.h testit.c \
index c659ade..77d439b 100644 (file)
@@ -113,6 +113,7 @@ union _FP_UNION_D
 
 #define FP_CMP_D(r,X,Y,un)     _FP_CMP(D,2,r,X,Y,un)
 #define FP_CMP_EQ_D(r,X,Y)     _FP_CMP_EQ(D,2,r,X,Y)
+#define FP_CMP_UNORD_D(r,X,Y)  _FP_CMP_UNORD(D,2,r,X,Y)
 
 #define FP_TO_INT_D(r,X,rsz,rsg)       _FP_TO_INT(D,2,r,X,rsz,rsg)
 #define FP_FROM_INT_D(X,r,rs,rt)       _FP_FROM_INT(D,2,X,r,rs,rt)
index 2edcbd0..a1f54cc 100644 (file)
@@ -224,6 +224,7 @@ union _FP_UNION_E
 
 #define FP_CMP_E(r,X,Y,un)     _FP_CMP(E,4,r,X,Y,un)
 #define FP_CMP_EQ_E(r,X,Y)     _FP_CMP_EQ(E,4,r,X,Y)
+#define FP_CMP_UNORD_E(r,X,Y)  _FP_CMP_UNORD(E,4,r,X,Y)
 
 #define FP_TO_INT_E(r,X,rsz,rsg)       _FP_TO_INT(E,4,r,X,rsz,rsg)
 #define FP_FROM_INT_E(X,r,rs,rt)       _FP_FROM_INT(E,4,X,r,rs,rt)
diff --git a/soft-fp/floatundidf.c b/soft-fp/floatundidf.c
new file mode 100644 (file)
index 0000000..03bda04
--- /dev/null
@@ -0,0 +1,38 @@
+/* Software floating-point emulation.
+   Convert a 64bit unsigned integer to IEEE double
+   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 "soft-fp.h"
+#include "double.h"
+
+double
+__floatundidf(UDItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_D(A);
+  double a;
+
+  FP_FROM_INT_D(A, i, 64, long long);
+  FP_PACK_D(a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
diff --git a/soft-fp/floatundisf.c b/soft-fp/floatundisf.c
new file mode 100644 (file)
index 0000000..68aa90f
--- /dev/null
@@ -0,0 +1,38 @@
+/* Software floating-point emulation.
+   Convert a 64bit unsigned integer to IEEE single
+   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 "soft-fp.h"
+#include "single.h"
+
+float
+__floatundisf(UDItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_S(A);
+  float a;
+
+  FP_FROM_INT_S(A, i, 64, long long);
+  FP_PACK_S(a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
diff --git a/soft-fp/floatunditf.c b/soft-fp/floatunditf.c
new file mode 100644 (file)
index 0000000..2f53f7d
--- /dev/null
@@ -0,0 +1,38 @@
+/* Software floating-point emulation.
+   Convert a 64bit unsigned integer to IEEE quad
+   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 "soft-fp.h"
+#include "quad.h"
+
+long double
+__floatunditf(UDItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_Q(A);
+  long double a;
+
+  FP_FROM_INT_Q(A, i, 64, long long);
+  FP_PACK_Q(a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
diff --git a/soft-fp/floatunsidf.c b/soft-fp/floatunsidf.c
new file mode 100644 (file)
index 0000000..2649adc
--- /dev/null
@@ -0,0 +1,38 @@
+/* Software floating-point emulation.
+   Convert a 32bit unsigned integer to IEEE double
+   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 "soft-fp.h"
+#include "double.h"
+
+double
+__floatunsidf(USItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_D(A);
+  double a;
+
+  FP_FROM_INT_D(A, i, 32, int);
+  FP_PACK_D(a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
diff --git a/soft-fp/floatunsisf.c b/soft-fp/floatunsisf.c
new file mode 100644 (file)
index 0000000..a7f21ca
--- /dev/null
@@ -0,0 +1,38 @@
+/* Software floating-point emulation.
+   Convert a 32bit unsigned integer to IEEE single
+   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 "soft-fp.h"
+#include "single.h"
+
+float
+__floatunsisf(USItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_S(A);
+  float a;
+
+  FP_FROM_INT_S(A, i, 32, int);
+  FP_PACK_S(a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
diff --git a/soft-fp/floatunsitf.c b/soft-fp/floatunsitf.c
new file mode 100644 (file)
index 0000000..efb66e9
--- /dev/null
@@ -0,0 +1,38 @@
+/* Software floating-point emulation.
+   Convert a 32bit unsigned integer to IEEE quad
+   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 "soft-fp.h"
+#include "quad.h"
+
+long double
+__floatunsitf(USItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_Q(A);
+  long double a;
+
+  FP_FROM_INT_Q(A, i, 32, int);
+  FP_PACK_Q(a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
index 46162ed..f30260e 100644 (file)
@@ -553,6 +553,14 @@ do {                                                       \
       }                                                                          \
   } while (0)
 
+/* Version to test unordered.  */
+
+#define _FP_CMP_UNORD(fs, wc, ret, X, Y)                               \
+  do {                                                                 \
+    ret = ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X))       \
+          || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(Y)));   \
+  } while (0)
+
 /*
  * Main square root routine.  The input value should be cooked.
  */
index 33ee4d4..b03063b 100644 (file)
@@ -119,6 +119,7 @@ union _FP_UNION_Q
 
 #define FP_CMP_Q(r,X,Y,un)     _FP_CMP(Q,4,r,X,Y,un)
 #define FP_CMP_EQ_Q(r,X,Y)     _FP_CMP_EQ(Q,4,r,X,Y)
+#define FP_CMP_UNORD_Q(r,X,Y)  _FP_CMP_UNORD(Q,4,r,X,Y)
 
 #define FP_TO_INT_Q(r,X,rsz,rsg)       _FP_TO_INT(Q,4,r,X,rsz,rsg)
 #define FP_FROM_INT_Q(X,r,rs,rt)       _FP_FROM_INT(Q,4,X,r,rs,rt)
index b571d50..094dc3c 100644 (file)
@@ -102,6 +102,7 @@ union _FP_UNION_S
 
 #define FP_CMP_S(r,X,Y,un)     _FP_CMP(S,1,r,X,Y,un)
 #define FP_CMP_EQ_S(r,X,Y)     _FP_CMP_EQ(S,1,r,X,Y)
+#define FP_CMP_UNORD_S(r,X,Y)  _FP_CMP_UNORD(S,1,r,X,Y)
 
 #define FP_TO_INT_S(r,X,rsz,rsg)       _FP_TO_INT(S,1,r,X,rsz,rsg)
 #define FP_FROM_INT_S(X,r,rs,rt)       _FP_FROM_INT(S,1,X,r,rs,rt)
diff --git a/soft-fp/unorddf2.c b/soft-fp/unorddf2.c
new file mode 100644 (file)
index 0000000..35f3e67
--- /dev/null
@@ -0,0 +1,36 @@
+/* Software floating-point emulation.
+   Return 1 iff a or b is a NaN, 0 otherwise.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Joseph Myers (joseph@codesourcery.com).
+
+   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 "soft-fp.h"
+#include "double.h"
+
+int
+__unorddf2(double a, double b)
+{
+  FP_DECL_D(A); FP_DECL_D(B);
+  int r;
+
+  FP_UNPACK_RAW_D(A, a);
+  FP_UNPACK_RAW_D(B, b);
+  FP_CMP_UNORD_D(r, A, B);
+
+  return r;
+}
diff --git a/soft-fp/unordsf2.c b/soft-fp/unordsf2.c
new file mode 100644 (file)
index 0000000..e741b79
--- /dev/null
@@ -0,0 +1,37 @@
+/* Software floating-point emulation.
+   Return 1 iff a or b is a NaN, 0 otherwise.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Joseph Myers (joseph@codesourcery.com).
+
+   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 "soft-fp.h"
+#include "single.h"
+
+int
+__unordsf2(float a, float b)
+{
+  FP_DECL_S(A);
+  FP_DECL_S(B);
+  int r;
+
+  FP_UNPACK_RAW_S(A, a);
+  FP_UNPACK_RAW_S(B, b);
+  FP_CMP_UNORD_S(r, A, B);
+
+  return r;
+}
diff --git a/soft-fp/unordtf2.c b/soft-fp/unordtf2.c
new file mode 100644 (file)
index 0000000..5e30ddb
--- /dev/null
@@ -0,0 +1,37 @@
+/* Software floating-point emulation.
+   Return 1 iff a or b is a NaN, 0 otherwise.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Joseph Myers (joseph@codesourcery.com).
+
+   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 "soft-fp.h"
+#include "quad.h"
+
+int
+__unordtf2(long double a, long double b)
+{
+  FP_DECL_Q(A);
+  FP_DECL_Q(B);
+  int r;
+
+  FP_UNPACK_RAW_Q(A, a);
+  FP_UNPACK_RAW_Q(B, b);
+  FP_CMP_UNORD_Q(r, A, B);
+
+  return r;
+}