about summary refs log tree commit diff
path: root/math/libm-test.inc
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2012-05-17 08:49:19 -0400
committerChris Metcalf <cmetcalf@tilera.com>2012-05-17 08:50:41 -0400
commit0af797def371ceb4f05586d7bcd25841653d2082 (patch)
tree3aa5591836c95fba6b694fb45c1421bf0025de91 /math/libm-test.inc
parente39745ffa030f685fbba13534a3023d52a27ead8 (diff)
downloadglibc-0af797def371ceb4f05586d7bcd25841653d2082.tar.gz
glibc-0af797def371ceb4f05586d7bcd25841653d2082.tar.xz
glibc-0af797def371ceb4f05586d7bcd25841653d2082.zip
math: support platforms with limited FP rounding or exception support
For some tests, just claim that fetestexcept() always returns true,
so the rest of the test can be compiled.

For libm-test, provide known bogus values for unsupported rounding
modes, so fesetround() will return failure.

Elsewhere, just add some #ifdefs to avoid code that uses particular
FP exceptions if the exceptions aren't supported.
Diffstat (limited to 'math/libm-test.inc')
-rw-r--r--math/libm-test.inc16
1 files changed, 16 insertions, 0 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 5a38dbf3a7..47bbd5f1ef 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -128,6 +128,22 @@
 #include <string.h>
 #include <argp.h>
 
+/* Allow platforms without all rounding modes to test properly,
+   assuming they provide an __FE_UNDEFINED in <bits/fenv.h> which
+   causes fesetround() to return failure.  */
+#ifndef FE_TONEAREST
+# define FE_TONEAREST	__FE_UNDEFINED
+#endif
+#ifndef FE_TOWARDZERO
+# define FE_TOWARDZERO	__FE_UNDEFINED
+#endif
+#ifndef FE_UPWARD
+# define FE_UPWARD	__FE_UNDEFINED
+#endif
+#ifndef FE_DOWNWARD
+# define FE_DOWNWARD	__FE_UNDEFINED
+#endif
+
 /* Possible exceptions */
 #define NO_EXCEPTION			0x0
 #define INVALID_EXCEPTION		0x1