| 1 |
! RUN: bbc -emit-hlfir -fopenmp %s -o - | FileCheck %s |
| 2 |
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s |
| 3 |
|
| 4 |
subroutine sectionsReduction(x) |
| 5 |
real, dimension(:) :: x |
| 6 |
|
| 7 |
!$omp parallel |
| 8 |
!$omp sections reduction(+:x) |
| 9 |
x = x + 1 |
| 10 |
!$omp section |
| 11 |
x = x + 2 |
| 12 |
!$omp end sections |
| 13 |
!$omp end parallel |
| 14 |
end subroutine |
| 15 |
|
| 16 |
|
| 17 |
! CHECK-LABEL: omp.declare_reduction @add_reduction_byref_box_Uxf32 : !fir.ref<!fir.box<!fir.array<?xf32>>> init { |
| 18 |
! [...] |
| 19 |
! CHECK: omp.yield |
| 20 |
! CHECK-LABEL: } combiner { |
| 21 |
! [...] |
| 22 |
! CHECK: omp.yield |
| 23 |
! CHECK-LABEL: } cleanup { |
| 24 |
! [...] |
| 25 |
! CHECK: omp.yield |
| 26 |
! CHECK: } |
| 27 |
|
| 28 |
! CHECK-LABEL: func.func @_QPsectionsreduction( |
| 29 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<?xf32>> {fir.bindc_name = "x"}) { |
| 30 |
! CHECK: %[[VAL_1:.*]] = fir.dummy_scope : !fir.dscope |
| 31 |
! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %[[VAL_1]] {uniq_name = "_QFsectionsreductionEx"} : (!fir.box<!fir.array<?xf32>>, !fir.dscope) -> (!fir.box<!fir.array<?xf32>>, !fir.box<!fir.array<?xf32>>) |
| 32 |
! CHECK: omp.parallel { |
| 33 |
! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.box<!fir.array<?xf32>> |
| 34 |
! CHECK: fir.store %[[VAL_2]]#1 to %[[VAL_3]] : !fir.ref<!fir.box<!fir.array<?xf32>>> |
| 35 |
! CHECK: omp.sections reduction(byref @add_reduction_byref_box_Uxf32 -> %[[VAL_3]] : !fir.ref<!fir.box<!fir.array<?xf32>>>) { |
| 36 |
! CHECK: ^bb0(%[[VAL_4:.*]]: !fir.ref<!fir.box<!fir.array<?xf32>>>): |
| 37 |
! CHECK: omp.section { |
| 38 |
! CHECK: ^bb0(%[[VAL_5:.*]]: !fir.ref<!fir.box<!fir.array<?xf32>>>): |
| 39 |
! [...] |
| 40 |
! CHECK: omp.terminator |
| 41 |
! CHECK: } |
| 42 |
! CHECK: omp.section { |
| 43 |
! CHECK: ^bb0(%[[VAL_23:.*]]: !fir.ref<!fir.box<!fir.array<?xf32>>>): |
| 44 |
! [...] |
| 45 |
! CHECK: omp.terminator |
| 46 |
! CHECK: } |
| 47 |
! CHECK: omp.terminator |
| 48 |
! CHECK: } |
| 49 |
! CHECK: omp.terminator |
| 50 |
! CHECK: } |
| 51 |
! CHECK: return |
| 52 |
! CHECK: } |
| 53 |
|