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
51 lines
818 B
C
51 lines
818 B
C
#define size 8
|
|
|
|
#pragma omp declare target
|
|
int
|
|
identity (int x)
|
|
{
|
|
return x;
|
|
}
|
|
|
|
int
|
|
expx (int x, int n)
|
|
{
|
|
for (int i = 0; i < n - 1; i++)
|
|
x *= x;
|
|
|
|
return x;
|
|
}
|
|
|
|
float
|
|
init (int x, int y)
|
|
{
|
|
int x1 = identity (identity (identity (identity (x))));
|
|
int y1 = identity (identity (identity (identity (y))));
|
|
|
|
int x2 = expx (x1, 2);
|
|
int y2 = expx (y1, 2);
|
|
|
|
return (x2 + y2);
|
|
}
|
|
#pragma omp end declare target
|
|
|
|
int
|
|
main ()
|
|
{
|
|
int i, j;
|
|
int a[size][size];
|
|
|
|
#pragma omp target teams map(to:a[:size][:size])
|
|
#pragma omp distribute parallel for default(none) private(i, j) shared(a)
|
|
for (i = 0; i < size; ++i)
|
|
for (j = 0; j < size; ++j)
|
|
a[i][j] = init (i, j);
|
|
|
|
for (i = 0; i < size; ++i)
|
|
for (j = 0; j < size; ++j)
|
|
if (i * i + j * j != a[i][j])
|
|
__builtin_abort ();
|
|
|
|
return 0;
|
|
}
|