38 lines · plain
1! RUN: bbc -emit-hlfir -fopenmp -fopenmp-version=50 -o - %s 2>&1 | FileCheck %s2! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 -o - %s 2>&1 | FileCheck %s3 4!CHECK-LABEL: omp.declare_reduction5!CHECK-SAME: @[[RED_I32_NAME:.*]] : i32 init {6!CHECK: ^bb0(%{{.*}}: i32):7!CHECK: %[[C0_1:.*]] = arith.constant 0 : i328!CHECK: omp.yield(%[[C0_1]] : i32)9!CHECK: } combiner {10!CHECK: ^bb0(%[[ARG0:.*]]: i32, %[[ARG1:.*]]: i32):11!CHECK: %[[RES:.*]] = arith.addi %[[ARG0]], %[[ARG1]] : i3212!CHECK: omp.yield(%[[RES]] : i32)13!CHECK: }14 15!CHECK-LABEL: func.func @_QPin_reduction() {16! [...]17!CHECK: omp.taskgroup task_reduction(@[[RED_I32_NAME]] %[[VAL_1:.*]]#0 -> %[[VAL_3:.*]] : !fir.ref<i32>) {18!CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[VAL_3]] {uniq_name = "_QFin_reductionEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)19!CHECK: omp.task in_reduction(@[[RED_I32_NAME]] %[[VAL_4]]#0 -> %[[VAL_5:.*]] : !fir.ref<i32>) {20!CHECK: %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_5]] {uniq_name = "_QFin_reductionEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)21! [...]22!CHECK: omp.terminator23!CHECK: }24!CHECK: omp.terminator25!CHECK: }26!CHECK: return27!CHECK: }28 29subroutine in_reduction()30 integer :: x31 x = 032 !$omp taskgroup task_reduction(+:x)33 !$omp task in_reduction(+:x)34 x = x + 135 !$omp end task36 !$omp end taskgroup37end subroutine38