! This test checks lowering of OpenACC reduction clause. ! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s ! RUN: bbc -fopenacc -emit-hlfir %s -o - -openacc-use-reduction-combine | FileCheck -check-prefix=ACC_COMBINE %s ! CHECK-LABEL: acc.reduction.recipe @reduction_lor_ref_box_heap_l32 : !fir.ref>>> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>>>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant false ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_0]] : !fir.ref>>> ! CHECK: %[[BOX_ADDR_0:.*]] = fir.box_addr %[[LOAD_0]] : (!fir.box>>) -> !fir.heap> ! CHECK: %[[ALLOCMEM_0:.*]] = fir.allocmem !fir.logical<4> {bindc_name = "acc.reduction.init", uniq_name = ""} ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCMEM_0]] temporary_lhs : i1, !fir.heap> ! CHECK: %[[EMBOX_0:.*]] = fir.embox %[[ALLOCMEM_0]] : (!fir.heap>) -> !fir.box>> ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.box>> ! CHECK: fir.store %[[EMBOX_0]] to %[[ALLOCA_0]] : !fir.ref>>> ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref>>> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>>>, %[[VAL_1:.*]]: !fir.ref>>>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref>>> ! CHECK: %[[BOX_ADDR_0:.*]] = fir.box_addr %[[LOAD_0]] : (!fir.box>>) -> !fir.heap> ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref>>> ! CHECK: %[[BOX_ADDR_1:.*]] = fir.box_addr %[[LOAD_1]] : (!fir.box>>) -> !fir.heap> ! CHECK: %[[LOAD_2:.*]] = fir.load %[[BOX_ADDR_0]] : !fir.heap> ! CHECK: %[[LOAD_3:.*]] = fir.load %[[BOX_ADDR_1]] : !fir.heap> ! CHECK: %[[ORI_0:.*]] = fir.logical_or %[[LOAD_3]], %[[LOAD_2]] : !fir.logical<4> ! CHECK: hlfir.assign %[[ORI_0]] to %[[BOX_ADDR_1]] : !fir.logical<4>, !fir.heap> ! CHECK: acc.yield %[[VAL_0]] : !fir.ref>>> ! CHECK-LABEL: } destroy { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>>>, %[[VAL_1:.*]]: !fir.ref>>>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref>>> ! CHECK: %[[BOX_ADDR_0:.*]] = fir.box_addr %[[LOAD_0]] : (!fir.box>>) -> !fir.heap> ! CHECK: fir.freemem %[[BOX_ADDR_0]] : !fir.heap> ! CHECK: acc.terminator ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_max_box_UxUxf32 : !fir.box> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.box>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant -3.40282347E+38 : f32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_1]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 1 : index ! CHECK: %[[BOX_DIMS_1:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_2]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[BOX_DIMS_0]]#1, %[[BOX_DIMS_1]]#1 : (index, index) -> !fir.shape<2> ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[BOX_DIMS_0]]#1, %[[BOX_DIMS_1]]#1 : (index, index) -> !fir.shape<2> ! CHECK: %[[ALLOCMEM_0:.*]] = fir.allocmem !fir.array, %[[BOX_DIMS_0]]#1, %[[BOX_DIMS_1]]#1 {bindc_name = "acc.reduction.init", uniq_name = ""} ! CHECK: %[[EMBOX_0:.*]] = fir.embox %[[ALLOCMEM_0]](%[[SHAPE_1]]) : (!fir.heap>, !fir.shape<2>) -> !fir.box> ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_2:.*]]:3 = fir.box_dims %[[EMBOX_0]], %[[CONSTANT_3]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 1 : index ! CHECK: %[[BOX_DIMS_3:.*]]:3 = fir.box_dims %[[EMBOX_0]], %[[CONSTANT_4]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_2:.*]] = fir.shape %[[BOX_DIMS_2]]#1, %[[BOX_DIMS_3]]#1 : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_5]] to %[[BOX_DIMS_3]]#1 step %[[CONSTANT_5]] unordered { ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_5]] to %[[BOX_DIMS_2]]#1 step %[[CONSTANT_5]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[EMBOX_0]] (%[[VAL_2]], %[[VAL_1]]) : (!fir.box>, index, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_0]] temporary_lhs : f32, !fir.ref ! CHECK: } ! CHECK: } ! CHECK: %[[CONSTANT_6:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_4:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_6]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_7:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_5:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_7]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_8:.*]] = arith.constant 1 : index ! CHECK: %[[BOX_DIMS_6:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_8]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_9:.*]] = arith.constant 1 : index ! CHECK: %[[BOX_DIMS_7:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_9]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_SHIFT_0:.*]] = fir.shape_shift %[[BOX_DIMS_4]]#0, %[[BOX_DIMS_5]]#1, %[[BOX_DIMS_6]]#0, %[[BOX_DIMS_7]]#1 : (index, index, index, index) -> !fir.shapeshift<2> ! CHECK: %[[EMBOX_1:.*]] = fir.embox %[[ALLOCMEM_0]](%[[SHAPE_SHIFT_0]]) : (!fir.heap>, !fir.shapeshift<2>) -> !fir.box> ! CHECK: acc.yield %[[EMBOX_1]] : !fir.box> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.box>, %[[VAL_1:.*]]: !fir.box>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_0]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 1 : index ! CHECK: %[[BOX_DIMS_1:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_1]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[BOX_DIMS_0]]#1, %[[BOX_DIMS_1]]#1 : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_2:.*]]:3 = fir.box_dims %[[VAL_1]], %[[CONSTANT_2]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 1 : index ! CHECK: %[[BOX_DIMS_3:.*]]:3 = fir.box_dims %[[VAL_1]], %[[CONSTANT_3]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[BOX_DIMS_2]]#1, %[[BOX_DIMS_3]]#1 : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_4]] to %[[BOX_DIMS_1]]#1 step %[[CONSTANT_4]] unordered { ! CHECK: fir.do_loop %[[VAL_3:.*]] = %[[CONSTANT_4]] to %[[BOX_DIMS_0]]#1 step %[[CONSTANT_4]] unordered { ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_4:.*]]:3 = fir.box_dims %[[VAL_1]], %[[CONSTANT_5]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_6:.*]] = arith.constant 1 : index ! CHECK: %[[BOX_DIMS_5:.*]]:3 = fir.box_dims %[[VAL_1]], %[[CONSTANT_6]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_7:.*]] = arith.constant 1 : index ! CHECK: %[[SUBI_0:.*]] = arith.subi %[[BOX_DIMS_4]]#0, %[[CONSTANT_7]] : index ! CHECK: %[[ADDI_0:.*]] = arith.addi %[[VAL_3]], %[[SUBI_0]] : index ! CHECK: %[[SUBI_1:.*]] = arith.subi %[[BOX_DIMS_5]]#0, %[[CONSTANT_7]] : index ! CHECK: %[[ADDI_1:.*]] = arith.addi %[[VAL_2]], %[[SUBI_1]] : index ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[ADDI_0]], %[[ADDI_1]]) : (!fir.box>, index, index) -> !fir.ref ! CHECK: %[[CONSTANT_8:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_6:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_8]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_9:.*]] = arith.constant 1 : index ! CHECK: %[[BOX_DIMS_7:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_9]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_10:.*]] = arith.constant 1 : index ! CHECK: %[[SUBI_2:.*]] = arith.subi %[[BOX_DIMS_6]]#0, %[[CONSTANT_10]] : index ! CHECK: %[[ADDI_2:.*]] = arith.addi %[[VAL_3]], %[[SUBI_2]] : index ! CHECK: %[[SUBI_3:.*]] = arith.subi %[[BOX_DIMS_7]]#0, %[[CONSTANT_10]] : index ! CHECK: %[[ADDI_3:.*]] = arith.addi %[[VAL_2]], %[[SUBI_3]] : index ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[ADDI_2]], %[[ADDI_3]]) : (!fir.box>, index, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_0]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_1]] : !fir.ref ! CHECK: %[[CMPF_0:.*]] = arith.cmpf ogt, %[[LOAD_1]], %[[LOAD_0]] fastmath : f32 ! CHECK: %[[SELECT_0:.*]] = arith.select %[[CMPF_0]], %[[LOAD_1]], %[[LOAD_0]] : f32 ! CHECK: hlfir.assign %[[SELECT_0]] to %[[DESIGNATE_1]] : f32, !fir.ref ! CHECK: } ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.box> ! CHECK-LABEL: } destroy { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.box>, %[[VAL_1:.*]]: !fir.box>): ! CHECK: %[[BOX_ADDR_0:.*]] = fir.box_addr %[[VAL_1]] : (!fir.box>) -> !fir.ref> ! CHECK: %[[CONVERT_0:.*]] = fir.convert %[[BOX_ADDR_0]] : (!fir.ref>) -> !fir.heap> ! CHECK: fir.freemem %[[CONVERT_0]] : !fir.heap> ! CHECK: acc.terminator ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_max_ref_box_ptr_Uxf32 : !fir.ref>>> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>>>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant -3.40282347E+38 : f32 ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_0]] : !fir.ref>>> ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[LOAD_0]], %[[CONSTANT_1]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[BOX_DIMS_0]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[BOX_DIMS_0]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[ALLOCMEM_0:.*]] = fir.allocmem !fir.array, %[[BOX_DIMS_0]]#1 {bindc_name = "acc.reduction.init", uniq_name = ""} ! CHECK: %[[EMBOX_0:.*]] = fir.embox %[[ALLOCMEM_0]](%[[SHAPE_1]]) : (!fir.heap>, !fir.shape<1>) -> !fir.box> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_1:.*]]:3 = fir.box_dims %[[EMBOX_0]], %[[CONSTANT_2]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_2:.*]] = fir.shape %[[BOX_DIMS_1]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_3]] to %[[BOX_DIMS_1]]#1 step %[[CONSTANT_3]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[EMBOX_0]] (%[[VAL_1]]) : (!fir.box>, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_0]] temporary_lhs : f32, !fir.ref ! CHECK: } ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_2:.*]]:3 = fir.box_dims %[[LOAD_0]], %[[CONSTANT_4]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_3:.*]]:3 = fir.box_dims %[[LOAD_0]], %[[CONSTANT_5]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[SHAPE_SHIFT_0:.*]] = fir.shape_shift %[[BOX_DIMS_2]]#0, %[[BOX_DIMS_3]]#1 : (index, index) -> !fir.shapeshift<1> ! CHECK: %[[EMBOX_1:.*]] = fir.embox %[[ALLOCMEM_0]](%[[SHAPE_SHIFT_0]]) : (!fir.heap>, !fir.shapeshift<1>) -> !fir.box>> ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.box>> ! CHECK: fir.store %[[EMBOX_1]] to %[[ALLOCA_0]] : !fir.ref>>> ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref>>> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>>>, %[[VAL_1:.*]]: !fir.ref>>>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref>>> ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref>>> ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[LOAD_1]], %[[CONSTANT_0]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[BOX_DIMS_0]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_1:.*]]:3 = fir.box_dims %[[LOAD_0]], %[[CONSTANT_1]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[BOX_DIMS_1]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_2]] to %[[BOX_DIMS_0]]#1 step %[[CONSTANT_2]] unordered { ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_2:.*]]:3 = fir.box_dims %[[LOAD_0]], %[[CONSTANT_3]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 1 : index ! CHECK: %[[SUBI_0:.*]] = arith.subi %[[BOX_DIMS_2]]#0, %[[CONSTANT_4]] : index ! CHECK: %[[ADDI_0:.*]] = arith.addi %[[VAL_2]], %[[SUBI_0]] : index ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[LOAD_0]] (%[[ADDI_0]]) : (!fir.box>>, index) -> !fir.ref ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_3:.*]]:3 = fir.box_dims %[[LOAD_1]], %[[CONSTANT_5]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_6:.*]] = arith.constant 1 : index ! CHECK: %[[SUBI_1:.*]] = arith.subi %[[BOX_DIMS_3]]#0, %[[CONSTANT_6]] : index ! CHECK: %[[ADDI_1:.*]] = arith.addi %[[VAL_2]], %[[SUBI_1]] : index ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[LOAD_1]] (%[[ADDI_1]]) : (!fir.box>>, index) -> !fir.ref ! CHECK: %[[LOAD_2:.*]] = fir.load %[[DESIGNATE_0]] : !fir.ref ! CHECK: %[[LOAD_3:.*]] = fir.load %[[DESIGNATE_1]] : !fir.ref ! CHECK: %[[CMPF_0:.*]] = arith.cmpf ogt, %[[LOAD_3]], %[[LOAD_2]] fastmath : f32 ! CHECK: %[[SELECT_0:.*]] = arith.select %[[CMPF_0]], %[[LOAD_3]], %[[LOAD_2]] : f32 ! CHECK: hlfir.assign %[[SELECT_0]] to %[[DESIGNATE_1]] : f32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.ref>>> ! CHECK-LABEL: } destroy { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>>>, %[[VAL_1:.*]]: !fir.ref>>>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref>>> ! CHECK: %[[BOX_ADDR_0:.*]] = fir.box_addr %[[LOAD_0]] : (!fir.box>>) -> !fir.ptr> ! CHECK: %[[CONVERT_0:.*]] = fir.convert %[[BOX_ADDR_0]] : (!fir.ptr>) -> !fir.heap> ! CHECK: fir.freemem %[[CONVERT_0]] : !fir.heap> ! CHECK: acc.terminator ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_max_ref_box_heap_Uxf32 : !fir.ref>>> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>>>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant -3.40282347E+38 : f32 ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_0]] : !fir.ref>>> ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[LOAD_0]], %[[CONSTANT_1]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[BOX_DIMS_0]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[BOX_DIMS_0]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[ALLOCMEM_0:.*]] = fir.allocmem !fir.array, %[[BOX_DIMS_0]]#1 {bindc_name = "acc.reduction.init", uniq_name = ""} ! CHECK: %[[EMBOX_0:.*]] = fir.embox %[[ALLOCMEM_0]](%[[SHAPE_1]]) : (!fir.heap>, !fir.shape<1>) -> !fir.box> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_1:.*]]:3 = fir.box_dims %[[EMBOX_0]], %[[CONSTANT_2]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_2:.*]] = fir.shape %[[BOX_DIMS_1]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_3]] to %[[BOX_DIMS_1]]#1 step %[[CONSTANT_3]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[EMBOX_0]] (%[[VAL_1]]) : (!fir.box>, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_0]] temporary_lhs : f32, !fir.ref ! CHECK: } ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_2:.*]]:3 = fir.box_dims %[[LOAD_0]], %[[CONSTANT_4]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_3:.*]]:3 = fir.box_dims %[[LOAD_0]], %[[CONSTANT_5]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[SHAPE_SHIFT_0:.*]] = fir.shape_shift %[[BOX_DIMS_2]]#0, %[[BOX_DIMS_3]]#1 : (index, index) -> !fir.shapeshift<1> ! CHECK: %[[EMBOX_1:.*]] = fir.embox %[[ALLOCMEM_0]](%[[SHAPE_SHIFT_0]]) : (!fir.heap>, !fir.shapeshift<1>) -> !fir.box>> ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.box>> ! CHECK: fir.store %[[EMBOX_1]] to %[[ALLOCA_0]] : !fir.ref>>> ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref>>> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>>>, %[[VAL_1:.*]]: !fir.ref>>>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref>>> ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref>>> ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[LOAD_1]], %[[CONSTANT_0]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[BOX_DIMS_0]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_1:.*]]:3 = fir.box_dims %[[LOAD_0]], %[[CONSTANT_1]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[BOX_DIMS_1]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_2]] to %[[BOX_DIMS_0]]#1 step %[[CONSTANT_2]] unordered { ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_2:.*]]:3 = fir.box_dims %[[LOAD_0]], %[[CONSTANT_3]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 1 : index ! CHECK: %[[SUBI_0:.*]] = arith.subi %[[BOX_DIMS_2]]#0, %[[CONSTANT_4]] : index ! CHECK: %[[ADDI_0:.*]] = arith.addi %[[VAL_2]], %[[SUBI_0]] : index ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[LOAD_0]] (%[[ADDI_0]]) : (!fir.box>>, index) -> !fir.ref ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_3:.*]]:3 = fir.box_dims %[[LOAD_1]], %[[CONSTANT_5]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_6:.*]] = arith.constant 1 : index ! CHECK: %[[SUBI_1:.*]] = arith.subi %[[BOX_DIMS_3]]#0, %[[CONSTANT_6]] : index ! CHECK: %[[ADDI_1:.*]] = arith.addi %[[VAL_2]], %[[SUBI_1]] : index ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[LOAD_1]] (%[[ADDI_1]]) : (!fir.box>>, index) -> !fir.ref ! CHECK: %[[LOAD_2:.*]] = fir.load %[[DESIGNATE_0]] : !fir.ref ! CHECK: %[[LOAD_3:.*]] = fir.load %[[DESIGNATE_1]] : !fir.ref ! CHECK: %[[CMPF_0:.*]] = arith.cmpf ogt, %[[LOAD_3]], %[[LOAD_2]] fastmath : f32 ! CHECK: %[[SELECT_0:.*]] = arith.select %[[CMPF_0]], %[[LOAD_3]], %[[LOAD_2]] : f32 ! CHECK: hlfir.assign %[[SELECT_0]] to %[[DESIGNATE_1]] : f32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.ref>>> ! CHECK-LABEL: } destroy { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>>>, %[[VAL_1:.*]]: !fir.ref>>>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref>>> ! CHECK: %[[BOX_ADDR_0:.*]] = fir.box_addr %[[LOAD_0]] : (!fir.box>>) -> !fir.heap> ! CHECK: fir.freemem %[[BOX_ADDR_0]] : !fir.heap> ! CHECK: acc.terminator ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_add_section_lb1.ub3_box_Uxi32 : !fir.box> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.box>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.array<3xi32> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : i32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 3 : index ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 0 : index ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 2 : index ! CHECK: %[[CONSTANT_6:.*]] = arith.constant 3 : index ! CHECK: %[[CONSTANT_7:.*]] = arith.constant true ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_6]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_8:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_8]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[ADDI_0:.*]] = arith.addi %[[BOX_DIMS_0]]#0, %[[CONSTANT_2]] : index ! CHECK: %[[ADDI_1:.*]] = arith.addi %[[BOX_DIMS_0]]#0, %[[CONSTANT_3]] : index ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_0]] (%[[ADDI_0]]:%[[ADDI_1]]:%[[CONSTANT_1]]) shape %[[SHAPE_0]] : (!fir.box>, index, index, index, !fir.shape<1>) -> !fir.box> ! CHECK: %[[CONSTANT_9:.*]] = arith.constant 3 : index ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_9]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_10:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_10]] to %[[CONSTANT_9]] step %[[CONSTANT_10]] unordered { ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[ALLOCA_0]] (%[[VAL_1]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_1]] temporary_lhs : i32, !fir.ref ! CHECK: } ! CHECK: %[[CONSTANT_11:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_1:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_11]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_12:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_2:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_12]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONVERT_0:.*]] = fir.convert %[[ALLOCA_0]] : (!fir.ref>) -> !fir.ref> ! CHECK: %[[CONSTANT_13:.*]] = arith.constant 0 : index ! CHECK: %[[SHAPE_SHIFT_0:.*]] = fir.shape_shift %[[CONSTANT_2]], %[[BOX_DIMS_2]]#1 : (index, index) -> !fir.shapeshift<1> ! CHECK: %[[ARRAY_COOR_0:.*]] = fir.array_coor %[[CONVERT_0]](%[[SHAPE_SHIFT_0]]) %[[CONSTANT_13]] : (!fir.ref>, !fir.shapeshift<1>, index) -> !fir.ref ! CHECK: %[[CONVERT_1:.*]] = fir.convert %[[ARRAY_COOR_0]] : (!fir.ref) -> !fir.ref> ! CHECK: %[[SHAPE_SHIFT_1:.*]] = fir.shape_shift %[[BOX_DIMS_1]]#0, %[[BOX_DIMS_2]]#1 : (index, index) -> !fir.shapeshift<1> ! CHECK: %[[EMBOX_0:.*]] = fir.embox %[[CONVERT_1]](%[[SHAPE_SHIFT_1]]) : (!fir.ref>, !fir.shapeshift<1>) -> !fir.box> ! CHECK: acc.yield %[[EMBOX_0]] : !fir.box> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.box>, %[[VAL_1:.*]]: !fir.box>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 3 : index ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 0 : index ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 2 : index ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 3 : index ! CHECK: %[[CONSTANT_6:.*]] = arith.constant true ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_5]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_7:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_7]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[ADDI_0:.*]] = arith.addi %[[BOX_DIMS_0]]#0, %[[CONSTANT_1]] : index ! CHECK: %[[ADDI_1:.*]] = arith.addi %[[BOX_DIMS_0]]#0, %[[CONSTANT_2]] : index ! CHECK: %[[CONSTANT_8:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_1:.*]]:3 = fir.box_dims %[[VAL_1]], %[[CONSTANT_8]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[ADDI_2:.*]] = arith.addi %[[BOX_DIMS_1]]#0, %[[CONSTANT_1]] : index ! CHECK: %[[ADDI_3:.*]] = arith.addi %[[BOX_DIMS_1]]#0, %[[CONSTANT_2]] : index ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[ADDI_2]]:%[[ADDI_3]]:%[[CONSTANT_0]]) shape %[[SHAPE_0]] : (!fir.box>, index, index, index, !fir.shape<1>) -> !fir.box> ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[ADDI_0]]:%[[ADDI_1]]:%[[CONSTANT_0]]) shape %[[SHAPE_0]] : (!fir.box>, index, index, index, !fir.shape<1>) -> !fir.box> ! CHECK: %[[CONSTANT_9:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_9]] to %[[CONSTANT_5]] step %[[CONSTANT_9]] unordered { ! CHECK: %[[DESIGNATE_2:.*]] = hlfir.designate %[[DESIGNATE_0]] (%[[VAL_2]]) : (!fir.box>, index) -> !fir.ref ! CHECK: %[[DESIGNATE_3:.*]] = hlfir.designate %[[DESIGNATE_1]] (%[[VAL_2]]) : (!fir.box>, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_2]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_3]] : !fir.ref ! CHECK: %[[ADDI_4:.*]] = arith.addi %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[ADDI_4]] to %[[DESIGNATE_3]] : i32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.box> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_max_box_Uxf32 : !fir.box> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.box>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant -3.40282347E+38 : f32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_1]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[BOX_DIMS_0]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[BOX_DIMS_0]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[ALLOCMEM_0:.*]] = fir.allocmem !fir.array, %[[BOX_DIMS_0]]#1 {bindc_name = "acc.reduction.init", uniq_name = ""} ! CHECK: %[[EMBOX_0:.*]] = fir.embox %[[ALLOCMEM_0]](%[[SHAPE_1]]) : (!fir.heap>, !fir.shape<1>) -> !fir.box> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_1:.*]]:3 = fir.box_dims %[[EMBOX_0]], %[[CONSTANT_2]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_2:.*]] = fir.shape %[[BOX_DIMS_1]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_3]] to %[[BOX_DIMS_1]]#1 step %[[CONSTANT_3]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[EMBOX_0]] (%[[VAL_1]]) : (!fir.box>, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_0]] temporary_lhs : f32, !fir.ref ! CHECK: } ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_2:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_4]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_3:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_5]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_SHIFT_0:.*]] = fir.shape_shift %[[BOX_DIMS_2]]#0, %[[BOX_DIMS_3]]#1 : (index, index) -> !fir.shapeshift<1> ! CHECK: %[[EMBOX_1:.*]] = fir.embox %[[ALLOCMEM_0]](%[[SHAPE_SHIFT_0]]) : (!fir.heap>, !fir.shapeshift<1>) -> !fir.box> ! CHECK: acc.yield %[[EMBOX_1]] : !fir.box> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.box>, %[[VAL_1:.*]]: !fir.box>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_0]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[BOX_DIMS_0]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_1:.*]]:3 = fir.box_dims %[[VAL_1]], %[[CONSTANT_1]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[BOX_DIMS_1]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_2]] to %[[BOX_DIMS_0]]#1 step %[[CONSTANT_2]] unordered { ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_2:.*]]:3 = fir.box_dims %[[VAL_1]], %[[CONSTANT_3]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 1 : index ! CHECK: %[[SUBI_0:.*]] = arith.subi %[[BOX_DIMS_2]]#0, %[[CONSTANT_4]] : index ! CHECK: %[[ADDI_0:.*]] = arith.addi %[[VAL_2]], %[[SUBI_0]] : index ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[ADDI_0]]) : (!fir.box>, index) -> !fir.ref ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_3:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_5]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_6:.*]] = arith.constant 1 : index ! CHECK: %[[SUBI_1:.*]] = arith.subi %[[BOX_DIMS_3]]#0, %[[CONSTANT_6]] : index ! CHECK: %[[ADDI_1:.*]] = arith.addi %[[VAL_2]], %[[SUBI_1]] : index ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[ADDI_1]]) : (!fir.box>, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_0]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_1]] : !fir.ref ! CHECK: %[[CMPF_0:.*]] = arith.cmpf ogt, %[[LOAD_1]], %[[LOAD_0]] fastmath : f32 ! CHECK: %[[SELECT_0:.*]] = arith.select %[[CMPF_0]], %[[LOAD_1]], %[[LOAD_0]] : f32 ! CHECK: hlfir.assign %[[SELECT_0]] to %[[DESIGNATE_1]] : f32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.box> ! CHECK-LABEL: } destroy { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.box>, %[[VAL_1:.*]]: !fir.box>): ! CHECK: %[[BOX_ADDR_0:.*]] = fir.box_addr %[[VAL_1]] : (!fir.box>) -> !fir.ref> ! CHECK: %[[CONVERT_0:.*]] = fir.convert %[[BOX_ADDR_0]] : (!fir.ref>) -> !fir.heap> ! CHECK: fir.freemem %[[CONVERT_0]] : !fir.heap> ! CHECK: acc.terminator ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_add_box_Uxi32 : !fir.box> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.box>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : i32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_1]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[BOX_DIMS_0]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[BOX_DIMS_0]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[ALLOCMEM_0:.*]] = fir.allocmem !fir.array, %[[BOX_DIMS_0]]#1 {bindc_name = "acc.reduction.init", uniq_name = ""} ! CHECK: %[[EMBOX_0:.*]] = fir.embox %[[ALLOCMEM_0]](%[[SHAPE_1]]) : (!fir.heap>, !fir.shape<1>) -> !fir.box> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_1:.*]]:3 = fir.box_dims %[[EMBOX_0]], %[[CONSTANT_2]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_2:.*]] = fir.shape %[[BOX_DIMS_1]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_3]] to %[[BOX_DIMS_1]]#1 step %[[CONSTANT_3]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[EMBOX_0]] (%[[VAL_1]]) : (!fir.box>, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_0]] temporary_lhs : i32, !fir.ref ! CHECK: } ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_2:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_4]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_3:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_5]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_SHIFT_0:.*]] = fir.shape_shift %[[BOX_DIMS_2]]#0, %[[BOX_DIMS_3]]#1 : (index, index) -> !fir.shapeshift<1> ! CHECK: %[[EMBOX_1:.*]] = fir.embox %[[ALLOCMEM_0]](%[[SHAPE_SHIFT_0]]) : (!fir.heap>, !fir.shapeshift<1>) -> !fir.box> ! CHECK: acc.yield %[[EMBOX_1]] : !fir.box> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.box>, %[[VAL_1:.*]]: !fir.box>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_0]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[BOX_DIMS_0]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_1:.*]]:3 = fir.box_dims %[[VAL_1]], %[[CONSTANT_1]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[BOX_DIMS_1]]#1 : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_2]] to %[[BOX_DIMS_0]]#1 step %[[CONSTANT_2]] unordered { ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_2:.*]]:3 = fir.box_dims %[[VAL_1]], %[[CONSTANT_3]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 1 : index ! CHECK: %[[SUBI_0:.*]] = arith.subi %[[BOX_DIMS_2]]#0, %[[CONSTANT_4]] : index ! CHECK: %[[ADDI_0:.*]] = arith.addi %[[VAL_2]], %[[SUBI_0]] : index ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[ADDI_0]]) : (!fir.box>, index) -> !fir.ref ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 0 : index ! CHECK: %[[BOX_DIMS_3:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_5]] : (!fir.box>, index) -> (index, index, index) ! CHECK: %[[CONSTANT_6:.*]] = arith.constant 1 : index ! CHECK: %[[SUBI_1:.*]] = arith.subi %[[BOX_DIMS_3]]#0, %[[CONSTANT_6]] : index ! CHECK: %[[ADDI_1:.*]] = arith.addi %[[VAL_2]], %[[SUBI_1]] : index ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[ADDI_1]]) : (!fir.box>, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_0]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_1]] : !fir.ref ! CHECK: %[[ADDI_2:.*]] = arith.addi %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[ADDI_2]] to %[[DESIGNATE_1]] : i32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.box> ! CHECK-LABEL: } destroy { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.box>, %[[VAL_1:.*]]: !fir.box>): ! CHECK: %[[BOX_ADDR_0:.*]] = fir.box_addr %[[VAL_1]] : (!fir.box>) -> !fir.ref> ! CHECK: %[[CONVERT_0:.*]] = fir.convert %[[BOX_ADDR_0]] : (!fir.ref>) -> !fir.heap> ! CHECK: fir.freemem %[[CONVERT_0]] : !fir.heap> ! CHECK: acc.terminator ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_add_section_lb0.ub9xlb0.ub19_ref_10x20xi32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.array<10x20xi32> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : i32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 0 : index ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 9 : index ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 0 : index ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 19 : index ! CHECK: %[[CONSTANT_6:.*]] = arith.constant 0 : index ! CHECK: %[[CONSTANT_7:.*]] = arith.constant 10 : index ! CHECK: %[[CONSTANT_8:.*]] = arith.constant true ! CHECK: %[[CONSTANT_9:.*]] = arith.constant 0 : index ! CHECK: %[[CONSTANT_10:.*]] = arith.constant 20 : index ! CHECK: %[[CONSTANT_11:.*]] = arith.constant true ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_7]], %[[CONSTANT_10]] : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_12:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_13:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_14:.*]] = arith.constant 10 : index ! CHECK: %[[CONSTANT_15:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_16:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_17:.*]] = arith.constant 20 : index ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_0]] (%[[CONSTANT_13]]:%[[CONSTANT_14]]:%[[CONSTANT_1]], %[[CONSTANT_16]]:%[[CONSTANT_17]]:%[[CONSTANT_1]]) shape %[[SHAPE_0]] : (!fir.ref>, index, index, index, index, index, index, !fir.shape<2>) -> !fir.ref> ! CHECK: %[[CONSTANT_18:.*]] = arith.constant 10 : index ! CHECK: %[[CONSTANT_19:.*]] = arith.constant 20 : index ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_18]], %[[CONSTANT_19]] : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_20:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_20]] to %[[CONSTANT_19]] step %[[CONSTANT_20]] unordered { ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_20]] to %[[CONSTANT_18]] step %[[CONSTANT_20]] unordered { ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[ALLOCA_0]] (%[[VAL_2]], %[[VAL_1]]) : (!fir.ref>, index, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_1]] temporary_lhs : i32, !fir.ref ! CHECK: } ! CHECK: } ! CHECK: %[[CONSTANT_21:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_22:.*]] = arith.constant 10 : index ! CHECK: %[[CONSTANT_23:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_24:.*]] = arith.constant 20 : index ! CHECK: %[[CONSTANT_25:.*]] = arith.constant 0 : index ! CHECK: %[[SHAPE_SHIFT_0:.*]] = fir.shape_shift %[[CONSTANT_2]], %[[CONSTANT_22]], %[[CONSTANT_4]], %[[CONSTANT_24]] : (index, index, index, index) -> !fir.shapeshift<2> ! CHECK: %[[ARRAY_COOR_0:.*]] = fir.array_coor %[[ALLOCA_0]](%[[SHAPE_SHIFT_0]]) %[[CONSTANT_25]], %[[CONSTANT_25]] : (!fir.ref>, !fir.shapeshift<2>, index, index) -> !fir.ref ! CHECK: %[[CONVERT_0:.*]] = fir.convert %[[ARRAY_COOR_0]] : (!fir.ref) -> !fir.ref> ! CHECK: acc.yield %[[CONVERT_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 0 : index ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 9 : index ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 0 : index ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 19 : index ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 0 : index ! CHECK: %[[CONSTANT_6:.*]] = arith.constant 10 : index ! CHECK: %[[CONSTANT_7:.*]] = arith.constant true ! CHECK: %[[CONSTANT_8:.*]] = arith.constant 0 : index ! CHECK: %[[CONSTANT_9:.*]] = arith.constant 20 : index ! CHECK: %[[CONSTANT_10:.*]] = arith.constant true ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_6]], %[[CONSTANT_9]] : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_11:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_12:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_13:.*]] = arith.constant 10 : index ! CHECK: %[[CONSTANT_14:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_15:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_16:.*]] = arith.constant 20 : index ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[CONSTANT_12]]:%[[CONSTANT_13]]:%[[CONSTANT_0]], %[[CONSTANT_15]]:%[[CONSTANT_16]]:%[[CONSTANT_0]]) shape %[[SHAPE_0]] : (!fir.ref>, index, index, index, index, index, index, !fir.shape<2>) -> !fir.ref> ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[CONSTANT_12]]:%[[CONSTANT_13]]:%[[CONSTANT_0]], %[[CONSTANT_15]]:%[[CONSTANT_16]]:%[[CONSTANT_0]]) shape %[[SHAPE_0]] : (!fir.ref>, index, index, index, index, index, index, !fir.shape<2>) -> !fir.ref> ! CHECK: %[[CONSTANT_17:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_17]] to %[[CONSTANT_9]] step %[[CONSTANT_17]] unordered { ! CHECK: fir.do_loop %[[VAL_3:.*]] = %[[CONSTANT_17]] to %[[CONSTANT_6]] step %[[CONSTANT_17]] unordered { ! CHECK: %[[DESIGNATE_2:.*]] = hlfir.designate %[[DESIGNATE_0]] (%[[VAL_3]], %[[VAL_2]]) : (!fir.ref>, index, index) -> !fir.ref ! CHECK: %[[DESIGNATE_3:.*]] = hlfir.designate %[[DESIGNATE_1]] (%[[VAL_3]], %[[VAL_2]]) : (!fir.ref>, index, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_2]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_3]] : !fir.ref ! CHECK: %[[ADDI_0:.*]] = arith.addi %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[ADDI_0]] to %[[DESIGNATE_3]] : i32, !fir.ref ! CHECK: } ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_add_section_lb10.ub19_ref_100xi32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.array<10xi32> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : i32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 10 : index ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 19 : index ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 0 : index ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 9 : index ! CHECK: %[[CONSTANT_6:.*]] = arith.constant 10 : index ! CHECK: %[[CONSTANT_7:.*]] = arith.constant true ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_6]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_8:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_9:.*]] = arith.constant 11 : index ! CHECK: %[[CONSTANT_10:.*]] = arith.constant 20 : index ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_0]] (%[[CONSTANT_9]]:%[[CONSTANT_10]]:%[[CONSTANT_1]]) shape %[[SHAPE_0]] : (!fir.ref>, index, index, index, !fir.shape<1>) -> !fir.ref> ! CHECK: %[[CONSTANT_11:.*]] = arith.constant 10 : index ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_11]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_12:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_12]] to %[[CONSTANT_11]] step %[[CONSTANT_12]] unordered { ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[ALLOCA_0]] (%[[VAL_1]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_1]] temporary_lhs : i32, !fir.ref ! CHECK: } ! CHECK: %[[CONSTANT_13:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_14:.*]] = arith.constant 100 : index ! CHECK: %[[CONVERT_0:.*]] = fir.convert %[[ALLOCA_0]] : (!fir.ref>) -> !fir.ref> ! CHECK: %[[CONSTANT_15:.*]] = arith.constant 0 : index ! CHECK: %[[SHAPE_SHIFT_0:.*]] = fir.shape_shift %[[CONSTANT_2]], %[[CONSTANT_14]] : (index, index) -> !fir.shapeshift<1> ! CHECK: %[[ARRAY_COOR_0:.*]] = fir.array_coor %[[CONVERT_0]](%[[SHAPE_SHIFT_0]]) %[[CONSTANT_15]] : (!fir.ref>, !fir.shapeshift<1>, index) -> !fir.ref ! CHECK: %[[CONVERT_1:.*]] = fir.convert %[[ARRAY_COOR_0]] : (!fir.ref) -> !fir.ref> ! CHECK: acc.yield %[[CONVERT_1]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 10 : index ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 19 : index ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 0 : index ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 9 : index ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 10 : index ! CHECK: %[[CONSTANT_6:.*]] = arith.constant true ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_5]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_7:.*]] = arith.constant 1 : index ! CHECK: %[[CONSTANT_8:.*]] = arith.constant 11 : index ! CHECK: %[[CONSTANT_9:.*]] = arith.constant 20 : index ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[CONSTANT_8]]:%[[CONSTANT_9]]:%[[CONSTANT_0]]) shape %[[SHAPE_0]] : (!fir.ref>, index, index, index, !fir.shape<1>) -> !fir.ref> ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[CONSTANT_8]]:%[[CONSTANT_9]]:%[[CONSTANT_0]]) shape %[[SHAPE_0]] : (!fir.ref>, index, index, index, !fir.shape<1>) -> !fir.ref> ! CHECK: %[[CONSTANT_10:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_10]] to %[[CONSTANT_5]] step %[[CONSTANT_10]] unordered { ! CHECK: %[[DESIGNATE_2:.*]] = hlfir.designate %[[DESIGNATE_0]] (%[[VAL_2]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: %[[DESIGNATE_3:.*]] = hlfir.designate %[[DESIGNATE_1]] (%[[VAL_2]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_2]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_3]] : !fir.ref ! CHECK: %[[ADDI_0:.*]] = arith.addi %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[ADDI_0]] to %[[DESIGNATE_3]] : i32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_box_ptr_i32 : !fir.ref>> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : i32 ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_0]] : !fir.ref>> ! CHECK: %[[BOX_ADDR_0:.*]] = fir.box_addr %[[LOAD_0]] : (!fir.box>) -> !fir.ptr ! CHECK: %[[ALLOCMEM_0:.*]] = fir.allocmem i32 {bindc_name = "acc.reduction.init", uniq_name = ""} ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCMEM_0]] temporary_lhs : i32, !fir.heap ! CHECK: %[[EMBOX_0:.*]] = fir.embox %[[ALLOCMEM_0]] : (!fir.heap) -> !fir.box> ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.box> ! CHECK: fir.store %[[EMBOX_0]] to %[[ALLOCA_0]] : !fir.ref>> ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref>> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>>, %[[VAL_1:.*]]: !fir.ref>>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref>> ! CHECK: %[[BOX_ADDR_0:.*]] = fir.box_addr %[[LOAD_0]] : (!fir.box>) -> !fir.ptr ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref>> ! CHECK: %[[BOX_ADDR_1:.*]] = fir.box_addr %[[LOAD_1]] : (!fir.box>) -> !fir.ptr ! CHECK: %[[LOAD_2:.*]] = fir.load %[[BOX_ADDR_0]] : !fir.ptr ! CHECK: %[[LOAD_3:.*]] = fir.load %[[BOX_ADDR_1]] : !fir.ptr ! CHECK: %[[ADDI_0:.*]] = arith.addi %[[LOAD_3]], %[[LOAD_2]] : i32 ! CHECK: hlfir.assign %[[ADDI_0]] to %[[BOX_ADDR_1]] : i32, !fir.ptr ! CHECK: acc.yield %[[VAL_0]] : !fir.ref>> ! CHECK-LABEL: } destroy { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>>, %[[VAL_1:.*]]: !fir.ref>>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref>> ! CHECK: %[[BOX_ADDR_0:.*]] = fir.box_addr %[[LOAD_0]] : (!fir.box>) -> !fir.ptr ! CHECK: %[[CONVERT_0:.*]] = fir.convert %[[BOX_ADDR_0]] : (!fir.ptr) -> !fir.heap ! CHECK: fir.freemem %[[CONVERT_0]] : !fir.heap ! CHECK: acc.terminator ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_box_heap_i32 : !fir.ref>> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : i32 ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_0]] : !fir.ref>> ! CHECK: %[[BOX_ADDR_0:.*]] = fir.box_addr %[[LOAD_0]] : (!fir.box>) -> !fir.heap ! CHECK: %[[ALLOCMEM_0:.*]] = fir.allocmem i32 {bindc_name = "acc.reduction.init", uniq_name = ""} ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCMEM_0]] temporary_lhs : i32, !fir.heap ! CHECK: %[[EMBOX_0:.*]] = fir.embox %[[ALLOCMEM_0]] : (!fir.heap) -> !fir.box> ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.box> ! CHECK: fir.store %[[EMBOX_0]] to %[[ALLOCA_0]] : !fir.ref>> ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref>> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>>, %[[VAL_1:.*]]: !fir.ref>>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref>> ! CHECK: %[[BOX_ADDR_0:.*]] = fir.box_addr %[[LOAD_0]] : (!fir.box>) -> !fir.heap ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref>> ! CHECK: %[[BOX_ADDR_1:.*]] = fir.box_addr %[[LOAD_1]] : (!fir.box>) -> !fir.heap ! CHECK: %[[LOAD_2:.*]] = fir.load %[[BOX_ADDR_0]] : !fir.heap ! CHECK: %[[LOAD_3:.*]] = fir.load %[[BOX_ADDR_1]] : !fir.heap ! CHECK: %[[ADDI_0:.*]] = arith.addi %[[LOAD_3]], %[[LOAD_2]] : i32 ! CHECK: hlfir.assign %[[ADDI_0]] to %[[BOX_ADDR_1]] : i32, !fir.heap ! CHECK: acc.yield %[[VAL_0]] : !fir.ref>> ! CHECK-LABEL: } destroy { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>>, %[[VAL_1:.*]]: !fir.ref>>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref>> ! CHECK: %[[BOX_ADDR_0:.*]] = fir.box_addr %[[LOAD_0]] : (!fir.box>) -> !fir.heap ! CHECK: fir.freemem %[[BOX_ADDR_0]] : !fir.heap ! CHECK: acc.terminator ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_mul_ref_z32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca complex {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 1.000000e+00 : f32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 0.000000e+00 : f32 ! CHECK: %[[UNDEFINED_0:.*]] = fir.undefined complex ! CHECK: %[[INSERT_VALUE_0:.*]] = fir.insert_value %[[UNDEFINED_0]], %[[CONSTANT_0]], [0 : index] : (complex, f32) -> complex ! CHECK: %[[INSERT_VALUE_1:.*]] = fir.insert_value %[[INSERT_VALUE_0]], %[[CONSTANT_1]], [1 : index] : (complex, f32) -> complex ! CHECK: hlfir.assign %[[INSERT_VALUE_1]] to %[[ALLOCA_0]] temporary_lhs : complex, !fir.ref> ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref> ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref> ! CHECK: %[[MULC_0:.*]] = fir.mulc %[[LOAD_1]], %[[LOAD_0]] {fastmath = #arith.fastmath} : complex ! CHECK: hlfir.assign %[[MULC_0]] to %[[VAL_0]] : complex, !fir.ref> ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_z32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca complex {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0.000000e+00 : f32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 0.000000e+00 : f32 ! CHECK: %[[UNDEFINED_0:.*]] = fir.undefined complex ! CHECK: %[[INSERT_VALUE_0:.*]] = fir.insert_value %[[UNDEFINED_0]], %[[CONSTANT_0]], [0 : index] : (complex, f32) -> complex ! CHECK: %[[INSERT_VALUE_1:.*]] = fir.insert_value %[[INSERT_VALUE_0]], %[[CONSTANT_1]], [1 : index] : (complex, f32) -> complex ! CHECK: hlfir.assign %[[INSERT_VALUE_1]] to %[[ALLOCA_0]] temporary_lhs : complex, !fir.ref> ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref> ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref> ! CHECK: %[[ADDC_0:.*]] = fir.addc %[[LOAD_1]], %[[LOAD_0]] {fastmath = #arith.fastmath} : complex ! CHECK: hlfir.assign %[[ADDC_0]] to %[[VAL_0]] : complex, !fir.ref> ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_neqv_ref_l32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.logical<4> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant false ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCA_0]] temporary_lhs : i1, !fir.ref> ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref> ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref> ! CHECK: %[[CMPI_0:.*]] = fir.neqv %[[LOAD_1]], %[[LOAD_0]] : !fir.logical<4> ! CHECK: hlfir.assign %[[CMPI_0]] to %[[VAL_0]] : !fir.logical<4>, !fir.ref> ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_eqv_ref_l32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.logical<4> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant true ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCA_0]] temporary_lhs : i1, !fir.ref> ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref> ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref> ! CHECK: %[[CMPI_0:.*]] = fir.eqv %[[LOAD_1]], %[[LOAD_0]] : !fir.logical<4> ! CHECK: hlfir.assign %[[CMPI_0]] to %[[VAL_0]] : !fir.logical<4>, !fir.ref> ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_lor_ref_l32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.logical<4> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant false ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCA_0]] temporary_lhs : i1, !fir.ref> ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref> ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref> ! CHECK: %[[ORI_0:.*]] = fir.logical_or %[[LOAD_1]], %[[LOAD_0]] : !fir.logical<4> ! CHECK: hlfir.assign %[[ORI_0]] to %[[VAL_0]] : !fir.logical<4>, !fir.ref> ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_land_ref_l32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.logical<4> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant true ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCA_0]] temporary_lhs : i1, !fir.ref> ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref> ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref> ! CHECK: %[[ANDI_0:.*]] = fir.logical_and %[[LOAD_1]], %[[LOAD_0]] : !fir.logical<4> ! CHECK: hlfir.assign %[[ANDI_0]] to %[[VAL_0]] : !fir.logical<4>, !fir.ref> ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_xor_ref_i32 : !fir.ref reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca i32 {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : i32 ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCA_0]] temporary_lhs : i32, !fir.ref ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref, %[[VAL_1:.*]]: !fir.ref): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref ! CHECK: %[[XORI_0:.*]] = arith.xori %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[XORI_0]] to %[[VAL_0]] : i32, !fir.ref ! CHECK: acc.yield %[[VAL_0]] : !fir.ref ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_ior_ref_i32 : !fir.ref reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca i32 {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : i32 ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCA_0]] temporary_lhs : i32, !fir.ref ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref, %[[VAL_1:.*]]: !fir.ref): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref ! CHECK: %[[ORI_0:.*]] = arith.ori %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[ORI_0]] to %[[VAL_0]] : i32, !fir.ref ! CHECK: acc.yield %[[VAL_0]] : !fir.ref ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_iand_ref_i32 : !fir.ref reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca i32 {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant -1 : i32 ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCA_0]] temporary_lhs : i32, !fir.ref ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref, %[[VAL_1:.*]]: !fir.ref): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref ! CHECK: %[[ANDI_0:.*]] = arith.andi %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[ANDI_0]] to %[[VAL_0]] : i32, !fir.ref ! CHECK: acc.yield %[[VAL_0]] : !fir.ref ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_max_ref_100xf32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.array<100xf32> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant -3.40282347E+38 : f32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_2:.*]] = fir.shape %[[CONSTANT_2]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_3]] to %[[CONSTANT_2]] step %[[CONSTANT_3]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[ALLOCA_0]] (%[[VAL_1]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_0]] temporary_lhs : f32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_0]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_2]] to %[[CONSTANT_0]] step %[[CONSTANT_2]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[VAL_2]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[VAL_2]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_0]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_1]] : !fir.ref ! CHECK: %[[CMPF_0:.*]] = arith.cmpf ogt, %[[LOAD_1]], %[[LOAD_0]] fastmath : f32 ! CHECK: %[[SELECT_0:.*]] = arith.select %[[CMPF_0]], %[[LOAD_1]], %[[LOAD_0]] : f32 ! CHECK: hlfir.assign %[[SELECT_0]] to %[[DESIGNATE_1]] : f32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_max_ref_f32 : !fir.ref reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca f32 {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant -3.40282347E+38 : f32 ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCA_0]] temporary_lhs : f32, !fir.ref ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref, %[[VAL_1:.*]]: !fir.ref): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref ! CHECK: %[[CMPF_0:.*]] = arith.cmpf ogt, %[[LOAD_1]], %[[LOAD_0]] fastmath : f32 ! CHECK: %[[SELECT_0:.*]] = arith.select %[[CMPF_0]], %[[LOAD_1]], %[[LOAD_0]] : f32 ! CHECK: hlfir.assign %[[SELECT_0]] to %[[VAL_0]] : f32, !fir.ref ! CHECK: acc.yield %[[VAL_0]] : !fir.ref ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_max_ref_100x10xi32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.array<100x10xi32> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant -2147483648 : i32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 10 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_1]], %[[CONSTANT_2]] : (index, index) -> !fir.shape<2> ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]], %[[CONSTANT_2]] : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 10 : index ! CHECK: %[[SHAPE_2:.*]] = fir.shape %[[CONSTANT_3]], %[[CONSTANT_4]] : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_5]] to %[[CONSTANT_4]] step %[[CONSTANT_5]] unordered { ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_5]] to %[[CONSTANT_3]] step %[[CONSTANT_5]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[ALLOCA_0]] (%[[VAL_2]], %[[VAL_1]]) : (!fir.ref>, index, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_0]] temporary_lhs : i32, !fir.ref ! CHECK: } ! CHECK: } ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 10 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_0]], %[[CONSTANT_1]] : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 10 : index ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_2]], %[[CONSTANT_3]] : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_4]] to %[[CONSTANT_1]] step %[[CONSTANT_4]] unordered { ! CHECK: fir.do_loop %[[VAL_3:.*]] = %[[CONSTANT_4]] to %[[CONSTANT_0]] step %[[CONSTANT_4]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[VAL_3]], %[[VAL_2]]) : (!fir.ref>, index, index) -> !fir.ref ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[VAL_3]], %[[VAL_2]]) : (!fir.ref>, index, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_0]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_1]] : !fir.ref ! CHECK: %[[SELECT_0:.*]] = arith.maxsi %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[SELECT_0]] to %[[DESIGNATE_1]] : i32, !fir.ref ! CHECK: } ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_max_ref_i32 : !fir.ref reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca i32 {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant -2147483648 : i32 ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCA_0]] temporary_lhs : i32, !fir.ref ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref, %[[VAL_1:.*]]: !fir.ref): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref ! CHECK: %[[SELECT_0:.*]] = arith.maxsi %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[SELECT_0]] to %[[VAL_0]] : i32, !fir.ref ! CHECK: acc.yield %[[VAL_0]] : !fir.ref ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_min_ref_100x10xf32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.array<100x10xf32> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 3.40282347E+38 : f32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 10 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_1]], %[[CONSTANT_2]] : (index, index) -> !fir.shape<2> ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]], %[[CONSTANT_2]] : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 10 : index ! CHECK: %[[SHAPE_2:.*]] = fir.shape %[[CONSTANT_3]], %[[CONSTANT_4]] : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_5]] to %[[CONSTANT_4]] step %[[CONSTANT_5]] unordered { ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_5]] to %[[CONSTANT_3]] step %[[CONSTANT_5]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[ALLOCA_0]] (%[[VAL_2]], %[[VAL_1]]) : (!fir.ref>, index, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_0]] temporary_lhs : f32, !fir.ref ! CHECK: } ! CHECK: } ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 10 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_0]], %[[CONSTANT_1]] : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 10 : index ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_2]], %[[CONSTANT_3]] : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_4]] to %[[CONSTANT_1]] step %[[CONSTANT_4]] unordered { ! CHECK: fir.do_loop %[[VAL_3:.*]] = %[[CONSTANT_4]] to %[[CONSTANT_0]] step %[[CONSTANT_4]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[VAL_3]], %[[VAL_2]]) : (!fir.ref>, index, index) -> !fir.ref ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[VAL_3]], %[[VAL_2]]) : (!fir.ref>, index, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_0]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_1]] : !fir.ref ! CHECK: %[[CMPF_0:.*]] = arith.cmpf olt, %[[LOAD_1]], %[[LOAD_0]] fastmath : f32 ! CHECK: %[[SELECT_0:.*]] = arith.select %[[CMPF_0]], %[[LOAD_1]], %[[LOAD_0]] : f32 ! CHECK: hlfir.assign %[[SELECT_0]] to %[[DESIGNATE_1]] : f32, !fir.ref ! CHECK: } ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_min_ref_f32 : !fir.ref reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca f32 {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 3.40282347E+38 : f32 ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCA_0]] temporary_lhs : f32, !fir.ref ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref, %[[VAL_1:.*]]: !fir.ref): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref ! CHECK: %[[CMPF_0:.*]] = arith.cmpf olt, %[[LOAD_1]], %[[LOAD_0]] fastmath : f32 ! CHECK: %[[SELECT_0:.*]] = arith.select %[[CMPF_0]], %[[LOAD_1]], %[[LOAD_0]] : f32 ! CHECK: hlfir.assign %[[SELECT_0]] to %[[VAL_0]] : f32, !fir.ref ! CHECK: acc.yield %[[VAL_0]] : !fir.ref ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_min_ref_100xi32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.array<100xi32> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 2147483647 : i32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_2:.*]] = fir.shape %[[CONSTANT_2]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_3]] to %[[CONSTANT_2]] step %[[CONSTANT_3]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[ALLOCA_0]] (%[[VAL_1]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_0]] temporary_lhs : i32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_0]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_2]] to %[[CONSTANT_0]] step %[[CONSTANT_2]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[VAL_2]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[VAL_2]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_0]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_1]] : !fir.ref ! CHECK: %[[SELECT_0:.*]] = arith.minsi %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[SELECT_0]] to %[[DESIGNATE_1]] : i32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_min_ref_i32 : !fir.ref reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca i32 {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 2147483647 : i32 ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCA_0]] temporary_lhs : i32, !fir.ref ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref, %[[VAL_1:.*]]: !fir.ref): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref ! CHECK: %[[SELECT_0:.*]] = arith.minsi %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[SELECT_0]] to %[[VAL_0]] : i32, !fir.ref ! CHECK: acc.yield %[[VAL_0]] : !fir.ref ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_mul_ref_100xf32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.array<100xf32> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 1.000000e+00 : f32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_2:.*]] = fir.shape %[[CONSTANT_2]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_3]] to %[[CONSTANT_2]] step %[[CONSTANT_3]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[ALLOCA_0]] (%[[VAL_1]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_0]] temporary_lhs : f32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_0]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_2]] to %[[CONSTANT_0]] step %[[CONSTANT_2]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[VAL_2]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[VAL_2]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_0]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_1]] : !fir.ref ! CHECK: %[[MULF_0:.*]] = arith.mulf %[[LOAD_1]], %[[LOAD_0]] fastmath : f32 ! CHECK: hlfir.assign %[[MULF_0]] to %[[DESIGNATE_1]] : f32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_mul_ref_f32 : !fir.ref reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca f32 {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 1.000000e+00 : f32 ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCA_0]] temporary_lhs : f32, !fir.ref ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref, %[[VAL_1:.*]]: !fir.ref): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref ! CHECK: %[[MULF_0:.*]] = arith.mulf %[[LOAD_1]], %[[LOAD_0]] fastmath : f32 ! CHECK: hlfir.assign %[[MULF_0]] to %[[VAL_0]] : f32, !fir.ref ! CHECK: acc.yield %[[VAL_0]] : !fir.ref ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_mul_ref_100xi32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.array<100xi32> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 1 : i32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_2:.*]] = fir.shape %[[CONSTANT_2]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_3]] to %[[CONSTANT_2]] step %[[CONSTANT_3]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[ALLOCA_0]] (%[[VAL_1]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_0]] temporary_lhs : i32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_0]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_2]] to %[[CONSTANT_0]] step %[[CONSTANT_2]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[VAL_2]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[VAL_2]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_0]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_1]] : !fir.ref ! CHECK: %[[MULI_0:.*]] = arith.muli %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[MULI_0]] to %[[DESIGNATE_1]] : i32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_mul_ref_i32 : !fir.ref reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca i32 {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 1 : i32 ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCA_0]] temporary_lhs : i32, !fir.ref ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref, %[[VAL_1:.*]]: !fir.ref): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref ! CHECK: %[[MULI_0:.*]] = arith.muli %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[MULI_0]] to %[[VAL_0]] : i32, !fir.ref ! CHECK: acc.yield %[[VAL_0]] : !fir.ref ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_100xf32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.array<100xf32> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0.000000e+00 : f32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_2:.*]] = fir.shape %[[CONSTANT_2]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_3]] to %[[CONSTANT_2]] step %[[CONSTANT_3]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[ALLOCA_0]] (%[[VAL_1]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_0]] temporary_lhs : f32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_0]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_2]] to %[[CONSTANT_0]] step %[[CONSTANT_2]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[VAL_2]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[VAL_2]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_0]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_1]] : !fir.ref ! CHECK: %[[ADDF_0:.*]] = arith.addf %[[LOAD_1]], %[[LOAD_0]] fastmath : f32 ! CHECK: hlfir.assign %[[ADDF_0]] to %[[DESIGNATE_1]] : f32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_f32 : !fir.ref reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca f32 {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0.000000e+00 : f32 ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCA_0]] temporary_lhs : f32, !fir.ref ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref, %[[VAL_1:.*]]: !fir.ref): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref ! CHECK: %[[ADDF_0:.*]] = arith.addf %[[LOAD_1]], %[[LOAD_0]] fastmath : f32 ! CHECK: hlfir.assign %[[ADDF_0]] to %[[VAL_0]] : f32, !fir.ref ! CHECK: acc.yield %[[VAL_0]] : !fir.ref ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_100x10x2xi32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.array<100x10x2xi32> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : i32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 10 : index ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 2 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_1]], %[[CONSTANT_2]], %[[CONSTANT_3]] : (index, index, index) -> !fir.shape<3> ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]], %[[CONSTANT_2]], %[[CONSTANT_3]] : (index, index, index) -> !fir.shape<3> ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 10 : index ! CHECK: %[[CONSTANT_6:.*]] = arith.constant 2 : index ! CHECK: %[[SHAPE_2:.*]] = fir.shape %[[CONSTANT_4]], %[[CONSTANT_5]], %[[CONSTANT_6]] : (index, index, index) -> !fir.shape<3> ! CHECK: %[[CONSTANT_7:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_7]] to %[[CONSTANT_6]] step %[[CONSTANT_7]] unordered { ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_7]] to %[[CONSTANT_5]] step %[[CONSTANT_7]] unordered { ! CHECK: fir.do_loop %[[VAL_3:.*]] = %[[CONSTANT_7]] to %[[CONSTANT_4]] step %[[CONSTANT_7]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[ALLOCA_0]] (%[[VAL_3]], %[[VAL_2]], %[[VAL_1]]) : (!fir.ref>, index, index, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_0]] temporary_lhs : i32, !fir.ref ! CHECK: } ! CHECK: } ! CHECK: } ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 10 : index ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 2 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_0]], %[[CONSTANT_1]], %[[CONSTANT_2]] : (index, index, index) -> !fir.shape<3> ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 10 : index ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 2 : index ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_3]], %[[CONSTANT_4]], %[[CONSTANT_5]] : (index, index, index) -> !fir.shape<3> ! CHECK: %[[CONSTANT_6:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_6]] to %[[CONSTANT_2]] step %[[CONSTANT_6]] unordered { ! CHECK: fir.do_loop %[[VAL_3:.*]] = %[[CONSTANT_6]] to %[[CONSTANT_1]] step %[[CONSTANT_6]] unordered { ! CHECK: fir.do_loop %[[VAL_4:.*]] = %[[CONSTANT_6]] to %[[CONSTANT_0]] step %[[CONSTANT_6]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[VAL_4]], %[[VAL_3]], %[[VAL_2]]) : (!fir.ref>, index, index, index) -> !fir.ref ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[VAL_4]], %[[VAL_3]], %[[VAL_2]]) : (!fir.ref>, index, index, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_0]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_1]] : !fir.ref ! CHECK: %[[ADDI_0:.*]] = arith.addi %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[ADDI_0]] to %[[DESIGNATE_1]] : i32, !fir.ref ! CHECK: } ! CHECK: } ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_100x10xi32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.array<100x10xi32> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : i32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 10 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_1]], %[[CONSTANT_2]] : (index, index) -> !fir.shape<2> ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]], %[[CONSTANT_2]] : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 10 : index ! CHECK: %[[SHAPE_2:.*]] = fir.shape %[[CONSTANT_3]], %[[CONSTANT_4]] : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_5:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_5]] to %[[CONSTANT_4]] step %[[CONSTANT_5]] unordered { ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_5]] to %[[CONSTANT_3]] step %[[CONSTANT_5]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[ALLOCA_0]] (%[[VAL_2]], %[[VAL_1]]) : (!fir.ref>, index, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_0]] temporary_lhs : i32, !fir.ref ! CHECK: } ! CHECK: } ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 10 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_0]], %[[CONSTANT_1]] : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 100 : index ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 10 : index ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_2]], %[[CONSTANT_3]] : (index, index) -> !fir.shape<2> ! CHECK: %[[CONSTANT_4:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_4]] to %[[CONSTANT_1]] step %[[CONSTANT_4]] unordered { ! CHECK: fir.do_loop %[[VAL_3:.*]] = %[[CONSTANT_4]] to %[[CONSTANT_0]] step %[[CONSTANT_4]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[VAL_3]], %[[VAL_2]]) : (!fir.ref>, index, index) -> !fir.ref ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[VAL_3]], %[[VAL_2]]) : (!fir.ref>, index, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_0]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_1]] : !fir.ref ! CHECK: %[[ADDI_0:.*]] = arith.addi %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[ADDI_0]] to %[[DESIGNATE_1]] : i32, !fir.ref ! CHECK: } ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_100xi32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca !fir.array<100xi32> {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : i32 ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_2:.*]] = fir.shape %[[CONSTANT_2]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_3:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_1:.*]] = %[[CONSTANT_3]] to %[[CONSTANT_2]] step %[[CONSTANT_3]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[ALLOCA_0]] (%[[VAL_1]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[DESIGNATE_0]] temporary_lhs : i32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref> ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>, %[[VAL_1:.*]]: !fir.ref>): ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_0]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_1:.*]] = arith.constant 100 : index ! CHECK: %[[SHAPE_1:.*]] = fir.shape %[[CONSTANT_1]] : (index) -> !fir.shape<1> ! CHECK: %[[CONSTANT_2:.*]] = arith.constant 1 : index ! CHECK: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_2]] to %[[CONSTANT_0]] step %[[CONSTANT_2]] unordered { ! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[VAL_2]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[VAL_2]]) : (!fir.ref>, index) -> !fir.ref ! CHECK: %[[LOAD_0:.*]] = fir.load %[[DESIGNATE_0]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[DESIGNATE_1]] : !fir.ref ! CHECK: %[[ADDI_0:.*]] = arith.addi %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[ADDI_0]] to %[[DESIGNATE_1]] : i32, !fir.ref ! CHECK: } ! CHECK: acc.yield %[[VAL_0]] : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.private.recipe @privatization_ref_i32 : !fir.ref init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca i32 {bindc_name = "acc.private.init"} ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref ! CHECK: } ! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_i32 : !fir.ref reduction_operator init { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): ! CHECK: %[[ALLOCA_0:.*]] = fir.alloca i32 {bindc_name = "acc.reduction.init"} ! CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : i32 ! CHECK: hlfir.assign %[[CONSTANT_0]] to %[[ALLOCA_0]] temporary_lhs : i32, !fir.ref ! CHECK: acc.yield %[[ALLOCA_0]] : !fir.ref ! CHECK-LABEL: } combiner { ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref, %[[VAL_1:.*]]: !fir.ref): ! CHECK: %[[LOAD_0:.*]] = fir.load %[[VAL_1]] : !fir.ref ! CHECK: %[[LOAD_1:.*]] = fir.load %[[VAL_0]] : !fir.ref ! CHECK: %[[ADDI_0:.*]] = arith.addi %[[LOAD_1]], %[[LOAD_0]] : i32 ! CHECK: hlfir.assign %[[ADDI_0]] to %[[VAL_0]] : i32, !fir.ref ! CHECK: acc.yield %[[VAL_0]] : !fir.ref ! CHECK: } subroutine acc_reduction_add_int(a, b) integer :: a(100) integer :: i, b !$acc loop reduction(+:b) do i = 1, 100 b = b + a(i) end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_int( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) ! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#0 : !fir.ref) recipe(@reduction_add_ref_i32) -> !fir.ref {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_B]] : !fir.ref) ! The non-standard '-' reduction operator is treated as '+', so it reuses the ! add recipe. subroutine acc_reduction_minus_int(a, b) integer :: a(100) integer :: i, b !$acc loop reduction(-:b) do i = 1, 100 b = b - a(i) end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_minus_int( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) ! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#0 : !fir.ref) recipe(@reduction_add_ref_i32) -> !fir.ref {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_B]] : !fir.ref) subroutine acc_reduction_add_int_array_1d(a, b) integer :: a(100) integer :: i, b(100) !$acc loop reduction(+:b) do i = 1, 100 b(i) = b(i) + a(i) end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_int_array_1d( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref> {fir.bindc_name = "b"}) ! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#0 : !fir.ref>) recipe(@reduction_add_ref_100xi32) -> !fir.ref> {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_B]] : !fir.ref>) subroutine acc_reduction_add_int_array_2d(a, b) integer :: a(100, 10), b(100, 10) integer :: i, j !$acc loop collapse(2) reduction(+:b) do i = 1, 100 do j = 1, 10 b(i, j) = b(i, j) + a(i, j) end do end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_int_array_2d( ! CHECK-SAME: %[[ARG0:.*]]: !fir.ref> {fir.bindc_name = "a"}, %[[ARG1:.*]]: !fir.ref> {fir.bindc_name = "b"}) { ! CHECK: %[[DECLARG1:.*]]:2 = hlfir.declare %[[ARG1]] ! CHECK: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[DECLARG1]]#0 : !fir.ref>) recipe(@reduction_add_ref_100x10xi32) -> !fir.ref> {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_ARG1]] : !fir.ref>) ! CHECK: } attributes {collapse = [2]{{.*}} subroutine acc_reduction_add_int_array_3d(a, b) integer :: a(100, 10, 2), b(100, 10, 2) integer :: i, j, k !$acc loop collapse(3) reduction(+:b) do i = 1, 100 do j = 1, 10 do k = 1, 2 b(i, j, k) = b(i, j, k) + a(i, j, k) end do end do end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_int_array_3d( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[ARG1:.*]]: !fir.ref> {fir.bindc_name = "b"}) ! CHECK: %[[DECLARG1:.*]]:2 = hlfir.declare %[[ARG1]] ! CHECK: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[DECLARG1]]#0 : !fir.ref>) recipe(@reduction_add_ref_100x10x2xi32) -> !fir.ref> {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_ARG1]] : !fir.ref>) ! CHECK: } attributes {collapse = [3]{{.*}} subroutine acc_reduction_add_float(a, b) real :: a(100), b integer :: i !$acc loop reduction(+:b) do i = 1, 100 b = b + a(i) end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_float( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) ! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#0 : !fir.ref) recipe(@reduction_add_ref_f32) -> !fir.ref {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_B]] : !fir.ref) subroutine acc_reduction_add_float_array_1d(a, b) real :: a(100), b(100) integer :: i !$acc loop reduction(+:b) do i = 1, 100 b(i) = b(i) + a(i) end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_float_array_1d( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref> {fir.bindc_name = "b"}) ! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#0 : !fir.ref>) recipe(@reduction_add_ref_100xf32) -> !fir.ref> {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_B]] : !fir.ref>) subroutine acc_reduction_mul_int(a, b) integer :: a(100) integer :: i, b !$acc loop reduction(*:b) do i = 1, 100 b = b * a(i) end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_mul_int( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) ! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#0 : !fir.ref) recipe(@reduction_mul_ref_i32) -> !fir.ref {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_B]] : !fir.ref) subroutine acc_reduction_mul_int_array_1d(a, b) integer :: a(100) integer :: i, b(100) !$acc loop reduction(*:b) do i = 1, 100 b(i) = b(i) * a(i) end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_mul_int_array_1d( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref> {fir.bindc_name = "b"}) ! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#0 : !fir.ref>) recipe(@reduction_mul_ref_100xi32) -> !fir.ref> {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_B]] : !fir.ref>) subroutine acc_reduction_mul_float(a, b) real :: a(100), b integer :: i !$acc loop reduction(*:b) do i = 1, 100 b = b * a(i) end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_mul_float( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) ! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#0 : !fir.ref) recipe(@reduction_mul_ref_f32) -> !fir.ref {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_B]] : !fir.ref) subroutine acc_reduction_mul_float_array_1d(a, b) real :: a(100), b(100) integer :: i !$acc loop reduction(*:b) do i = 1, 100 b(i) = b(i) * a(i) end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_mul_float_array_1d( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref> {fir.bindc_name = "b"}) ! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#0 : !fir.ref>) recipe(@reduction_mul_ref_100xf32) -> !fir.ref> {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_B]] : !fir.ref>) subroutine acc_reduction_min_int(a, b) integer :: a(100) integer :: i, b !$acc loop reduction(min:b) do i = 1, 100 b = min(b, a(i)) end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_min_int( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) ! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#0 : !fir.ref) recipe(@reduction_min_ref_i32) -> !fir.ref {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_B]] : !fir.ref) subroutine acc_reduction_min_int_array_1d(a, b) integer :: a(100), b(100) integer :: i !$acc loop reduction(min:b) do i = 1, 100 b(i) = min(b(i), a(i)) end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_min_int_array_1d( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[ARG1:.*]]: !fir.ref> {fir.bindc_name = "b"}) ! CHECK: %[[DECLARG1:.*]]:2 = hlfir.declare %[[ARG1]] ! CHECK: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[DECLARG1]]#0 : !fir.ref>) recipe(@reduction_min_ref_100xi32) -> !fir.ref> {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_ARG1]] : !fir.ref>) subroutine acc_reduction_min_float(a, b) real :: a(100), b integer :: i !$acc loop reduction(min:b) do i = 1, 100 b = min(b, a(i)) end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_min_float( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) ! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#0 : !fir.ref) recipe(@reduction_min_ref_f32) -> !fir.ref {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_B]] : !fir.ref) subroutine acc_reduction_min_float_array2d(a, b) real :: a(100, 10), b(100, 10) integer :: i, j !$acc loop reduction(min:b) collapse(2) do i = 1, 100 do j = 1, 10 b(i, j) = min(b(i, j), a(i, j)) end do end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_min_float_array2d( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[ARG1:.*]]: !fir.ref> {fir.bindc_name = "b"}) ! CHECK: %[[DECLARG1:.*]]:2 = hlfir.declare %[[ARG1]] ! CHECK: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[DECLARG1]]#0 : !fir.ref>) recipe(@reduction_min_ref_100x10xf32) -> !fir.ref> {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_ARG1]] : !fir.ref>) ! CHECK: attributes {collapse = [2]{{.*}} subroutine acc_reduction_max_int(a, b) integer :: a(100) integer :: i, b !$acc loop reduction(max:b) do i = 1, 100 b = max(b, a(i)) end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_max_int( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) ! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#0 : !fir.ref) recipe(@reduction_max_ref_i32) -> !fir.ref {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_B]] : !fir.ref) subroutine acc_reduction_max_int_array2d(a, b) integer :: a(100, 10), b(100, 10) integer :: i, j !$acc loop reduction(max:b) collapse(2) do i = 1, 100 do j = 1, 10 b(i, j) = max(b(i, j), a(i, j)) end do end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_max_int_array2d( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[ARG1:.*]]: !fir.ref> {fir.bindc_name = "b"}) ! CHECK: %[[DECLARG1:.*]]:2 = hlfir.declare %[[ARG1]] ! CHECK: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[DECLARG1]]#0 : !fir.ref>) recipe(@reduction_max_ref_100x10xi32) -> !fir.ref> {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_ARG1]] : !fir.ref>) subroutine acc_reduction_max_float(a, b) real :: a(100), b integer :: i !$acc loop reduction(max:b) do i = 1, 100 b = max(b, a(i)) end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_max_float( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) ! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#0 : !fir.ref) recipe(@reduction_max_ref_f32) -> !fir.ref {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_B]] : !fir.ref) subroutine acc_reduction_max_float_array1d(a, b) real :: a(100), b(100) integer :: i !$acc loop reduction(max:b) do i = 1, 100 b(i) = max(b(i), a(i)) end do end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_max_float_array1d( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[ARG1:.*]]: !fir.ref> {fir.bindc_name = "b"}) ! CHECK: %[[DECLARG1:.*]]:2 = hlfir.declare %[[ARG1]] ! CHECK: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[DECLARG1]]#0 : !fir.ref>) recipe(@reduction_max_ref_100xf32) -> !fir.ref> {name = "b"} ! CHECK: acc.loop {{.*}} reduction(%[[RED_ARG1]] : !fir.ref>) subroutine acc_reduction_iand() integer :: i !$acc parallel reduction(iand:i) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_iand() ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref) recipe(@reduction_iand_ref_i32) -> !fir.ref {name = "i"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.ref) subroutine acc_reduction_ior() integer :: i !$acc parallel reduction(ior:i) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_ior() ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref) recipe(@reduction_ior_ref_i32) -> !fir.ref {name = "i"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.ref) subroutine acc_reduction_ieor() integer :: i !$acc parallel reduction(ieor:i) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_ieor() ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref) recipe(@reduction_xor_ref_i32) -> !fir.ref {name = "i"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.ref) subroutine acc_reduction_and() logical :: l !$acc parallel reduction(.and.:l) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_and() ! CHECK: %[[L:.*]] = fir.alloca !fir.logical<4> {bindc_name = "l", uniq_name = "_QFacc_reduction_andEl"} ! CHECK: %[[DECLL:.*]]:2 = hlfir.declare %[[L]] ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%[[DECLL]]#0 : !fir.ref>) recipe(@reduction_land_ref_l32) -> !fir.ref> {name = "l"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.ref>) subroutine acc_reduction_or() logical :: l !$acc parallel reduction(.or.:l) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_or() ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref>) recipe(@reduction_lor_ref_l32) -> !fir.ref> {name = "l"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.ref>) subroutine acc_reduction_eqv() logical :: l !$acc parallel reduction(.eqv.:l) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_eqv() ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref>) recipe(@reduction_eqv_ref_l32) -> !fir.ref> {name = "l"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.ref>) subroutine acc_reduction_neqv() logical :: l !$acc parallel reduction(.neqv.:l) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_neqv() ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref>) recipe(@reduction_neqv_ref_l32) -> !fir.ref> {name = "l"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.ref>) subroutine acc_reduction_add_cmplx() complex :: c !$acc parallel reduction(+:c) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_cmplx() ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref>) recipe(@reduction_add_ref_z32) -> !fir.ref> {name = "c"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.ref>) subroutine acc_reduction_mul_cmplx() complex :: c !$acc parallel reduction(*:c) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_mul_cmplx() ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref>) recipe(@reduction_mul_ref_z32) -> !fir.ref> {name = "c"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.ref>) subroutine acc_reduction_add_alloc() integer, allocatable :: i allocate(i) !$acc parallel reduction(+:i) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_alloc() ! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.box> {bindc_name = "i", uniq_name = "_QFacc_reduction_add_allocEi"} ! CHECK: %[[DECL:.*]]:2 = hlfir.declare %[[ALLOCA]] ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%[[DECL]]#0 : !fir.ref>>) recipe(@reduction_add_ref_box_heap_i32) -> !fir.ref>> {name = "i"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.ref>>) subroutine acc_reduction_add_pointer(i) integer, pointer :: i !$acc parallel reduction(+:i) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_pointer( ! CHECK-SAME: %[[ARG0:.*]]: !fir.ref>> {fir.bindc_name = "i"}) ! CHECK: %[[DECLARG0:.*]]:2 = hlfir.declare %[[ARG0]] ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%[[DECLARG0]]#0 : !fir.ref>>) recipe(@reduction_add_ref_box_ptr_i32) -> !fir.ref>> {name = "i"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.ref>>) subroutine acc_reduction_add_static_slice(a) integer :: a(100) !$acc parallel reduction(+:a(11:20)) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_static_slice( ! CHECK-SAME: %[[ARG0:.*]]: !fir.ref> {fir.bindc_name = "a"}) ! CHECK: %[[C100:.*]] = arith.constant 100 : index ! CHECK: %[[DECLARG0:.*]]:2 = hlfir.declare %[[ARG0]] ! CHECK: %[[C1:.*]] = arith.constant 1 : index ! CHECK: %[[LB:.*]] = arith.constant 10 : index ! CHECK: %[[UB:.*]] = arith.constant 19 : index ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) extent(%[[C100]] : index) stride(%[[C1]] : index) startIdx(%[[C1]] : index) ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%[[DECLARG0]]#0 : !fir.ref>) bounds(%[[BOUND]]) recipe(@reduction_add_section_lb10.ub19_ref_100xi32) -> !fir.ref> {name = "a(11:20)"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.ref>) subroutine acc_reduction_add_static_slice_2d(a) integer :: a(10,20) !$acc parallel reduction(+:a(:10,:20)) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_static_slice_2d( ! CHECK-SAME: %[[ARG0:.*]]: !fir.ref> {fir.bindc_name = "a"}) ! CHECK: %[[C10:.*]] = arith.constant 10 : index ! CHECK: %[[C20:.*]] = arith.constant 20 : index ! CHECK: %[[DECLARG0:.*]]:2 = hlfir.declare %[[ARG0]] ! CHECK: %[[LB:.*]] = arith.constant 0 : index ! CHECK: %[[C1:.*]] = arith.constant 1 : index ! CHECK: %[[UB9:.*]] = arith.constant 9 : index ! CHECK: %[[STRIDE1:.*]] = arith.constant 10 : index ! CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB9]] : index) extent(%[[C10]] : index) stride(%[[C1]] : index) startIdx(%[[C1]] : index) ! CHECK: %[[UB19:.*]] = arith.constant 19 : index ! CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB19]] : index) extent(%[[C20]] : index) ! stride(%[[STRIDE1]] : index) startIdx(%[[C1]] : index) ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%[[DECLARG0]]#0 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) recipe(@reduction_add_section_lb0.ub9xlb0.ub19_ref_10x20xi32) -> ! !fir.ref> {name = "a(:10,:20)"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.ref>) subroutine acc_reduction_add_dynamic_extent_add(a) integer :: a(:) !$acc parallel reduction(+:a) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_dynamic_extent_add( ! CHECK-SAME: %[[ARG0:.*]]: !fir.box> {fir.bindc_name = "a"}) ! CHECK: %[[DECLARG0:.*]]:2 = hlfir.declare %[[ARG0]] ! CHECK: %[[RED:.*]] = acc.reduction var(%{{.*}} : !fir.box>) recipe(@reduction_add_box_Uxi32) -> !fir.box> {name = "a"} ! CHECK: acc.parallel reduction(%[[RED:.*]] : !fir.box>) subroutine acc_reduction_add_assumed_shape_max(a) real :: a(:) !$acc parallel reduction(max:a) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_assumed_shape_max( ! CHECK-SAME: %[[ARG0:.*]]: !fir.box> {fir.bindc_name = "a"}) ! CHECK: %[[DECLARG0:.*]]:2 = hlfir.declare %[[ARG0]] ! CHECK: %[[RED:.*]] = acc.reduction var(%{{.*}} : !fir.box>) recipe(@reduction_max_box_Uxf32) -> !fir.box> {name = "a"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.box>) { subroutine acc_reduction_add_dynamic_extent_add_with_section(a) integer :: a(:) !$acc parallel reduction(+:a(2:4)) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_dynamic_extent_add_with_section( ! CHECK-SAME: %[[ARG0:.*]]: !fir.box> {fir.bindc_name = "a"}) ! CHECK: %[[DECL:.*]]:2 = hlfir.declare %[[ARG0]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFacc_reduction_add_dynamic_extent_add_with_sectionEa"} : (!fir.box>, !fir.dscope) -> (!fir.box>, !fir.box>) ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%c1{{.*}} : index) upperbound(%c3{{.*}} : index) extent(%{{.*}}#1 : index) stride(%{{.*}}#2 : index) startIdx(%{{.*}} : index) {strideInBytes = true} ! CHECK: %[[RED:.*]] = acc.reduction var(%[[DECL]]#0 : !fir.box>) bounds(%[[BOUND]]) recipe(@reduction_add_section_lb1.ub3_box_Uxi32) -> !fir.box> {name = "a(2:4)"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.box>) subroutine acc_reduction_add_allocatable(a) real, allocatable :: a(:) !$acc parallel reduction(max:a) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_allocatable( ! CHECK-SAME: %[[ARG0:.*]]: !fir.ref>>> {fir.bindc_name = "a"}) ! CHECK: %[[DECL:.*]]:2 = hlfir.declare %[[ARG0]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {fortran_attrs = #fir.var_attrs, uniq_name = "_QFacc_reduction_add_allocatableEa"} : (!fir.ref>>>, !fir.dscope) -> (!fir.ref>>>, !fir.ref>>>) ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%[[DECL]]#0 : !fir.ref>>>) recipe(@reduction_max_ref_box_heap_Uxf32) -> !fir.ref>>> {name = "a"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.ref>>>) subroutine acc_reduction_add_pointer_array(a) real, pointer :: a(:) !$acc parallel reduction(max:a) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_add_pointer_array( ! CHECK-SAME: %[[ARG0:.*]]: !fir.ref>>> {fir.bindc_name = "a"}) ! CHECK: %[[DECL:.*]]:2 = hlfir.declare %[[ARG0]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {fortran_attrs = #fir.var_attrs, uniq_name = "_QFacc_reduction_add_pointer_arrayEa"} : (!fir.ref>>>, !fir.dscope) -> (!fir.ref>>>, !fir.ref>>>) ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%[[DECL]]#0 : !fir.ref>>>) recipe(@reduction_max_ref_box_ptr_Uxf32) -> !fir.ref>>> {name = "a"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.ref>>>) subroutine acc_reduction_max_dynamic_extent_max(a, n) integer :: n real :: a(n, n) !$acc parallel reduction(max:a) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_max_dynamic_extent_max( ! CHECK-SAME: %[[ARG0:.*]]: !fir.ref> {fir.bindc_name = "a"}, %{{.*}}: !fir.ref {fir.bindc_name = "n"}) ! CHECK: %[[DECL_A:.*]]:2 = hlfir.declare %[[ARG0]](%{{.*}}) dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFacc_reduction_max_dynamic_extent_maxEa"} : (!fir.ref>, !fir.shape<2>, !fir.dscope) -> (!fir.box>, !fir.ref>) ! CHECK: %[[RED:.*]] = acc.reduction var(%[[DECL_A]]#0 : !fir.box>) recipe(@reduction_max_box_UxUxf32) -> !fir.box> {name = "a"} ! CHECK: acc.parallel reduction(%[[RED]] : !fir.box>) subroutine acc_reduction_logical_allocatable(l) logical, allocatable :: l !$acc parallel reduction(.or.:l) !$acc end parallel end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_logical_allocatable( ! CHECK: %[[REDUCTION_0:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref>>>) recipe(@reduction_lor_ref_box_heap_l32) -> !fir.ref>>> {name = "l"} ! CHECK: acc.parallel reduction(%[[REDUCTION_0]] : !fir.ref>>>) ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_lor_ref_box_heap_l32 : !fir.ref>>> reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_max_box_UxUxf32 : !fir.box> reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_max_ref_box_ptr_Uxf32 : !fir.ref>>> reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_max_ref_box_heap_Uxf32 : !fir.ref>>> reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_add_section_lb1.ub3_box_Uxi32 : !fir.box> reduction_operator init { ! ACC_COMBINE-LABEL: } combiner { ! ACC_COMBINE: ^bb0(%[[VAL_0:.*]]: !fir.box>, %[[VAL_1:.*]]: !fir.box>): ! ACC_COMBINE: %[[CONSTANT_0:.*]] = arith.constant 1 : index ! ACC_COMBINE: %[[CONSTANT_1:.*]] = arith.constant 1 : index ! ACC_COMBINE: %[[CONSTANT_2:.*]] = arith.constant 3 : index ! ACC_COMBINE: %[[CONSTANT_3:.*]] = arith.constant 0 : index ! ACC_COMBINE: %[[CONSTANT_4:.*]] = arith.constant 2 : index ! ACC_COMBINE: %[[CONSTANT_5:.*]] = arith.constant 3 : index ! ACC_COMBINE: %[[CONSTANT_6:.*]] = arith.constant true ! ACC_COMBINE: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_5]] : (index) -> !fir.shape<1> ! ACC_COMBINE: %[[CONSTANT_7:.*]] = arith.constant 0 : index ! ACC_COMBINE: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[VAL_0]], %[[CONSTANT_7]] : (!fir.box>, index) -> (index, index, index) ! ACC_COMBINE: %[[ADDI_0:.*]] = arith.addi %[[BOX_DIMS_0]]#0, %[[CONSTANT_1]] : index ! ACC_COMBINE: %[[ADDI_1:.*]] = arith.addi %[[BOX_DIMS_0]]#0, %[[CONSTANT_2]] : index ! ACC_COMBINE: %[[CONSTANT_8:.*]] = arith.constant 0 : index ! ACC_COMBINE: %[[BOX_DIMS_1:.*]]:3 = fir.box_dims %[[VAL_1]], %[[CONSTANT_8]] : (!fir.box>, index) -> (index, index, index) ! ACC_COMBINE: %[[ADDI_2:.*]] = arith.addi %[[BOX_DIMS_1]]#0, %[[CONSTANT_1]] : index ! ACC_COMBINE: %[[ADDI_3:.*]] = arith.addi %[[BOX_DIMS_1]]#0, %[[CONSTANT_2]] : index ! ACC_COMBINE: %[[DESIGNATE_0:.*]] = hlfir.designate %[[VAL_1]] (%[[ADDI_2]]:%[[ADDI_3]]:%[[CONSTANT_0]]) shape %[[SHAPE_0]] : (!fir.box>, index, index, index, !fir.shape<1>) -> !fir.box> ! ACC_COMBINE: %[[DESIGNATE_1:.*]] = hlfir.designate %[[VAL_0]] (%[[ADDI_0]]:%[[ADDI_1]]:%[[CONSTANT_0]]) shape %[[SHAPE_0]] : (!fir.box>, index, index, index, !fir.shape<1>) -> !fir.box> ! ACC_COMBINE: %[[CONSTANT_9:.*]] = arith.constant 1 : index ! ACC_COMBINE: fir.do_loop %[[VAL_2:.*]] = %[[CONSTANT_9]] to %[[CONSTANT_5]] step %[[CONSTANT_9]] unordered { ! ACC_COMBINE: %[[DESIGNATE_2:.*]] = hlfir.designate %[[DESIGNATE_0]] (%[[VAL_2]]) : (!fir.box>, index) -> !fir.ref ! ACC_COMBINE: %[[DESIGNATE_3:.*]] = hlfir.designate %[[DESIGNATE_1]] (%[[VAL_2]]) : (!fir.box>, index) -> !fir.ref ! ACC_COMBINE: acc.reduction_combine %[[DESIGNATE_2]] into %[[DESIGNATE_3]] : !fir.ref ! ACC_COMBINE: } ! ACC_COMBINE: acc.yield %[[VAL_0]] : !fir.box> ! ACC_COMBINE: } ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_max_box_Uxf32 : !fir.box> reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_add_box_Uxi32 : !fir.box> reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_add_section_lb0.ub9xlb0.ub19_ref_10x20xi32 : !fir.ref> reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_add_section_lb10.ub19_ref_100xi32 : !fir.ref> reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_add_ref_box_ptr_i32 : !fir.ref>> reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ptr ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_add_ref_box_heap_i32 : !fir.ref>> reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.heap ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_mul_ref_z32 : !fir.ref> reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref> ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_add_ref_z32 : !fir.ref> reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref> ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_neqv_ref_l32 : !fir.ref> reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_eqv_ref_l32 : !fir.ref> reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_lor_ref_l32 : !fir.ref> reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_land_ref_l32 : !fir.ref> reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_xor_ref_i32 : !fir.ref reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_ior_ref_i32 : !fir.ref reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_iand_ref_i32 : !fir.ref reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_max_ref_100xf32 : !fir.ref> reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_max_ref_f32 : !fir.ref reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_max_ref_100x10xi32 : !fir.ref> reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_max_ref_i32 : !fir.ref reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_min_ref_100x10xf32 : !fir.ref> reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_min_ref_f32 : !fir.ref reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_min_ref_100xi32 : !fir.ref> reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_min_ref_i32 : !fir.ref reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_mul_ref_100xf32 : !fir.ref> reduction_operator init { ! ACC_COMBINE-NOT: acc.reduction_combine ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_mul_ref_f32 : !fir.ref reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_mul_ref_100xi32 : !fir.ref> reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_mul_ref_i32 : !fir.ref reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_add_ref_100xf32 : !fir.ref> reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_add_ref_f32 : !fir.ref reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_add_ref_100x10x2xi32 : !fir.ref> reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_add_ref_100x10xi32 : !fir.ref> reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_add_ref_100xi32 : !fir.ref> reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref ! ACC_COMBINE-LABEL: acc.reduction.recipe @reduction_add_ref_i32 : !fir.ref reduction_operator init { ! ACC_COMBINE: acc.reduction_combine %{{.*}} into %{{.*}} : !fir.ref