usleep.h 699 B

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