xref: /llvm-project/flang/test/Lower/OpenMP/Todo/omp-default-clause-inner-loop.f90 (revision 937cbce14c9aa956342a9c818c26a8a557802843)
1! This test checks the lowering of parallel do
2
3! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - \
4! RUN: | FileCheck %s
5
6! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - \
7! RUN: | FileCheck %s
8
9! The string "EXPECTED" denotes the expected FIR
10
11! CHECK: omp.parallel  private(@{{.*}} %{{.*}} -> %[[PRIVATE_Y:.*]], @{{.*}} %{{.*}} -> %[[PRIVATE_Y:.*]] : !fir.ref<i32>, !fir.ref<i32>) {
12! CHECK: %[[TEMP:.*]] = fir.alloca i32 {bindc_name = "x", pinned, {{.*}}}
13! CHECK: %[[const_1:.*]] = arith.constant 1 : i32
14! CHECK: %[[const_2:.*]] = arith.constant 10 : i32
15! CHECK: %[[const_3:.*]] = arith.constant 1 : i32
16! CHECK: omp.wsloop {
17! CHECK-NEXT: omp.loop_nest (%[[ARG:.*]]) : i32 = (%[[const_1]]) to (%[[const_2]]) inclusive step (%[[const_3]]) {
18! CHECK: fir.store %[[ARG]] to %[[TEMP]] : !fir.ref<i32>
19! EXPECTED: %[[temp_1:.*]] = fir.load %[[PRIVATE_Z]] : !fir.ref<i32>
20! CHECK: %[[temp_1:.*]] = fir.load %{{.*}} : !fir.ref<i32>
21! CHECK: %[[temp_2:.*]] = fir.load %[[TEMP]] : !fir.ref<i32>
22! CHECK: %[[result:.*]] = arith.addi %[[temp_1]], %[[temp_2]] : i32
23! EXPECTED: fir.store %[[result]] to %[[PRIVATE_Y]] : !fir.ref<i32>
24! CHECK: fir.store %[[result]] to %{{.*}} : !fir.ref<i32>
25! CHECK: omp.yield
26! CHECK: }
27! CHECK: }
28! CHECK: omp.terminator
29! CHECK: }
30subroutine nested_default_clause()
31	integer x, y, z
32	!$omp parallel do default(private)
33		do x = 1, 10
34			y = z + x
35		enddo
36	!$omp end parallel do
37end subroutine
38