aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.oacc-c-c++-common/subr.h
blob: 9db236c836292ef121d650bdca01187444717315 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

#if ACC_DEVICE_TYPE_nvidia

#pragma acc routine nohost
static int clock (void)
{
  int thetime;

  asm __volatile__ ("mov.u32 %0, %%clock;" : "=r"(thetime));

  return thetime;
}

#endif

void
delay (unsigned long *d_o, unsigned long delay)
{
  int start, ticks;

  start = clock ();

  ticks = 0;

  while (ticks < delay)
    ticks = clock () - start;

  return;
}

void
delay2 (unsigned long *d_o, unsigned long delay, unsigned long tid)
{
  int start, ticks;

  start = clock ();

  ticks = 0;

  while (ticks < delay)
    ticks = clock () - start;

  d_o[0] = tid;

  return;
}