| 1 |
#include <unistd.h> |
| 2 |
|
| 3 |
int |
| 4 |
fallback_usleep (useconds_t d) |
| 5 |
{ |
| 6 |
/* This function serves as a replacement for usleep in |
| 7 |
this test case. It does not even attempt to be functionally |
| 8 |
equivalent - we just want some sort of delay. */ |
| 9 |
int i; |
| 10 |
int N = d * 2000; |
| 11 |
for (i = 0; i < N; i++) |
| 12 |
asm volatile ("" : : : "memory"); |
| 13 |
return 0; |
| 14 |
} |
| 15 |
|
| 16 |
#pragma omp declare variant (fallback_usleep) match(construct={target},device={arch(nvptx)}) |
| 17 |
#pragma omp declare variant (fallback_usleep) match(construct={target},device={arch(gcn)}) |
| 18 |
#pragma omp declare variant (usleep) match(user={condition(1)}) |
| 19 |
int |
| 20 |
tgt_usleep (useconds_t d) |
| 21 |
{ |
| 22 |
return 0; |
| 23 |
} |
| 24 |
|
| 25 |
#pragma omp declare target to (fallback_usleep, tgt_usleep) |