56 lines · plain
1! RUN: bbc -emit-hlfir -fopenmp %s -o - | FileCheck %s2! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s3 4subroutine sectionsReduction(x)5 real, dimension(:) :: x6 7 !$omp parallel8 !$omp sections reduction(+:x)9 x = x + 110 !$omp section11 x = x + 212 !$omp end sections13 !$omp end parallel14end subroutine15 16 17! CHECK-LABEL: omp.declare_reduction @add_reduction_byref_box_Uxf32 : !fir.ref<!fir.box<!fir.array<?xf32>>> {{.*}} alloc {18! [...]19! CHECK: omp.yield20! CHECK-LABEL: } init {21! [...]22! CHECK: omp.yield23! CHECK-LABEL: } combiner {24! [...]25! CHECK: omp.yield26! CHECK-LABEL: } cleanup {27! [...]28! CHECK: omp.yield29! CHECK: }30 31! CHECK-LABEL: func.func @_QPsectionsreduction(32! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<?xf32>> {fir.bindc_name = "x"}) {33! CHECK: %[[VAL_1:.*]] = fir.dummy_scope : !fir.dscope34! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %[[VAL_1]] arg {{[0-9]+}} {uniq_name = "_QFsectionsreductionEx"} : (!fir.box<!fir.array<?xf32>>, !fir.dscope) -> (!fir.box<!fir.array<?xf32>>, !fir.box<!fir.array<?xf32>>)35! CHECK: omp.parallel {36! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.box<!fir.array<?xf32>>37! CHECK: fir.store %[[VAL_2]]#0 to %[[VAL_3]] : !fir.ref<!fir.box<!fir.array<?xf32>>>38! CHECK: omp.sections reduction(byref @add_reduction_byref_box_Uxf32 %[[VAL_3]] -> %[[VAL_4:.*]] : !fir.ref<!fir.box<!fir.array<?xf32>>>) {39! CHECK: omp.section {40! CHECK: ^bb0(%[[VAL_5:.*]]: !fir.ref<!fir.box<!fir.array<?xf32>>>):41! [...]42! CHECK: omp.terminator43! CHECK: }44! CHECK: omp.section {45! CHECK: ^bb0(%[[VAL_23:.*]]: !fir.ref<!fir.box<!fir.array<?xf32>>>):46! [...]47! CHECK: omp.terminator48! CHECK: }49! CHECK: omp.terminator50! CHECK: }51! CHECK: omp.terminator52! CHECK: }53! CHECK: return54! CHECK: }55 56