From bda3409f2c1920dd414041a843635832a0acd8f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?utf8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?utf8?q?=E3=83=B3=29?= Date: Tue, 21 Nov 2023 15:53:30 -0800 Subject: [PATCH] [flang][openacc][NFC] Check only HLFIR lowering for compute construct tests (#73051) --- flang/test/Lower/OpenACC/acc-host-data.f90 | 25 +- flang/test/Lower/OpenACC/acc-kernels-loop.f90 | 92 ++- flang/test/Lower/OpenACC/acc-kernels.f90 | 120 ++-- flang/test/Lower/OpenACC/acc-parallel-loop.f90 | 96 ++-- flang/test/Lower/OpenACC/acc-parallel.f90 | 753 ++++++++++++------------- flang/test/Lower/OpenACC/acc-serial-loop.f90 | 110 ++-- flang/test/Lower/OpenACC/acc-serial.f90 | 141 ++--- 7 files changed, 567 insertions(+), 770 deletions(-) rewrite flang/test/Lower/OpenACC/acc-parallel.f90 (81%) diff --git a/flang/test/Lower/OpenACC/acc-host-data.f90 b/flang/test/Lower/OpenACC/acc-host-data.f90 index ad6630c24c9d..269e461aa560 100644 --- a/flang/test/Lower/OpenACC/acc-host-data.f90 +++ b/flang/test/Lower/OpenACC/acc-host-data.f90 @@ -1,31 +1,28 @@ ! This test checks lowering of OpenACC host_data directive. -! RUN: bbc -fopenacc -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefixes=CHECK,FIR -! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s 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: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] ! CHECK: %[[IFCOND:.*]] = fir.address_of(@_QFacc_host_dataEifcondition) : !fir.ref> -! HLFIR: %[[DECLIFCOND:.*]]:2 = hlfir.declare %[[IFCOND]] +! CHECK: %[[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) -! 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: %[[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) -! 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: %[[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} @@ -33,10 +30,8 @@ subroutine acc_host_data() !$acc end host_data ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%{{.*}} : index) startIdx(%{{.*}} : index) -! 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: %[[DA:.*]] = acc.use_device varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a"} +! CHECK: %[[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>) @@ -44,8 +39,7 @@ subroutine acc_host_data() !$acc end host_data ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%{{.*}} : index) startIdx(%{{.*}} : index) -! 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: %[[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.) @@ -53,7 +47,6 @@ subroutine acc_host_data() !$acc end host_data ! CHECK-NOT: acc.host_data -! FIR: fir.do_loop -! HLFIR: hlfir.assign %{{.*}} to %[[DECLA]]#0 +! CHECK: hlfir.assign %{{.*}} to %[[DECLA]]#0 end subroutine diff --git a/flang/test/Lower/OpenACC/acc-kernels-loop.f90 b/flang/test/Lower/OpenACC/acc-kernels-loop.f90 index eee3f09732a3..34e723269724 100644 --- a/flang/test/Lower/OpenACC/acc-kernels-loop.f90 +++ b/flang/test/Lower/OpenACC/acc-kernels-loop.f90 @@ -1,7 +1,6 @@ ! This test checks lowering of OpenACC kernels loop combined directive. -! RUN: bbc -fopenacc -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefixes=CHECK,FIR -! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s subroutine acc_kernels_loop integer :: i, j @@ -26,17 +25,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: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] ! CHECK: %[[B:.*]] = fir.alloca !fir.array<10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} -! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[C:.*]] = fir.alloca !fir.array<10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} -! HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] +! CHECK: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] ! CHECK: %[[F:.*]] = fir.alloca !fir.box> {bindc_name = "f", uniq_name = "{{.*}}Ef"} -! HLFIR: %[[DECLF:.*]]:2 = hlfir.declare %[[F]] +! CHECK: %[[DECLF:.*]]:2 = hlfir.declare %[[F]] ! CHECK: %[[G:.*]] = fir.alloca !fir.box> {bindc_name = "g", uniq_name = "{{.*}}Eg"} -! HLFIR: %[[DECLG:.*]]:2 = hlfir.declare %[[G]] +! CHECK: %[[DECLG:.*]]:2 = hlfir.declare %[[G]] ! CHECK: %[[IFCONDITION:.*]] = fir.address_of(@{{.*}}ifcondition) : !fir.ref> -! HLFIR: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] +! CHECK: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] !$acc kernels loop DO i = 1, n @@ -295,8 +294,8 @@ subroutine acc_kernels_loop a(i) = b(i) END DO -! FIR: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 -! HLFIR: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 + +! CHECK: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 ! CHECK: acc.kernels self(%[[SELF2]]) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -310,10 +309,9 @@ subroutine acc_kernels_loop a(i) = b(i) END DO -! 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: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[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 @@ -321,20 +319,16 @@ subroutine acc_kernels_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} -! 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"} +! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! CHECK: 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 -! 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: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[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 @@ -342,20 +336,16 @@ subroutine acc_kernels_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} -! 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"} +! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! CHECK: 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 -! 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: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[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 @@ -369,10 +359,8 @@ subroutine acc_kernels_loop a(i) = b(i) END DO -! 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: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[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 @@ -380,20 +368,16 @@ subroutine acc_kernels_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} -! 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"} +! CHECK: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a"} +! CHECK: 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 -! 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: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! CHECK: %[[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 @@ -409,10 +393,8 @@ subroutine acc_kernels_loop a(i) = b(i) END DO -! 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: %[[NOCREATE_A:.*]] = acc.nocreate varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[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 @@ -426,10 +408,8 @@ subroutine acc_kernels_loop a(i) = b(i) END DO -! 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: %[[PRESENT_A:.*]] = acc.present varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[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 @@ -443,10 +423,8 @@ subroutine acc_kernels_loop a(i) = b(i) END DO -! 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: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[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 @@ -460,12 +438,10 @@ subroutine acc_kernels_loop a(i) = b(i) END DO -! FIR: %[[BOX_F:.*]] = fir.load %[[F]] : !fir.ref>> -! HLFIR: %[[BOX_F:.*]] = fir.load %[[DECLF]]#1 : !fir.ref>> +! CHECK: %[[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"} -! FIR: %[[BOX_G:.*]] = fir.load %[[G]] : !fir.ref>> -! HLFIR: %[[BOX_G:.*]] = fir.load %[[DECLG]]#1 : !fir.ref>> +! CHECK: %[[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) { diff --git a/flang/test/Lower/OpenACC/acc-kernels.f90 b/flang/test/Lower/OpenACC/acc-kernels.f90 index d150986c587e..1f882c6df510 100644 --- a/flang/test/Lower/OpenACC/acc-kernels.f90 +++ b/flang/test/Lower/OpenACC/acc-kernels.f90 @@ -1,7 +1,6 @@ ! This test checks lowering of OpenACC kernels construct. -! RUN: bbc -fopenacc -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefixes=CHECK,FIR -! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s subroutine acc_kernels integer :: i, j @@ -17,17 +16,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: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] ! CHECK: %[[B:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} -! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[C:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} -! HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] +! CHECK: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] ! CHECK: %[[D:.*]] = fir.alloca !fir.box> {bindc_name = "d", uniq_name = "{{.*}}Ed"} -! HLFIR: %[[DECLD:.*]]:2 = hlfir.declare %[[D]] +! CHECK: %[[DECLD:.*]]:2 = hlfir.declare %[[D]] ! CHECK: %[[E:.*]] = fir.alloca !fir.box> {bindc_name = "e", uniq_name = "{{.*}}Ee"} -! HLFIR: %[[DECLE:.*]]:2 = hlfir.declare %[[E]] +! CHECK: %[[DECLE:.*]]:2 = hlfir.declare %[[E]] ! CHECK: %[[IFCONDITION:.*]] = fir.address_of(@{{.*}}ifcondition) : !fir.ref> -! HLFIR: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] +! CHECK: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] !$acc kernels !$acc end kernels @@ -175,8 +174,7 @@ subroutine acc_kernels !$acc kernels self(ifCondition) !$acc end kernels -! FIR: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 -! HLFIR: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 +! CHECK: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 ! CHECK: acc.kernels self(%[[SELF2]]) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} @@ -184,50 +182,35 @@ subroutine acc_kernels !$acc kernels copy(a, b, c) !$acc end kernels -! 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: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! CHECK: %[[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: }{{$}} -! 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"} +! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} +! CHECK: 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 -! 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: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! CHECK: %[[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: }{{$}} -! 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"} +! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} +! CHECK: 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 -! 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: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! CHECK: %[[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: }{{$}} @@ -235,31 +218,22 @@ subroutine acc_kernels !$acc kernels copyout(a) copyout(zero: b) copyout(c) !$acc end kernels -! 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: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! CHECK: %[[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: }{{$}} -! 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"} +! CHECK: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a"} +! CHECK: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {name = "b"} +! CHECK: 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 -! 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: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! CHECK: %[[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: }{{$}} @@ -270,12 +244,9 @@ subroutine acc_kernels !$acc kernels no_create(a, b) create(zero: c) !$acc end kernels -! 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: %[[NO_CREATE_A:.*]] = acc.nocreate varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[NO_CREATE_B:.*]] = acc.nocreate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! CHECK: %[[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: }{{$}} @@ -283,12 +254,9 @@ subroutine acc_kernels !$acc kernels present(a, b, c) !$acc end kernels -! 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: %[[PRESENT_A:.*]] = acc.present varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[PRESENT_B:.*]] = acc.present varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! CHECK: %[[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: }{{$}} @@ -296,10 +264,8 @@ subroutine acc_kernels !$acc kernels deviceptr(a) deviceptr(c) !$acc end kernels -! 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: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[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: }{{$}} @@ -307,12 +273,10 @@ subroutine acc_kernels !$acc kernels attach(d, e) !$acc end kernels -! FIR: %[[BOX_D:.*]] = fir.load %[[D]] : !fir.ref>> -! HLFIR: %[[BOX_D:.*]] = fir.load %[[DECLD]]#1 : !fir.ref>> +! CHECK: %[[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_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) { diff --git a/flang/test/Lower/OpenACC/acc-parallel-loop.f90 b/flang/test/Lower/OpenACC/acc-parallel-loop.f90 index 0fd484091664..1856215ce59d 100644 --- a/flang/test/Lower/OpenACC/acc-parallel-loop.f90 +++ b/flang/test/Lower/OpenACC/acc-parallel-loop.f90 @@ -1,7 +1,6 @@ ! This test checks lowering of OpenACC parallel loop combined directive. -! RUN: bbc -fopenacc -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefixes=CHECK,FIR -! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s ! CHECK-LABEL: func.func @_QPacc_parallel_loop() @@ -28,17 +27,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: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] ! CHECK: %[[B:.*]] = fir.alloca !fir.array<10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} -! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[C:.*]] = fir.alloca !fir.array<10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} -! HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] +! CHECK: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] ! CHECK: %[[F:.*]] = fir.alloca !fir.box> {bindc_name = "f", uniq_name = "{{.*}}Ef"} -! HLFIR: %[[DECLF:.*]]:2 = hlfir.declare %[[F]] +! CHECK: %[[DECLF:.*]]:2 = hlfir.declare %[[F]] ! CHECK: %[[G:.*]] = fir.alloca !fir.box> {bindc_name = "g", uniq_name = "{{.*}}Eg"} -! HLFIR: %[[DECLG:.*]]:2 = hlfir.declare %[[G]] +! CHECK: %[[DECLG:.*]]:2 = hlfir.declare %[[G]] ! CHECK: %[[IFCONDITION:.*]] = fir.address_of(@{{.*}}ifcondition) : !fir.ref> -! HLFIR: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] +! CHECK: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] !$acc parallel loop DO i = 1, n @@ -297,8 +296,7 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! FIR: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 -! HLFIR: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 +! CHECK: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 ! CHECK: acc.parallel self(%[[SELF2]]) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -312,10 +310,8 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! 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: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[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 @@ -323,20 +319,16 @@ subroutine acc_parallel_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} -! 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"} +! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! CHECK: 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 -! 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: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[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 @@ -344,20 +336,16 @@ subroutine acc_parallel_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} -! 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"} +! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! CHECK: 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 -! 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: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[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 @@ -371,10 +359,8 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! 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: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[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 @@ -382,20 +368,16 @@ subroutine acc_parallel_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} -! 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"} +! CHECK: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a"} +! CHECK: 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 -! 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: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! CHECK: %[[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 @@ -411,10 +393,8 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! 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: %[[NOCREATE_A:.*]] = acc.nocreate varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[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 @@ -428,10 +408,8 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! 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: %[[PRESENT_A:.*]] = acc.present varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[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 @@ -445,10 +423,8 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! 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: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[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 @@ -462,12 +438,10 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! FIR: %[[BOX_F:.*]] = fir.load %[[F]] : !fir.ref>> -! HLFIR: %[[BOX_F:.*]] = fir.load %[[DECLF]]#1 : !fir.ref>> +! CHECK: %[[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"} -! FIR: %[[BOX_G:.*]] = fir.load %[[G]] : !fir.ref>> -! HLFIR: %[[BOX_G:.*]] = fir.load %[[DECLG]]#1 : !fir.ref>> +! CHECK: %[[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) { @@ -483,11 +457,9 @@ subroutine acc_parallel_loop a(i) = b(i) END DO -! 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_PRIVATE_B:.*]] = acc.firstprivate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.parallel firstprivate(@firstprivatization_section_ext10_ref_10xf32 -> %[[ACC_PRIVATE_B]] : !fir.ref>) { -! 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_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 dissimilarity index 81% index 2243430ef12c..bbf51ba36a7d 100644 --- a/flang/test/Lower/OpenACC/acc-parallel.f90 +++ b/flang/test/Lower/OpenACC/acc-parallel.f90 @@ -1,397 +1,356 @@ -! This test checks lowering of OpenACC parallel directive. - -! RUN: bbc -fopenacc -emit-fir -hlfir=false %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_section_ext10xext10_ref_10x10xf32 : !fir.ref> init { -! CHECK: ^bb0(%{{.*}}: !fir.ref>): -! HLFIR: %[[SHAPE:.*]] = fir.shape %{{.*}}, %{{.*}} : (index, index) -> !fir.shape<2> -! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<10x10xf32> -! HLFIR: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.private.init"} : (!fir.ref>, !fir.shape<2>) -> (!fir.ref>, !fir.ref>) -! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.ref> -! CHECK: } copy { -! CHECK: ^bb0(%arg0: !fir.ref>, %arg1: !fir.ref>): -! CHECK: acc.terminator -! CHECK: } - -! CHECK-LABEL: acc.private.recipe @privatization_ref_10x10xf32 : !fir.ref> init { -! CHECK: ^bb0(%{{.*}}: !fir.ref>): -! HLFIR: %[[SHAPE:.*]] = fir.shape %{{.*}}, %{{.*}} : (index, index) -> !fir.shape<2> -! HLFIR: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.private.init"} : (!fir.ref>, !fir.shape<2>) -> (!fir.ref>, !fir.ref>) -! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.ref> -! CHECK: } - -! CHECK-LABEL: func.func @_QPacc_parallel() - -subroutine acc_parallel - integer :: i, j - - integer :: async = 1 - integer :: wait1 = 1 - integer :: wait2 = 2 - integer :: numGangs = 1 - integer :: numWorkers = 10 - integer :: vectorLength = 128 - logical :: ifCondition = .TRUE. - real, dimension(10, 10) :: a, b, c - real, pointer :: d, e - integer :: reduction_i - 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 - -!CHECK: acc.parallel { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel async - !$acc end parallel - -!CHECK: acc.parallel { -!CHECK: acc.yield -!CHECK-NEXT: } attributes {asyncAttr} - - !$acc parallel async(1) - !$acc end parallel - -!CHECK: [[ASYNC1:%.*]] = arith.constant 1 : i32 -!CHECK: acc.parallel async([[ASYNC1]] : i32) { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel async(async) - !$acc end parallel - -!CHECK: [[ASYNC2:%.*]] = fir.load %{{.*}} : !fir.ref -!CHECK: acc.parallel async([[ASYNC2]] : i32) { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel wait - !$acc end parallel - -!CHECK: acc.parallel { -!CHECK: acc.yield -!CHECK-NEXT: } attributes {waitAttr} - - !$acc parallel wait(1) - !$acc end parallel - -!CHECK: [[WAIT1:%.*]] = arith.constant 1 : i32 -!CHECK: acc.parallel wait([[WAIT1]] : i32) { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel wait(1, 2) - !$acc end parallel - -!CHECK: [[WAIT2:%.*]] = arith.constant 1 : i32 -!CHECK: [[WAIT3:%.*]] = arith.constant 2 : i32 -!CHECK: acc.parallel wait([[WAIT2]], [[WAIT3]] : i32, i32) { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel wait(wait1, wait2) - !$acc end parallel - -!CHECK: [[WAIT4:%.*]] = fir.load %{{.*}} : !fir.ref -!CHECK: [[WAIT5:%.*]] = fir.load %{{.*}} : !fir.ref -!CHECK: acc.parallel wait([[WAIT4]], [[WAIT5]] : i32, i32) { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel num_gangs(1) - !$acc end parallel - -!CHECK: [[NUMGANGS1:%.*]] = arith.constant 1 : i32 -!CHECK: acc.parallel num_gangs([[NUMGANGS1]] : i32) { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel num_gangs(numGangs) - !$acc end parallel - -!CHECK: [[NUMGANGS2:%.*]] = fir.load %{{.*}} : !fir.ref -!CHECK: acc.parallel num_gangs([[NUMGANGS2]] : i32) { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel num_gangs(1, 1, 1) - !$acc end parallel - -!CHECK: acc.parallel num_gangs(%{{.*}}, %{{.*}}, %{{.*}} : i32, i32, i32) { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel num_workers(10) - !$acc end parallel - -!CHECK: [[NUMWORKERS1:%.*]] = arith.constant 10 : i32 -!CHECK: acc.parallel num_workers([[NUMWORKERS1]] : i32) { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel num_workers(numWorkers) - !$acc end parallel - -!CHECK: [[NUMWORKERS2:%.*]] = fir.load %{{.*}} : !fir.ref -!CHECK: acc.parallel num_workers([[NUMWORKERS2]] : i32) { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel vector_length(128) - !$acc end parallel - -!CHECK: [[VECTORLENGTH1:%.*]] = arith.constant 128 : i32 -!CHECK: acc.parallel vector_length([[VECTORLENGTH1]] : i32) { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel vector_length(vectorLength) - !$acc end parallel - -!CHECK: [[VECTORLENGTH2:%.*]] = fir.load %{{.*}} : !fir.ref -!CHECK: acc.parallel vector_length([[VECTORLENGTH2]] : i32) { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel if(.TRUE.) - !$acc end parallel - -!CHECK: [[IF1:%.*]] = arith.constant true -!CHECK: acc.parallel if([[IF1]]) { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel if(ifCondition) - !$acc end parallel - -!CHECK: [[IFCOND:%.*]] = fir.load %{{.*}} : !fir.ref> -!CHECK: [[IF2:%.*]] = fir.convert [[IFCOND]] : (!fir.logical<4>) -> i1 -!CHECK: acc.parallel if([[IF2]]) { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel self(.TRUE.) - !$acc end parallel - -!CHECK: [[SELF1:%.*]] = arith.constant true -!CHECK: acc.parallel self([[SELF1]]) { -!CHECK: acc.yield -!CHECK-NEXT: }{{$}} - - !$acc parallel self - !$acc end parallel - -!CHECK: acc.parallel { -!CHECK: acc.yield -!CHECK-NEXT: } attributes {selfAttr} - - !$acc parallel self(ifCondition) - !$acc end parallel - -!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: }{{$}} - - !$acc parallel copy(a, b, c) - !$acc end parallel - -!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: }{{$}} -!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 - -!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: }{{$}} -!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 - -!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: }{{$}} - - !$acc parallel copyout(a) copyout(zero: b) copyout(c) - !$acc end parallel - -!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: }{{$}} -!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 - -!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: }{{$}} -!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 parallel create(c) copy(b) create(a) - !$acc end parallel -!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 - -!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: }{{$}} -!CHECK: acc.delete accPtr(%[[CREATE_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "c"} - - - !$acc parallel present(a, b, c) - !$acc end parallel - -!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: }{{$}} - - !$acc parallel deviceptr(a) deviceptr(c) - !$acc end parallel - -!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: }{{$}} - - !$acc parallel attach(d, e) - !$acc end parallel - -!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"} -!CHECK: acc.detach accPtr(%[[ATTACH_E]] : !fir.ptr) {dataClause = #acc, name = "e"} - -!$acc parallel private(a) firstprivate(b) private(c) -!$acc end parallel - -! 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_section_ext10xext10_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: }{{$}} - -!$acc parallel reduction(+:reduction_r) reduction(*:reduction_i) -!$acc end parallel - -! CHECK: acc.parallel reduction(@reduction_add_ref_f32 -> %{{.*}} : !fir.ref, @reduction_mul_ref_i32 -> %{{.*}} : !fir.ref) { -! CHECK: acc.yield -! CHECK-NEXT: }{{$}} - -!$acc parallel default(none) -!$acc end parallel - -! CHECK: acc.parallel { -! CHECK: } attributes {defaultAttr = #acc} - -!$acc parallel default(present) -!$acc end parallel - -! CHECK: acc.parallel { -! CHECK: } attributes {defaultAttr = #acc} - -end subroutine acc_parallel +! This test checks lowering of OpenACC parallel directive. + +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s + +! CHECK-LABEL: acc.firstprivate.recipe @firstprivatization_section_ext10xext10_ref_10x10xf32 : !fir.ref> init { +! CHECK: ^bb0(%{{.*}}: !fir.ref>): +! CHECK: %[[SHAPE:.*]] = fir.shape %{{.*}}, %{{.*}} : (index, index) -> !fir.shape<2> +! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<10x10xf32> +! CHECK: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.private.init"} : (!fir.ref>, !fir.shape<2>) -> (!fir.ref>, !fir.ref>) +! CHECK: acc.yield %[[DECLARE]]#0 : !fir.ref> +! CHECK: } copy { +! CHECK: ^bb0(%arg0: !fir.ref>, %arg1: !fir.ref>): +! CHECK: acc.terminator +! CHECK: } + +! CHECK-LABEL: acc.private.recipe @privatization_ref_10x10xf32 : !fir.ref> init { +! CHECK: ^bb0(%{{.*}}: !fir.ref>): +! CHECK: %[[SHAPE:.*]] = fir.shape %{{.*}}, %{{.*}} : (index, index) -> !fir.shape<2> +! CHECK: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.private.init"} : (!fir.ref>, !fir.shape<2>) -> (!fir.ref>, !fir.ref>) +! CHECK: acc.yield %[[DECLARE]]#0 : !fir.ref> +! CHECK: } + +! CHECK-LABEL: func.func @_QPacc_parallel() + +subroutine acc_parallel + integer :: i, j + + integer :: async = 1 + integer :: wait1 = 1 + integer :: wait2 = 2 + integer :: numGangs = 1 + integer :: numWorkers = 10 + integer :: vectorLength = 128 + logical :: ifCondition = .TRUE. + real, dimension(10, 10) :: a, b, c + real, pointer :: d, e + integer :: reduction_i + real :: reduction_r + +! CHECK: %[[A:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ea"} +! CHECK: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] +! CHECK: %[[B:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} +! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! CHECK: %[[C:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} +! CHECK: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] +! CHECK: %[[D:.*]] = fir.alloca !fir.box> {bindc_name = "d", uniq_name = "{{.*}}Ed"} +! CHECK: %[[DECLD:.*]]:2 = hlfir.declare %[[D]] +! CHECK: %[[E:.*]] = fir.alloca !fir.box> {bindc_name = "e", uniq_name = "{{.*}}Ee"} +! CHECK: %[[DECLE:.*]]:2 = hlfir.declare %[[E]] +! CHECK: %[[IFCONDITION:.*]] = fir.address_of(@{{.*}}ifcondition) : !fir.ref> +! CHECK: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] + + !$acc parallel + !$acc end parallel + +! CHECK: acc.parallel { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel async + !$acc end parallel + +! CHECK: acc.parallel { +! CHECK: acc.yield +! CHECK-NEXT: } attributes {asyncAttr} + + !$acc parallel async(1) + !$acc end parallel + +! CHECK: [[ASYNC1:%.*]] = arith.constant 1 : i32 +! CHECK: acc.parallel async([[ASYNC1]] : i32) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel async(async) + !$acc end parallel + +! CHECK: [[ASYNC2:%.*]] = fir.load %{{.*}} : !fir.ref +! CHECK: acc.parallel async([[ASYNC2]] : i32) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel wait + !$acc end parallel + +! CHECK: acc.parallel { +! CHECK: acc.yield +! CHECK-NEXT: } attributes {waitAttr} + + !$acc parallel wait(1) + !$acc end parallel + +! CHECK: [[WAIT1:%.*]] = arith.constant 1 : i32 +! CHECK: acc.parallel wait([[WAIT1]] : i32) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel wait(1, 2) + !$acc end parallel + +! CHECK: [[WAIT2:%.*]] = arith.constant 1 : i32 +! CHECK: [[WAIT3:%.*]] = arith.constant 2 : i32 +! CHECK: acc.parallel wait([[WAIT2]], [[WAIT3]] : i32, i32) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel wait(wait1, wait2) + !$acc end parallel + +! CHECK: [[WAIT4:%.*]] = fir.load %{{.*}} : !fir.ref +! CHECK: [[WAIT5:%.*]] = fir.load %{{.*}} : !fir.ref +! CHECK: acc.parallel wait([[WAIT4]], [[WAIT5]] : i32, i32) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel num_gangs(1) + !$acc end parallel + +! CHECK: [[NUMGANGS1:%.*]] = arith.constant 1 : i32 +! CHECK: acc.parallel num_gangs([[NUMGANGS1]] : i32) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel num_gangs(numGangs) + !$acc end parallel + +! CHECK: [[NUMGANGS2:%.*]] = fir.load %{{.*}} : !fir.ref +! CHECK: acc.parallel num_gangs([[NUMGANGS2]] : i32) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel num_gangs(1, 1, 1) + !$acc end parallel + +! CHECK: acc.parallel num_gangs(%{{.*}}, %{{.*}}, %{{.*}} : i32, i32, i32) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel num_workers(10) + !$acc end parallel + +! CHECK: [[NUMWORKERS1:%.*]] = arith.constant 10 : i32 +! CHECK: acc.parallel num_workers([[NUMWORKERS1]] : i32) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel num_workers(numWorkers) + !$acc end parallel + +! CHECK: [[NUMWORKERS2:%.*]] = fir.load %{{.*}} : !fir.ref +! CHECK: acc.parallel num_workers([[NUMWORKERS2]] : i32) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel vector_length(128) + !$acc end parallel + +! CHECK: [[VECTORLENGTH1:%.*]] = arith.constant 128 : i32 +! CHECK: acc.parallel vector_length([[VECTORLENGTH1]] : i32) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel vector_length(vectorLength) + !$acc end parallel + +! CHECK: [[VECTORLENGTH2:%.*]] = fir.load %{{.*}} : !fir.ref +! CHECK: acc.parallel vector_length([[VECTORLENGTH2]] : i32) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel if(.TRUE.) + !$acc end parallel + +! CHECK: [[IF1:%.*]] = arith.constant true +! CHECK: acc.parallel if([[IF1]]) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel if(ifCondition) + !$acc end parallel + +! CHECK: [[IFCOND:%.*]] = fir.load %{{.*}} : !fir.ref> +! CHECK: [[IF2:%.*]] = fir.convert [[IFCOND]] : (!fir.logical<4>) -> i1 +! CHECK: acc.parallel if([[IF2]]) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel self(.TRUE.) + !$acc end parallel + +! CHECK: [[SELF1:%.*]] = arith.constant true +! CHECK: acc.parallel self([[SELF1]]) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel self + !$acc end parallel + +! CHECK: acc.parallel { +! CHECK: acc.yield +! CHECK-NEXT: } attributes {selfAttr} + + !$acc parallel self(ifCondition) + !$acc end parallel + +! CHECK: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 +! CHECK: acc.parallel self(%[[SELF2]]) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + + !$acc parallel copy(a, b, c) + !$acc end parallel + +! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! CHECK: %[[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(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} +! CHECK: 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(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! CHECK: %[[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(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} +! CHECK: 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(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! CHECK: %[[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: }{{$}} + + !$acc parallel copyout(a) copyout(zero: b) copyout(c) + !$acc end parallel + +! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! CHECK: %[[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(%[[DECLA]]#1 : !fir.ref>) {name = "a"} +! CHECK: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {name = "b"} +! CHECK: 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(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! CHECK: %[[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.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 parallel create(c) copy(b) create(a) + !$acc end parallel +! CHECK: %[[CREATE_C:.*]] = acc.create varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! CHECK: %[[COPY_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! CHECK: %[[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(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[NO_CREATE_B:.*]] = acc.nocreate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! CHECK: %[[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: }{{$}} +! CHECK: acc.delete accPtr(%[[CREATE_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "c"} + + + !$acc parallel present(a, b, c) + !$acc end parallel + +! CHECK: %[[PRESENT_A:.*]] = acc.present varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[PRESENT_B:.*]] = acc.present varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! CHECK: %[[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: }{{$}} + + !$acc parallel deviceptr(a) deviceptr(c) + !$acc end parallel + +! CHECK: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[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: }{{$}} + + !$acc parallel attach(d, e) + !$acc end parallel + +! CHECK: %[[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"} +! CHECK: %[[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"} +! CHECK: acc.detach accPtr(%[[ATTACH_E]] : !fir.ptr) {dataClause = #acc, name = "e"} + +!$acc parallel private(a) firstprivate(b) private(c) +!$acc end parallel + +! CHECK: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[ACC_FPRIVATE_B:.*]] = acc.firstprivate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! CHECK: %[[ACC_PRIVATE_C:.*]] = acc.private varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} +! CHECK: acc.parallel firstprivate(@firstprivatization_section_ext10xext10_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: }{{$}} + +!$acc parallel reduction(+:reduction_r) reduction(*:reduction_i) +!$acc end parallel + +! CHECK: acc.parallel reduction(@reduction_add_ref_f32 -> %{{.*}} : !fir.ref, @reduction_mul_ref_i32 -> %{{.*}} : !fir.ref) { +! CHECK: acc.yield +! CHECK-NEXT: }{{$}} + +!$acc parallel default(none) +!$acc end parallel + +! CHECK: acc.parallel { +! CHECK: } attributes {defaultAttr = #acc} + +!$acc parallel default(present) +!$acc end parallel + +! CHECK: acc.parallel { +! CHECK: } attributes {defaultAttr = #acc} + +end subroutine acc_parallel diff --git a/flang/test/Lower/OpenACC/acc-serial-loop.f90 b/flang/test/Lower/OpenACC/acc-serial-loop.f90 index 4e5060b9ff02..4ed7bb8da29a 100644 --- a/flang/test/Lower/OpenACC/acc-serial-loop.f90 +++ b/flang/test/Lower/OpenACC/acc-serial-loop.f90 @@ -1,22 +1,21 @@ ! This test checks lowering of Openacc serial loop combined directive. -! RUN: bbc -fopenacc -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefixes=CHECK,FIR -! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s ! CHECK-LABEL: acc.private.recipe @privatization_ref_10xf32 : !fir.ref> init { ! CHECK: ^bb0(%{{.*}}: !fir.ref>): -! HLFIR: %[[SHAPE:.*]] = fir.shape %{{.*}} : (index) -> !fir.shape<1> -! HLFIR: %[[ALLOCA:.*]] = fir.alloca !fir.array<10xf32> -! HLFIR: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.private.init"} : (!fir.ref>, !fir.shape<1>) -> (!fir.ref>, !fir.ref>) -! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.ref> +! CHECK: %[[SHAPE:.*]] = fir.shape %{{.*}} : (index) -> !fir.shape<1> +! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<10xf32> +! CHECK: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.private.init"} : (!fir.ref>, !fir.shape<1>) -> (!fir.ref>, !fir.ref>) +! CHECK: acc.yield %[[DECLARE]]#0 : !fir.ref> ! CHECK: } ! CHECK-LABEL: acc.firstprivate.recipe @firstprivatization_section_ext10_ref_10xf32 : !fir.ref> init { ! CHECK: ^bb0(%{{.*}}: !fir.ref>): -! HLFIR: %[[SHAPE:.*]] = fir.shape %{{.*}} : (index) -> !fir.shape<1> +! CHECK: %[[SHAPE:.*]] = fir.shape %{{.*}} : (index) -> !fir.shape<1> ! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<10xf32> -! HLFIR: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.private.init"} : (!fir.ref>, !fir.shape<1>) -> (!fir.ref>, !fir.ref>) -! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.ref> +! CHECK: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.private.init"} : (!fir.ref>, !fir.shape<1>) -> (!fir.ref>, !fir.ref>) +! CHECK: acc.yield %[[DECLARE]]#0 : !fir.ref> ! CHECK: } copy { ! CHECK: ^bb0(%arg0: !fir.ref>, %arg1: !fir.ref>): ! CHECK: acc.terminator @@ -47,17 +46,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: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] ! CHECK: %[[B:.*]] = fir.alloca !fir.array<10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} -! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[C:.*]] = fir.alloca !fir.array<10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} -! HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] +! CHECK: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] ! CHECK: %[[F:.*]] = fir.alloca !fir.box> {bindc_name = "f", uniq_name = "{{.*}}Ef"} -! HLFIR: %[[DECLF:.*]]:2 = hlfir.declare %[[F]] +! CHECK: %[[DECLF:.*]]:2 = hlfir.declare %[[F]] ! CHECK: %[[G:.*]] = fir.alloca !fir.box> {bindc_name = "g", uniq_name = "{{.*}}Eg"} -! HLFIR: %[[DECLG:.*]]:2 = hlfir.declare %[[G]] +! CHECK: %[[DECLG:.*]]:2 = hlfir.declare %[[G]] ! CHECK: %[[IFCONDITION:.*]] = fir.address_of(@{{.*}}ifcondition) : !fir.ref> -! HLFIR: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] +! CHECK: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] !$acc serial loop DO i = 1, n @@ -232,8 +231,7 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! FIR: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 -! HLFIR: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 +! CHECK: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 ! CHECK: acc.serial self(%[[SELF2]]) { ! CHECK: acc.loop { ! CHECK: fir.do_loop @@ -247,10 +245,8 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! 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: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[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 @@ -258,20 +254,16 @@ subroutine acc_serial_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} -! 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"} +! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! CHECK: 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 -! 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: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[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 @@ -279,20 +271,16 @@ subroutine acc_serial_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} -! 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"} +! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! CHECK: 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 -! 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: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[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 @@ -306,10 +294,8 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! 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: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[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 @@ -317,20 +303,16 @@ subroutine acc_serial_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} -! 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"} +! CHECK: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a"} +! CHECK: 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 -! 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: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} +! CHECK: %[[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 @@ -346,10 +328,8 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! 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: %[[NOCREATE_A:.*]] = acc.nocreate varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[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 @@ -363,10 +343,8 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! 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: %[[PRESENT_A:.*]] = acc.present varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[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 @@ -380,10 +358,8 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! 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: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[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 @@ -397,12 +373,10 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! FIR: %[[BOX_F:.*]] = fir.load %[[F]] : !fir.ref>> -! HLFIR: %[[BOX_F:.*]] = fir.load %[[DECLF]]#1 : !fir.ref>> +! CHECK: %[[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"} -! FIR: %[[BOX_G:.*]] = fir.load %[[G]] : !fir.ref>> -! HLFIR: %[[BOX_G:.*]] = fir.load %[[DECLG]]#1 : !fir.ref>> +! CHECK: %[[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) { @@ -418,11 +392,9 @@ subroutine acc_serial_loop a(i) = b(i) END DO -! 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_FPRIVATE_B:.*]] = acc.firstprivate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}) -> !fir.ref> {name = "b"} ! CHECK: acc.serial firstprivate(@firstprivatization_section_ext10_ref_10xf32 -> %[[ACC_FPRIVATE_B]] : !fir.ref>) { -! 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_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 89e920eff936..ab3b0ccd5459 100644 --- a/flang/test/Lower/OpenACC/acc-serial.f90 +++ b/flang/test/Lower/OpenACC/acc-serial.f90 @@ -1,14 +1,13 @@ ! This test checks lowering of OpenACC serial directive. -! RUN: bbc -fopenacc -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefixes=CHECK,FIR -! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s ! CHECK-LABEL: acc.firstprivate.recipe @firstprivatization_section_ext10xext10_ref_10x10xf32 : !fir.ref> init { ! CHECK: ^bb0(%{{.*}}: !fir.ref>): -! HLFIR: %[[SHAPE:.*]] = fir.shape %{{.*}}, %{{.*}} : (index, index) -> !fir.shape<2> +! CHECK: %[[SHAPE:.*]] = fir.shape %{{.*}}, %{{.*}} : (index, index) -> !fir.shape<2> ! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<10x10xf32> -! HLFIR: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.private.init"} : (!fir.ref>, !fir.shape<2>) -> (!fir.ref>, !fir.ref>) -! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.ref> +! CHECK: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.private.init"} : (!fir.ref>, !fir.shape<2>) -> (!fir.ref>, !fir.ref>) +! CHECK: acc.yield %[[DECLARE]]#0 : !fir.ref> ! CHECK: } copy { ! CHECK: ^bb0(%arg0: !fir.ref>, %arg1: !fir.ref>): ! CHECK: acc.terminator @@ -16,9 +15,9 @@ ! CHECK-LABEL: acc.private.recipe @privatization_ref_10x10xf32 : !fir.ref> init { ! CHECK: ^bb0(%{{.*}}: !fir.ref>): -! HLFIR: %[[SHAPE:.*]] = fir.shape %{{.*}}, %{{.*}} : (index, index) -> !fir.shape<2> -! HLFIR: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.private.init"} : (!fir.ref>, !fir.shape<2>) -> (!fir.ref>, !fir.ref>) -! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.ref> +! CHECK: %[[SHAPE:.*]] = fir.shape %{{.*}}, %{{.*}} : (index, index) -> !fir.shape<2> +! CHECK: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.private.init"} : (!fir.ref>, !fir.shape<2>) -> (!fir.ref>, !fir.ref>) +! CHECK: acc.yield %[[DECLARE]]#0 : !fir.ref> ! CHECK: } ! CHECK-LABEL: func.func @_QPacc_serial() @@ -39,17 +38,17 @@ subroutine acc_serial real :: reduction_r ! CHECK: %[[A:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ea"} -! HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] +! CHECK: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] ! CHECK: %[[B:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Eb"} -! HLFIR: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] +! CHECK: %[[DECLB:.*]]:2 = hlfir.declare %[[B]] ! CHECK: %[[C:.*]] = fir.alloca !fir.array<10x10xf32> {{{.*}}uniq_name = "{{.*}}Ec"} -! HLFIR: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] +! CHECK: %[[DECLC:.*]]:2 = hlfir.declare %[[C]] ! CHECK: %[[D:.*]] = fir.alloca !fir.box> {bindc_name = "d", uniq_name = "{{.*}}Ed"} -! HLFIR: %[[DECLD:.*]]:2 = hlfir.declare %[[D]] +! CHECK: %[[DECLD:.*]]:2 = hlfir.declare %[[D]] ! CHECK: %[[E:.*]] = fir.alloca !fir.box> {bindc_name = "e", uniq_name = "{{.*}}Ee"} -! HLFIR: %[[DECLE:.*]]:2 = hlfir.declare %[[E]] +! CHECK: %[[DECLE:.*]]:2 = hlfir.declare %[[E]] ! CHECK: %[[IFCONDITION:.*]] = fir.address_of(@{{.*}}ifcondition) : !fir.ref> -! HLFIR: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] +! CHECK: %[[DECLIFCONDITION:.*]]:2 = hlfir.declare %[[IFCONDITION]] !$acc serial !$acc end serial @@ -149,8 +148,7 @@ subroutine acc_serial !$acc serial self(ifCondition) !$acc end serial -! FIR: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref>) -> i1 -! HLFIR: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 +! CHECK: %[[SELF2:.*]] = fir.convert %[[DECLIFCONDITION]]#1 : (!fir.ref>) -> i1 ! CHECK: acc.serial self(%[[SELF2]]) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} @@ -158,50 +156,35 @@ subroutine acc_serial !$acc serial copy(a, b, c) !$acc end serial -! 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: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! CHECK: %[[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: }{{$}} -! 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"} +! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} +! CHECK: 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 -! 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: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! CHECK: %[[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: }{{$}} -! 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"} +! CHECK: acc.copyout accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {dataClause = #acc, name = "a"} +! CHECK: acc.copyout accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {dataClause = #acc, name = "b"} +! CHECK: 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 -! 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: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! CHECK: %[[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: }{{$}} @@ -209,31 +192,22 @@ subroutine acc_serial !$acc serial copyout(a) copyout(zero: b) copyout(c) !$acc end serial -! 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: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a"} +! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "b"} +! CHECK: %[[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: }{{$}} -! 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"} +! CHECK: acc.copyout accPtr(%[[CREATE_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref>) {name = "a"} +! CHECK: acc.copyout accPtr(%[[CREATE_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLB]]#1 : !fir.ref>) {name = "b"} +! CHECK: 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 -! 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: %[[CREATE_A:.*]] = acc.create varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! CHECK: %[[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: }{{$}} @@ -244,12 +218,9 @@ subroutine acc_serial !$acc serial no_create(a, b) create(zero: c) !$acc end serial -! 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: %[[NO_CREATE_A:.*]] = acc.nocreate varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[NO_CREATE_B:.*]] = acc.nocreate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! CHECK: %[[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: }{{$}} @@ -257,12 +228,9 @@ subroutine acc_serial !$acc serial present(a, b, c) !$acc end serial -! 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: %[[PRESENT_A:.*]] = acc.present varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[PRESENT_B:.*]] = acc.present varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! CHECK: %[[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: }{{$}} @@ -270,10 +238,8 @@ subroutine acc_serial !$acc serial deviceptr(a) deviceptr(c) !$acc end serial -! 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: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[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: }{{$}} @@ -281,12 +247,10 @@ subroutine acc_serial !$acc serial attach(d, e) !$acc end serial -! FIR: %[[BOX_D:.*]] = fir.load %[[D]] : !fir.ref>> -! HLFIR: %[[BOX_D:.*]] = fir.load %[[DECLD]]#1 : !fir.ref>> +! CHECK: %[[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_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) { @@ -298,12 +262,9 @@ subroutine acc_serial !$acc serial private(a) firstprivate(b) private(c) !$acc end serial -! 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_PRIVATE_A:.*]] = acc.private varPtr(%[[DECLA]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "a"} +! CHECK: %[[ACC_FPRIVATE_B:.*]] = acc.firstprivate varPtr(%[[DECLB]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "b"} +! CHECK: %[[ACC_PRIVATE_C:.*]] = acc.private varPtr(%[[DECLC]]#1 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {name = "c"} ! CHECK: acc.serial firstprivate(@firstprivatization_section_ext10xext10_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: }{{$}} -- 2.11.4.GIT