gcc/libgomp/testsuite/libgomp.c/usleep.h
Tobias Burnus cb1a4876a0 testsuite/libgomp.c/usleep.h: Use sleep-loop also for GCN
As typically configured, newlib's libc.a does not build 'posix' and,
hence, usleep is not available. Thus, use the same fallback as for nvptx.

libgomp/
	* testsuite/libgomp.c/usleep.h (fallback_usleep): Renamed from
	nvptx_usleep; use also for device={arch(gcn)}.
2020-11-18 14:11:27 +01:00

26 lines
699 B
C

#include <unistd.h>
int
fallback_usleep (useconds_t d)
{
/* This function serves as a replacement for usleep in
this test case. It does not even attempt to be functionally
equivalent - we just want some sort of delay. */
int i;
int N = d * 2000;
for (i = 0; i < N; i++)
asm volatile ("" : : : "memory");
return 0;
}
#pragma omp declare variant (fallback_usleep) match(construct={target},device={arch(nvptx)})
#pragma omp declare variant (fallback_usleep) match(construct={target},device={arch(gcn)})
#pragma omp declare variant (usleep) match(user={condition(1)})
int
tgt_usleep (useconds_t d)
{
return 0;
}
#pragma omp declare target to (fallback_usleep, tgt_usleep)