[RISCV][VLOPT] Add vector narrowing integer right shift instructions to isSupportedIn...
[llvm-project.git] / offload / test / offloading / target_critical_region.cpp
blob0b97823e266b29c36c770bdaac57a361675e413b
1 // RUN: %libomptarget-compilexx-run-and-check-generic
3 // REQUIRES: gpu
4 // UNSUPPORTED: nvptx64-nvidia-cuda
5 // UNSUPPORTED: nvptx64-nvidia-cuda-LTO
6 // UNSUPPORTED: amdgcn-amd-amdhsa
8 #include <omp.h>
9 #include <stdio.h>
11 #define N 1000000
13 int A[N];
14 int main() {
15 for (int i = 0; i < N; i++)
16 A[i] = 1;
18 int sum[1];
19 sum[0] = 0;
21 #pragma omp target teams distribute parallel for num_teams(256) \
22 schedule(static, 1) map(to \
23 : A[:N]) map(tofrom \
24 : sum[:1])
26 for (int i = 0; i < N; i++) {
27 #pragma omp critical
28 { sum[0] += A[i]; }
32 // CHECK: SUM = 1000000
33 printf("SUM = %d\n", sum[0]);
35 return 0;