1 | // clang-format off |
2 | // |
3 | // RUN: %libomptarget-compileopt-generic -fopenmp-target-jit |
4 | // RUN: env LIBOMPTARGET_JIT_PRE_OPT_IR_MODULE=%t.pre.ll \ |
5 | // RUN: LIBOMPTARGET_JIT_SKIP_OPT=true \ |
6 | // RUN: %libomptarget-run-generic |
7 | // RUN: %fcheck-plain-generic --input-file %t.pre.ll %s |
8 | // |
9 | // clang-format on |
10 | |
11 | // UNSUPPORTED: aarch64-unknown-linux-gnu |
12 | // UNSUPPORTED: aarch64-unknown-linux-gnu-LTO |
13 | // UNSUPPORTED: x86_64-pc-linux-gnu |
14 | // UNSUPPORTED: x86_64-pc-linux-gnu-LTO |
15 | // UNSUPPORTED: s390x-ibm-linux-gnu |
16 | // UNSUPPORTED: s390x-ibm-linux-gnu-LTO |
17 | |
18 | // Ensure that there is only the kernel function left, not any outlined |
19 | // parallel regions. |
20 | // |
21 | // CHECK: define |
22 | // CHECK-NOT: define |
23 | |
24 | #include <omp.h> |
25 | #include <stdio.h> |
26 | |
27 | void f(long *A, int N) { |
28 | long i = 0; |
29 | #pragma omp target map(A[ : N]) |
30 | { |
31 | #pragma omp parallel firstprivate(i) |
32 | A[omp_get_thread_num()] = i; |
33 | #pragma omp parallel firstprivate(i, N) |
34 | A[omp_get_thread_num()] += i + N; |
35 | } |
36 | } |
37 | |
38 | int main() { |
39 | long A[1]; |
40 | f(A: &A[0], N: 1); |
41 | printf(format: "%li\n" , A[0]); |
42 | return 0; |
43 | } |
44 | |