37 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 @_QPomp_taskgroup_task_reduction() {16!CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "res", uniq_name = "_QFomp_taskgroup_task_reductionEres"}17!CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFomp_taskgroup_task_reductionEres"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)18!CHECK: omp.taskgroup task_reduction(@[[RED_I32_NAME]] %[[VAL_1]]#0 -> %[[VAL_2:.*]] : !fir.ref<i32>) {19!CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_2]] 20!CHECK-SAME: {uniq_name = "_QFomp_taskgroup_task_reductionEres"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)21!CHECK: %[[VAL_4:.*]] = fir.load %[[VAL_3]]#0 : !fir.ref<i32>22!CHECK: %[[VAL_5:.*]] = arith.constant 1 : i3223!CHECK: %[[VAL_6:.*]] = arith.addi %[[VAL_4]], %[[VAL_5]] : i3224!CHECK: hlfir.assign %[[VAL_6]] to %[[VAL_3]]#0 : i32, !fir.ref<i32>25!CHECK: omp.terminator26!CHECK: }27!CHECK: return28!CHECK: }29 30 31subroutine omp_taskgroup_task_reduction()32 integer :: res33 !$omp taskgroup task_reduction(+:res)34 res = res + 135 !$omp end taskgroup36end subroutine37