CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
306 lines
14 KiB
Fortran
306 lines
14 KiB
Fortran
! This test checks lowering of `LASTPRIVATE` clause for scalar types.
|
|
|
|
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
|
|
! RUN: %flang_fc1 -fopenmp -emit-hlfir %s -o - | FileCheck %s
|
|
|
|
!CHECK: func @_QPlastprivate_character(%[[ARG1:.*]]: !fir.boxchar<1>{{.*}}) {
|
|
!CHECK-DAG: %[[ARG1_UNBOX:.*]]:2 = fir.unboxchar
|
|
!CHECK-DAG: %[[FIVE:.*]] = arith.constant 5 : index
|
|
!CHECK-DAG: %[[ARG1_REF:.*]] = fir.convert %[[ARG1_UNBOX]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.char<1,5>>
|
|
!CHECK-DAG: %[[ARG1_DECL:.*]]:2 = hlfir.declare %[[ARG1_REF]] typeparams %[[FIVE]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFlastprivate_characterEarg1"} : (!fir.ref<!fir.char<1,5>>, index, !fir.dscope) -> (!fir.ref<!fir.char<1,5>>, !fir.ref<!fir.char<1,5>>)
|
|
|
|
!CHECK: omp.parallel {
|
|
|
|
! Check that we are accessing the clone inside the loop
|
|
!CHECK: omp.wsloop private(@{{.*}} %{{.*}}#0 -> %[[ARG1_PVT:.*]], @{{.*}} %{{.*}}#0 -> %{{.*}} : !fir.ref<!fir.char<1,5>>, !{{.*}}) {
|
|
!CHECK-NEXT: omp.loop_nest (%[[INDX_WS:.*]]) : {{.*}} {
|
|
!CHECK: %[[FIVE:.*]] = arith.constant 5 : index
|
|
!CHECK: %[[ARG1_PVT_DECL:.*]]:2 = hlfir.declare %[[ARG1_PVT]] typeparams %[[FIVE]] {uniq_name = "_QFlastprivate_characterEarg1"} : (!fir.ref<!fir.char<1,5>>, index) -> (!fir.ref<!fir.char<1,5>>, !fir.ref<!fir.char<1,5>>)
|
|
!CHECK: %[[UNIT:.*]] = arith.constant 6 : i32
|
|
!CHECK-NEXT: %[[ADDR:.*]] = fir.address_of(@_QQclX
|
|
!CHECK-NEXT: %[[CVT0:.*]] = fir.convert %[[ADDR]]
|
|
!CHECK-NEXT: %[[CNST:.*]] = arith.constant
|
|
!CHECK-NEXT: %[[CALL_BEGIN_IO:.*]] = fir.call @_FortranAioBeginExternalListOutput(%[[UNIT]], %[[CVT0]], %[[CNST]]) {{.*}}: (i32, !fir.ref<i8>, i32) -> !fir.ref<i8>
|
|
!CHECK-NEXT: %[[CVT_0_1:.*]] = fir.convert %[[ARG1_PVT_DECL]]#0
|
|
!CHECK-NEXT: %[[CVT_0_2:.*]] = fir.convert %[[FIVE]]
|
|
!CHECK-NEXT: %[[CALL_OP_ASCII:.*]] = fir.call @_FortranAioOutputAscii(%[[CALL_BEGIN_IO]], %[[CVT_0_1]], %[[CVT_0_2]])
|
|
!CHECK-NEXT: %[[CALL_END_IO:.*]] = fir.call @_FortranAioEndIoStatement(%[[CALL_BEGIN_IO]])
|
|
|
|
! Testing last iteration check
|
|
!CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32
|
|
!CHECK: %[[C0:.*]] = arith.constant 0 : i32
|
|
!CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32
|
|
!CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32
|
|
!CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32
|
|
!CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1
|
|
!CHECK: fir.if %[[IV_CMP]] {
|
|
!CHECK: hlfir.assign %[[V]] to %{{.*}} : i32, !fir.ref<i32>
|
|
|
|
! Testing lastprivate val update
|
|
!CHECK: hlfir.assign %[[ARG1_PVT_DECL]]#0 to %[[ARG1_DECL]]#0 : !fir.ref<!fir.char<1,5>>, !fir.ref<!fir.char<1,5>>
|
|
!CHECK: }
|
|
!CHECK: omp.yield
|
|
!CHECK: }
|
|
!CHECK: }
|
|
|
|
subroutine lastprivate_character(arg1)
|
|
character(5) :: arg1
|
|
!$OMP PARALLEL
|
|
!$OMP DO LASTPRIVATE(arg1)
|
|
do n = 1, 5
|
|
arg1(n:n) = 'c'
|
|
print *, arg1
|
|
end do
|
|
!$OMP END DO
|
|
!$OMP END PARALLEL
|
|
end subroutine
|
|
|
|
!CHECK: func @_QPlastprivate_int(%[[ARG1:.*]]: !fir.ref<i32> {fir.bindc_name = "arg1"}) {
|
|
!CHECK: %[[ARG1_DECL:.*]]:2 = hlfir.declare %[[ARG1]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFlastprivate_intEarg1"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
!CHECK-DAG: omp.parallel {
|
|
!CHECK: omp.wsloop private(@{{.*}} %{{.*}}#0 -> %[[CLONE:.*]], @{{.*}} %{{.*}}#0 -> %{{.*}} : !fir.ref<i32>, !{{.*}}) {
|
|
!CHECK-NEXT: omp.loop_nest (%[[INDX_WS:.*]]) : {{.*}} {
|
|
!CHECK: %[[CLONE_DECL:.*]]:2 = hlfir.declare %[[CLONE]] {uniq_name = "_QFlastprivate_intEarg1"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
|
|
! Testing last iteration check
|
|
!CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32
|
|
!CHECK: %[[C0:.*]] = arith.constant 0 : i32
|
|
!CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32
|
|
!CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32
|
|
!CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32
|
|
!CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1
|
|
!CHECK: fir.if %[[IV_CMP]] {
|
|
!CHECK: hlfir.assign %[[V]] to %{{.*}} : i32, !fir.ref<i32>
|
|
|
|
! Testing lastprivate val update
|
|
!CHECK-NEXT: %[[CLONE_LD:.*]] = fir.load %[[CLONE_DECL]]#0 : !fir.ref<i32>
|
|
!CHECK: hlfir.assign %[[CLONE_LD]] to %[[ARG1_DECL]]#0 : i32, !fir.ref<i32>
|
|
!CHECK: }
|
|
!CHECK: omp.yield
|
|
!CHECK: }
|
|
!CHECK: }
|
|
|
|
subroutine lastprivate_int(arg1)
|
|
integer :: arg1
|
|
!$OMP PARALLEL
|
|
!$OMP DO LASTPRIVATE(arg1)
|
|
do n = 1, 5
|
|
arg1 = 2
|
|
print *, arg1
|
|
end do
|
|
!$OMP END DO
|
|
!$OMP END PARALLEL
|
|
print *, arg1
|
|
end subroutine
|
|
|
|
!CHECK: func.func @_QPmult_lastprivate_int(%[[ARG1:.*]]: !fir.ref<i32> {fir.bindc_name = "arg1"}, %[[ARG2:.*]]: !fir.ref<i32> {fir.bindc_name = "arg2"}) {
|
|
!CHECK: %[[ARG1_DECL:.*]]:2 = hlfir.declare %[[ARG1]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFmult_lastprivate_intEarg1"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
!CHECK: %[[ARG2_DECL:.*]]:2 = hlfir.declare %[[ARG2]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFmult_lastprivate_intEarg2"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
!CHECK: omp.parallel {
|
|
!CHECK: omp.wsloop private(@{{.*}} %{{.*}}#0 -> %[[CLONE1:.*]], @{{.*}} %{{.*}}#0 -> %[[CLONE2:.*]], @{{.*}} %{{.*}}#0 -> %{{.*}} : !fir.ref<i32>, !fir.ref<i32>, !{{.*}}) {
|
|
!CHECK-NEXT: omp.loop_nest (%[[INDX_WS:.*]]) : {{.*}} {
|
|
!CHECK-DAG: %[[CLONE1_DECL:.*]]:2 = hlfir.declare %[[CLONE1]] {uniq_name = "_QFmult_lastprivate_intEarg1"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
!CHECK-DAG: %[[CLONE2_DECL:.*]]:2 = hlfir.declare %[[CLONE2]] {uniq_name = "_QFmult_lastprivate_intEarg2"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
|
|
! Testing last iteration check
|
|
!CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32
|
|
!CHECK: %[[C0:.*]] = arith.constant 0 : i32
|
|
!CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32
|
|
!CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32
|
|
!CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32
|
|
!CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1
|
|
!CHECK: fir.if %[[IV_CMP]] {
|
|
!CHECK: hlfir.assign %[[V]] to %{{.*}} : i32, !fir.ref<i32>
|
|
! Testing lastprivate val update
|
|
!CHECK-DAG: %[[CLONE_LD1:.*]] = fir.load %[[CLONE1_DECL]]#0 : !fir.ref<i32>
|
|
!CHECK-DAG: hlfir.assign %[[CLONE_LD1]] to %[[ARG1_DECL]]#0 : i32, !fir.ref<i32>
|
|
!CHECK-DAG: %[[CLONE_LD2:.*]] = fir.load %[[CLONE2_DECL]]#0 : !fir.ref<i32>
|
|
!CHECK-DAG: hlfir.assign %[[CLONE_LD2]] to %[[ARG2_DECL]]#0 : i32, !fir.ref<i32>
|
|
!CHECK: }
|
|
!CHECK: omp.yield
|
|
!CHECK: }
|
|
!CHECK: }
|
|
|
|
subroutine mult_lastprivate_int(arg1, arg2)
|
|
integer :: arg1, arg2
|
|
!$OMP PARALLEL
|
|
!$OMP DO LASTPRIVATE(arg1) LASTPRIVATE(arg2)
|
|
do n = 1, 5
|
|
arg1 = 2
|
|
arg2 = 3
|
|
print *, arg1, arg2
|
|
end do
|
|
!$OMP END DO
|
|
!$OMP END PARALLEL
|
|
print *, arg1, arg2
|
|
end subroutine
|
|
|
|
!CHECK: func.func @_QPmult_lastprivate_int2(%[[ARG1:.*]]: !fir.ref<i32> {fir.bindc_name = "arg1"}, %[[ARG2:.*]]: !fir.ref<i32> {fir.bindc_name = "arg2"}) {
|
|
!CHECK: %[[ARG1_DECL:.*]]:2 = hlfir.declare %[[ARG1]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFmult_lastprivate_int2Earg1"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
!CHECK: %[[ARG2_DECL:.*]]:2 = hlfir.declare %[[ARG2]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFmult_lastprivate_int2Earg2"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
!CHECK: omp.parallel {
|
|
!CHECK: omp.wsloop private(@{{.*}} %{{.*}}#0 -> %[[CLONE1:.*]], @{{.*}} %{{.*}}#0 -> %[[CLONE2:.*]], @{{.*}} %{{.*}}#0 -> %{{.*}} : !fir.ref<i32>, !fir.ref<i32>, !{{.*}}) {
|
|
!CHECK-NEXT: omp.loop_nest (%[[INDX_WS:.*]]) : {{.*}} {
|
|
!CHECK-DAG: %[[CLONE1_DECL:.*]]:2 = hlfir.declare %[[CLONE1]] {uniq_name = "_QFmult_lastprivate_int2Earg1"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
!CHECK-DAG: %[[CLONE2_DECL:.*]]:2 = hlfir.declare %[[CLONE2]] {uniq_name = "_QFmult_lastprivate_int2Earg2"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
|
|
!Testing last iteration check
|
|
!CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32
|
|
!CHECK: %[[C0:.*]] = arith.constant 0 : i32
|
|
!CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32
|
|
!CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32
|
|
!CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32
|
|
!CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1
|
|
!CHECK: fir.if %[[IV_CMP]] {
|
|
!CHECK: hlfir.assign %[[V]] to %{{.*}} : i32, !fir.ref<i32>
|
|
!Testing lastprivate val update
|
|
!CHECK-DAG: %[[CLONE_LD2:.*]] = fir.load %[[CLONE2_DECL]]#0 : !fir.ref<i32>
|
|
!CHECK-DAG: hlfir.assign %[[CLONE_LD2]] to %[[ARG2_DECL]]#0 : i32, !fir.ref<i32>
|
|
!CHECK-DAG: %[[CLONE_LD1:.*]] = fir.load %[[CLONE1_DECL]]#0 : !fir.ref<i32>
|
|
!CHECK-DAG: hlfir.assign %[[CLONE_LD1]] to %[[ARG1_DECL]]#0 : i32, !fir.ref<i32>
|
|
!CHECK: }
|
|
!CHECK: omp.yield
|
|
!CHECK: }
|
|
!CHECK: }
|
|
|
|
subroutine mult_lastprivate_int2(arg1, arg2)
|
|
integer :: arg1, arg2
|
|
!$OMP PARALLEL
|
|
!$OMP DO LASTPRIVATE(arg1, arg2)
|
|
do n = 1, 5
|
|
arg1 = 2
|
|
arg2 = 3
|
|
print *, arg1, arg2
|
|
end do
|
|
!$OMP END DO
|
|
!$OMP END PARALLEL
|
|
print *, arg1, arg2
|
|
end subroutine
|
|
|
|
!CHECK: func.func @_QPfirstpriv_lastpriv_int(%[[ARG1:.*]]: !fir.ref<i32> {fir.bindc_name = "arg1"}, %[[ARG2:.*]]: !fir.ref<i32> {fir.bindc_name = "arg2"}) {
|
|
!CHECK: %[[ARG1_DECL:.*]]:2 = hlfir.declare %[[ARG1]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFfirstpriv_lastpriv_intEarg1"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
!CHECK: %[[ARG2_DECL:.*]]:2 = hlfir.declare %[[ARG2]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFfirstpriv_lastpriv_intEarg2"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
!CHECK: omp.parallel {
|
|
! Firstprivate update
|
|
!CHECK-NOT: omp.barrier
|
|
!CHECK: omp.wsloop private(@{{.*}} %{{.*}}#0 -> %[[CLONE1:.*]], @{{.*}} %{{.*}}#0 -> %[[CLONE2:.*]], @{{.*}} %{{.*}}#0 -> %{{.*}} : !fir.ref<i32>, !fir.ref<i32>, !{{.*}}) {
|
|
!CHECK-NEXT: omp.loop_nest (%[[INDX_WS:.*]]) : {{.*}} {
|
|
!CHECK: %[[CLONE1_DECL:.*]]:2 = hlfir.declare %[[CLONE1]] {uniq_name = "_QFfirstpriv_lastpriv_intEarg1"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
!CHECK: %[[CLONE2_DECL:.*]]:2 = hlfir.declare %[[CLONE2]] {uniq_name = "_QFfirstpriv_lastpriv_intEarg2"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
|
|
! Testing last iteration check
|
|
!CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32
|
|
!CHECK: %[[C0:.*]] = arith.constant 0 : i32
|
|
!CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32
|
|
!CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32
|
|
!CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32
|
|
!CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1
|
|
!CHECK: fir.if %[[IV_CMP]] {
|
|
!CHECK: hlfir.assign %[[V]] to %{{.*}} : i32, !fir.ref<i32>
|
|
! Testing lastprivate val update
|
|
!CHECK-NEXT: %[[CLONE_LD:.*]] = fir.load %[[CLONE2_DECL]]#0 : !fir.ref<i32>
|
|
!CHECK-NEXT: hlfir.assign %[[CLONE_LD]] to %[[ARG2_DECL]]#0 : i32, !fir.ref<i32>
|
|
!CHECK-NEXT: }
|
|
!CHECK-NEXT: omp.yield
|
|
!CHECK-NEXT: }
|
|
!CHECK-NEXT: }
|
|
|
|
subroutine firstpriv_lastpriv_int(arg1, arg2)
|
|
integer :: arg1, arg2
|
|
!$OMP PARALLEL
|
|
!$OMP DO FIRSTPRIVATE(arg1) LASTPRIVATE(arg2)
|
|
do n = 1, 5
|
|
arg1 = 2
|
|
arg2 = 3
|
|
print *, arg1, arg2
|
|
end do
|
|
!$OMP END DO
|
|
!$OMP END PARALLEL
|
|
print *, arg1, arg2
|
|
end subroutine
|
|
|
|
!CHECK: func.func @_QPfirstpriv_lastpriv_int2(%[[ARG1:.*]]: !fir.ref<i32> {fir.bindc_name = "arg1"}) {
|
|
!CHECK: %[[ARG1_DECL:.*]]:2 = hlfir.declare %[[ARG1]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFfirstpriv_lastpriv_int2Earg1"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
!CHECK: omp.parallel {
|
|
|
|
! Firstprivate update
|
|
|
|
|
|
!CHECK: omp.wsloop private(@{{.*}} %{{.*}}#0 -> %[[CLONE1:.*]], @{{.*}} %{{.*}}#0 -> %[[IV:.*]] : !fir.ref<i32>, !fir.ref<i32>) private_barrier {
|
|
!CHECK-NEXT: omp.loop_nest (%[[INDX_WS:.*]]) : {{.*}} {
|
|
!CHECK: %[[CLONE1_DECL:.*]]:2 = hlfir.declare %[[CLONE1]] {uniq_name = "_QFfirstpriv_lastpriv_int2Earg1"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
|
|
!CHECK-NEXT: hlfir.declare %[[IV]]
|
|
! Testing last iteration check
|
|
!CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32
|
|
!CHECK: %[[C0:.*]] = arith.constant 0 : i32
|
|
!CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32
|
|
!CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32
|
|
!CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32
|
|
!CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1
|
|
!CHECK: fir.if %[[IV_CMP]] {
|
|
!CHECK: hlfir.assign %[[V]] to %{{.*}} : i32, !fir.ref<i32>
|
|
! Testing lastprivate val update
|
|
!CHECK-NEXT: %[[CLONE_LD:.*]] = fir.load %[[CLONE1_DECL]]#0 : !fir.ref<i32>
|
|
!CHECK-NEXT: hlfir.assign %[[CLONE_LD]] to %[[ARG1_DECL]]#0 : i32, !fir.ref<i32>
|
|
!CHECK-NEXT: }
|
|
!CHECK-NEXT: omp.yield
|
|
!CHECK-NEXT: }
|
|
!CHECK-NEXT: }
|
|
|
|
subroutine firstpriv_lastpriv_int2(arg1)
|
|
integer :: arg1
|
|
!$OMP PARALLEL
|
|
!$OMP DO FIRSTPRIVATE(arg1) LASTPRIVATE(arg1)
|
|
do n = 1, 5
|
|
arg1 = 2
|
|
print *, arg1
|
|
end do
|
|
!$OMP END DO
|
|
!$OMP END PARALLEL
|
|
print *, arg1
|
|
end subroutine
|
|
|
|
! Check that LASTPRIVATE updates the private copy of `i` when used inside
|
|
! nested PARALLEL constructs in which `i` is private.
|
|
!CHECK-LABEL: func @_QPlastprivate_nested_parallel()
|
|
!CHECK: %[[I:.*]]:2 = hlfir.declare %{{.*}} {uniq_name = "_QFlastprivate_nested_parallelEi"} :
|
|
!CHECK-SAME: (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
!CHECK: omp.parallel private(@_QFlastprivate_nested_parallelEi_private_i32 %[[I]]#0 {{.*}})
|
|
!CHECK: %[[PRIV_I:.*]]:2 = hlfir.declare %{{.*}} {uniq_name = "_QFlastprivate_nested_parallelEi"} :
|
|
!CHECK-SAME: (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
!CHECK: omp.parallel {
|
|
!CHECK: omp.wsloop private(@_QFlastprivate_nested_parallelEi_private_i32 %[[PRIV_I]]#0 {{.*}})
|
|
!CHECK: hlfir.assign %{{.*}} to %[[PRIV_I]]#0
|
|
|
|
subroutine lastprivate_nested_parallel()
|
|
integer :: i
|
|
|
|
!$OMP PARALLEL DEFAULT(PRIVATE)
|
|
!$OMP PARALLEL
|
|
!$OMP DO LASTPRIVATE(i)
|
|
do i = 1, 5
|
|
end do
|
|
!$OMP END PARALLEL
|
|
!$OMP END PARALLEL
|
|
end subroutine
|
|
|
|
!CHECK-LABEL: func @_QPlastprivate_nested_parallel2()
|
|
!CHECK: omp.parallel {
|
|
!CHECK: omp.wsloop private(@_QFlastprivate_nested_parallel2Ei_private_i32 {{.*}})
|
|
!CHECK: %[[PRIV_I:.*]]:2 = hlfir.declare %{{.*}} {uniq_name = "_QFlastprivate_nested_parallel2Ei"}
|
|
!CHECK: omp.parallel {
|
|
!CHECK: omp.wsloop private(@_QFlastprivate_nested_parallel2Ei_private_i32 %[[PRIV_I]]#0 {{.*}})
|
|
!CHECK: hlfir.assign %{{.*}} to %[[PRIV_I]]#0
|
|
|
|
subroutine lastprivate_nested_parallel2()
|
|
integer :: i, j, k
|
|
|
|
!$omp parallel do lastprivate(i)
|
|
do j = 1, 10
|
|
!$omp parallel do lastprivate(i)
|
|
do k = 2, 20
|
|
end do
|
|
end do
|
|
end subroutine
|