diff options
| author | rearnsha <rearnsha@NetBSD.org> | 2003-05-06 08:58:19 +0000 |
|---|---|---|
| committer | rearnsha <rearnsha@NetBSD.org> | 2003-05-06 08:58:19 +0000 |
| commit | 033db35cb2044bc1ee854fa8e8f847bdc27b6003 (patch) | |
| tree | 96560f85f43641a36e7f3a4448511ca3d2666944 /lib/libc/softfloat | |
| parent | 7d8f3e39e7b8339aa7a1fb90d6cf5fc3f9e32377 (diff) | |
GCC-3 requires a libcall to support testing for unordered.
Diffstat (limited to 'lib/libc/softfloat')
| -rw-r--r-- | lib/libc/softfloat/Makefile.inc | 5 | ||||
| -rw-r--r-- | lib/libc/softfloat/unorddf2.c | 28 | ||||
| -rw-r--r-- | lib/libc/softfloat/unordsf2.c | 28 |
3 files changed, 59 insertions, 2 deletions
diff --git a/lib/libc/softfloat/Makefile.inc b/lib/libc/softfloat/Makefile.inc index e6421b9469b..41f4449d7b9 100644 --- a/lib/libc/softfloat/Makefile.inc +++ b/lib/libc/softfloat/Makefile.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.2 2002/05/21 23:51:05 bjh21 Exp $ +# $NetBSD: Makefile.inc,v 1.3 2003/05/06 08:58:20 rearnsha Exp $ SOFTFLOAT_BITS?=64 .PATH: ${ARCHDIR}/softfloat \ @@ -13,4 +13,5 @@ SRCS+= fpgetround.c fpsetround.c fpgetmask.c fpsetmask.c \ fpgetsticky.c fpsetsticky.c SRCS+= eqsf2.c nesf2.c gtsf2.c gesf2.c ltsf2.c lesf2.c negsf2.c \ - eqdf2.c nedf2.c gtdf2.c gedf2.c ltdf2.c ledf2.c negdf2.c + eqdf2.c nedf2.c gtdf2.c gedf2.c ltdf2.c ledf2.c negdf2.c \ + unordsf2.c unorddf2.c diff --git a/lib/libc/softfloat/unorddf2.c b/lib/libc/softfloat/unorddf2.c new file mode 100644 index 00000000000..d4ac29cbbaf --- /dev/null +++ b/lib/libc/softfloat/unorddf2.c @@ -0,0 +1,28 @@ +/* $NetBSD: unorddf2.c,v 1.1 2003/05/06 08:58:19 rearnsha Exp $ */ + +/* + * Written by Richard Earnshaw, 2003. This file is in the Public Domain. + */ + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +#include <sys/cdefs.h> +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: unorddf2.c,v 1.1 2003/05/06 08:58:19 rearnsha Exp $"); +#endif /* LIBC_SCCS and not lint */ + +flag __unorddf2(float64, float64); + +flag +__unorddf2(float64 a, float64 b) +{ + /* + * The comparison is unordered if either input is a NaN. + * Test for this by comparing each operand with itself. + * We must perform both comparisons to correctly check for + * signalling NaNs. + */ + return 1 ^ (float64_eq(a, a) & float64_eq(b, b)); +} diff --git a/lib/libc/softfloat/unordsf2.c b/lib/libc/softfloat/unordsf2.c new file mode 100644 index 00000000000..03a1969dd98 --- /dev/null +++ b/lib/libc/softfloat/unordsf2.c @@ -0,0 +1,28 @@ +/* $NetBSD: unordsf2.c,v 1.1 2003/05/06 08:58:20 rearnsha Exp $ */ + +/* + * Written by Richard Earnshaw, 2003. This file is in the Public Domain. + */ + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +#include <sys/cdefs.h> +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: unordsf2.c,v 1.1 2003/05/06 08:58:20 rearnsha Exp $"); +#endif /* LIBC_SCCS and not lint */ + +flag __unordsf2(float32, float32); + +flag +__unordsf2(float32 a, float32 b) +{ + /* + * The comparison is unordered if either input is a NaN. + * Test for this by comparing each operand with itself. + * We must perform both comparisons to correctly check for + * signalling NaNs. + */ + return 1 ^ (float32_eq(a, a) & float32_eq(b, b)); +} |
