gcc/libgomp/testsuite/libgomp.c/examples-4/device-1.c
Martin Jambor 02e0b5b245 [hsa testsuite] Adjust libgomp tests that do not work on host fallback
2016-03-07  Martin Jambor  <mjambor@suse.cz>

	* testsuite/libgomp.c/examples-4/async_target-2.c: Only run on
	non-shared memory accelerators.
	* testsuite/libgomp.c/examples-4/device-1.c: Likewise.
	* testsuite/libgomp.c/examples-4/target-5.c: Likewise.
	* testsuite/libgomp.c/examples-4/target_data-6.c: Likewise.
	* testsuite/libgomp.c/examples-4/target_data-7.c: Likewise.
	* testsuite/libgomp.fortran/examples-4/async_target-2.f90: Likewise.
	* testsuite/libgomp.fortran/examples-4/device-1.f90: Likewise.
	* testsuite/libgomp.fortran/examples-4/target-5.f90: Likewise.
	* testsuite/libgomp.fortran/examples-4/target_data-6.f90: Likewise.
	* testsuite/libgomp.fortran/examples-4/target_data-7.f90: Likewise.

From-SVN: r234046
2016-03-07 19:42:33 +01:00

60 lines
1.1 KiB
C

/* { dg-do run } */
/* { dg-require-effective-target offload_device_nonshared_as } */
#include <omp.h>
#include <stdlib.h>
int main ()
{
int a = 100;
int b = 0;
int c, d;
#pragma omp target if(a > 200 && a < 400) map(from: c)
c = omp_is_initial_device ();
#pragma omp target data map(to: b) if(a > 200 && a < 400)
#pragma omp target map(from: b, d)
{
b = 100;
d = omp_is_initial_device ();
}
if (b != 100 || !c || d)
abort ();
a += 200;
b = 0;
#pragma omp target if(a > 200 && a < 400) map(from: c)
c = omp_is_initial_device ();
#pragma omp target data map(to: b) if(a > 200 && a < 400)
#pragma omp target map(from: b, d)
{
b = 100;
d = omp_is_initial_device ();
}
if (b != 0 || c || d)
abort ();
a += 200;
b = 0;
#pragma omp target if(a > 200 && a < 400) map(from: c)
c = omp_is_initial_device ();
#pragma omp target data map(to: b) if(a > 200 && a < 400)
#pragma omp target map(from: b, d)
{
b = 100;
d = omp_is_initial_device ();
}
if (b != 100 || !c || d)
abort ();
return 0;
}