Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / libomptarget / test / offloading / small_trip_count_thread_limit.cpp
blob9796c2dc11663bc8463e6e94136ba53fec6eaffc
1 // clang-format off
2 // RUN: %libomptarget-compilexx-generic
3 // RUN: env LIBOMPTARGET_INFO=16 \
4 // RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic
6 // UNSUPPORTED: aarch64-unknown-linux-gnu
7 // UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
8 // UNSUPPORTED: x86_64-pc-linux-gnu
9 // UNSUPPORTED: x86_64-pc-linux-gnu-LTO
11 int main(int argc, char *argv[]) {
12 constexpr const int block_size = 256;
13 constexpr const int grid_size = 4;
14 constexpr const int count = block_size * grid_size;
16 int *data = new int[count];
18 #pragma omp target teams distribute parallel for thread_limit(block_size) map(from: data[0:count])
19 for (int i = 0; i < count; ++i)
20 data[i] = i;
22 for (int i = 0; i < count; ++i)
23 if (data[i] != i)
24 return 1;
26 delete[] data;
28 return 0;
31 // CHECK: Launching kernel {{.*}} with 4 blocks and 256 threads in SPMD mode