Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / api / omp_dynamic_shared_memory.c
blob76f625f07bfaf3ad6cff43f918cb1146ebd2866e
1 // RUN: %libomptarget-compile-generic
2 // RUN: env LIBOMPTARGET_SHARED_MEMORY_SIZE=256 \
3 // RUN: %libomptarget-run-generic | %fcheck-generic
5 // RUN: %libomptarget-compileopt-generic
6 // RUN: env LIBOMPTARGET_SHARED_MEMORY_SIZE=256 \
7 // RUN: %libomptarget-run-generic | %fcheck-generic
9 // REQUIRES: gpu
11 #include <omp.h>
12 #include <stdio.h>
14 int main() {
15 int x;
16 #pragma omp target parallel map(from : x)
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;
27 // CHECK: PASS
28 if (x == 1 && llvm_omp_target_dynamic_shared_alloc() == NULL)
29 printf("PASS\n");