Module: Mesa
Branch: staging/23.3
Commit: 685cc5f6f2dac0b4fda7d209252dd7d1a2ab34b2
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=685cc5f6f2dac0b4fda7d209252dd7d1a2ab34b2

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>
(cherry picked from commit 5b7c73390247caa847c56c442298107a1e568a6d)

---

 .pick_status.json                  |  2 +-
 src/util/tests/half_float_test.cpp | 39 +++++++++++++++++++++++++++++++-------
 2 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 9fc93a99059..49e74ac2ae7 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -504,7 +504,7 @@
         "description": "util/tests: Disable half-float NaN test on 
hppa/old-mips",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "067023dce2cae5ef44d2b8cd52a81aa880256037",
         "notes": null
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