diff --git a/flang/test/Lower/OpenACC/acc-data-operands.f90 b/flang/test/Lower/OpenACC/acc-data-operands.f90 index bedb1a48ea589..3ec78c4b781d7 100644 --- a/flang/test/Lower/OpenACC/acc-data-operands.f90 +++ b/flang/test/Lower/OpenACC/acc-data-operands.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of complex OpenACC data operands. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s --check-prefixes=CHECK,FIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR module acc_data_operand @@ -20,21 +21,25 @@ subroutine acc_operand_array_section() ! CHECK-LABEL: func.func @_QMacc_data_operandPacc_operand_array_section ! CHECK: %[[ARR:.*]] = fir.alloca !fir.array<100xf32> +! HLFIR: %[[DECL:.*]]:2 = hlfir.declare %[[ARR]] ! CHECK: %[[ONE:.*]] = arith.constant 1 : index ! CHECK: %[[LB:.*]] = arith.constant 0 : index ! CHECK: %[[UB:.*]] = arith.constant 49 : index ! CHECK: %[[BOUND_1_50:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index) -! CHECK: %[[COPYIN:.*]] = acc.copyin varPtr(%[[ARR]] : !fir.ref>) bounds(%[[BOUND_1_50]]) -> !fir.ref> {name = "a(1:50)"} +! FIR: %[[COPYIN:.*]] = acc.copyin varPtr(%[[ARR]] : !fir.ref>) bounds(%[[BOUND_1_50]]) -> !fir.ref> {name = "a(1:50)"} +! HLFIR: %[[COPYIN:.*]] = acc.copyin varPtr(%[[DECL]]#1 : !fir.ref>) bounds(%[[BOUND_1_50]]) -> !fir.ref> {name = "a(1:50)"} ! CHECK: %[[ONE:.*]] = arith.constant 1 : index ! CHECK: %[[LB:.*]] = arith.constant 50 : index ! CHECK: %[[UB:.*]] = arith.constant 99 : index ! CHECK: %[[BOUND_51_100:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index) -! CHECK: %[[COPYOUT_CREATE:.*]] = acc.create varPtr(%[[ARR]] : !fir.ref>) bounds(%[[BOUND_51_100]]) -> !fir.ref> {dataClause = #acc, name = "a(51:100)"} +! FIR: %[[COPYOUT_CREATE:.*]] = acc.create varPtr(%[[ARR]] : !fir.ref>) bounds(%[[BOUND_51_100]]) -> !fir.ref> {dataClause = #acc, name = "a(51:100)"} +! HLFIR: %[[COPYOUT_CREATE:.*]] = acc.create varPtr(%[[DECL]]#1 : !fir.ref>) bounds(%[[BOUND_51_100]]) -> !fir.ref> {dataClause = #acc, name = "a(51:100)"} ! CHECK: acc.data dataOperands(%[[COPYIN]], %[[COPYOUT_CREATE]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK: } -! CHECK: acc.copyout accPtr(%[[COPYOUT_CREATE]] : !fir.ref>) bounds(%[[BOUND_51_100]]) to varPtr(%[[ARR]] : !fir.ref>) {name = "a(51:100)"} - +! FIR: acc.copyout accPtr(%[[COPYOUT_CREATE]] : !fir.ref>) bounds(%[[BOUND_51_100]]) to varPtr(%[[ARR]] : !fir.ref>) {name = "a(51:100)"} +! HLFIR: acc.copyout accPtr(%[[COPYOUT_CREATE]] : !fir.ref>) bounds(%[[BOUND_51_100]]) to varPtr(%[[DECL]]#1 : !fir.ref>) {name = "a(51:100)"} + ! Testing array sections of a derived-type component subroutine acc_operand_array_section_component() @@ -46,8 +51,10 @@ subroutine acc_operand_array_section_component() ! CHECK-LABEL: func.func @_QMacc_data_operandPacc_operand_array_section_component() { ! CHECK: %[[W:.*]] = fir.alloca !fir.type<_QMacc_data_operandTwrapper{data:!fir.array<100xf32>}> {bindc_name = "w", uniq_name = "_QMacc_data_operandFacc_operand_array_section_componentEw"} -! CHECK: %[[FIELD_DATA:.*]] = fir.field_index data, !fir.type<_QMacc_data_operandTwrapper{data:!fir.array<100xf32>}> -! CHECK: %[[COORD_DATA:.*]] = fir.coordinate_of %[[W]], %[[FIELD_DATA]] : (!fir.ref}>>, !fir.field) -> !fir.ref> +! HLFIR: %[[DECLW:.*]]:2 = hlfir.declare %[[W]] +! FIR: %[[FIELD_DATA:.*]] = fir.field_index data, !fir.type<_QMacc_data_operandTwrapper{data:!fir.array<100xf32>}> +! FIR: %[[COORD_DATA:.*]] = fir.coordinate_of %[[W]], %[[FIELD_DATA]] : (!fir.ref}>>, !fir.field) -> !fir.ref> +! HLFIR: %[[COORD_DATA:.*]] = hlfir.designate %[[DECLW]]#0{"data"} shape %{{.*}} : (!fir.ref}>>, !fir.shape<1>) -> !fir.ref> ! CHECK: %[[ONE:.*]] = arith.constant 1 : index ! CHECK: %[[LB:.*]] = arith.constant 0 : index ! CHECK: %[[UB:.*]] = arith.constant 19 : index @@ -68,9 +75,12 @@ subroutine acc_operand_derived_type_component() ! CHECK-LABEL: func.func @_QMacc_data_operandPacc_operand_derived_type_component() { ! CHECK: %[[W:.*]] = fir.alloca !fir.type<_QMacc_data_operandTwrapper{data:!fir.array<100xf32>}> {bindc_name = "w", uniq_name = "_QMacc_data_operandFacc_operand_derived_type_componentEw"} -! CHECK: %[[FIELD_DATA:.*]] = fir.field_index data, !fir.type<_QMacc_data_operandTwrapper{data:!fir.array<100xf32>}> -! CHECK: %[[COORD_DATA:.*]] = fir.coordinate_of %[[W]], %[[FIELD_DATA]] : (!fir.ref}>>, !fir.field) -> !fir.ref}> +! FIR: %[[COORD_DATA:.*]] = fir.coordinate_of %[[W]], %[[FIELD_DATA]] : (!fir.ref}>>, !fir.field) -> !fir.ref}>>, !fir.shape<1>) -> !fir.ref> +! FIR: %[[EXT:.*]] = arith.constant 100 : index ! CHECK: %[[ONE:.*]] = arith.constant 1 : index ! CHECK: %[[LB:.*]] = arith.constant 0 : index ! CHECK: %[[UB:.*]] = arith.subi %[[EXT]], %[[ONE]] : index @@ -92,17 +102,22 @@ subroutine acc_operand_array_derived_type_component() ! CHECK-LABEL: func.func @_QMacc_data_operandPacc_operand_array_derived_type_component() { ! CHECK: %[[W:.*]] = fir.alloca !fir.array<10x!fir.type<_QMacc_data_operandTwrapper{data:!fir.array<100xf32>}>> {bindc_name = "w", uniq_name = "_QMacc_data_operandFacc_operand_array_derived_type_componentEw"} -! CHECK: %[[C1:.*]] = arith.constant 1 : i64 -! CHECK: %[[SUB:.*]] = arith.constant 1 : i64 -! CHECK: %[[IDX:.*]] = arith.subi %[[C1]], %[[SUB]] : i64 -! CHECK: %[[W_1:.*]] = fir.coordinate_of %[[W]], %[[IDX]] : (!fir.ref}>>>, i64) -> !fir.ref}>> -! CHECK: %[[FIELD_DATA:.*]] = fir.field_index data, !fir.type<_QMacc_data_operandTwrapper{data:!fir.array<100xf32>}> -! CHECK: %[[COORD_W1_DATA:.*]] = fir.coordinate_of %[[W_1]], %[[FIELD_DATA]] : (!fir.ref}>>, !fir.field) -> !fir.ref> -! CHECK: %[[EXT:.*]] = arith.constant 100 : index +! HLFIR: %[[DECLW:.*]]:2 = hlfir.declare %[[W]] +! FIR: %[[C1:.*]] = arith.constant 1 : i64 +! FIR: %[[SUB:.*]] = arith.constant 1 : i64 +! FIR: %[[IDX:.*]] = arith.subi %[[C1]], %[[SUB]] : i64 +! FIR: %[[W_1:.*]] = fir.coordinate_of %[[W]], %[[IDX]] : (!fir.ref}>>>, i64) -> !fir.ref}>> +! HLFIR: %[[C1:.*]] = arith.constant 1 : index +! HLFIR: %[[W_1:.*]] = hlfir.designate %[[DECLW]]#0 (%[[C1]]) : (!fir.ref}>>>, index) -> !fir.ref}>> +! FIR: %[[FIELD_DATA:.*]] = fir.field_index data, !fir.type<_QMacc_data_operandTwrapper{data:!fir.array<100xf32>}> +! FIR: %[[COORD_W1_DATA:.*]] = fir.coordinate_of %[[W_1]], %[[FIELD_DATA]] : (!fir.ref}>>, !fir.field) -> !fir.ref> +! HLFIR: %[[EXT:.*]] = arith.constant 100 : index +! HLFIR: %[[COORD_W1_DATA:.*]] = hlfir.designate %[[W_1]]{"data"} shape %{{.*}} : (!fir.ref}>>, !fir.shape<1>) -> !fir.ref> +! FIR: %[[EXT:.*]] = arith.constant 100 : index ! CHECK: %[[ONE:.*]] = arith.constant 1 : index ! CHECK: %[[LB:.*]] = arith.constant 0 : index ! CHECK: %[[UB:.*]] = arith.subi %[[EXT]], %[[ONE]] : index -! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) extent(%[[EXT]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index) +! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) extent(%[[EXT]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index) ! CHECK: %[[COPY_COPYIN:.*]] = acc.copyin varPtr(%[[COORD_W1_DATA]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {dataClause = #acc, name = "w(1_8)%data"} ! CHECK: acc.data dataOperands(%[[COPY_COPYIN]] : !fir.ref>) { ! CHECK: acc.terminator @@ -123,8 +138,11 @@ subroutine acc_operand_array_section_allocatable() ! CHECK-LABEL: func.func @_QMacc_data_operandPacc_operand_array_section_allocatable() { ! CHECK: %[[A:.*]] = fir.alloca !fir.box>> {bindc_name = "a", uniq_name = "_QMacc_data_operandFacc_operand_array_section_allocatableEa"} -! CHECK: %[[LOAD_BOX_A_0:.*]] = fir.load %[[A]] : !fir.ref>>> -! CHECK: %[[LOAD_BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +! HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] {fortran_attrs = #fir.var_attrs +! FIR: %[[LOAD_BOX_A_0:.*]] = fir.load %[[A]] : !fir.ref>>> +! FIR: %[[LOAD_BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +! HLFIR: %[[LOAD_BOX_A_0:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> +! HLFIR: %[[LOAD_BOX_A_1:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> ! CHECK: %[[C0:.*]] = arith.constant 0 : index ! CHECK: %[[DIMS0_0:.*]]:3 = fir.box_dims %[[LOAD_BOX_A_1]], %[[C0]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[C0:.*]] = arith.constant 0 : index @@ -136,8 +154,10 @@ subroutine acc_operand_array_section_allocatable() ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[DIMS0_1]]#2 : index) startIdx(%[[DIMS0_0]]#0 : index) {strideInBytes = true} ! CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[LOAD_BOX_A_0]] : (!fir.box>>) -> !fir.heap> ! CHECK: %[[COPYIN:.*]] = acc.copyin varPtr(%[[BOX_ADDR]] : !fir.heap>) bounds(%[[BOUND]]) -> !fir.heap> {name = "a(1:50)"} -! CHECK: %[[LOAD_BOX_A_0:.*]] = fir.load %[[A]] : !fir.ref>>> -! CHECK: %[[LOAD_BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +! FIR: %[[LOAD_BOX_A_0:.*]] = fir.load %[[A]] : !fir.ref>>> +! FIR: %[[LOAD_BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +! HLFIR: %[[LOAD_BOX_A_0:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> +! HLFIR: %[[LOAD_BOX_A_1:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> ! CHECK: %[[C0:.*]] = arith.constant 0 : index ! CHECK: %[[DIMS0_0:.*]]:3 = fir.box_dims %[[LOAD_BOX_A_1]], %[[C0]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[C0:.*]] = arith.constant 0 : index @@ -168,8 +188,11 @@ subroutine acc_operand_array_section_pointer() ! CHECK-LABEL: func.func @_QMacc_data_operandPacc_operand_array_section_pointer() { ! CHECK: %[[P:.*]] = fir.alloca !fir.box>> {bindc_name = "p", uniq_name = "_QMacc_data_operandFacc_operand_array_section_pointerEp"} -! CHECK: %[[LOAD_BOX_P_0:.*]] = fir.load %[[P]] : !fir.ref>>> -! CHECK: %[[LOAD_BOX_P_1:.*]] = fir.load %[[P]] : !fir.ref>>> +! HLFIR: %[[DECLP:.*]]:2 = hlfir.declare %[[P]] {fortran_attrs = #fir.var_attrs +! FIR: %[[LOAD_BOX_P_0:.*]] = fir.load %[[P]] : !fir.ref>>> +! FIR: %[[LOAD_BOX_P_1:.*]] = fir.load %[[P]] : !fir.ref>>> +! HLFIR: %[[LOAD_BOX_P_0:.*]] = fir.load %[[DECLP]]#1 : !fir.ref>>> +! HLFIR: %[[LOAD_BOX_P_1:.*]] = fir.load %[[DECLP]]#1 : !fir.ref>>> ! CHECK: %[[C0:.*]] = arith.constant 0 : index ! CHECK: %[[DIMS0_0:.*]]:3 = fir.box_dims %[[LOAD_BOX_P_1]], %[[C0:.*]] : (!fir.box>>, index) -> (index, index, index) ! CHECK: %[[C0:.*]] = arith.constant 0 : index diff --git a/flang/test/Lower/OpenACC/acc-data.f90 b/flang/test/Lower/OpenACC/acc-data.f90 index 5226474d012c1..c749f1948bbbe 100644 --- a/flang/test/Lower/OpenACC/acc-data.f90 +++ b/flang/test/Lower/OpenACC/acc-data.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of OpenACC data directive. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s --check-prefixes=CHECK,FIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR subroutine acc_data real, dimension(10, 10) :: a, b, c @@ -8,64 +9,88 @@ subroutine acc_data logical :: ifCondition = .TRUE. ! CHECK: %[[A:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ea"} +! HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] ! CHECK: %[[B:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[C:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} +! HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] ! CHECK: %[[D:.*]] = fir.alloca !fir.box> {bindc_name = "d", uniq_name = "{{.*}}Ed"} +! HLFIR: %[[DECLD:.*]]:2 = hlfir.declare %[[D]] ! CHECK: %[[E:.*]] = fir.alloca !fir.box> {bindc_name = "e", uniq_name = "{{.*}}Ee"} +! HLFIR: %[[DECLE:.*]]:2 = hlfir.declare %[[E]] !$acc data if(.TRUE.) copy(a) !$acc end data ! CHECK: %[[IF1:.*]] = arith.constant true -! CHECK: %[[COPYIN:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[COPYIN:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[COPYIN:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} ! CHECK: acc.data if(%[[IF1]]) dataOperands(%[[COPYIN]] : !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[COPYIN]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! FIR: acc.copyout accPtr(%[[COPYIN]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! HLFIR: acc.copyout accPtr(%[[COPYIN]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} !$acc data copy(a) if(ifCondition) !$acc end data -! CHECK: %[[COPYIN:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[COPYIN:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[COPYIN:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} ! CHECK: %[[IFCOND:.*]] = fir.load %{{.*}} : !fir.ref> ! CHECK: %[[IF2:.*]] = fir.convert %[[IFCOND]] : (!fir.logical<4>) -> i1 ! CHECK: acc.data if(%[[IF2]]) dataOperands(%[[COPYIN]] : !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[COPYIN]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! FIR: acc.copyout accPtr(%[[COPYIN]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! HLFIR: acc.copyout accPtr(%[[COPYIN]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} !$acc data copy(a, b, c) !$acc end data -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -! CHECK: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.data dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} -! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} -! CHECK: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +! FIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! FIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} +! FIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLC]]#1 : !fir.ref>) {dataClause = #acc, name = "c"} !$acc data copy(a) copy(b) copy(c) !$acc end data -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -! CHECK: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.data dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} -! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} -! CHECK: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +! FIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! FIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} +! FIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLC]]#1 : !fir.ref>) {dataClause = #acc, name = "c"} !$acc data copyin(a) copyin(readonly: b, c) !$acc end data -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -! CHECK: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.data dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} @@ -73,22 +98,31 @@ subroutine acc_data !$acc data copyout(a) copyout(zero: b) copyout(c) !$acc end data -! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -! CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.data dataOperands(%[[CREATE_A]], %[[CREATE_B]], %[[CREATE_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a"} -! CHECK: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} -! CHECK: acc.copyout accPtr(%[[CREATE_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {name = "c"} +! FIR: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a"} +! HLFIR: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a"} +! FIR: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! HLFIR: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} +! FIR: acc.copyout accPtr(%[[CREATE_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {name = "c"} +! HLFIR: acc.copyout accPtr(%[[CREATE_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLC]]#1 : !fir.ref>) {name = "c"} !$acc data create(a, b) create(zero: c) !$acc end data -! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} -! CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.data dataOperands(%[[CREATE_A]], %[[CREATE_B]], %[[CREATE_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} @@ -98,17 +132,23 @@ subroutine acc_data !$acc data create(c) copy(b) create(a) !$acc end data -!CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} -!CHECK: %[[COPY_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +!FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +!HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +!FIR: %[[COPY_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +!HLFIR: %[[COPY_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} !CHECK: acc.data dataOperands(%[[CREATE_C]], %[[COPY_B]], %[[CREATE_A]] : !fir.ref>, !fir.ref>, !fir.ref>) { !$acc data no_create(a, b) create(zero: c) !$acc end data -! CHECK: %[[NO_CREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[NO_CREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} -! CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[NO_CREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[NO_CREATE_A:.*]] = acc.nocreate varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[NO_CREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[NO_CREATE_B:.*]] = acc.nocreate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.data dataOperands(%[[NO_CREATE_A]], %[[NO_CREATE_B]], %[[CREATE_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} @@ -117,9 +157,12 @@ subroutine acc_data !$acc data present(a, b, c) !$acc end data -! CHECK: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} -! CHECK: %[[PRESENT_C:.*]] = acc.present varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! FIR: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[PRESENT_A:.*]] = acc.present varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[PRESENT_B:.*]] = acc.present varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[PRESENT_C:.*]] = acc.present varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! HLFIR: %[[PRESENT_C:.*]] = acc.present varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} ! CHECK: acc.data dataOperands(%[[PRESENT_A]], %[[PRESENT_B]], %[[PRESENT_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} @@ -127,8 +170,10 @@ subroutine acc_data !$acc data deviceptr(b, c) !$acc end data -! CHECK: %[[DEVICEPTR_B:.*]] = acc.deviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} -! CHECK: %[[DEVICEPTR_C:.*]] = acc.deviceptr varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! FIR: %[[DEVICEPTR_B:.*]] = acc.deviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[DEVICEPTR_B:.*]] = acc.deviceptr varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[DEVICEPTR_C:.*]] = acc.deviceptr varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! HLFIR: %[[DEVICEPTR_C:.*]] = acc.deviceptr varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} ! CHECK: acc.data dataOperands(%[[DEVICEPTR_B]], %[[DEVICEPTR_C]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} diff --git a/flang/test/Lower/OpenACC/acc-declare-globals.f90 b/flang/test/Lower/OpenACC/acc-declare-globals.f90 index a8930b53662f6..c30419b171394 100644 --- a/flang/test/Lower/OpenACC/acc-declare-globals.f90 +++ b/flang/test/Lower/OpenACC/acc-declare-globals.f90 @@ -2,6 +2,7 @@ ! part. ! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s module acc_declare_test integer, parameter :: n = 100000 diff --git a/flang/test/Lower/OpenACC/acc-declare.f90 b/flang/test/Lower/OpenACC/acc-declare.f90 index 92966c3c367f3..11f62f1c24dfa 100644 --- a/flang/test/Lower/OpenACC/acc-declare.f90 +++ b/flang/test/Lower/OpenACC/acc-declare.f90 @@ -38,7 +38,7 @@ subroutine acc_declare_create() end subroutine ! CHECK-LABEL: func.func @_QMacc_declarePacc_declare_create() { - + ! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<100xi32> {acc.declare = #acc.declare, bindc_name = "a", uniq_name = "_QMacc_declareFacc_declare_createEa"} ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) extent(%{{.*}} : index) stride(%c1 : index) startIdx(%c1 : index) ! CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[ALLOCA]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a"} @@ -272,7 +272,7 @@ subroutine acc_declare_multiple_directive(a, b) ! CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[ARG1]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} ! CHECK: acc.declare dataOperands(%[[COPYIN]], %[[CREATE]] : !fir.ref>, !fir.ref>) { ! CHECK: %{{.*}}:{{.*}} = fir.do_loop %{{.*}} = %{{.*}} to %{{.*}} step %{{.*}} iter_args(%{{.*}} = %{{.*}}) -> (index, i32) { - + ! CHECK: acc.terminator ! CHECK: } ! CHECK: acc.copyout accPtr(%[[CREATE]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[ARG1]] : !fir.ref>) {name = "b"} diff --git a/flang/test/Lower/OpenACC/acc-enter-data.f90 b/flang/test/Lower/OpenACC/acc-enter-data.f90 index 333cd2f0b774b..5e18528dfc829 100644 --- a/flang/test/Lower/OpenACC/acc-enter-data.f90 +++ b/flang/test/Lower/OpenACC/acc-enter-data.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of OpenACC enter data directive. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s --check-prefixes=CHECK,FIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR subroutine acc_enter_data integer :: async = 1 @@ -11,9 +12,13 @@ subroutine acc_enter_data !CHECK: %[[C10:.*]] = arith.constant 10 : index !CHECK: %[[EXTENT_C10:.*]] = arith.constant 10 : index !CHECK: %[[A:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ea"} +!HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] !CHECK: %[[B:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} +!HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] !CHECK: %[[C:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} +!HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] !CHECK: %[[D:.*]] = fir.alloca !fir.box> {bindc_name = "d", uniq_name = "{{.*}}Ed"} +!HLFIR: %[[DECLD:.*]]:2 = hlfir.declare %[[D]] !$acc enter data create(a) !CHECK: %[[ONE:.*]] = arith.constant 1 : index @@ -23,7 +28,8 @@ subroutine acc_enter_data !CHECK: %[[LB:.*]] = arith.constant 0 : index !CHECK: %[[UB:.*]] = arith.subi %[[EXTENT_C10]], %[[ONE]] : index !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) extent(%[[EXTENT_C10]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index) -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE_A]] : !fir.ref>){{$}} !$acc enter data create(a) if(.true.) @@ -34,7 +40,8 @@ subroutine acc_enter_data !CHECK: %[[LB:.*]] = arith.constant 0 : index !CHECK: %[[UB:.*]] = arith.subi %[[EXTENT_C10]], %[[ONE]] : index !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) extent(%[[EXTENT_C10]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index) -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} !CHECK: [[IF1:%.*]] = arith.constant true !CHECK: acc.enter_data if([[IF1]]) dataOperands(%[[CREATE_A]] : !fir.ref>){{$}} @@ -46,7 +53,8 @@ subroutine acc_enter_data !CHECK: %[[LB:.*]] = arith.constant 0 : index !CHECK: %[[UB:.*]] = arith.subi %[[EXTENT_C10]], %[[ONE]] : index !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) extent(%[[EXTENT_C10]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index) -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} !CHECK: [[IFCOND:%.*]] = fir.load %{{.*}} : !fir.ref> !CHECK: [[IF2:%.*]] = fir.convert [[IFCOND]] : (!fir.logical<4>) -> i1 !CHECK: acc.enter_data if([[IF2]]) dataOperands(%[[CREATE_A]] : !fir.ref>){{$}} @@ -54,35 +62,44 @@ subroutine acc_enter_data !$acc enter data create(a) create(b) create(c) !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "b", structured = false} +!FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "b", structured = false} +!HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "b", structured = false} !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "c", structured = false} +!FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "c", structured = false} +!HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "c", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE_A]], %[[CREATE_B]], %[[CREATE_C]] : !fir.ref>, !fir.ref>, !fir.ref>){{$}} !$acc enter data create(a) create(b) create(zero: c) !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "b", structured = false} +!FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "b", structured = false} +!HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "b", structured = false} !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {dataClause = #acc, name = "c", structured = false} +!FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {dataClause = #acc, name = "c", structured = false} +!HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {dataClause = #acc, name = "c", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE_A]], %[[CREATE_B]], %[[CREATE_C]] : !fir.ref>, !fir.ref>, !fir.ref>){{$}} !$acc enter data copyin(a) create(b) attach(d) !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "b", structured = false} -!CHECK: %[[BOX_D:.*]] = fir.load %[[D]] : !fir.ref>> +!FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "b", structured = false} +!HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "b", structured = false} +!FIR: %[[BOX_D:.*]] = fir.load %[[D]] : !fir.ref>> +!HLFIR: %[[BOX_D:.*]] = fir.load %[[DECLD]]#1 : !fir.ref>> !CHECK: %[[BOX_ADDR_D:.*]] = fir.box_addr %[[BOX_D]] : (!fir.box>) -> !fir.ptr !CHECK: %[[ATTACH_D:.*]] = acc.attach varPtr(%[[BOX_ADDR_D]] : !fir.ptr) -> !fir.ptr {name = "d", structured = false} !CHECK: acc.enter_data dataOperands(%[[COPYIN_A]], %[[CREATE_B]], %[[ATTACH_D]] : !fir.ref>, !fir.ref>, !fir.ptr){{$}} @@ -90,46 +107,53 @@ subroutine acc_enter_data !$acc enter data create(a) async !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE_A]] : !fir.ref>) attributes {async} !$acc enter data create(a) wait !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE_A]] : !fir.ref>) attributes {wait} !$acc enter data create(a) async wait !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE_A]] : !fir.ref>) attributes {async, wait} !$acc enter data create(a) async(1) !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} !CHECK: %[[ASYNC1:.*]] = arith.constant 1 : i32 !CHECK: acc.enter_data async(%[[ASYNC1]] : i32) dataOperands(%[[CREATE_A]] : !fir.ref>) !$acc enter data create(a) async(async) !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} !CHECK: %[[ASYNC2:.*]] = fir.load %{{.*}} : !fir.ref !CHECK: acc.enter_data async(%[[ASYNC2]] : i32) dataOperands(%[[CREATE_A]] : !fir.ref>) !$acc enter data create(a) wait(1) !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} !CHECK: %[[WAIT1:.*]] = arith.constant 1 : i32 !CHECK: acc.enter_data wait(%[[WAIT1]] : i32) dataOperands(%[[CREATE_A]] : !fir.ref>) !$acc enter data create(a) wait(queues: 1, 2) !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} !CHECK: %[[WAIT2:.*]] = arith.constant 1 : i32 !CHECK: %[[WAIT3:.*]] = arith.constant 2 : i32 !CHECK: acc.enter_data wait(%[[WAIT2]], %[[WAIT3]] : i32, i32) dataOperands(%[[CREATE_A]] : !fir.ref>) @@ -137,7 +161,8 @@ subroutine acc_enter_data !$acc enter data create(a) wait(devnum: 1: queues: 1, 2) !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a", structured = false} !CHECK: %[[WAIT4:.*]] = arith.constant 1 : i32 !CHECK: %[[WAIT5:.*]] = arith.constant 2 : i32 !CHECK: %[[WAIT6:.*]] = arith.constant 1 : i32 @@ -146,19 +171,21 @@ subroutine acc_enter_data !$acc enter data copyin(a(1:10,1:5)) !CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a(1:10,1:5)", structured = false} +!FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a(1:10,1:5)", structured = false} +!HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref> {name = "a(1:10,1:5)", structured = false} !CHECK: acc.enter_data dataOperands(%[[COPYIN_A]] : !fir.ref>) !$acc enter data copyin(a(1:,1:5)) -!CHECK: %[[ONE:.*]] = arith.constant 1 : index +!CHECK: %[[ONE:.*]] = arith.constant 1 : index !CHECK: %[[LB1:.*]] = arith.constant 0 : index !CHECK: %[[LBEXT:.*]] = arith.addi %c10{{.*}}, %[[ONE]] : index -!CHECK: %[[UB1:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index +!CHECK: %[[UB1:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%[[LB1]] : index) upperbound(%[[UB1]] : index) stride(%[[ONE]] : index) startIdx(%c1{{.*}} : index) !CHECK: %[[LB2:.*]] = arith.constant 0 : index !CHECK: %[[UB2:.*]] = arith.constant 4 : index !CHECK: %[[BOUND2:.*]] = acc.bounds lowerbound(%[[LB2]] : index) upperbound(%[[UB2]] : index) stride(%[[ONE]] : index) startIdx(%c1{{.*}} : index) -!CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND1]], %[[BOUND2]]) -> !fir.ref> {name = "a(1:,1:5)", structured = false} +!FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND1]], %[[BOUND2]]) -> !fir.ref> {name = "a(1:,1:5)", structured = false} +!HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND1]], %[[BOUND2]]) -> !fir.ref> {name = "a(1:,1:5)", structured = false} !CHECK: acc.enter_data dataOperands(%[[COPYIN_A]] : !fir.ref>) !$acc enter data copyin(a(:10,1:5)) @@ -169,7 +196,8 @@ subroutine acc_enter_data !CHECK: %[[LB:.*]] = arith.constant 0 : index !CHECK: %[[UB2:.*]] = arith.constant 4 : index !CHECK: %[[BOUND2:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB2]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index) -!CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND1]], %[[BOUND2]]) -> !fir.ref> {name = "a(:10,1:5)", structured = false} +!FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND1]], %[[BOUND2]]) -> !fir.ref> {name = "a(:10,1:5)", structured = false} +!HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND1]], %[[BOUND2]]) -> !fir.ref> {name = "a(:10,1:5)", structured = false} !CHECK: acc.enter_data dataOperands(%[[COPYIN_A]] : !fir.ref>) !$acc enter data copyin(a(:,:)) @@ -179,9 +207,10 @@ subroutine acc_enter_data !CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index) !CHECK: %[[LBEXT:.*]] = arith.addi %c10{{.*}}, %[[ONE]] : index -!CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index +!CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index !CHECK: %[[BOUND2:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index) -!CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND1]], %[[BOUND2]]) -> !fir.ref> {name = "a(:,:)", structured = false} +!FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND1]], %[[BOUND2]]) -> !fir.ref> {name = "a(:,:)", structured = false} +!HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND1]], %[[BOUND2]]) -> !fir.ref> {name = "a(:,:)", structured = false} end subroutine acc_enter_data subroutine acc_enter_data_dummy(a, b, n, m) @@ -193,10 +222,15 @@ subroutine acc_enter_data_dummy(a, b, n, m) !CHECK-SAME: %[[A:.*]]: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref> {fir.bindc_name = "b"}, %[[N:.*]]: !fir.ref {fir.bindc_name = "n"}, %[[M:.*]]: !fir.ref {fir.bindc_name = "m"} !CHECK: %[[C10:.*]] = arith.constant 10 : index -!CHECK: %[[LOAD_N:.*]] = fir.load %[[N]] : !fir.ref +!HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] +!HLFIR: %[[DECLN:.*]]:2 = hlfir.declare %[[N]] +!HLFIR: %[[DECLM:.*]]:2 = hlfir.declare %[[M]] +!FIR: %[[LOAD_N:.*]] = fir.load %[[N]] : !fir.ref +!HLFIR: %[[LOAD_N:.*]] = fir.load %[[DECLN]]#0 : !fir.ref !CHECK: %[[N_I64:.*]] = fir.convert %[[LOAD_N]] : (i32) -> i64 !CHECK: %[[N_IDX:.*]] = fir.convert %[[N_I64]] : (i64) -> index -!CHECK: %[[LOAD_M:.*]] = fir.load %[[M]] : !fir.ref +!FIR: %[[LOAD_M:.*]] = fir.load %[[M]] : !fir.ref +!HLFIR: %[[LOAD_M:.*]] = fir.load %[[DECLM]]#0 : !fir.ref !CHECK: %[[M_I64:.*]] = fir.convert %[[LOAD_M]] : (i32) -> i64 !CHECK: %[[M_IDX:.*]] = fir.convert %[[M_I64]] : (i64) -> index !CHECK: %[[M_N:.*]] = arith.subi %[[M_IDX]], %[[N_IDX]] : index @@ -205,15 +239,18 @@ subroutine acc_enter_data_dummy(a, b, n, m) !CHECK: %[[C0:.*]] = arith.constant 0 : index !CHECK: %[[CMP:.*]] = arith.cmpi sgt, %[[M_N_1]], %[[C0]] : index !CHECK: %[[EXT_B:.*]] = arith.select %[[CMP]], %[[M_N_1]], %[[C0]] : index +!HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] !$acc enter data create(a) !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a", structured = false} +!FIR: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a", structured = false} +!HLFIR: %[[CREATE:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(b) !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%c1{{.*}} : index) startIdx(%{{.*}} : index) -!CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b", structured = false} +!FIR: %[[CREATE:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b", structured = false} +!HLFIR: %[[CREATE:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(a(5:10)) @@ -221,38 +258,45 @@ subroutine acc_enter_data_dummy(a, b, n, m) !CHECK: %[[LB1:.*]] = arith.constant 4 : index !CHECK: %[[UB1:.*]] = arith.constant 9 : index !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%[[LB1]] : index) upperbound(%[[UB1]] : index) stride(%[[ONE]] : index) startIdx(%c1{{.*}} : index) -!CHECK: %[[CREATE1:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND1]]) -> !fir.ref> {name = "a(5:10)", structured = false} +!FIR: %[[CREATE1:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND1]]) -> !fir.ref> {name = "a(5:10)", structured = false} +!HLFIR: %[[CREATE1:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND1]]) -> !fir.ref> {name = "a(5:10)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE1]] : !fir.ref>) !$acc enter data create(b(n:m)) !CHECK: %[[ONE:.*]] = arith.constant 1 : index -!CHECK: %[[LOAD_N:.*]] = fir.load %[[N]] : !fir.ref +!FIR: %[[LOAD_N:.*]] = fir.load %[[N]] : !fir.ref +!HLFIR: %[[LOAD_N:.*]] = fir.load %[[DECLN]]#0 : !fir.ref !CHECK: %[[CONVERT_N:.*]] = fir.convert %[[LOAD_N]] : (i32) -> index !CHECK: %[[LB:.*]] = arith.subi %[[CONVERT_N]], %[[N_IDX]] : index -!CHECK: %[[LOAD_M:.*]] = fir.load %[[M]] : !fir.ref +!FIR: %[[LOAD_M:.*]] = fir.load %[[M]] : !fir.ref +!HLFIR: %[[LOAD_M:.*]] = fir.load %[[DECLM]]#0 : !fir.ref !CHECK: %[[CONVERT_M:.*]] = fir.convert %[[LOAD_M]] : (i32) -> index !CHECK: %[[UB:.*]] = arith.subi %[[CONVERT_M]], %[[N_IDX]] : index !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[N_IDX]] : index) -!CHECK: %[[CREATE1:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND1]]) -> !fir.ref> {name = "b(n:m)", structured = false} +!FIR: %[[CREATE1:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND1]]) -> !fir.ref> {name = "b(n:m)", structured = false} +!HLFIR: %[[CREATE1:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%[[BOUND1]]) -> !fir.ref> {name = "b(n:m)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE1]] : !fir.ref>) !$acc enter data create(b(n:)) -!CHECK: %[[ONE:.*]] = arith.constant 1 : index -!CHECK: %[[LOAD_N:.*]] = fir.load %[[N]] : !fir.ref +!CHECK: %[[ONE:.*]] = arith.constant 1 : index +!FIR: %[[LOAD_N:.*]] = fir.load %[[N]] : !fir.ref +!HLFIR: %[[LOAD_N:.*]] = fir.load %[[DECLN]]#0 : !fir.ref !CHECK: %[[CONVERT_N:.*]] = fir.convert %[[LOAD_N]] : (i32) -> index !CHECK: %[[LB:.*]] = arith.subi %[[CONVERT_N]], %[[N_IDX]] : index !CHECK: %[[LBEXT:.*]] = arith.addi %[[EXT_B]], %[[N_IDX]] : index -!CHECK: %[[UB:.*]] = arith.subi %[[LBEXT:.*]], %[[ONE]] : index -!CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[N_IDX]] : index) -!CHECK: %[[CREATE1:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND1]]) -> !fir.ref> {name = "b(n:)", structured = false} +!CHECK: %[[UB:.*]] = arith.subi %[[LBEXT:.*]], %[[ONE]] : index +!CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[N_IDX]] : index) +!FIR: %[[CREATE1:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND1]]) -> !fir.ref> {name = "b(n:)", structured = false} +!HLFIR: %[[CREATE1:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%[[BOUND1]]) -> !fir.ref> {name = "b(n:)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE1]] : !fir.ref>) !$acc enter data create(b(:)) -!CHECK: %[[ONE:.*]] = arith.constant 1 : index -!CHECK: %[[LBEXT:.*]] = arith.addi %[[EXT_B]], %[[N_IDX]] : index +!CHECK: %[[ONE:.*]] = arith.constant 1 : index +!CHECK: %[[LBEXT:.*]] = arith.addi %[[EXT_B]], %[[N_IDX]] : index !CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index !CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%[[N_IDX]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[N_IDX]] : index) -!CHECK: %[[CREATE1:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND1]]) -> !fir.ref> {name = "b(:)", structured = false} +!FIR: %[[CREATE1:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND1]]) -> !fir.ref> {name = "b(:)", structured = false} +!HLFIR: %[[CREATE1:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%[[BOUND1]]) -> !fir.ref> {name = "b(:)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE1]] : !fir.ref>) end subroutine @@ -266,6 +310,9 @@ subroutine acc_enter_data_non_default_lb() !CHECK: %[[BASELB:.*]] = arith.constant 0 : index !CHECK: %[[EXTENT_C10:.*]] = arith.constant 10 : index !CHECK: %[[A:.*]] = fir.alloca !fir.array<10xi32> {bindc_name = "a", uniq_name = "_QFacc_enter_data_non_default_lbEa"} +!HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] +!CHECK: %[[B:.*]] = fir.alloca !fir.array<10xi32> {bindc_name = "b", uniq_name = "_QFacc_enter_data_non_default_lbEb"} +!HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] !$acc enter data create(a(5:9)) !CHECK: %[[ONE:.*]] = arith.constant 1 : index @@ -274,7 +321,8 @@ subroutine acc_enter_data_non_default_lb() !CHECK: %[[SECTIONUB:.*]] = arith.constant 9 : index !CHECK: %[[UB:.*]] = arith.subi %[[SECTIONUB]], %[[BASELB]] : index !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[BASELB]] : index) -!CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(5:9)", structured = false} +!FIR: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(5:9)", structured = false} +!HLFIR: %[[CREATE:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(5:9)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(a(:)) @@ -282,7 +330,8 @@ subroutine acc_enter_data_non_default_lb() !CHECK: %[[LBEXT:.*]] = arith.addi %[[EXTENT_C10]], %[[BASELB]] : index !CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[BASELB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[BASELB]] : index) -!CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(:)", structured = false} +!FIR: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(:)", structured = false} +!HLFIR: %[[CREATE:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(:)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(a(:6)) @@ -290,7 +339,8 @@ subroutine acc_enter_data_non_default_lb() !CHECK: %[[SECTIONUB:.*]] = arith.constant 6 : index !CHECK: %[[UB:.*]] = arith.subi %[[SECTIONUB]], %[[BASELB]] : index !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[BASELB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[BASELB]] : index) -!CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(:6)", structured = false} +!FIR: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(:6)", structured = false} +!HLFIR: %[[CREATE:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(:6)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(a(4:)) @@ -300,15 +350,17 @@ subroutine acc_enter_data_non_default_lb() !CHECK: %[[LBEXT:.*]] = arith.addi %[[EXTENT_C10]], %[[BASELB]] : index !CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[BASELB]] : index) -!CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(4:)", structured = false} +!FIR: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(4:)", structured = false} +!HLFIR: %[[CREATE:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(4:)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(b) -!CHECK: %[[ONE:.*]] = arith.constant 1 : index -!CHECK: %[[LB:.*]] = arith.constant 0 : index -!CHECK: %[[UB:.*]] = arith.subi %c10{{.*}}, %[[ONE]] : index -!CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) extent(%c10{{.*}} : index) stride(%[[ONE]] : index) startIdx(%c11{{.*}} : index) -!CHECK: %[[CREATE:.*]] = acc.create varPtr(%1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b", structured = false} +!CHECK: %[[ONE:.*]] = arith.constant 1 : index +!CHECK: %[[LB:.*]] = arith.constant 0 : index +!CHECK: %[[UB:.*]] = arith.subi %c10{{.*}}, %[[ONE]] : index +!CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) extent(%c10{{.*}} : index) stride(%[[ONE]] : index) startIdx(%c11{{.*}} : index) +!FIR: %[[CREATE:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b", structured = false} +!HLFIR: %[[CREATE:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) end subroutine @@ -321,18 +373,23 @@ subroutine acc_enter_data_assumed(a, b, n, m) !CHECK-LABEL: func.func @_QPacc_enter_data_assumed( !CHECK-SAME: %[[A:.*]]: !fir.box> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.box> {fir.bindc_name = "b"}, %[[N:.*]]: !fir.ref {fir.bindc_name = "n"}, %[[M:.*]]: !fir.ref {fir.bindc_name = "m"}) { - +!HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] !CHECK: %[[LB_C10:.*]] = arith.constant 10 : i64 !CHECK: %[[LB_C10_IDX:.*]] = fir.convert %[[LB_C10]] : (i64) -> index +!HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +!HLFIR: %[[DECLM:.*]]:2 = hlfir.declare %[[M]] +!HLFIR: %[[DECLN:.*]]:2 = hlfir.declare %[[N]] !$acc enter data create(a) !CHECK: %[[C1:.*]] = arith.constant 1 : index !CHECK: %[[C0:.*]] = arith.constant 0 : index -!CHECK: %[[DIMS:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) -!CHECK: %[[LB:.*]] = arith.constant 0 : index -!CHECK: %[[UB:.*]] = arith.subi %[[DIMS]]#1, %[[C1]] : index -!CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[DIMS]]#2 : index) startIdx(%[[C1]] : index) {strideInBytes = true} -!CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!FIR: %[[DIMS:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!HLFIR: %[[DIMS:.*]]:3 = fir.box_dims %[[DECLA]]#1, %[[C0]] : (!fir.box>, index) -> (index, index, index) +!CHECK: %[[LB:.*]] = arith.constant 0 : index +!CHECK: %[[UB:.*]] = arith.subi %[[DIMS]]#1, %[[C1]] : index +!CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[DIMS]]#2 : index) startIdx(%[[C1]] : index) {strideInBytes = true} +!FIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!HLFIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[DECLA]]#1 : (!fir.box>) -> !fir.ref> !CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[BOX_ADDR]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) @@ -340,27 +397,33 @@ subroutine acc_enter_data_assumed(a, b, n, m) !CHECK: %[[LB:.*]] = arith.constant 0 : index !CHECK: %[[ONE:.*]] = arith.constant 1 : index !CHECK: %[[C0:.*]] = arith.constant 0 : index -!CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!FIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!HLFIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[DECLA]]#1, %[[C0]] : (!fir.box>, index) -> (index, index, index) !CHECK: %[[C0:.*]] = arith.constant 0 : index -!CHECK: %[[DIMS1:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!FIR: %[[DIMS1:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!HLFIR: %[[DIMS1:.*]]:3 = fir.box_dims %[[DECLA]]#1, %[[C0]] : (!fir.box>, index) -> (index, index, index) !CHECK: %[[LBEXT:.*]] = arith.addi %[[DIMS1]]#1, %[[ONE]] : index !CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[DIMS0]]#2 : index) startIdx(%[[ONE]] : index) {strideInBytes = true} -!CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!FIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!HLFIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[DECLA]]#1 : (!fir.box>) -> !fir.ref> !CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[BOX_ADDR]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(:)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(a(2:)) !CHECK: %[[ONE:.*]] = arith.constant 1 : index !CHECK: %[[C0:.*]] = arith.constant 0 : index -!CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!FIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!HLFIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[DECLA]]#1, %[[C0]] : (!fir.box>, index) -> (index, index, index) !CHECK: %[[LB:.*]] = arith.constant 1 : index !CHECK: %[[C0:.*]] = arith.constant 0 : index -!CHECK: %[[DIMS1:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!FIR: %[[DIMS1:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!HLFIR: %[[DIMS1:.*]]:3 = fir.box_dims %[[DECLA]]#1, %[[C0]] : (!fir.box>, index) -> (index, index, index) !CHECK: %[[LBEXT:.*]] = arith.addi %[[DIMS1]]#1, %[[ONE]] : index !CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[DIMS0]]#2 : index) startIdx(%[[ONE]] : index) {strideInBytes = true} -!CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!FIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!HLFIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[DECLA]]#1 : (!fir.box>) -> !fir.ref> !CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[BOX_ADDR]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(2:)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) @@ -368,37 +431,45 @@ subroutine acc_enter_data_assumed(a, b, n, m) !CHECK: %[[LB:.*]] = arith.constant 0 : index !CHECK: %[[ONE:.*]] = arith.constant 1 : index !CHECK: %[[C0:.*]] = arith.constant 0 : index -!CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!FIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!HLFIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[DECLA]]#1, %[[C0]] : (!fir.box>, index) -> (index, index, index) !CHECK: %[[UB:.*]] = arith.constant 3 : index !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[DIMS0]]#2 : index) startIdx(%[[ONE]] : index) {strideInBytes = true} -!CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!FIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!HLFIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[DECLA]]#1 : (!fir.box>) -> !fir.ref> !CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[BOX_ADDR]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(:4)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(a(6:10)) !CHECK: %[[ONE:.*]] = arith.constant 1 : index !CHECK: %[[C0:.*]] = arith.constant 0 : index -!CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!FIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!HLFIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[DECLA]]#1, %[[C0]] : (!fir.box>, index) -> (index, index, index) !CHECK: %[[LB:.*]] = arith.constant 5 : index !CHECK: %[[UB:.*]] = arith.constant 9 : index !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[DIMS0]]#2 : index) startIdx(%[[ONE]] : index) {strideInBytes = true} -!CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!FIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!HLFIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[DECLA]]#1 : (!fir.box>) -> !fir.ref> !CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[BOX_ADDR]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(6:10)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(a(n:)) !CHECK: %[[ONE:.*]] = arith.constant 1 : index !CHECK: %[[C0:.*]] = arith.constant 0 : index -!CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) -!CHECK: %[[LOAD_N:.*]] = fir.load %[[N]] : !fir.ref +!FIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!HLFIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[DECLA]]#1, %[[C0]] : (!fir.box>, index) -> (index, index, index) +!FIR: %[[LOAD_N:.*]] = fir.load %[[N]] : !fir.ref +!HLFIR: %[[LOAD_N:.*]] = fir.load %[[DECLN]]#0 : !fir.ref !CHECK: %[[CONVERT_N:.*]] = fir.convert %[[LOAD_N]] : (i32) -> index !CHECK: %[[LB:.*]] = arith.subi %[[CONVERT_N]], %[[ONE]] : index !CHECK: %[[C0:.*]] = arith.constant 0 : index -!CHECK: %[[DIMS:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!FIR: %[[DIMS:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!HLFIR: %[[DIMS:.*]]:3 = fir.box_dims %[[DECLA]]#1, %[[C0]] : (!fir.box>, index) -> (index, index, index) !CHECK: %[[LBEXT:.*]] = arith.addi %[[DIMS]]#1, %[[ONE]] : index !CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[DIMS0]]#2 : index) startIdx(%[[ONE]] : index) {strideInBytes = true} -!CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!FIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!HLFIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[DECLA]]#1 : (!fir.box>) -> !fir.ref> !CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[BOX_ADDR]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(n:)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) @@ -406,49 +477,61 @@ subroutine acc_enter_data_assumed(a, b, n, m) !CHECK: %[[BASELB:.*]] = arith.constant 0 : index !CHECK: %[[ONE:.*]] = arith.constant 1 : index !CHECK: %[[C0:.*]] = arith.constant 0 : index -!CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) -!CHECK: %[[LOAD_M:.*]] = fir.load %[[M]] : !fir.ref +!FIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!HLFIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[DECLA]]#1, %[[C0]] : (!fir.box>, index) -> (index, index, index) +!FIR: %[[LOAD_M:.*]] = fir.load %[[M]] : !fir.ref +!HLFIR: %[[LOAD_M:.*]] = fir.load %[[DECLM]]#0 : !fir.ref !CHECK: %[[CONVERT_M:.*]] = fir.convert %[[LOAD_M]] : (i32) -> index !CHECK: %[[UB:.*]] = arith.subi %[[CONVERT_M]], %[[ONE]] : index !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[BASELB]] : index) upperbound(%[[UB]] : index) stride(%[[DIMS0]]#2 : index) startIdx(%[[ONE]] : index) {strideInBytes = true} -!CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!FIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!HLFIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[DECLA]]#1 : (!fir.box>) -> !fir.ref> !CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[BOX_ADDR]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(:m)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(a(n:m)) !CHECK: %[[ONE:.*]] = arith.constant 1 : index !CHECK: %[[C0:.*]] = arith.constant 0 : index -!CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) -!CHECK: %[[LOAD_N:.*]] = fir.load %[[N]] : !fir.ref +!FIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[A]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!HLFIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[DECLA]]#1, %[[C0]] : (!fir.box>, index) -> (index, index, index) +!FIR: %[[LOAD_N:.*]] = fir.load %[[N]] : !fir.ref +!HLFIR: %[[LOAD_N:.*]] = fir.load %[[DECLN]]#0 : !fir.ref !CHECK: %[[CONVERT_N:.*]] = fir.convert %[[LOAD_N]] : (i32) -> index !CHECK: %[[LB:.*]] = arith.subi %[[CONVERT_N]], %[[ONE]] : index -!CHECK: %[[LOAD_M:.*]] = fir.load %[[M]] : !fir.ref +!FIR: %[[LOAD_M:.*]] = fir.load %[[M]] : !fir.ref +!HLFIR: %[[LOAD_M:.*]] = fir.load %[[DECLM]]#0 : !fir.ref !CHECK: %[[CONVERT_M:.*]] = fir.convert %[[LOAD_M]] : (i32) -> index !CHECK: %[[UB:.*]] = arith.subi %[[CONVERT_M]], %[[ONE]] : index !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[DIMS0]]#2 : index) startIdx(%[[ONE]] : index) {strideInBytes = true} -!CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!FIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[A]] : (!fir.box>) -> !fir.ref> +!HLFIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[DECLA]]#1 : (!fir.box>) -> !fir.ref> !CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[BOX_ADDR]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(n:m)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(b(:m)) !CHECK: %[[C0:.*]] = arith.constant 0 : index -!CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %[[B]], %[[C0]] : (!fir.box>, index) -> (index, index, index) -!CHECK: %[[LOAD_M:.*]] = fir.load %[[M]] : !fir.ref +!FIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[B]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!HLFIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[DECLB]]#1, %[[C0]] : (!fir.box>, index) -> (index, index, index) +!FIR: %[[LOAD_M:.*]] = fir.load %[[M]] : !fir.ref +!HLFIR: %[[LOAD_M:.*]] = fir.load %[[DECLM]]#0 : !fir.ref !CHECK: %[[CONVERT_M:.*]] = fir.convert %[[LOAD_M]] : (i32) -> index !CHECK: %[[UB:.*]] = arith.subi %[[CONVERT_M]], %[[LB_C10_IDX]] : index !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB_C10_IDX]] : index) upperbound(%[[UB]] : index) stride(%[[DIMS0]]#2 : index) startIdx(%[[LB_C10_IDX]] : index) {strideInBytes = true} -!CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[B]] : (!fir.box>) -> !fir.ref> +!FIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[B]] : (!fir.box>) -> !fir.ref> +!HLFIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[DECLB]]#1 : (!fir.box>) -> !fir.ref> !CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[BOX_ADDR]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b(:m)", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(b) !CHECK: %[[ONE:.*]] = arith.constant 1 : index !CHECK: %[[C0:.*]] = arith.constant 0 : index -!CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %[[B]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!FIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[B]], %[[C0]] : (!fir.box>, index) -> (index, index, index) +!HLFIR: %[[DIMS0:.*]]:3 = fir.box_dims %[[DECLB]]#1, %[[C0]] : (!fir.box>, index) -> (index, index, index) !CHECK: %[[C0:.*]] = arith.constant 0 : index !CHECK: %[[UB:.*]] = arith.subi %[[DIMS0]]#1, %[[ONE]] : index !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[C0]] : index) upperbound(%[[UB]] : index) stride(%[[DIMS0]]#2 : index) startIdx(%[[LB_C10_IDX]] : index) {strideInBytes = true} -!CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[B]] : (!fir.box>) -> !fir.ref> +!FIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[B]] : (!fir.box>) -> !fir.ref> +!HLFIR: %[[BOX_ADDR:.*]] = fir.box_addr %[[DECLB]]#1 : (!fir.box>) -> !fir.ref> !CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[BOX_ADDR]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) @@ -457,15 +540,19 @@ subroutine acc_enter_data_assumed(a, b, n, m) subroutine acc_enter_data_allocatable() real, allocatable :: a(:) integer, allocatable :: i - + !CHECK-LABEL: func.func @_QPacc_enter_data_allocatable() { !CHECK: %[[A:.*]] = fir.alloca !fir.box>> {bindc_name = "a", uniq_name = "_QFacc_enter_data_allocatableEa"} +!HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] !CHECK: %[[I:.*]] = fir.alloca !fir.box> {bindc_name = "i", uniq_name = "_QFacc_enter_data_allocatableEi"} +!HLFIR: %[[DECLI:.*]]:2 = hlfir.declare %[[I]] !$acc enter data create(a) -!CHECK: %[[BOX_A_0:.*]] = fir.load %[[A]] : !fir.ref>>> +!FIR: %[[BOX_A_0:.*]] = fir.load %[[A]] : !fir.ref>>> +!HLFIR: %[[BOX_A_0:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> !CHECK: %[[C0_0:.*]] = arith.constant 0 : index -!CHECK: %[[BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +!FIR: %[[BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +!HLFIR: %[[BOX_A_1:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> !CHECK: %[[C0_1:.*]] = arith.constant 0 : index !CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %[[BOX_A_1]], %[[C0_1]] : (!fir.box>>, index) -> (index, index, index) !CHECK: %[[DIMS1:.*]]:3 = fir.box_dims %[[BOX_A_0]], %[[C0_0]] : (!fir.box>>, index) -> (index, index, index) @@ -476,14 +563,17 @@ subroutine acc_enter_data_allocatable() !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.heap>) !$acc enter data create(a(:)) -!CHECK: %[[BOX_A_0:.*]] = fir.load %[[A]] : !fir.ref>>> +!FIR: %[[BOX_A_0:.*]] = fir.load %[[A]] : !fir.ref>>> +!HLFIR: %[[BOX_A_0:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> !CHECK: %[[ONE:.*]] = arith.constant 1 : index -!CHECK: %[[BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +!FIR: %[[BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +!HLFIR: %[[BOX_A_1:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> !CHECK: %[[C0:.*]] = arith.constant 0 : index !CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %[[BOX_A_1]], %[[C0]] : (!fir.box>>, index) -> (index, index, index) !CHECK: %[[C0:.*]] = arith.constant 0 : index !CHECK: %[[DIMS1:.*]]:3 = fir.box_dims %[[BOX_A_0]], %[[C0]] : (!fir.box>>, index) -> (index, index, index) -!CHECK: %[[BOX_A_2:.*]] = fir.load %[[A]] : !fir.ref>>> +!FIR: %[[BOX_A_2:.*]] = fir.load %[[A]] : !fir.ref>>> +!HLFIR: %[[BOX_A_2:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> !CHECK: %[[C0:.*]] = arith.constant 0 : index !CHECK: %[[DIMS2:.*]]:3 = fir.box_dims %[[BOX_A_2]], %[[C0]] : (!fir.box>>, index) -> (index, index, index) !CHECK: %[[LBEXT:.*]] = arith.addi %[[DIMS2]]#1, %[[DIMS0]]#0 : index @@ -494,8 +584,10 @@ subroutine acc_enter_data_allocatable() !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.heap>) !$acc enter data create(a(2:5)) -!CHECK: %[[BOX_A_0:.*]] = fir.load %[[A]] : !fir.ref>>> -!CHECK: %[[BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +!FIR: %[[BOX_A_0:.*]] = fir.load %[[A]] : !fir.ref>>> +!HLFIR: %[[BOX_A_0:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> +!FIR: %[[BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +!HLFIR: %[[BOX_A_1:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> !CHECK: %[[C0:.*]] = arith.constant 0 : index !CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %[[BOX_A_1]], %[[C0]] : (!fir.box>>, index) -> (index, index, index) !CHECK: %[[C0:.*]] = arith.constant 0 : index @@ -510,16 +602,19 @@ subroutine acc_enter_data_allocatable() !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.heap>) !$acc enter data create(a(3:)) -!CHECK: %[[BOX_A_0:.*]] = fir.load %[[A]] : !fir.ref>>> +!FIR: %[[BOX_A_0:.*]] = fir.load %[[A]] : !fir.ref>>> +!HLFIR: %[[BOX_A_0:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> !CHECK: %[[ONE:.*]] = arith.constant 1 : index -!CHECK: %[[BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +!FIR: %[[BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +!HLFIR: %[[BOX_A_1:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> !CHECK: %[[C0:.*]] = arith.constant 0 : index !CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %[[BOX_A_1]], %[[C0]] : (!fir.box>>, index) -> (index, index, index) !CHECK: %[[C0:.*]] = arith.constant 0 : index !CHECK: %[[DIMS1:.*]]:3 = fir.box_dims %[[BOX_A_0]], %[[C0]] : (!fir.box>>, index) -> (index, index, index) !CHECK: %[[C3:.*]] = arith.constant 3 : index !CHECK: %[[LB:.*]] = arith.subi %[[C3]], %[[DIMS0]]#0 : index -!CHECK: %[[BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +!FIR: %[[BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +!HLFIR: %[[BOX_A_1:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> !CHECK: %[[C0:.*]] = arith.constant 0 : index !CHECK: %[[DIMS2:.*]]:3 = fir.box_dims %[[BOX_A_1]], %[[C0]] : (!fir.box>>, index) -> (index, index, index) !CHECK: %[[LBEXT:.*]] = arith.addi %[[DIMS2:.*]]#1, %[[DIMS0]]#0 : index @@ -530,8 +625,10 @@ subroutine acc_enter_data_allocatable() !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.heap>) !$acc enter data create(a(:7)) -!CHECK: %[[BOX_A_0:.*]] = fir.load %[[A]] : !fir.ref>>> -!CHECK: %[[BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +!FIR: %[[BOX_A_0:.*]] = fir.load %[[A]] : !fir.ref>>> +!HLFIR: %[[BOX_A_0:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> +!FIR: %[[BOX_A_1:.*]] = fir.load %[[A]] : !fir.ref>>> +!HLFIR: %[[BOX_A_1:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> !CHECK: %[[C0:.*]] = arith.constant 0 : index !CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %[[BOX_A_1]], %[[C0]] : (!fir.box>>, index) -> (index, index, index) !CHECK: %[[C0:.*]] = arith.constant 0 : index @@ -544,7 +641,8 @@ subroutine acc_enter_data_allocatable() !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.heap>) !$acc enter data create(i) -!CHECK: %[[BOX_I:.*]] = fir.load %[[I]] : !fir.ref>> +!FIR: %[[BOX_I:.*]] = fir.load %[[I]] : !fir.ref>> +!HLFIR: %[[BOX_I:.*]] = fir.load %[[DECLI]]#1 : !fir.ref>> !CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[BOX_I]] : (!fir.box>) -> !fir.heap !CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[BOX_ADDR]] : !fir.heap) -> !fir.heap {name = "i", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.heap) @@ -577,28 +675,37 @@ subroutine acc_enter_data_derived_type() !CHECK-LABEL: func.func @_QPacc_enter_data_derived_type() { !CHECK: %[[A:.*]] = fir.alloca !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> {bindc_name = "a", uniq_name = "_QFacc_enter_data_derived_typeEa"} +!HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] !CHECK: %[[AA:.*]] = fir.alloca !fir.array<10x!fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}>> {bindc_name = "aa", uniq_name = "_QFacc_enter_data_derived_typeEaa"} +!HLFIR: %[[DECLAA:.*]]:2 = hlfir.declare %[[AA]] !CHECK: %[[B:.*]] = fir.alloca !fir.type<_QFacc_enter_data_derived_typeTt{d:!fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}>}> {bindc_name = "b", uniq_name = "_QFacc_enter_data_derived_typeEb"} +!HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] !CHECK: %[[C:.*]] = fir.alloca !fir.type<_QFacc_enter_data_derived_typeTz{data:!fir.box>>}> {bindc_name = "c", uniq_name = "_QFacc_enter_data_derived_typeEc"} +!HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] !CHECK: %[[D:.*]] = fir.alloca !fir.type<_QFacc_enter_data_derived_typeTtt{d:!fir.array<10x!fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}>>}> {bindc_name = "d", uniq_name = "_QFacc_enter_data_derived_typeEd"} +!HLFIR: %[[DECLD:.*]]:2 = hlfir.declare %[[D]] !$acc enter data create(a%data) -!CHECK: %[[DATA_FIELD:.*]] = fir.field_index data, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> -!CHECK: %[[DATA_COORD:.*]] = fir.coordinate_of %[[A]], %[[DATA_FIELD]] : (!fir.ref}>>, !fir.field) -> !fir.ref +!FIR: %[[DATA_FIELD:.*]] = fir.field_index data, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> +!FIR: %[[DATA_COORD:.*]] = fir.coordinate_of %[[A]], %[[DATA_FIELD]] : (!fir.ref}>>, !fir.field) -> !fir.ref +!HLFIR: %[[DATA_COORD:.*]] = hlfir.designate %[[DECLA]]#0{"data"} : (!fir.ref}>>) -> !fir.ref !CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[DATA_COORD]] : !fir.ref) -> !fir.ref {name = "a%data", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref) !$acc enter data create(b%d%data) -!CHECK: %[[D_FIELD:.*]] = fir.field_index d, !fir.type<_QFacc_enter_data_derived_typeTt{d:!fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}>}> -!CHECK: %[[DATA_FIELD:.*]] = fir.field_index data, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> -!CHECK: %[[DATA_COORD:.*]] = fir.coordinate_of %[[B]], %[[D_FIELD]], %[[DATA_FIELD]] : (!fir.ref}>}>>, !fir.field, !fir.field) -> !fir.ref +!FIR: %[[D_FIELD:.*]] = fir.field_index d, !fir.type<_QFacc_enter_data_derived_typeTt{d:!fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}>}> +!FIR: %[[DATA_FIELD:.*]] = fir.field_index data, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> +!FIR: %[[DATA_COORD:.*]] = fir.coordinate_of %[[B]], %[[D_FIELD]], %[[DATA_FIELD]] : (!fir.ref}>}>>, !fir.field, !fir.field) -> !fir.ref +!HLFIR: %[[D_COORD:.*]] = hlfir.designate %[[DECLB]]#0{"d"} : (!fir.ref}>}>>) -> !fir.ref}>> +!HLFIR: %[[DATA_COORD:.*]] = hlfir.designate %[[D_COORD]]{"data"} : (!fir.ref}>>) -> !fir.ref !CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[DATA_COORD]] : !fir.ref) -> !fir.ref {name = "b%d%data", structured = false} !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref) !$acc enter data create(a%array) -!CHECK: %[[ARRAY_FIELD:.*]] = fir.field_index array, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> -!CHECK: %[[ARRAY_COORD:.*]] = fir.coordinate_of %[[A]], %[[ARRAY_FIELD]] : (!fir.ref}>>, !fir.field) -> !fir.ref> +!FIR: %[[ARRAY_FIELD:.*]] = fir.field_index array, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> +!FIR: %[[ARRAY_COORD:.*]] = fir.coordinate_of %[[A]], %[[ARRAY_FIELD]] : (!fir.ref}>>, !fir.field) -> !fir.ref> !CHECK: %[[C10:.*]] = arith.constant 10 : index +!HLFIR: %[[ARRAY_COORD:.*]] = hlfir.designate %[[DECLA]]#0{"array"} shape %{{.*}} : (!fir.ref}>>, !fir.shape<1>) -> !fir.ref> !CHECK: %[[C1:.*]] = arith.constant 1 : index !CHECK: %[[LB:.*]] = arith.constant 0 : index !CHECK: %[[UB:.*]] = arith.subi %[[C10]], %[[C1]] : index @@ -607,9 +714,10 @@ subroutine acc_enter_data_derived_type() !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(a%array(:)) -!CHECK: %[[ARRAY_FIELD:.*]] = fir.field_index array, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> -!CHECK: %[[ARRAY_COORD:.*]] = fir.coordinate_of %[[A]], %[[ARRAY_FIELD]] : (!fir.ref}>>, !fir.field) -> !fir.ref> +!FIR: %[[ARRAY_FIELD:.*]] = fir.field_index array, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> +!FIR: %[[ARRAY_COORD:.*]] = fir.coordinate_of %[[A]], %[[ARRAY_FIELD]] : (!fir.ref}>>, !fir.field) -> !fir.ref> !CHECK: %[[C10:.*]] = arith.constant 10 : index +!HLFIR: %[[ARRAY_COORD:.*]] = hlfir.designate %[[DECLA]]#0{"array"} shape %{{.*}} : (!fir.ref}>>, !fir.shape<1>) -> !fir.ref> !CHECK: %[[LB:.*]] = arith.constant 0 : index !CHECK: %[[C1:.*]] = arith.constant 1 : index !CHECK: %[[LBEXT:.*]] = arith.addi %[[C10]], %[[C1]] : index @@ -619,8 +727,9 @@ subroutine acc_enter_data_derived_type() !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(a%array(1:5)) -!CHECK: %[[ARRAY_FIELD:.*]] = fir.field_index array, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> -!CHECK: %[[ARRAY_COORD:.*]] = fir.coordinate_of %[[A]], %[[ARRAY_FIELD]] : (!fir.ref}>>, !fir.field) -> !fir.ref> +!FIR: %[[ARRAY_FIELD:.*]] = fir.field_index array, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> +!FIR: %[[ARRAY_COORD:.*]] = fir.coordinate_of %[[A]], %[[ARRAY_FIELD]] : (!fir.ref}>>, !fir.field) -> !fir.ref> +!HLFIR: %[[ARRAY_COORD:.*]] = hlfir.designate %[[DECLA]]#0{"array"} shape %{{.*}} : (!fir.ref}>>, !fir.shape<1>) -> !fir.ref> !CHECK: %[[C1:.*]] = arith.constant 1 : index !CHECK: %[[C0:.*]] = arith.constant 0 : index !CHECK: %[[C4:.*]] = arith.constant 4 : index @@ -629,9 +738,10 @@ subroutine acc_enter_data_derived_type() !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(a%array(:5)) -!CHECK: %[[ARRAY_FIELD:.*]] = fir.field_index array, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> -!CHECK: %[[ARRAY_COORD:.*]] = fir.coordinate_of %[[A]], %[[ARRAY_FIELD]] : (!fir.ref}>>, !fir.field) -> !fir.ref> -!CHECK: %[[LB:.*]] = arith.constant 0 : index +!FIR: %[[ARRAY_FIELD:.*]] = fir.field_index array, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> +!FIR: %[[ARRAY_COORD:.*]] = fir.coordinate_of %[[A]], %[[ARRAY_FIELD]] : (!fir.ref}>>, !fir.field) -> !fir.ref> +!HLFIR: %[[ARRAY_COORD:.*]] = hlfir.designate %[[DECLA]]#0{"array"} shape %{{.*}} : (!fir.ref}>>, !fir.shape<1>) -> !fir.ref> +!CHECK: %[[LB:.*]] = arith.constant 0 : index !CHECK: %[[C1:.*]] = arith.constant 1 : index !CHECK: %[[C4:.*]] = arith.constant 4 : index !CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[C4]] : index) stride(%[[C1]] : index) startIdx(%[[C1]] : index) @@ -639,9 +749,10 @@ subroutine acc_enter_data_derived_type() !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(a%array(2:)) -!CHECK: %[[ARRAY_FIELD:.*]] = fir.field_index array, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> -!CHECK: %[[ARRAY_COORD:.*]] = fir.coordinate_of %[[A]], %[[ARRAY_FIELD]] : (!fir.ref}>>, !fir.field) -> !fir.ref> +!FIR: %[[ARRAY_FIELD:.*]] = fir.field_index array, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> +!FIR: %[[ARRAY_COORD:.*]] = fir.coordinate_of %[[A]], %[[ARRAY_FIELD]] : (!fir.ref}>>, !fir.field) -> !fir.ref> !CHECK: %[[C10:.*]] = arith.constant 10 : index +!HLFIR: %[[ARRAY_COORD:.*]] = hlfir.designate %[[DECLA]]#0{"array"} shape %{{.*}} : (!fir.ref}>>, !fir.shape<1>) -> !fir.ref> !CHECK: %[[ONE:.*]] = arith.constant 1 : index !CHECK: %[[LB:.*]] = arith.constant 1 : index !CHECK: %[[LBEXT:.*]] = arith.addi %[[C10]], %[[ONE]] : index @@ -651,10 +762,12 @@ subroutine acc_enter_data_derived_type() !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref>) !$acc enter data create(b%d%array) -!CHECK: %[[D_FIELD:.*]] = fir.field_index d, !fir.type<_QFacc_enter_data_derived_typeTt{d:!fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}>}> -!CHECK: %[[ARRAY_FIELD:.*]] = fir.field_index array, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> -!CHECK: %[[ARRAY_COORD:.*]] = fir.coordinate_of %[[B]], %[[D_FIELD]], %[[ARRAY_FIELD]] : (!fir.ref}>}>>, !fir.field, !fir.field) -> !fir.ref> +!FIR: %[[D_FIELD:.*]] = fir.field_index d, !fir.type<_QFacc_enter_data_derived_typeTt{d:!fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}>}> +!FIR: %[[ARRAY_FIELD:.*]] = fir.field_index array, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> +!FIR: %[[ARRAY_COORD:.*]] = fir.coordinate_of %[[B]], %[[D_FIELD]], %[[ARRAY_FIELD]] : (!fir.ref}>}>>, !fir.field, !fir.field) -> !fir.ref> +!HLFIR: %[[D_COORD:.*]] = hlfir.designate %[[DECLB]]#0{"d"} : (!fir.ref}>}>>) -> !fir.ref}>> !CHECK: %[[C10:.*]] = arith.constant 10 : index +!HLFIR: %[[ARRAY_COORD:.*]] = hlfir.designate %[[D_COORD]]{"array"} shape %{{.*}} : (!fir.ref}>>, !fir.shape<1>) -> !fir.ref> !CHECK: %[[C1:.*]] = arith.constant 1 : index !CHECK: %[[LB:.*]] = arith.constant 0 : index !CHECK: %[[UB:.*]] = arith.subi %[[C10]], %[[C1]] : index @@ -662,8 +775,9 @@ subroutine acc_enter_data_derived_type() !CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[ARRAY_COORD]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b%d%array", structured = false} !$acc enter data create(c%data) -!CHECK: %[[DATA_FIELD:.*]] = fir.field_index data, !fir.type<_QFacc_enter_data_derived_typeTz{data:!fir.box>>}> -!CHECK: %[[DATA_COORD:.*]] = fir.coordinate_of %[[C]], %[[DATA_FIELD]] : (!fir.ref>>}>>, !fir.field) -> !fir.ref>>> +!FIR: %[[DATA_FIELD:.*]] = fir.field_index data, !fir.type<_QFacc_enter_data_derived_typeTz{data:!fir.box>>}> +!FIR: %[[DATA_COORD:.*]] = fir.coordinate_of %[[C]], %[[DATA_FIELD]] : (!fir.ref>>}>>, !fir.field) -> !fir.ref>>> +!HLFIR: %[[DATA_COORD:.*]] = hlfir.designate %[[DECLC]]#0{"data"} {fortran_attrs = #fir.var_attrs} : (!fir.ref>>}>>) -> !fir.ref>>> !CHECK: %[[DATA_BOX:.*]] = fir.load %[[DATA_COORD]] : !fir.ref>>> !CHECK: %[[DIM0:.*]] = arith.constant 0 : index !CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %[[DATA_BOX]], %[[DIM0]] : (!fir.box>>, index) -> (index, index, index) @@ -677,15 +791,18 @@ subroutine acc_enter_data_derived_type() !CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.heap>) !$acc enter data create (d%d(1)%array) -!CHECK: %[[D_FIELD:.*]] = fir.field_index d, !fir.type<_QFacc_enter_data_derived_typeTtt{d:!fir.array<10x!fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}>>}> -!CHECK: %[[D_COORD:.*]] = fir.coordinate_of %[[D]], %[[D_FIELD]] : (!fir.ref}>>}>>, !fir.field) -> !fir.ref}>>> -!CHECK: %[[IDX:.*]] = arith.constant 1 : i64 -!CHECK: %[[ONE:.*]] = arith.constant 1 : i64 -!CHECK: %[[NORMALIZED_IDX:.*]] = arith.subi %[[IDX]], %[[ONE]] : i64 -!CHECK: %[[D1_COORD:.*]] = fir.coordinate_of %[[D_COORD]], %[[NORMALIZED_IDX]] : (!fir.ref}>>>, i64) -> !fir.ref}>> -!CHECK: %[[ARRAY_FIELD:.*]] = fir.field_index array, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> -!CHECK: %[[ARRAY_COORD:.*]] = fir.coordinate_of %[[D1_COORD]], %[[ARRAY_FIELD]] : (!fir.ref}>>, !fir.field) -> !fir.ref> +!FIR: %[[D_FIELD:.*]] = fir.field_index d, !fir.type<_QFacc_enter_data_derived_typeTtt{d:!fir.array<10x!fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}>>}> +!FIR: %[[D_COORD:.*]] = fir.coordinate_of %[[D]], %[[D_FIELD]] : (!fir.ref}>>}>>, !fir.field) -> !fir.ref}>>> +!FIR: %[[IDX:.*]] = arith.constant 1 : i64 +!FIR: %[[ONE:.*]] = arith.constant 1 : i64 +!FIR: %[[NORMALIZED_IDX:.*]] = arith.subi %[[IDX]], %[[ONE]] : i64 +!FIR: %[[D1_COORD:.*]] = fir.coordinate_of %[[D_COORD]], %[[NORMALIZED_IDX]] : (!fir.ref}>>>, i64) -> !fir.ref}>> +!HLFIR: %[[ONE:.*]] = arith.constant 1 : index +!HLFIR: %[[D1_COORD:.*]] = hlfir.designate %[[DECLD]]#0{"d"} <%{{.*}}> (%[[ONE]]) : (!fir.ref}>>}>>, !fir.shape<1>, index) -> !fir.ref}>> +!FIR: %[[ARRAY_FIELD:.*]] = fir.field_index array, !fir.type<_QFacc_enter_data_derived_typeTdt{data:f32,array:!fir.array<10xf32>}> +!FIR: %[[ARRAY_COORD:.*]] = fir.coordinate_of %[[D1_COORD]], %[[ARRAY_FIELD]] : (!fir.ref}>>, !fir.field) -> !fir.ref> !CHECK: %[[C10:.*]] = arith.constant 10 : index +!HLFIR: %[[ARRAY_COORD:.*]] = hlfir.designate %[[D1_COORD]]{"array"} shape %{{.*}} : (!fir.ref}>>, !fir.shape<1>) -> !fir.ref> !CHECK: %[[C1:.*]] = arith.constant 1 : index !CHECK: %[[LB:.*]] = arith.constant 0 : index !CHECK: %[[UB:.*]] = arith.subi %[[C10]], %[[C1]] : index diff --git a/flang/test/Lower/OpenACC/acc-exit-data.f90 b/flang/test/Lower/OpenACC/acc-exit-data.f90 index 87f6c25c7c0b3..ec92cbb43aba1 100644 --- a/flang/test/Lower/OpenACC/acc-exit-data.f90 +++ b/flang/test/Lower/OpenACC/acc-exit-data.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of OpenACC exit data directive. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s --check-prefixes=CHECK,FIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR subroutine acc_exit_data integer :: async = 1 @@ -9,91 +10,113 @@ subroutine acc_exit_data logical :: ifCondition = .TRUE. !CHECK: %[[A:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ea"} +!HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] !CHECK: %[[B:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} +!HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] !CHECK: %[[C:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} +!HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] !CHECK: %[[D:.*]] = fir.alloca !fir.box> {bindc_name = "d", uniq_name = "{{.*}}Ed"} +!HLFIR: %[[DECLD:.*]]:2 = hlfir.declare %[[D]] !$acc exit data delete(a) -!CHECK: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!FIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!HLFIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} !CHECK: acc.exit_data dataOperands(%[[DEVPTR]] : !fir.ref>) !CHECK: acc.delete accPtr(%[[DEVPTR]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {name = "a", structured = false} !$acc exit data delete(a) if(.true.) -!CHECK: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!FIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!HLFIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} !CHECK: %[[IF1:.*]] = arith.constant true -!CHECK: acc.exit_data if(%[[IF1]]) dataOperands(%[[DEVPTR]] : !fir.ref>) +!CHECK: acc.exit_data if(%[[IF1]]) dataOperands(%[[DEVPTR]] : !fir.ref>) !CHECK: acc.delete accPtr(%[[DEVPTR]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {name = "a", structured = false} !$acc exit data delete(a) if(ifCondition) -!CHECK: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!FIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!HLFIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} !CHECK: %[[IFCOND:.*]] = fir.load %{{.*}} : !fir.ref> !CHECK: %[[IF2:.*]] = fir.convert %[[IFCOND]] : (!fir.logical<4>) -> i1 !CHECK: acc.exit_data if(%[[IF2]]) dataOperands(%[[DEVPTR]] : !fir.ref>){{$}} !CHECK: acc.delete accPtr(%[[DEVPTR]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {name = "a", structured = false} !$acc exit data delete(a) delete(b) delete(c) -!CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} -!CHECK: %[[DEVPTR_B:.*]] = acc.getdeviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b", structured = false} -!CHECK: %[[DEVPTR_C:.*]] = acc.getdeviceptr varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c", structured = false} +!FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!FIR: %[[DEVPTR_B:.*]] = acc.getdeviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b", structured = false} +!HLFIR: %[[DEVPTR_B:.*]] = acc.getdeviceptr varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b", structured = false} +!FIR: %[[DEVPTR_C:.*]] = acc.getdeviceptr varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c", structured = false} +!HLFIR: %[[DEVPTR_C:.*]] = acc.getdeviceptr varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c", structured = false} !CHECK: acc.exit_data dataOperands(%[[DEVPTR_A]], %[[DEVPTR_B]], %[[DEVPTR_C]] : !fir.ref>, !fir.ref>, !fir.ref>){{$}} !CHECK: acc.delete accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {name = "a", structured = false} !CHECK: acc.delete accPtr(%[[DEVPTR_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {name = "b", structured = false} !CHECK: acc.delete accPtr(%[[DEVPTR_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {name = "c", structured = false} !$acc exit data copyout(a) delete(b) detach(d) -!CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} -!CHECK: %[[DEVPTR_B:.*]] = acc.getdeviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b", structured = false} -!CHECK: %[[BOX_D:.*]] = fir.load %[[D]] : !fir.ref>> +!FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!FIR: %[[DEVPTR_B:.*]] = acc.getdeviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b", structured = false} +!HLFIR: %[[DEVPTR_B:.*]] = acc.getdeviceptr varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b", structured = false} +!FIR: %[[BOX_D:.*]] = fir.load %[[D]] : !fir.ref>> +!HLFIR: %[[BOX_D:.*]] = fir.load %[[DECLD]]#1 : !fir.ref>> !CHECK: %[[D_ADDR:.*]] = fir.box_addr %[[BOX_D]] : (!fir.box>) -> !fir.ptr !CHECK: %[[DEVPTR_D:.*]] = acc.getdeviceptr varPtr(%[[D_ADDR]] : !fir.ptr) -> !fir.ptr {dataClause = #acc, name = "d", structured = false} !CHECK: acc.exit_data dataOperands(%[[DEVPTR_A]], %[[DEVPTR_B]], %[[DEVPTR_D]] : !fir.ref>, !fir.ref>, !fir.ptr) -!CHECK: acc.copyout accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +!FIR: acc.copyout accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +!HLFIR: acc.copyout accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} !CHECK: acc.delete accPtr(%[[DEVPTR_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {name = "b", structured = false} !CHECK: acc.detach accPtr(%[[DEVPTR_D]] : !fir.ptr) {name = "d", structured = false} !$acc exit data delete(a) async -!CHECK: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!FIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!HLFIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} !CHECK: acc.exit_data dataOperands(%[[DEVPTR]] : !fir.ref>) attributes {async} !CHECK: acc.delete accPtr(%[[DEVPTR]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {name = "a", structured = false} !$acc exit data delete(a) wait -!CHECK: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!FIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!HLFIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} !CHECK: acc.exit_data dataOperands(%[[DEVPTR]] : !fir.ref>) attributes {wait} !CHECK: acc.delete accPtr(%[[DEVPTR]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {name = "a", structured = false} !$acc exit data delete(a) async wait -!CHECK: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!FIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!HLFIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} !CHECK: acc.exit_data dataOperands(%[[DEVPTR]] : !fir.ref>) attributes {async, wait} !CHECK: acc.delete accPtr(%[[DEVPTR]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {name = "a", structured = false} !$acc exit data delete(a) async(1) -!CHECK: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!FIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!HLFIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} !CHECK: %[[ASYNC1:.*]] = arith.constant 1 : i32 !CHECK: acc.exit_data async(%[[ASYNC1]] : i32) dataOperands(%[[DEVPTR]] : !fir.ref>) !CHECK: acc.delete accPtr(%[[DEVPTR]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {name = "a", structured = false} !$acc exit data delete(a) async(async) -!CHECK: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!FIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!HLFIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} !CHECK: %[[ASYNC2:.*]] = fir.load %{{.*}} : !fir.ref !CHECK: acc.exit_data async(%[[ASYNC2]] : i32) dataOperands(%[[DEVPTR]] : !fir.ref>) !CHECK: acc.delete accPtr(%[[DEVPTR]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {name = "a", structured = false} !$acc exit data delete(a) wait(1) -!CHECK: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!FIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!HLFIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} !CHECK: %[[WAIT1:.*]] = arith.constant 1 : i32 !CHECK: acc.exit_data wait(%[[WAIT1]] : i32) dataOperands(%[[DEVPTR]] : !fir.ref>) !CHECK: acc.delete accPtr(%[[DEVPTR]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {name = "a", structured = false} !$acc exit data delete(a) wait(queues: 1, 2) -!CHECK: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!FIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!HLFIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} !CHECK: %[[WAIT2:.*]] = arith.constant 1 : i32 !CHECK: %[[WAIT3:.*]] = arith.constant 2 : i32 !CHECK: acc.exit_data wait(%[[WAIT2]], %[[WAIT3]] : i32, i32) dataOperands(%[[DEVPTR]] : !fir.ref>) !CHECK: acc.delete accPtr(%[[DEVPTR]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {name = "a", structured = false} !$acc exit data delete(a) wait(devnum: 1: queues: 1, 2) -!CHECK: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!FIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +!HLFIR: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} !CHECK: %[[WAIT4:.*]] = arith.constant 1 : i32 !CHECK: %[[WAIT5:.*]] = arith.constant 2 : i32 !CHECK: %[[WAIT6:.*]] = arith.constant 1 : i32 diff --git a/flang/test/Lower/OpenACC/acc-host-data.f90 b/flang/test/Lower/OpenACC/acc-host-data.f90 index 492da53075ae4..9dfabc522753a 100644 --- a/flang/test/Lower/OpenACC/acc-host-data.f90 +++ b/flang/test/Lower/OpenACC/acc-host-data.f90 @@ -1,26 +1,31 @@ ! This test checks lowering of OpenACC host_data directive. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s --check-prefixes=CHECK,FIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR subroutine acc_host_data() real, dimension(10) :: a logical :: ifCondition = .TRUE. ! CHECK: %[[A:.*]] = fir.alloca !fir.array<10xf32> {bindc_name = "a", uniq_name = "_QFacc_host_dataEa"} +! HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] ! CHECK: %[[IFCOND:.*]] = fir.address_of(@_QFacc_host_dataEifcondition) : !fir.ref> +! HLFIR: %[[DECLIFCOND:.*]]:2 = hlfir.declare %[[IFCOND]] !$acc host_data use_device(a) !$acc end host_data ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%{{.*}} : index) startIdx(%{{.*}} : index) -! CHECK: %[[DA:.*]] = acc.use_device varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a"} +! FIR: %[[DA:.*]] = acc.use_device varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a"} +! HLFIR: %[[DA:.*]] = acc.use_device varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a"} ! CHECK: acc.host_data dataOperands(%[[DA]] : !fir.ref>) !$acc host_data use_device(a) if_present !$acc end host_data ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%{{.*}} : index) startIdx(%{{.*}} : index) -! CHECK: %[[DA:.*]] = acc.use_device varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a"} +! FIR: %[[DA:.*]] = acc.use_device varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a"} +! HLFIR: %[[DA:.*]] = acc.use_device varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a"} ! CHECK: acc.host_data dataOperands(%[[DA]] : !fir.ref>) { ! CHECK: } attributes {ifPresent} @@ -28,8 +33,10 @@ subroutine acc_host_data() !$acc end host_data ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%{{.*}} : index) startIdx(%{{.*}} : index) -! CHECK: %[[DA:.*]] = acc.use_device varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a"} -! CHECK: %[[LOAD_IFCOND:.*]] = fir.load %[[IFCOND]] : !fir.ref> +! FIR: %[[DA:.*]] = acc.use_device varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a"} +! HLFIR: %[[DA:.*]] = acc.use_device varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a"} +! FIR: %[[LOAD_IFCOND:.*]] = fir.load %[[IFCOND]] : !fir.ref> +! HLFIR: %[[LOAD_IFCOND:.*]] = fir.load %[[DECLIFCOND]]#0 : !fir.ref> ! CHECK: %[[IFCOND_I1:.*]] = fir.convert %[[LOAD_IFCOND]] : (!fir.logical<4>) -> i1 ! CHECK: acc.host_data if(%[[IFCOND_I1]]) dataOperands(%[[DA]] : !fir.ref>) @@ -37,7 +44,8 @@ subroutine acc_host_data() !$acc end host_data ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%{{.*}} : index) startIdx(%{{.*}} : index) -! CHECK: %[[DA:.*]] = acc.use_device varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a"} +! FIR: %[[DA:.*]] = acc.use_device varPtr(%[[A]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a"} +! HLFIR: %[[DA:.*]] = acc.use_device varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a"} ! CHECK: acc.host_data dataOperands(%[[DA]] : !fir.ref>) !$acc host_data use_device(a) if(.false.) @@ -45,6 +53,7 @@ subroutine acc_host_data() !$acc end host_data ! CHECK-NOT: acc.host_data -! CHECK: fir.do_loop +! FIR: fir.do_loop +! HLFIR: hlfir.assign %{{.*}} to %[[DECLA]]#0 end subroutine diff --git a/flang/test/Lower/OpenACC/acc-init.f90 b/flang/test/Lower/OpenACC/acc-init.f90 index 0e71fd55e3591..9132d41ccbdbd 100644 --- a/flang/test/Lower/OpenACC/acc-init.f90 +++ b/flang/test/Lower/OpenACC/acc-init.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of OpenACC init directive. ! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s subroutine acc_init logical :: ifCondition = .TRUE. diff --git a/flang/test/Lower/OpenACC/acc-kernels-loop.f90 b/flang/test/Lower/OpenACC/acc-kernels-loop.f90 index 05cd5ffe5f692..e708ca65e7c14 100644 --- a/flang/test/Lower/OpenACC/acc-kernels-loop.f90 +++ b/flang/test/Lower/OpenACC/acc-kernels-loop.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of OpenACC kernels loop combined directive. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s --check-prefixes=CHECK,FIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR subroutine acc_kernels_loop integer :: i, j @@ -25,11 +26,17 @@ subroutine acc_kernels_loop integer, parameter :: tileSize = 2 ! CHECK: %[[A:.*]] = fir.alloca !fir.array<10xf32> {{{.*}}uniq_name = "{{.*}}Ea"} +! HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] ! CHECK: %[[B:.*]] = fir.alloca !fir.array<10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[C:.*]] = fir.alloca !fir.array<10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} +! HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] ! CHECK: %[[F:.*]] = fir.alloca !fir.box> {bindc_name = "f", uniq_name = "{{.*}}Ef"} +! HLFIR: %[[DECLF:.*]]:2 = hlfir.declare %[[F]] ! CHECK: %[[G:.*]] = fir.alloca !fir.box> {bindc_name = "g", uniq_name = "{{.*}}Eg"} +! HLFIR: %[[DECLG:.*]]:2 = hlfir.declare %[[G]] ! CHECK: %[[IFCONDITION:.*]] = fir.address_of(@{{.*}}ifcondition) : !fir.ref> +! HLFIR: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] !$acc kernels loop DO i = 1, n @@ -288,7 +295,8 @@ subroutine acc_kernels_loop a(i) = b(i) END DO -! CHECK: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 +! FIR: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 +! HLFIR: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 ! CHECK: acc.kernels self(%[[SELF2]]) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -302,8 +310,10 @@ subroutine acc_kernels_loop a(i) = b(i) END DO -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} ! CHECK: acc.kernels dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -311,16 +321,20 @@ subroutine acc_kernels_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} -! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! FIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! FIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} !$acc kernels loop copy(a) copy(b) DO i = 1, n a(i) = b(i) END DO -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} ! CHECK: acc.kernels dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -328,16 +342,20 @@ subroutine acc_kernels_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} -! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! FIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! FIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} !$acc kernels loop copyin(a) copyin(readonly: b) DO i = 1, n a(i) = b(i) END DO -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} ! CHECK: acc.kernels dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -351,8 +369,10 @@ subroutine acc_kernels_loop a(i) = b(i) END DO -! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} ! CHECK: acc.kernels dataOperands(%[[CREATE_A]], %[[CREATE_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -360,16 +380,20 @@ subroutine acc_kernels_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a"} -! CHECK: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b"} +! FIR: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a"} +! HLFIR: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a"} +! FIR: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b"} +! HLFIR: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {name = "b"} !$acc kernels loop create(b) create(zero: a) DO i = 1, n a(i) = b(i) END DO -! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} -! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} ! CHECK: acc.kernels dataOperands(%[[CREATE_B]], %[[CREATE_A]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -385,8 +409,10 @@ subroutine acc_kernels_loop a(i) = b(i) END DO -! CHECK: %[[NOCREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[NOCREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[NOCREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[NOCREATE_A:.*]] = acc.nocreate varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[NOCREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[NOCREATE_B:.*]] = acc.nocreate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.kernels dataOperands(%[[NOCREATE_A]], %[[NOCREATE_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -400,8 +426,10 @@ subroutine acc_kernels_loop a(i) = b(i) END DO -! CHECK: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[PRESENT_A:.*]] = acc.present varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[PRESENT_B:.*]] = acc.present varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.kernels dataOperands(%[[PRESENT_A]], %[[PRESENT_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -415,8 +443,10 @@ subroutine acc_kernels_loop a(i) = b(i) END DO -! CHECK: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[DEVICEPTR_B:.*]] = acc.deviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[DEVICEPTR_B:.*]] = acc.deviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[DEVICEPTR_B:.*]] = acc.deviceptr varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.kernels dataOperands(%[[DEVICEPTR_A]], %[[DEVICEPTR_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -430,11 +460,13 @@ subroutine acc_kernels_loop a(i) = b(i) END DO -! CHECK: %[[BOX_F:.*]] = fir.load %[[F]] : !fir.ref>> -! CHECK: %[[BOX_ADDR_F:.*]] = fir.box_addr %[[BOX_F]] : (!fir.box>) -> !fir.ptr +! FIR: %[[BOX_F:.*]] = fir.load %[[F]] : !fir.ref>> +! HLFIR: %[[BOX_F:.*]] = fir.load %[[DECLF]]#1 : !fir.ref>> +! CHECK: %[[BOX_ADDR_F:.*]] = fir.box_addr %[[BOX_F]] : (!fir.box>) -> !fir.ptr ! CHECK: %[[ATTACH_F:.*]] = acc.attach varPtr(%[[BOX_ADDR_F]] : !fir.ptr) -> !fir.ptr {name = "f"} -! CHECK: %[[BOX_G:.*]] = fir.load %[[G]] : !fir.ref>> -! CHECK: %[[BOX_ADDR_G:.*]] = fir.box_addr %[[BOX_G]] : (!fir.box>) -> !fir.ptr +! FIR: %[[BOX_G:.*]] = fir.load %[[G]] : !fir.ref>> +! HLFIR: %[[BOX_G:.*]] = fir.load %[[DECLG]]#1 : !fir.ref>> +! CHECK: %[[BOX_ADDR_G:.*]] = fir.box_addr %[[BOX_G]] : (!fir.box>) -> !fir.ptr ! CHECK: %[[ATTACH_G:.*]] = acc.attach varPtr(%[[BOX_ADDR_G]] : !fir.ptr) -> !fir.ptr {name = "g"} ! CHECK: acc.kernels dataOperands(%[[ATTACH_F]], %[[ATTACH_G]] : !fir.ptr, !fir.ptr) { ! CHECK: acc.loop { diff --git a/flang/test/Lower/OpenACC/acc-kernels.f90 b/flang/test/Lower/OpenACC/acc-kernels.f90 index c31a6269610c0..18eb0779031c9 100644 --- a/flang/test/Lower/OpenACC/acc-kernels.f90 +++ b/flang/test/Lower/OpenACC/acc-kernels.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of OpenACC kernels construct. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s --check-prefixes=CHECK,FIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR subroutine acc_kernels integer :: i, j @@ -16,11 +17,17 @@ subroutine acc_kernels real, pointer :: d, e ! CHECK: %[[A:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ea"} +! HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] ! CHECK: %[[B:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[C:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} +! HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] ! CHECK: %[[D:.*]] = fir.alloca !fir.box> {bindc_name = "d", uniq_name = "{{.*}}Ed"} +! HLFIR: %[[DECLD:.*]]:2 = hlfir.declare %[[D]] ! CHECK: %[[E:.*]] = fir.alloca !fir.box> {bindc_name = "e", uniq_name = "{{.*}}Ee"} +! HLFIR: %[[DECLE:.*]]:2 = hlfir.declare %[[E]] ! CHECK: %[[IFCONDITION:.*]] = fir.address_of(@{{.*}}ifcondition) : !fir.ref> +! HLFIR: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] !$acc kernels !$acc end kernels @@ -168,7 +175,8 @@ subroutine acc_kernels !$acc kernels self(ifCondition) !$acc end kernels -! CHECK: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 +! FIR: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 +! HLFIR: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 ! CHECK: acc.kernels self(%[[SELF2]]) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} @@ -176,35 +184,50 @@ subroutine acc_kernels !$acc kernels copy(a, b, c) !$acc end kernels -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -! CHECK: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.kernels dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} -! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} -! CHECK: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +! FIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! FIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} +! FIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLC]]#1 : !fir.ref>) {dataClause = #acc, name = "c"} !$acc kernels copy(a) copy(b) copy(c) !$acc end kernels -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -! CHECK: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.kernels dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} -! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} -! CHECK: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +! FIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! FIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} +! FIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLC]]#1 : !fir.ref>) {dataClause = #acc, name = "c"} !$acc kernels copyin(a) copyin(readonly: b, c) !$acc end kernels -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -! CHECK: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.kernels dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} @@ -212,35 +235,47 @@ subroutine acc_kernels !$acc kernels copyout(a) copyout(zero: b) copyout(c) !$acc end kernels -! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -! CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.kernels dataOperands(%[[CREATE_A]], %[[CREATE_B]], %[[CREATE_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a"} -! CHECK: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b"} -! CHECK: acc.copyout accPtr(%[[CREATE_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {name = "c"} +! FIR: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a"} +! HLFIR: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a"} +! FIR: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b"} +! HLFIR: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {name = "b"} +! FIR: acc.copyout accPtr(%[[CREATE_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {name = "c"} +! HLFIR: acc.copyout accPtr(%[[CREATE_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLC]]#1 : !fir.ref>) {name = "c"} !$acc kernels create(a, b) create(zero: c) !$acc end kernels -! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} -! CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.kernels dataOperands(%[[CREATE_A]], %[[CREATE_B]], %[[CREATE_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} -! CHECK: acc.delete accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "a"} +! CHECK: acc.delete accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "a"} ! CHECK: acc.delete accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "b"} ! CHECK: acc.delete accPtr(%[[CREATE_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "c"} !$acc kernels no_create(a, b) create(zero: c) !$acc end kernels -! CHECK: %[[NO_CREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[NO_CREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} -! CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[NO_CREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[NO_CREATE_A:.*]] = acc.nocreate varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[NO_CREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[NO_CREATE_B:.*]] = acc.nocreate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.kernels dataOperands(%[[NO_CREATE_A]], %[[NO_CREATE_B]], %[[CREATE_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} @@ -248,9 +283,12 @@ subroutine acc_kernels !$acc kernels present(a, b, c) !$acc end kernels -! CHECK: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} -! CHECK: %[[PRESENT_C:.*]] = acc.present varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! FIR: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[PRESENT_A:.*]] = acc.present varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[PRESENT_B:.*]] = acc.present varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[PRESENT_C:.*]] = acc.present varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! HLFIR: %[[PRESENT_C:.*]] = acc.present varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} ! CHECK: acc.kernels dataOperands(%[[PRESENT_A]], %[[PRESENT_B]], %[[PRESENT_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} @@ -258,8 +296,10 @@ subroutine acc_kernels !$acc kernels deviceptr(a) deviceptr(c) !$acc end kernels -! CHECK: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[DEVICEPTR_C:.*]] = acc.deviceptr varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! FIR: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[DEVICEPTR_C:.*]] = acc.deviceptr varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! HLFIR: %[[DEVICEPTR_C:.*]] = acc.deviceptr varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} ! CHECK: acc.kernels dataOperands(%[[DEVICEPTR_A]], %[[DEVICEPTR_C]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} @@ -267,13 +307,15 @@ subroutine acc_kernels !$acc kernels attach(d, e) !$acc end kernels -! CHECK: %[[BOX_D:.*]] = fir.load %[[D]] : !fir.ref>> -! CHECK: %[[BOX_ADDR_D:.*]] = fir.box_addr %[[BOX_D]] : (!fir.box>) -> !fir.ptr -! CHECK: %[[ATTACH_D:.*]] = acc.attach varPtr(%[[BOX_ADDR_D]] : !fir.ptr) -> !fir.ptr {name = "d"} -! CHECK: %[[BOX_E:.*]] = fir.load %[[E]] : !fir.ref>> -! CHECK: %[[BOX_ADDR_E:.*]] = fir.box_addr %[[BOX_E]] : (!fir.box>) -> !fir.ptr -! CHECK: %[[ATTACH_E:.*]] = acc.attach varPtr(%[[BOX_ADDR_E]] : !fir.ptr) -> !fir.ptr {name = "e"} -! CHECK: acc.kernels dataOperands(%[[ATTACH_D]], %[[ATTACH_E]] : !fir.ptr, !fir.ptr) { +! FIR: %[[BOX_D:.*]] = fir.load %[[D]] : !fir.ref>> +! HLFIR: %[[BOX_D:.*]] = fir.load %[[DECLD]]#1 : !fir.ref>> +! CHECK: %[[BOX_ADDR_D:.*]] = fir.box_addr %[[BOX_D]] : (!fir.box>) -> !fir.ptr +! CHECK: %[[ATTACH_D:.*]] = acc.attach varPtr(%[[BOX_ADDR_D]] : !fir.ptr) -> !fir.ptr {name = "d"} +! FIR: %[[BOX_E:.*]] = fir.load %[[E]] : !fir.ref>> +! HLFIR: %[[BOX_E:.*]] = fir.load %[[DECLE]]#1 : !fir.ref>> +! CHECK: %[[BOX_ADDR_E:.*]] = fir.box_addr %[[BOX_E]] : (!fir.box>) -> !fir.ptr +! CHECK: %[[ATTACH_E:.*]] = acc.attach varPtr(%[[BOX_ADDR_E]] : !fir.ptr) -> !fir.ptr {name = "e"} +! CHECK: acc.kernels dataOperands(%[[ATTACH_D]], %[[ATTACH_E]] : !fir.ptr, !fir.ptr) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} diff --git a/flang/test/Lower/OpenACC/acc-loop.f90 b/flang/test/Lower/OpenACC/acc-loop.f90 index eac4fa41af82a..79faafbb5b383 100644 --- a/flang/test/Lower/OpenACC/acc-loop.f90 +++ b/flang/test/Lower/OpenACC/acc-loop.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of OpenACC loop directive. ! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s ! CHECK-LABEL: acc.private.recipe @privatization_ref_10x10xf32 : !fir.ref> init { ! CHECK: ^bb0(%{{.*}}: !fir.ref>): diff --git a/flang/test/Lower/OpenACC/acc-parallel-loop.f90 b/flang/test/Lower/OpenACC/acc-parallel-loop.f90 index 2e65ddbd36db4..4490a460afe96 100644 --- a/flang/test/Lower/OpenACC/acc-parallel-loop.f90 +++ b/flang/test/Lower/OpenACC/acc-parallel-loop.f90 @@ -1,10 +1,11 @@ ! This test checks lowering of OpenACC parallel loop combined directive. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s --check-prefixes=CHECK,FIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR ! CHECK-LABEL: acc.firstprivate.recipe @firstprivatization_ref_10xf32 : !fir.ref> init { ! CHECK: ^bb0(%{{.*}}: !fir.ref>): -! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<10xf32> +! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<10xf32> ! CHECK: acc.yield %[[ALLOCA]] : !fir.ref> ! CHECK: } copy { ! CHECK: ^bb0(%[[SRC:.*]]: !fir.ref>, %[[DST:.*]]: !fir.ref>): @@ -50,11 +51,17 @@ subroutine acc_parallel_loop integer, parameter :: tileSize = 2 ! CHECK: %[[A:.*]] = fir.alloca !fir.array<10xf32> {{{.*}}uniq_name = "{{.*}}Ea"} +! HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] ! CHECK: %[[B:.*]] = fir.alloca !fir.array<10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[C:.*]] = fir.alloca !fir.array<10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} +! HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] ! CHECK: %[[F:.*]] = fir.alloca !fir.box> {bindc_name = "f", uniq_name = "{{.*}}Ef"} +! HLFIR: %[[DECLF:.*]]:2 = hlfir.declare %[[F]] ! CHECK: %[[G:.*]] = fir.alloca !fir.box> {bindc_name = "g", uniq_name = "{{.*}}Eg"} +! HLFIR: %[[DECLG:.*]]:2 = hlfir.declare %[[G]] ! CHECK: %[[IFCONDITION:.*]] = fir.address_of(@{{.*}}ifcondition) : !fir.ref> +! HLFIR: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] !$acc parallel loop DO i = 1, n @@ -313,7 +320,8 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! CHECK: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 +! FIR: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 +! HLFIR: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 ! CHECK: acc.parallel self(%[[SELF2]]) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -327,8 +335,10 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} ! CHECK: acc.parallel dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -336,16 +346,20 @@ subroutine acc_parallel_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} -! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! FIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! FIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} !$acc parallel loop copy(a) copy(b) DO i = 1, n a(i) = b(i) END DO -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} ! CHECK: acc.parallel dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -353,16 +367,20 @@ subroutine acc_parallel_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} -! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! FIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! FIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} !$acc parallel loop copyin(a) copyin(readonly: b) DO i = 1, n a(i) = b(i) END DO -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} ! CHECK: acc.parallel dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -376,8 +394,10 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} ! CHECK: acc.parallel dataOperands(%[[CREATE_A]], %[[CREATE_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -385,16 +405,20 @@ subroutine acc_parallel_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a"} -! CHECK: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b"} +! FIR: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a"} +! HLFIR: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a"} +! FIR: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b"} +! HLFIR: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {name = "b"} !$acc parallel loop create(b) create(zero: a) DO i = 1, n a(i) = b(i) END DO -! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} -! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} ! CHECK: acc.parallel dataOperands(%[[CREATE_B]], %[[CREATE_A]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -410,8 +434,10 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! CHECK: %[[NOCREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[NOCREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[NOCREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[NOCREATE_A:.*]] = acc.nocreate varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[NOCREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[NOCREATE_B:.*]] = acc.nocreate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.parallel dataOperands(%[[NOCREATE_A]], %[[NOCREATE_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -425,8 +451,10 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! CHECK: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[PRESENT_A:.*]] = acc.present varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[PRESENT_B:.*]] = acc.present varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.parallel dataOperands(%[[PRESENT_A]], %[[PRESENT_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -440,8 +468,10 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! CHECK: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[DEVICEPTR_B:.*]] = acc.deviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[DEVICEPTR_B:.*]] = acc.deviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[DEVICEPTR_B:.*]] = acc.deviceptr varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.parallel dataOperands(%[[DEVICEPTR_A]], %[[DEVICEPTR_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -455,11 +485,13 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! CHECK: %[[BOX_F:.*]] = fir.load %[[F]] : !fir.ref>> -! CHECK: %[[BOX_ADDR_F:.*]] = fir.box_addr %[[BOX_F]] : (!fir.box>) -> !fir.ptr +! FIR: %[[BOX_F:.*]] = fir.load %[[F]] : !fir.ref>> +! HLFIR: %[[BOX_F:.*]] = fir.load %[[DECLF]]#1 : !fir.ref>> +! CHECK: %[[BOX_ADDR_F:.*]] = fir.box_addr %[[BOX_F]] : (!fir.box>) -> !fir.ptr ! CHECK: %[[ATTACH_F:.*]] = acc.attach varPtr(%[[BOX_ADDR_F]] : !fir.ptr) -> !fir.ptr {name = "f"} -! CHECK: %[[BOX_G:.*]] = fir.load %[[G]] : !fir.ref>> -! CHECK: %[[BOX_ADDR_G:.*]] = fir.box_addr %[[BOX_G]] : (!fir.box>) -> !fir.ptr +! FIR: %[[BOX_G:.*]] = fir.load %[[G]] : !fir.ref>> +! HLFIR: %[[BOX_G:.*]] = fir.load %[[DECLG]]#1 : !fir.ref>> +! CHECK: %[[BOX_ADDR_G:.*]] = fir.box_addr %[[BOX_G]] : (!fir.box>) -> !fir.ptr ! CHECK: %[[ATTACH_G:.*]] = acc.attach varPtr(%[[BOX_ADDR_G]] : !fir.ptr) -> !fir.ptr {name = "g"} ! CHECK: acc.parallel dataOperands(%[[ATTACH_F]], %[[ATTACH_G]] : !fir.ptr, !fir.ptr) { ! CHECK: acc.loop { @@ -474,10 +506,13 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! CHECK: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[ACC_PRIVATE_B:.*]] = acc.firstprivate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[ACC_PRIVATE_B:.*]] = acc.firstprivate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[ACC_PRIVATE_B:.*]] = acc.firstprivate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.parallel firstprivate(@firstprivatization_ref_10xf32 -> %[[ACC_PRIVATE_B]] : !fir.ref>) private(@privatization_ref_10xf32 -> %[[ACC_PRIVATE_A]] : !fir.ref>) { -! CHECK: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} ! CHECK: acc.loop private(@privatization_ref_10xf32 -> %[[ACC_PRIVATE_A]] : !fir.ref>) { ! CHECK: fir.do_loop ! CHECK: acc.yield diff --git a/flang/test/Lower/OpenACC/acc-parallel.f90 b/flang/test/Lower/OpenACC/acc-parallel.f90 index 67e66097ae6ff..8b59719dc6b93 100644 --- a/flang/test/Lower/OpenACC/acc-parallel.f90 +++ b/flang/test/Lower/OpenACC/acc-parallel.f90 @@ -1,10 +1,11 @@ ! This test checks lowering of OpenACC parallel directive. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s --check-prefixes=CHECK,FIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR ! CHECK-LABEL: acc.firstprivate.recipe @firstprivatization_ref_10x10xf32 : !fir.ref> init { ! CHECK: ^bb0(%{{.*}}: !fir.ref>): -! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<10x10xf32> +! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<10x10xf32> ! CHECK: acc.yield %[[ALLOCA]] : !fir.ref> ! CHECK: } copy { ! CHECK: ^bb0(%arg0: !fir.ref>, %arg1: !fir.ref>): @@ -34,11 +35,17 @@ subroutine acc_parallel real :: reduction_r !CHECK: %[[A:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ea"} +! HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] !CHECK: %[[B:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] !CHECK: %[[C:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} +! HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] !CHECK: %[[D:.*]] = fir.alloca !fir.box> {bindc_name = "d", uniq_name = "{{.*}}Ed"} +! HLFIR: %[[DECLD:.*]]:2 = hlfir.declare %[[D]] !CHECK: %[[E:.*]] = fir.alloca !fir.box> {bindc_name = "e", uniq_name = "{{.*}}Ee"} +! HLFIR: %[[DECLE:.*]]:2 = hlfir.declare %[[E]] !CHECK: %[[IFCONDITION:.*]] = fir.address_of(@{{.*}}ifcondition) : !fir.ref> +! HLFIR: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] !$acc parallel !$acc end parallel @@ -193,7 +200,8 @@ subroutine acc_parallel !$acc parallel self(ifCondition) !$acc end parallel -!CHECK: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 +!FIR: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 +!HLFIR: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 !CHECK: acc.parallel self(%[[SELF2]]) { !CHECK: acc.yield !CHECK-NEXT: }{{$}} @@ -201,35 +209,50 @@ subroutine acc_parallel !$acc parallel copy(a, b, c) !$acc end parallel -!CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -!CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -!CHECK: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +!FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +!HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +!FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +!HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +!FIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +!HLFIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} !CHECK: acc.parallel dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { !CHECK: acc.yield !CHECK-NEXT: }{{$}} -!CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} -!CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} -!CHECK: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +!FIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +!HLFIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +!FIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +!HLFIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} +!FIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +!HLFIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLC]]#1 : !fir.ref>) {dataClause = #acc, name = "c"} !$acc parallel copy(a) copy(b) copy(c) !$acc end parallel -!CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -!CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -!CHECK: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +!FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +!HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +!FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +!HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +!FIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +!HLFIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} !CHECK: acc.parallel dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { !CHECK: acc.yield !CHECK-NEXT: }{{$}} -!CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} -!CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} -!CHECK: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +!FIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +!HLFIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +!FIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +!HLFIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} +!FIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +!HLFIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLC]]#1 : !fir.ref>) {dataClause = #acc, name = "c"} !$acc parallel copyin(a) copyin(readonly: b, c) !$acc end parallel -!CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -!CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -!CHECK: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +!FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +!HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +!FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +!HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +!FIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +!HLFIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} !CHECK: acc.parallel dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { !CHECK: acc.yield !CHECK-NEXT: }{{$}} @@ -237,22 +260,31 @@ subroutine acc_parallel !$acc parallel copyout(a) copyout(zero: b) copyout(c) !$acc end parallel -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -!CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -!CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +!FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +!HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +!FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +!HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} !CHECK: acc.parallel dataOperands(%[[CREATE_A]], %[[CREATE_B]], %[[CREATE_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { !CHECK: acc.yield !CHECK-NEXT: }{{$}} -!CHECK: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a"} -!CHECK: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b"} -!CHECK: acc.copyout accPtr(%[[CREATE_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {name = "c"} +!FIR: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a"} +!HLFIR: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a"} +!FIR: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b"} +!HLFIR: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {name = "b"} +!FIR: acc.copyout accPtr(%[[CREATE_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {name = "c"} +!HLFIR: acc.copyout accPtr(%[[CREATE_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLC]]#1 : !fir.ref>) {name = "c"} !$acc parallel create(a, b) create(zero: c) !$acc end parallel -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -!CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} -!CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +!FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +!HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +!FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +!HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} !CHECK: acc.parallel dataOperands(%[[CREATE_A]], %[[CREATE_B]], %[[CREATE_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { !CHECK: acc.yield !CHECK-NEXT: }{{$}} @@ -262,17 +294,23 @@ subroutine acc_parallel !$acc parallel create(c) copy(b) create(a) !$acc end parallel -!CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} -!CHECK: %[[COPY_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +!FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +!HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +!FIR: %[[COPY_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +!HLFIR: %[[COPY_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +!FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +!HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} !CHECK: acc.parallel dataOperands(%[[CREATE_C]], %[[COPY_B]], %[[CREATE_A]] : !fir.ref>, !fir.ref>, !fir.ref>) { !$acc parallel no_create(a, b) create(zero: c) !$acc end parallel -!CHECK: %[[NO_CREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -!CHECK: %[[NO_CREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} -!CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +!FIR: %[[NO_CREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +!HLFIR: %[[NO_CREATE_A:.*]] = acc.nocreate varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +!FIR: %[[NO_CREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +!HLFIR: %[[NO_CREATE_B:.*]] = acc.nocreate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +!FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +!HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} !CHECK: acc.parallel dataOperands(%[[NO_CREATE_A]], %[[NO_CREATE_B]], %[[CREATE_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { !CHECK: acc.yield !CHECK-NEXT: }{{$}} @@ -282,9 +320,12 @@ subroutine acc_parallel !$acc parallel present(a, b, c) !$acc end parallel -!CHECK: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -!CHECK: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} -!CHECK: %[[PRESENT_C:.*]] = acc.present varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +!FIR: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +!HLFIR: %[[PRESENT_A:.*]] = acc.present varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +!FIR: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +!HLFIR: %[[PRESENT_B:.*]] = acc.present varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +!FIR: %[[PRESENT_C:.*]] = acc.present varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +!HLFIR: %[[PRESENT_C:.*]] = acc.present varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} !CHECK: acc.parallel dataOperands(%[[PRESENT_A]], %[[PRESENT_B]], %[[PRESENT_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { !CHECK: acc.yield !CHECK-NEXT: }{{$}} @@ -292,8 +333,10 @@ subroutine acc_parallel !$acc parallel deviceptr(a) deviceptr(c) !$acc end parallel -!CHECK: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -!CHECK: %[[DEVICEPTR_C:.*]] = acc.deviceptr varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +!FIR: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +!HLFIR: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +!FIR: %[[DEVICEPTR_C:.*]] = acc.deviceptr varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +!HLFIR: %[[DEVICEPTR_C:.*]] = acc.deviceptr varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} !CHECK: acc.parallel dataOperands(%[[DEVICEPTR_A]], %[[DEVICEPTR_C]] : !fir.ref>, !fir.ref>) { !CHECK: acc.yield !CHECK-NEXT: }{{$}} @@ -301,13 +344,15 @@ subroutine acc_parallel !$acc parallel attach(d, e) !$acc end parallel -!CHECK: %[[BOX_D:.*]] = fir.load %[[D]] : !fir.ref>> -!CHECK: %[[BOX_ADDR_D:.*]] = fir.box_addr %[[BOX_D]] : (!fir.box>) -> !fir.ptr -!CHECK: %[[ATTACH_D:.*]] = acc.attach varPtr(%[[BOX_ADDR_D]] : !fir.ptr) -> !fir.ptr {name = "d"} -!CHECK: %[[BOX_E:.*]] = fir.load %[[E]] : !fir.ref>> -!CHECK: %[[BOX_ADDR_E:.*]] = fir.box_addr %[[BOX_E]] : (!fir.box>) -> !fir.ptr -!CHECK: %[[ATTACH_E:.*]] = acc.attach varPtr(%[[BOX_ADDR_E]] : !fir.ptr) -> !fir.ptr {name = "e"} -!CHECK: acc.parallel dataOperands(%[[ATTACH_D]], %[[ATTACH_E]] : !fir.ptr, !fir.ptr) { +!FIR: %[[BOX_D:.*]] = fir.load %[[D]] : !fir.ref>> +!HLFIR: %[[BOX_D:.*]] = fir.load %[[DECLD]]#1 : !fir.ref>> +!CHECK: %[[BOX_ADDR_D:.*]] = fir.box_addr %[[BOX_D]] : (!fir.box>) -> !fir.ptr +!CHECK: %[[ATTACH_D:.*]] = acc.attach varPtr(%[[BOX_ADDR_D]] : !fir.ptr) -> !fir.ptr {name = "d"} +!FIR: %[[BOX_E:.*]] = fir.load %[[E]] : !fir.ref>> +!HLFIR: %[[BOX_E:.*]] = fir.load %[[DECLE]]#1 : !fir.ref>> +!CHECK: %[[BOX_ADDR_E:.*]] = fir.box_addr %[[BOX_E]] : (!fir.box>) -> !fir.ptr +!CHECK: %[[ATTACH_E:.*]] = acc.attach varPtr(%[[BOX_ADDR_E]] : !fir.ptr) -> !fir.ptr {name = "e"} +!CHECK: acc.parallel dataOperands(%[[ATTACH_D]], %[[ATTACH_E]] : !fir.ptr, !fir.ptr) { !CHECK: acc.yield !CHECK-NEXT: }{{$}} !CHECK: acc.detach accPtr(%[[ATTACH_D]] : !fir.ptr) {dataClause = #acc, name = "d"} @@ -316,9 +361,12 @@ subroutine acc_parallel !$acc parallel private(a) firstprivate(b) private(c) !$acc end parallel -! CHECK: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[ACC_FPRIVATE_B:.*]] = acc.firstprivate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} -! CHECK: %[[ACC_PRIVATE_C:.*]] = acc.private varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! FIR: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[ACC_FPRIVATE_B:.*]] = acc.firstprivate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[ACC_FPRIVATE_B:.*]] = acc.firstprivate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[ACC_PRIVATE_C:.*]] = acc.private varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! HLFIR: %[[ACC_PRIVATE_C:.*]] = acc.private varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} ! CHECK: acc.parallel firstprivate(@firstprivatization_ref_10x10xf32 -> %[[ACC_FPRIVATE_B]] : !fir.ref>) private(@privatization_ref_10x10xf32 -> %[[ACC_PRIVATE_A]] : !fir.ref>, @privatization_ref_10x10xf32 -> %[[ACC_PRIVATE_C]] : !fir.ref>) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} diff --git a/flang/test/Lower/OpenACC/acc-private.f90 b/flang/test/Lower/OpenACC/acc-private.f90 index c8709c826e024..0ec15710aaa80 100644 --- a/flang/test/Lower/OpenACC/acc-private.f90 +++ b/flang/test/Lower/OpenACC/acc-private.f90 @@ -1,10 +1,13 @@ ! This test checks lowering of OpenACC loop directive. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s --check-prefixes=CHECK,FIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR ! CHECK-LABEL: acc.firstprivate.recipe @firstprivatization_ref_50xf32 : !fir.ref> init { ! CHECK: ^bb0(%{{.*}}: !fir.ref>): ! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<50xf32> +! FIXME: we need hlfir.declare here to satisfy the assumptions about +! the HLFIR lowering, i.e. that every varible has fir/hlfir.declare. ! CHECK: acc.yield %[[ALLOCA]] : !fir.ref> ! CHECK: } copy { ! CHECK: ^bb0(%[[SRC:.*]]: !fir.ref>, %[[DST:.*]]: !fir.ref>): @@ -73,7 +76,9 @@ program acc_private real, dimension(n) :: a, b ! CHECK: %[[B:.*]] = fir.address_of(@_QFEb) : !fir.ref> +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[C:.*]] = fir.alloca i32 {bindc_name = "c", uniq_name = "_QFEc"} +! HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] !$acc loop private(c) DO i = 1, n @@ -81,7 +86,8 @@ program acc_private a(i) = b(i) + c END DO -! CHECK: %[[C_PRIVATE:.*]] = acc.private varPtr(%[[C]] : !fir.ref) -> !fir.ref {name = "c"} +! FIR: %[[C_PRIVATE:.*]] = acc.private varPtr(%[[C]] : !fir.ref) -> !fir.ref {name = "c"} +! HLFIR: %[[C_PRIVATE:.*]] = acc.private varPtr(%[[DECLC]]#1 : !fir.ref) -> !fir.ref {name = "c"} ! CHECK: acc.loop private(@privatization_ref_i32 -> %[[C_PRIVATE]] : !fir.ref) ! CHECK: acc.yield @@ -95,7 +101,8 @@ program acc_private ! CHECK: %[[LB:.*]] = arith.constant 0 : index ! CHECK: %[[UB:.*]] = arith.subi %{{.*}}, %[[C1]] : index ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) extent(%{{.*}} : index) stride(%[[C1]] : index) startIdx(%[[C1]] : index) -! CHECK: %[[B_PRIVATE:.*]] = acc.private varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b"} +! FIR: %[[B_PRIVATE:.*]] = acc.private varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b"} +! HLFIR: %[[B_PRIVATE:.*]] = acc.private varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b"} ! CHECK: acc.loop private(@privatization_ref_100xf32 -> %[[B_PRIVATE]] : !fir.ref>) { ! CHECK: acc.yield @@ -109,7 +116,8 @@ program acc_private ! CHECK: %[[LB:.*]] = arith.constant 0 : index ! CHECK: %[[UB:.*]] = arith.constant 49 : index ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[C1]] : index) startIdx(%[[C1]] : index) -! CHECK: %[[B_PRIVATE:.*]] = acc.private varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b(1:50)"} +! FIR: %[[B_PRIVATE:.*]] = acc.private varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b(1:50)"} +! HLFIR: %[[B_PRIVATE:.*]] = acc.private varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b(1:50)"} ! CHECK: acc.loop private(@privatization_ref_50xf32 -> %[[B_PRIVATE]] : !fir.ref>) !$acc parallel loop firstprivate(c) @@ -117,8 +125,9 @@ program acc_private c = i a(i) = b(i) + c END DO - -! CHECK: %[[FP_C:.*]] = acc.firstprivate varPtr(%[[C]] : !fir.ref) -> !fir.ref {name = "c"} + +! FIR: %[[FP_C:.*]] = acc.firstprivate varPtr(%[[C]] : !fir.ref) -> !fir.ref {name = "c"} +! HLFIR: %[[FP_C:.*]] = acc.firstprivate varPtr(%[[DECLC]]#1 : !fir.ref) -> !fir.ref {name = "c"} ! CHECK: acc.parallel firstprivate(@firstprivatization_ref_i32 -> %[[FP_C]] : !fir.ref) ! CHECK: acc.yield @@ -132,7 +141,8 @@ program acc_private ! CHECK: %[[LB:.*]] = arith.constant 0 : index ! CHECK: %[[UB:.*]] = arith.subi %{{.*}}, %[[C1]] : index ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) extent(%{{.*}} : index) stride(%[[C1]] : index) startIdx(%[[C1]] : index) -! CHECK: %[[FP_B:.*]] = acc.firstprivate varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b"} +! FIR: %[[FP_B:.*]] = acc.firstprivate varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b"} +! HLFIR: %[[FP_B:.*]] = acc.firstprivate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b"} ! CHECK: acc.parallel firstprivate(@firstprivatization_ref_100xf32 -> %[[FP_B]] : !fir.ref>) ! CHECK: acc.yield @@ -146,7 +156,8 @@ program acc_private ! CHECK: %[[LB:.*]] = arith.constant 50 : index ! CHECK: %[[UB:.*]] = arith.constant 99 : index ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[C1]] : index) startIdx(%[[C1]] : index) -! CHECK: %[[FP_B:.*]] = acc.firstprivate varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b(51:100)"} +! FIR: %[[FP_B:.*]] = acc.firstprivate varPtr(%[[B]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b(51:100)"} +! HLFIR: %[[FP_B:.*]] = acc.firstprivate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "b(51:100)"} ! CHECK: acc.parallel firstprivate(@firstprivatization_ref_50xf32 -> %[[FP_B]] : !fir.ref>) end program diff --git a/flang/test/Lower/OpenACC/acc-reduction.f90 b/flang/test/Lower/OpenACC/acc-reduction.f90 index 068b52636c019..d33199f9e4068 100644 --- a/flang/test/Lower/OpenACC/acc-reduction.f90 +++ b/flang/test/Lower/OpenACC/acc-reduction.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of OpenACC reduction clause. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s --check-prefixes=CHECK,FIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR ! CHECK-LABEL: acc.reduction.recipe @reduction_mul_ref_z32 : !fir.ref> reduction_operator init { ! CHECK: ^bb0(%{{.*}}: !fir.ref>): @@ -522,7 +523,9 @@ subroutine acc_reduction_add_int(a, b) ! CHECK-LABEL: func.func @_QPacc_reduction_add_int( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) -! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! FIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#1 : !fir.ref) -> !fir.ref {name = "b"} ! CHECK: acc.loop reduction(@reduction_add_ref_i32 -> %[[RED_B]] : !fir.ref) subroutine acc_reduction_add_int_array_1d(a, b) @@ -537,7 +540,9 @@ subroutine acc_reduction_add_int_array_1d(a, b) ! 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: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! FIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.loop reduction(@reduction_add_ref_100xi32 -> %[[RED_B]] : !fir.ref>) subroutine acc_reduction_add_int_array_2d(a, b) @@ -554,7 +559,9 @@ subroutine acc_reduction_add_int_array_2d(a, b) ! 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: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[DECLARG1:.*]]:2 = hlfir.declare %[[ARG1]] +! FIR: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[DECLARG1]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.loop reduction(@reduction_add_ref_100x10xi32 -> %[[RED_ARG1]] : !fir.ref>) { ! CHECK: } attributes {collapse = 2 : i64} @@ -574,7 +581,9 @@ subroutine acc_reduction_add_int_array_3d(a, b) ! 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: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[DECLARG1:.*]]:2 = hlfir.declare %[[ARG1]] +! FIR: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[DECLARG1]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.loop reduction(@reduction_add_ref_100x10x2xi32 -> %[[RED_ARG1]] : !fir.ref>) ! CHECK: } attributes {collapse = 3 : i64} @@ -590,7 +599,9 @@ subroutine acc_reduction_add_float(a, b) ! CHECK-LABEL: func.func @_QPacc_reduction_add_float( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) -! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! FIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#1 : !fir.ref) -> !fir.ref {name = "b"} ! CHECK: acc.loop reduction(@reduction_add_ref_f32 -> %[[RED_B]] : !fir.ref) subroutine acc_reduction_add_float_array_1d(a, b) @@ -605,7 +616,9 @@ subroutine acc_reduction_add_float_array_1d(a, b) ! 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: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! FIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.loop reduction(@reduction_add_ref_100xf32 -> %[[RED_B]] : !fir.ref>) subroutine acc_reduction_mul_int(a, b) @@ -620,7 +633,9 @@ subroutine acc_reduction_mul_int(a, b) ! CHECK-LABEL: func.func @_QPacc_reduction_mul_int( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) -! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! FIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#1 : !fir.ref) -> !fir.ref {name = "b"} ! CHECK: acc.loop reduction(@reduction_mul_ref_i32 -> %[[RED_B]] : !fir.ref) subroutine acc_reduction_mul_int_array_1d(a, b) @@ -635,7 +650,9 @@ subroutine acc_reduction_mul_int_array_1d(a, b) ! 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: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! FIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.loop reduction(@reduction_mul_ref_100xi32 -> %[[RED_B]] : !fir.ref>) subroutine acc_reduction_mul_float(a, b) @@ -650,7 +667,9 @@ subroutine acc_reduction_mul_float(a, b) ! CHECK-LABEL: func.func @_QPacc_reduction_mul_float( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) -! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! FIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#1 : !fir.ref) -> !fir.ref {name = "b"} ! CHECK: acc.loop reduction(@reduction_mul_ref_f32 -> %[[RED_B]] : !fir.ref) subroutine acc_reduction_mul_float_array_1d(a, b) @@ -665,7 +684,9 @@ subroutine acc_reduction_mul_float_array_1d(a, b) ! 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: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref>) bounds(%2) -> !fir.ref> {name = "b"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! FIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref>) bounds(%2) -> !fir.ref> {name = "b"} +! HLFIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.loop reduction(@reduction_mul_ref_100xf32 -> %[[RED_B]] : !fir.ref>) subroutine acc_reduction_min_int(a, b) @@ -680,7 +701,9 @@ subroutine acc_reduction_min_int(a, b) ! CHECK-LABEL: func.func @_QPacc_reduction_min_int( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) -! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! FIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#1 : !fir.ref) -> !fir.ref {name = "b"} ! CHECK: acc.loop reduction(@reduction_min_ref_i32 -> %[[RED_B]] : !fir.ref) subroutine acc_reduction_min_int_array_1d(a, b) @@ -695,7 +718,9 @@ subroutine acc_reduction_min_int_array_1d(a, b) ! 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: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref>) bounds(%2) -> !fir.ref> {name = "b"} +! HLFIR: %[[DECLARG1:.*]]:2 = hlfir.declare %[[ARG1]] +! FIR: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref>) bounds(%2) -> !fir.ref> {name = "b"} +! HLFIR: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[DECLARG1]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.loop reduction(@reduction_min_ref_100xi32 -> %[[RED_ARG1]] : !fir.ref>) subroutine acc_reduction_min_float(a, b) @@ -710,7 +735,9 @@ subroutine acc_reduction_min_float(a, b) ! CHECK-LABEL: func.func @_QPacc_reduction_min_float( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) -! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! FIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#1 : !fir.ref) -> !fir.ref {name = "b"} ! CHECK: acc.loop reduction(@reduction_min_ref_f32 -> %[[RED_B]] : !fir.ref) subroutine acc_reduction_min_float_array2d(a, b) @@ -727,7 +754,9 @@ subroutine acc_reduction_min_float_array2d(a, b) ! 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: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref>) bounds(%3, %5) -> !fir.ref> {name = "b"} +! HLFIR: %[[DECLARG1:.*]]:2 = hlfir.declare %[[ARG1]] +! FIR: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref>) bounds(%3, %5) -> !fir.ref> {name = "b"} +! HLFIR: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[DECLARG1]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.loop reduction(@reduction_min_ref_100x10xf32 -> %[[RED_ARG1]] : !fir.ref>) ! CHECK: attributes {collapse = 2 : i64} @@ -743,7 +772,9 @@ subroutine acc_reduction_max_int(a, b) ! CHECK-LABEL: func.func @_QPacc_reduction_max_int( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) -! CHECL: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! FIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#1 : !fir.ref) -> !fir.ref {name = "b"} ! CHECK: acc.loop reduction(@reduction_max_ref_i32 -> %[[RED_B]] : !fir.ref) subroutine acc_reduction_max_int_array2d(a, b) @@ -760,7 +791,9 @@ subroutine acc_reduction_max_int_array2d(a, b) ! 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: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[DECLARG1:.*]]:2 = hlfir.declare %[[ARG1]] +! FIR: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[DECLARG1]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.loop reduction(@reduction_max_ref_100x10xi32 -> %[[RED_ARG1]] : !fir.ref>) subroutine acc_reduction_max_float(a, b) @@ -775,7 +808,9 @@ subroutine acc_reduction_max_float(a, b) ! CHECK-LABEL: func.func @_QPacc_reduction_max_float( ! CHECK-SAME: %{{.*}}: !fir.ref> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref {fir.bindc_name = "b"}) -! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! FIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref) -> !fir.ref {name = "b"} +! HLFIR: %[[RED_B:.*]] = acc.reduction varPtr(%[[DECLB]]#1 : !fir.ref) -> !fir.ref {name = "b"} ! CHECK: acc.loop reduction(@reduction_max_ref_f32 -> %[[RED_B]] : !fir.ref) subroutine acc_reduction_max_float_array1d(a, b) @@ -790,7 +825,9 @@ subroutine acc_reduction_max_float_array1d(a, b) ! 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: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[DECLARG1:.*]]:2 = hlfir.declare %[[ARG1]] +! FIR: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[DECLARG1]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.loop reduction(@reduction_max_ref_100xf32 -> %[[RED_ARG1]] : !fir.ref>) { subroutine acc_reduction_iand() @@ -830,7 +867,10 @@ subroutine acc_reduction_and() end subroutine ! CHECK-LABEL: func.func @_QPacc_reduction_and() -! CHECK: %[[RED:.*]] = acc.reduction varPtr(%0 : !fir.ref>) -> !fir.ref> {name = "l"} +! CHECK: %[[L:.*]] = fir.alloca !fir.logical<4> {bindc_name = "l", uniq_name = "_QFacc_reduction_andEl"} +! HLFIR: %[[DECLL:.*]]:2 = hlfir.declare %[[L]] +! FIR: %[[RED:.*]] = acc.reduction varPtr(%[[L]] : !fir.ref>) -> !fir.ref> {name = "l"} +! HLFIR: %[[RED:.*]] = acc.reduction varPtr(%[[DECLL]]#1 : !fir.ref>) -> !fir.ref> {name = "l"} ! CHECK: acc.parallel reduction(@reduction_land_ref_l32 -> %[[RED]] : !fir.ref>) subroutine acc_reduction_or() @@ -892,7 +932,9 @@ subroutine acc_reduction_add_alloc() ! CHECK-LABEL: func.func @_QPacc_reduction_add_alloc() ! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.box> {bindc_name = "i", uniq_name = "_QFacc_reduction_add_allocEi"} -! CHECK: %[[LOAD:.*]] = fir.load %[[ALLOCA]] : !fir.ref>> +! HLFIR: %[[DECL:.*]]:2 = hlfir.declare %[[ALLOCA]] +! FIR: %[[LOAD:.*]] = fir.load %[[ALLOCA]] : !fir.ref>> +! HLFIR: %[[LOAD:.*]] = fir.load %[[DECL]]#1 : !fir.ref>> ! CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[LOAD]] : (!fir.box>) -> !fir.heap ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%[[BOX_ADDR]] : !fir.heap) -> !fir.heap {name = "i"} ! CHECK: acc.parallel reduction(@reduction_add_heap_i32 -> %[[RED]] : !fir.heap) @@ -905,7 +947,9 @@ subroutine acc_reduction_add_pointer(i) ! CHECK-LABEL: func.func @_QPacc_reduction_add_pointer( ! CHECK-SAME: %[[ARG0:.*]]: !fir.ref>> {fir.bindc_name = "i"}) -! CHECK: %[[LOAD:.*]] = fir.load %[[ARG0]] : !fir.ref>> +! HLFIR: %[[DECLARG0:.*]]:2 = hlfir.declare %[[ARG0]] +! FIR: %[[LOAD:.*]] = fir.load %[[ARG0]] : !fir.ref>> +! HLFIR: %[[LOAD:.*]] = fir.load %[[DECLARG0]]#1 : !fir.ref>> ! CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[LOAD]] : (!fir.box>) -> !fir.ptr ! CHECK: %[[RED:.*]] = acc.reduction varPtr(%[[BOX_ADDR]] : !fir.ptr) -> !fir.ptr {name = "i"} ! CHECK: acc.parallel reduction(@reduction_add_ptr_i32 -> %[[RED]] : !fir.ptr) @@ -918,9 +962,11 @@ subroutine acc_reduction_add_static_slice(a) ! CHECK-LABEL: func.func @_QPacc_reduction_add_static_slice( ! CHECK-SAME: %[[ARG0:.*]]: !fir.ref> {fir.bindc_name = "a"}) +! HLFIR: %[[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) stride(%[[C1]] : index) startIdx(%[[C1]] : index) -! CHECK: %[[RED:.*]] = acc.reduction varPtr(%[[ARG0]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(11:20)"} +! FIR: %[[RED:.*]] = acc.reduction varPtr(%[[ARG0]] : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(11:20)"} +! HLFIR: %[[RED:.*]] = acc.reduction varPtr(%[[DECLARG0]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a(11:20)"} ! CHECK: acc.parallel reduction(@reduction_add_ref_100xi32 -> %[[RED]] : !fir.ref>) diff --git a/flang/test/Lower/OpenACC/acc-routine-named.f90 b/flang/test/Lower/OpenACC/acc-routine-named.f90 index bc05cc56ce45a..3bafbc441c34c 100644 --- a/flang/test/Lower/OpenACC/acc-routine-named.f90 +++ b/flang/test/Lower/OpenACC/acc-routine-named.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of OpenACC routine directive. ! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s module acc_routines diff --git a/flang/test/Lower/OpenACC/acc-routine.f90 b/flang/test/Lower/OpenACC/acc-routine.f90 index 9736c48fcb739..f9fc9b1a0b4b7 100644 --- a/flang/test/Lower/OpenACC/acc-routine.f90 +++ b/flang/test/Lower/OpenACC/acc-routine.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of OpenACC routine directive. ! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s ! CHECK: acc.routine @acc_routine_9 func(@_QPacc_routine10) seq ! CHECK: acc.routine @acc_routine_8 func(@_QPacc_routine9) bind("_QPacc_routine9a") diff --git a/flang/test/Lower/OpenACC/acc-serial-loop.f90 b/flang/test/Lower/OpenACC/acc-serial-loop.f90 index a3fe901a73ce4..662a34d42d7c3 100644 --- a/flang/test/Lower/OpenACC/acc-serial-loop.f90 +++ b/flang/test/Lower/OpenACC/acc-serial-loop.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of Openacc serial loop combined directive. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s --check-prefixes=CHECK,FIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR ! CHECK-LABEL: acc.firstprivate.recipe @firstprivatization_ref_10xf32 : !fir.ref> init { ! CHECK: ^bb0(%{{.*}}: !fir.ref>): @@ -41,11 +42,17 @@ subroutine acc_serial_loop integer, parameter :: tileSize = 2 ! CHECK: %[[A:.*]] = fir.alloca !fir.array<10xf32> {{{.*}}uniq_name = "{{.*}}Ea"} +! HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] ! CHECK: %[[B:.*]] = fir.alloca !fir.array<10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[C:.*]] = fir.alloca !fir.array<10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} +! HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] ! CHECK: %[[F:.*]] = fir.alloca !fir.box> {bindc_name = "f", uniq_name = "{{.*}}Ef"} +! HLFIR: %[[DECLF:.*]]:2 = hlfir.declare %[[F]] ! CHECK: %[[G:.*]] = fir.alloca !fir.box> {bindc_name = "g", uniq_name = "{{.*}}Eg"} +! HLFIR: %[[DECLG:.*]]:2 = hlfir.declare %[[G]] ! CHECK: %[[IFCONDITION:.*]] = fir.address_of(@{{.*}}ifcondition) : !fir.ref> +! HLFIR: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] !$acc serial loop DO i = 1, n @@ -220,7 +227,8 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! CHECK: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 +! FIR: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 +! HLFIR: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 ! CHECK: acc.serial self(%[[SELF2]]) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -234,8 +242,10 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} ! CHECK: acc.serial dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -243,16 +253,20 @@ subroutine acc_serial_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} -! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! FIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! FIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} !$acc serial loop copy(a) copy(b) DO i = 1, n a(i) = b(i) END DO -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} ! CHECK: acc.serial dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -260,16 +274,20 @@ subroutine acc_serial_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} -! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! FIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! FIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} !$acc serial loop copyin(a) copyin(readonly: b) DO i = 1, n a(i) = b(i) END DO -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} ! CHECK: acc.serial dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -283,8 +301,10 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} ! CHECK: acc.serial dataOperands(%[[CREATE_A]], %[[CREATE_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -292,16 +312,20 @@ subroutine acc_serial_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a"} -! CHECK: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b"} +! FIR: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a"} +! HLFIR: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a"} +! FIR: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b"} +! HLFIR: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {name = "b"} !$acc serial loop create(b) create(zero: a) DO i = 1, n a(i) = b(i) END DO -! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} -! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} ! CHECK: acc.serial dataOperands(%[[CREATE_B]], %[[CREATE_A]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -317,8 +341,10 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! CHECK: %[[NOCREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[NOCREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[NOCREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[NOCREATE_A:.*]] = acc.nocreate varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[NOCREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[NOCREATE_B:.*]] = acc.nocreate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.serial dataOperands(%[[NOCREATE_A]], %[[NOCREATE_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -332,8 +358,10 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! CHECK: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[PRESENT_A:.*]] = acc.present varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[PRESENT_B:.*]] = acc.present varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.serial dataOperands(%[[PRESENT_A]], %[[PRESENT_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -347,8 +375,10 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! CHECK: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[DEVICEPTR_B:.*]] = acc.deviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[DEVICEPTR_B:.*]] = acc.deviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[DEVICEPTR_B:.*]] = acc.deviceptr varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.serial dataOperands(%[[DEVICEPTR_A]], %[[DEVICEPTR_B]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -362,11 +392,13 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! CHECK: %[[BOX_F:.*]] = fir.load %[[F]] : !fir.ref>> -! CHECK: %[[BOX_ADDR_F:.*]] = fir.box_addr %[[BOX_F]] : (!fir.box>) -> !fir.ptr +! FIR: %[[BOX_F:.*]] = fir.load %[[F]] : !fir.ref>> +! HLFIR: %[[BOX_F:.*]] = fir.load %[[DECLF]]#1 : !fir.ref>> +! CHECK: %[[BOX_ADDR_F:.*]] = fir.box_addr %[[BOX_F]] : (!fir.box>) -> !fir.ptr ! CHECK: %[[ATTACH_F:.*]] = acc.attach varPtr(%[[BOX_ADDR_F]] : !fir.ptr) -> !fir.ptr {name = "f"} -! CHECK: %[[BOX_G:.*]] = fir.load %[[G]] : !fir.ref>> -! CHECK: %[[BOX_ADDR_G:.*]] = fir.box_addr %[[BOX_G]] : (!fir.box>) -> !fir.ptr +! FIR: %[[BOX_G:.*]] = fir.load %[[G]] : !fir.ref>> +! HLFIR: %[[BOX_G:.*]] = fir.load %[[DECLG]]#1 : !fir.ref>> +! CHECK: %[[BOX_ADDR_G:.*]] = fir.box_addr %[[BOX_G]] : (!fir.box>) -> !fir.ptr ! CHECK: %[[ATTACH_G:.*]] = acc.attach varPtr(%[[BOX_ADDR_G]] : !fir.ptr) -> !fir.ptr {name = "g"} ! CHECK: acc.serial dataOperands(%[[ATTACH_F]], %[[ATTACH_G]] : !fir.ptr, !fir.ptr) { ! CHECK: acc.loop { @@ -381,10 +413,13 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! CHECK: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[ACC_FPRIVATE_B:.*]] = acc.firstprivate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[ACC_FPRIVATE_B:.*]] = acc.firstprivate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[ACC_FPRIVATE_B:.*]] = acc.firstprivate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.serial firstprivate(@firstprivatization_ref_10xf32 -> %[[ACC_FPRIVATE_B]] : !fir.ref>) private(@privatization_ref_10xf32 -> %[[ACC_PRIVATE_A]] : !fir.ref>) { -! CHECK: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} ! CHECK: acc.loop private(@privatization_ref_10xf32 -> %[[ACC_PRIVATE_A]] : !fir.ref>) { ! CHECK: fir.do_loop ! CHECK: acc.yield diff --git a/flang/test/Lower/OpenACC/acc-serial.f90 b/flang/test/Lower/OpenACC/acc-serial.f90 index 7589f659d14b4..0c0a4012f5fab 100644 --- a/flang/test/Lower/OpenACC/acc-serial.f90 +++ b/flang/test/Lower/OpenACC/acc-serial.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of OpenACC serial directive. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s --check-prefixes=CHECK,FIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR ! CHECK-LABEL: acc.firstprivate.recipe @firstprivatization_ref_10x10xf32 : !fir.ref> init { ! CHECK: ^bb0(%{{.*}}: !fir.ref>): @@ -34,11 +35,17 @@ subroutine acc_serial real :: reduction_r ! CHECK: %[[A:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ea"} +! HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] ! CHECK: %[[B:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[C:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} +! HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] ! CHECK: %[[D:.*]] = fir.alloca !fir.box> {bindc_name = "d", uniq_name = "{{.*}}Ed"} +! HLFIR: %[[DECLD:.*]]:2 = hlfir.declare %[[D]] ! CHECK: %[[E:.*]] = fir.alloca !fir.box> {bindc_name = "e", uniq_name = "{{.*}}Ee"} +! HLFIR: %[[DECLE:.*]]:2 = hlfir.declare %[[E]] ! CHECK: %[[IFCONDITION:.*]] = fir.address_of(@{{.*}}ifcondition) : !fir.ref> +! HLFIR: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] !$acc serial !$acc end serial @@ -138,7 +145,8 @@ subroutine acc_serial !$acc serial self(ifCondition) !$acc end serial -! CHECK: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 +! FIR: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 +! HLFIR: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 ! CHECK: acc.serial self(%[[SELF2]]) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} @@ -146,35 +154,50 @@ subroutine acc_serial !$acc serial copy(a, b, c) !$acc end serial -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -! CHECK: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.serial dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} -! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} -! CHECK: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +! FIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! FIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} +! FIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLC]]#1 : !fir.ref>) {dataClause = #acc, name = "c"} !$acc serial copy(a) copy(b) copy(c) !$acc end serial -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -! CHECK: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.serial dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} -! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} -! CHECK: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +! FIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! FIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {dataClause = #acc, name = "b"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} +! FIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {dataClause = #acc, name = "c"} +! HLFIR: acc.copyout accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLC]]#1 : !fir.ref>) {dataClause = #acc, name = "c"} !$acc serial copyin(a) copyin(readonly: b, c) !$acc end serial -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -! CHECK: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[COPYIN_C:.*]] = acc.copyin varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.serial dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} @@ -182,22 +205,31 @@ subroutine acc_serial !$acc serial copyout(a) copyout(zero: b) copyout(c) !$acc end serial -! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} -! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} -! CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.serial dataOperands(%[[CREATE_A]], %[[CREATE_B]], %[[CREATE_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} -! CHECK: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a"} -! CHECK: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b"} -! CHECK: acc.copyout accPtr(%[[CREATE_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {name = "c"} +! FIR: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a"} +! HLFIR: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a"} +! FIR: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b"} +! HLFIR: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {name = "b"} +! FIR: acc.copyout accPtr(%[[CREATE_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {name = "c"} +! HLFIR: acc.copyout accPtr(%[[CREATE_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLC]]#1 : !fir.ref>) {name = "c"} !$acc serial create(a, b) create(zero: c) !$acc end serial -! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} -! CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.serial dataOperands(%[[CREATE_A]], %[[CREATE_B]], %[[CREATE_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} @@ -208,9 +240,12 @@ subroutine acc_serial !$acc serial no_create(a, b) create(zero: c) !$acc end serial -! CHECK: %[[NO_CREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[NO_CREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} -! CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! FIR: %[[NO_CREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[NO_CREATE_A:.*]] = acc.nocreate varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[NO_CREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[NO_CREATE_B:.*]] = acc.nocreate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} +! HLFIR: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c"} ! CHECK: acc.serial dataOperands(%[[NO_CREATE_A]], %[[NO_CREATE_B]], %[[CREATE_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} @@ -218,9 +253,12 @@ subroutine acc_serial !$acc serial present(a, b, c) !$acc end serial -! CHECK: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} -! CHECK: %[[PRESENT_C:.*]] = acc.present varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! FIR: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[PRESENT_A:.*]] = acc.present varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[PRESENT_B:.*]] = acc.present varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[PRESENT_C:.*]] = acc.present varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! HLFIR: %[[PRESENT_C:.*]] = acc.present varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} ! CHECK: acc.serial dataOperands(%[[PRESENT_A]], %[[PRESENT_B]], %[[PRESENT_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} @@ -228,22 +266,26 @@ subroutine acc_serial !$acc serial deviceptr(a) deviceptr(c) !$acc end serial -! CHECK: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[DEVICEPTR_C:.*]] = acc.deviceptr varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! FIR: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[DEVICEPTR_C:.*]] = acc.deviceptr varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! HLFIR: %[[DEVICEPTR_C:.*]] = acc.deviceptr varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} ! CHECK: acc.serial dataOperands(%[[DEVICEPTR_A]], %[[DEVICEPTR_C]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} - + !$acc serial attach(d, e) !$acc end serial -! CHECK: %[[BOX_D:.*]] = fir.load %[[D]] : !fir.ref>> -! CHECK: %[[BOX_ADDR_D:.*]] = fir.box_addr %[[BOX_D]] : (!fir.box>) -> !fir.ptr -! CHECK: %[[ATTACH_D:.*]] = acc.attach varPtr(%[[BOX_ADDR_D]] : !fir.ptr) -> !fir.ptr {name = "d"} -! CHECK: %[[BOX_E:.*]] = fir.load %[[E]] : !fir.ref>> -! CHECK: %[[BOX_ADDR_E:.*]] = fir.box_addr %[[BOX_E]] : (!fir.box>) -> !fir.ptr -! CHECK: %[[ATTACH_E:.*]] = acc.attach varPtr(%[[BOX_ADDR_E]] : !fir.ptr) -> !fir.ptr {name = "e"} -! CHECK: acc.serial dataOperands(%[[ATTACH_D]], %[[ATTACH_E]] : !fir.ptr, !fir.ptr) { +! FIR: %[[BOX_D:.*]] = fir.load %[[D]] : !fir.ref>> +! HLFIR: %[[BOX_D:.*]] = fir.load %[[DECLD]]#1 : !fir.ref>> +! CHECK: %[[BOX_ADDR_D:.*]] = fir.box_addr %[[BOX_D]] : (!fir.box>) -> !fir.ptr +! CHECK: %[[ATTACH_D:.*]] = acc.attach varPtr(%[[BOX_ADDR_D]] : !fir.ptr) -> !fir.ptr {name = "d"} +! FIR: %[[BOX_E:.*]] = fir.load %[[E]] : !fir.ref>> +! HLFIR: %[[BOX_E:.*]] = fir.load %[[DECLE]]#1 : !fir.ref>> +! CHECK: %[[BOX_ADDR_E:.*]] = fir.box_addr %[[BOX_E]] : (!fir.box>) -> !fir.ptr +! CHECK: %[[ATTACH_E:.*]] = acc.attach varPtr(%[[BOX_ADDR_E]] : !fir.ptr) -> !fir.ptr {name = "e"} +! CHECK: acc.serial dataOperands(%[[ATTACH_D]], %[[ATTACH_E]] : !fir.ptr, !fir.ptr) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} ! CHECK: acc.detach accPtr(%[[ATTACH_D]] : !fir.ptr) {dataClause = #acc, name = "d"} @@ -252,9 +294,12 @@ subroutine acc_serial !$acc serial private(a) firstprivate(b) private(c) !$acc end serial -! CHECK: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} -! CHECK: %[[ACC_FPRIVATE_B:.*]] = acc.firstprivate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} -! CHECK: %[[ACC_PRIVATE_C:.*]] = acc.private varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! FIR: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! HLFIR: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! FIR: %[[ACC_FPRIVATE_B:.*]] = acc.firstprivate varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! HLFIR: %[[ACC_FPRIVATE_B:.*]] = acc.firstprivate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! FIR: %[[ACC_PRIVATE_C:.*]] = acc.private varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! HLFIR: %[[ACC_PRIVATE_C:.*]] = acc.private varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} ! CHECK: acc.serial firstprivate(@firstprivatization_ref_10x10xf32 -> %[[ACC_FPRIVATE_B]] : !fir.ref>) private(@privatization_ref_10x10xf32 -> %[[ACC_PRIVATE_A]] : !fir.ref>, @privatization_ref_10x10xf32 -> %[[ACC_PRIVATE_C]] : !fir.ref>) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} diff --git a/flang/test/Lower/OpenACC/acc-set.f90 b/flang/test/Lower/OpenACC/acc-set.f90 index 90889a21ff423..52baedeafecb2 100644 --- a/flang/test/Lower/OpenACC/acc-set.f90 +++ b/flang/test/Lower/OpenACC/acc-set.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of OpenACC set directive. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s --check-prefixes=CHECK,FIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR program test_acc_set logical :: l @@ -19,12 +20,14 @@ program test_acc_set ! CHECK-LABEL: func.func @_QQmain() ! CHECK: %[[L:.*]] = fir.alloca !fir.logical<4> {bindc_name = "l", uniq_name = "_QFEl"} +! HLFIR: %[[DECLL:.*]]:2 = hlfir.declare %[[L]] {uniq_name = "_QFEl"} ! CHECK: %[[C1:.*]] = arith.constant 1 : i32 ! CHECK: acc.set default_async(%[[C1]] : i32) ! CHECK: %[[C1:.*]] = arith.constant 1 : i32 -! CHECK: %[[LOAD_L:.*]] = fir.load %[[L]] : !fir.ref> +! FIR: %[[LOAD_L:.*]] = fir.load %[[L]] : !fir.ref> +! HLFIR: %[[LOAD_L:.*]] = fir.load %[[DECLL]]#0 : !fir.ref> ! CHECK: %[[CONV_L:.*]] = fir.convert %[[LOAD_L]] : (!fir.logical<4>) -> i1 ! CHECK: acc.set default_async(%[[C1]] : i32) if(%[[CONV_L]]) diff --git a/flang/test/Lower/OpenACC/acc-shutdown.f90 b/flang/test/Lower/OpenACC/acc-shutdown.f90 index db9a6d85cdae9..49e1acc546d90 100644 --- a/flang/test/Lower/OpenACC/acc-shutdown.f90 +++ b/flang/test/Lower/OpenACC/acc-shutdown.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of OpenACC shutdown directive. ! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s subroutine acc_shutdown logical :: ifCondition = .TRUE. diff --git a/flang/test/Lower/OpenACC/acc-update.f90 b/flang/test/Lower/OpenACC/acc-update.f90 index 893153fc6229c..f7343a69285f8 100644 --- a/flang/test/Lower/OpenACC/acc-update.f90 +++ b/flang/test/Lower/OpenACC/acc-update.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of OpenACC update directive. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s --check-prefixes=CHECK,FIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR subroutine acc_update integer :: async = 1 @@ -8,113 +9,157 @@ subroutine acc_update logical :: ifCondition = .TRUE. !CHECK: %[[A:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ea"} +! HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] !CHECK: %[[B:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} +! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] !CHECK: %[[C:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} +! HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] !$acc update host(a) -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} ! CHECK: acc.update dataOperands(%[[DEVPTR_A]] : !fir.ref>){{$}} -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} !$acc update host(a) if_present -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} ! CHECK: acc.update dataOperands(%[[DEVPTR_A]] : !fir.ref>) attributes {ifPresent}{{$}} -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} !$acc update self(a) -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} ! CHECK: acc.update dataOperands(%[[DEVPTR_A]] : !fir.ref>){{$}} -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {dataClause = #acc, name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a", structured = false} !$acc update host(a) if(.true.) -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} ! CHECK: %[[IF1:.*]] = arith.constant true ! CHECK: acc.update if(%[[IF1]]) dataOperands(%[[DEVPTR_A]] : !fir.ref>){{$}} -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} !$acc update host(a) if(ifCondition) -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} ! CHECK: %[[IFCOND:.*]] = fir.load %{{.*}} : !fir.ref> ! CHECK: %[[IF2:.*]] = fir.convert %[[IFCOND]] : (!fir.logical<4>) -> i1 ! CHECK: acc.update if(%[[IF2]]) dataOperands(%[[DEVPTR_A]] : !fir.ref>){{$}} -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} !$acc update host(a) host(b) host(c) -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} -! CHECK: %[[DEVPTR_B:.*]] = acc.getdeviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b", structured = false} -! CHECK: %[[DEVPTR_C:.*]] = acc.getdeviceptr varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_B:.*]] = acc.getdeviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b", structured = false} +! HLFIR: %[[DEVPTR_B:.*]] = acc.getdeviceptr varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b", structured = false} +! FIR: %[[DEVPTR_C:.*]] = acc.getdeviceptr varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c", structured = false} +! HLFIR: %[[DEVPTR_C:.*]] = acc.getdeviceptr varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "c", structured = false} ! CHECK: acc.update dataOperands(%[[DEVPTR_A]], %[[DEVPTR_B]], %[[DEVPTR_C]] : !fir.ref>, !fir.ref>, !fir.ref>){{$}} -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} -! CHECK: acc.update_host accPtr(%[[DEVPTR_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b", structured = false} -! CHECK: acc.update_host accPtr(%[[DEVPTR_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {name = "c", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {name = "b", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[C]] : !fir.ref>) {name = "c", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLC]]#1 : !fir.ref>) {name = "c", structured = false} !$acc update host(a) host(b) device(c) -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} -! CHECK: %[[DEVPTR_B:.*]] = acc.getdeviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b", structured = false} -! CHECK: %[[DEVPTR_C:.*]] = acc.update_device varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_B:.*]] = acc.getdeviceptr varPtr(%[[B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b", structured = false} +! HLFIR: %[[DEVPTR_B:.*]] = acc.getdeviceptr varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b", structured = false} +! FIR: %[[DEVPTR_C:.*]] = acc.update_device varPtr(%[[C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c", structured = false} +! HLFIR: %[[DEVPTR_C:.*]] = acc.update_device varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c", structured = false} ! CHECK: acc.update dataOperands(%[[DEVPTR_C]], %[[DEVPTR_A]], %[[DEVPTR_B]] : !fir.ref>, !fir.ref>, !fir.ref>){{$}} -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} -! CHECK: acc.update_host accPtr(%[[DEVPTR_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[B]] : !fir.ref>) {name = "b", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {name = "b", structured = false} !$acc update host(a) async -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} ! CHECK: acc.update dataOperands(%[[DEVPTR_A]] : !fir.ref>) attributes {async} -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} !$acc update host(a) wait -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} ! CHECK: acc.update dataOperands(%[[DEVPTR_A]] : !fir.ref>) attributes {wait} -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} !$acc update host(a) async wait -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} ! CHECK: acc.update dataOperands(%[[DEVPTR_A]] : !fir.ref>) attributes {async, wait} -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} !$acc update host(a) async(1) -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} ! CHECK: [[ASYNC1:%.*]] = arith.constant 1 : i32 ! CHECK: acc.update async([[ASYNC1]] : i32) dataOperands(%[[DEVPTR_A]] : !fir.ref>) -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} !$acc update host(a) async(async) -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} ! CHECK: [[ASYNC2:%.*]] = fir.load %{{.*}} : !fir.ref ! CHECK: acc.update async([[ASYNC2]] : i32) dataOperands(%[[DEVPTR_A]] : !fir.ref>) -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} !$acc update host(a) wait(1) -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} ! CHECK: [[WAIT1:%.*]] = arith.constant 1 : i32 ! CHECK: acc.update wait([[WAIT1]] : i32) dataOperands(%[[DEVPTR_A]] : !fir.ref>) -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} !$acc update host(a) wait(queues: 1, 2) -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} ! CHECK: [[WAIT2:%.*]] = arith.constant 1 : i32 ! CHECK: [[WAIT3:%.*]] = arith.constant 2 : i32 ! CHECK: acc.update wait([[WAIT2]], [[WAIT3]] : i32, i32) dataOperands(%[[DEVPTR_A]] : !fir.ref>) -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} !$acc update host(a) wait(devnum: 1: queues: 1, 2) -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} ! CHECK: [[WAIT4:%.*]] = arith.constant 1 : i32 ! CHECK: [[WAIT5:%.*]] = arith.constant 2 : i32 ! CHECK: [[WAIT6:%.*]] = arith.constant 1 : i32 ! CHECK: acc.update wait_devnum([[WAIT6]] : i32) wait([[WAIT4]], [[WAIT5]] : i32, i32) dataOperands(%[[DEVPTR_A]] : !fir.ref>) -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} !$acc update host(a) device_type(1, 2) -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} ! CHECK: [[DEVTYPE1:%.*]] = arith.constant 1 : i32 ! CHECK: [[DEVTYPE2:%.*]] = arith.constant 2 : i32 ! CHECK: acc.update device_type([[DEVTYPE1]], [[DEVTYPE2]] : i32, i32) dataOperands(%[[DEVPTR_A]] : !fir.ref>){{$}} -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} !$acc update host(a) device_type(*) -! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} +! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} ! CHECK: [[DEVTYPE3:%.*]] = arith.constant -1 : index ! CHECK: acc.update device_type([[DEVTYPE3]] : index) dataOperands(%[[DEVPTR_A]] : !fir.ref>){{$}} -! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref>) {name = "a", structured = false} +! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a", structured = false} end subroutine acc_update diff --git a/flang/test/Lower/OpenACC/acc-wait.f90 b/flang/test/Lower/OpenACC/acc-wait.f90 index 74c0a87829f03..604fa5b3d6f99 100644 --- a/flang/test/Lower/OpenACC/acc-wait.f90 +++ b/flang/test/Lower/OpenACC/acc-wait.f90 @@ -1,6 +1,7 @@ ! This test checks lowering of OpenACC wait directive. ! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s subroutine acc_update integer :: async = 1 diff --git a/flang/test/Lower/OpenACC/locations.f90 b/flang/test/Lower/OpenACC/locations.f90 index 3af06ab07e34b..19788f9f6d1aa 100644 --- a/flang/test/Lower/OpenACC/locations.f90 +++ b/flang/test/Lower/OpenACC/locations.f90 @@ -2,7 +2,7 @@ ! operations. ! RUN: bbc -fopenacc -emit-fir --mlir-print-debuginfo --mlir-print-local-scope %s -o - | FileCheck %s - +! RUN: bbc -fopenacc -emit-hlfir --mlir-print-debuginfo --mlir-print-local-scope %s -o - | FileCheck %s module acc_locations implicit none diff --git a/flang/test/Lower/OpenACC/stop-stmt-in-region.f90 b/flang/test/Lower/OpenACC/stop-stmt-in-region.f90 index b36e3b4a4ad3a..4b3e5632650f1 100644 --- a/flang/test/Lower/OpenACC/stop-stmt-in-region.f90 +++ b/flang/test/Lower/OpenACC/stop-stmt-in-region.f90 @@ -1,7 +1,9 @@ ! This test checks lowering of stop statement in OpenACC region. ! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s ! RUN: %flang_fc1 -emit-fir -fopenacc %s -o - | FileCheck %s +! RUN: %flang_fc1 -emit-hlfir -fopenacc %s -o - | FileCheck %s ! CHECK-LABEL: func.func @_QPtest_stop_in_region1() { ! CHECK: acc.parallel {