1// clang-format off
2// RUN: %libomptarget-compile-generic
3// RUN: env LIBOMPTARGET_INFO=16 \
4// RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefix=DEFAULT
5// RUN: env LIBOMPTARGET_INFO=16 LIBOMPTARGET_MIN_THREADS_FOR_LOW_TRIP_COUNT=8 \
6// RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefix=EIGHT
7
8// UNSUPPORTED: aarch64-unknown-linux-gnu
9// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
10// UNSUPPORTED: x86_64-pc-linux-gnu
11// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
12// UNSUPPORTED: s390x-ibm-linux-gnu
13// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
14
15#define N 128
16
17__attribute__((optnone)) void optnone() {}
18
19int main() {
20 // DEFAULT: Launching kernel {{.+_main_.+}} with 4 blocks and 32 threads in SPMD mode
21 // EIGHT: Launching kernel {{.+_main_.+}} with 16 blocks and 8 threads in SPMD mode
22#pragma omp target teams distribute parallel for simd
23 for (int i = 0; i < N; ++i) {
24 optnone();
25 }
26 // DEFAULT: Launching kernel {{.+_main_.+}} with 4 blocks and 32 threads in SPMD mode
27 // EIGHT: Launching kernel {{.+_main_.+}} with 16 blocks and 8 threads in SPMD mode
28#pragma omp target teams distribute parallel for simd
29 for (int i = 0; i < N - 1; ++i) {
30 optnone();
31 }
32 // DEFAULT: Launching kernel {{.+_main_.+}} with 5 blocks and 32 threads in SPMD mode
33 // EIGHT: Launching kernel {{.+_main_.+}} with 17 blocks and 8 threads in SPMD mode
34#pragma omp target teams distribute parallel for simd
35 for (int i = 0; i < N + 1; ++i) {
36 optnone();
37 }
38 // DEFAULT: Launching kernel {{.+_main_.+}} with 32 blocks and 4 threads in SPMD mode
39 // EIGHT: Launching kernel {{.+_main_.+}} with 32 blocks and 4 threads in SPMD mode
40#pragma omp target teams distribute parallel for simd thread_limit(4)
41 for (int i = 0; i < N; ++i) {
42 optnone();
43 }
44}
45
46

source code of offload/test/offloading/small_trip_count.c