gcc/libgomp/testsuite/libgomp.hsa.c/pr69568.c
Martin Jambor 96a71bd53c [hsa testsuite] New directory for HSA-specific C testcases
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
2016-03-07 19:45:17 +01:00

42 lines
846 B
C

/* PR hsa/69568 */
typedef float float2 __attribute__ ((vector_size (8)));
float2 *output;
void __attribute__((noinline, noclone))
foo (int n, float2 *a, int workgroup_size)
{
int i;
#pragma omp target map(from:a[:n]) firstprivate(n, workgroup_size)
#pragma omp teams thread_limit(workgroup_size)
#pragma omp distribute parallel for shared(a) firstprivate(n) private(i)
for (i = 0; i < n; i++)
{ float2 v;
v[0] = i;
v[1] = 1+i;
a[i] = v;
}
}
int main (int argc, char **argv)
{
int n = 32;
float2 *a = __builtin_malloc (sizeof (float2) * n);
int i;
__builtin_memset (a, 0, sizeof (float2) * n);
foo (n, a, 32);
for (i = 0; i < n; i++)
{
float2 v = a[i];
if (__builtin_abs (v[0] - i) > 0.1
|| __builtin_abs (v[1] - i - 1) > 0.1)
{
__builtin_abort ();
return 1;
}
}
return 0;
}