1 // RUN: %libomptarget-compilexx-run-and-check-aarch64-unknown-linux-gnu
2 // RUN: %libomptarget-compilexx-run-and-check-powerpc64-ibm-linux-gnu
3 // RUN: %libomptarget-compilexx-run-and-check-powerpc64le-ibm-linux-gnu
4 // RUN: %libomptarget-compilexx-run-and-check-x86_64-pc-linux-gnu
5 
6 #include <stdio.h>
7 #include <omp.h>
8 
9 int main(void) {
10   int isHost = 0;
11 
12 #pragma omp target map(from: isHost)
13   { isHost = omp_is_initial_device(); }
14 
15   if (isHost < 0) {
16     printf("Runtime error, isHost=%d\n", isHost);
17   }
18 
19   // CHECK: Target region executed on the device
20   printf("Target region executed on the %s\n", isHost ? "host" : "device");
21 
22   return isHost;
23 }
24