Module: Mesa
Branch: main
Commit: 5b7c73390247caa847c56c442298107a1e568a6d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b7c73390247caa847c56c442298107a1e568a6d

Author: Matt Turner <matts...@gmail.com>
Date:   Wed Jan 10 17:32:06 2024 -0500

util/tests: Disable half-float NaN test on hppa/old-mips

Bug: https://bugs.gentoo.org/908079
Fixes: 067023dce2c ("util: Add some unit tests of the half-float conversions.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26991>

---

 src/util/tests/half_float_test.cpp | 39 +++++++++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 7 deletions(-)

diff --git a/src/util/tests/half_float_test.cpp 
b/src/util/tests/half_float_test.cpp
index 051e0d0376a..5b11f60576d 100644
--- a/src/util/tests/half_float_test.cpp
+++ b/src/util/tests/half_float_test.cpp
@@ -46,18 +46,35 @@ static bool issignaling(float x)
 }
 #endif
 
-/* Sanity test our test values */
-TEST(half_to_float_test, nan_test)
+/* The sign of the bit for signaling is different on some old processors
+ * (PA-RISC, old MIPS without IEEE-754-2008 support).
+ *
+ * Disable the tests on those platforms, because it's not clear how to
+ * correctly handle NaNs when the CPU and GPU differ in their convention.
+ */
+#if DETECT_ARCH_HPPA || ((DETECT_ARCH_MIPS || DETECT_ARCH_MIPS64) && !defined 
__mips_nan2008)
+#define IEEE754_2008_NAN 0
+#else
+#define IEEE754_2008_NAN 1
+#endif
+
+/* Sanity test our inf test values */
+TEST(half_to_float_test, inf_test)
 {
    EXPECT_TRUE(isinf(TEST_POS_INF));
    EXPECT_TRUE(isinf(TEST_NEG_INF));
+}
 
+/* Make sure that our 32-bit float nan test value we're using is a
+ * non-signaling NaN.
+ */
+#if IEEE754_2008_NAN
+TEST(half_to_float_test, nan_test)
+#else
+TEST(half_to_float_test, DISABLED_nan_test)
+#endif
+{
    EXPECT_TRUE(isnan(TEST_NAN));
-   /* Make sure that our 32-bit float nan test value we're using is a
-    * non-signaling NaN.  The sign of the bit for signaling was apparently
-    * different on some old processors (PA-RISC, MIPS?).  This test value 
should
-    * cover Intel, ARM, and PPC, for sure.
-    */
    EXPECT_FALSE(issignaling(TEST_NAN));
 }
 
@@ -82,12 +99,20 @@ test_half_to_float_limits(float (*func)(uint16_t))
 }
 
 /* Test the optionally HW instruction-using path. */
+#if IEEE754_2008_NAN
 TEST(half_to_float_test, half_to_float_test)
+#else
+TEST(half_to_float_test, DISABLED_half_to_float_test)
+#endif
 {
    test_half_to_float_limits(_mesa_half_to_float);
 }
 
+#if IEEE754_2008_NAN
 TEST(half_to_float_test, half_to_float_slow_test)
+#else
+TEST(half_to_float_test, DISABLED_half_to_float_slow_test)
+#endif
 {
    test_half_to_float_limits(_mesa_half_to_float_slow);
 }

Reply via email to