1 // RUN: %libomptarget-compile-generic -DLIBRARY -c -o %t.o 2 // RUN: llvm-ar rcs %t.a %t.o 3 // RUN: %libomptarget-compile-generic %t.a && %libomptarget-run-generic 2>&1 | %fcheck-generic 4 5 // REQUIRES: nvptx64-nvidia-cuda-newDriver 6 // REQUIRES: amdgcn-amd-amdhsa-newDriver 7 8 #ifdef LIBRARY 9 int x = 42; 10 #pragma omp declare target(x) 11 12 int foo() { 13 int value; 14 #pragma omp target map(from : value) 15 value = x; 16 return value; 17 } 18 #else 19 #include <stdio.h> 20 int foo(); 21 22 int main() { 23 int x = foo(); 24 25 // CHECK: PASS 26 if (x == 42) 27 printf("PASS\n"); 28 } 29 #endif 30