[RISCV][VLOPT] Add vector narrowing integer right shift instructions to isSupportedIn...
[llvm-project.git] / offload / test / offloading / parallel_offloading_map.cpp
blobd2a6c4200df52c00300120f15a39462e0845561b
1 // RUN: %libomptarget-compilexx-run-and-check-generic
3 // REQUIRES: gpu
5 #include <cassert>
6 #include <iostream>
8 int main(int argc, char *argv[]) {
9 constexpr const int num_threads = 64, N = 128;
10 int array[num_threads] = {0};
12 #pragma omp parallel for
13 for (int i = 0; i < num_threads; ++i) {
14 int tmp[N];
16 for (int j = 0; j < N; ++j) {
17 tmp[j] = i;
20 #pragma omp target teams distribute parallel for map(tofrom : tmp)
21 for (int j = 0; j < N; ++j) {
22 tmp[j] += j;
25 for (int j = 0; j < N; ++j) {
26 array[i] += tmp[j];
30 // Verify
31 for (int i = 0; i < num_threads; ++i) {
32 const int ref = (0 + N - 1) * N / 2 + i * N;
33 assert(array[i] == ref);
36 std::cout << "PASS\n";
38 return 0;
41 // CHECK: PASS