Hi FX,
On 20.08.23 21:37, FX Coudert wrote:
testsuite/libgomp.c/simd-math-1.c calls nonstandard functions that are not 
available on darwin (and possibly other systems?).

Namely:

* "gamma" which has been repaced by tgamma and lgamma as BSD's gamma ==
tgamma while glibc's gamma == lgamma.

* __builtin_scalb{,f,l} – where "scalb" (only double version) was in
POSIX.1-2001 but was replaced in favour of scalb{l,}n{,f,l} which take
an int/long instead of a floating point number for the exponent argument
(2nd arg).

* __builtin_significand{,f,l} – where the man page states: "This
function exists mainly for use in certain standardized tests for IEEE
754 conformance." and "These functions are nonstandard; the double
version is available on a number of other systems."

(BTW: The testcase does not test the long-double versions – which makes
sense as it evolved as nvptx/gcn SIMD test.)

* * *

Looking at the testcase, I wonder:

(a) why there is no test for scalb[l,}n{,f,l} (= scalb* but with int or
long as second argument for 'exp'). (Requires a new macro taking a
second type.)

(b) whether the tgamma test shouldn't be only TEST_FUN_XFAIL for '#if
defined(__AMDGCN__) || defined(__nvptx__)' and TEST_FUN otherwise. Other
platforms could then still add themselves to XFAIL as needed.

Because I did not want to disable their testing completely, I suggest we simply 
use preprocessor macros to avoid them on darwin.
That makes sense.
This fixes the test failure on aarch64-apple-darwin.
OK to commit?

OK. — I'd prefer if you also changed + tested a fix for my (a) + (b)
remarks, but as those are unrelated, I understand if you don't and just
commit your Darwin patch.

Thanks,

Tobias

 From bc7f4862b9301c9490c7e80a58aa21c7a9727bcd Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert<fxcoud...@gmail.com>
Date: Sun, 20 Aug 2023 21:32:18 +0200
Subject: [PATCH] libgomp, testsuite: Do not call nonstandard functions on
  darwin

The following functions are not standard, and not always available on
darwin. They should not be called there: gamma, gammaf, scalb, scalbf,
significand, and significandf.

libgomp/ChangeLog:

      * testsuite/libgomp.c/simd-math-1.c: Avoid calling nonstandard
      functions on darwin.
---
  libgomp/testsuite/libgomp.c/simd-math-1.c | 8 ++++++++
  1 file changed, 8 insertions(+)

diff --git a/libgomp/testsuite/libgomp.c/simd-math-1.c 
b/libgomp/testsuite/libgomp.c/simd-math-1.c
index dd2077cc597..b6127c118d1 100644
--- a/libgomp/testsuite/libgomp.c/simd-math-1.c
+++ b/libgomp/testsuite/libgomp.c/simd-math-1.c
@@ -160,7 +160,9 @@ int main (void)
    TEST_FUN (float, -10.0, 10.0, expf);
    TEST_FUN (float, -10.0, 10.0, exp2f);
    TEST_FUN2 (float, -10.0, 10.0, 100.0, -25.0, fmodf);
+#if !defined(__APPLE__)
    TEST_FUN (float, -10.0, 10.0, gammaf);
+#endif
    TEST_FUN2 (float, -10.0, 10.0, 15.0, -5.0,hypotf);
    TEST_FUN (float, -10.0, 10.0, lgammaf);
    TEST_FUN (float, -1.0, 50.0, logf);
@@ -169,8 +171,10 @@ int main (void)
    TEST_FUN2 (float, -100.0, 100.0, 100.0, -100.0, powf);
    TEST_FUN2 (float, -50.0, 100.0, -2.0, 40.0, remainderf);
    TEST_FUN (float, -50.0, 50.0, rintf);
+#if !defined(__APPLE__)
    TEST_FUN2 (float, -50.0, 50.0, -10.0, 32.0, __builtin_scalbf);
    TEST_FUN (float, -10.0, 10.0, __builtin_significandf);
+#endif
    TEST_FUN (float, -3.14159265359, 3.14159265359, sinf);
    TEST_FUN (float, -3.14159265359, 3.14159265359, sinhf);
    TEST_FUN (float, -0.1, 10000.0, sqrtf);
@@ -193,7 +197,9 @@ int main (void)
    TEST_FUN (double, -10.0, 10.0, exp);
    TEST_FUN (double, -10.0, 10.0, exp2);
    TEST_FUN2 (double, -10.0, 10.0, 100.0, -25.0, fmod);
+#if !defined(__APPLE__)
    TEST_FUN (double, -10.0, 10.0, gamma);
+#endif
    TEST_FUN2 (double, -10.0, 10.0, 15.0, -5.0, hypot);
    TEST_FUN (double, -10.0, 10.0, lgamma);
    TEST_FUN (double, -1.0, 50.0, log);
@@ -202,8 +208,10 @@ int main (void)
    TEST_FUN2 (double, -100.0, 100.0, 100.0, -100.0, pow);
    TEST_FUN2 (double, -50.0, 100.0, -2.0, 40.0, remainder);
    TEST_FUN (double, -50.0, 50.0, rint);
+#if !defined(__APPLE__)
    TEST_FUN2 (double, -50.0, 50.0, -10.0, 32.0, __builtin_scalb);
    TEST_FUN (double, -10.0, 10.0, __builtin_significand);
+#endif
    TEST_FUN (double, -3.14159265359, 3.14159265359, sin);
    TEST_FUN (double, -3.14159265359, 3.14159265359, sinh);
    TEST_FUN (double, -0.1, 10000.0, sqrt);
-- 2.39.2 (Apple Git-143)
Attachments:

0001-libgomp-testsuite-Do-not-call-nonstandard-functions-.patch       2,6 KB

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955

Reply via email to