PR tree-optimization/87009
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / acc_on_device-1.c
blob8112745bcb86077c17e5259963aec6957d8ee479
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" } */
5 #include <stdlib.h>
6 #include <openacc.h>
8 int
9 main (int argc, char *argv[])
11 /* Host. */
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 ();
25 /* Host via offloading fallback mode. */
27 #pragma acc parallel if(0)
29 if (!acc_on_device (acc_device_none))
30 abort ();
31 if (!acc_on_device (acc_device_host))
32 abort ();
33 if (acc_on_device (acc_device_not_host))
34 abort ();
35 if (acc_on_device (acc_device_nvidia))
36 abort ();
40 #if !ACC_DEVICE_TYPE_host
42 /* Offloaded. */
44 #pragma acc parallel
46 if (acc_on_device (acc_device_none))
47 abort ();
48 if (acc_on_device (acc_device_host))
49 abort ();
50 if (!acc_on_device (acc_device_not_host))
51 abort ();
52 #if ACC_DEVICE_TYPE_nvidia
53 if (!acc_on_device (acc_device_nvidia))
54 abort ();
55 #else
56 if (acc_on_device (acc_device_nvidia))
57 abort ();
58 #endif
61 #endif
63 return 0;