1 /* Disable the acc_on_device builtin; we want to test the libgomp library
2 function. */
3 /* { dg-additional-options "-fno-builtin-acc_on_device" } */
4
5 #include <stdlib.h>
6 #include <openacc.h>
7
8 int
9 main (int argc, char *argv[])
10 {
11 /* Host. */
12
13 {
14 if (!acc_on_device (acc_device_none))
15 abort ();
16 if (!acc_on_device (acc_device_host))
17 abort ();
18 if (acc_on_device (acc_device_not_host))
19 abort ();
20 if (acc_on_device (acc_device_nvidia))
21 abort ();
22 if (acc_on_device (acc_device_radeon))
23 abort ();
24 }
25
26
27 /* Host via offloading fallback mode. */
28
29 #pragma acc parallel if(0)
30 {
31 if (!acc_on_device (acc_device_none))
32 abort ();
33 if (!acc_on_device (acc_device_host))
34 abort ();
35 if (acc_on_device (acc_device_not_host))
36 abort ();
37 if (acc_on_device (acc_device_nvidia))
38 abort ();
39 if (acc_on_device (acc_device_radeon))
40 abort ();
41 }
42
43
44 #if !ACC_DEVICE_TYPE_host
45
46 /* Offloaded. */
47
48 #pragma acc parallel
49 {
50 if (acc_on_device (acc_device_none))
51 abort ();
52 if (acc_on_device (acc_device_host))
53 abort ();
54 if (!acc_on_device (acc_device_not_host))
55 abort ();
56 #if ACC_DEVICE_TYPE_nvidia
57 if (!acc_on_device (acc_device_nvidia))
58 abort ();
59 #else
60 if (acc_on_device (acc_device_nvidia))
61 abort ();
62 #endif
63 #if ACC_DEVICE_TYPE_radeon
64 if (!acc_on_device (acc_device_radeon))
65 abort ();
66 #else
67 if (acc_on_device (acc_device_radeon))
68 abort ();
69 #endif
70 }
71
72 #endif
73
74 return 0;
75 }