aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libgomp/testsuite/lib/libgomp.exp19
-rw-r--r--libgomp/testsuite/libgomp.c/simd-math-1.c9
2 files changed, 28 insertions, 0 deletions
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 2f9e538..a143b5d 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -377,6 +377,25 @@ proc offload_target_to_openacc_device_type { offload_target } {
}
}
+# Return 1 if certain nonstandard math functions are available
+# on the target: gamma, scalb, significand, and their float variants.
+proc check_effective_target_nonstandard_math_functions { } {
+ return [check_no_compiler_messages nonstandard_math_functions executable {
+ #include <math.h>
+ int main() {
+ float x = 42;
+ double y = 42;
+ x = gammaf (x);
+ x = __builtin_scalbf (x, 2.f);
+ x =__builtin_significandf (x);
+ y = gamma (y);
+ y = __builtin_scalb (y, 2.);
+ y =__builtin_significand (y);
+ return 0;
+ }
+ } "-lm" ]
+}
+
# Return 1 if compiling for the specified offload target
# Takes -foffload=... into account by checking OFFLOAD_TARGET_NAMES=
# in the -v compiler output.
diff --git a/libgomp/testsuite/libgomp.c/simd-math-1.c b/libgomp/testsuite/libgomp.c/simd-math-1.c
index dd2077c..42a008c 100644
--- a/libgomp/testsuite/libgomp.c/simd-math-1.c
+++ b/libgomp/testsuite/libgomp.c/simd-math-1.c
@@ -4,6 +4,7 @@
/* { dg-do run } */
/* { dg-options "-O2 -ftree-vectorize -fno-math-errno" } */
/* { dg-additional-options -foffload-options=amdgcn-amdhsa=-mstack-size=3000000 { target offload_target_amdgcn } } */
+/* { dg-additional-options "-DNONSTDFUNC=1" { target nonstandard_math_functions } } */
#undef PRINT_RESULT
#define VERBOSE 0
@@ -160,7 +161,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);
+#ifdef NONSTDFUNC
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 +172,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);
+#ifdef NONSTDFUNC
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 +198,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);
+#ifdef NONSTDFUNC
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 +209,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);
+#ifdef NONSTDFUNC
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);