Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / libomptarget / test / offloading / parallel_target_teams_reduction.cpp
blob5303a9463f155161aeb232c35492583353a47d4c
1 // RUN: %libomptarget-compilexx-run-and-check-generic
2 // RUN: %libomptarget-compileoptxx-run-and-check-generic
4 // FIXME: This is a bug in host offload, this should run fine.
5 // UNSUPPORTED: aarch64-unknown-linux-gnu
6 // UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
7 // UNSUPPORTED: x86_64-pc-linux-gnu
8 // UNSUPPORTED: x86_64-pc-linux-gnu-LTO
10 #include <iostream>
11 #include <vector>
13 #define N 8
15 int main() {
16 std::vector<int> avec(N);
17 int *a = avec.data();
18 #pragma omp parallel for
19 for (int i = 0; i < N; i++) {
20 a[i] = 0;
21 #pragma omp target teams distribute parallel for reduction(+ : a[i])
22 for (int j = 0; j < N; j++)
23 a[i] += 1;
26 // CHECK: 8
27 // CHECK: 8
28 // CHECK: 8
29 // CHECK: 8
30 // CHECK: 8
31 // CHECK: 8
32 // CHECK: 8
33 // CHECK: 8
34 for (int i = 0; i < N; i++)
35 std::cout << a[i] << std::endl;