Skip to content
Snippets Groups Projects
Commit 0ccfbe64 authored by Francois-Xavier Coudert's avatar Francois-Xavier Coudert Committed by Francois-Xavier Coudert
Browse files

libgomp, testsuite: Do not call nonstandard functions

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

libgomp/ChangeLog:

	* testsuite/lib/libgomp.exp: Add effective target.
	* testsuite/libgomp.c/simd-math-1.c: Avoid calling nonstandard
	functions.
parent 3242fb53
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment