1 // RUN: %libomptarget-compile-generic 2 // RUN: env LIBOMPTARGET_SHARED_MEMORY_SIZE=256 \ 3 // RUN: %libomptarget-run-generic | %fcheck-generic 4 5 // RUN: %libomptarget-compileopt-generic 6 // RUN: env LIBOMPTARGET_SHARED_MEMORY_SIZE=256 \ 7 // RUN: %libomptarget-run-generic | %fcheck-generic 8 9 // REQUIRES: gpu 10 11 #include <omp.h> 12 #include <stdio.h> 13 main()14int main() { 15 int x; 16 #pragma omp target parallel map(from : x) 17 { 18 int *buf = llvm_omp_target_dynamic_shared_alloc() + 252; 19 #pragma omp barrier 20 if (omp_get_thread_num() == 0) 21 *buf = 1; 22 #pragma omp barrier 23 if (omp_get_thread_num() == 1) 24 x = *buf; 25 } 26 27 // CHECK: PASS 28 if (x == 1 && llvm_omp_target_dynamic_shared_alloc() == NULL) 29 printf("PASS\n"); 30 } 31