Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / api / is_initial_device.c
blobf1a85fec6403fe35660c4bda56a809dfd3800f4c
1 // RUN: %libomptarget-compile-run-and-check-x86_64-pc-linux-gnu
2 // RUN: %libomptarget-compile-x86_64-pc-linux-gnu -DUNUSED -Wall -Werror
4 // only run for x86_64 host offloading:
5 // REQUIRES: x86_64-pc-linux-gnu
7 #include <omp.h>
8 #include <stdio.h>
10 int main() {
11 int errors = 0;
12 #ifdef UNUSED
13 // Test if it is OK to leave the variants unused in the header
14 #else // UNUSED
15 int host = omp_is_initial_device();
16 int device = 1;
17 #pragma omp target map(tofrom : device)
18 { device = omp_is_initial_device(); }
19 if (!host) {
20 printf("omp_is_initial_device() returned false on host\n");
21 errors++;
23 if (device) {
24 printf("omp_is_initial_device() returned true on device\n");
25 errors++;
27 #endif // UNUSED
29 // CHECK: PASS
30 printf("%s\n", errors ? "FAIL" : "PASS");
32 return errors;