96a71bd53c
2016-03-07 Martin Jambor <mjambor@suse.cz> * testsuite/lib/libgomp.exp (check_effective_target_hsa_offloading_selected_nocache): New. (check_effective_target_hsa_offloading_selected): Likewise. * testsuite/libgomp.hsa.c/c.exp: Likewise. * testsuite/libgomp.hsa.c/alloca-1.c: Likewise. * testsuite/libgomp.hsa.c/bitfield-1.c: Likewise. * testsuite/libgomp.hsa.c/builtins-1.c: Likewise. * testsuite/libgomp.hsa.c/complex-1.c: Likewise. * testsuite/libgomp.hsa.c/formal-actual-args-1.c: Likewise. * testsuite/libgomp.hsa.c/function-call-1.c: Likewise. * testsuite/libgomp.hsa.c/get-level-1.c: Likewise. * testsuite/libgomp.hsa.c/gridify-1.c: Likewise. * testsuite/libgomp.hsa.c/gridify-2.c: Likewise. * testsuite/libgomp.hsa.c/gridify-3.c: Likewise. * testsuite/libgomp.hsa.c/gridify-4.c: Likewise. * testsuite/libgomp.hsa.c/memory-operations-1.c: Likewise. * testsuite/libgomp.hsa.c/pr69568.c: Likewise. * testsuite/libgomp.hsa.c/rotate-1.c: Likewise. * testsuite/libgomp.hsa.c/switch-1.c: Likewise. * testsuite/libgomp.hsa.c/switch-branch-1.c: Likewise. From-SVN: r234047
66 lines
1.2 KiB
C
66 lines
1.2 KiB
C
#include <assert.h>
|
|
#include <complex.h>
|
|
#include <math.h>
|
|
|
|
#define uchar unsigned char
|
|
#define C 123
|
|
|
|
#define TEST(type) \
|
|
type foo_##type (void) \
|
|
{ \
|
|
_Complex type a = C + 45I; \
|
|
return __real__ a; \
|
|
}
|
|
|
|
#pragma omp declare target
|
|
TEST (char)
|
|
TEST (uchar)
|
|
TEST (short)
|
|
TEST (int)
|
|
|
|
float
|
|
bar (float a, float b)
|
|
{
|
|
_Complex float c = a + b * I;
|
|
|
|
c += 11.f + 12.f * I;
|
|
|
|
_Complex float d = 2.f + 4.44f * I;
|
|
|
|
return __real__(crealf (c + d) + cimag (d) * I);
|
|
}
|
|
|
|
#pragma omp end declare target
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
int v = 0;
|
|
float v2 = 0.0f;
|
|
|
|
#pragma omp target map(to: v)
|
|
v = foo_char ();
|
|
|
|
assert (v == C);
|
|
|
|
#pragma omp target map(to: v)
|
|
v = foo_uchar ();
|
|
|
|
assert (v == C);
|
|
|
|
#pragma omp target map(to: v)
|
|
v = foo_short ();
|
|
|
|
assert (v == C);
|
|
|
|
#pragma omp target map(to: v)
|
|
v = foo_int ();
|
|
|
|
assert (v == C);
|
|
|
|
#pragma omp target map(to: v2)
|
|
v2 = bar (1.12f, 4.44f);
|
|
|
|
assert (fabs (v2 - 14.12) < 0.0001f);
|
|
}
|