1 // RUN: %libomptarget-compile-run-and-check-aarch64-unknown-linux-gnu
2 // RUN: %libomptarget-compile-run-and-check-powerpc64-ibm-linux-gnu
3 // RUN: %libomptarget-compile-run-and-check-powerpc64le-ibm-linux-gnu
4 // RUN: %libomptarget-compile-run-and-check-x86_64-pc-linux-gnu
5 // RUN: %libomptarget-compile-run-and-check-nvptx64-nvidia-cuda
6 
7 #include <assert.h>
8 #include <stdio.h>
9 
main()10 int main() {
11   int data1[3] = {1}, data2[3] = {2}, data3[3] = {3};
12   int sum[16] = {0};
13 #pragma omp target teams distribute parallel for map(tofrom                    \
14                                                      : sum)                    \
15     firstprivate(data1, data2, data3)
16   for (int i = 0; i < 16; ++i) {
17     for (int j = 0; j < 3; ++j) {
18       sum[i] += data1[j];
19       sum[i] += data2[j];
20       sum[i] += data3[j];
21     }
22   }
23 
24   for (int i = 0; i < 16; ++i) {
25     assert(sum[i] == 6);
26   }
27 
28   printf("PASS\n");
29 
30   return 0;
31 }
32 
33 // CHECK: PASS
34