diff --git a/flang/test/Lower/OpenMP/FIR/array-bounds.f90 b/flang/test/Lower/OpenMP/FIR/array-bounds.f90 deleted file mode 100644 index c2bb7a94712bd..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/array-bounds.f90 +++ /dev/null @@ -1,121 +0,0 @@ -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes=HOST,ALL -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefixes=DEVICE,ALL - -!ALL-LABEL: func.func @_QPread_write_section( -!ALL: %[[ITER:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFread_write_sectionEi"} -!ALL: %[[READ:.*]] = fir.address_of(@_QFread_write_sectionEsp_read) : !fir.ref> -!ALL: %[[C10:.*]] = arith.constant 10 : index -!ALL: %[[WRITE:.*]] = fir.address_of(@_QFread_write_sectionEsp_write) : !fir.ref> -!ALL: %[[C10_0:.*]] = arith.constant 10 : index -!ALL: %[[C1:.*]] = arith.constant 1 : index -!ALL: %[[C2:.*]] = arith.constant 1 : index -!ALL: %[[C3:.*]] = arith.constant 4 : index -!ALL: %[[BOUNDS0:.*]] = omp.map.bounds lower_bound(%[[C2]] : index) upper_bound(%[[C3]] : index) extent(%[[C10]] : index) stride(%[[C1]] : index) start_idx(%[[C1]] : index) -!ALL: %[[MAP0:.*]] = omp.map.info var_ptr(%[[READ]] : !fir.ref>, !fir.array<10xi32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS0]]) -> !fir.ref> {name = "sp_read(2:5)"} -!ALL: %[[C4:.*]] = arith.constant 1 : index -!ALL: %[[C5:.*]] = arith.constant 1 : index -!ALL: %[[C6:.*]] = arith.constant 4 : index -!ALL: %[[BOUNDS1:.*]] = omp.map.bounds lower_bound(%[[C5]] : index) upper_bound(%[[C6]] : index) extent(%[[C10_0]] : index) stride(%[[C4]] : index) start_idx(%[[C4]] : index) -!ALL: %[[MAP1:.*]] = omp.map.info var_ptr(%[[WRITE]] : !fir.ref>, !fir.array<10xi32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS1]]) -> !fir.ref> {name = "sp_write(2:5)"} -!ALL: %[[MAP2:.*]] = omp.map.info var_ptr(%[[ITER]] : !fir.ref, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !fir.ref {name = "i"} -!ALL: omp.target map_entries(%[[MAP0]] -> %{{.*}}, %[[MAP1]] -> %{{.*}}, %[[MAP2]] -> %{{.*}} : !fir.ref>, !fir.ref>, !fir.ref) { - -subroutine read_write_section() - integer :: sp_read(10) = (/1,2,3,4,5,6,7,8,9,10/) - integer :: sp_write(10) = (/0,0,0,0,0,0,0,0,0,0/) - -!$omp target map(tofrom:sp_read(2:5)) map(tofrom:sp_write(2:5)) - do i = 2, 5 - sp_write(i) = sp_read(i) - end do -!$omp end target -end subroutine read_write_section - -module assumed_array_routines -contains -!ALL-LABEL: func.func @_QMassumed_array_routinesPassumed_shape_array( -!ALL-SAME: %[[ARG0:.*]]: !fir.box> {fir.bindc_name = "arr_read_write"}) -!ALL: %[[INTERMEDIATE_ALLOCA:.*]] = fir.alloca !fir.box> -!ALL: %[[ALLOCA:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QMassumed_array_routinesFassumed_shape_arrayEi"} -!ALL: %[[C0:.*]] = arith.constant 1 : index -!ALL: %[[C1:.*]] = arith.constant 0 : index -!ALL: %[[DIMS0:.*]]:3 = fir.box_dims %arg0, %[[C1]] : (!fir.box>, index) -> (index, index, index) -!ALL: %[[C3:.*]] = arith.constant 1 : index -!ALL: %[[C4:.*]] = arith.constant 4 : index -!ALL: %[[C0_1:.*]] = arith.constant 0 : index -!ALL: %[[DIMS1:.*]]:3 = fir.box_dims %arg0, %[[C0_1]] : (!fir.box>, index) -> (index, index, index) -!ALL: %[[BOUNDS:.*]] = omp.map.bounds lower_bound(%[[C3]] : index) upper_bound(%[[C4]] : index) extent(%[[DIMS1]]#1 : index) stride(%[[DIMS0]]#2 : index) start_idx(%[[C0]] : index) {stride_in_bytes = true} -!ALL: %[[BOXADDRADDR:.*]] = fir.box_offset %0 base_addr : (!fir.ref>>) -> !fir.llvm_ptr>> -!ALL: %[[MAP_MEMBER:.*]] = omp.map.info var_ptr(%0 : !fir.ref>>, !fir.array) var_ptr_ptr(%[[BOXADDRADDR]] : !fir.llvm_ptr>>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.llvm_ptr>> {name = ""} -!ALL: %[[MAP:.*]] = omp.map.info var_ptr(%0 : !fir.ref>>, !fir.box>) map_clauses(tofrom) capture(ByRef) members(%[[MAP_MEMBER]] : !fir.llvm_ptr>>) -> !fir.ref> {name = "arr_read_write(2:5)"} -!ALL: %[[MAP2:.*]] = omp.map.info var_ptr(%[[ALLOCA]] : !fir.ref, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !fir.ref {name = "i"} -!ALL: omp.target map_entries(%[[MAP_MEMBER]] -> %{{.*}}, %[[MAP]] -> %{{.*}}, %[[MAP2]] -> %{{.*}} : !fir.llvm_ptr>>, !fir.ref>, !fir.ref) { - subroutine assumed_shape_array(arr_read_write) - integer, intent(inout) :: arr_read_write(:) - - !$omp target map(tofrom:arr_read_write(2:5)) - do i = 2, 5 - arr_read_write(i) = i - end do - !$omp end target - end subroutine assumed_shape_array - -!ALL-LABEL: func.func @_QMassumed_array_routinesPassumed_size_array( -!ALL-SAME: %[[ARG0:.*]]: !fir.ref> {fir.bindc_name = "arr_read_write"}) -!ALL: %[[ALLOCA:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QMassumed_array_routinesFassumed_size_arrayEi"} -!ALL: %[[C0:.*]] = arith.constant 1 : index -!ALL: %[[C1:.*]] = arith.constant 1 : index -!ALL: %[[C2:.*]] = arith.constant 4 : index -!ALL: %[[DIFF:.*]] = arith.subi %[[C2]], %[[C1]] : index -!ALL: %[[EXT:.*]] = arith.addi %[[DIFF]], %[[C0]] : index -!ALL: %[[BOUNDS:.*]] = omp.map.bounds lower_bound(%[[C1]] : index) upper_bound(%[[C2]] : index) extent(%[[EXT]] : index) stride(%[[C0]] : index) start_idx(%[[C0]] : index) -!ALL: %[[MAP:.*]] = omp.map.info var_ptr(%[[ARG0]] : !fir.ref>, !fir.array) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "arr_read_write(2:5)"} -!ALL: %[[MAP2:.*]] = omp.map.info var_ptr(%[[ALLOCA]] : !fir.ref, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !fir.ref {name = "i"} -!ALL: omp.target map_entries(%[[MAP]] -> %{{.*}}, %[[MAP2]] -> %{{.*}} : !fir.ref>, !fir.ref) { - subroutine assumed_size_array(arr_read_write) - integer, intent(inout) :: arr_read_write(*) - - !$omp target map(tofrom:arr_read_write(2:5)) - do i = 2, 5 - arr_read_write(i) = i - end do - !$omp end target - end subroutine assumed_size_array -end module assumed_array_routines - -!DEVICE-NOT:func.func @_QPcall_assumed_shape_and_size_array() { - -!HOST-LABEL:func.func @_QPcall_assumed_shape_and_size_array() { -!HOST:%{{.*}} = arith.constant 20 : index -!HOST:%[[ALLOCA:.*]] = fir.alloca !fir.array<20xi32> {bindc_name = "arr_read_write", uniq_name = "_QFcall_assumed_shape_and_size_arrayEarr_read_write"} -!HOST:%{{.*}} = arith.constant 1 : i64 -!HOST:%{{.*}} = fir.convert %{{.*}} : (i64) -> index -!HOST:%{{.*}} = arith.constant 1 : i64 -!HOST:%{{.*}} = fir.convert %{{.*}} : (i64) -> index -!HOST:%{{.*}} = arith.constant 10 : i64 -!HOST:%{{.*}} = fir.convert %{{.*}} : (i64) -> index -!HOST:%[[SHAPE0:.*]] = fir.shape %{{.*}} : (index) -> !fir.shape<1> -!HOST:%[[SLICE0:.*]] = fir.slice %{{.*}}, %{{.*}}, %{{.*}} : (index, index, index) -> !fir.slice<1> -!HOST:%[[ARG0EMB:.*]] = fir.embox %[[ALLOCA]](%[[SHAPE0]]) [%[[SLICE0]]] : (!fir.ref>, !fir.shape<1>, !fir.slice<1>) -> !fir.box> -!HOST:%[[ARG0:.*]] = fir.convert %[[ARG0EMB]] : (!fir.box>) -> !fir.box> -!HOST:fir.call @_QMassumed_array_routinesPassumed_shape_array(%[[ARG0]]) fastmath : (!fir.box>) -> () -!HOST:%{{.*}} = arith.constant 10 : i64 -!HOST:%{{.*}} = fir.convert %{{.*}} : (i64) -> index -!HOST:%{{.*}} = arith.constant 1 : i64 -!HOST:%{{.*}} = fir.convert %{{.*}} : (i64) -> index -!HOST:%{{.*}} = arith.constant 20 : i64 -!HOST:%{{.*}} = fir.convert %{{.*}} : (i64) -> index -!HOST:%[[SHAPE1:.*]] = fir.shape %{{.*}} : (index) -> !fir.shape<1> -!HOST:%[[SLICE1:.*]] = fir.slice %{{.*}}, %{{.*}}, %{{.*}} : (index, index, index) -> !fir.slice<1> -!HOST:%[[ARG1EMB:.*]] = fir.embox %[[ALLOCA]](%[[SHAPE1]]) [%[[SLICE1]]] : (!fir.ref>, !fir.shape<1>, !fir.slice<1>) -> !fir.box> -!HOST:%[[ADDROF:.*]] = fir.box_addr %[[ARG1EMB]] : (!fir.box>) -> !fir.ref> -!HOST:%[[ARG1:.*]] = fir.convert %[[ADDROF]] : (!fir.ref>) -> !fir.ref> -!HOST:fir.call @_QMassumed_array_routinesPassumed_size_array(%[[ARG1]]) fastmath : (!fir.ref>) -> () -!HOST:return -!HOST:} -subroutine call_assumed_shape_and_size_array - use assumed_array_routines - integer :: arr_read_write(20) - call assumed_shape_array(arr_read_write(1:10)) - call assumed_size_array(arr_read_write(10:20)) -end subroutine call_assumed_shape_and_size_array diff --git a/flang/test/Lower/OpenMP/FIR/atomic-capture.f90 b/flang/test/Lower/OpenMP/FIR/atomic-capture.f90 deleted file mode 100644 index 9b94214b9da8b..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/atomic-capture.f90 +++ /dev/null @@ -1,119 +0,0 @@ -! REQUIRES: openmp_runtime - -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -! This test checks the lowering of atomic capture - -program OmpAtomicCapture - use omp_lib - integer :: x, y - -!CHECK: %[[X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFEx"} -!CHECK: %[[Y:.*]] = fir.alloca i32 {bindc_name = "y", uniq_name = "_QFEy"} -!CHECK: %[[temp:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: omp.atomic.capture memory_order(release) { -!CHECK: omp.atomic.read %[[X]] = %[[Y]] : !fir.ref -!CHECK: omp.atomic.update %[[Y]] : !fir.ref { -!CHECK: ^bb0(%[[ARG:.*]]: i32): -!CHECK: %[[result:.*]] = arith.addi %[[temp]], %[[ARG]] : i32 -!CHECK: omp.yield(%[[result]] : i32) -!CHECK: } -!CHECK: } - - !$omp atomic capture release - x = y - y = x + y - !$omp end atomic - - -!CHECK: %[[temp:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: omp.atomic.capture hint(uncontended) { -!CHECK: omp.atomic.update %[[Y]] : !fir.ref { -!CHECK: ^bb0(%[[ARG:.*]]: i32): -!CHECK: %[[result:.*]] = arith.muli %[[temp]], %[[ARG]] : i32 -!CHECK: omp.yield(%[[result]] : i32) -!CHECK: } -!CHECK: omp.atomic.read %[[X]] = %[[Y]] : !fir.ref -!CHECK: } - - !$omp atomic hint(omp_sync_hint_uncontended) capture - y = x * y - x = y - !$omp end atomic - -!CHECK: %[[constant_20:.*]] = arith.constant 20 : i32 -!CHECK: %[[constant_8:.*]] = arith.constant 8 : i32 -!CHECK: %[[temp:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: %[[result:.*]] = arith.subi %[[constant_8]], %[[temp]] : i32 -!CHECK: %[[result_noreassoc:.*]] = fir.no_reassoc %[[result]] : i32 -!CHECK: %[[result:.*]] = arith.addi %[[constant_20]], %[[result_noreassoc]] : i32 -!CHECK: omp.atomic.capture memory_order(acquire) hint(nonspeculative) { -!CHECK: omp.atomic.read %[[X]] = %[[Y]] : !fir.ref -!CHECK: omp.atomic.write %[[Y]] = %[[result]] : !fir.ref, i32 -!CHECK: } - - !$omp atomic hint(omp_lock_hint_nonspeculative) capture acquire - x = y - y = 2 * 10 + (8 - x) - !$omp end atomic - - -!CHECK: %[[constant_20:.*]] = arith.constant 20 : i32 -!CHECK: %[[constant_8:.*]] = arith.constant 8 : i32 -!CHECK: %[[temp:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: %[[result:.*]] = arith.subi %[[constant_8]], %[[temp]] : i32 -!CHECK: %[[result_noreassoc:.*]] = fir.no_reassoc %[[result]] : i32 -!CHECK: %[[result:.*]] = arith.addi %[[constant_20]], %[[result_noreassoc]] : i32 -!CHECK: omp.atomic.capture { -!CHECK: omp.atomic.read %[[X]] = %[[Y]] : !fir.ref -!CHECK: omp.atomic.write %[[Y]] = %[[result]] : !fir.ref, i32 -!CHECK: } - - !$omp atomic capture - x = y - y = 2 * 10 + (8 - x) - !$omp end atomic -end program - - - -subroutine pointers_in_atomic_capture() -!CHECK: %[[A:.*]] = fir.alloca !fir.box> {bindc_name = "a", uniq_name = "_QFpointers_in_atomic_captureEa"} -!CHECK: {{.*}} = fir.zero_bits !fir.ptr -!CHECK: {{.*}} = fir.embox {{.*}} : (!fir.ptr) -> !fir.box> -!CHECK: fir.store {{.*}} to %[[A]] : !fir.ref>> -!CHECK: %[[B:.*]] = fir.alloca !fir.box> {bindc_name = "b", uniq_name = "_QFpointers_in_atomic_captureEb"} -!CHECK: {{.*}} = fir.zero_bits !fir.ptr -!CHECK: {{.*}} = fir.embox {{.*}} : (!fir.ptr) -> !fir.box> -!CHECK: fir.store {{.*}} to %[[B]] : !fir.ref>> -!CHECK: %[[C:.*]] = fir.alloca i32 {bindc_name = "c", fir.target, uniq_name = "_QFpointers_in_atomic_captureEc"} -!CHECK: %[[D:.*]] = fir.alloca i32 {bindc_name = "d", fir.target, uniq_name = "_QFpointers_in_atomic_captureEd"} -!CHECK: {{.*}} = fir.embox {{.*}} : (!fir.ref) -> !fir.box> -!CHECK: fir.store {{.*}} to %[[A]] : !fir.ref>> -!CHECK: {{.*}} = fir.embox {{.*}} : (!fir.ref) -> !fir.box> -!CHECK: fir.store {{.*}} to %[[B]] : !fir.ref>> -!CHECK: %[[loaded_A:.*]] = fir.load %[[A]] : !fir.ref>> -!CHECK: %[[loaded_A_addr:.*]] = fir.box_addr %[[loaded_A]] : (!fir.box>) -> !fir.ptr -!CHECK: %[[loaded_B:.*]] = fir.load %[[B]] : !fir.ref>> -!CHECK: %[[loaded_B_addr:.*]] = fir.box_addr %[[loaded_B]] : (!fir.box>) -> !fir.ptr -!CHECK: %[[PRIVATE_LOADED_B:.*]] = fir.load %[[B]] : !fir.ref>> -!CHECK: %[[PRIVATE_LOADED_B_addr:.*]] = fir.box_addr %[[PRIVATE_LOADED_B]] : (!fir.box>) -> !fir.ptr -!CHECK: %[[loaded_value:.*]] = fir.load %[[PRIVATE_LOADED_B_addr]] : !fir.ptr -!CHECK: omp.atomic.capture { -!CHECK: omp.atomic.update %[[loaded_A_addr]] : !fir.ptr { -!CHECK: ^bb0(%[[ARG:.*]]: i32): -!CHECK: %[[result:.*]] = arith.addi %[[ARG]], %[[loaded_value]] : i32 -!CHECK: omp.yield(%[[result]] : i32) -!CHECK: } -!CHECK: omp.atomic.read %[[loaded_B_addr]] = %[[loaded_A_addr]] : !fir.ptr, i32 -!CHECK: } - integer, pointer :: a, b - integer, target :: c, d - a=>c - b=>d - - !$omp atomic capture - a = a + b - b = a - !$omp end atomic -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/atomic-read.f90 b/flang/test/Lower/OpenMP/FIR/atomic-read.f90 deleted file mode 100644 index 7698c3d7490fe..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/atomic-read.f90 +++ /dev/null @@ -1,80 +0,0 @@ -! REQUIRES: openmp_runtime - -! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s - -! This test checks the lowering of atomic read - -!CHECK: func @_QQmain() attributes {fir.bindc_name = "ompatomic"} { -!CHECK: %[[VAR_A:.*]] = fir.alloca !fir.char<1> {bindc_name = "a", uniq_name = "_QFEa"} -!CHECK: %[[VAR_B:.*]] = fir.alloca !fir.char<1> {bindc_name = "b", uniq_name = "_QFEb"} -!CHECK: %[[VAR_C:.*]] = fir.alloca !fir.logical<4> {bindc_name = "c", uniq_name = "_QFEc"} -!CHECK: %[[VAR_D:.*]] = fir.alloca !fir.logical<4> {bindc_name = "d", uniq_name = "_QFEd"} -!CHECK: %[[VAR_E:.*]] = fir.alloca !fir.char<1,8> {bindc_name = "e", uniq_name = "_QFEe"} -!CHECK: %[[VAR_F:.*]] = fir.alloca !fir.char<1,8> {bindc_name = "f", uniq_name = "_QFEf"} -!CHECK: %[[VAR_G:.*]] = fir.alloca f32 {bindc_name = "g", uniq_name = "_QFEg"} -!CHECK: %[[VAR_H:.*]] = fir.alloca f32 {bindc_name = "h", uniq_name = "_QFEh"} -!CHECK: %[[VAR_X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFEx"} -!CHECK: %[[VAR_Y:.*]] = fir.alloca i32 {bindc_name = "y", uniq_name = "_QFEy"} -!CHECK: omp.atomic.read %[[VAR_X]] = %[[VAR_Y]] memory_order(acquire) hint(uncontended) : !fir.ref, i32 -!CHECK: omp.atomic.read %[[VAR_A]] = %[[VAR_B]] memory_order(relaxed) : !fir.ref>, !fir.char<1> -!CHECK: omp.atomic.read %[[VAR_C]] = %[[VAR_D]] memory_order(seq_cst) hint(contended) : !fir.ref>, !fir.logical<4> -!CHECK: omp.atomic.read %[[VAR_E]] = %[[VAR_F]] hint(speculative) : !fir.ref>, !fir.char<1,8> -!CHECK: omp.atomic.read %[[VAR_G]] = %[[VAR_H]] hint(nonspeculative) : !fir.ref, f32 -!CHECK: omp.atomic.read %[[VAR_G]] = %[[VAR_H]] : !fir.ref, f32 -!CHECK: return -!CHECK: } - -program OmpAtomic - - use omp_lib - integer :: x, y - character :: a, b - logical :: c, d - character(8) :: e, f - real g, h - !$omp atomic acquire read hint(omp_sync_hint_uncontended) - x = y - !$omp atomic relaxed read hint(omp_sync_hint_none) - a = b - !$omp atomic read seq_cst hint(omp_sync_hint_contended) - c = d - !$omp atomic read hint(omp_sync_hint_speculative) - e = f - !$omp atomic read hint(omp_sync_hint_nonspeculative) - g = h - !$omp atomic read - g = h -end program OmpAtomic - -! Test lowering atomic read for pointer variables. -! Please notice to use %[[VAL_4]] and %[[VAL_1]] for operands of atomic -! operation, instead of %[[VAL_3]] and %[[VAL_0]]. - -!CHECK-LABEL: func.func @_QPatomic_read_pointer() { -!CHECK: %[[VAL_0:.*]] = fir.alloca !fir.box> {bindc_name = "x", uniq_name = "_QFatomic_read_pointerEx"} -!CHECK: %[[VAL_1:.*]] = fir.alloca !fir.ptr {uniq_name = "_QFatomic_read_pointerEx.addr"} -!CHECK: %[[VAL_2:.*]] = fir.zero_bits !fir.ptr -!CHECK: fir.store %[[VAL_2]] to %[[VAL_1]] : !fir.ref> -!CHECK: %[[VAL_3:.*]] = fir.alloca !fir.box> {bindc_name = "y", uniq_name = "_QFatomic_read_pointerEy"} -!CHECK: %[[VAL_4:.*]] = fir.alloca !fir.ptr {uniq_name = "_QFatomic_read_pointerEy.addr"} -!CHECK: %[[VAL_5:.*]] = fir.zero_bits !fir.ptr -!CHECK: fir.store %[[VAL_5]] to %[[VAL_4]] : !fir.ref> -!CHECK: %[[VAL_6:.*]] = fir.load %[[VAL_1]] : !fir.ref> -!CHECK: %[[VAL_7:.*]] = fir.load %[[VAL_4]] : !fir.ref> -!CHECK: omp.atomic.read %[[VAL_7]] = %[[VAL_6]] : !fir.ptr, i32 -!CHECK: %[[VAL_8:.*]] = fir.load %[[VAL_4]] : !fir.ref> -!CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_8]] : !fir.ptr -!CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_1]] : !fir.ref> -!CHECK: fir.store %[[VAL_9]] to %[[VAL_10]] : !fir.ptr -!CHECK: return -!CHECK: } - -subroutine atomic_read_pointer() - integer, pointer :: x, y - - !$omp atomic read - y = x - - x = y -end - diff --git a/flang/test/Lower/OpenMP/FIR/atomic-update.f90 b/flang/test/Lower/OpenMP/FIR/atomic-update.f90 deleted file mode 100644 index ae201807c337f..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/atomic-update.f90 +++ /dev/null @@ -1,141 +0,0 @@ -! REQUIRES: openmp_runtime - -! This test checks lowering of atomic and atomic update constructs -! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s -! RUN: %flang_fc1 -mllvm --use-desc-for-alloc=false -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -program OmpAtomicUpdate - use omp_lib - integer :: x, y, z - integer, pointer :: a, b - integer, target :: c, d - integer(1) :: i1 - - a=>c - b=>d - -!CHECK: func.func @_QQmain() attributes {fir.bindc_name = "ompatomicupdate"} { -!CHECK: %[[A:.*]] = fir.alloca !fir.box> {bindc_name = "a", uniq_name = "_QFEa"} -!CHECK: %[[A_ADDR:.*]] = fir.alloca !fir.ptr {uniq_name = "_QFEa.addr"} -!CHECK: %{{.*}} = fir.zero_bits !fir.ptr -!CHECK: fir.store %{{.*}} to %[[A_ADDR]] : !fir.ref> -!CHECK: %[[B:.*]] = fir.alloca !fir.box> {bindc_name = "b", uniq_name = "_QFEb"} -!CHECK: %[[B_ADDR:.*]] = fir.alloca !fir.ptr {uniq_name = "_QFEb.addr"} -!CHECK: %{{.*}} = fir.zero_bits !fir.ptr -!CHECK: fir.store %{{.*}} to %[[B_ADDR]] : !fir.ref> -!CHECK: %[[C_ADDR:.*]] = fir.address_of(@_QFEc) : !fir.ref -!CHECK: %[[D_ADDR:.*]] = fir.address_of(@_QFEd) : !fir.ref -!CHECK: %[[I1:.*]] = fir.alloca i8 {bindc_name = "i1", uniq_name = "_QFEi1"} -!CHECK: %[[X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFEx"} -!CHECK: %[[Y:.*]] = fir.alloca i32 {bindc_name = "y", uniq_name = "_QFEy"} -!CHECK: %[[Z:.*]] = fir.alloca i32 {bindc_name = "z", uniq_name = "_QFEz"} -!CHECK: %{{.*}} = fir.convert %[[C_ADDR]] : (!fir.ref) -> !fir.ptr -!CHECK: fir.store %{{.*}} to %[[A_ADDR]] : !fir.ref> -!CHECK: %{{.*}} = fir.convert %[[D_ADDR]] : (!fir.ref) -> !fir.ptr -!CHECK: fir.store {{.*}} to %[[B_ADDR]] : !fir.ref> -!CHECK: %[[LOADED_A:.*]] = fir.load %[[A_ADDR]] : !fir.ref> -!CHECK: %[[LOADED_B:.*]] = fir.load %[[B_ADDR]] : !fir.ref> -!CHECK: %{{.*}} = fir.load %[[LOADED_B]] : !fir.ptr -!CHECK: omp.atomic.update %[[LOADED_A]] : !fir.ptr { -!CHECK: ^bb0(%[[ARG:.*]]: i32): -!CHECK: %[[RESULT:.*]] = arith.addi %[[ARG]], %{{.*}} : i32 -!CHECK: omp.yield(%[[RESULT]] : i32) -!CHECK: } - !$omp atomic update - a = a + b - -!CHECK: {{.*}} = arith.constant 1 : i32 -!CHECK: omp.atomic.update %[[Y]] : !fir.ref { -!CHECK: ^bb0(%[[ARG:.*]]: i32): -!CHECK: %[[RESULT:.*]] = arith.addi %[[ARG]], {{.*}} : i32 -!CHECK: omp.yield(%[[RESULT]] : i32) -!CHECK: } -!CHECK: %[[LOADED_X:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: omp.atomic.update %[[Z]] : !fir.ref { -!CHECK: ^bb0(%[[ARG:.*]]: i32): -!CHECK: %[[RESULT:.*]] = arith.muli %[[LOADED_X]], %[[ARG]] : i32 -!CHECK: omp.yield(%[[RESULT]] : i32) -!CHECK: } - !$omp atomic - y = y + 1 - !$omp atomic update - z = x * z - -!CHECK: %{{.*}} = arith.constant 1 : i32 -!CHECK: omp.atomic.update memory_order(relaxed) hint(uncontended) %[[X]] : !fir.ref { -!CHECK: ^bb0(%[[ARG:.*]]: i32): -!CHECK: %[[RESULT:.*]] = arith.subi %[[ARG]], {{.*}} : i32 -!CHECK: omp.yield(%[[RESULT]] : i32) -!CHECK: } -!CHECK: %[[LOADED_X:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: %[[LOADED_Z:.*]] = fir.load %[[Z]] : !fir.ref -!CHECK: omp.atomic.update memory_order(relaxed) %[[Y]] : !fir.ref { -!CHECK: ^bb0(%[[ARG:.*]]: i32): -!CHECK: %{{.*}} = arith.cmpi sgt, %[[ARG]], %[[LOADED_X]] : i32 -!CHECK: %{{.*}} = arith.select %{{.*}}, %[[ARG]], %[[LOADED_X]] : i32 -!CHECK: %{{.*}} = arith.cmpi sgt, %{{.*}}, %[[LOADED_Z]] : i32 -!CHECK: %[[RESULT:.*]] = arith.select %{{.*}}, %{{.*}}, %[[LOADED_Z]] : i32 -!CHECK: omp.yield(%[[RESULT]] : i32) -!CHECK: } -!CHECK: %[[LOADED_X:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: omp.atomic.update memory_order(relaxed) hint(contended) %[[Z]] : !fir.ref { -!CHECK: ^bb0(%[[ARG:.*]]: i32): -!CHECK: %[[RESULT:.*]] = arith.addi %[[ARG]], %[[LOADED_X]] : i32 -!CHECK: omp.yield(%[[RESULT]] : i32) -!CHECK: } - !$omp atomic relaxed update hint(omp_sync_hint_uncontended) - x = x - 1 - !$omp atomic update relaxed - y = max(y, x, z) - !$omp atomic relaxed hint(omp_sync_hint_contended) - z = z + x - -!CHECK: %{{.*}} = arith.constant 10 : i32 -!CHECK: omp.atomic.update memory_order(release) hint(contended) %[[Z]] : !fir.ref { -!CHECK: ^bb0(%[[ARG:.*]]: i32): -!CHECK: %[[RESULT:.*]] = arith.muli {{.*}}, %[[ARG]] : i32 -!CHECK: omp.yield(%[[RESULT]] : i32) -!CHECK: } -!CHECK: %[[LOADED_Z:.*]] = fir.load %[[Z]] : !fir.ref -!CHECK: omp.atomic.update memory_order(release) hint(speculative) %[[X]] : !fir.ref { -!CHECK: ^bb0(%[[ARG:.*]]: i32): -!CHECK: %[[RESULT:.*]] = arith.divsi %[[ARG]], %[[LOADED_Z]] : i32 -!CHECK: omp.yield(%[[RESULT]] : i32) -!CHECK: } - - !$omp atomic release update hint(omp_lock_hint_contended) - z = z * 10 - !$omp atomic hint(omp_lock_hint_speculative) update release - x = x / z - -!CHECK: %{{.*}} = arith.constant 10 : i32 -!CHECK: omp.atomic.update memory_order(seq_cst) hint(nonspeculative) %[[Y]] : !fir.ref { -!CHECK: ^bb0(%[[ARG:.*]]: i32): -!CHECK: %[[RESULT:.*]] = arith.addi %{{.*}}, %[[ARG]] : i32 -!CHECK: omp.yield(%[[RESULT]] : i32) -!CHECK: } -!CHECK: %[[LOADED_Y:.*]] = fir.load %[[Y]] : !fir.ref -!CHECK: omp.atomic.update memory_order(seq_cst) %[[Z]] : !fir.ref { -!CHECK: ^bb0(%[[ARG:.*]]: i32): -!CHECK: %[[RESULT:.*]] = arith.addi %[[LOADED_Y]], %[[ARG]] : i32 -!CHECK: omp.yield(%[[RESULT]] : i32) -!CHECK: } - !$omp atomic hint(omp_sync_hint_nonspeculative) seq_cst - y = 10 + y - !$omp atomic seq_cst update - z = y + z - -!CHECK: %[[C1_VAL:.*]] = arith.constant 1 : i32 -!CHECK: omp.atomic.update %[[I1]] : !fir.ref { -!CHECK: ^bb0(%[[VAL:.*]]: i8): -!CHECK: %[[CVT_VAL:.*]] = fir.convert %[[VAL]] : (i8) -> i32 -!CHECK: %[[ADD_VAL:.*]] = arith.addi %[[CVT_VAL]], %[[C1_VAL]] : i32 -!CHECK: %[[UPDATED_VAL:.*]] = fir.convert %[[ADD_VAL]] : (i32) -> i8 -!CHECK: omp.yield(%[[UPDATED_VAL]] : i8) -!CHECK: } - !$omp atomic - i1 = i1 + 1 - !$omp end atomic -!CHECK: return -!CHECK: } -end program OmpAtomicUpdate diff --git a/flang/test/Lower/OpenMP/FIR/atomic-write.f90 b/flang/test/Lower/OpenMP/FIR/atomic-write.f90 deleted file mode 100644 index 142481b7a1d21..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/atomic-write.f90 +++ /dev/null @@ -1,77 +0,0 @@ -! REQUIRES: openmp_runtime - -! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s - -! This test checks the lowering of atomic write - -!CHECK: func @_QQmain() attributes {fir.bindc_name = "ompatomicwrite"} { -!CHECK: %[[VAR_X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFEx"} -!CHECK: %[[VAR_Y:.*]] = fir.alloca i32 {bindc_name = "y", uniq_name = "_QFEy"} -!CHECK: %[[VAR_Z:.*]] = fir.alloca i32 {bindc_name = "z", uniq_name = "_QFEz"} -!CHECK: %[[CONST_44:.*]] = arith.constant 44 : i32 -!CHECK: omp.atomic.write %[[VAR_X]] = %[[CONST_44]] hint(uncontended) memory_order(seq_cst) : !fir.ref, i32 -!CHECK: %[[CONST_7:.*]] = arith.constant 7 : i32 -!CHECK: {{.*}} = fir.load %[[VAR_Y]] : !fir.ref -!CHECK: %[[VAR_7y:.*]] = arith.muli %[[CONST_7]], {{.*}} : i32 -!CHECK: omp.atomic.write %[[VAR_X]] = %[[VAR_7y]] memory_order(relaxed) : !fir.ref, i32 -!CHECK: %[[CONST_10:.*]] = arith.constant 10 : i32 -!CHECK: {{.*}} = fir.load %[[VAR_X]] : !fir.ref -!CHECK: {{.*}} = arith.muli %[[CONST_10]], {{.*}} : i32 -!CHECK: {{.*}} = fir.load %[[VAR_Z]] : !fir.ref -!CHECK: %[[CONST_2:.*]] = arith.constant 2 : i32 -!CHECK: {{.*}} = arith.divsi {{.*}}, %[[CONST_2]] : i32 -!CHECK: {{.*}} = arith.addi {{.*}}, {{.*}} : i32 -!CHECK: omp.atomic.write %[[VAR_Y]] = {{.*}} hint(speculative) memory_order(release) : !fir.ref, i32 -!CHECK: return -!CHECK: } - -program OmpAtomicWrite - use omp_lib - integer :: x, y, z - !$omp atomic seq_cst write hint(omp_sync_hint_uncontended) - x = 8*4 + 12 - - !$omp atomic write relaxed - x = 7 * y - - !$omp atomic write release hint(omp_sync_hint_speculative) - y = 10*x + z/2 -end program OmpAtomicWrite - -! Test lowering atomic read for pointer variables. -! Please notice to use %[[VAL_1]] for operands of atomic operation, instead -! of %[[VAL_0]]. - -!CHECK-LABEL: func.func @_QPatomic_write_pointer() { -!CHECK: %[[VAL_0:.*]] = fir.alloca !fir.box> {bindc_name = "x", uniq_name = "_QFatomic_write_pointerEx"} -!CHECK: %[[VAL_1:.*]] = fir.alloca !fir.ptr {uniq_name = "_QFatomic_write_pointerEx.addr"} -!CHECK: %[[VAL_2:.*]] = fir.zero_bits !fir.ptr -!CHECK: fir.store %[[VAL_2]] to %[[VAL_1]] : !fir.ref> -!CHECK: %[[VAL_3:.*]] = arith.constant 1 : i32 -!CHECK: %[[VAL_4:.*]] = fir.load %[[VAL_1]] : !fir.ref> -!CHECK: omp.atomic.write %[[VAL_4]] = %[[VAL_3]] : !fir.ptr, i32 -!CHECK: %[[VAL_5:.*]] = arith.constant 2 : i32 -!CHECK: %[[VAL_6:.*]] = fir.load %[[VAL_1]] : !fir.ref> -!CHECK: fir.store %[[VAL_5]] to %[[VAL_6]] : !fir.ptr -!CHECK: return -!CHECK: } - -subroutine atomic_write_pointer() - integer, pointer :: x - - !$omp atomic write - x = 1 - - x = 2 -end - -!CHECK-LABEL: func.func @_QPatomic_write_typed_assign -!CHECK: %[[VAR:.*]] = fir.alloca f32 {bindc_name = "r2", uniq_name = "{{.*}}r2"} -!CHECK: %[[CST:.*]] = arith.constant 0.000000e+00 : f32 -!CHECK: omp.atomic.write %[[VAR]] = %[[CST]] : !fir.ref, f32 - -subroutine atomic_write_typed_assign - real :: r2 - !$omp atomic write - r2 = 0 -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/copyin.f90 b/flang/test/Lower/OpenMP/FIR/copyin.f90 deleted file mode 100644 index e256404d3d55c..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/copyin.f90 +++ /dev/null @@ -1,358 +0,0 @@ -! This test checks lowering of `COPYIN` clause. -! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -! CHECK-LABEL: func.func @_QPcopyin_scalar_array() { -! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QFcopyin_scalar_arrayEx1) : !fir.ref -! CHECK: %[[VAL_1:.*]] = omp.threadprivate %[[VAL_0]] : !fir.ref -> !fir.ref -! CHECK: %[[VAL_2:.*]] = fir.address_of(@_QFcopyin_scalar_arrayEx2) : !fir.ref> -! CHECK: %[[VAL_3:.*]] = arith.constant 10 : index -! CHECK: %[[VAL_4:.*]] = omp.threadprivate %[[VAL_2]] : !fir.ref> -> !fir.ref> -! CHECK: omp.parallel { -! CHECK: %[[VAL_5:.*]] = omp.threadprivate %[[VAL_0]] : !fir.ref -> !fir.ref -! CHECK: %[[VAL_6:.*]] = fir.load %[[VAL_1]] : !fir.ref -! CHECK: fir.store %[[VAL_6]] to %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_7:.*]] = omp.threadprivate %[[VAL_2]] : !fir.ref> -> !fir.ref> -! CHECK: %[[VAL_8:.*]] = fir.shape %[[VAL_3]] : (index) -> !fir.shape<1> -! CHECK: %[[VAL_9:.*]] = fir.array_load %[[VAL_7]](%[[VAL_8]]) : (!fir.ref>, !fir.shape<1>) -> !fir.array<10xi64> -! CHECK: %[[VAL_10:.*]] = fir.shape %[[VAL_3]] : (index) -> !fir.shape<1> -! CHECK: %[[VAL_11:.*]] = fir.array_load %[[VAL_4]](%[[VAL_10]]) : (!fir.ref>, !fir.shape<1>) -> !fir.array<10xi64> -! CHECK: %[[VAL_12:.*]] = arith.constant 1 : index -! CHECK: %[[VAL_13:.*]] = arith.constant 0 : index -! CHECK: %[[VAL_14:.*]] = arith.subi %[[VAL_3]], %[[VAL_12]] : index -! CHECK: %[[VAL_15:.*]] = fir.do_loop %[[VAL_16:.*]] = %[[VAL_13]] to %[[VAL_14]] step %[[VAL_12]] unordered iter_args(%[[VAL_17:.*]] = %[[VAL_9]]) -> (!fir.array<10xi64>) { -! CHECK: %[[VAL_18:.*]] = fir.array_fetch %[[VAL_11]], %[[VAL_16]] : (!fir.array<10xi64>, index) -> i64 -! CHECK: %[[VAL_19:.*]] = fir.array_update %[[VAL_17]], %[[VAL_18]], %[[VAL_16]] : (!fir.array<10xi64>, i64, index) -> !fir.array<10xi64> -! CHECK: fir.result %[[VAL_19]] : !fir.array<10xi64> -! CHECK: } -! CHECK: fir.array_merge_store %[[VAL_9]], %[[VAL_20:.*]] to %[[VAL_7]] : !fir.array<10xi64>, !fir.array<10xi64>, !fir.ref> -! CHECK: omp.barrier -! CHECK: fir.call @_QPsub1(%[[VAL_5]], %[[VAL_7]]) {{.*}}: (!fir.ref, !fir.ref>) -> () -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine copyin_scalar_array() - integer(kind=4), save :: x1 - integer(kind=8), save :: x2(10) - !$omp threadprivate(x1, x2) - - !$omp parallel copyin(x1) copyin(x2) - call sub1(x1, x2) - !$omp end parallel - -end - -! CHECK-LABEL: func.func @_QPcopyin_char_chararray() { -! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QFcopyin_char_chararrayEx3) : !fir.ref> -! CHECK: %[[VAL_1:.*]] = arith.constant 5 : index -! CHECK: %[[VAL_2:.*]] = omp.threadprivate %[[VAL_0]] : !fir.ref> -> !fir.ref> -! CHECK: %[[VAL_3:.*]] = fir.address_of(@_QFcopyin_char_chararrayEx4) : !fir.ref>> -! CHECK: %[[VAL_4:.*]] = arith.constant 5 : index -! CHECK: %[[VAL_5:.*]] = arith.constant 10 : index -! CHECK: %[[VAL_6:.*]] = omp.threadprivate %[[VAL_3]] : !fir.ref>> -> !fir.ref>> -! CHECK: omp.parallel { -! CHECK: %[[VAL_7:.*]] = omp.threadprivate %[[VAL_0]] : !fir.ref> -> !fir.ref> -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_9:.*]] = fir.convert %[[VAL_1]] : (index) -> i64 -! CHECK: %[[VAL_10:.*]] = arith.muli %[[VAL_8]], %[[VAL_9]] : i64 -! CHECK: %[[VAL_11:.*]] = arith.constant false -! CHECK: %[[VAL_12:.*]] = fir.convert %[[VAL_7]] : (!fir.ref>) -> !fir.ref -! CHECK: %[[VAL_13:.*]] = fir.convert %[[VAL_2]] : (!fir.ref>) -> !fir.ref -! CHECK: fir.call @llvm.memmove.p0.p0.i64(%[[VAL_12]], %[[VAL_13]], %[[VAL_10]], %[[VAL_11]]) {{.*}}: (!fir.ref, !fir.ref, i64, i1) -> () -! CHECK: %[[VAL_14:.*]] = omp.threadprivate %[[VAL_3]] : !fir.ref>> -> !fir.ref>> -! CHECK: %[[VAL_15:.*]] = fir.shape %[[VAL_5]] : (index) -> !fir.shape<1> -! CHECK: %[[VAL_16:.*]] = fir.array_load %[[VAL_14]](%[[VAL_15]]) : (!fir.ref>>, !fir.shape<1>) -> !fir.array<10x!fir.char<1,5>> -! CHECK: %[[VAL_17:.*]] = fir.shape %[[VAL_5]] : (index) -> !fir.shape<1> -! CHECK: %[[VAL_18:.*]] = fir.array_load %[[VAL_6]](%[[VAL_17]]) : (!fir.ref>>, !fir.shape<1>) -> !fir.array<10x!fir.char<1,5>> -! CHECK: %[[VAL_19:.*]] = arith.constant 1 : index -! CHECK: %[[VAL_20:.*]] = arith.constant 0 : index -! CHECK: %[[VAL_21:.*]] = arith.subi %[[VAL_5]], %[[VAL_19]] : index -! CHECK: %[[VAL_22:.*]] = fir.do_loop %[[VAL_23:.*]] = %[[VAL_20]] to %[[VAL_21]] step %[[VAL_19]] unordered iter_args(%[[VAL_24:.*]] = %[[VAL_16]]) -> (!fir.array<10x!fir.char<1,5>>) { -! CHECK: %[[VAL_25:.*]] = fir.array_access %[[VAL_18]], %[[VAL_23]] : (!fir.array<10x!fir.char<1,5>>, index) -> !fir.ref> -! CHECK: %[[VAL_26:.*]] = fir.array_access %[[VAL_24]], %[[VAL_23]] : (!fir.array<10x!fir.char<1,5>>, index) -> !fir.ref> -! CHECK: %[[VAL_27:.*]] = arith.constant 5 : index -! CHECK: %[[VAL_28:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_29:.*]] = fir.convert %[[VAL_27]] : (index) -> i64 -! CHECK: %[[VAL_30:.*]] = arith.muli %[[VAL_28]], %[[VAL_29]] : i64 -! CHECK: %[[VAL_31:.*]] = arith.constant false -! CHECK: %[[VAL_32:.*]] = fir.convert %[[VAL_26]] : (!fir.ref>) -> !fir.ref -! CHECK: %[[VAL_33:.*]] = fir.convert %[[VAL_25]] : (!fir.ref>) -> !fir.ref -! CHECK: fir.call @llvm.memmove.p0.p0.i64(%[[VAL_32]], %[[VAL_33]], %[[VAL_30]], %[[VAL_31]]) {{.*}}: (!fir.ref, !fir.ref, i64, i1) -> () -! CHECK: %[[VAL_34:.*]] = fir.array_amend %[[VAL_24]], %[[VAL_26]] : (!fir.array<10x!fir.char<1,5>>, !fir.ref>) -> !fir.array<10x!fir.char<1,5>> -! CHECK: fir.result %[[VAL_34]] : !fir.array<10x!fir.char<1,5>> -! CHECK: } -! CHECK: fir.array_merge_store %[[VAL_16]], %[[VAL_35:.*]] to %[[VAL_14]] : !fir.array<10x!fir.char<1,5>>, !fir.array<10x!fir.char<1,5>>, !fir.ref>> -! CHECK: omp.barrier -! CHECK: %[[VAL_37:.*]] = fir.emboxchar %[[VAL_7]], %[[VAL_1]] : (!fir.ref>, index) -> !fir.boxchar<1> -! CHECK: %[[VAL_38:.*]] = fir.convert %[[VAL_14]] : (!fir.ref>>) -> !fir.ref> -! CHECK: %[[VAL_39:.*]] = fir.emboxchar %[[VAL_38]], %[[VAL_4]] : (!fir.ref>, index) -> !fir.boxchar<1> -! CHECK: fir.call @_QPsub2(%[[VAL_37]], %[[VAL_39]]) {{.*}}: (!fir.boxchar<1>, !fir.boxchar<1>) -> () -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine copyin_char_chararray() - character(5), save :: x3, x4(10) - !$omp threadprivate(x3, x4) - - !$omp parallel copyin(x3) copyin(x4) - call sub2(x3, x4) - !$omp end parallel - -end - -! CHECK-LABEL: func.func @_QPcopyin_derived_type() { -! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QFcopyin_derived_typeEx5) : !fir.ref}>> -! CHECK: %[[VAL_1:.*]] = omp.threadprivate %[[VAL_0]] : !fir.ref}>> -> !fir.ref}>> -! CHECK: omp.parallel { -! CHECK: %[[VAL_2:.*]] = omp.threadprivate %[[VAL_0]] : !fir.ref}>> -> !fir.ref}>> -! CHECK: %[[VAL_3:.*]] = fir.load %[[VAL_1]] : !fir.ref}>> -! CHECK: fir.store %[[VAL_3]] to %[[VAL_2]] : !fir.ref}>> -! CHECK: omp.barrier -! CHECK: fir.call @_QPsub3(%[[VAL_2]]) {{.*}}: (!fir.ref}>>) -> () -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine copyin_derived_type() - type my_type - integer :: t_i - integer :: t_arr(5) - end type my_type - type(my_type), save :: x5 - !$omp threadprivate(x5) - - !$omp parallel copyin(x5) - call sub3(x5) - !$omp end parallel - -end - -! CHECK-LABEL: func.func @_QPcombined_parallel_worksharing_loop() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFcombined_parallel_worksharing_loopEi"} -! CHECK: %[[VAL_1:.*]] = fir.address_of(@_QFcombined_parallel_worksharing_loopEx6) : !fir.ref -! CHECK: %[[VAL_2:.*]] = omp.threadprivate %[[VAL_1]] : !fir.ref -> !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_3:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_4:.*]] = omp.threadprivate %[[VAL_1]] : !fir.ref -> !fir.ref -! CHECK: %[[VAL_5:.*]] = fir.load %[[VAL_2]] : !fir.ref -! CHECK: fir.store %[[VAL_5]] to %[[VAL_4]] : !fir.ref -! CHECK: omp.barrier -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_7:.*]] = fir.load %[[VAL_4]] : !fir.ref -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop { -! CHECK-NEXT: omp.loop_nest (%[[VAL_9:.*]]) : i32 = (%[[VAL_6]]) to (%[[VAL_7]]) inclusive step (%[[VAL_8]]) { -! CHECK: fir.store %[[VAL_9]] to %[[VAL_3]] : !fir.ref -! CHECK: fir.call @_QPsub4(%[[VAL_4]]) {{.*}}: (!fir.ref) -> () -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine combined_parallel_worksharing_loop() - integer, save :: x6 - !$omp threadprivate(x6) - - !$omp parallel do copyin(x6) - do i=1, x6 - call sub4(x6) - end do - !$omp end parallel do - -end - -! CHECK-LABEL: func.func @_QPcombined_parallel_sections() { -! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QFcombined_parallel_sectionsEx7) : !fir.ref -! CHECK: %[[VAL_1:.*]] = omp.threadprivate %[[VAL_0]] : !fir.ref -> !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_2:.*]] = omp.threadprivate %[[VAL_0]] : !fir.ref -> !fir.ref -! CHECK: %[[VAL_3:.*]] = fir.load %[[VAL_1]] : !fir.ref -! CHECK: fir.store %[[VAL_3]] to %[[VAL_2]] : !fir.ref -! CHECK: omp.barrier -! CHECK: omp.sections { -! CHECK: omp.section { -! CHECK: fir.call @_QPsub5(%[[VAL_2]]) {{.*}}: (!fir.ref) -> () -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.section { -! CHECK: fir.call @_QPsub6(%[[VAL_2]]) {{.*}}: (!fir.ref) -> () -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine combined_parallel_sections() - integer, save :: x7 - !$omp threadprivate(x7) - - !$omp parallel sections copyin(x7) - !$omp section - call sub5(x7) - !$omp section - call sub6(x7) - !$omp end parallel sections - -end - - -!CHECK: func.func @_QPcommon_1() { -!CHECK: %[[val_0:.*]] = fir.address_of(@c_) : !fir.ref> -!CHECK: %[[val_1:.*]] = omp.threadprivate %[[val_0]] : !fir.ref> -> !fir.ref> -!CHECK: %[[val_2:.*]] = fir.convert %[[val_1]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c0:.*]] = arith.constant 0 : index -!CHECK: %[[val_3:.*]] = fir.coordinate_of %[[val_2]], %[[val_c0]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_4:.*]] = fir.convert %[[val_3]] : (!fir.ref) -> !fir.ref -!CHECK: %[[val_5:.*]] = fir.alloca i32 {bindc_name = "y", uniq_name = "_QFcommon_1Ey"} -!CHECK: omp.parallel { -!CHECK: %[[val_6:.*]] = omp.threadprivate %[[val_0]] : !fir.ref> -> !fir.ref> -!CHECK: %[[val_7:.*]] = fir.convert %[[val_6]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c0_0:.*]] = arith.constant 0 : index -!CHECK: %[[val_8:.*]] = fir.coordinate_of %[[val_7]], %[[val_c0_0]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_9:.*]] = fir.convert %[[val_8]] : (!fir.ref) -> !fir.ref -!CHECK: %[[val_10:.*]] = fir.load %[[val_4]] : !fir.ref -!CHECK: fir.store %[[val_10]] to %[[val_9]] : !fir.ref -!CHECK: omp.barrier -!CHECK: omp.sections { -!CHECK: omp.section { -!CHECK: %[[val_11:.*]] = fir.load %[[val_9]] : !fir.ref -!CHECK: %[[val_c1_i32:.*]] = arith.constant 1 : i32 -!CHECK: %[[val_12:.*]] = arith.addi %[[val_11]], %[[val_c1_i32]] : i32 -!CHECK: fir.store %[[val_12]] to %[[val_5]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.section { -!CHECK: %[[val_11:.*]] = fir.load %[[val_5]] : !fir.ref -!CHECK: %[[val_12:.*]] = fir.load %[[val_5]] : !fir.ref -!CHECK: %[[val_13:.*]] = arith.muli %[[val_11]], %[[val_12]] : i32 -!CHECK: fir.store %[[val_13]] to %[[val_9]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.terminator -!CHECK: } -!CHECK: return -!CHECK: } -subroutine common_1() - integer :: x - integer :: y - common /c/ x - !$omp threadprivate(/c/) - - !$omp parallel sections copyin(/c/) - !$omp section - y = x + 1 - !$omp section - x = y * y - !$omp end parallel sections -end subroutine - -!CHECK: func.func @_QPcommon_2() { -!CHECK: %[[val_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFcommon_2Ei"} -!CHECK: %[[val_1:.*]] = fir.address_of(@d_) : !fir.ref> -!CHECK: %[[val_2:.*]] = omp.threadprivate %[[val_1]] : !fir.ref> -> !fir.ref> -!CHECK: %[[val_3:.*]] = fir.convert %[[val_2]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c0:.*]] = arith.constant 0 : index -!CHECK: %[[val_4:.*]] = fir.coordinate_of %[[val_3]], %[[val_c0]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_5:.*]] = fir.convert %[[val_4]] : (!fir.ref) -> !fir.ref -!CHECK: %[[val_6:.*]] = fir.convert %[[val_2]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c4:.*]] = arith.constant 4 : index -!CHECK: %[[val_7:.*]] = fir.coordinate_of %[[val_6]], %[[val_c4]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_8:.*]] = fir.convert %[[val_7]] : (!fir.ref) -> !fir.ref -!CHECK: omp.parallel { -!CHECK: %[[val_9:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -!CHECK: %[[val_10:.*]] = omp.threadprivate %[[val_1]] : !fir.ref> -> !fir.ref> -!CHECK: %[[val_11:.*]] = fir.convert %[[val_10]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c0_0:.*]] = arith.constant 0 : index -!CHECK: %[[val_12:.*]] = fir.coordinate_of %[[val_11]], %[[val_c0_0]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_13:.*]] = fir.convert %[[val_12]] : (!fir.ref) -> !fir.ref -!CHECK: %[[val_14:.*]] = fir.convert %[[val_10]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c4_1:.*]] = arith.constant 4 : index -!CHECK: %[[val_15:.*]] = fir.coordinate_of %[[val_14]], %[[val_c4_1]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_16:.*]] = fir.convert %[[val_15]] : (!fir.ref) -> !fir.ref -!CHECK: %[[val_17:.*]] = fir.load %[[val_5]] : !fir.ref -!CHECK: fir.store %[[val_17]] to %[[val_13]] : !fir.ref -!CHECK: %[[val_18:.*]] = fir.load %[[val_8]] : !fir.ref -!CHECK: fir.store %[[val_18]] to %[[val_16]] : !fir.ref -!CHECK: omp.barrier -!CHECK: %[[val_c1_i32:.*]] = arith.constant 1 : i32 -!CHECK: %[[val_19:.*]] = fir.load %[[val_13]] : !fir.ref -!CHECK: %[[val_c1_i32_2:.*]] = arith.constant 1 : i32 -!CHECK: omp.wsloop { -!CHECK-NEXT: omp.loop_nest (%[[arg:.*]]) : i32 = (%[[val_c1_i32]]) to (%[[val_19]]) inclusive step (%[[val_c1_i32_2]]) { -!CHECK: fir.store %[[arg]] to %[[val_9]] : !fir.ref -!CHECK: %[[val_20:.*]] = fir.load %[[val_16]] : !fir.ref -!CHECK: %[[val_21:.*]] = fir.load %[[val_9]] : !fir.ref -!CHECK: %[[val_22:.*]] = arith.addi %[[val_20]], %[[val_21]] : i32 -!CHECK: fir.store %[[val_22]] to %[[val_16]] : !fir.ref -!CHECK: omp.yield -!CHECK: } -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.terminator -!CHECK: } -!CHECK: return -!CHECK: } -subroutine common_2() - integer :: x - integer :: y - common /d/ x, y - !$omp threadprivate(/d/) - - !$omp parallel do copyin(/d/) - do i = 1, x - y = y + i - end do - !$omp end parallel do -end subroutine - -!CHECK: func.func @_QPcommon_3() { -!CHECK: %[[val_0:.*]] = fir.address_of(@blk_) : !fir.ref> -!CHECK: %[[val_1:.*]] = omp.threadprivate %[[val_0]] : !fir.ref> -> !fir.ref> -!CHECK: %[[val_2:.*]] = fir.convert %[[val_1]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c4:.*]] = arith.constant 4 : index -!CHECK: %[[val_3:.*]] = fir.coordinate_of %[[val_2]], %[[val_c4]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_4:.*]] = fir.convert %[[val_3]] : (!fir.ref) -> !fir.ref -!CHECK: omp.parallel { -!CHECK: %[[val_5:.*]] = omp.threadprivate %[[val_0]] : !fir.ref> -> !fir.ref> -!CHECK: %[[val_6:.*]] = fir.convert %[[val_5]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c4_0:.*]] = arith.constant 4 : index -!CHECK: %[[val_7:.*]] = fir.coordinate_of %[[val_6]], %[[val_c4_0]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_8:.*]] = fir.convert %[[val_7]] : (!fir.ref) -> !fir.ref -!CHECK: %[[val_9:.*]] = fir.load %[[val_4]] : !fir.ref -!CHECK: fir.store %[[val_9]] to %[[val_8]] : !fir.ref -!CHECK: omp.barrier -!CHECK: omp.sections { -!CHECK: omp.section { -!CHECK: %[[val_10:.*]] = fir.load %[[val_8]] : !fir.ref -!CHECK: %[[val_c3_i32:.*]] = arith.constant 3 : i32 -!CHECK: %[[val_11:.*]] = arith.addi %[[val_10]], %[[val_c3_i32]] : i32 -!CHECK: fir.store %[[val_11]] to %[[val_8]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.terminator -!CHECK: } -!CHECK: return -!CHECK: } -subroutine common_3() - integer :: x - integer :: y - common /blk/ x, y - !$omp threadprivate (/blk/) - - !$omp parallel sections copyin(/blk/) - !$omp section - y = y + 3 - !$omp end parallel sections -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/critical.f90 b/flang/test/Lower/OpenMP/FIR/critical.f90 deleted file mode 100644 index fa33fb0fe58bb..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/critical.f90 +++ /dev/null @@ -1,38 +0,0 @@ -! REQUIRES: openmp_runtime - -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes="OMPDialect" -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefix="OMPDialect" -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | tco | FileCheck %s --check-prefix="LLVMIR" - -!OMPDialect: omp.critical.declare @help2 -!OMPDialect: omp.critical.declare @help1 hint(contended) - -subroutine omp_critical() - use omp_lib - integer :: x, y -!OMPDialect: omp.critical(@help1) -!LLVMIR: call void @__kmpc_critical_with_hint({{.*}}, {{.*}}, {{.*}} @{{.*}}help1.var, i32 2) -!$OMP CRITICAL(help1) HINT(omp_lock_hint_contended) - x = x + y -!OMPDialect: omp.terminator -!LLVMIR: call void @__kmpc_end_critical({{.*}}, {{.*}}, {{.*}} @{{.*}}help1.var) -!$OMP END CRITICAL(help1) - -! Test that the same name can be used again -! Also test with the zero hint expression -!OMPDialect: omp.critical(@help2) -!LLVMIR: call void @__kmpc_critical_with_hint({{.*}}, {{.*}}, {{.*}} @{{.*}}help2.var, i32 0) -!$OMP CRITICAL(help2) HINT(omp_lock_hint_none) - x = x - y -!OMPDialect: omp.terminator -!LLVMIR: call void @__kmpc_end_critical({{.*}}, {{.*}}, {{.*}} @{{.*}}help2.var) -!$OMP END CRITICAL(help2) - -!OMPDialect: omp.critical -!LLVMIR: call void @__kmpc_critical({{.*}}, {{.*}}, {{.*}} @{{.*}}_.var) -!$OMP CRITICAL - y = x + y -!OMPDialect: omp.terminator -!LLVMIR: call void @__kmpc_end_critical({{.*}}, {{.*}}, {{.*}} @{{.*}}_.var) -!$OMP END CRITICAL -end subroutine omp_critical diff --git a/flang/test/Lower/OpenMP/FIR/declare-target-data.f90 b/flang/test/Lower/OpenMP/FIR/declare-target-data.f90 deleted file mode 100644 index bb3bbc8dfa837..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/declare-target-data.f90 +++ /dev/null @@ -1,88 +0,0 @@ -!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s - -module test_0 - implicit none - -!CHECK-DAG: fir.global @_QMtest_0Edata_int {omp.declare_target = #omp.declaretarget} : i32 -INTEGER :: data_int = 10 -!$omp declare target link(data_int) - -!CHECK-DAG: fir.global @_QMtest_0Earray_1d({{.*}}) {omp.declare_target = #omp.declaretarget} : !fir.array<3xi32> -INTEGER :: array_1d(3) = (/1,2,3/) -!$omp declare target link(array_1d) - -!CHECK-DAG: fir.global @_QMtest_0Earray_2d({{.*}}) {omp.declare_target = #omp.declaretarget} : !fir.array<2x2xi32> -INTEGER :: array_2d(2,2) = reshape((/1,2,3,4/), (/2,2/)) -!$omp declare target link(array_2d) - -!CHECK-DAG: fir.global @_QMtest_0Ept1 {omp.declare_target = #omp.declaretarget} : !fir.box> -INTEGER, POINTER :: pt1 -!$omp declare target link(pt1) - -!CHECK-DAG: fir.global @_QMtest_0Ept2_tar {omp.declare_target = #omp.declaretarget} target : i32 -INTEGER, TARGET :: pt2_tar = 5 -!$omp declare target link(pt2_tar) - -!CHECK-DAG: fir.global @_QMtest_0Ept2 {omp.declare_target = #omp.declaretarget} : !fir.box> -INTEGER, POINTER :: pt2 => pt2_tar -!$omp declare target link(pt2) - -!CHECK-DAG: fir.global @_QMtest_0Edata_int_to {omp.declare_target = #omp.declaretarget} : i32 -INTEGER :: data_int_to = 5 -!$omp declare target to(data_int_to) - -!CHECK-DAG: fir.global @_QMtest_0Edata_int_enter {omp.declare_target = #omp.declaretarget} : i32 -INTEGER :: data_int_enter = 5 -!$omp declare target enter(data_int_enter) - -!CHECK-DAG: fir.global @_QMtest_0Edata_int_clauseless {omp.declare_target = #omp.declaretarget} : i32 -INTEGER :: data_int_clauseless = 1 -!$omp declare target(data_int_clauseless) - -!CHECK-DAG: fir.global @_QMtest_0Edata_extended_to_1 {omp.declare_target = #omp.declaretarget} : f32 -!CHECK-DAG: fir.global @_QMtest_0Edata_extended_to_2 {omp.declare_target = #omp.declaretarget} : f32 -REAL :: data_extended_to_1 = 2 -REAL :: data_extended_to_2 = 3 -!$omp declare target to(data_extended_to_1, data_extended_to_2) - -!CHECK-DAG: fir.global @_QMtest_0Edata_extended_enter_1 {omp.declare_target = #omp.declaretarget} : f32 -!CHECK-DAG: fir.global @_QMtest_0Edata_extended_enter_2 {omp.declare_target = #omp.declaretarget} : f32 -REAL :: data_extended_enter_1 = 2 -REAL :: data_extended_enter_2 = 3 -!$omp declare target enter(data_extended_enter_1, data_extended_enter_2) - -!CHECK-DAG: fir.global @_QMtest_0Edata_extended_link_1 {omp.declare_target = #omp.declaretarget} : f32 -!CHECK-DAG: fir.global @_QMtest_0Edata_extended_link_2 {omp.declare_target = #omp.declaretarget} : f32 -REAL :: data_extended_link_1 = 2 -REAL :: data_extended_link_2 = 3 -!$omp declare target link(data_extended_link_1, data_extended_link_2) - -contains -end module test_0 - -PROGRAM commons - !CHECK-DAG: fir.global @numbers_ {omp.declare_target = #omp.declaretarget} : tuple { - REAL :: one = 1 - REAL :: two = 2 - COMMON /numbers/ one, two - !$omp declare target(/numbers/) - - !CHECK-DAG: fir.global @numbers_link_ {omp.declare_target = #omp.declaretarget} : tuple { - REAL :: one_link = 1 - REAL :: two_link = 2 - COMMON /numbers_link/ one_link, two_link - !$omp declare target link(/numbers_link/) - - !CHECK-DAG: fir.global @numbers_to_ {omp.declare_target = #omp.declaretarget} : tuple { - REAL :: one_to = 1 - REAL :: two_to = 2 - COMMON /numbers_to/ one_to, two_to - !$omp declare target to(/numbers_to/) - - !CHECK-DAG: fir.global @numbers_enter_ {omp.declare_target = #omp.declaretarget} : tuple { - REAL :: one_enter = 1 - REAL :: two_enter = 2 - COMMON /numbers_enter/ one_enter, two_enter - !$omp declare target enter(/numbers_enter/) -END diff --git a/flang/test/Lower/OpenMP/FIR/declare-target-func-and-subr.f90 b/flang/test/Lower/OpenMP/FIR/declare-target-func-and-subr.f90 deleted file mode 100644 index 36d4d7db64e5f..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/declare-target-func-and-subr.f90 +++ /dev/null @@ -1,178 +0,0 @@ -!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s --check-prefixes ALL,HOST -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-is-device %s -o - | FileCheck %s --check-prefixes ALL,DEVICE - -! Check specification valid forms of declare target with functions -! utilising device_type and to clauses as well as the default -! zero clause declare target - -! DEVICE-LABEL: func.func @_QPfunc_t_device() -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -FUNCTION FUNC_T_DEVICE() RESULT(I) -!$omp declare target to(FUNC_T_DEVICE) device_type(nohost) - INTEGER :: I - I = 1 -END FUNCTION FUNC_T_DEVICE - -! DEVICE-LABEL: func.func @_QPfunc_enter_device() -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -FUNCTION FUNC_ENTER_DEVICE() RESULT(I) -!$omp declare target enter(FUNC_ENTER_DEVICE) device_type(nohost) - INTEGER :: I - I = 1 -END FUNCTION FUNC_ENTER_DEVICE - -! HOST-LABEL: func.func @_QPfunc_t_host() -! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -FUNCTION FUNC_T_HOST() RESULT(I) -!$omp declare target to(FUNC_T_HOST) device_type(host) - INTEGER :: I - I = 1 -END FUNCTION FUNC_T_HOST - -! HOST-LABEL: func.func @_QPfunc_enter_host() -! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -FUNCTION FUNC_ENTER_HOST() RESULT(I) -!$omp declare target enter(FUNC_ENTER_HOST) device_type(host) - INTEGER :: I - I = 1 -END FUNCTION FUNC_ENTER_HOST - -! ALL-LABEL: func.func @_QPfunc_t_any() -! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -FUNCTION FUNC_T_ANY() RESULT(I) -!$omp declare target to(FUNC_T_ANY) device_type(any) - INTEGER :: I - I = 1 -END FUNCTION FUNC_T_ANY - -! ALL-LABEL: func.func @_QPfunc_enter_any() -! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -FUNCTION FUNC_ENTER_ANY() RESULT(I) -!$omp declare target enter(FUNC_ENTER_ANY) device_type(any) - INTEGER :: I - I = 1 -END FUNCTION FUNC_ENTER_ANY - -! ALL-LABEL: func.func @_QPfunc_default_t_any() -! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -FUNCTION FUNC_DEFAULT_T_ANY() RESULT(I) -!$omp declare target to(FUNC_DEFAULT_T_ANY) - INTEGER :: I - I = 1 -END FUNCTION FUNC_DEFAULT_T_ANY - -! ALL-LABEL: func.func @_QPfunc_default_enter_any() -! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -FUNCTION FUNC_DEFAULT_ENTER_ANY() RESULT(I) -!$omp declare target enter(FUNC_DEFAULT_ENTER_ANY) - INTEGER :: I - I = 1 -END FUNCTION FUNC_DEFAULT_ENTER_ANY - -! ALL-LABEL: func.func @_QPfunc_default_any() -! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -FUNCTION FUNC_DEFAULT_ANY() RESULT(I) -!$omp declare target - INTEGER :: I - I = 1 -END FUNCTION FUNC_DEFAULT_ANY - -! ALL-LABEL: func.func @_QPfunc_default_extendedlist() -! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -FUNCTION FUNC_DEFAULT_EXTENDEDLIST() RESULT(I) -!$omp declare target(FUNC_DEFAULT_EXTENDEDLIST) - INTEGER :: I - I = 1 -END FUNCTION FUNC_DEFAULT_EXTENDEDLIST - -!! ----- - -! Check specification valid forms of declare target with subroutines -! utilising device_type and to clauses as well as the default -! zero clause declare target - -! DEVICE-LABEL: func.func @_QPsubr_t_device() -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -SUBROUTINE SUBR_T_DEVICE() -!$omp declare target to(SUBR_T_DEVICE) device_type(nohost) -END - -! DEVICE-LABEL: func.func @_QPsubr_enter_device() -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -SUBROUTINE SUBR_ENTER_DEVICE() -!$omp declare target enter(SUBR_ENTER_DEVICE) device_type(nohost) -END - -! HOST-LABEL: func.func @_QPsubr_t_host() -! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -SUBROUTINE SUBR_T_HOST() -!$omp declare target to(SUBR_T_HOST) device_type(host) -END - -! HOST-LABEL: func.func @_QPsubr_enter_host() -! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -SUBROUTINE SUBR_ENTER_HOST() -!$omp declare target enter(SUBR_ENTER_HOST) device_type(host) -END - -! ALL-LABEL: func.func @_QPsubr_t_any() -! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -SUBROUTINE SUBR_T_ANY() -!$omp declare target to(SUBR_T_ANY) device_type(any) -END - -! ALL-LABEL: func.func @_QPsubr_enter_any() -! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -SUBROUTINE SUBR_ENTER_ANY() -!$omp declare target enter(SUBR_ENTER_ANY) device_type(any) -END - -! ALL-LABEL: func.func @_QPsubr_default_t_any() -! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -SUBROUTINE SUBR_DEFAULT_T_ANY() -!$omp declare target to(SUBR_DEFAULT_T_ANY) -END - -! ALL-LABEL: func.func @_QPsubr_default_enter_any() -! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -SUBROUTINE SUBR_DEFAULT_ENTER_ANY() -!$omp declare target enter(SUBR_DEFAULT_ENTER_ANY) -END - -! ALL-LABEL: func.func @_QPsubr_default_any() -! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -SUBROUTINE SUBR_DEFAULT_ANY() -!$omp declare target -END - -! ALL-LABEL: func.func @_QPsubr_default_extendedlist() -! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -SUBROUTINE SUBR_DEFAULT_EXTENDEDLIST() -!$omp declare target(SUBR_DEFAULT_EXTENDEDLIST) -END - -!! ----- - -! DEVICE-LABEL: func.func @_QPrecursive_declare_target -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -RECURSIVE FUNCTION RECURSIVE_DECLARE_TARGET(INCREMENT) RESULT(K) -!$omp declare target to(RECURSIVE_DECLARE_TARGET) device_type(nohost) - INTEGER :: INCREMENT, K - IF (INCREMENT == 10) THEN - K = INCREMENT - ELSE - K = RECURSIVE_DECLARE_TARGET(INCREMENT + 1) - END IF -END FUNCTION RECURSIVE_DECLARE_TARGET - -! DEVICE-LABEL: func.func @_QPrecursive_declare_target_enter -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}} -RECURSIVE FUNCTION RECURSIVE_DECLARE_TARGET_ENTER(INCREMENT) RESULT(K) -!$omp declare target enter(RECURSIVE_DECLARE_TARGET_ENTER) device_type(nohost) - INTEGER :: INCREMENT, K - IF (INCREMENT == 10) THEN - K = INCREMENT - ELSE - K = RECURSIVE_DECLARE_TARGET_ENTER(INCREMENT + 1) - END IF -END FUNCTION RECURSIVE_DECLARE_TARGET_ENTER diff --git a/flang/test/Lower/OpenMP/FIR/declare-target-implicit-func-and-subr-cap-enter.f90 b/flang/test/Lower/OpenMP/FIR/declare-target-implicit-func-and-subr-cap-enter.f90 deleted file mode 100644 index 8e88d1b0f52a9..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/declare-target-implicit-func-and-subr-cap-enter.f90 +++ /dev/null @@ -1,192 +0,0 @@ -!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=DEVICE -!RUN: bbc -emit-fir -fopenmp %s -o - | FileCheck %s -!RUN: bbc -emit-fir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=DEVICE - -! CHECK-LABEL: func.func @_QPimplicitly_captured_twice -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function implicitly_captured_twice() result(k) - integer :: i - i = 10 - k = i -end function implicitly_captured_twice - -! CHECK-LABEL: func.func @_QPtarget_function_twice_host -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function target_function_twice_host() result(i) -!$omp declare target enter(target_function_twice_host) device_type(host) - integer :: i - i = implicitly_captured_twice() -end function target_function_twice_host - -! DEVICE-LABEL: func.func @_QPtarget_function_twice_device -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function target_function_twice_device() result(i) -!$omp declare target enter(target_function_twice_device) device_type(nohost) - integer :: i - i = implicitly_captured_twice() -end function target_function_twice_device - -!! ----- - -! DEVICE-LABEL: func.func @_QPimplicitly_captured_nest -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function implicitly_captured_nest() result(k) - integer :: i - i = 10 - k = i -end function implicitly_captured_nest - -! DEVICE-LABEL: func.func @_QPimplicitly_captured_one -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function implicitly_captured_two() result(k) - integer :: i - i = 10 - k = i -end function implicitly_captured_two - -! DEVICE-LABEL: func.func @_QPtarget_function_test -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function target_function_test() result(j) -!$omp declare target enter(target_function_test) device_type(nohost) - integer :: i, j - i = implicitly_captured_one() - j = implicitly_captured_two() + i -end function target_function_test - -!! ----- - -! CHECK-LABEL: func.func @_QPimplicitly_captured_nest_twice -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function implicitly_captured_nest_twice() result(k) - integer :: i - i = 10 - k = i -end function implicitly_captured_nest_twice - -! CHECK-LABEL: func.func @_QPimplicitly_captured_one_twice -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function implicitly_captured_one_twice() result(k) - k = implicitly_captured_nest_twice() -end function implicitly_captured_one_twice - -! CHECK-LABEL: func.func @_QPimplicitly_captured_two_twice -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function implicitly_captured_two_twice() result(k) - integer :: i - i = 10 - k = i -end function implicitly_captured_two_twice - -! DEVICE-LABEL: func.func @_QPtarget_function_test_device -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function target_function_test_device() result(j) - !$omp declare target enter(target_function_test_device) device_type(nohost) - integer :: i, j - i = implicitly_captured_one_twice() - j = implicitly_captured_two_twice() + i -end function target_function_test_device - -! CHECK-LABEL: func.func @_QPtarget_function_test_host -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function target_function_test_host() result(j) - !$omp declare target enter(target_function_test_host) device_type(host) - integer :: i, j - i = implicitly_captured_one_twice() - j = implicitly_captured_two_twice() + i -end function target_function_test_host - -!! ----- - -! DEVICE-LABEL: func.func @_QPimplicitly_captured_with_dev_type_recursive -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -recursive function implicitly_captured_with_dev_type_recursive(increment) result(k) -!$omp declare target enter(implicitly_captured_with_dev_type_recursive) device_type(host) - integer :: increment, k - if (increment == 10) then - k = increment - else - k = implicitly_captured_with_dev_type_recursive(increment + 1) - end if -end function implicitly_captured_with_dev_type_recursive - -! DEVICE-LABEL: func.func @_QPtarget_function_with_dev_type_recurse -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function target_function_with_dev_type_recurse() result(i) -!$omp declare target enter(target_function_with_dev_type_recurse) device_type(nohost) - integer :: i - i = implicitly_captured_with_dev_type_recursive(0) -end function target_function_with_dev_type_recurse - -!! ----- - -module test_module -contains -! CHECK-LABEL: func.func @_QMtest_modulePimplicitly_captured_nest_twice -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} - function implicitly_captured_nest_twice() result(i) - integer :: i - i = 10 - end function implicitly_captured_nest_twice - -! CHECK-LABEL: func.func @_QMtest_modulePimplicitly_captured_one_twice -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} - function implicitly_captured_one_twice() result(k) - !$omp declare target enter(implicitly_captured_one_twice) device_type(host) - k = implicitly_captured_nest_twice() - end function implicitly_captured_one_twice - -! DEVICE-LABEL: func.func @_QMtest_modulePimplicitly_captured_two_twice -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} - function implicitly_captured_two_twice() result(y) - integer :: y - y = 5 - end function implicitly_captured_two_twice - -! DEVICE-LABEL: func.func @_QMtest_modulePtarget_function_test_device -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} - function target_function_test_device() result(j) - !$omp declare target enter(target_function_test_device) device_type(nohost) - integer :: i, j - i = implicitly_captured_one_twice() - j = implicitly_captured_two_twice() + i - end function target_function_test_device -end module test_module - -!! ----- - -program mb - interface - subroutine caller_recursive - !$omp declare target enter(caller_recursive) device_type(nohost) - end subroutine - - recursive subroutine implicitly_captured_recursive(increment) - integer :: increment - end subroutine - end interface -end program - -! DEVICE-LABEL: func.func @_QPimplicitly_captured_recursive -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -recursive subroutine implicitly_captured_recursive(increment) - integer :: increment - if (increment == 10) then - return - else - call implicitly_captured_recursive(increment + 1) - end if -end subroutine - -! DEVICE-LABEL: func.func @_QPcaller_recursive -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -subroutine caller_recursive -!$omp declare target enter(caller_recursive) device_type(nohost) - call implicitly_captured_recursive(0) -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/declare-target-implicit-func-and-subr-cap.f90 b/flang/test/Lower/OpenMP/FIR/declare-target-implicit-func-and-subr-cap.f90 deleted file mode 100644 index a90b04246e6dc..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/declare-target-implicit-func-and-subr-cap.f90 +++ /dev/null @@ -1,218 +0,0 @@ -!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=DEVICE -!RUN: bbc -emit-fir -fopenmp %s -o - | FileCheck %s -!RUN: bbc -emit-fir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=DEVICE - -! CHECK-LABEL: func.func @_QPimplicitly_captured -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function implicitly_captured(toggle) result(k) - integer :: i, j, k - logical :: toggle - i = 10 - j = 5 - if (toggle) then - k = i - else - k = j - end if -end function implicitly_captured - - -! CHECK-LABEL: func.func @_QPtarget_function -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function target_function(toggle) result(i) -!$omp declare target - integer :: i - logical :: toggle - i = implicitly_captured(toggle) -end function target_function - -!! ----- - -! CHECK-LABEL: func.func @_QPimplicitly_captured_twice -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function implicitly_captured_twice() result(k) - integer :: i - i = 10 - k = i -end function implicitly_captured_twice - -! CHECK-LABEL: func.func @_QPtarget_function_twice_host -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function target_function_twice_host() result(i) -!$omp declare target to(target_function_twice_host) device_type(host) - integer :: i - i = implicitly_captured_twice() -end function target_function_twice_host - -! DEVICE-LABEL: func.func @_QPtarget_function_twice_device -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function target_function_twice_device() result(i) -!$omp declare target to(target_function_twice_device) device_type(nohost) - integer :: i - i = implicitly_captured_twice() -end function target_function_twice_device - -!! ----- - -! DEVICE-LABEL: func.func @_QPimplicitly_captured_nest -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function implicitly_captured_nest() result(k) - integer :: i - i = 10 - k = i -end function implicitly_captured_nest - -! DEVICE-LABEL: func.func @_QPimplicitly_captured_one -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function implicitly_captured_two() result(k) - integer :: i - i = 10 - k = i -end function implicitly_captured_two - -! DEVICE-LABEL: func.func @_QPtarget_function_test -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function target_function_test() result(j) -!$omp declare target to(target_function_test) device_type(nohost) - integer :: i, j - i = implicitly_captured_one() - j = implicitly_captured_two() + i -end function target_function_test - -!! ----- - -! CHECK-LABEL: func.func @_QPimplicitly_captured_nest_twice -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function implicitly_captured_nest_twice() result(k) - integer :: i - i = 10 - k = i -end function implicitly_captured_nest_twice - -! CHECK-LABEL: func.func @_QPimplicitly_captured_one_twice -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function implicitly_captured_one_twice() result(k) - k = implicitly_captured_nest_twice() -end function implicitly_captured_one_twice - -! CHECK-LABEL: func.func @_QPimplicitly_captured_two_twice -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function implicitly_captured_two_twice() result(k) - integer :: i - i = 10 - k = i -end function implicitly_captured_two_twice - -! DEVICE-LABEL: func.func @_QPtarget_function_test_device -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function target_function_test_device() result(j) - !$omp declare target to(target_function_test_device) device_type(nohost) - integer :: i, j - i = implicitly_captured_one_twice() - j = implicitly_captured_two_twice() + i -end function target_function_test_device - -! CHECK-LABEL: func.func @_QPtarget_function_test_host -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function target_function_test_host() result(j) - !$omp declare target to(target_function_test_host) device_type(host) - integer :: i, j - i = implicitly_captured_one_twice() - j = implicitly_captured_two_twice() + i -end function target_function_test_host - -!! ----- - -! DEVICE-LABEL: func.func @_QPimplicitly_captured_with_dev_type_recursive -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -recursive function implicitly_captured_with_dev_type_recursive(increment) result(k) -!$omp declare target to(implicitly_captured_with_dev_type_recursive) device_type(host) - integer :: increment, k - if (increment == 10) then - k = increment - else - k = implicitly_captured_with_dev_type_recursive(increment + 1) - end if -end function implicitly_captured_with_dev_type_recursive - -! DEVICE-LABEL: func.func @_QPtarget_function_with_dev_type_recurse -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -function target_function_with_dev_type_recurse() result(i) -!$omp declare target to(target_function_with_dev_type_recurse) device_type(nohost) - integer :: i - i = implicitly_captured_with_dev_type_recursive(0) -end function target_function_with_dev_type_recurse - -!! ----- - -module test_module -contains -! CHECK-LABEL: func.func @_QMtest_modulePimplicitly_captured_nest_twice -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} - function implicitly_captured_nest_twice() result(i) - integer :: i - i = 10 - end function implicitly_captured_nest_twice - -! CHECK-LABEL: func.func @_QMtest_modulePimplicitly_captured_one_twice -! CHECK-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} - function implicitly_captured_one_twice() result(k) - !$omp declare target to(implicitly_captured_one_twice) device_type(host) - k = implicitly_captured_nest_twice() - end function implicitly_captured_one_twice - -! DEVICE-LABEL: func.func @_QMtest_modulePimplicitly_captured_two_twice -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} - function implicitly_captured_two_twice() result(y) - integer :: y - y = 5 - end function implicitly_captured_two_twice - -! DEVICE-LABEL: func.func @_QMtest_modulePtarget_function_test_device -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} - function target_function_test_device() result(j) - !$omp declare target to(target_function_test_device) device_type(nohost) - integer :: i, j - i = implicitly_captured_one_twice() - j = implicitly_captured_two_twice() + i - end function target_function_test_device -end module test_module - -!! ----- - -program mb - interface - subroutine caller_recursive - !$omp declare target to(caller_recursive) device_type(nohost) - end subroutine - - recursive subroutine implicitly_captured_recursive(increment) - integer :: increment - end subroutine - end interface -end program - -! DEVICE-LABEL: func.func @_QPimplicitly_captured_recursive -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -recursive subroutine implicitly_captured_recursive(increment) - integer :: increment - if (increment == 10) then - return - else - call implicitly_captured_recursive(increment + 1) - end if -end subroutine - -! DEVICE-LABEL: func.func @_QPcaller_recursive -! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget{{.*}}} -subroutine caller_recursive -!$omp declare target to(caller_recursive) device_type(nohost) - call implicitly_captured_recursive(0) -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/default-clause.f90 b/flang/test/Lower/OpenMP/FIR/default-clause.f90 deleted file mode 100644 index 14c0d375896a1..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/default-clause.f90 +++ /dev/null @@ -1,281 +0,0 @@ -! This test checks lowering of OpenMP parallel directive -! with `DEFAULT` clause present. - -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s -! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s - - -!CHECK: func @_QQmain() attributes {fir.bindc_name = "default_clause_lowering"} { -!CHECK: %[[W:.*]] = fir.alloca i32 {bindc_name = "w", uniq_name = "_QFEw"} -!CHECK: %[[X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFEx"} -!CHECK: %[[Y:.*]] = fir.alloca i32 {bindc_name = "y", uniq_name = "_QFEy"} -!CHECK: %[[Z:.*]] = fir.alloca i32 {bindc_name = "z", uniq_name = "_QFEz"} -!CHECK: omp.parallel { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFEx"} -!CHECK: %[[const:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: fir.store %[[const]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[PRIVATE_Y:.*]] = fir.alloca i32 {bindc_name = "y", pinned, uniq_name = "_QFEy"} -!CHECK: %[[PRIVATE_W:.*]] = fir.alloca i32 {bindc_name = "w", pinned, uniq_name = "_QFEw"} -!CHECK: %[[const:.*]] = arith.constant 2 : i32 -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_Y]] : !fir.ref -!CHECK: %[[result:.*]] = arith.muli %[[const]], %[[temp]] : i32 -!CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_W]] : !fir.ref -!CHECK: %[[const:.*]] = arith.constant 45 : i32 -!CHECK: %[[result:.*]] = arith.addi %[[temp]], %[[const]] : i32 -!CHECK: fir.store %[[result]] to %[[Z]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } - -program default_clause_lowering - integer :: x, y, z, w - - !$omp parallel default(private) firstprivate(x) shared(z) - x = y * 2 - z = w + 45 - !$omp end parallel - -!CHECK: omp.parallel { -!CHECK: %[[temp:.*]] = fir.load %[[Y]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[X]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } - - !$omp parallel default(shared) - x = y - !$omp end parallel - -!CHECK: omp.parallel { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFEx"} -!CHECK: %[[PRIVATE_Y:.*]] = fir.alloca i32 {bindc_name = "y", pinned, uniq_name = "_QFEy"} -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_Y]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } - - !$omp parallel default(none) private(x, y) - x = y - !$omp end parallel - -!CHECK: omp.parallel { -!CHECK: %[[PRIVATE_Y:.*]] = fir.alloca i32 {bindc_name = "y", pinned, uniq_name = "_QFEy"} -!CHECK: %[[temp:.*]] = fir.load %[[Y]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_Y]] : !fir.ref -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFEx"} -!CHECK: %[[temp:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_Y]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } - - !$omp parallel default(firstprivate) firstprivate(y) - x = y - !$omp end parallel - -!CHECK: omp.parallel { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFEx"} -!CHECK: %[[PRIVATE_Y:.*]] = fir.alloca i32 {bindc_name = "y", pinned, uniq_name = "_QFEy"} -!CHECK: %[[temp:.*]] = fir.load %[[Y]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_Y]] : !fir.ref -!CHECK: %[[PRIVATE_W:.*]] = fir.alloca i32 {bindc_name = "w", pinned, uniq_name = "_QFEw"} -!CHECK: %[[temp:.*]] = fir.load %[[W]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_W]] : !fir.ref -!CHECK: %[[const:.*]] = arith.constant 2 : i32 -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_Y]] : !fir.ref -!CHECK: %[[result:.*]] = arith.muli %[[const]], %[[temp]] : i32 -!CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_W]] : !fir.ref -!CHECK: %[[const:.*]] = arith.constant 45 : i32 -!CHECK: %[[result:.*]] = arith.addi %[[temp]], %[[const]] : i32 -!CHECK: fir.store %[[result]] to %[[Z]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } - - !$omp parallel default(firstprivate) private(x) shared(z) - x = y * 2 - z = w + 45 - !$omp end parallel - -!CHECK: omp.parallel { -!CHECK: omp.parallel { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFEx"} -!CHECK: %[[PRIVATE_Y:.*]] = fir.alloca i32 {bindc_name = "y", pinned, uniq_name = "_QFEy"} -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_Y]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.parallel { -!CHECK: %[[PRIVATE_W:.*]] = fir.alloca i32 {bindc_name = "w", pinned, uniq_name = "_QFEw"} -!CHECK: %[[temp:.*]] = fir.load %[[W]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_W]] : !fir.ref -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFEx"} -!CHECK: %[[temp:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_W]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - !$omp parallel - !$omp parallel default(private) - x = y - !$omp end parallel - - !$omp parallel default(firstprivate) - w = x - !$omp end parallel - !$omp end parallel - -end program default_clause_lowering - -subroutine nested_default_clause_tests - integer :: x, y, z, w, k, a - -!CHECK: %[[K:.*]] = fir.alloca i32 {bindc_name = "k", uniq_name = "_QFnested_default_clause_testsEk"} -!CHECK: %[[W:.*]] = fir.alloca i32 {bindc_name = "w", uniq_name = "_QFnested_default_clause_testsEw"} -!CHECK: %[[X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFnested_default_clause_testsEx"} -!CHECK: %[[Y:.*]] = fir.alloca i32 {bindc_name = "y", uniq_name = "_QFnested_default_clause_testsEy"} -!CHECK: %[[Z:.*]] = fir.alloca i32 {bindc_name = "z", uniq_name = "_QFnested_default_clause_testsEz"} -!CHECK: omp.parallel { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFnested_default_clause_testsEx"} -!CHECK: %[[temp:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[PRIVATE_Y:.*]] = fir.alloca i32 {bindc_name = "y", pinned, uniq_name = "_QFnested_default_clause_testsEy"} -!CHECK: %[[PRIVATE_Z:.*]] = fir.alloca i32 {bindc_name = "z", pinned, uniq_name = "_QFnested_default_clause_testsEz"} -!CHECK: %[[PRIVATE_K:.*]] = fir.alloca i32 {bindc_name = "k", pinned, uniq_name = "_QFnested_default_clause_testsEk"} -!CHECK: omp.parallel { -!CHECK: %[[INNER_PRIVATE_Y:.*]] = fir.alloca i32 {bindc_name = "y", pinned, uniq_name = "_QFnested_default_clause_testsEy"} -!CHECK: %[[INNER_PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFnested_default_clause_testsEx"} -!CHECK: %[[const:.*]] = arith.constant 20 : i32 -!CHECK: fir.store %[[const]] to %[[INNER_PRIVATE_Y]] : !fir.ref -!CHECK: %[[const:.*]] = arith.constant 10 : i32 -!CHECK: fir.store %[[const]] to %[[INNER_PRIVATE_X]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.parallel { -!CHECK: %[[INNER_PRIVATE_W:.*]] = fir.alloca i32 {bindc_name = "w", pinned, uniq_name = "_QFnested_default_clause_testsEw"} -!CHECK: %[[INNER_PRIVATE_Z:.*]] = fir.alloca i32 {bindc_name = "z", pinned, uniq_name = "_QFnested_default_clause_testsEz"} -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_Z]] -!CHECK: fir.store %[[temp]] to %[[INNER_PRIVATE_Z]] : !fir.ref -!CHECK: %[[INNER_PRIVATE_K:.*]] = fir.alloca i32 {bindc_name = "k", pinned, uniq_name = "_QFnested_default_clause_testsEk"} -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_K]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[INNER_PRIVATE_K]] : !fir.ref -!CHECK: %[[const:.*]] = arith.constant 30 : i32 -!CHECK: fir.store %[[const]] to %[[PRIVATE_Y]] : !fir.ref -!CHECK: %[[const:.*]] = arith.constant 40 : i32 -!CHECK: fir.store %[[const]] to %[[INNER_PRIVATE_W]] : !fir.ref -!CHECK: %[[const:.*]] = arith.constant 50 : i32 -!CHECK: fir.store %[[const]] to %[[INNER_PRIVATE_Z]] : !fir.ref -!CHECK: %[[const:.*]] = arith.constant 40 : i32 -!CHECK: fir.store %[[const]] to %[[INNER_PRIVATE_K]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - !$omp parallel firstprivate(x) private(y) shared(w) default(private) - !$omp parallel default(private) - y = 20 - x = 10 - !$omp end parallel - - !$omp parallel default(firstprivate) shared(y) private(w) - y = 30 - w = 40 - z = 50 - k = 40 - !$omp end parallel - !$omp end parallel - - -!CHECK: omp.parallel { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFnested_default_clause_testsEx"} -!CHECK: %[[PRIVATE_Y:.*]] = fir.alloca i32 {bindc_name = "y", pinned, uniq_name = "_QFnested_default_clause_testsEy"} -!CHECK: %[[PRIVATE_Z:.*]] = fir.alloca i32 {bindc_name = "z", pinned, uniq_name = "_QFnested_default_clause_testsEz"} -!CHECK: %[[PRIVATE_W:.*]] = fir.alloca i32 {bindc_name = "w", pinned, uniq_name = "_QFnested_default_clause_testsEw"} -!CHECK: omp.parallel { -!CHECK: %[[PRIVATE_INNER_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFnested_default_clause_testsEx"} -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_INNER_X]] : !fir.ref -!CHECK: %[[INNER_PRIVATE_Y:.*]] = fir.alloca i32 {bindc_name = "y", pinned, uniq_name = "_QFnested_default_clause_testsEy"} -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_Y]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[INNER_PRIVATE_Y]] : !fir.ref -!CHECK: %[[temp:.*]] = fir.load %[[INNER_PRIVATE_Y]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_INNER_X]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.parallel { -!CHECK: %[[PRIVATE_INNER_W:.*]] = fir.alloca i32 {bindc_name = "w", pinned, uniq_name = "_QFnested_default_clause_testsEw"} -!CHECK: %[[PRIVATE_INNER_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFnested_default_clause_testsEx"} -!CHECK: %[[temp_1:.*]] = fir.load %[[PRIVATE_INNER_X]] : !fir.ref -!CHECK: %[[temp_2:.*]] = fir.load %[[PRIVATE_Z]] : !fir.ref -!CHECK: %[[result:.*]] = arith.addi %{{.*}}, %{{.*}} : i32 -!CHECK: fir.store %[[result]] to %[[PRIVATE_INNER_W]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } - !$omp parallel default(private) - !$omp parallel default(firstprivate) - x = y - !$omp end parallel - - !$omp parallel default(private) shared(z) - w = x + z - !$omp end parallel - !$omp end parallel - -!CHECK: omp.parallel { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFnested_default_clause_testsEx"} -!CHECK: %[[PRIVATE_Y:.*]] = fir.alloca i32 {bindc_name = "y", pinned, uniq_name = "_QFnested_default_clause_testsEy"} -!CHECK: %[[PRIVATE_W:.*]] = fir.alloca i32 {bindc_name = "w", pinned, uniq_name = "_QFnested_default_clause_testsEw"} -!CHECK: %[[PRIVATE_Z:.*]] = fir.alloca i32 {bindc_name = "z", pinned, uniq_name = "_QFnested_default_clause_testsEz"} -!CHECK: omp.parallel { -!CHECK: %[[INNER_PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFnested_default_clause_testsEx"} -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[INNER_PRIVATE_X]] : !fir.ref -!CHECK: %[[INNER_PRIVATE_Y:.*]] = fir.alloca i32 {bindc_name = "y", pinned, uniq_name = "_QFnested_default_clause_testsEy"} -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_Y]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[INNER_PRIVATE_Y]] : !fir.ref -!CHECK: %[[temp:.*]] = fir.load %[[INNER_PRIVATE_Y]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[INNER_PRIVATE_X]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.parallel { -!CHECK: %[[temp_1:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[temp_2:.*]] = fir.load %[[PRIVATE_Z]] : !fir.ref -!CHECK: %[[temp_3:.*]] = arith.addi %[[temp_1]], %[[temp_2]] : i32 -!CHECK: fir.store %[[temp_3]] to %[[PRIVATE_W]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: } - !$omp parallel default(private) - !$omp parallel default(firstprivate) - x = y - !$omp end parallel - - !$omp parallel default(shared) - w = x + z - !$omp end parallel - !$omp end parallel - -!CHECK: omp.parallel { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFnested_default_clause_testsEx"} -!CHECK: %[[temp:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[PRIVATE_Y:.*]] = fir.alloca i32 {bindc_name = "y", pinned, uniq_name = "_QFnested_default_clause_testsEy"} -!CHECK: %[[temp:.*]] = fir.load %[[Y]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_Y]] : !fir.ref -!CHECK: omp.single { -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_Y]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.terminator -!CHECK: } -!CHECK: } - !$omp parallel default(firstprivate) - !$omp single - x = y - !$omp end single - !$omp end parallel -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/delayed-privatization-firstprivate.f90 b/flang/test/Lower/OpenMP/FIR/delayed-privatization-firstprivate.f90 deleted file mode 100644 index 50938342dee7c..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/delayed-privatization-firstprivate.f90 +++ /dev/null @@ -1,32 +0,0 @@ -! Test delayed privatization for the `private` clause. - -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -mmlir \ -! RUN: --openmp-enable-delayed-privatization -o - %s 2>&1 | FileCheck %s -! RUN: bbc -emit-fir -hlfir=false -fopenmp --openmp-enable-delayed-privatization \ -! RUN: -o - %s 2>&1 | FileCheck %s - -subroutine delayed_privatization_firstprivate - implicit none - integer :: var1 - -!$OMP PARALLEL FIRSTPRIVATE(var1) - var1 = 10 -!$OMP END PARALLEL -end subroutine - -! CHECK-LABEL: omp.private {type = firstprivate} -! CHECK-SAME: @[[VAR1_PRIVATIZER_SYM:.*]] : !fir.ref alloc { -! CHECK-NEXT: ^bb0(%[[PRIV_ARG:.*]]: !fir.ref): -! CHECK-NEXT: %[[PRIV_ALLOC:.*]] = fir.alloca i32 {bindc_name = "var1", pinned, uniq_name = "_QFdelayed_privatization_firstprivateEvar1"} -! CHECK-NEXT: omp.yield(%[[PRIV_ALLOC]] : !fir.ref) -! CHECK: } copy { -! CHECK: ^bb0(%[[PRIV_ORIG_ARG:.*]]: !fir.ref, %[[PRIV_PRIV_ARG:.*]]: !fir.ref): -! CHECK: %[[ORIG_VAL:.*]] = fir.load %[[PRIV_ORIG_ARG]] : !fir.ref -! CHECK: fir.store %[[ORIG_VAL]] to %[[PRIV_PRIV_ARG]] : !fir.ref -! CHECK: omp.yield(%[[PRIV_PRIV_ARG]] : !fir.ref) -! CHECK: } - -! CHECK-LABEL: @_QPdelayed_privatization_firstprivate -! CHECK: omp.parallel private(@[[VAR1_PRIVATIZER_SYM]] %{{.*}} -> %{{.*}} : !fir.ref) { -! CHECK: omp.terminator - diff --git a/flang/test/Lower/OpenMP/FIR/delayed-privatization-private.f90 b/flang/test/Lower/OpenMP/FIR/delayed-privatization-private.f90 deleted file mode 100644 index b13687faa3f26..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/delayed-privatization-private.f90 +++ /dev/null @@ -1,41 +0,0 @@ -! Test delayed privatization for the `private` clause. - -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -mmlir \ -! RUN: --openmp-enable-delayed-privatization -o - %s 2>&1 | FileCheck %s -! RUN: bbc -emit-fir -hlfir=false -fopenmp --openmp-enable-delayed-privatization \ -! RUN: -o - %s 2>&1 | FileCheck %s - -subroutine delayed_privatization_private - implicit none - integer :: var1 - -!$OMP PARALLEL PRIVATE(var1) - var1 = 10 -!$OMP END PARALLEL - -!$OMP PARALLEL PRIVATE(var1) - var1 = 20 -!$OMP END PARALLEL - -end subroutine - -! CHECK-LABEL: omp.private {type = private} -! CHECK-SAME: @[[PRIVATIZER_SYM:.*]] : !fir.ref alloc { -! CHECK-NEXT: ^bb0(%[[PRIV_ARG:.*]]: !fir.ref): -! CHECK-NEXT: %[[PRIV_ALLOC:.*]] = fir.alloca i32 {bindc_name = "var1", pinned, uniq_name = "_QFdelayed_privatization_privateEvar1"} -! CHECK-NEXT: omp.yield(%[[PRIV_ALLOC]] : !fir.ref) -! CHECK-NOT: } copy { - -! CHECK-LABEL: @_QPdelayed_privatization_private -! CHECK: %[[ORIG_ALLOC:.*]] = fir.alloca i32 {bindc_name = "var1", uniq_name = "_QFdelayed_privatization_privateEvar1"} -! CHECK: omp.parallel private(@[[PRIVATIZER_SYM]] %[[ORIG_ALLOC]] -> %[[PAR_ARG:.*]] : !fir.ref) { -! CHECK: %[[C10:.*]] = arith.constant 10 : i32 -! CHECK: fir.store %[[C10]] to %[[PAR_ARG]] : !fir.ref -! CHECK: omp.terminator - -! Test that the same privatizer is used if the a variable with the same type and -! name was previously privatized. -! CHECK: omp.parallel private(@[[PRIVATIZER_SYM]] %[[ORIG_ALLOC]] -> %[[PAR_ARG:.*]] : !fir.ref) { -! CHECK: %[[C20:.*]] = arith.constant 20 : i32 -! CHECK: fir.store %[[C20]] to %[[PAR_ARG]] : !fir.ref -! CHECK: omp.terminator diff --git a/flang/test/Lower/OpenMP/FIR/firstprivate-commonblock.f90 b/flang/test/Lower/OpenMP/FIR/firstprivate-commonblock.f90 deleted file mode 100644 index 6adc7d9f6c82b..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/firstprivate-commonblock.f90 +++ /dev/null @@ -1,30 +0,0 @@ -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s - -!CHECK: func.func @_QPfirstprivate_common() { -!CHECK: %[[val_0:.*]] = fir.address_of(@c_) : !fir.ref> -!CHECK: %[[val_1:.*]] = fir.convert %[[val_0]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c0:.*]] = arith.constant 0 : index -!CHECK: %[[val_2:.*]] = fir.coordinate_of %[[val_1]], %[[val_c0]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_3:.*]] = fir.convert %[[val_2]] : (!fir.ref) -> !fir.ref -!CHECK: %[[val_4:.*]] = fir.convert %[[val_0]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c4:.*]] = arith.constant 4 : index -!CHECK: %[[val_5:.*]] = fir.coordinate_of %[[val_4]], %[[val_c4]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_6:.*]] = fir.convert %[[val_5]] : (!fir.ref) -> !fir.ref -!CHECK: omp.parallel { -!CHECK: %[[val_7:.*]] = fir.alloca f32 {bindc_name = "x", pinned, uniq_name = "_QFfirstprivate_commonEx"} -!CHECK: %[[val_8:.*]] = fir.load %[[val_3]] : !fir.ref -!CHECK: fir.store %[[val_8]] to %[[val_7]] : !fir.ref -!CHECK: %[[val_9:.*]] = fir.alloca f32 {bindc_name = "y", pinned, uniq_name = "_QFfirstprivate_commonEy"} -!CHECK: %[[val_10:.*]] = fir.load %[[val_6]] : !fir.ref -!CHECK: fir.store %[[val_10]] to %[[val_9]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: return -!CHECK: } - -subroutine firstprivate_common - common /c/ x, y - real x, y - !$omp parallel firstprivate(/c/) - !$omp end parallel -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/flush.f90 b/flang/test/Lower/OpenMP/FIR/flush.f90 deleted file mode 100644 index 2c281632b85cb..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/flush.f90 +++ /dev/null @@ -1,45 +0,0 @@ -! This test checks lowering of OpenMP Flush Directive. - -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect" -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --cfg-conversion | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="LLVMIRDialect,OMPDialect" - -subroutine flush_standalone(a, b, c) - integer, intent(inout) :: a, b, c - -!$omp flush(a,b,c) -!$omp flush -!OMPDialect: omp.flush(%{{.*}}, %{{.*}}, %{{.*}} : -!FIRDialect: !fir.ref, !fir.ref, !fir.ref) -!LLVMIRDialect: !llvm.ptr, !llvm.ptr, !llvm.ptr) -!OMPDialect: omp.flush - -end subroutine flush_standalone - -subroutine flush_parallel(a, b, c) - integer, intent(inout) :: a, b, c - -!$omp parallel -!OMPDialect: omp.parallel { - -!OMPDialect: omp.flush(%{{.*}}, %{{.*}}, %{{.*}} : -!FIRDialect: !fir.ref, !fir.ref, !fir.ref) -!LLVMIRDialect: !llvm.ptr, !llvm.ptr, !llvm.ptr) -!OMPDialect: omp.flush -!$omp flush(a,b,c) -!$omp flush - -!FIRDialect: %{{.*}} = fir.load %{{.*}} : !fir.ref -!FIRDialect: %{{.*}} = fir.load %{{.*}} : !fir.ref -!FIRDialect: %{{.*}} = arith.addi %{{.*}}, %{{.*}} : i32 -!FIRDialect: fir.store %{{.*}} to %{{.*}} : !fir.ref - -!LLVMIRDialect: %{{.*}} = llvm.load %{{.*}} : !llvm.ptr -> i32 -!LLVMIRDialect: %{{.*}} = llvm.load %{{.*}} : !llvm.ptr -> i32 -!LLVMIRDialect: %{{.*}} = llvm.add %{{.*}}, %{{.*}} : i32 -!LLVMIRDialect: llvm.store %{{.*}}, %{{.*}} : i32, !llvm.ptr - c = a + b - -!OMPDialect: omp.terminator -!$omp END parallel - -end subroutine flush_parallel diff --git a/flang/test/Lower/OpenMP/FIR/if-clause.f90 b/flang/test/Lower/OpenMP/FIR/if-clause.f90 deleted file mode 100644 index 683d9f7ef9726..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/if-clause.f90 +++ /dev/null @@ -1,498 +0,0 @@ -! This test checks lowering of OpenMP IF clauses. - -! The "if" clause was added to the "simd" directive in OpenMP 5.0, and -! to the "teams" directive in OpenMP 5.2. -! RUN: bbc -fopenmp -fopenmp-version=52 -emit-fir %s -o - | FileCheck %s -! RUN: %flang_fc1 -fopenmp -fopenmp-version=52 -emit-fir %s -o - | FileCheck %s - -program main - integer :: i - - ! TODO When they are supported, add tests for: - ! - DISTRIBUTE PARALLEL DO - ! - DISTRIBUTE PARALLEL DO SIMD - ! - DISTRIBUTE SIMD - ! - PARALLEL SECTIONS - ! - PARALLEL WORKSHARE - ! - TARGET PARALLEL - ! - TARGET TEAMS DISTRIBUTE - ! - TARGET TEAMS DISTRIBUTE PARALLEL DO - ! - TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD - ! - TARGET TEAMS DISTRIBUTE SIMD - ! - TARGET UPDATE - ! - TASKLOOP - ! - TASKLOOP SIMD - ! - TEAMS DISTRIBUTE - ! - TEAMS DISTRIBUTE PARALLEL DO - ! - TEAMS DISTRIBUTE PARALLEL DO SIMD - ! - TEAMS DISTRIBUTE SIMD - - ! ---------------------------------------------------------------------------- - ! DO SIMD - ! ---------------------------------------------------------------------------- - ! CHECK: omp.wsloop - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp do simd - do i = 1, 10 - end do - !$omp end do simd - - ! CHECK: omp.wsloop - !$omp do simd if(.true.) - do i = 1, 10 - end do - !$omp end do simd - - ! CHECK: omp.wsloop - !$omp do simd if(simd: .true.) - do i = 1, 10 - end do - !$omp end do simd - - ! ---------------------------------------------------------------------------- - ! PARALLEL - ! ---------------------------------------------------------------------------- - ! CHECK: omp.parallel - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp parallel - i = 10 - !$omp end parallel - - ! CHECK: omp.parallel - ! CHECK-SAME: if({{.*}}) - !$omp parallel if(.true.) - i = 10 - !$omp end parallel - - ! CHECK: omp.parallel - ! CHECK-SAME: if({{.*}}) - !$omp parallel if(parallel: .true.) - i = 10 - !$omp end parallel - - ! ---------------------------------------------------------------------------- - ! PARALLEL DO - ! ---------------------------------------------------------------------------- - ! CHECK: omp.parallel - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp parallel do - do i = 1, 10 - end do - !$omp end parallel do - - ! CHECK: omp.parallel - ! CHECK-SAME: if({{.*}}) - !$omp parallel do if(.true.) - do i = 1, 10 - end do - !$omp end parallel do - - ! CHECK: omp.parallel - ! CHECK-SAME: if({{.*}}) - !$omp parallel do if(parallel: .true.) - do i = 1, 10 - end do - !$omp end parallel do - - ! ---------------------------------------------------------------------------- - ! PARALLEL DO SIMD - ! ---------------------------------------------------------------------------- - ! CHECK: omp.parallel - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - ! CHECK: omp.wsloop - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp parallel do simd - do i = 1, 10 - end do - !$omp end parallel do simd - - ! CHECK: omp.parallel - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.wsloop - !$omp parallel do simd if(.true.) - do i = 1, 10 - end do - !$omp end parallel do simd - - ! CHECK: omp.parallel - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.wsloop - !$omp parallel do simd if(parallel: .true.) if(simd: .false.) - do i = 1, 10 - end do - !$omp end parallel do simd - - ! CHECK: omp.parallel - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.wsloop - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp parallel do simd if(parallel: .true.) - do i = 1, 10 - end do - !$omp end parallel do simd - - ! CHECK: omp.parallel - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - ! CHECK: omp.wsloop - !$omp parallel do simd if(simd: .true.) - do i = 1, 10 - end do - !$omp end parallel do simd - - ! ---------------------------------------------------------------------------- - ! SIMD - ! ---------------------------------------------------------------------------- - ! CHECK: omp.simd - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp simd - do i = 1, 10 - end do - !$omp end simd - - ! CHECK: omp.simd - ! CHECK-SAME: if({{.*}}) - !$omp simd if(.true.) - do i = 1, 10 - end do - !$omp end simd - - ! CHECK: omp.simd - ! CHECK-SAME: if({{.*}}) - !$omp simd if(simd: .true.) - do i = 1, 10 - end do - !$omp end simd - - ! ---------------------------------------------------------------------------- - ! TARGET - ! ---------------------------------------------------------------------------- - ! CHECK: omp.target - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp target - !$omp end target - - ! CHECK: omp.target - ! CHECK-SAME: if({{.*}}) - !$omp target if(.true.) - !$omp end target - - ! CHECK: omp.target - ! CHECK-SAME: if({{.*}}) - !$omp target if(target: .true.) - !$omp end target - - ! ---------------------------------------------------------------------------- - ! TARGET DATA - ! ---------------------------------------------------------------------------- - ! CHECK: omp.target_data - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp target data map(tofrom: i) - !$omp end target data - - ! CHECK: omp.target_data - ! CHECK-SAME: if({{.*}}) - !$omp target data map(tofrom: i) if(.true.) - !$omp end target data - - ! CHECK: omp.target_data - ! CHECK-SAME: if({{.*}}) - !$omp target data map(tofrom: i) if(target data: .true.) - !$omp end target data - - ! ---------------------------------------------------------------------------- - ! TARGET ENTER DATA - ! ---------------------------------------------------------------------------- - ! CHECK: omp.target_enter_data - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: map - !$omp target enter data map(to: i) - - ! CHECK: omp.target_enter_data - ! CHECK-SAME: if({{.*}}) - !$omp target enter data map(to: i) if(.true.) - - ! CHECK: omp.target_enter_data - ! CHECK-SAME: if({{.*}}) - !$omp target enter data map(to: i) if(target enter data: .true.) - - ! ---------------------------------------------------------------------------- - ! TARGET EXIT DATA - ! ---------------------------------------------------------------------------- - ! CHECK: omp.target_exit_data - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: map - !$omp target exit data map(from: i) - - ! CHECK: omp.target_exit_data - ! CHECK-SAME: if({{.*}}) - !$omp target exit data map(from: i) if(.true.) - - ! CHECK: omp.target_exit_data - ! CHECK-SAME: if({{.*}}) - !$omp target exit data map(from: i) if(target exit data: .true.) - - ! ---------------------------------------------------------------------------- - ! TARGET PARALLEL DO - ! ---------------------------------------------------------------------------- - ! CHECK: omp.target - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - ! CHECK: omp.parallel - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp target parallel do - do i = 1, 10 - end do - !$omp end target parallel do - - ! CHECK: omp.target - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.parallel - ! CHECK-SAME: if({{.*}}) - !$omp target parallel do if(.true.) - do i = 1, 10 - end do - !$omp end target parallel do - - ! CHECK: omp.target - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.parallel - ! CHECK-SAME: if({{.*}}) - !$omp target parallel do if(target: .true.) if(parallel: .false.) - do i = 1, 10 - end do - !$omp end target parallel do - - ! CHECK: omp.target - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.parallel - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp target parallel do if(target: .true.) - do i = 1, 10 - end do - !$omp end target parallel do - - ! CHECK: omp.target - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - ! CHECK: omp.parallel - ! CHECK-SAME: if({{.*}}) - !$omp target parallel do if(parallel: .true.) - do i = 1, 10 - end do - !$omp end target parallel do - - ! ---------------------------------------------------------------------------- - ! TARGET PARALLEL DO SIMD - ! ---------------------------------------------------------------------------- - ! CHECK: omp.target - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - ! CHECK: omp.parallel - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - ! CHECK: omp.wsloop - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp target parallel do simd - do i = 1, 10 - end do - !$omp end target parallel do simd - - ! CHECK: omp.target - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.parallel - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.wsloop - !$omp target parallel do simd if(.true.) - do i = 1, 10 - end do - !$omp end target parallel do simd - - ! CHECK: omp.target - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.parallel - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.wsloop - !$omp target parallel do simd if(target: .true.) if(parallel: .false.) & - !$omp& if(simd: .true.) - do i = 1, 10 - end do - !$omp end target parallel do simd - - ! CHECK: omp.target - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.parallel - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - ! CHECK: omp.wsloop - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp target parallel do simd if(target: .true.) - do i = 1, 10 - end do - !$omp end target parallel do simd - - ! CHECK: omp.target - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - ! CHECK: omp.parallel - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.wsloop - !$omp target parallel do simd if(parallel: .true.) if(simd: .false.) - do i = 1, 10 - end do - !$omp end target parallel do simd - - ! ---------------------------------------------------------------------------- - ! TARGET SIMD - ! ---------------------------------------------------------------------------- - ! CHECK: omp.target - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - ! CHECK: omp.simd - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp target simd - do i = 1, 10 - end do - !$omp end target simd - - ! CHECK: omp.target - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.simd - ! CHECK-SAME: if({{.*}}) - !$omp target simd if(.true.) - do i = 1, 10 - end do - !$omp end target simd - - ! CHECK: omp.target - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.simd - ! CHECK-SAME: if({{.*}}) - !$omp target simd if(target: .true.) if(simd: .false.) - do i = 1, 10 - end do - !$omp end target simd - - ! CHECK: omp.target - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.simd - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp target simd if(target: .true.) - do i = 1, 10 - end do - !$omp end target simd - - ! CHECK: omp.target - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - ! CHECK: omp.simd - ! CHECK-SAME: if({{.*}}) - !$omp target simd if(simd: .true.) - do i = 1, 10 - end do - !$omp end target simd - - ! ---------------------------------------------------------------------------- - ! TARGET TEAMS - ! ---------------------------------------------------------------------------- - - ! CHECK: omp.target - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - ! CHECK: omp.teams - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp target teams - i = 1 - !$omp end target teams - - ! CHECK: omp.target - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.teams - ! CHECK-SAME: if({{.*}}) - !$omp target teams if(.true.) - i = 1 - !$omp end target teams - - ! CHECK: omp.target - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.teams - ! CHECK-SAME: if({{.*}}) - !$omp target teams if(target: .true.) if(teams: .false.) - i = 1 - !$omp end target teams - - ! CHECK: omp.target - ! CHECK-SAME: if({{.*}}) - ! CHECK: omp.teams - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp target teams if(target: .true.) - i = 1 - !$omp end target teams - - ! CHECK: omp.target - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - ! CHECK: omp.teams - ! CHECK-SAME: if({{.*}}) - !$omp target teams if(teams: .true.) - i = 1 - !$omp end target teams - - ! ---------------------------------------------------------------------------- - ! TASK - ! ---------------------------------------------------------------------------- - ! CHECK: omp.task - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp task - !$omp end task - - ! CHECK: omp.task - ! CHECK-SAME: if({{.*}}) - !$omp task if(.true.) - !$omp end task - - ! CHECK: omp.task - ! CHECK-SAME: if({{.*}}) - !$omp task if(task: .true.) - !$omp end task - - ! ---------------------------------------------------------------------------- - ! TEAMS - ! ---------------------------------------------------------------------------- - ! CHECK: omp.teams - ! CHECK-NOT: if({{.*}}) - ! CHECK-SAME: { - !$omp teams - i = 1 - !$omp end teams - - ! CHECK: omp.teams - ! CHECK-SAME: if({{.*}}) - !$omp teams if(.true.) - i = 1 - !$omp end teams - - ! CHECK: omp.teams - ! CHECK-SAME: if({{.*}}) - !$omp teams if(teams: .true.) - i = 1 - !$omp end teams -end program main diff --git a/flang/test/Lower/OpenMP/FIR/is-device.f90 b/flang/test/Lower/OpenMP/FIR/is-device.f90 deleted file mode 100644 index 79e0ee506c5f2..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/is-device.f90 +++ /dev/null @@ -1,14 +0,0 @@ -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=DEVICE -!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s --check-prefix=HOST -!RUN: %flang_fc1 -emit-fir -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=DEVICE-FLAG-ONLY -!RUN: bbc -fopenmp -fopenmp-is-target-device -emit-fir -o - %s | FileCheck %s --check-prefix=DEVICE -!RUN: bbc -fopenmp -emit-fir -o - %s | FileCheck %s --check-prefix=HOST -!RUN: bbc -fopenmp-is-target-device -emit-fir -o - %s | FileCheck %s --check-prefix=DEVICE-FLAG-ONLY - -!DEVICE: module attributes {{{.*}}, omp.is_target_device = true{{.*}}} -!HOST: module attributes {{{.*}}, omp.is_target_device = false{{.*}}} -!DEVICE-FLAG-ONLY: module attributes {{{.*}}" -!DEVICE-FLAG-ONLY-NOT: , omp.is_target_device = {{.*}} -!DEVICE-FLAG-ONLY-SAME: } -subroutine omp_subroutine() -end subroutine omp_subroutine diff --git a/flang/test/Lower/OpenMP/FIR/lastprivate-commonblock.f90 b/flang/test/Lower/OpenMP/FIR/lastprivate-commonblock.f90 deleted file mode 100644 index 86c4d917fa51e..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/lastprivate-commonblock.f90 +++ /dev/null @@ -1,49 +0,0 @@ -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s - -!CHECK: func.func @_QPlastprivate_common() { -!CHECK: %[[val_0:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -!CHECK: %[[val_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFlastprivate_commonEi"} -!CHECK: %[[val_2:.*]] = fir.address_of(@c_) : !fir.ref> -!CHECK: %[[val_3:.*]] = fir.convert %[[val_2]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c0:.*]] = arith.constant 0 : index -!CHECK: %[[val_4:.*]] = fir.coordinate_of %[[val_3]], %[[val_c0]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_5:.*]] = fir.convert %[[val_4]] : (!fir.ref) -> !fir.ref -!CHECK: %[[val_6:.*]] = fir.convert %[[val_2]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c4:.*]] = arith.constant 4 : index -!CHECK: %[[val_7:.*]] = fir.coordinate_of %[[val_6]], %[[val_c4]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_8:.*]] = fir.convert %[[val_7]] : (!fir.ref) -> !fir.ref -!CHECK: %[[val_9:.*]] = fir.alloca f32 {bindc_name = "x", pinned, uniq_name = "_QFlastprivate_commonEx"} -!CHECK: %[[val_10:.*]] = fir.alloca f32 {bindc_name = "y", pinned, uniq_name = "_QFlastprivate_commonEy"} -!CHECK: %[[val_c1_i32:.*]] = arith.constant 1 : i32 -!CHECK: %[[val_c100_i32:.*]] = arith.constant 100 : i32 -!CHECK: %[[val_c1_i32_0:.*]] = arith.constant 1 : i32 -!CHECK: omp.wsloop { -!CHECK-NEXT: omp.loop_nest (%[[arg:.*]]) : i32 = (%[[val_c1_i32]]) to (%[[val_c100_i32]]) inclusive step (%[[val_c1_i32_0]]) { -!CHECK: fir.store %[[arg]] to %[[val_0]] : !fir.ref -!CHECK: %[[val_11:.*]] = arith.addi %[[arg]], %[[val_c1_i32_0]] : i32 -!CHECK: %[[val_c0_i32:.*]] = arith.constant 0 : i32 -!CHECK: %[[val_12:.*]] = arith.cmpi slt, %[[val_c1_i32_0]], %[[val_c0_i32]] : i32 -!CHECK: %[[val_13:.*]] = arith.cmpi slt, %[[val_11]], %[[val_c100_i32]] : i32 -!CHECK: %[[val_14:.*]] = arith.cmpi sgt, %[[val_11]], %[[val_c100_i32]] : i32 -!CHECK: %[[val_15:.*]] = arith.select %[[val_12]], %[[val_13]], %[[val_14]] : i1 -!CHECK: fir.if %[[val_15]] { -!CHECK: fir.store %[[val_11]] to %[[val_0]] : !fir.ref -!CHECK: %[[val_16:.*]] = fir.load %[[val_9]] : !fir.ref -!CHECK: fir.store %[[val_16]] to %[[val_5]] : !fir.ref -!CHECK: %[[val_17:.*]] = fir.load %[[val_10]] : !fir.ref -!CHECK: fir.store %[[val_17]] to %[[val_8]] : !fir.ref -!CHECK: } -!CHECK: omp.yield -!CHECK: } -!CHECK: omp.terminator -!CHECK: } -!CHECK: return -!CHECK: } -subroutine lastprivate_common - common /c/ x, y - real x, y - !$omp do lastprivate(/c/) - do i=1,100 - end do - !$omp end do -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/location.f90 b/flang/test/Lower/OpenMP/FIR/location.f90 deleted file mode 100644 index 6a7fb3c035846..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/location.f90 +++ /dev/null @@ -1,71 +0,0 @@ -! This test checks location of OpenMP constructs and clauses - -!RUN: %flang_fc1 -emit-fir -fopenmp -mmlir --mlir-print-debuginfo %s -o - | FileCheck %s - -!CHECK-LABEL: sub_parallel -subroutine sub_parallel() - print *, x -!CHECK: omp.parallel { - !$omp parallel - print *, x -!CHECK: omp.terminator loc(#[[PAR_LOC:.*]]) -!CHECK: } loc(#[[PAR_LOC]]) - !$omp end parallel - print *, x -end - -!CHECK-LABEL: sub_target -subroutine sub_target() - print *, x -!CHECK: omp.target {{.*}} { - !$omp target - print *, x -!CHECK: omp.terminator loc(#[[TAR_LOC:.*]]) -!CHECK: } loc(#[[TAR_LOC]]) - !$omp end target - print *, x -end - -!CHECK-LABEL: sub_loop -subroutine sub_loop() -!CHECK: omp.wsloop { -!CHECK-NEXT: omp.loop_nest {{.*}} { - !$omp do - do i=1,10 - print *, i -!CHECK: omp.yield loc(#[[LOOP_LOC:.*]]) -!CHECK: } loc(#[[LOOP_LOC]]) -!CHECK: omp.terminator loc(#[[LOOP_LOC]]) -!CHECK: } loc(#[[LOOP_LOC]]) - end do - !$omp end do -end - -!CHECK-LABEL: sub_standalone -subroutine sub_standalone() - !CHECK: omp.barrier loc(#[[BAR_LOC:.*]]) - !$omp barrier - !CHECK: omp.taskwait loc(#[[TW_LOC:.*]]) - !$omp taskwait - !CHECK: omp.taskyield loc(#[[TY_LOC:.*]]) - !$omp taskyield -end - -subroutine sub_if(c) - logical(kind=4) :: c - !CHECK: %[[CVT:.*]] = fir.convert %{{.*}} : (!fir.logical<4>) -> i1 loc(#[[IF_LOC:.*]]) - !CHECK: omp.task if(%[[CVT]]) - !$omp task if(c) - print *, "Task" - !$omp end task - !CHECK: } loc(#[[TASK_LOC:.*]]) -end subroutine - -!CHECK: #[[PAR_LOC]] = loc("{{.*}}location.f90":9:9) -!CHECK: #[[TAR_LOC]] = loc("{{.*}}location.f90":21:9) -!CHECK: #[[LOOP_LOC]] = loc("{{.*}}location.f90":33:9) -!CHECK: #[[BAR_LOC]] = loc("{{.*}}location.f90":47:9) -!CHECK: #[[TW_LOC]] = loc("{{.*}}location.f90":49:9) -!CHECK: #[[TY_LOC]] = loc("{{.*}}location.f90":51:9) -!CHECK: #[[IF_LOC]] = loc("{{.*}}location.f90":58:14) -!CHECK: #[[TASK_LOC]] = loc("{{.*}}location.f90":58:9) diff --git a/flang/test/Lower/OpenMP/FIR/loop-combined.f90 b/flang/test/Lower/OpenMP/FIR/loop-combined.f90 deleted file mode 100644 index 6c6618dc9fb57..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/loop-combined.f90 +++ /dev/null @@ -1,83 +0,0 @@ -! This test checks lowering of OpenMP combined loop constructs. - -! RUN: bbc -fopenmp -emit-fir %s -o - | FileCheck %s -! RUN: %flang_fc1 -fopenmp -emit-fir %s -o - | FileCheck %s - -program main - integer :: i - - ! TODO When DISTRIBUTE, TASKLOOP and TEAMS are supported add: - ! - DISTRIBUTE PARALLEL DO SIMD - ! - DISTRIBUTE PARALLEL DO - ! - DISTRIBUTE SIMD - ! - TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD - ! - TARGET TEAMS DISTRIBUTE PARALLEL DO - ! - TARGET TEAMS DISTRIBUTE SIMD - ! - TARGET TEAMS DISTRIBUTE - ! - TASKLOOP SIMD - ! - TEAMS DISTRIBUTE PARALLEL DO SIMD - ! - TEAMS DISTRIBUTE PARALLEL DO - ! - TEAMS DISTRIBUTE SIMD - ! - TEAMS DISTRIBUTE - - ! ---------------------------------------------------------------------------- - ! DO SIMD - ! ---------------------------------------------------------------------------- - ! CHECK: omp.wsloop - !$omp do simd - do i = 1, 10 - end do - !$omp end do simd - - ! ---------------------------------------------------------------------------- - ! PARALLEL DO SIMD - ! ---------------------------------------------------------------------------- - ! CHECK: omp.parallel - ! CHECK: omp.wsloop - !$omp parallel do simd - do i = 1, 10 - end do - !$omp end parallel do simd - - ! ---------------------------------------------------------------------------- - ! PARALLEL DO - ! ---------------------------------------------------------------------------- - ! CHECK: omp.parallel - ! CHECK: omp.wsloop - !$omp parallel do - do i = 1, 10 - end do - !$omp end parallel do - - ! ---------------------------------------------------------------------------- - ! TARGET PARALLEL DO SIMD - ! ---------------------------------------------------------------------------- - ! CHECK: omp.target - ! CHECK: omp.parallel - ! CHECK: omp.wsloop - !$omp target parallel do simd - do i = 1, 10 - end do - !$omp end target parallel do simd - - ! ---------------------------------------------------------------------------- - ! TARGET PARALLEL DO - ! ---------------------------------------------------------------------------- - ! CHECK: omp.target - ! CHECK: omp.parallel - ! CHECK: omp.wsloop - !$omp target parallel do - do i = 1, 10 - end do - !$omp end target parallel do - - ! ---------------------------------------------------------------------------- - ! TARGET SIMD - ! ---------------------------------------------------------------------------- - ! CHECK: omp.target - ! CHECK: omp.simd - !$omp target simd - do i = 1, 10 - end do - !$omp end target simd -end program main diff --git a/flang/test/Lower/OpenMP/FIR/map-component-ref.f90 b/flang/test/Lower/OpenMP/FIR/map-component-ref.f90 deleted file mode 100644 index 6799941701f42..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/map-component-ref.f90 +++ /dev/null @@ -1,33 +0,0 @@ -! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s -! RUN: bbc -fopenmp -emit-fir %s -o - | FileCheck %s - -! CHECK: %[[V0:[0-9]+]] = fir.alloca !fir.type<_QFfooTt0{a0:i32,a1:i32}> {bindc_name = "a", uniq_name = "_QFfooEa"} -! CHECK: %[[V1:[0-9]+]] = fir.declare %[[V0]] {uniq_name = "_QFfooEa"} : (!fir.ref>) -> !fir.ref> -! CHECK: %[[V2:[0-9]+]] = fir.field_index a1, !fir.type<_QFfooTt0{a0:i32,a1:i32}> -! CHECK: %[[V3:[0-9]+]] = fir.coordinate_of %[[V1]], %[[V2]] : (!fir.ref>, !fir.field) -> !fir.ref -! CHECK: %[[V4:[0-9]+]] = omp.map.info var_ptr(%[[V3]] : !fir.ref, i32) map_clauses(tofrom) capture(ByRef) -> !fir.ref {name = "a%a1"} -! CHECK: %[[V5:[0-9]+]] = omp.map.info var_ptr(%[[V1]] : !fir.ref>, !fir.type<_QFfooTt0{a0:i32,a1:i32}>) map_clauses(implicit, tofrom) capture(ByRef) -> !fir.ref> {name = "a"} -! CHECK: omp.target map_entries(%[[V4]] -> %arg0, %[[V5]] -> %arg1 : !fir.ref, !fir.ref>) { -! CHECK: ^bb0(%arg0: !fir.ref, %arg1: !fir.ref>): -! CHECK: %c0_i32 = arith.constant 0 : i32 -! CHECK: %[[V6:[0-9]+]] = fir.declare %arg1 {uniq_name = "_QFfooEa"} : (!fir.ref>) -> !fir.ref> -! CHECK: %[[V7:[0-9]+]] = fir.field_index a1, !fir.type<_QFfooTt0{a0:i32,a1:i32}> -! CHECK: %[[V8:[0-9]+]] = fir.coordinate_of %[[V6]], %[[V7]] : (!fir.ref>, !fir.field) -> !fir.ref -! CHECK: fir.store %c0_i32 to %[[V8]] : !fir.ref -! CHECK: omp.terminator -! CHECK: } - -subroutine foo() - implicit none - - type t0 - integer :: a0, a1 - end type - - type(t0) :: a - - !$omp target map(a%a1) - a%a1 = 0 - !$omp end target -end - diff --git a/flang/test/Lower/OpenMP/FIR/master.f90 b/flang/test/Lower/OpenMP/FIR/master.f90 deleted file mode 100644 index dd9910da2f419..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/master.f90 +++ /dev/null @@ -1,100 +0,0 @@ -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect" -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --cfg-conversion | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="OMPDialect" - -!=============================================================================== -! parallel construct with function call which has master construct internally -!=============================================================================== -!FIRDialect-LABEL: func @_QPomp_master -subroutine omp_master() - -!OMPDialect: omp.master { -!$omp master - - !FIRDialect: fir.call @_QPmaster() {{.*}}: () -> () - call master() - -!OMPDialect: omp.terminator -!$omp end master - -end subroutine omp_master - -!FIRDialect-LABEL: func @_QPparallel_function_master -subroutine parallel_function_master() - -!OMPDialect: omp.parallel { -!$omp parallel - - !FIRDialect: fir.call @_QPfoo() {{.*}}: () -> () - call foo() - -!OMPDialect: omp.terminator -!$omp end parallel - -end subroutine parallel_function_master - -!=============================================================================== -! master construct nested inside parallel construct -!=============================================================================== - -!FIRDialect-LABEL: func @_QPomp_parallel_master -subroutine omp_parallel_master() - -!OMPDialect: omp.parallel { -!$omp parallel - !FIRDialect: fir.call @_QPparallel() {{.*}}: () -> () - call parallel() - -!OMPDialect: omp.master { -!$omp master - - !FIRDialect: fir.call @_QPparallel_master() {{.*}}: () -> () - call parallel_master() - -!OMPDialect: omp.terminator -!$omp end master - -!OMPDialect: omp.terminator -!$omp end parallel - -end subroutine omp_parallel_master - -!=============================================================================== -! master construct nested inside parallel construct with conditional flow -!=============================================================================== - -!FIRDialect-LABEL: func @_QPomp_master_parallel -subroutine omp_master_parallel() - integer :: alpha, beta, gama - alpha = 4 - beta = 5 - gama = 6 - -!OMPDialect: omp.master { -!$omp master - - !FIRDialect: %{{.*}} = fir.load %{{.*}} - !FIRDialect: %{{.*}} = fir.load %{{.*}} - !FIRDialect: %[[RESULT:.*]] = arith.cmpi sge, %{{.*}}, %{{.*}} - !FIRDialect: fir.if %[[RESULT]] { - if (alpha .ge. gama) then - -!OMPDialect: omp.parallel { -!$omp parallel - !FIRDialect: fir.call @_QPinside_if_parallel() {{.*}}: () -> () - call inside_if_parallel() - -!OMPDialect: omp.terminator -!$omp end parallel - - !FIRDialect: %{{.*}} = fir.load %{{.*}} - !FIRDialect: %{{.*}} = fir.load %{{.*}} - !FIRDialect: %{{.*}} = arith.addi %{{.*}}, %{{.*}} - !FIRDialect: fir.store %{{.*}} to %{{.*}} - beta = alpha + gama - end if - !FIRDialect: else - -!OMPDialect: omp.terminator -!$omp end master - -end subroutine omp_master_parallel diff --git a/flang/test/Lower/OpenMP/FIR/omp-declare-target-program-var.f90 b/flang/test/Lower/OpenMP/FIR/omp-declare-target-program-var.f90 deleted file mode 100644 index 0da76f6d9ad2c..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/omp-declare-target-program-var.f90 +++ /dev/null @@ -1,12 +0,0 @@ -!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s --check-prefixes=HOST,ALL -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=ALL - -PROGRAM main - ! HOST-DAG: %0 = fir.alloca f32 {bindc_name = "i", uniq_name = "_QFEi"} - REAL :: I - ! ALL-DAG: fir.global internal @_QFEi {omp.declare_target = #omp.declaretarget} : f32 { - ! ALL-DAG: %0 = fir.undefined f32 - ! ALL-DAG: fir.has_value %0 : f32 - ! ALL-DAG: } - !$omp declare target(I) -END diff --git a/flang/test/Lower/OpenMP/FIR/omp-is-gpu.f90 b/flang/test/Lower/OpenMP/FIR/omp-is-gpu.f90 deleted file mode 100644 index ac8d249748015..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/omp-is-gpu.f90 +++ /dev/null @@ -1,16 +0,0 @@ -!REQUIRES: amdgpu-registered-target, nvptx-registered-target - -!RUN: %flang_fc1 -triple amdgcn-amd-amdhsa -emit-fir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s -!RUN: %flang_fc1 -triple nvptx64-nvidia-cuda -emit-fir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s -!RUN: bbc -fopenmp -fopenmp-is-target-device -fopenmp-is-gpu -emit-fir -o - %s | FileCheck %s - -!RUN: not %flang_fc1 -triple amdgcn-amd-amdhsa -emit-fir -fopenmp %s -o - 2>&1 | FileCheck %s --check-prefix=FLANG-ERROR -!RUN: not %flang_fc1 -triple nvptx64-nvidia-cuda -emit-fir -fopenmp %s -o - 2>&1 | FileCheck %s --check-prefix=FLANG-ERROR -!RUN: not bbc -fopenmp -fopenmp-is-gpu -emit-fir %s -o - 2>&1 | FileCheck %s --check-prefix=BBC-ERROR - -!CHECK: module attributes {{{.*}}omp.is_gpu = true -subroutine omp_subroutine() -end subroutine omp_subroutine - -!FLANG-ERROR: error: OpenMP AMDGPU/NVPTX is only prepared to deal with device code. -!BBC-ERROR: FATAL: -fopenmp-is-gpu can only be set if -fopenmp-is-target-device is also set diff --git a/flang/test/Lower/OpenMP/FIR/ordered-threads.f90 b/flang/test/Lower/OpenMP/FIR/ordered-threads.f90 deleted file mode 100644 index 2dea4c857e877..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/ordered-threads.f90 +++ /dev/null @@ -1,40 +0,0 @@ -! This test checks lowering of OpenMP ordered directive with threads Clause. -! Without clause in ordered direcitve, it behaves as if threads clause is -! specified. - -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefix=FIRDialect -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefix=LLVMIRDialect -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | tco | FileCheck %s --check-prefix=LLVMIR - -subroutine ordered - integer :: i - integer :: a(20) - -!FIRDialect: omp.ordered.region { -!LLVMIRDialect: omp.ordered.region { -!LLVMIR: [[TMP0:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB0:[0-9]+]]) -!LLVMIR-NEXT: call void @__kmpc_ordered(ptr @[[GLOB0]], i32 [[TMP0]]) -!$OMP ORDERED - a(i) = a(i-1) + 1 -!FIRDialect: omp.terminator -!FIRDialect-NEXT: } -!LLVMIRDialect: omp.terminator -!LLVMIRDialect-NEXT: } -!LLVMIR: call void @__kmpc_end_ordered(ptr @[[GLOB0]], i32 [[TMP0]]) -!$OMP END ORDERED - -!FIRDialect: omp.ordered.region { -!LLVMIRDialect: omp.ordered.region { -!LLVMIR: [[TMP1:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1:[0-9]+]]) -!LLVMIR-NEXT: call void @__kmpc_ordered(ptr @[[GLOB1]], i32 [[TMP1]]) -!$OMP ORDERED THREADS - a(i) = a(i-1) + 1 -!FIRDialect: omp.terminator -!FIRDialect-NEXT: } -!LLVMIRDialect: omp.terminator -!LLVMIRDialect-NEXT: } -!LLVMIR: call void @__kmpc_end_ordered(ptr @[[GLOB1]], i32 [[TMP1]]) -!LLVMIR-NEXT: ret void -!$OMP END ORDERED - -end diff --git a/flang/test/Lower/OpenMP/FIR/parallel-firstprivate-clause-scalar.f90 b/flang/test/Lower/OpenMP/FIR/parallel-firstprivate-clause-scalar.f90 deleted file mode 100644 index 37f916ecb84c9..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/parallel-firstprivate-clause-scalar.f90 +++ /dev/null @@ -1,159 +0,0 @@ -! This test checks lowering of `FIRSTPRIVATE` clause for scalar types. - -! REQUIRES: shell -! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefix=FIRDialect - -!FIRDialect-DAG: func @_QPfirstprivate_complex(%[[ARG1:.*]]: !fir.ref>{{.*}}, %[[ARG2:.*]]: !fir.ref>{{.*}}) { -!FIRDialect: omp.parallel { -!FIRDialect: %[[ARG1_PVT:.*]] = fir.alloca !fir.complex<4> {bindc_name = "arg1", pinned, uniq_name = "_QFfirstprivate_complexEarg1"} -!FIRDialect: %[[ARG1_VAL:.*]] = fir.load %[[ARG1]] : !fir.ref> -!FIRDialect: fir.store %[[ARG1_VAL]] to %[[ARG1_PVT]] : !fir.ref> -!FIRDialect: %[[ARG2_PVT:.*]] = fir.alloca !fir.complex<8> {bindc_name = "arg2", pinned, uniq_name = "_QFfirstprivate_complexEarg2"} -!FIRDialect: %[[ARG2_VAL:.*]] = fir.load %[[ARG2]] : !fir.ref> -!FIRDialect: fir.store %[[ARG2_VAL]] to %[[ARG2_PVT]] : !fir.ref> -!FIRDialect: fir.call @_QPfoo(%[[ARG1_PVT]], %[[ARG2_PVT]]) {{.*}}: (!fir.ref>, !fir.ref>) -> () -!FIRDialect: omp.terminator -!FIRDialect: } - -subroutine firstprivate_complex(arg1, arg2) - complex(4) :: arg1 - complex(8) :: arg2 - -!$OMP PARALLEL FIRSTPRIVATE(arg1, arg2) - call foo(arg1, arg2) -!$OMP END PARALLEL - -end subroutine - -!FIRDialect-DAG: func @_QPfirstprivate_integer(%[[ARG1:.*]]: !fir.ref{{.*}}, %[[ARG2:.*]]: !fir.ref{{.*}}, %[[ARG3:.*]]: !fir.ref{{.*}}, %[[ARG4:.*]]: !fir.ref{{.*}}, %[[ARG5:.*]]: !fir.ref{{.*}}, %[[ARG6:.*]]: !fir.ref{{.*}}) { -!FIRDialect: omp.parallel { -!FIRDialect: %[[ARG1_PVT:.*]] = fir.alloca i32 {bindc_name = "arg1", pinned, uniq_name = "_QFfirstprivate_integerEarg1"} -!FIRDialect: %[[ARG1_VAL:.*]] = fir.load %[[ARG1]] : !fir.ref -!FIRDialect: fir.store %[[ARG1_VAL]] to %[[ARG1_PVT]] : !fir.ref -!FIRDialect: %[[ARG2_PVT:.*]] = fir.alloca i8 {bindc_name = "arg2", pinned, uniq_name = "_QFfirstprivate_integerEarg2"} -!FIRDialect: %[[ARG2_VAL:.*]] = fir.load %[[ARG2]] : !fir.ref -!FIRDialect: fir.store %[[ARG2_VAL]] to %[[ARG2_PVT]] : !fir.ref -!FIRDialect: %[[ARG3_PVT:.*]] = fir.alloca i16 {bindc_name = "arg3", pinned, uniq_name = "_QFfirstprivate_integerEarg3"} -!FIRDialect: %[[ARG3_VAL:.*]] = fir.load %[[ARG3]] : !fir.ref -!FIRDialect: fir.store %[[ARG3_VAL]] to %[[ARG3_PVT]] : !fir.ref -!FIRDialect: %[[ARG4_PVT:.*]] = fir.alloca i32 {bindc_name = "arg4", pinned, uniq_name = "_QFfirstprivate_integerEarg4"} -!FIRDialect: %[[ARG4_VAL:.*]] = fir.load %[[ARG4]] : !fir.ref -!FIRDialect: fir.store %[[ARG4_VAL]] to %[[ARG4_PVT]] : !fir.ref -!FIRDialect: %[[ARG5_PVT:.*]] = fir.alloca i64 {bindc_name = "arg5", pinned, uniq_name = "_QFfirstprivate_integerEarg5"} -!FIRDialect: %[[ARG5_VAL:.*]] = fir.load %[[ARG5]] : !fir.ref -!FIRDialect: fir.store %[[ARG5_VAL]] to %[[ARG5_PVT]] : !fir.ref -!FIRDialect: %[[ARG6_PVT:.*]] = fir.alloca i128 {bindc_name = "arg6", pinned, uniq_name = "_QFfirstprivate_integerEarg6"} -!FIRDialect: %[[ARG6_VAL:.*]] = fir.load %[[ARG6]] : !fir.ref -!FIRDialect: fir.store %[[ARG6_VAL]] to %[[ARG6_PVT]] : !fir.ref -!FIRDialect: fir.call @_QPbar(%[[ARG1_PVT]], %[[ARG2_PVT]], %[[ARG3_PVT]], %[[ARG4_PVT]], %[[ARG5_PVT]], %[[ARG6_PVT]]) {{.*}}: (!fir.ref, !fir.ref, !fir.ref, !fir.ref, !fir.ref, !fir.ref) -> () -!FIRDialect: omp.terminator -!FIRDialect: } - -subroutine firstprivate_integer(arg1, arg2, arg3, arg4, arg5, arg6) - integer :: arg1 - integer(kind=1) :: arg2 - integer(kind=2) :: arg3 - integer(kind=4) :: arg4 - integer(kind=8) :: arg5 - integer(kind=16) :: arg6 - -!$OMP PARALLEL FIRSTPRIVATE(arg1, arg2, arg3, arg4, arg5, arg6) - call bar(arg1, arg2, arg3, arg4, arg5, arg6) -!$OMP END PARALLEL - -end subroutine - -!FIRDialect-DAG: func @_QPfirstprivate_logical(%[[ARG1:.*]]: !fir.ref>{{.*}}, %[[ARG2:.*]]: !fir.ref>{{.*}}, %[[ARG3:.*]]: !fir.ref>{{.*}}, %[[ARG4:.*]]: !fir.ref>{{.*}}, %[[ARG5:.*]]: !fir.ref>{{.*}}) { -!FIRDialect: omp.parallel { -!FIRDialect: %[[ARG1_PVT:.*]] = fir.alloca !fir.logical<4> {bindc_name = "arg1", pinned, uniq_name = "_QFfirstprivate_logicalEarg1"} -!FIRDialect: %[[ARG1_VAL:.*]] = fir.load %[[ARG1]] : !fir.ref> -!FIRDialect: fir.store %[[ARG1_VAL]] to %[[ARG1_PVT]] : !fir.ref> -!FIRDialect: %[[ARG2_PVT:.*]] = fir.alloca !fir.logical<1> {bindc_name = "arg2", pinned, uniq_name = "_QFfirstprivate_logicalEarg2"} -!FIRDialect: %[[ARG2_VAL:.*]] = fir.load %[[ARG2]] : !fir.ref> -!FIRDialect: fir.store %[[ARG2_VAL]] to %[[ARG2_PVT]] : !fir.ref> -!FIRDialect: %[[ARG3_PVT:.*]] = fir.alloca !fir.logical<2> {bindc_name = "arg3", pinned, uniq_name = "_QFfirstprivate_logicalEarg3"} -!FIRDialect: %[[ARG3_VAL:.*]] = fir.load %[[ARG3]] : !fir.ref> -!FIRDialect: fir.store %[[ARG3_VAL]] to %[[ARG3_PVT]] : !fir.ref> -!FIRDialect: %[[ARG4_PVT:.*]] = fir.alloca !fir.logical<4> {bindc_name = "arg4", pinned, uniq_name = "_QFfirstprivate_logicalEarg4"} -!FIRDialect: %[[ARG4_VAL:.*]] = fir.load %[[ARG4]] : !fir.ref> -!FIRDialect: fir.store %[[ARG4_VAL]] to %[[ARG4_PVT]] : !fir.ref> -!FIRDialect: %[[ARG5_PVT:.*]] = fir.alloca !fir.logical<8> {bindc_name = "arg5", pinned, uniq_name = "_QFfirstprivate_logicalEarg5"} -!FIRDialect: %[[ARG5_VAL:.*]] = fir.load %[[ARG5]] : !fir.ref> -!FIRDialect: fir.store %[[ARG5_VAL]] to %[[ARG5_PVT]] : !fir.ref> -!FIRDialect: fir.call @_QPbaz(%[[ARG1_PVT]], %[[ARG2_PVT]], %[[ARG3_PVT]], %[[ARG4_PVT]], %[[ARG5_PVT]]) {{.*}}: (!fir.ref>, !fir.ref>, !fir.ref>, !fir.ref>, !fir.ref>) -> () -!FIRDialect: omp.terminator -!FIRDialect: } - -subroutine firstprivate_logical(arg1, arg2, arg3, arg4, arg5) - logical :: arg1 - logical(kind=1) :: arg2 - logical(kind=2) :: arg3 - logical(kind=4) :: arg4 - logical(kind=8) :: arg5 - -!$OMP PARALLEL FIRSTPRIVATE(arg1, arg2, arg3, arg4, arg5) - call baz(arg1, arg2, arg3, arg4, arg5) -!$OMP END PARALLEL - -end subroutine - -!FIRDialect-DAG: func @_QPfirstprivate_real(%[[ARG1:.*]]: !fir.ref{{.*}}, %[[ARG2:.*]]: !fir.ref{{.*}}, %[[ARG3:.*]]: !fir.ref{{.*}}, %[[ARG4:.*]]: !fir.ref{{.*}}, %[[ARG5:.*]]: !fir.ref{{.*}}, %[[ARG6:.*]]: !fir.ref{{.*}}) { -!FIRDialect: omp.parallel { -!FIRDialect: %[[ARG1_PVT:.*]] = fir.alloca f32 {bindc_name = "arg1", pinned, uniq_name = "_QFfirstprivate_realEarg1"} -!FIRDialect: %[[ARG1_VAL:.*]] = fir.load %[[ARG1]] : !fir.ref -!FIRDialect: fir.store %[[ARG1_VAL]] to %[[ARG1_PVT]] : !fir.ref -!FIRDialect: %[[ARG2_PVT:.*]] = fir.alloca f16 {bindc_name = "arg2", pinned, uniq_name = "_QFfirstprivate_realEarg2"} -!FIRDialect: %[[ARG2_VAL:.*]] = fir.load %[[ARG2]] : !fir.ref -!FIRDialect: fir.store %[[ARG2_VAL]] to %[[ARG2_PVT]] : !fir.ref -!FIRDialect: %[[ARG3_PVT:.*]] = fir.alloca f32 {bindc_name = "arg3", pinned, uniq_name = "_QFfirstprivate_realEarg3"} -!FIRDialect: %[[ARG3_VAL:.*]] = fir.load %[[ARG3]] : !fir.ref -!FIRDialect: fir.store %[[ARG3_VAL]] to %[[ARG3_PVT]] : !fir.ref -!FIRDialect: %[[ARG4_PVT:.*]] = fir.alloca f64 {bindc_name = "arg4", pinned, uniq_name = "_QFfirstprivate_realEarg4"} -!FIRDialect: %[[ARG4_VAL:.*]] = fir.load %[[ARG4]] : !fir.ref -!FIRDialect: fir.store %[[ARG4_VAL]] to %[[ARG4_PVT]] : !fir.ref -!FIRDialect: %[[ARG5_PVT:.*]] = fir.alloca f80 {bindc_name = "arg5", pinned, uniq_name = "_QFfirstprivate_realEarg5"} -!FIRDialect: %[[ARG5_VAL:.*]] = fir.load %[[ARG5]] : !fir.ref -!FIRDialect: fir.store %[[ARG5_VAL]] to %[[ARG5_PVT]] : !fir.ref -!FIRDialect: %[[ARG6_PVT:.*]] = fir.alloca f128 {bindc_name = "arg6", pinned, uniq_name = "_QFfirstprivate_realEarg6"} -!FIRDialect: %[[ARG6_VAL:.*]] = fir.load %[[ARG6]] : !fir.ref -!FIRDialect: fir.store %[[ARG6_VAL]] to %[[ARG6_PVT]] : !fir.ref -!FIRDialect: fir.call @_QPqux(%[[ARG1_PVT]], %[[ARG2_PVT]], %[[ARG3_PVT]], %[[ARG4_PVT]], %[[ARG5_PVT]], %[[ARG6_PVT]]) {{.*}}: (!fir.ref, !fir.ref, !fir.ref, !fir.ref, !fir.ref, !fir.ref) -> () -!FIRDialect: omp.terminator -!FIRDialect: } - -subroutine firstprivate_real(arg1, arg2, arg3, arg4, arg5, arg6) - real :: arg1 - real(kind=2) :: arg2 - real(kind=4) :: arg3 - real(kind=8) :: arg4 - real(kind=10) :: arg5 - real(kind=16) :: arg6 - -!$OMP PARALLEL FIRSTPRIVATE(arg1, arg2, arg3, arg4, arg5, arg6) - call qux(arg1, arg2, arg3, arg4, arg5, arg6) -!$OMP END PARALLEL - -end subroutine - -!FIRDialect-LABEL: func.func @_QPmultiple_firstprivate( -!FIRDialect-SAME: %[[A_ADDR:.*]]: !fir.ref {fir.bindc_name = "a"}, -!FIRDialect-SAME: %[[B_ADDR:.*]]: !fir.ref {fir.bindc_name = "b"}) { -!FIRDialect: omp.parallel { -!FIRDialect: %[[A_PRIV_ADDR:.*]] = fir.alloca i32 {bindc_name = "a", pinned, uniq_name = "_QFmultiple_firstprivateEa"} -!FIRDialect: %[[A:.*]] = fir.load %[[A_ADDR]] : !fir.ref -!FIRDialect: fir.store %[[A]] to %[[A_PRIV_ADDR]] : !fir.ref -!FIRDialect: %[[B_PRIV_ADDR:.*]] = fir.alloca i32 {bindc_name = "b", pinned, uniq_name = "_QFmultiple_firstprivateEb"} -!FIRDialect: %[[B:.*]] = fir.load %[[B_ADDR]] : !fir.ref -!FIRDialect: fir.store %[[B]] to %[[B_PRIV_ADDR]] : !fir.ref -!FIRDialect: fir.call @_QPquux(%[[A_PRIV_ADDR]], %[[B_PRIV_ADDR]]) {{.*}}: (!fir.ref, !fir.ref) -> () -!FIRDialect: omp.terminator -!FIRDialect: } -!FIRDialect: return -!FIRDialect: } - -subroutine multiple_firstprivate(a, b) - integer :: a, b -!$OMP PARALLEL FIRSTPRIVATE(a) FIRSTPRIVATE(b) - call quux(a, b) -!$OMP END PARALLEL -end subroutine multiple_firstprivate diff --git a/flang/test/Lower/OpenMP/FIR/parallel-lastprivate-clause-scalar.f90 b/flang/test/Lower/OpenMP/FIR/parallel-lastprivate-clause-scalar.f90 deleted file mode 100644 index 16832355f5d1b..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/parallel-lastprivate-clause-scalar.f90 +++ /dev/null @@ -1,261 +0,0 @@ -! This test checks lowering of `LASTPRIVATE` clause for scalar types. - -! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s -! RUN: %flang_fc1 -fopenmp -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s - -!CHECK: func @_QPlastprivate_character(%[[ARG1:.*]]: !fir.boxchar<1>{{.*}}) { -!CHECK-DAG: %[[ARG1_UNBOX:.*]]:2 = fir.unboxchar -!CHECK-DAG: %[[FIVE:.*]] = arith.constant 5 : index -!CHECK-DAG: %[[ARG1_REF:.*]] = fir.convert %[[ARG1_UNBOX]]#0 : (!fir.ref>) -> !fir.ref> - -!CHECK: omp.parallel { -!CHECK-DAG: %[[ARG1_PVT:.*]] = fir.alloca !fir.char<1,5> {bindc_name = "arg1", - -! Check that we are accessing the clone inside the loop -!CHECK: omp.wsloop { -!CHECK-NEXT: omp.loop_nest (%[[INDX_WS:.*]]) : {{.*}} { -!CHECK: %[[UNIT:.*]] = arith.constant 6 : i32 -!CHECK-NEXT: %[[ADDR:.*]] = fir.address_of(@_QQclX -!CHECK-NEXT: %[[CVT0:.*]] = fir.convert %[[ADDR]] -!CHECK-NEXT: %[[CNST:.*]] = arith.constant -!CHECK-NEXT: %[[CALL_BEGIN_IO:.*]] = fir.call @_FortranAioBeginExternalListOutput(%[[UNIT]], %[[CVT0]], %[[CNST]]) {{.*}}: (i32, !fir.ref, i32) -> !fir.ref -!CHECK-NEXT: %[[CVT_0_1:.*]] = fir.convert %[[ARG1_PVT]] -!CHECK-NEXT: %[[CVT_0_2:.*]] = fir.convert %[[FIVE]] -!CHECK-NEXT: %[[CALL_OP_ASCII:.*]] = fir.call @_FortranAioOutputAscii(%[[CALL_BEGIN_IO]], %[[CVT_0_1]], %[[CVT_0_2]]) -!CHECK-NEXT: %[[CALL_END_IO:.*]] = fir.call @_FortranAioEndIoStatement(%[[CALL_BEGIN_IO]]) - -! Testing last iteration check -!CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32 -!CHECK: %[[C0:.*]] = arith.constant 0 : i32 -!CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32 -!CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32 -!CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32 -!CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1 -!CHECK: fir.if %[[IV_CMP]] { -!CHECK: fir.store %[[V]] to %{{.*}} : !fir.ref - -! Testing lastprivate val update -!CHECK-DAG: %[[CVT:.*]] = fir.convert %[[ARG1_REF]] : (!fir.ref>) -> !fir.ref -!CHECK-DAG: %[[CVT1:.*]] = fir.convert %[[ARG1_PVT]] : (!fir.ref>) -> !fir.ref -!CHECK: fir.call @llvm.memmove.p0.p0.i64(%[[CVT]], %[[CVT1]]{{.*}}) -!CHECK: } -!CHECK: omp.yield -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - -subroutine lastprivate_character(arg1) - character(5) :: arg1 -!$OMP PARALLEL -!$OMP DO LASTPRIVATE(arg1) -do n = 1, 5 - arg1(n:n) = 'c' - print *, arg1 -end do -!$OMP END DO -!$OMP END PARALLEL -end subroutine - -!CHECK: func @_QPlastprivate_int(%[[ARG1:.*]]: !fir.ref {fir.bindc_name = "arg1"}) { -!CHECK-DAG: omp.parallel { -!CHECK-DAG: %[[CLONE:.*]] = fir.alloca i32 {bindc_name = "arg1" -!CHECK: omp.wsloop { -!CHECK-NEXT: omp.loop_nest (%[[INDX_WS:.*]]) : {{.*}} { - -! Testing last iteration check -!CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32 -!CHECK: %[[C0:.*]] = arith.constant 0 : i32 -!CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32 -!CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32 -!CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32 -!CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1 -!CHECK: fir.if %[[IV_CMP]] { -!CHECK: fir.store %[[V]] to %{{.*}} : !fir.ref - -! Testing lastprivate val update -!CHECK-NEXT: %[[CLONE_LD:.*]] = fir.load %[[CLONE]] : !fir.ref -!CHECK-NEXT: fir.store %[[CLONE_LD]] to %[[ARG1]] : !fir.ref -!CHECK: } -!CHECK: omp.yield -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - -subroutine lastprivate_int(arg1) - integer :: arg1 -!$OMP PARALLEL -!$OMP DO LASTPRIVATE(arg1) -do n = 1, 5 - arg1 = 2 - print *, arg1 -end do -!$OMP END DO -!$OMP END PARALLEL -print *, arg1 -end subroutine - -!CHECK: func.func @_QPmult_lastprivate_int(%[[ARG1:.*]]: !fir.ref {fir.bindc_name = "arg1"}, %[[ARG2:.*]]: !fir.ref {fir.bindc_name = "arg2"}) { -!CHECK: omp.parallel { -!CHECK-DAG: %[[CLONE1:.*]] = fir.alloca i32 {bindc_name = "arg1" -!CHECK-DAG: %[[CLONE2:.*]] = fir.alloca i32 {bindc_name = "arg2" -!CHECK: omp.wsloop { -!CHECK-NEXT: omp.loop_nest (%[[INDX_WS:.*]]) : {{.*}} { - -! Testing last iteration check -!CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32 -!CHECK: %[[C0:.*]] = arith.constant 0 : i32 -!CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32 -!CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32 -!CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32 -!CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1 -!CHECK: fir.if %[[IV_CMP]] { -!CHECK: fir.store %[[V]] to %{{.*}} : !fir.ref -! Testing lastprivate val update -!CHECK-DAG: %[[CLONE_LD1:.*]] = fir.load %[[CLONE1]] : !fir.ref -!CHECK-DAG: fir.store %[[CLONE_LD1]] to %[[ARG1]] : !fir.ref -!CHECK-DAG: %[[CLONE_LD2:.*]] = fir.load %[[CLONE2]] : !fir.ref -!CHECK-DAG: fir.store %[[CLONE_LD2]] to %[[ARG2]] : !fir.ref -!CHECK: } -!CHECK: omp.yield -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - -subroutine mult_lastprivate_int(arg1, arg2) - integer :: arg1, arg2 -!$OMP PARALLEL -!$OMP DO LASTPRIVATE(arg1) LASTPRIVATE(arg2) -do n = 1, 5 - arg1 = 2 - arg2 = 3 - print *, arg1, arg2 -end do -!$OMP END DO -!$OMP END PARALLEL -print *, arg1, arg2 -end subroutine - -!CHECK: func.func @_QPmult_lastprivate_int2(%[[ARG1:.*]]: !fir.ref {fir.bindc_name = "arg1"}, %[[ARG2:.*]]: !fir.ref {fir.bindc_name = "arg2"}) { -!CHECK: omp.parallel { -!CHECK-DAG: %[[CLONE1:.*]] = fir.alloca i32 {bindc_name = "arg1" -!CHECK-DAG: %[[CLONE2:.*]] = fir.alloca i32 {bindc_name = "arg2" -!CHECK: omp.wsloop { -!CHECK-NEXT: omp.loop_nest (%[[INDX_WS:.*]]) : {{.*}} { - -!Testing last iteration check -!CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32 -!CHECK: %[[C0:.*]] = arith.constant 0 : i32 -!CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32 -!CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32 -!CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32 -!CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1 -!CHECK: fir.if %[[IV_CMP]] { -!CHECK: fir.store %[[V]] to %{{.*}} : !fir.ref -!Testing lastprivate val update -!CHECK-DAG: %[[CLONE_LD2:.*]] = fir.load %[[CLONE2]] : !fir.ref -!CHECK-DAG: fir.store %[[CLONE_LD2]] to %[[ARG2]] : !fir.ref -!CHECK-DAG: %[[CLONE_LD1:.*]] = fir.load %[[CLONE1]] : !fir.ref -!CHECK-DAG: fir.store %[[CLONE_LD1]] to %[[ARG1]] : !fir.ref -!CHECK: } -!CHECK: omp.yield -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - -subroutine mult_lastprivate_int2(arg1, arg2) - integer :: arg1, arg2 -!$OMP PARALLEL -!$OMP DO LASTPRIVATE(arg1, arg2) -do n = 1, 5 - arg1 = 2 - arg2 = 3 - print *, arg1, arg2 -end do -!$OMP END DO -!$OMP END PARALLEL -print *, arg1, arg2 -end subroutine - -!CHECK: func.func @_QPfirstpriv_lastpriv_int(%[[ARG1:.*]]: !fir.ref {fir.bindc_name = "arg1"}, %[[ARG2:.*]]: !fir.ref {fir.bindc_name = "arg2"}) { -!CHECK: omp.parallel { -! Firstprivate update -!CHECK-DAG: %[[CLONE1:.*]] = fir.alloca i32 {bindc_name = "arg1" -!CHECK-DAG: %[[FPV_LD:.*]] = fir.load %[[ARG1]] : !fir.ref -!CHECK-DAG: fir.store %[[FPV_LD]] to %[[CLONE1]] : !fir.ref -! Lastprivate Allocation -!CHECK-DAG: %[[CLONE2:.*]] = fir.alloca i32 {bindc_name = "arg2" -!CHECK-NOT: omp.barrier -!CHECK: omp.wsloop { -!CHECK-NEXT: omp.loop_nest (%[[INDX_WS:.*]]) : {{.*}} { - -! Testing last iteration check -!CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32 -!CHECK: %[[C0:.*]] = arith.constant 0 : i32 -!CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32 -!CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32 -!CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32 -!CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1 -!CHECK: fir.if %[[IV_CMP]] { -!CHECK: fir.store %[[V]] to %{{.*}} : !fir.ref -! Testing lastprivate val update -!CHECK-NEXT: %[[CLONE_LD:.*]] = fir.load %[[CLONE2]] : !fir.ref -!CHECK-NEXT: fir.store %[[CLONE_LD]] to %[[ARG2]] : !fir.ref -!CHECK-NEXT: } -!CHECK-NEXT: omp.yield -!CHECK-NEXT: } -!CHECK-NEXT: omp.terminator -!CHECK-NEXT: } - -subroutine firstpriv_lastpriv_int(arg1, arg2) - integer :: arg1, arg2 -!$OMP PARALLEL -!$OMP DO FIRSTPRIVATE(arg1) LASTPRIVATE(arg2) -do n = 1, 5 - arg1 = 2 - arg2 = 3 - print *, arg1, arg2 -end do -!$OMP END DO -!$OMP END PARALLEL -print *, arg1, arg2 -end subroutine - -!CHECK: func.func @_QPfirstpriv_lastpriv_int2(%[[ARG1:.*]]: !fir.ref {fir.bindc_name = "arg1"}) { -!CHECK: omp.parallel { -! Firstprivate update -!CHECK: %[[CLONE1:.*]] = fir.alloca i32 {bindc_name = "arg1" -!CHECK-NEXT: %[[FPV_LD:.*]] = fir.load %[[ARG1]] : !fir.ref -!CHECK-NEXT: fir.store %[[FPV_LD]] to %[[CLONE1]] : !fir.ref -!CHECK-NEXT: omp.barrier -!CHECK: omp.wsloop { -!CHECK-NEXT: omp.loop_nest (%[[INDX_WS:.*]]) : {{.*}} { -! Testing last iteration check -!CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32 -!CHECK: %[[C0:.*]] = arith.constant 0 : i32 -!CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32 -!CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32 -!CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32 -!CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1 -!CHECK: fir.if %[[IV_CMP]] { -!CHECK: fir.store %[[V]] to %{{.*}} : !fir.ref -! Testing lastprivate val update -!CHECK-NEXT: %[[CLONE_LD:.*]] = fir.load %[[CLONE1]] : !fir.ref -!CHECK-NEXT: fir.store %[[CLONE_LD]] to %[[ARG1]] : !fir.ref -!CHECK-NEXT: } -!CHECK-NEXT: omp.yield -!CHECK-NEXT: } -!CHECK-NEXT: omp.terminator -!CHECK-NEXT: } - -subroutine firstpriv_lastpriv_int2(arg1) - integer :: arg1 -!$OMP PARALLEL -!$OMP DO FIRSTPRIVATE(arg1) LASTPRIVATE(arg1) -do n = 1, 5 - arg1 = 2 - print *, arg1 -end do -!$OMP END DO -!$OMP END PARALLEL -print *, arg1 -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/parallel-private-clause-fixes.f90 b/flang/test/Lower/OpenMP/FIR/parallel-private-clause-fixes.f90 deleted file mode 100644 index fb0fb9594c350..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/parallel-private-clause-fixes.f90 +++ /dev/null @@ -1,84 +0,0 @@ -! This test checks a few bug fixes in the PRIVATE clause lowering - -! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s - -! CHECK-LABEL: multiple_private_fix -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFmultiple_private_fixEi"} -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "j", uniq_name = "_QFmultiple_private_fixEj"} -! CHECK: %[[VAL_2:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFmultiple_private_fixEx"} -! CHECK: omp.parallel { -! CHECK-DAG: %[[PRIV_J:.*]] = fir.alloca i32 {bindc_name = "j", pinned -! CHECK-DAG: %[[PRIV_I:.*]] = fir.alloca i32 {adapt.valuebyref, pinned -! CHECK-DAG: %[[PRIV_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned -! CHECK: %[[ONE:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_3:.*]] = fir.load %[[VAL_4:.*]] : !fir.ref -! CHECK: %[[VAL_5:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop { -! CHECK-NEXT: omp.loop_nest (%[[VAL_6:.*]]) : i32 = (%[[ONE]]) to (%[[VAL_3]]) inclusive step (%[[VAL_5]]) { -! CHECK: fir.store %[[VAL_6]] to %[[PRIV_I]] : !fir.ref -! CHECK: %[[VAL_7:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_8:.*]] = fir.convert %[[VAL_7]] : (i32) -> index -! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_4]] : !fir.ref -! CHECK: %[[VAL_10:.*]] = fir.convert %[[VAL_9]] : (i32) -> index -! CHECK: %[[VAL_11:.*]] = arith.constant 1 : index -! CHECK: %[[LB:.*]] = fir.convert %[[VAL_8]] : (index) -> i32 -! CHECK: %[[VAL_12:.*]]:2 = fir.do_loop %[[VAL_13:[^ ]*]] = -! CHECK-SAME: %[[VAL_8]] to %[[VAL_10]] step %[[VAL_11]] -! CHECK-SAME: iter_args(%[[IV:.*]] = %[[LB]]) -> (index, i32) { -! CHECK: fir.store %[[IV]] to %[[PRIV_J]] : !fir.ref -! CHECK: %[[LOAD:.*]] = fir.load %[[PRIV_I]] : !fir.ref -! CHECK: %[[VAL_15:.*]] = fir.load %[[PRIV_J]] : !fir.ref -! CHECK: %[[VAL_16:.*]] = arith.addi %[[LOAD]], %[[VAL_15]] : i32 -! CHECK: fir.store %[[VAL_16]] to %[[PRIV_X]] : !fir.ref -! CHECK: %[[VAL_17:.*]] = arith.addi %[[VAL_13]], %[[VAL_11]] : index -! CHECK: %[[STEPCAST:.*]] = fir.convert %[[VAL_11]] : (index) -> i32 -! CHECK: %[[IVLOAD:.*]] = fir.load %[[PRIV_J]] : !fir.ref -! CHECK: %[[IVINC:.*]] = arith.addi %[[IVLOAD]], %[[STEPCAST]] -! CHECK: fir.result %[[VAL_17]], %[[IVINC]] : index, i32 -! CHECK: } -! CHECK: fir.store %[[VAL_12]]#1 to %[[PRIV_J]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -subroutine multiple_private_fix(gama) - integer :: i, j, x, gama -!$OMP PARALLEL DO PRIVATE(j,x) - do i = 1, gama - do j = 1, gama - x = i + j - end do - end do -!$OMP END PARALLEL DO -end subroutine - -! CHECK-LABEL: multiple_private_fix2 -! CHECK: %[[X1:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFmultiple_private_fix2Ex"} -! CHECK: omp.parallel { -! CHECK: %[[X2:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFmultiple_private_fix2Ex"} -! CHECK: omp.parallel { -! CHECK: %[[X3:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFmultiple_private_fix2Ex"} -! CHECK: %[[C3:.*]] = arith.constant 1 : i32 -! CHECK: fir.store %[[C3]] to %[[X3]] : !fir.ref -! CHECK: omp.terminator -! CHECK: } -! CHECK: %[[C2:.*]] = arith.constant 1 : i32 -! CHECK: fir.store %[[C2]] to %[[X2]] : !fir.ref -! CHECK: omp.terminator -! CHECK: } -! CHECK: %[[C1:.*]] = arith.constant 1 : i32 -! CHECK: fir.store %[[C1]] to %[[X1]] : !fir.ref -! CHECK: return -subroutine multiple_private_fix2() - integer :: x - !$omp parallel private(x) - !$omp parallel private(x) - x = 1 - !$omp end parallel - x = 1 - !$omp end parallel - x = 1 -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/parallel-private-clause.f90 b/flang/test/Lower/OpenMP/FIR/parallel-private-clause.f90 deleted file mode 100644 index 2e68d25a15edc..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/parallel-private-clause.f90 +++ /dev/null @@ -1,387 +0,0 @@ -! This test checks lowering of OpenMP parallel Directive with -! `PRIVATE` clause present. - -! REQUIRES: shell -! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir -hlfir=false %s -o - | \ -! RUN: FileCheck %s --check-prefix=FIRDialect - -!FIRDialect: func @_QPprivate_clause(%[[ARG1:.*]]: !fir.ref{{.*}}, %[[ARG2:.*]]: !fir.ref>{{.*}}, %[[ARG3:.*]]: !fir.boxchar<1>{{.*}}, %[[ARG4:.*]]: !fir.boxchar<1>{{.*}}) { -!FIRDialect-DAG: %[[ALPHA:.*]] = fir.alloca i32 {{{.*}}, uniq_name = "{{.*}}Ealpha"} -!FIRDialect-DAG: %[[ALPHA_ARRAY:.*]] = fir.alloca !fir.array<10xi32> {{{.*}}, uniq_name = "{{.*}}Ealpha_array"} -!FIRDialect-DAG: %[[BETA:.*]] = fir.alloca !fir.char<1,5> {{{.*}}, uniq_name = "{{.*}}Ebeta"} -!FIRDialect-DAG: %[[BETA_ARRAY:.*]] = fir.alloca !fir.array<10x!fir.char<1,5>> {{{.*}}, uniq_name = "{{.*}}Ebeta_array"} - -!FIRDialect-DAG: omp.parallel { -!FIRDialect-DAG: %[[ALPHA_PRIVATE:.*]] = fir.alloca i32 {{{.*}}, pinned, uniq_name = "{{.*}}Ealpha"} -!FIRDialect-DAG: %[[ALPHA_ARRAY_PRIVATE:.*]] = fir.alloca !fir.array<10xi32> {{{.*}}, pinned, uniq_name = "{{.*}}Ealpha_array"} -!FIRDialect-DAG: %[[BETA_PRIVATE:.*]] = fir.alloca !fir.char<1,5> {{{.*}}, pinned, uniq_name = "{{.*}}Ebeta"} -!FIRDialect-DAG: %[[BETA_ARRAY_PRIVATE:.*]] = fir.alloca !fir.array<10x!fir.char<1,5>> {{{.*}}, pinned, uniq_name = "{{.*}}Ebeta_array"} -!FIRDialect-DAG: %[[ARG1_PRIVATE:.*]] = fir.alloca i32 {{{.*}}, pinned, uniq_name = "{{.*}}Earg1"} -!FIRDialect-DAG: %[[ARG2_ARRAY_PRIVATE:.*]] = fir.alloca !fir.array<10xi32> {{{.*}}, pinned, uniq_name = "{{.*}}Earg2"} -!FIRDialect-DAG: %[[ARG3_PRIVATE:.*]] = fir.alloca !fir.char<1,5> {{{.*}}, pinned, uniq_name = "{{.*}}Earg3"} -!FIRDialect-DAG: %[[ARG4_ARRAY_PRIVATE:.*]] = fir.alloca !fir.array<10x!fir.char<1,5>> {{{.*}}, pinned, uniq_name = "{{.*}}Earg4"} -!FIRDialect: omp.terminator -!FIRDialect: } - -subroutine private_clause(arg1, arg2, arg3, arg4) - - integer :: arg1, arg2(10) - integer :: alpha, alpha_array(10) - character(5) :: arg3, arg4(10) - character(5) :: beta, beta_array(10) - -!$OMP PARALLEL PRIVATE(alpha, alpha_array, beta, beta_array, arg1, arg2, arg3, arg4) - alpha = 1 - alpha_array = 4 - beta = "hi" - beta_array = "hi" - arg1 = 2 - arg2 = 3 - arg3 = "world" - arg4 = "world" -!$OMP END PARALLEL - -end subroutine - -!FIRDialect: func @_QPprivate_clause_scalar() { -!FIRDialect-DAG: {{.*}} = fir.alloca !fir.complex<4> {bindc_name = "c", uniq_name = "{{.*}}Ec"} -!FIRDialect-DAG: {{.*}} = fir.alloca i8 {bindc_name = "i1", uniq_name = "{{.*}}Ei1"} -!FIRDialect-DAG: {{.*}} = fir.alloca i128 {bindc_name = "i16", uniq_name = "{{.*}}Ei16"} -!FIRDialect-DAG: {{.*}} = fir.alloca i16 {bindc_name = "i2", uniq_name = "{{.*}}Ei2"} -!FIRDialect-DAG: {{.*}} = fir.alloca i32 {bindc_name = "i4", uniq_name = "{{.*}}Ei4"} -!FIRDialect-DAG: {{.*}} = fir.alloca i64 {bindc_name = "i8", uniq_name = "{{.*}}Ei8"} -!FIRDialect-DAG: {{.*}} = fir.alloca !fir.logical<4> {bindc_name = "l", uniq_name = "{{.*}}El"} -!FIRDialect-DAG: {{.*}} = fir.alloca f32 {bindc_name = "r", uniq_name = "{{.*}}Er"} - -!FIRDialect: omp.parallel { -!FIRDialect-DAG: {{.*}} = fir.alloca i8 {bindc_name = "i1", pinned, uniq_name = "{{.*}}Ei1"} -!FIRDialect-DAG: {{.*}} = fir.alloca i16 {bindc_name = "i2", pinned, uniq_name = "{{.*}}Ei2"} -!FIRDialect-DAG: {{.*}} = fir.alloca i32 {bindc_name = "i4", pinned, uniq_name = "{{.*}}Ei4"} -!FIRDialect-DAG: {{.*}} = fir.alloca i64 {bindc_name = "i8", pinned, uniq_name = "{{.*}}Ei8"} -!FIRDialect-DAG: {{.*}} = fir.alloca i128 {bindc_name = "i16", pinned, uniq_name = "{{.*}}Ei16"} -!FIRDialect-DAG: {{.*}} = fir.alloca !fir.complex<4> {bindc_name = "c", pinned, uniq_name = "{{.*}}Ec"} -!FIRDialect-DAG: {{.*}} = fir.alloca !fir.logical<4> {bindc_name = "l", pinned, uniq_name = "{{.*}}El"} -!FIRDialect-DAG: {{.*}} = fir.alloca f32 {bindc_name = "r", pinned, uniq_name = "{{.*}}Er"} - -subroutine private_clause_scalar() - - integer(kind=1) :: i1 - integer(kind=2) :: i2 - integer(kind=4) :: i4 - integer(kind=8) :: i8 - integer(kind=16) :: i16 - complex :: c - logical :: l - real :: r - -!$OMP PARALLEL PRIVATE(i1, i2, i4, i8, i16, c, l, r) - print *, i1, i2, i4, i8, i16, c, l, r -!$OMP END PARALLEL - -end subroutine - -!FIRDialect: func @_QPprivate_clause_derived_type() { -!FIRDialect: {{.*}} = fir.alloca !fir.type<{{.*}}{t_i:i32,t_arr:!fir.array<5xi32>}> {bindc_name = "t", uniq_name = "{{.*}}Et"} - -!FIRDialect: omp.parallel { -!FIRDialect: {{.*}} = fir.alloca !fir.type<{{.*}}{t_i:i32,t_arr:!fir.array<5xi32>}> {bindc_name = "t", pinned, uniq_name = "{{.*}}Et"} - -subroutine private_clause_derived_type() - - type my_type - integer :: t_i - integer :: t_arr(5) - end type my_type - type(my_type) :: t - -!$OMP PARALLEL PRIVATE(t) - print *, t%t_i -!$OMP END PARALLEL - -end subroutine - -!FIRDialect: func @_QPprivate_clause_allocatable() { -!FIRDialect-DAG: {{.*}} = fir.alloca !fir.box> {bindc_name = "x", uniq_name = "{{.*}}Ex"} -!FIRDialect-DAG: {{.*}} = fir.alloca !fir.heap {uniq_name = "{{.*}}Ex.addr"} -!FIRDialect-DAG: {{.*}} = fir.alloca !fir.box>> {bindc_name = "x2", uniq_name = "{{.*}}Ex2"} -!FIRDialect-DAG: {{.*}} = fir.alloca !fir.heap> {uniq_name = "{{.*}}Ex2.addr"} -!FIRDialect-DAG: {{.*}} = fir.address_of(@{{.*}}Ex3) : !fir.ref>> -!FIRDialect-DAG: [[TMP8:%.*]] = fir.address_of(@{{.*}}Ex4) : !fir.ref>>> - -!FIRDialect: omp.parallel { -!FIRDialect-DAG: [[TMP35:%.*]] = fir.alloca !fir.box> {bindc_name = "x", pinned, uniq_name = "{{.*}}Ex"} -!FIRDialect-DAG: [[TMP39:%.*]] = fir.alloca !fir.box>> {bindc_name = "x2", pinned, uniq_name = "{{.*}}Ex2"} -!FIRDialect-DAG: [[TMP45:%.*]] = fir.alloca !fir.box> {bindc_name = "x3", pinned, uniq_name = "{{.*}}Ex3"} - -!FIRDialect-DAG: [[TMP51:%.*]] = fir.load [[TMP8]] : !fir.ref>>> -!FIRDialect-DAG: [[TMP97:%.*]] = fir.load [[TMP8]] : !fir.ref>>> -!FIRDialect-DAG: [[TMP98:%.*]]:3 = fir.box_dims [[TMP97]], {{.*}} : (!fir.box>>, index) -> (index, index, index) -!FIRDialect-DAG: [[TMP50:%.*]] = fir.alloca !fir.box>> {bindc_name = "x4", pinned, uniq_name = "{{.*}}Ex4"} - -! FIRDialect-DAG: [[TMP101:%.*]] = fir.allocmem !fir.array, {{.*}} {fir.must_be_heap = true, uniq_name = "{{.*}}Ex4.alloc"} -! FIRDialect-DAG: [[TMP102:%.*]] = fir.shape_shift {{.*}}#0, {{.*}} : (index, index) -> !fir.shapeshift<1> -! FIRDialect-DAG: [[TMP103:%.*]] = fir.embox [[TMP101]]([[TMP102]]) : (!fir.heap>, !fir.shapeshift<1>) -> !fir.box>> -! FIRDialect-DAG: fir.store [[TMP103]] to [[TMP50]] : !fir.ref>>> - - -subroutine private_clause_allocatable() - - integer, allocatable :: x, x2(:) - integer, allocatable, save :: x3, x4(:) - - print *, x, x2, x3, x4 - -!$OMP PARALLEL PRIVATE(x, x2, x3, x4) - print *, x, x2, x3, x4 -!$OMP END PARALLEL - -end subroutine - - -!FIRDialect: func @_QPprivate_clause_real_call_allocatable() { -!FIRDialect-DAG: {{.*}} = fir.alloca !fir.box> {bindc_name = "x5", uniq_name = "{{.*}}Ex5"} -!FIRDialect-DAG: {{.*}} = fir.zero_bits !fir.heap -!FIRDialect-DAG: {{.*}} = fir.embox %1 : (!fir.heap) -> !fir.box> -!FIRDialect-DAG: fir.store %2 to %0 : !fir.ref>> -!FIRDialect-DAG: omp.parallel { -!FIRDialect-DAG: [[TMP203:%.*]] = fir.alloca !fir.box> {bindc_name = "x5", pinned, uniq_name = "{{.*}}Ex5"} - -!FIRDialect-DAG: fir.if %{{.*}} { - -!FIRDialect-DAG: fir.store %{{.*}} to [[TMP203]] : !fir.ref>> -!FIRDialect-DAG: } else { - -!FIRDialect-DAG: fir.store %{{.*}} to [[TMP203]] : !fir.ref>> -!FIRDialect-DAG: } -!FIRDialect-DAG: fir.call @_QFprivate_clause_real_call_allocatablePhelper_private_clause_real_call_allocatable([[TMP203]]) fastmath : (!fir.ref>>) -> () -!FIRDialect-DAG: %{{.*}} = fir.load [[TMP203]] : !fir.ref>> - -!FIRDialect-DAG: fir.if %{{.*}} { -!FIRDialect-DAG: %{{.*}} = fir.load [[TMP203]] : !fir.ref>> - -!FIRDialect-DAG: fir.store %{{.*}} to [[TMP203]] : !fir.ref>> -!FIRDialect-DAG: } -!FIRDialect-DAG: omp.terminator -!FIRDialect-DAG: } -!FIRDialect-DAG: return -!FIRDialect-DAG: } - - -subroutine private_clause_real_call_allocatable - real, allocatable :: x5 - !$omp parallel private(x5) - call helper_private_clause_real_call_allocatable(x5) - !$omp end parallel - contains - subroutine helper_private_clause_real_call_allocatable(x6) - real, allocatable :: x6 - print *, allocated(x6) - end subroutine -end subroutine - -!FIRDialect: func.func @_QPincrement_list_items(%arg0: !fir.ref>>}>>>> {fir.bindc_name = "head"}) { -!FIRDialect: {{%.*}} = fir.alloca !fir.box>>}>>> {bindc_name = "p", uniq_name = "_QFincrement_list_itemsEp"} -!FIRDialect: omp.parallel { -!FIRDialect: {{%.*}} = fir.alloca !fir.box>>}>>> {bindc_name = "p", pinned, uniq_name = "_QFincrement_list_itemsEp"} -!FIRDialect: omp.single { - -!FIRDialect: omp.terminator -!FIRDialect: omp.terminator -!FIRDialect: return - -subroutine increment_list_items (head) - type node - integer :: payload - type (node), pointer :: next - end type node - - type (node), pointer :: head - type (node), pointer :: p -!$omp parallel private(p) -!$omp single - p => head - do - p => p%next - if ( associated (p) .eqv. .false. ) exit - end do -!$omp end single -!$omp end parallel -end subroutine increment_list_items - -!FIRDialect: func.func @_QPparallel_pointer() { -!FIRDialect-DAG: [[PP0:%.*]] = fir.alloca !fir.box> {bindc_name = "y1", uniq_name = "{{.*}}Ey1"} -!FIRDialect-DAG: [[PP1:%.*]] = fir.alloca !fir.ptr {uniq_name = "{{.*}}Ey1.addr"} -!FIRDialect-DAG: [[PP2:%.*]] = fir.zero_bits !fir.ptr -!FIRDialect: fir.store [[PP2]] to [[PP1]] : !fir.ref> -!FIRDialect-DAG: [[PP3:%.*]] = fir.alloca !fir.box>> {bindc_name = "y2", uniq_name = "{{.*}}Ey2"} - -!FIRDialect: fir.store %6 to %3 : !fir.ref>>> -!FIRDialect-DAG: [[PP7:%.*]] = fir.alloca i32 {bindc_name = "z1", fir.target, uniq_name = "{{.*}}Ez1"} - -!FIRDialect-DAG: [[PP8:%.*]] = fir.alloca !fir.array<10xi32> {bindc_name = "z2", fir.target, uniq_name = "{{.*}}Ez2"} -!FIRDialect: omp.parallel { -!FIRDialect-DAG: [[PP9:%.*]] = fir.alloca !fir.box> {bindc_name = "y1", pinned, uniq_name = "{{.*}}Ey1"} -!FIRDialect-DAG: [[PP10:%.*]] = fir.alloca !fir.box>> {bindc_name = "y2", pinned, uniq_name = "{{.*}}Ey2"} -!FIRDialect-DAG: [[PP11:%.*]] = fir.embox [[PP7]] : (!fir.ref) -> !fir.box> -!FIRDialect: fir.store [[PP11]] to [[PP9]] : !fir.ref>> -!FIRDialect-DAG: [[PP12:%.*]] = fir.shape %c{{.*}} : (index) -> !fir.shape<1> -!FIRDialect-DAG: [[PP13:%.*]] = fir.embox [[PP8]]([[PP12]]) : (!fir.ref>, !fir.shape<1>) -> !fir.box>> -!FIRDialect: fir.store %13 to [[PP10]] : !fir.ref>>> -!FIRDialect: omp.terminator -!FIRDialect: } -!FIRDialect: return -!FIRDialect: } - -subroutine parallel_pointer() - integer, pointer :: y1, y2(:) - integer, target :: z1, z2(10) - -!$omp parallel private(y1, y2) - y1=>z1 - y2=>z2 -!$omp end parallel -end subroutine parallel_pointer - - -!FIRDialect-LABEL: func @_QPsimple_loop_1() -subroutine simple_loop_1 - integer :: i - real, allocatable :: r; - ! FIRDialect: omp.parallel - !$OMP PARALLEL PRIVATE(r) - ! FIRDialect: %[[ALLOCA_IV:.*]] = fir.alloca i32 {{{.*}}, pinned} - - ! FIRDialect: [[R:%.*]] = fir.alloca !fir.box> {bindc_name = "r", pinned, uniq_name = "{{.*}}Er"} - ! FIRDialect: fir.store {{%.*}} to [[R]] : !fir.ref>> - ! FIRDialect: fir.store {{%.*}} to [[R]] : !fir.ref>> - - ! FIRDialect: %[[WS_LB:.*]] = arith.constant 1 : i32 - ! FIRDialect: %[[WS_UB:.*]] = arith.constant 9 : i32 - ! FIRDialect: %[[WS_STEP:.*]] = arith.constant 1 : i32 - - ! FIRDialect: omp.wsloop { - ! FIRDialect-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) { - !$OMP DO - do i=1, 9 - ! FIRDialect: fir.store %[[I]] to %[[ALLOCA_IV:.*]] : !fir.ref - ! FIRDialect: %[[LOAD_IV:.*]] = fir.load %[[ALLOCA_IV]] : !fir.ref - ! FIRDialect: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - ! FIRDialect: omp.yield - ! FIRDialect: omp.terminator - ! FIRDialect: {{%.*}} = fir.load [[R]] : !fir.ref>> - ! FIRDialect: fir.if {{%.*}} { - ! FIRDialect: [[LD:%.*]] = fir.load [[R]] : !fir.ref>> - ! FIRDialect: [[AD:%.*]] = fir.box_addr [[LD]] : (!fir.box>) -> !fir.heap - ! FIRDialect: fir.freemem [[AD]] : !fir.heap - ! FIRDialect: fir.store {{%.*}} to [[R]] : !fir.ref>> - !$OMP END DO - ! FIRDialect: omp.terminator - !$OMP END PARALLEL -end subroutine - -!FIRDialect-LABEL: func @_QPsimple_loop_2() -subroutine simple_loop_2 - integer :: i - real, allocatable :: r; - ! FIRDialect: omp.parallel - !$OMP PARALLEL - ! FIRDialect: %[[ALLOCA_IV:.*]] = fir.alloca i32 {{{.*}}, pinned} - - ! FIRDialect: [[R:%.*]] = fir.alloca !fir.box> {bindc_name = "r", pinned, uniq_name = "{{.*}}Er"} - ! FIRDialect: fir.store {{%.*}} to [[R]] : !fir.ref>> - ! FIRDialect: fir.store {{%.*}} to [[R]] : !fir.ref>> - - ! FIRDialect: %[[WS_LB:.*]] = arith.constant 1 : i32 - ! FIRDialect: %[[WS_UB:.*]] = arith.constant 9 : i32 - ! FIRDialect: %[[WS_STEP:.*]] = arith.constant 1 : i32 - - ! FIRDialect: omp.wsloop { - ! FIRDialect-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) { - !$OMP DO PRIVATE(r) - do i=1, 9 - ! FIRDialect: fir.store %[[I]] to %[[ALLOCA_IV:.*]] : !fir.ref - ! FIRDialect: %[[LOAD_IV:.*]] = fir.load %[[ALLOCA_IV]] : !fir.ref - ! FIRDialect: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - ! FIRDialect: omp.yield - ! FIRDialect: omp.terminator - ! FIRDialect: {{%.*}} = fir.load [[R]] : !fir.ref>> - ! FIRDialect: fir.if {{%.*}} { - ! FIRDialect: [[LD:%.*]] = fir.load [[R]] : !fir.ref>> - ! FIRDialect: [[AD:%.*]] = fir.box_addr [[LD]] : (!fir.box>) -> !fir.heap - ! FIRDialect: fir.freemem [[AD]] : !fir.heap - ! FIRDialect: fir.store {{%.*}} to [[R]] : !fir.ref>> - !$OMP END DO - ! FIRDialect: omp.terminator - !$OMP END PARALLEL -end subroutine - -!FIRDialect-LABEL: func @_QPsimple_loop_3() -subroutine simple_loop_3 - integer :: i - real, allocatable :: r; - ! FIRDialect: omp.parallel - ! FIRDialect: %[[ALLOCA_IV:.*]] = fir.alloca i32 {{{.*}}, pinned} - - ! FIRDialect: [[R:%.*]] = fir.alloca !fir.box> {bindc_name = "r", pinned, uniq_name = "{{.*}}Er"} - ! FIRDialect: fir.store {{%.*}} to [[R]] : !fir.ref>> - ! FIRDialect: fir.store {{%.*}} to [[R]] : !fir.ref>> - - ! FIRDialect: %[[WS_LB:.*]] = arith.constant 1 : i32 - ! FIRDialect: %[[WS_UB:.*]] = arith.constant 9 : i32 - ! FIRDialect: %[[WS_STEP:.*]] = arith.constant 1 : i32 - - ! FIRDialect: omp.wsloop { - ! FIRDialect-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) { - !$OMP PARALLEL DO PRIVATE(r) - do i=1, 9 - ! FIRDialect: fir.store %[[I]] to %[[ALLOCA_IV:.*]] : !fir.ref - ! FIRDialect: %[[LOAD_IV:.*]] = fir.load %[[ALLOCA_IV]] : !fir.ref - ! FIRDialect: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - ! FIRDialect: omp.yield - ! FIRDialect: omp.terminator - ! FIRDialect: {{%.*}} = fir.load [[R]] : !fir.ref>> - ! FIRDialect: fir.if {{%.*}} { - ! FIRDialect: [[LD:%.*]] = fir.load [[R]] : !fir.ref>> - ! FIRDialect: [[AD:%.*]] = fir.box_addr [[LD]] : (!fir.box>) -> !fir.heap - ! FIRDialect: fir.freemem [[AD]] : !fir.heap - ! FIRDialect: fir.store {{%.*}} to [[R]] : !fir.ref>> - !$OMP END PARALLEL DO - ! FIRDialect: omp.terminator -end subroutine - -!CHECK-LABEL: func @_QPsimd_loop_1() -subroutine simd_loop_1 - integer :: i - real, allocatable :: r; - ! FIRDialect: [[R:%.*]] = fir.alloca !fir.box> {bindc_name = "r", pinned, uniq_name = "{{.*}}Er"} - ! FIRDialect: fir.store {{%.*}} to [[R]] : !fir.ref>> - ! FIRDialect: fir.store {{%.*}} to [[R]] : !fir.ref>> - - ! FIRDialect: %[[LB:.*]] = arith.constant 1 : i32 - ! FIRDialect: %[[UB:.*]] = arith.constant 9 : i32 - ! FIRDialect: %[[STEP:.*]] = arith.constant 1 : i32 - - ! FIRDialect: omp.simd { - ! FIRDialect-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[LB]]) to (%[[UB]]) inclusive step (%[[STEP]]) { - !$OMP SIMD PRIVATE(r) - do i=1, 9 - ! FIRDialect: fir.store %[[I]] to %[[LOCAL:.*]] : !fir.ref - ! FIRDialect: %[[LOAD_IV:.*]] = fir.load %[[LOCAL]] : !fir.ref - ! FIRDialect: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - !$OMP END SIMD - ! FIRDialect: omp.yield - ! FIRDialect: {{%.*}} = fir.load [[R]] : !fir.ref>> - ! FIRDialect: fir.if {{%.*}} { - ! FIRDialect: [[LD:%.*]] = fir.load [[R]] : !fir.ref>> - ! FIRDialect: [[AD:%.*]] = fir.box_addr [[LD]] : (!fir.box>) -> !fir.heap - ! FIRDialect: fir.freemem [[AD]] : !fir.heap - ! FIRDialect: fir.store {{%.*}} to [[R]] : !fir.ref>> -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/parallel-reduction-add-byref.f90 b/flang/test/Lower/OpenMP/FIR/parallel-reduction-add-byref.f90 deleted file mode 100644 index ea45e716ceaee..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/parallel-reduction-add-byref.f90 +++ /dev/null @@ -1,117 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp --force-byref-reduction -o - %s 2>&1 | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -mmlir --force-byref-reduction -o - %s 2>&1 | FileCheck %s - -!CHECK-LABEL: omp.declare_reduction -!CHECK-SAME: @[[RED_F32_NAME:.*]] : !fir.ref -!CHECK-SAME: init { -!CHECK: ^bb0(%{{.*}}: !fir.ref): -!CHECK: %[[C0_1:.*]] = arith.constant 0.000000e+00 : f32 -!CHECK: %[[REF:.*]] = fir.alloca f32 -!CHECKL fir.store [[%C0_1]] to %[[REF]] : !fir.ref -!CHECK: omp.yield(%[[REF]] : !fir.ref) -!CHECK: } combiner { -!CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref, %[[ARG1:.*]]: !fir.ref): -!CHECK: %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref -!CHECK: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref -!CHECK: %[[RES:.*]] = arith.addf %[[LD0]], %[[LD1]] {{.*}}: f32 -!CHECK: fir.store %[[RES]] to %[[ARG0]] : !fir.ref -!CHECK: omp.yield(%[[ARG0]] : !fir.ref) -!CHECK: } - -!CHECK-LABEL: omp.declare_reduction -!CHECK-SAME: @[[RED_I32_NAME:.*]] : !fir.ref -!CHECK-SAME: init { -!CHECK: ^bb0(%{{.*}}: !fir.ref): -!CHECK: %[[C0_1:.*]] = arith.constant 0 : i32 -!CHECK: %[[REF:.*]] = fir.alloca i32 -!CHECKL fir.store [[%C0_1]] to %[[REF]] : !fir.ref -!CHECK: omp.yield(%[[REF]] : !fir.ref) -!CHECK: } combiner { -!CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref, %[[ARG1:.*]]: !fir.ref): -!CHECK: %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref -!CHECK: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref -!CHECK: %[[RES:.*]] = arith.addi %[[LD0]], %[[LD1]] : i32 -!CHECK: fir.store %[[RES]] to %[[ARG0]] : !fir.ref -!CHECK: omp.yield(%[[ARG0]] : !fir.ref) -!CHECK: } - -!CHECK-LABEL: func.func @_QPsimple_int_add -!CHECK: %[[IREF:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_int_addEi"} -!CHECK: %[[I_START:.*]] = arith.constant 0 : i32 -!CHECK: fir.store %[[I_START]] to %[[IREF]] : !fir.ref -!CHECK: omp.parallel byref reduction(@[[RED_I32_NAME]] %[[IREF]] -> %[[PRV:.+]] : !fir.ref) { -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[I_INCR:.+]] = arith.constant 1 : i32 -!CHECK: %[[RES:.+]] = arith.addi %[[LPRV]], %[[I_INCR]] -!CHECK: fir.store %[[RES]] to %[[PRV]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: return -subroutine simple_int_add - integer :: i - i = 0 - - !$omp parallel reduction(+:i) - i = i + 1 - !$omp end parallel - - print *, i -end subroutine - -!CHECK-LABEL: func.func @_QPsimple_real_add -!CHECK: %[[RREF:.*]] = fir.alloca f32 {bindc_name = "r", uniq_name = "_QFsimple_real_addEr"} -!CHECK: %[[R_START:.*]] = arith.constant 0.000000e+00 : f32 -!CHECK: fir.store %[[R_START]] to %[[RREF]] : !fir.ref -!CHECK: omp.parallel byref reduction(@[[RED_F32_NAME]] %[[RREF]] -> %[[PRV:.+]] : !fir.ref) { -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[R_INCR:.+]] = arith.constant 1.500000e+00 : f32 -!CHECK: %[[RES]] = arith.addf %[[LPRV]], %[[R_INCR]] {{.*}} : f32 -!CHECK: fir.store %[[RES]] to %[[PRV]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: return -subroutine simple_real_add - real :: r - r = 0.0 - - !$omp parallel reduction(+:r) - r = r + 1.5 - !$omp end parallel - - print *, r -end subroutine - -!CHECK-LABEL: func.func @_QPint_real_add -!CHECK: %[[IREF:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFint_real_addEi"} -!CHECK: %[[RREF:.*]] = fir.alloca f32 {bindc_name = "r", uniq_name = "_QFint_real_addEr"} -!CHECK: %[[R_START:.*]] = arith.constant 0.000000e+00 : f32 -!CHECK: fir.store %[[R_START]] to %[[RREF]] : !fir.ref -!CHECK: %[[I_START:.*]] = arith.constant 0 : i32 -!CHECK: fir.store %[[I_START]] to %[[IREF]] : !fir.ref -!CHECK: omp.parallel byref reduction(@[[RED_I32_NAME]] %[[IREF]] -> %[[PRV0:.+]] : !fir.ref, @[[RED_F32_NAME]] %[[RREF]] -> %[[PRV1:.+]] : !fir.ref) { -!CHECK: %[[R_INCR:.*]] = arith.constant 1.500000e+00 : f32 -!CHECK: %[[LPRV1:.+]] = fir.load %[[PRV1]] : !fir.ref -!CHECK: %[[RES1:.+]] = arith.addf %[[R_INCR]], %[[LPRV1]] {{.*}} : f32 -!CHECK: fir.store %[[RES1]] to %[[PRV1]] -!CHECK: %[[LPRV0:.+]] = fir.load %[[PRV0]] : !fir.ref -!CHECK: %[[I_INCR:.*]] = arith.constant 3 : i32 -!CHECK: %[[RES0:.+]] = arith.addi %[[LPRV0]], %[[I_INCR]] -!CHECK: fir.store %[[RES0]] to %[[PRV0]] -!CHECK: omp.terminator -!CHECK: } -!CHECK: return -subroutine int_real_add - real :: r - integer :: i - - r = 0.0 - i = 0 - - !$omp parallel reduction(+:i,r) - r = 1.5 + r - i = i + 3 - !$omp end parallel - - print *, r - print *, i -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/parallel-reduction-add.f90 b/flang/test/Lower/OpenMP/FIR/parallel-reduction-add.f90 deleted file mode 100644 index 3f6d9e647c9bd..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/parallel-reduction-add.f90 +++ /dev/null @@ -1,105 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp -o - %s 2>&1 | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s - -!CHECK-LABEL: omp.declare_reduction -!CHECK-SAME: @[[RED_F32_NAME:.*]] : f32 init { -!CHECK: ^bb0(%{{.*}}: f32): -!CHECK: %[[C0_1:.*]] = arith.constant 0.000000e+00 : f32 -!CHECK: omp.yield(%[[C0_1]] : f32) -!CHECK: } combiner { -!CHECK: ^bb0(%[[ARG0:.*]]: f32, %[[ARG1:.*]]: f32): -!CHECK: %[[RES:.*]] = arith.addf %[[ARG0]], %[[ARG1]] {{.*}}: f32 -!CHECK: omp.yield(%[[RES]] : f32) -!CHECK: } - -!CHECK-LABEL: omp.declare_reduction -!CHECK-SAME: @[[RED_I32_NAME:.*]] : i32 init { -!CHECK: ^bb0(%{{.*}}: i32): -!CHECK: %[[C0_1:.*]] = arith.constant 0 : i32 -!CHECK: omp.yield(%[[C0_1]] : i32) -!CHECK: } combiner { -!CHECK: ^bb0(%[[ARG0:.*]]: i32, %[[ARG1:.*]]: i32): -!CHECK: %[[RES:.*]] = arith.addi %[[ARG0]], %[[ARG1]] : i32 -!CHECK: omp.yield(%[[RES]] : i32) -!CHECK: } - -!CHECK-LABEL: func.func @_QPsimple_int_add -!CHECK: %[[IREF:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_int_addEi"} -!CHECK: %[[I_START:.*]] = arith.constant 0 : i32 -!CHECK: fir.store %[[I_START]] to %[[IREF]] : !fir.ref -!CHECK: omp.parallel reduction(@[[RED_I32_NAME]] %[[IREF]] -> %[[PRV:.+]] : !fir.ref) { -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[I_INCR:.+]] = arith.constant 1 : i32 -!CHECK: %[[RES:.+]] = arith.addi %[[LPRV]], %[[I_INCR]] -!CHECK: fir.store %[[RES]] to %[[PRV]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: return -subroutine simple_int_add - integer :: i - i = 0 - - !$omp parallel reduction(+:i) - i = i + 1 - !$omp end parallel - - print *, i -end subroutine - -!CHECK-LABEL: func.func @_QPsimple_real_add -!CHECK: %[[RREF:.*]] = fir.alloca f32 {bindc_name = "r", uniq_name = "_QFsimple_real_addEr"} -!CHECK: %[[R_START:.*]] = arith.constant 0.000000e+00 : f32 -!CHECK: fir.store %[[R_START]] to %[[RREF]] : !fir.ref -!CHECK: omp.parallel reduction(@[[RED_F32_NAME]] %[[RREF]] -> %[[PRV:.+]] : !fir.ref) { -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[R_INCR:.+]] = arith.constant 1.500000e+00 : f32 -!CHECK: %[[RES]] = arith.addf %[[LPRV]], %[[R_INCR]] {{.*}} : f32 -!CHECK: fir.store %[[RES]] to %[[PRV]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: return -subroutine simple_real_add - real :: r - r = 0.0 - - !$omp parallel reduction(+:r) - r = r + 1.5 - !$omp end parallel - - print *, r -end subroutine - -!CHECK-LABEL: func.func @_QPint_real_add -!CHECK: %[[IREF:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFint_real_addEi"} -!CHECK: %[[RREF:.*]] = fir.alloca f32 {bindc_name = "r", uniq_name = "_QFint_real_addEr"} -!CHECK: %[[R_START:.*]] = arith.constant 0.000000e+00 : f32 -!CHECK: fir.store %[[R_START]] to %[[RREF]] : !fir.ref -!CHECK: %[[I_START:.*]] = arith.constant 0 : i32 -!CHECK: fir.store %[[I_START]] to %[[IREF]] : !fir.ref -!CHECK: omp.parallel reduction(@[[RED_I32_NAME]] %[[IREF]] -> %[[PRV0:.+]] : !fir.ref, @[[RED_F32_NAME]] %[[RREF]] -> %[[PRV1:.+]] : !fir.ref) { -!CHECK: %[[R_INCR:.*]] = arith.constant 1.500000e+00 : f32 -!CHECK: %[[LPRV1:.+]] = fir.load %[[PRV1]] : !fir.ref -!CHECK: %[[RES1:.+]] = arith.addf %[[R_INCR]], %[[LPRV1]] {{.*}} : f32 -!CHECK: fir.store %[[RES1]] to %[[PRV1]] -!CHECK: %[[LPRV0:.+]] = fir.load %[[PRV0]] : !fir.ref -!CHECK: %[[I_INCR:.*]] = arith.constant 3 : i32 -!CHECK: %[[RES0:.+]] = arith.addi %[[LPRV0]], %[[I_INCR]] -!CHECK: fir.store %[[RES0]] to %[[PRV0]] -!CHECK: omp.terminator -!CHECK: } -!CHECK: return -subroutine int_real_add - real :: r - integer :: i - - r = 0.0 - i = 0 - - !$omp parallel reduction(+:i,r) - r = 1.5 + r - i = i + 3 - !$omp end parallel - - print *, r - print *, i -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/parallel-sections.f90 b/flang/test/Lower/OpenMP/FIR/parallel-sections.f90 deleted file mode 100644 index 7730ab87a719a..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/parallel-sections.f90 +++ /dev/null @@ -1,65 +0,0 @@ -! REQUIRES: openmp_runtime - -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect" -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --cfg-conversion | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="OMPDialect,LLVMDialect" - -!=============================================================================== -! Parallel sections construct -!=============================================================================== - -!FIRDialect: func @_QPomp_parallel_sections -subroutine omp_parallel_sections(x, y) - integer, intent(inout) :: x, y - !OMPDialect: omp.parallel { - !OMPDialect: omp.sections { - !$omp parallel sections - !OMPDialect: omp.section { - !$omp section - !FIRDialect: fir.load - !FIRDialect: arith.addi - !FIRDialect: fir.store - x = x + 12 - !OMPDialect: omp.terminator - !OMPDialect: omp.section { - !$omp section - !FIRDialect: fir.load - !FIRDialect: arith.subi - !FIRDialect: fir.store - y = y - 5 - !OMPDialect: omp.terminator - !OMPDialect: omp.terminator - !OMPDialect: omp.terminator - !$omp end parallel sections -end subroutine omp_parallel_sections - -!=============================================================================== -! Parallel sections construct with allocate clause -!=============================================================================== - -!FIRDialect: func @_QPomp_parallel_sections -subroutine omp_parallel_sections_allocate(x, y) - use omp_lib - integer, intent(inout) :: x, y - !FIRDialect: %[[allocator_1:.*]] = arith.constant 4 : i64 - !FIRDialect: %[[allocator_2:.*]] = arith.constant 4 : i64 - !LLVMDialect: %[[allocator_1:.*]] = llvm.mlir.constant(4 : i64) : i64 - !LLVMDialect: %[[allocator_2:.*]] = llvm.mlir.constant(4 : i64) : i64 - !OMPDialect: omp.parallel allocate( - !FIRDialect: %[[allocator_2]] : i64 -> %{{.*}} : !fir.ref) { - !LLVMDialect: %[[allocator_2]] : i64 -> %{{.*}} : !llvm.ptr) { - !OMPDialect: omp.sections allocate( - !FIRDialect: %[[allocator_1]] : i64 -> %{{.*}} : !fir.ref) { - !LLVMDialect: %[[allocator_1]] : i64 -> %{{.*}} : !llvm.ptr) { - !$omp parallel sections allocate(omp_high_bw_mem_alloc: x) - !OMPDialect: omp.section { - !$omp section - x = x + 12 - !OMPDialect: omp.terminator - !OMPDialect: omp.section { - !$omp section - y = y + 5 - !OMPDialect: omp.terminator - !OMPDialect: omp.terminator - !OMPDialect: omp.terminator - !$omp end parallel sections -end subroutine omp_parallel_sections_allocate diff --git a/flang/test/Lower/OpenMP/FIR/parallel-wsloop-firstpriv.f90 b/flang/test/Lower/OpenMP/FIR/parallel-wsloop-firstpriv.f90 deleted file mode 100644 index 490f6d0cf7bca..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/parallel-wsloop-firstpriv.f90 +++ /dev/null @@ -1,69 +0,0 @@ -! This test checks lowering of OpenMP parallel DO, with the loop bound being -! a firstprivate variable - -! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s - -! CHECK: func @_QPomp_do_firstprivate(%[[ARG0:.*]]: !fir.ref {fir.bindc_name = "a"}) -subroutine omp_do_firstprivate(a) - integer::a - integer::n - n = a+1 - !$omp parallel do firstprivate(a) - ! CHECK: omp.parallel { - ! CHECK-NEXT: %[[REF:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} - ! CHECK-NEXT: %[[CLONE:.*]] = fir.alloca i32 {bindc_name = "a", pinned - ! CHECK-NEXT: %[[LD:.*]] = fir.load %[[ARG0]] : !fir.ref - ! CHECK-NEXT: fir.store %[[LD]] to %[[CLONE]] : !fir.ref - ! CHECK: %[[LB:.*]] = arith.constant 1 : i32 - ! CHECK-NEXT: %[[UB:.*]] = fir.load %[[CLONE]] : !fir.ref - ! CHECK-NEXT: %[[STEP:.*]] = arith.constant 1 : i32 - ! CHECK-NEXT: omp.wsloop { - ! CHECK-NEXT: omp.loop_nest (%[[ARG1:.*]]) : i32 = (%[[LB]]) to (%[[UB]]) inclusive step (%[[STEP]]) { - ! CHECK-NEXT: fir.store %[[ARG1]] to %[[REF]] : !fir.ref - ! CHECK-NEXT: fir.call @_QPfoo(%[[REF]], %[[CLONE]]) {{.*}}: (!fir.ref, !fir.ref) -> () - ! CHECK-NEXT: omp.yield - ! CHECK-NEXT: } - ! CHECK-NEXT: omp.terminator - ! CHECK-NEXT: } - do i=1, a - call foo(i, a) - end do - !$omp end parallel do - !CHECK: fir.call @_QPbar(%[[ARG0]]) {{.*}}: (!fir.ref) -> () - call bar(a) -end subroutine omp_do_firstprivate - -! CHECK: func @_QPomp_do_firstprivate2(%[[ARG0:.*]]: !fir.ref {fir.bindc_name = "a"}, %[[ARG1:.*]]: !fir.ref {fir.bindc_name = "n"}) -subroutine omp_do_firstprivate2(a, n) - integer::a - integer::n - n = a+1 - !$omp parallel do firstprivate(a, n) - ! CHECK: omp.parallel { - ! CHECK-NEXT: %[[REF:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} - ! CHECK-NEXT: %[[CLONE:.*]] = fir.alloca i32 {bindc_name = "a", pinned - ! CHECK-NEXT: %[[LD:.*]] = fir.load %[[ARG0]] : !fir.ref - ! CHECK-NEXT: fir.store %[[LD]] to %[[CLONE]] : !fir.ref - ! CHECK-NEXT: %[[CLONE1:.*]] = fir.alloca i32 {bindc_name = "n", pinned - ! CHECK-NEXT: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref - ! CHECK-NEXT: fir.store %[[LD1]] to %[[CLONE1]] : !fir.ref - - - ! CHECK: %[[LB:.*]] = fir.load %[[CLONE]] : !fir.ref - ! CHECK-NEXT: %[[UB:.*]] = fir.load %[[CLONE1]] : !fir.ref - ! CHECK-NEXT: %[[STEP:.*]] = arith.constant 1 : i32 - ! CHECK-NEXT: omp.wsloop { - ! CHECK-NEXT: omp.loop_nest (%[[ARG2:.*]]) : i32 = (%[[LB]]) to (%[[UB]]) inclusive step (%[[STEP]]) { - ! CHECK-NEXT: fir.store %[[ARG2]] to %[[REF]] : !fir.ref - ! CHECK-NEXT: fir.call @_QPfoo(%[[REF]], %[[CLONE]]) {{.*}}: (!fir.ref, !fir.ref) -> () - ! CHECK-NEXT: omp.yield - ! CHECK-NEXT: } - ! CHECK-NEXT: omp.terminator - ! CHECK-NEXT: } - do i= a, n - call foo(i, a) - end do - !$omp end parallel do - !CHECK: fir.call @_QPbar(%[[ARG1]]) {{.*}}: (!fir.ref) -> () - call bar(n) -end subroutine omp_do_firstprivate2 diff --git a/flang/test/Lower/OpenMP/FIR/parallel-wsloop.f90 b/flang/test/Lower/OpenMP/FIR/parallel-wsloop.f90 deleted file mode 100644 index 630d647bc64b6..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/parallel-wsloop.f90 +++ /dev/null @@ -1,297 +0,0 @@ -! This test checks lowering of OpenMP DO Directive (Worksharing). - -! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s - -! CHECK-LABEL: func @_QPsimple_parallel_do() -subroutine simple_parallel_do - integer :: i - ! CHECK: omp.parallel - ! CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32 - ! CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32 - ! CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32 - ! CHECK: omp.wsloop { - ! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) { - !$OMP PARALLEL DO - do i=1, 9 - ! CHECK: fir.store %[[I]] to %[[IV_ADDR:.*]] : !fir.ref - ! CHECK: %[[LOAD_IV:.*]] = fir.load %[[IV_ADDR]] : !fir.ref - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - ! CHECK: omp.yield - ! CHECK: omp.terminator - ! CHECK: omp.terminator - !$OMP END PARALLEL DO -end subroutine - -! CHECK-LABEL: func @_QPparallel_do_with_parallel_clauses -! CHECK-SAME: %[[COND_REF:.*]]: !fir.ref> {fir.bindc_name = "cond"}, %[[NT_REF:.*]]: !fir.ref {fir.bindc_name = "nt"} -subroutine parallel_do_with_parallel_clauses(cond, nt) - logical :: cond - integer :: nt - integer :: i - ! CHECK: %[[COND:.*]] = fir.load %[[COND_REF]] : !fir.ref> - ! CHECK: %[[COND_CVT:.*]] = fir.convert %[[COND]] : (!fir.logical<4>) -> i1 - ! CHECK: %[[NT:.*]] = fir.load %[[NT_REF]] : !fir.ref - ! CHECK: omp.parallel if(%[[COND_CVT]] : i1) num_threads(%[[NT]] : i32) proc_bind(close) - ! CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32 - ! CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32 - ! CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32 - ! CHECK: omp.wsloop { - ! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) { - !$OMP PARALLEL DO IF(cond) NUM_THREADS(nt) PROC_BIND(close) - do i=1, 9 - ! CHECK: fir.store %[[I]] to %[[IV_ADDR:.*]] : !fir.ref - ! CHECK: %[[LOAD_IV:.*]] = fir.load %[[IV_ADDR]] : !fir.ref - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - ! CHECK: omp.yield - ! CHECK: omp.terminator - ! CHECK: omp.terminator - !$OMP END PARALLEL DO -end subroutine - -! CHECK-LABEL: func @_QPparallel_do_with_clauses -! CHECK-SAME: %[[NT_REF:.*]]: !fir.ref {fir.bindc_name = "nt"} -subroutine parallel_do_with_clauses(nt) - integer :: nt - integer :: i - ! CHECK: %[[NT:.*]] = fir.load %[[NT_REF]] : !fir.ref - ! CHECK: omp.parallel num_threads(%[[NT]] : i32) - ! CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32 - ! CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32 - ! CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32 - ! CHECK: omp.wsloop schedule(dynamic) { - ! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) - !$OMP PARALLEL DO NUM_THREADS(nt) SCHEDULE(dynamic) - do i=1, 9 - ! CHECK: fir.store %[[I]] to %[[IV_ADDR:.*]] : !fir.ref - ! CHECK: %[[LOAD_IV:.*]] = fir.load %[[IV_ADDR]] : !fir.ref - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - ! CHECK: omp.yield - ! CHECK: omp.terminator - ! CHECK: omp.terminator - !$OMP END PARALLEL DO -end subroutine - -!=============================================================================== -! Checking for the following construct: -! !$omp parallel do private(...) firstprivate(...) -!=============================================================================== - -! CHECK-LABEL: func @_QPparallel_do_with_privatisation_clauses -! CHECK-SAME: %[[COND_REF:.*]]: !fir.ref> {fir.bindc_name = "cond"}, %[[NT_REF:.*]]: !fir.ref {fir.bindc_name = "nt"} -subroutine parallel_do_with_privatisation_clauses(cond,nt) - logical :: cond - integer :: nt - integer :: i - ! CHECK: omp.parallel - ! CHECK: %[[PRIVATE_COND_REF:.*]] = fir.alloca !fir.logical<4> {bindc_name = "cond", pinned, uniq_name = "_QFparallel_do_with_privatisation_clausesEcond"} - ! CHECK: %[[PRIVATE_NT_REF:.*]] = fir.alloca i32 {bindc_name = "nt", pinned, uniq_name = "_QFparallel_do_with_privatisation_clausesEnt"} - ! CHECK: %[[NT_VAL:.*]] = fir.load %[[NT_REF]] : !fir.ref - ! CHECK: fir.store %[[NT_VAL]] to %[[PRIVATE_NT_REF]] : !fir.ref - ! CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32 - ! CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32 - ! CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32 - ! CHECK: omp.wsloop { - ! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) { - !$OMP PARALLEL DO PRIVATE(cond) FIRSTPRIVATE(nt) - do i=1, 9 - ! CHECK: fir.store %[[I]] to %[[IV_ADDR:.*]] : !fir.ref - ! CHECK: %[[LOAD_IV:.*]] = fir.load %[[IV_ADDR]] : !fir.ref - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref, i32) -> i1 - ! CHECK: %[[PRIVATE_COND_VAL:.*]] = fir.load %[[PRIVATE_COND_REF]] : !fir.ref> - ! CHECK: %[[PRIVATE_COND_VAL_CVT:.*]] = fir.convert %[[PRIVATE_COND_VAL]] : (!fir.logical<4>) -> i1 - ! CHECK: fir.call @_FortranAioOutputLogical({{.*}}, %[[PRIVATE_COND_VAL_CVT]]) {{.*}}: (!fir.ref, i1) -> i1 - ! CHECK: %[[PRIVATE_NT_VAL:.*]] = fir.load %[[PRIVATE_NT_REF]] : !fir.ref - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[PRIVATE_NT_VAL]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i, cond, nt - end do - ! CHECK: omp.yield - ! CHECK: omp.terminator - ! CHECK: omp.terminator - !$OMP END PARALLEL DO -end subroutine - -!=============================================================================== -! Checking for the following construct -! !$omp parallel private(...) firstprivate(...) -! !$omp do -!=============================================================================== - -subroutine parallel_private_do(cond,nt) -logical :: cond - integer :: nt - integer :: i - !$OMP PARALLEL PRIVATE(cond) FIRSTPRIVATE(nt) - !$OMP DO - do i=1, 9 - call foo(i, cond, nt) - end do - !$OMP END DO - !$OMP END PARALLEL -end subroutine parallel_private_do - -! CHECK-LABEL: func.func @_QPparallel_private_do( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref> {fir.bindc_name = "cond"}, -! CHECK-SAME: %[[VAL_1:.*]]: !fir.ref {fir.bindc_name = "nt"}) { -! CHECK: %[[I:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFparallel_private_doEi"} -! CHECK: omp.parallel { -! CHECK: %[[I_PRIV:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[COND_ADDR:.*]] = fir.alloca !fir.logical<4> {bindc_name = "cond", pinned, uniq_name = "_QFparallel_private_doEcond"} -! CHECK: %[[NT_ADDR:.*]] = fir.alloca i32 {bindc_name = "nt", pinned, uniq_name = "_QFparallel_private_doEnt"} -! CHECK: %[[NT:.*]] = fir.load %[[VAL_1]] : !fir.ref -! CHECK: fir.store %[[NT]] to %[[NT_ADDR]] : !fir.ref -! CHECK: %[[VAL_7:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_8:.*]] = arith.constant 9 : i32 -! CHECK: %[[VAL_9:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop { -! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[VAL_7]]) to (%[[VAL_8]]) inclusive step (%[[VAL_9]]) { -! CHECK: fir.store %[[I]] to %[[I_PRIV]] : !fir.ref -! CHECK: fir.call @_QPfoo(%[[I_PRIV]], %[[COND_ADDR]], %[[NT_ADDR]]) {{.*}}: (!fir.ref, !fir.ref>, !fir.ref) -> () -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -!=============================================================================== -! Checking for the following construct -! !$omp parallel -! !$omp do firstprivate(...) firstprivate(...) -!=============================================================================== - -subroutine omp_parallel_multiple_firstprivate_do(a, b) - integer::a, b - !$OMP PARALLEL FIRSTPRIVATE(a) FIRSTPRIVATE(b) - !$OMP DO - do i=1, 10 - call bar(i, a) - end do - !$OMP END DO - !$OMP END PARALLEL -end subroutine omp_parallel_multiple_firstprivate_do - -! CHECK-LABEL: func.func @_QPomp_parallel_multiple_firstprivate_do( -! CHECK-SAME: %[[A_ADDR:.*]]: !fir.ref {fir.bindc_name = "a"}, -! CHECK-SAME: %[[B_ADDR:.*]]: !fir.ref {fir.bindc_name = "b"}) { -! CHECK: %[[I_ADDR:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFomp_parallel_multiple_firstprivate_doEi"} -! CHECK: omp.parallel { -! CHECK: %[[I_PRIV_ADDR:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[A_PRIV_ADDR:.*]] = fir.alloca i32 {bindc_name = "a", pinned, uniq_name = "_QFomp_parallel_multiple_firstprivate_doEa"} -! CHECK: %[[A:.*]] = fir.load %[[A_ADDR]] : !fir.ref -! CHECK: fir.store %[[A]] to %[[A_PRIV_ADDR]] : !fir.ref -! CHECK: %[[B_PRIV_ADDR:.*]] = fir.alloca i32 {bindc_name = "b", pinned, uniq_name = "_QFomp_parallel_multiple_firstprivate_doEb"} -! CHECK: %[[B:.*]] = fir.load %[[B_ADDR]] : !fir.ref -! CHECK: fir.store %[[B]] to %[[B_PRIV_ADDR]] : !fir.ref -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_9:.*]] = arith.constant 10 : i32 -! CHECK: %[[VAL_10:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop { -! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[VAL_8]]) to (%[[VAL_9]]) inclusive step (%[[VAL_10]]) { -! CHECK: fir.store %[[I]] to %[[I_PRIV_ADDR]] : !fir.ref -! CHECK: fir.call @_QPbar(%[[I_PRIV_ADDR]], %[[A_PRIV_ADDR]]) {{.*}}: (!fir.ref, !fir.ref) -> () -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -!=============================================================================== -! Checking for the following construct -! !$omp parallel -! !$omp do private(...) firstprivate(...) -!=============================================================================== - -subroutine parallel_do_private(cond,nt) -logical :: cond - integer :: nt - integer :: i - !$OMP PARALLEL - !$OMP DO PRIVATE(cond) FIRSTPRIVATE(nt) - do i=1, 9 - call foo(i, cond, nt) - end do - !$OMP END DO - !$OMP END PARALLEL -end subroutine parallel_do_private - -! CHECK-LABEL: func.func @_QPparallel_do_private( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref> {fir.bindc_name = "cond"}, -! CHECK-SAME: %[[VAL_1:.*]]: !fir.ref {fir.bindc_name = "nt"}) { -! CHECK: %[[I_ADDR:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFparallel_do_privateEi"} -! CHECK: omp.parallel { -! CHECK: %[[I_PRIV_ADDR:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[COND_ADDR:.*]] = fir.alloca !fir.logical<4> {bindc_name = "cond", pinned, uniq_name = "_QFparallel_do_privateEcond"} -! CHECK: %[[NT_ADDR:.*]] = fir.alloca i32 {bindc_name = "nt", pinned, uniq_name = "_QFparallel_do_privateEnt"} -! CHECK: %[[NT:.*]] = fir.load %[[VAL_1]] : !fir.ref -! CHECK: fir.store %[[NT]] to %[[NT_ADDR]] : !fir.ref -! CHECK: %[[VAL_7:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_8:.*]] = arith.constant 9 : i32 -! CHECK: %[[VAL_9:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop { -! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[VAL_7]]) to (%[[VAL_8]]) inclusive step (%[[VAL_9]]) { -! CHECK: fir.store %[[I]] to %[[I_PRIV_ADDR]] : !fir.ref -! CHECK: fir.call @_QPfoo(%[[I_PRIV_ADDR]], %[[COND_ADDR]], %[[NT_ADDR]]) {{.*}}: (!fir.ref, !fir.ref>, !fir.ref) -> () -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -!=============================================================================== -! Checking for the following construct -! !$omp parallel -! !$omp do firstprivate(...) firstprivate(...) -!=============================================================================== - -subroutine omp_parallel_do_multiple_firstprivate(a, b) - integer::a, b - !$OMP PARALLEL - !$OMP DO FIRSTPRIVATE(a) FIRSTPRIVATE(b) - do i=1, 10 - call bar(i, a) - end do - !$OMP END DO - !$OMP END PARALLEL -end subroutine omp_parallel_do_multiple_firstprivate - -! CHECK-LABEL: func.func @_QPomp_parallel_do_multiple_firstprivate( -! CHECK-SAME: %[[A_ADDR:.*]]: !fir.ref {fir.bindc_name = "a"}, -! CHECK-SAME: %[[B_ADDR:.*]]: !fir.ref {fir.bindc_name = "b"}) { -! CHECK: %[[I_ADDR:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFomp_parallel_do_multiple_firstprivateEi"} -! CHECK: omp.parallel { -! CHECK: %[[I_PRIV_ADDR:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[A_PRIV_ADDR:.*]] = fir.alloca i32 {bindc_name = "a", pinned, uniq_name = "_QFomp_parallel_do_multiple_firstprivateEa"} -! CHECK: %[[A:.*]] = fir.load %[[A_ADDR]] : !fir.ref -! CHECK: fir.store %[[A]] to %[[A_PRIV_ADDR]] : !fir.ref -! CHECK: %[[B_PRIV_ADDR:.*]] = fir.alloca i32 {bindc_name = "b", pinned, uniq_name = "_QFomp_parallel_do_multiple_firstprivateEb"} -! CHECK: %[[B:.*]] = fir.load %[[B_ADDR]] : !fir.ref -! CHECK: fir.store %[[B]] to %[[B_PRIV_ADDR]] : !fir.ref -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_9:.*]] = arith.constant 10 : i32 -! CHECK: %[[VAL_10:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop { -! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[VAL_8]]) to (%[[VAL_9]]) inclusive step (%[[VAL_10]]) { -! CHECK: fir.store %[[I]] to %[[I_PRIV_ADDR]] : !fir.ref -! CHECK: fir.call @_QPbar(%[[I_PRIV_ADDR]], %[[A_PRIV_ADDR]]) {{.*}}: (!fir.ref, !fir.ref) -> () -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } diff --git a/flang/test/Lower/OpenMP/FIR/parallel.f90 b/flang/test/Lower/OpenMP/FIR/parallel.f90 deleted file mode 100644 index a2ceb2d939f25..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/parallel.f90 +++ /dev/null @@ -1,211 +0,0 @@ -! REQUIRES: openmp_runtime - -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect" -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="LLVMDialect,OMPDialect" - -!FIRDialect-LABEL: func @_QPparallel_simple -subroutine parallel_simple() - !OMPDialect: omp.parallel -!$omp parallel - !FIRDialect: fir.call - call f1() -!$omp end parallel -end subroutine parallel_simple - -!=============================================================================== -! `if` clause -!=============================================================================== - -!FIRDialect-LABEL: func @_QPparallel_if -subroutine parallel_if(alpha, beta, gamma) - integer, intent(in) :: alpha - logical, intent(in) :: beta - logical(1) :: logical1 - logical(2) :: logical2 - logical(4) :: logical4 - logical(8) :: logical8 - - !OMPDialect: omp.parallel if(%{{.*}} : i1) { - !$omp parallel if(alpha .le. 0) - !FIRDialect: fir.call - call f1() - !OMPDialect: omp.terminator - !$omp end parallel - - !OMPDialect: omp.parallel if(%{{.*}} : i1) { - !$omp parallel if(.false.) - !FIRDialect: fir.call - call f2() - !OMPDialect: omp.terminator - !$omp end parallel - - !OMPDialect: omp.parallel if(%{{.*}} : i1) { - !$omp parallel if(alpha .ge. 0) - !FIRDialect: fir.call - call f3() - !OMPDialect: omp.terminator - !$omp end parallel - - !OMPDialect: omp.parallel if(%{{.*}} : i1) { - !$omp parallel if(.true.) - !FIRDialect: fir.call - call f4() - !OMPDialect: omp.terminator - !$omp end parallel - - !OMPDialect: omp.parallel if(%{{.*}} : i1) { - !$omp parallel if(beta) - !FIRDialect: fir.call - call f1() - !OMPDialect: omp.terminator - !$omp end parallel - - !OMPDialect: omp.parallel if(%{{.*}} : i1) { - !$omp parallel if(logical1) - !FIRDialect: fir.call - call f1() - !OMPDialect: omp.terminator - !$omp end parallel - - !OMPDialect: omp.parallel if(%{{.*}} : i1) { - !$omp parallel if(logical2) - !FIRDialect: fir.call - call f1() - !OMPDialect: omp.terminator - !$omp end parallel - - !OMPDialect: omp.parallel if(%{{.*}} : i1) { - !$omp parallel if(logical4) - !FIRDialect: fir.call - call f1() - !OMPDialect: omp.terminator - !$omp end parallel - - !OMPDialect: omp.parallel if(%{{.*}} : i1) { - !$omp parallel if(logical8) - !FIRDialect: fir.call - call f1() - !OMPDialect: omp.terminator - !$omp end parallel - -end subroutine parallel_if - -!=============================================================================== -! `num_threads` clause -!=============================================================================== - -!FIRDialect-LABEL: func @_QPparallel_numthreads -subroutine parallel_numthreads(num_threads) - integer, intent(inout) :: num_threads - - !OMPDialect: omp.parallel num_threads(%{{.*}}: i32) { - !$omp parallel num_threads(16) - !FIRDialect: fir.call - call f1() - !OMPDialect: omp.terminator - !$omp end parallel - - num_threads = 4 - - !OMPDialect: omp.parallel num_threads(%{{.*}} : i32) { - !$omp parallel num_threads(num_threads) - !FIRDialect: fir.call - call f2() - !OMPDialect: omp.terminator - !$omp end parallel - -end subroutine parallel_numthreads - -!=============================================================================== -! `proc_bind` clause -!=============================================================================== - -!FIRDialect-LABEL: func @_QPparallel_proc_bind -subroutine parallel_proc_bind() - - !OMPDialect: omp.parallel proc_bind(master) { - !$omp parallel proc_bind(master) - !FIRDialect: fir.call - call f1() - !OMPDialect: omp.terminator - !$omp end parallel - - !OMPDialect: omp.parallel proc_bind(close) { - !$omp parallel proc_bind(close) - !FIRDialect: fir.call - call f2() - !OMPDialect: omp.terminator - !$omp end parallel - - !OMPDialect: omp.parallel proc_bind(spread) { - !$omp parallel proc_bind(spread) - !FIRDialect: fir.call - call f3() - !OMPDialect: omp.terminator - !$omp end parallel - -end subroutine parallel_proc_bind - -!=============================================================================== -! `allocate` clause -!=============================================================================== - -!FIRDialect-LABEL: func @_QPparallel_allocate -subroutine parallel_allocate() - use omp_lib - integer :: x - !OMPDialect: omp.parallel allocate( - !FIRDialect: %{{.+}} : i64 -> %{{.+}} : !fir.ref - !LLVMDialect: %{{.+}} : i64 -> %{{.+}} : !llvm.ptr - !OMPDialect: ) { - !$omp parallel allocate(omp_high_bw_mem_alloc: x) private(x) - !FIRDialect: arith.addi - x = x + 12 - !OMPDialect: omp.terminator - !$omp end parallel -end subroutine parallel_allocate - -!=============================================================================== -! multiple clauses -!=============================================================================== - -!FIRDialect-LABEL: func @_QPparallel_multiple_clauses -subroutine parallel_multiple_clauses(alpha, num_threads) - use omp_lib - integer, intent(inout) :: alpha - integer, intent(in) :: num_threads - - !OMPDialect: omp.parallel if({{.*}} : i1) proc_bind(master) { - !$omp parallel if(alpha .le. 0) proc_bind(master) - !FIRDialect: fir.call - call f1() - !OMPDialect: omp.terminator - !$omp end parallel - - !OMPDialect: omp.parallel num_threads({{.*}} : i32) proc_bind(close) { - !$omp parallel proc_bind(close) num_threads(num_threads) - !FIRDialect: fir.call - call f2() - !OMPDialect: omp.terminator - !$omp end parallel - - !OMPDialect: omp.parallel if({{.*}} : i1) num_threads({{.*}} : i32) { - !$omp parallel num_threads(num_threads) if(alpha .le. 0) - !FIRDialect: fir.call - call f3() - !OMPDialect: omp.terminator - !$omp end parallel - - !OMPDialect: omp.parallel if({{.*}} : i1) num_threads({{.*}} : i32) allocate( - !FIRDialect: %{{.+}} : i64 -> %{{.+}} : !fir.ref - !LLVMDialect: %{{.+}} : i64 -> %{{.+}} : !llvm.ptr - !OMPDialect: ) { - !$omp parallel num_threads(num_threads) if(alpha .le. 0) allocate(omp_high_bw_mem_alloc: alpha) private(alpha) - !FIRDialect: fir.call - call f3() - !FIRDialect: arith.addi - alpha = alpha + 12 - !OMPDialect: omp.terminator - !$omp end parallel - -end subroutine parallel_multiple_clauses diff --git a/flang/test/Lower/OpenMP/FIR/pre-fir-tree-loop.f90 b/flang/test/Lower/OpenMP/FIR/pre-fir-tree-loop.f90 deleted file mode 100644 index eca8fb3049863..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/pre-fir-tree-loop.f90 +++ /dev/null @@ -1,70 +0,0 @@ -! RUN: bbc -fopenmp -pft-test -o %t %s | FileCheck %s -! RUN: %flang_fc1 -fopenmp -fdebug-dump-pft -o %t %s | FileCheck %s - -! Loop constructs always have an `end do` which can be the target of -! a branch. So OpenMP loop constructs do not need an artificial -! continue inserted for a target. - -!CHECK-LABEL: sb0 -!CHECK-NOT: continue -subroutine sb0(cond) - implicit none - logical :: cond - integer :: i - !$omp parallel do - do i = 1, 20 - if( cond) then - cycle - end if - end do - return -end subroutine - -!CHECK-LABEL: sb1 -!CHECK-NOT: continue -subroutine sb1(cond) - implicit none - logical :: cond - integer :: i - !$omp parallel do - do i = 1, 20 - if( cond) then - cycle - end if - end do - !$omp end parallel do - return -end subroutine - -!CHECK-LABEL: sb2 -!CHECK-NOT: continue -subroutine sb2 - integer :: i, n - integer :: tmp - - !$omp parallel do - do ifld=1,n - do isum=1,n - if (tmp > n) then - exit - endif - enddo - tmp = n - enddo -end subroutine - -!CHECK-LABEL: sb3 -!CHECK-NOT: continue -subroutine sb3 - integer :: i, n - integer :: tmp - - !$omp parallel do - do ifld=1,n - do isum=1,n - if (tmp > n) then - exit - endif - enddo - enddo -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/pre-fir-tree01.f90 b/flang/test/Lower/OpenMP/FIR/pre-fir-tree01.f90 deleted file mode 100644 index fc817942513e2..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/pre-fir-tree01.f90 +++ /dev/null @@ -1,19 +0,0 @@ -! RUN: bbc -fopenmp -pft-test -o %t %s | FileCheck %s -! RUN: %flang_fc1 -fopenmp -fdebug-dump-pft -o %t %s | FileCheck %s - -! Test structure of the Pre-FIR tree with OpenMP - -subroutine sub1(a, b, n) - real :: a(:), b(:) - integer :: n, i - !$omp parallel do - do i = 1, n - b(i) = exp(a(i)) - end do - !$omp end parallel do -end subroutine - -! CHECK-LABEL: Subroutine sub1 -! CHECK: <> -! CHECK: <> -! CHECK: <> diff --git a/flang/test/Lower/OpenMP/FIR/private-commonblock.f90 b/flang/test/Lower/OpenMP/FIR/private-commonblock.f90 deleted file mode 100644 index 90036e0c0c7e2..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/private-commonblock.f90 +++ /dev/null @@ -1,109 +0,0 @@ -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s - -!CHECK: func.func @_QPprivate_common() { -!CHECK: omp.parallel { -!CHECK: %[[X:.*]] = fir.alloca f32 {bindc_name = "x", pinned, uniq_name = "_QFprivate_commonEx"} -!CHECK: %[[Y:.*]] = fir.alloca f32 {bindc_name = "y", pinned, uniq_name = "_QFprivate_commonEy"} -!CHECK: omp.terminator -!CHECK: } -!CHECK: return -!CHECK: } -subroutine private_common - common /c/ x, y - real x, y - !$omp parallel private(/c/) - !$omp end parallel -end subroutine - -!CHECK: %[[val_0:.*]] = fir.address_of(@blk_) : !fir.ref> -!CHECK: %[[val_1:.*]] = fir.convert %0 : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c0:.*]] = arith.constant 0 : index -!CHECK: %[[val_2:.*]] = fir.coordinate_of %[[val_1]], %[[val_c0]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_3:.*]] = fir.convert %[[val_2]] : (!fir.ref) -> !fir.ref -!CHECK: %[[val_4:.*]] = fir.convert %[[val_0]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c4:.*]] = arith.constant 4 : index -!CHECK: %[[val_5:.*]] = fir.coordinate_of %[[val_4]], %[[val_c4]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_6:.*]] = fir.convert %[[val_5]] : (!fir.ref) -> !fir.ref> -!CHECK: %[[val_7:.*]] = fir.convert %[[val_0]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c44:.*]] = arith.constant 44 : index -!CHECK: %[[val_8:.*]] = fir.coordinate_of %[[val_7]], %[[val_c44]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_9:.*]] = fir.convert %[[val_8]] : (!fir.ref) -> !fir.ref> -!CHECK: %[[val_c5:.*]] = arith.constant 5 : index -!CHECK: %[[val_10:.*]] = fir.convert %[[val_0]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c49:.*]] = arith.constant 49 : index -!CHECK: %[[val_11:.*]] = fir.coordinate_of %[[val_10]], %[[val_c49]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_12:.*]] = fir.convert %[[val_11]] : (!fir.ref) -> !fir.ref>> -!CHECK: %[[val_c5_0:.*]] = arith.constant 5 : index -!CHECK: %[[val_14:.*]] = fir.emboxchar %[[val_9]], %[[val_c5]] : (!fir.ref>, index) -> !fir.boxchar<1> -!CHECK: %[[val_15:.*]] = fir.convert %[[val_12]] : (!fir.ref>>) -> !fir.ref> -!CHECK: %[[val_16:.*]] = fir.emboxchar %[[val_15]], %[[val_c5_0]] : (!fir.ref>, index) -> !fir.boxchar<1> -!CHECK: fir.call @_QPsub1(%[[val_3]], %[[val_6]], %[[val_14]], %[[val_16]]) fastmath : (!fir.ref, !fir.ref>, !fir.boxchar<1>, !fir.boxchar<1>) -> () -!CHECK: omp.parallel { -!CHECK: %[[val_21:.*]] = fir.alloca i32 {bindc_name = "a", pinned, uniq_name = "_QFprivate_clause_commonblockEa"} -!CHECK: %[[val_22:.*]] = fir.alloca !fir.array<10xf32> {bindc_name = "b", pinned, uniq_name = "_QFprivate_clause_commonblockEb"} -!CHECK: %[[val_23:.*]] = fir.alloca !fir.char<1,5> {bindc_name = "c", pinned, uniq_name = "_QFprivate_clause_commonblockEc"} -!CHECK: %[[val_24:.*]] = fir.alloca !fir.array<5x!fir.char<1,5>> {bindc_name = "d", pinned, uniq_name = "_QFprivate_clause_commonblockEd"} -!CHECK: %[[val_26:.*]] = fir.emboxchar %[[val_23]], %[[val_c5]] : (!fir.ref>, index) -> !fir.boxchar<1> -!CHECK: %[[val_27:.*]] = fir.convert %[[val_24]] : (!fir.ref>>) -> !fir.ref> -!CHECK: %[[val_28:.*]] = fir.emboxchar %[[val_27]], %[[val_c5_0]] : (!fir.ref>, index) -> !fir.boxchar<1> -!CHECK: fir.call @_QPsub2(%[[val_21]], %[[val_22]], %[[val_26]], %[[val_28]]) fastmath : (!fir.ref, !fir.ref>, !fir.boxchar<1>, !fir.boxchar<1>) -> () -!CHECK: omp.terminator -!CHECK: } -!CHECK: %[[val_18:.*]] = fir.emboxchar %[[val_9]], %[[val_c5]] : (!fir.ref>, index) -> !fir.boxchar<1> -!CHECK: %[[val_19:.*]] = fir.convert %[[val_12]] : (!fir.ref>>) -> !fir.ref> -!CHECK: %[[val_20:.*]] = fir.emboxchar %[[val_19]], %[[val_c5_0]] : (!fir.ref>, index) -> !fir.boxchar<1> -!CHECK: fir.call @_QPsub3(%[[val_3]], %[[val_6]], %[[val_18]], %[[val_20]]) fastmath : {{.*}} -!CHECK: return -!CHECK: } -subroutine private_clause_commonblock() - integer::a - real::b(10) - character(5):: c, d(5) - common /blk/ a, b, c, d - - call sub1(a, b, c, d) - !$omp parallel private(/blk/) - call sub2(a, b, c, d) - !$omp end parallel - call sub3(a, b, c, d) -end subroutine - -!CHECK: func.func @_QPprivate_clause_commonblock_pointer() { -!CHECK: %[[val_0:.*]] = fir.address_of(@blk_) : !fir.ref> -!CHECK: %[[val_1:.*]] = fir.convert %[[val_0]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c24:.*]] = arith.constant 24 : index -!CHECK: %[[val_2:.*]] = fir.coordinate_of %[[val_1]], %[[val_c24]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_3:.*]] = fir.convert %[[val_2]] : (!fir.ref) -> !fir.ref -!CHECK: %[[val_4:.*]] = fir.convert %[[val_0]] : (!fir.ref>) -> !fir.ref> -!CHECK: %[[val_c0:.*]] = arith.constant 0 : index -!CHECK: %[[val_5:.*]] = fir.coordinate_of %[[val_4]], %[[val_c0]] : (!fir.ref>, index) -> !fir.ref -!CHECK: %[[val_6:.*]] = fir.convert %[[val_5]] : (!fir.ref) -> !fir.ref>>> -!CHECK: %[[val_7:.*]] = fir.load %[[val_6]] : !fir.ref>>> -!CHECK: %[[val_8:.*]] = fir.box_addr %[[val_7]] : (!fir.box>>) -> !fir.ptr> -!CHECK: %[[val_9:.*]] = fir.convert %[[val_8]] : (!fir.ptr>) -> !fir.ref> -!CHECK: fir.call @_QPsub4(%[[val_9]], %[[val_3]]) fastmath : (!fir.ref>, !fir.ref) -> () -!CHECK: omp.parallel { -!CHECK: %[[val_13:.*]] = fir.alloca !fir.box>> {bindc_name = "c", pinned, uniq_name = "_QFprivate_clause_commonblock_pointerEc"} -!CHECK: %[[val_14:.*]] = fir.alloca i32 {bindc_name = "a", pinned, uniq_name = "_QFprivate_clause_commonblock_pointerEa"} -!CHECK: %[[val_15:.*]] = fir.load %[[val_13]] : !fir.ref>>> -!CHECK: %[[val_16:.*]] = fir.box_addr %[[val_15]] : (!fir.box>>) -> !fir.ptr> -!CHECK: %[[val_17:.*]] = fir.convert %[[val_16]] : (!fir.ptr>) -> !fir.ref> -!CHECK: fir.call @_QPsub5(%[[val_17]], %[[val_14]]) fastmath : (!fir.ref>, !fir.ref) -> () -!CHECK: omp.terminator -!CHECK: } -!CHECK: %[[val_10:.*]] = fir.load %[[val_6]] : !fir.ref>>> -!CHECK: %[[val_11:.*]] = fir.box_addr %[[val_10]] : (!fir.box>>) -> !fir.ptr> -!CHECK: %[[val_12:.*]] = fir.convert %[[val_11]] : (!fir.ptr>) -> !fir.ref> -!CHECK: fir.call @_QPsub6(%[[val_12]], %[[val_3]]) fastmath : (!fir.ref>, !fir.ref) -> () -!CHECK: return -!CHECK: } -subroutine private_clause_commonblock_pointer() - complex, pointer :: c - integer:: a - common /blk/ c, a - call sub4(c, a) - !$omp parallel private(/blk/) - call sub5(c, a) - !$omp end parallel - call sub6(c, a) -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/requires-common.f90 b/flang/test/Lower/OpenMP/FIR/requires-common.f90 deleted file mode 100644 index 2e112d72de3fd..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/requires-common.f90 +++ /dev/null @@ -1,19 +0,0 @@ -! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s -! RUN: bbc -fopenmp -emit-fir %s -o - | FileCheck %s -! RUN: bbc -fopenmp -fopenmp-is-target-device -emit-fir %s -o - | FileCheck %s - -! This test checks the lowering of requires into MLIR - -!CHECK: module attributes { -!CHECK-SAME: omp.requires = #omp -block data init - !$omp requires unified_shared_memory - integer :: x - common /block/ x - data x / 10 / -end - -subroutine f - !$omp declare target -end subroutine f diff --git a/flang/test/Lower/OpenMP/FIR/requires-notarget.f90 b/flang/test/Lower/OpenMP/FIR/requires-notarget.f90 deleted file mode 100644 index bfa5092084288..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/requires-notarget.f90 +++ /dev/null @@ -1,14 +0,0 @@ -! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s -! RUN: bbc -fopenmp -emit-fir %s -o - | FileCheck %s -! RUN: bbc -fopenmp -fopenmp-is-target-device -emit-fir %s -o - | FileCheck %s - -! This test checks that requires lowering into MLIR skips creating the -! omp.requires attribute with target-related clauses if there are no device -! functions in the compilation unit - -!CHECK: module attributes { -!CHECK-NOT: omp.requires -program requires - !$omp requires unified_shared_memory reverse_offload atomic_default_mem_order(seq_cst) -end program requires diff --git a/flang/test/Lower/OpenMP/FIR/requires.f90 b/flang/test/Lower/OpenMP/FIR/requires.f90 deleted file mode 100644 index bc53931b9f240..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/requires.f90 +++ /dev/null @@ -1,14 +0,0 @@ -! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s -! RUN: bbc -fopenmp -emit-fir %s -o - | FileCheck %s -! RUN: bbc -fopenmp -fopenmp-is-target-device -emit-fir %s -o - | FileCheck %s - -! This test checks the lowering of requires into MLIR - -!CHECK: module attributes { -!CHECK-SAME: omp.requires = #omp -program requires - !$omp requires unified_shared_memory reverse_offload atomic_default_mem_order(seq_cst) - !$omp target - !$omp end target -end program requires diff --git a/flang/test/Lower/OpenMP/FIR/rtl-flags.f90 b/flang/test/Lower/OpenMP/FIR/rtl-flags.f90 deleted file mode 100644 index ad8eb9e732137..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/rtl-flags.f90 +++ /dev/null @@ -1,39 +0,0 @@ -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=DEFAULT-DEVICE-FIR -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-version=45 %s -o - | FileCheck %s --check-prefix=DEFAULT-HOST-FIR -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-is-target-device -fopenmp-version=45 %s -o - | FileCheck %s --check-prefix=DEFAULT-DEVICE-FIR-VERSION -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-version=45 %s -o - | FileCheck %s --check-prefix=DEFAULT-HOST-FIR-VERSION -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-target-debug -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=DBG-DEVICE-FIR -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-target-debug=111 -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=DBG-EQ-DEVICE-FIR -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-assume-teams-oversubscription -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=TEAMS-OSUB-DEVICE-FIR -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-assume-threads-oversubscription -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=THREAD-OSUB-DEVICE-FIR -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-assume-no-thread-state -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=THREAD-STATE-DEVICE-FIR -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-assume-no-nested-parallelism -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=NEST-PAR-DEVICE-FIR -!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-target-debug -fopenmp-assume-teams-oversubscription -fopenmp-assume-no-nested-parallelism -fopenmp-assume-threads-oversubscription -fopenmp-assume-no-thread-state -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=ALL-DEVICE-FIR -!RUN: bbc -emit-fir -fopenmp -fopenmp-is-target-device -o - %s | FileCheck %s --check-prefix=DEFAULT-DEVICE-FIR -!RUN: bbc -emit-fir -fopenmp -fopenmp-is-target-device -fopenmp-version=45 -o - %s | FileCheck %s --check-prefix=DEFAULT-DEVICE-FIR-VERSION -!RUN: bbc -emit-fir -fopenmp -o - %s | FileCheck %s --check-prefix=DEFAULT-HOST-FIR -!RUN: bbc -emit-fir -fopenmp -fopenmp-version=45 -o - %s | FileCheck %s --check-prefix=DEFAULT-HOST-FIR-VERSION -!RUN: bbc -emit-fir -fopenmp -fopenmp-target-debug=111 -fopenmp-is-target-device -o - %s | FileCheck %s --check-prefix=DBG-EQ-DEVICE-FIR -!RUN: bbc -emit-fir -fopenmp -fopenmp-assume-teams-oversubscription -fopenmp-is-target-device -o - %s | FileCheck %s --check-prefix=TEAMS-OSUB-DEVICE-FIR -!RUN: bbc -emit-fir -fopenmp -fopenmp-assume-threads-oversubscription -fopenmp-is-target-device -o - %s | FileCheck %s --check-prefix=THREAD-OSUB-DEVICE-FIR -!RUN: bbc -emit-fir -fopenmp -fopenmp-assume-no-thread-state -fopenmp-is-target-device -o - %s | FileCheck %s --check-prefix=THREAD-STATE-DEVICE-FIR -!RUN: bbc -emit-fir -fopenmp -fopenmp-assume-no-nested-parallelism -fopenmp-is-target-device -o - %s | FileCheck %s --check-prefix=NEST-PAR-DEVICE-FIR -!RUN: bbc -emit-fir -fopenmp -fopenmp-target-debug=1 -fopenmp-assume-teams-oversubscription -fopenmp-assume-no-nested-parallelism -fopenmp-assume-threads-oversubscription -fopenmp-assume-no-thread-state -fopenmp-is-target-device -o - %s | FileCheck %s --check-prefix=ALL-DEVICE-FIR - -!DEFAULT-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags -!DEFAULT-DEVICE-FIR-SAME: omp.is_target_device = true -!DEFAULT-DEVICE-FIR-VERSION: module attributes {{{.*}}omp.flags = #omp.flags -!DEFAULT-DEVICE-FIR-VERSION-SAME: omp.is_target_device = true -!DEFAULT-DEVICE-FIR-VERSION-SAME: omp.version = #omp.version -!DEFAULT-HOST-FIR: module attributes {{{.*}}omp.is_target_device = false{{.*}} -!DEFAULT-HOST-FIR-VERSION: module attributes {{{.*}}omp.is_target_device = false -!DEFAULT-HOST-FIR-VERSION-SAME: omp.version = #omp.version -!DBG-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags -!DBG-EQ-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags -!TEAMS-OSUB-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags -!THREAD-OSUB-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags -!THREAD-STATE-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags -!NEST-PAR-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags -!ALL-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags -subroutine omp_subroutine() -end subroutine omp_subroutine diff --git a/flang/test/Lower/OpenMP/FIR/sections-pft.f90 b/flang/test/Lower/OpenMP/FIR/sections-pft.f90 deleted file mode 100644 index 7b20a87022c90..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/sections-pft.f90 +++ /dev/null @@ -1,91 +0,0 @@ -! RUN: %flang_fc1 -fdebug-pre-fir-tree -fopenmp %s | FileCheck %s - -subroutine openmp_sections(x, y) - - integer, intent(inout)::x, y - -!============================================================================== -! empty construct -!============================================================================== -!$omp sections -!$omp end sections - -!CHECK: OpenMPConstruct -!CHECK: End OpenMPConstruct - -!============================================================================== -! single section, without `!$omp section` -!============================================================================== -!$omp sections - call F1() -!$omp end sections - -!CHECK: OpenMPConstruct -!CHECK: OpenMPConstruct -!CHECK: CallStmt -!CHECK: End OpenMPConstruct -!CHECK: End OpenMPConstruct - -!============================================================================== -! single section with `!$omp section` -!============================================================================== -!$omp sections - !$omp section - call F1 -!$omp end sections - -!CHECK: OpenMPConstruct -!CHECK: OpenMPConstruct -!CHECK: CallStmt -!CHECK: End OpenMPConstruct -!CHECK: End OpenMPConstruct - -!============================================================================== -! multiple sections -!============================================================================== -!$omp sections - !$omp section - call F1 - !$omp section - call F2 - !$omp section - call F3 -!$omp end sections - -!CHECK: OpenMPConstruct -!CHECK: OpenMPConstruct -!CHECK: CallStmt -!CHECK: End OpenMPConstruct -!CHECK: OpenMPConstruct -!CHECK: CallStmt -!CHECK: End OpenMPConstruct -!CHECK: OpenMPConstruct -!CHECK: CallStmt -!CHECK: End OpenMPConstruct -!CHECK: End OpenMPConstruct - -!============================================================================== -! multiple sections with clauses -!============================================================================== -!$omp sections PRIVATE(x) FIRSTPRIVATE(y) - !$omp section - call F1 - !$omp section - call F2 - !$omp section - call F3 -!$omp end sections NOWAIT - -!CHECK: OpenMPConstruct -!CHECK: OpenMPConstruct -!CHECK: CallStmt -!CHECK: End OpenMPConstruct -!CHECK: OpenMPConstruct -!CHECK: CallStmt -!CHECK: End OpenMPConstruct -!CHECK: OpenMPConstruct -!CHECK: CallStmt -!CHECK: End OpenMPConstruct -!CHECK: End OpenMPConstruct - -end subroutine openmp_sections diff --git a/flang/test/Lower/OpenMP/FIR/sections.f90 b/flang/test/Lower/OpenMP/FIR/sections.f90 deleted file mode 100644 index 7b313f3dc0b41..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/sections.f90 +++ /dev/null @@ -1,288 +0,0 @@ -! REQUIRES: openmp_runtime - -! This test checks the lowering of OpenMP sections construct with several clauses present - -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -!CHECK: func @_QQmain() attributes {fir.bindc_name = "sample"} { -!CHECK: %[[COUNT:.*]] = fir.address_of(@_QFEcount) : !fir.ref -!CHECK: %[[ETA:.*]] = fir.alloca f32 {bindc_name = "eta", uniq_name = "_QFEeta"} -!CHECK: %[[CONST_1:.*]] = arith.constant 4 : i64 -!CHECK: omp.sections allocate(%[[CONST_1]] : i64 -> %0 : !fir.ref) { -!CHECK: omp.section { -!CHECK: %[[PRIVATE_ETA:.*]] = fir.alloca f32 {bindc_name = "eta", pinned, uniq_name = "_QFEeta"} -!CHECK: %[[PRIVATE_DOUBLE_COUNT:.*]] = fir.alloca i32 {bindc_name = "double_count", pinned, uniq_name = "_QFEdouble_count"} -!CHECK: %[[const:.*]] = arith.constant 5 : i32 -!CHECK: fir.store %[[const]] to %[[COUNT]] : !fir.ref -!CHECK: %[[temp_count:.*]] = fir.load %[[COUNT]] : !fir.ref -!CHECK: %[[temp_double_count:.*]] = fir.load %[[PRIVATE_DOUBLE_COUNT]] : !fir.ref -!CHECK: %[[result:.*]] = arith.muli %[[temp_count]], %[[temp_double_count]] : i32 -!CHECK: {{.*}} = fir.convert %[[result]] : (i32) -> f32 -!CHECK: fir.store {{.*}} to %[[PRIVATE_ETA]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.section { -!CHECK: %[[PRIVATE_ETA:.*]] = fir.alloca f32 {bindc_name = "eta", pinned, uniq_name = "_QFEeta"} -!CHECK: %[[PRIVATE_DOUBLE_COUNT:.*]] = fir.alloca i32 {bindc_name = "double_count", pinned, uniq_name = "_QFEdouble_count"} -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_DOUBLE_COUNT]] : !fir.ref -!CHECK: %[[const:.*]] = arith.constant 1 : i32 -!CHECK: %[[result:.*]] = arith.addi %[[temp]], %[[const]] : i32 -!CHECK: fir.store %[[result]] to %[[PRIVATE_DOUBLE_COUNT]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.section { -!CHECK: %[[PRIVATE_ETA:.*]] = fir.alloca f32 {bindc_name = "eta", pinned, uniq_name = "_QFEeta"} -!CHECK: %[[PRIVATE_DOUBLE_COUNT:.*]] = fir.alloca i32 {bindc_name = "double_count", pinned, uniq_name = "_QFEdouble_count"} -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_ETA]] : !fir.ref -!CHECK: %[[const:.*]] = arith.constant 7.000000e+00 : f32 -!CHECK: %[[result:.*]] = arith.subf %[[temp]], %[[const]] {{.*}}: f32 -!CHECK: fir.store %[[result]] to %[[PRIVATE_ETA]] : !fir.ref -!CHECK: {{.*}} = fir.load %[[COUNT]] : !fir.ref -!CHECK: %[[temp_count:.*]] = fir.convert {{.*}} : (i32) -> f32 -!CHECK: %[[temp_eta:.*]] = fir.load %[[PRIVATE_ETA]] : !fir.ref -!CHECK: {{.*}} = arith.mulf %[[temp_count]], %[[temp_eta]] {{.*}}: f32 -!CHECK: %[[result:.*]] = fir.convert {{.*}} : (f32) -> i32 -!CHECK: fir.store %[[result]] to %[[COUNT]] : !fir.ref -!CHECK: {{.*}} = fir.load %[[COUNT]] : !fir.ref -!CHECK: %[[temp_count:.*]] = fir.convert {{.*}} : (i32) -> f32 -!CHECK: %[[temp_eta:.*]] = fir.load %[[PRIVATE_ETA]] : !fir.ref -!CHECK: {{.*}} = arith.subf %[[temp_count]], %[[temp_eta]] {{.*}}: f32 -!CHECK: %[[result:.*]] = fir.convert {{.*}} : (f32) -> i32 -!CHECK: fir.store %[[result]] to %[[PRIVATE_DOUBLE_COUNT]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.sections nowait { -!CHECK: omp.terminator -!CHECK: } -!CHECK: return -!CHECK: } - -program sample - use omp_lib - integer :: count = 0, double_count = 1 - !$omp sections private (eta, double_count) allocate(omp_high_bw_mem_alloc: count) - !$omp section - count = 1 + 4 - eta = count * double_count - !$omp section - double_count = double_count + 1 - !$omp section - eta = eta - 7 - count = count * eta - double_count = count - eta - !$omp end sections - - !$omp sections - !$omp end sections nowait -end program sample - -!CHECK: func @_QPfirstprivate(%[[ARG:.*]]: !fir.ref {fir.bindc_name = "alpha"}) { -!CHECK: omp.sections { -!CHECK: omp.section { -!CHECK: %[[PRIVATE_ALPHA:.*]] = fir.alloca f32 {bindc_name = "alpha", pinned, uniq_name = "_QFfirstprivateEalpha"} -!CHECK: %[[temp:.*]] = fir.load %[[ARG]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_ALPHA]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.sections { -!CHECK: omp.section { -!CHECK: %[[PRIVATE_VAR:.*]] = fir.load %[[ARG]] : !fir.ref -!CHECK: %[[CONSTANT:.*]] = arith.constant 5.000000e+00 : f32 -!CHECK: %[[PRIVATE_VAR_2:.*]] = arith.mulf %[[PRIVATE_VAR]], %[[CONSTANT]] {{.*}}: f32 -!CHECK: fir.store %[[PRIVATE_VAR_2]] to %[[ARG]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.terminator -!CHECK: } -!CHECK: return -!CHECK: } - -subroutine firstprivate(alpha) - real :: alpha - !$omp sections firstprivate(alpha) - !$omp end sections - - !$omp sections - alpha = alpha * 5 - !$omp end sections -end subroutine - -subroutine lastprivate() - integer :: x -!CHECK: %[[X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFlastprivateEx"} -!CHECK: omp.sections { - !$omp sections lastprivate(x) -!CHECK: omp.section { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFlastprivateEx"} -!CHECK: %[[const:.*]] = arith.constant 10 : i32 -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[result:.*]] = arith.muli %c10_i32, %[[temp]] : i32 -!CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } - !$omp section - x = x * 10 -!CHECK: omp.section { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFlastprivateEx"} -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[const:.*]] = arith.constant 1 : i32 -!CHECK: %[[result:.*]] = arith.addi %[[temp]], %[[const]] : i32 -!CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[true:.*]] = arith.constant true -!CHECK: fir.if %[[true]] { -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[X]] : !fir.ref -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - !$omp section - x = x + 1 -!CHECK: omp.terminator -!CHECK: } - !$omp end sections - -!CHECK: omp.sections { - !$omp sections firstprivate(x) lastprivate(x) -!CHECK: omp.section { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFlastprivateEx"} -!CHECK: %[[temp:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: omp.barrier -!CHECK: %[[const:.*]] = arith.constant 10 : i32 -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[result:.*]] = arith.muli %c10_i32, %[[temp]] : i32 -!CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } - !$omp section - x = x * 10 -!CHECK: omp.section { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFlastprivateEx"} -!CHECK: %[[temp:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: omp.barrier -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[const:.*]] = arith.constant 1 : i32 -!CHECK: %[[result:.*]] = arith.addi %[[temp]], %[[const]] : i32 -!CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[true:.*]] = arith.constant true -!CHECK: fir.if %true { -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[X]] : !fir.ref -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - !$omp section - x = x + 1 -!CHECK: omp.terminator -!CHECK: } - !$omp end sections - -!CHECK: omp.sections nowait { - !$omp sections firstprivate(x) lastprivate(x) -!CHECK: omp.section { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFlastprivateEx"} -!CHECK: %[[temp:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: omp.barrier -!CHECK: %[[const:.*]] = arith.constant 10 : i32 -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[result:.*]] = arith.muli %c10_i32, %[[temp]] : i32 -!CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } - !$omp section - x = x * 10 -!CHECK: omp.section { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFlastprivateEx"} -!CHECK: %[[temp:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: omp.barrier -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[const:.*]] = arith.constant 1 : i32 -!CHECK: %[[result:.*]] = arith.addi %[[temp]], %[[const]] : i32 -!CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[true:.*]] = arith.constant true -!CHECK: fir.if %true { -!CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[X]] : !fir.ref -!CHECK: omp.barrier -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - !$omp section - x = x + 1 -!CHECK: omp.terminator -!CHECK: } - !$omp end sections nowait - -!CHECK: omp.sections { -!CHECK: omp.section { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFlastprivateEx"} -!CHECK: cf.br ^bb1 -!CHECK: ^bb1: // pred: ^bb0 -!CHECK: %[[INNER_PRIVATE_X:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[const:.*]] = arith.constant 1 : i32 -!CHECK: %[[result:.*]] = arith.addi %[[INNER_PRIVATE_X]], %[[const]] : i32 -!CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[loaded_value:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: fir.store %[[loaded_value]] to %[[X]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.terminator -!CHECK: } -!CHECK: return -!CHECK: } - - !$omp sections lastprivate(x) - !$omp section - goto 30 - 30 x = x + 1 - !$omp end sections -end subroutine - -subroutine unstructured_sections_privatization() -!CHECK: %[[X:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFunstructured_sections_privatizationEx"} -!CHECK: omp.sections { -!CHECK: omp.section { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca f32 {bindc_name = "x", pinned, uniq_name = "_QFunstructured_sections_privatizationEx"} -!CHECK: cf.br ^bb1 -!CHECK: ^bb1: // pred: ^bb0 -!CHECK: %[[INNER_PRIVATE_X:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[constant:.*]] = arith.constant 1.000000e+00 : f32 -!CHECK: %[[result:.*]] = arith.addf %[[INNER_PRIVATE_X]], %[[constant]] fastmath : f32 -!CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - !$omp sections private(x) - !$omp section - goto 40 - 40 x = x + 1 - !$omp end sections -!CHECK: omp.sections { -!CHECK: omp.section { -!CHECK: %[[PRIVATE_X:.*]] = fir.alloca f32 {bindc_name = "x", pinned, uniq_name = "_QFunstructured_sections_privatizationEx"} -!CHECK: %[[temp:.*]] = fir.load %[[X]] : !fir.ref -!CHECK: fir.store %[[temp]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: cf.br ^bb1 -!CHECK: ^bb1: // pred: ^bb0 -!CHECK: %[[INNER_PRIVATE_X:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref -!CHECK: %[[constant:.*]] = arith.constant 1.000000e+00 : f32 -!CHECK: %[[result:.*]] = arith.addf %[[INNER_PRIVATE_X]], %[[constant]] fastmath : f32 -!CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - !$omp sections firstprivate(x) - !$omp section - goto 50 - 50 x = x + 1 - !$omp end sections -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/simd.f90 b/flang/test/Lower/OpenMP/FIR/simd.f90 deleted file mode 100644 index 91e8750578bfb..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/simd.f90 +++ /dev/null @@ -1,176 +0,0 @@ -! Tests for 2.9.3.1 Simd - -! The "if" clause was added to the "simd" directive in OpenMP 5.0. -! RUN: bbc -fopenmp -fopenmp-version=50 -emit-fir -hlfir=false %s -o - | FileCheck %s - -!CHECK-LABEL: func @_QPsimd() -subroutine simd - integer :: i - !$OMP SIMD - ! CHECK: %[[LB:.*]] = arith.constant 1 : i32 - ! CHECK-NEXT: %[[UB:.*]] = arith.constant 9 : i32 - ! CHECK-NEXT: %[[STEP:.*]] = arith.constant 1 : i32 - ! CHECK-NEXT: omp.simd { - ! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[LB]]) to (%[[UB]]) inclusive step (%[[STEP]]) { - do i=1, 9 - ! CHECK: fir.store %[[I]] to %[[LOCAL:.*]] : !fir.ref - ! CHECK: %[[LD:.*]] = fir.load %[[LOCAL]] : !fir.ref - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LD]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - !$OMP END SIMD -end subroutine - -!CHECK-LABEL: func @_QPsimd_with_if_clause -subroutine simd_with_if_clause(n, threshold) - integer :: i, n, threshold - !$OMP SIMD IF( n .GE. threshold ) - ! CHECK: %[[LB:.*]] = arith.constant 1 : i32 - ! CHECK: %[[UB:.*]] = fir.load %arg0 - ! CHECK: %[[STEP:.*]] = arith.constant 1 : i32 - ! CHECK: %[[COND:.*]] = arith.cmpi sge - ! CHECK: omp.simd if(%[[COND:.*]]) { - ! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[LB]]) to (%[[UB]]) inclusive step (%[[STEP]]) { - do i = 1, n - ! CHECK: fir.store %[[I]] to %[[LOCAL:.*]] : !fir.ref - ! CHECK: %[[LD:.*]] = fir.load %[[LOCAL]] : !fir.ref - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LD]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - !$OMP END SIMD -end subroutine - -!CHECK-LABEL: func @_QPsimd_with_simdlen_clause -subroutine simd_with_simdlen_clause(n, threshold) - integer :: i, n, threshold - !$OMP SIMD SIMDLEN(2) - ! CHECK: %[[LB:.*]] = arith.constant 1 : i32 - ! CHECK: %[[UB:.*]] = fir.load %arg0 - ! CHECK: %[[STEP:.*]] = arith.constant 1 : i32 - ! CHECK: omp.simd simdlen(2) { - ! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[LB]]) to (%[[UB]]) inclusive step (%[[STEP]]) { - do i = 1, n - ! CHECK: fir.store %[[I]] to %[[LOCAL:.*]] : !fir.ref - ! CHECK: %[[LD:.*]] = fir.load %[[LOCAL]] : !fir.ref - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LD]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - !$OMP END SIMD -end subroutine - -!CHECK-LABEL: func @_QPsimd_with_simdlen_clause_from_param -subroutine simd_with_simdlen_clause_from_param(n, threshold) - integer :: i, n, threshold - integer, parameter :: simdlen = 2; - !$OMP SIMD SIMDLEN(simdlen) - ! CHECK: %[[LB:.*]] = arith.constant 1 : i32 - ! CHECK: %[[UB:.*]] = fir.load %arg0 - ! CHECK: %[[STEP:.*]] = arith.constant 1 : i32 - ! CHECK: omp.simd simdlen(2) { - ! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[LB]]) to (%[[UB]]) inclusive step (%[[STEP]]) { - do i = 1, n - ! CHECK: fir.store %[[I]] to %[[LOCAL:.*]] : !fir.ref - ! CHECK: %[[LD:.*]] = fir.load %[[LOCAL]] : !fir.ref - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LD]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - !$OMP END SIMD -end subroutine - -!CHECK-LABEL: func @_QPsimd_with_simdlen_clause_from_expr_from_param -subroutine simd_with_simdlen_clause_from_expr_from_param(n, threshold) - integer :: i, n, threshold - integer, parameter :: simdlen = 2; - !$OMP SIMD SIMDLEN(simdlen*2 + 2) - ! CHECK: %[[LB:.*]] = arith.constant 1 : i32 - ! CHECK: %[[UB:.*]] = fir.load %arg0 - ! CHECK: %[[STEP:.*]] = arith.constant 1 : i32 - ! CHECK: omp.simd simdlen(6) { - ! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[LB]]) to (%[[UB]]) inclusive step (%[[STEP]]) { - do i = 1, n - ! CHECK: fir.store %[[I]] to %[[LOCAL:.*]] : !fir.ref - ! CHECK: %[[LD:.*]] = fir.load %[[LOCAL]] : !fir.ref - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LD]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - !$OMP END SIMD -end subroutine - -!CHECK-LABEL: func @_QPsimd_with_safelen_clause -subroutine simd_with_safelen_clause(n, threshold) - integer :: i, n, threshold - !$OMP SIMD SAFELEN(2) - ! CHECK: %[[LB:.*]] = arith.constant 1 : i32 - ! CHECK: %[[UB:.*]] = fir.load %arg0 - ! CHECK: %[[STEP:.*]] = arith.constant 1 : i32 - ! CHECK: omp.simd safelen(2) { - ! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[LB]]) to (%[[UB]]) inclusive step (%[[STEP]]) { - do i = 1, n - ! CHECK: fir.store %[[I]] to %[[LOCAL:.*]] : !fir.ref - ! CHECK: %[[LD:.*]] = fir.load %[[LOCAL]] : !fir.ref - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LD]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - !$OMP END SIMD -end subroutine - -!CHECK-LABEL: func @_QPsimd_with_safelen_clause_from_expr_from_param -subroutine simd_with_safelen_clause_from_expr_from_param(n, threshold) - integer :: i, n, threshold - integer, parameter :: safelen = 2; - !$OMP SIMD SAFELEN(safelen*2 + 2) - ! CHECK: %[[LB:.*]] = arith.constant 1 : i32 - ! CHECK: %[[UB:.*]] = fir.load %arg0 - ! CHECK: %[[STEP:.*]] = arith.constant 1 : i32 - ! CHECK: omp.simd safelen(6) { - ! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[LB]]) to (%[[UB]]) inclusive step (%[[STEP]]) { - do i = 1, n - ! CHECK: fir.store %[[I]] to %[[LOCAL:.*]] : !fir.ref - ! CHECK: %[[LD:.*]] = fir.load %[[LOCAL]] : !fir.ref - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LD]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - !$OMP END SIMD -end subroutine - -!CHECK-LABEL: func @_QPsimd_with_simdlen_safelen_clause -subroutine simd_with_simdlen_safelen_clause(n, threshold) - integer :: i, n, threshold - !$OMP SIMD SIMDLEN(1) SAFELEN(2) - ! CHECK: %[[LB:.*]] = arith.constant 1 : i32 - ! CHECK: %[[UB:.*]] = fir.load %arg0 - ! CHECK: %[[STEP:.*]] = arith.constant 1 : i32 - ! CHECK: omp.simd simdlen(1) safelen(2) { - ! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[LB]]) to (%[[UB]]) inclusive step (%[[STEP]]) { - do i = 1, n - ! CHECK: fir.store %[[I]] to %[[LOCAL:.*]] : !fir.ref - ! CHECK: %[[LD:.*]] = fir.load %[[LOCAL]] : !fir.ref - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LD]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - !$OMP END SIMD -end subroutine - -!CHECK-LABEL: func @_QPsimd_with_collapse_clause -subroutine simd_with_collapse_clause(n) - integer :: i, j, n - integer :: A(n,n) - ! CHECK: %[[LOWER_I:.*]] = arith.constant 1 : i32 - ! CHECK: %[[UPPER_I:.*]] = fir.load %[[PARAM_ARG:.*]] : !fir.ref - ! CHECK: %[[STEP_I:.*]] = arith.constant 1 : i32 - ! CHECK: %[[LOWER_J:.*]] = arith.constant 1 : i32 - ! CHECK: %[[UPPER_J:.*]] = fir.load %[[PARAM_ARG:.*]] : !fir.ref - ! CHECK: %[[STEP_J:.*]] = arith.constant 1 : i32 - ! CHECK: omp.simd { - ! CHECK-NEXT: omp.loop_nest (%[[ARG_0:.*]], %[[ARG_1:.*]]) : i32 = ( - ! CHECK-SAME: %[[LOWER_I]], %[[LOWER_J]]) to ( - ! CHECK-SAME: %[[UPPER_I]], %[[UPPER_J]]) inclusive step ( - ! CHECK-SAME: %[[STEP_I]], %[[STEP_J]]) { - !$OMP SIMD COLLAPSE(2) - do i = 1, n - do j = 1, n - A(i,j) = i + j - end do - end do - !$OMP END SIMD -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/simple-barrier.f90 b/flang/test/Lower/OpenMP/FIR/simple-barrier.f90 deleted file mode 100644 index c621b8062eaaa..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/simple-barrier.f90 +++ /dev/null @@ -1,6 +0,0 @@ -! RUN: bbc -fopenmp -emit-fir -o - %s | FileCheck %s - -subroutine sample() -! CHECK: omp.barrier -!$omp barrier -end subroutine sample diff --git a/flang/test/Lower/OpenMP/FIR/single.f90 b/flang/test/Lower/OpenMP/FIR/single.f90 deleted file mode 100644 index 65ae07c2c2843..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/single.f90 +++ /dev/null @@ -1,123 +0,0 @@ -! REQUIRES: openmp_runtime - -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s -!RUN: bbc -emit-fir -hlfir=false -fopenmp %s -o - | FileCheck %s - -!=============================================================================== -! Single construct -!=============================================================================== - -!CHECK-LABEL: func @_QPomp_single -!CHECK-SAME: (%[[x:.*]]: !fir.ref {fir.bindc_name = "x"}) -subroutine omp_single(x) - integer, intent(inout) :: x - !CHECK: omp.parallel - !$omp parallel - !CHECK: omp.single - !$omp single - !CHECK: %[[xval:.*]] = fir.load %[[x]] : !fir.ref - !CHECK: %[[res:.*]] = arith.addi %[[xval]], %{{.*}} : i32 - !CHECK: fir.store %[[res]] to %[[x]] : !fir.ref - x = x + 12 - !CHECK: omp.terminator - !$omp end single - !CHECK: omp.terminator - !$omp end parallel -end subroutine omp_single - -!=============================================================================== -! Single construct with nowait -!=============================================================================== - -!CHECK-LABEL: func @_QPomp_single_nowait -!CHECK-SAME: (%[[x:.*]]: !fir.ref {fir.bindc_name = "x"}) -subroutine omp_single_nowait(x) - integer, intent(inout) :: x - !CHECK: omp.parallel - !$omp parallel - !CHECK: omp.single nowait - !$omp single - !CHECK: %[[xval:.*]] = fir.load %[[x]] : !fir.ref - !CHECK: %[[res:.*]] = arith.addi %[[xval]], %{{.*}} : i32 - !CHECK: fir.store %[[res]] to %[[x]] : !fir.ref - x = x + 12 - !CHECK: omp.terminator - !$omp end single nowait - !CHECK: omp.terminator - !$omp end parallel -end subroutine omp_single_nowait - -!=============================================================================== -! Single construct with allocate -!=============================================================================== - -!CHECK-LABEL: func @_QPsingle_allocate -subroutine single_allocate() - use omp_lib - integer :: x - !CHECK: omp.parallel { - !$omp parallel - !CHECK: omp.single allocate(%{{.+}} : i64 -> %{{.+}} : !fir.ref) { - !$omp single allocate(omp_high_bw_mem_alloc: x) private(x) - !CHECK: arith.addi - x = x + 12 - !CHECK: omp.terminator - !$omp end single - !CHECK: omp.terminator - !$omp end parallel -end subroutine single_allocate - -!=============================================================================== -! Single construct with private/firstprivate -!=============================================================================== - -! CHECK-LABEL: func.func @_QPsingle_privatization( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref {fir.bindc_name = "x"}, -! CHECK-SAME: %[[VAL_1:.*]]: !fir.ref {fir.bindc_name = "y"}) { -! CHECK: omp.single { -! CHECK: %[[VAL_2:.*]] = fir.alloca f32 {bindc_name = "x", pinned, uniq_name = "_QFsingle_privatizationEx"} -! CHECK: %[[VAL_3:.*]] = fir.alloca f64 {bindc_name = "y", pinned, uniq_name = "_QFsingle_privatizationEy"} -! CHECK: %[[VAL_4:.*]] = fir.load %[[VAL_1]] : !fir.ref -! CHECK: fir.store %[[VAL_4]] to %[[VAL_3]] : !fir.ref -! CHECK: fir.call @_QPbar(%[[VAL_2]], %[[VAL_3]]) {{.*}}: (!fir.ref, !fir.ref) -> () -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine single_privatization(x, y) - real :: x - real(8) :: y - - !$omp single private(x) firstprivate(y) - call bar(x, y) - !$omp end single -end subroutine - -! CHECK-LABEL: func.func @_QPsingle_privatization2( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref {fir.bindc_name = "x"}, -! CHECK-SAME: %[[VAL_1:.*]]: !fir.ref {fir.bindc_name = "y"}) { -! CHECK: omp.parallel { -! CHECK: omp.single { -! CHECK: %[[VAL_2:.*]] = fir.alloca f32 {bindc_name = "x", pinned, uniq_name = "_QFsingle_privatization2Ex"} -! CHECK: %[[VAL_3:.*]] = fir.alloca f64 {bindc_name = "y", pinned, uniq_name = "_QFsingle_privatization2Ey"} -! CHECK: %[[VAL_4:.*]] = fir.load %[[VAL_1]] : !fir.ref -! CHECK: fir.store %[[VAL_4]] to %[[VAL_3]] : !fir.ref -! CHECK: fir.call @_QPbar(%[[VAL_2]], %[[VAL_3]]) {{.*}}: (!fir.ref, !fir.ref) -> () -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine single_privatization2(x, y) - real :: x - real(8) :: y - - !$omp parallel - !$omp single private(x) firstprivate(y) - call bar(x, y) - !$omp end single - !$omp end parallel -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/stop-stmt-in-region.f90 b/flang/test/Lower/OpenMP/FIR/stop-stmt-in-region.f90 deleted file mode 100644 index 32cc6d17c420b..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/stop-stmt-in-region.f90 +++ /dev/null @@ -1,154 +0,0 @@ -! This test checks lowering of stop statement in OpenMP region. - -! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -! CHECK-LABEL: func.func @_QPtest_stop_in_region1() { -! CHECK: omp.parallel { -! CHECK: %[[VAL_0:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_1:.*]] = arith.constant false -! CHECK: %[[VAL_2:.*]] = arith.constant false -! CHECK: %[[VAL_3:.*]] = fir.call @_FortranAStopStatement(%[[VAL_0]], %[[VAL_1]], %[[VAL_2]]) {{.*}} : (i32, i1, i1) -> none -! CHECK-NOT: fir.unreachable -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine test_stop_in_region1() - !$omp parallel - stop 1 - !$omp end parallel -end - -! CHECK-LABEL: func.func @_QPtest_stop_in_region2() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFtest_stop_in_region2Ex"} -! CHECK: omp.parallel { -! CHECK: %[[VAL_1:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_2:.*]] = arith.constant false -! CHECK: %[[VAL_3:.*]] = arith.constant false -! CHECK: %[[VAL_4:.*]] = fir.call @_FortranAStopStatement(%[[VAL_1]], %[[VAL_2]], %[[VAL_3]]) {{.*}} : (i32, i1, i1) -> none -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine test_stop_in_region2() - integer :: x - !$omp parallel - stop 1 - x = 2 - !$omp end parallel -end - -! CHECK-LABEL: func.func @_QPtest_stop_in_region3() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFtest_stop_in_region3Ex"} -! CHECK: omp.parallel { -! CHECK: %[[VAL_1:.*]] = arith.constant 3 : i32 -! CHECK: fir.store %[[VAL_1]] to %[[VAL_0]] : !fir.ref -! CHECK: %[[VAL_2:.*]] = fir.load %[[VAL_0]] : !fir.ref -! CHECK: %[[VAL_3:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_4:.*]] = arith.cmpi sgt, %[[VAL_2]], %[[VAL_3]] : i32 -! CHECK: cf.cond_br %[[VAL_4]], ^bb1, ^bb2 -! CHECK: ^bb1: -! CHECK: %[[VAL_5:.*]] = fir.load %[[VAL_0]] : !fir.ref -! CHECK: %[[VAL_6:.*]] = arith.constant false -! CHECK: %[[VAL_7:.*]] = arith.constant false -! CHECK: %[[VAL_8:.*]] = fir.call @_FortranAStopStatement(%[[VAL_5]], %[[VAL_6]], %[[VAL_7]]) {{.*}} : (i32, i1, i1) -> none -! CHECK: omp.terminator -! CHECK: ^bb2: -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine test_stop_in_region3() - integer :: x - !$omp parallel - x = 3 - if (x > 1) stop x - !$omp end parallel -end - -! CHECK-LABEL: func.func @_QPtest_stop_in_region4() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFtest_stop_in_region4Ei"} -! CHECK: %[[VAL_2:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFtest_stop_in_region4Ex"} -! CHECK: %[[VAL_3:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_4:.*]] = arith.constant 10 : i32 -! CHECK: %[[VAL_5:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop { -! CHECK-NEXT: omp.loop_nest (%[[VAL_6:.*]]) : i32 = (%[[VAL_3]]) to (%[[VAL_4]]) inclusive step (%[[VAL_5]]) { -! CHECK: fir.store %[[VAL_6]] to %[[VAL_0]] : !fir.ref -! CHECK: cf.br ^bb1 -! CHECK: ^bb1: -! CHECK: %[[VAL_7:.*]] = arith.constant 3 : i32 -! CHECK: fir.store %[[VAL_7]] to %[[VAL_2]] : !fir.ref -! CHECK: %[[VAL_8:.*]] = fir.load %[[VAL_2]] : !fir.ref -! CHECK: %[[VAL_9:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_10:.*]] = arith.cmpi sgt, %[[VAL_8]], %[[VAL_9]] : i32 -! CHECK: cf.cond_br %[[VAL_10]], ^bb2, ^bb3 -! CHECK: ^bb2: -! CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_2]] : !fir.ref -! CHECK: %[[VAL_12:.*]] = arith.constant false -! CHECK: %[[VAL_13:.*]] = arith.constant false -! CHECK: %[[VAL_14:.*]] = fir.call @_FortranAStopStatement(%[[VAL_11]], %[[VAL_12]], %[[VAL_13]]) {{.*}} : (i32, i1, i1) -> none -! CHECK: omp.yield -! CHECK: ^bb3: -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: cf.br ^bb1 -! CHECK: ^bb1: -! CHECK: return -! CHECK: } - -subroutine test_stop_in_region4() - integer :: x - !$omp do - do i = 1, 10 - x = 3 - if (x > 1) stop x - enddo - !$omp end do -end - - -!CHECK-LABEL: func.func @_QPtest_stop_in_region5 -!CHECK: omp.parallel { -!CHECK: {{.*}} fir.call @_FortranAStopStatement({{.*}}, {{.*}}, {{.*}}) fastmath : (i32, i1, i1) -> none -!CHECK: omp.terminator -!CHECK: } -!CHECK: return - -subroutine test_stop_in_region5() - !$omp parallel - block - stop 1 - end block - !$omp end parallel -end - -!CHECK-LABEL: func.func @_QPtest_stop_in_region6 -!CHECK: omp.parallel { -!CHECK: cf.cond_br %{{.*}}, ^[[BB1:.*]], ^[[BB2:.*]] -!CHECK: ^[[BB1]]: -!CHECK: {{.*}}fir.call @_FortranAStopStatement({{.*}}, {{.*}}, {{.*}}) fastmath : (i32, i1, i1) -> none -!CHECK: omp.terminator -!CHECK: ^[[BB2]]: -!CHECK: {{.*}}fir.call @_FortranAStopStatement({{.*}}, {{.*}}, {{.*}}) fastmath : (i32, i1, i1) -> none -!CHECK: omp.terminator -!CHECK: } -!CHECK: return - -subroutine test_stop_in_region6(x) - integer :: x - !$omp parallel - if (x .gt. 1) then - stop 1 - else - stop 2 - end if - !$omp end parallel -end diff --git a/flang/test/Lower/OpenMP/FIR/target.f90 b/flang/test/Lower/OpenMP/FIR/target.f90 deleted file mode 100644 index ea4b9240e9e51..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/target.f90 +++ /dev/null @@ -1,554 +0,0 @@ -! The "thread_limit" clause was added to the "target" construct in OpenMP 5.1. -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -fopenmp-version=51 %s -o - | FileCheck %s - -!=============================================================================== -! Target_Enter Simple -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target_enter_simple() { -subroutine omp_target_enter_simple - integer :: a(1024) - !CHECK: %[[BOUNDS:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(to) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "a"} - !CHECK: omp.target_enter_data map_entries(%[[MAP]] : !fir.ref>) - !$omp target enter data map(to: a) -end subroutine omp_target_enter_simple - -!=============================================================================== -! Target_Enter Map types -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target_enter_mt() { -subroutine omp_target_enter_mt - integer :: a(1024) - integer :: b(1024) - integer :: c(1024) - integer :: d(1024) - !CHECK: %[[BOUNDS_0:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP_0:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(to) capture(ByRef) bounds(%[[BOUNDS_0]]) -> !fir.ref> {name = "a"} - !CHECK: %[[BOUNDS_1:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP_1:.*]] = omp.map.info var_ptr(%{{.*}}) map_clauses(to) capture(ByRef) bounds(%[[BOUNDS_1]]) -> !fir.ref> {name = "b"} - !CHECK: %[[BOUNDS_2:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP_2:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(always, exit_release_or_enter_alloc) capture(ByRef) bounds(%[[BOUNDS_2]]) -> !fir.ref> {name = "c"} - !CHECK: %[[BOUNDS_3:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP_3:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(to) capture(ByRef) bounds(%[[BOUNDS_3]]) -> !fir.ref> {name = "d"} - !CHECK: omp.target_enter_data map_entries(%[[MAP_0]], %[[MAP_1]], %[[MAP_2]], %[[MAP_3]] : !fir.ref>, !fir.ref>, !fir.ref>, !fir.ref>) - !$omp target enter data map(to: a, b) map(always, alloc: c) map(to: d) -end subroutine omp_target_enter_mt - -!=============================================================================== -! `Nowait` clause -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target_enter_nowait() { -subroutine omp_target_enter_nowait - integer :: a(1024) - !CHECK: %[[BOUNDS:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(to) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "a"} - !CHECK: omp.target_enter_data nowait map_entries(%[[MAP]] : !fir.ref>) - !$omp target enter data map(to: a) nowait -end subroutine omp_target_enter_nowait - -!=============================================================================== -! `if` clause -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target_enter_if() { -subroutine omp_target_enter_if - integer :: a(1024) - integer :: i - i = 5 - !CHECK: %[[VAL_3:.*]] = fir.load %[[VAL_1:.*]] : !fir.ref - !CHECK: %[[VAL_4:.*]] = arith.constant 10 : i32 - !CHECK: %[[VAL_5:.*]] = arith.cmpi slt, %[[VAL_3]], %[[VAL_4]] : i32 - !CHECK: %[[BOUNDS:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(to) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "a"} - !CHECK: omp.target_enter_data if(%[[VAL_5]] : i1) map_entries(%[[MAP]] : !fir.ref>) - !$omp target enter data if(i<10) map(to: a) -end subroutine omp_target_enter_if - -!=============================================================================== -! `device` clause -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target_enter_device() { -subroutine omp_target_enter_device - integer :: a(1024) - !CHECK: %[[VAL_1:.*]] = arith.constant 2 : i32 - !CHECK: %[[BOUNDS:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(to) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "a"} - !CHECK: omp.target_enter_data device(%[[VAL_1]] : i32) map_entries(%[[MAP]] : !fir.ref>) - !$omp target enter data map(to: a) device(2) -end subroutine omp_target_enter_device - -!=============================================================================== -! Target_Exit Simple -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target_exit_simple() { -subroutine omp_target_exit_simple - integer :: a(1024) - !CHECK: %[[BOUNDS:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(from) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "a"} - !CHECK: omp.target_exit_data map_entries(%[[MAP]] : !fir.ref>) - !$omp target exit data map(from: a) -end subroutine omp_target_exit_simple - -!=============================================================================== -! Target_Exit Map types -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target_exit_mt() { -subroutine omp_target_exit_mt - integer :: a(1024) - integer :: b(1024) - integer :: c(1024) - integer :: d(1024) - integer :: e(1024) - !CHECK: %[[BOUNDS_0:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP_0:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(from) capture(ByRef) bounds(%[[BOUNDS_0]]) -> !fir.ref> {name = "a"} - !CHECK: %[[BOUNDS_1:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP_1:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(from) capture(ByRef) bounds(%[[BOUNDS_1]]) -> !fir.ref> {name = "b"} - !CHECK: %[[BOUNDS_2:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP_2:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(exit_release_or_enter_alloc) capture(ByRef) bounds(%[[BOUNDS_2]]) -> !fir.ref> {name = "c"} - !CHECK: %[[BOUNDS_3:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP_3:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(always, delete) capture(ByRef) bounds(%[[BOUNDS_3]]) -> !fir.ref> {name = "d"} - !CHECK: %[[BOUNDS_4:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP_4:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(from) capture(ByRef) bounds(%[[BOUNDS_4]]) -> !fir.ref> {name = "e"} - !CHECK: omp.target_exit_data map_entries(%[[MAP_0]], %[[MAP_1]], %[[MAP_2]], %[[MAP_3]], %[[MAP_4]] : !fir.ref>, !fir.ref>, !fir.ref>, !fir.ref>, !fir.ref>) - !$omp target exit data map(from: a,b) map(release: c) map(always, delete: d) map(from: e) -end subroutine omp_target_exit_mt - -!=============================================================================== -! `device` clause -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target_exit_device() { -subroutine omp_target_exit_device - integer :: a(1024) - integer :: d - !CHECK: %[[VAL_2:.*]] = fir.load %[[VAL_1:.*]] : !fir.ref - !CHECK: %[[BOUNDS:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(from) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "a"} - !CHECK: omp.target_exit_data device(%[[VAL_2]] : i32) map_entries(%[[MAP]] : !fir.ref>) - !$omp target exit data map(from: a) device(d) -end subroutine omp_target_exit_device - -!=============================================================================== -! Target_Update `to` clause -!=============================================================================== - -subroutine omp_target_update_to - integer :: a(1024) - - !CHECK-DAG: %[[A_ALLOC:.*]] = fir.alloca !fir.array<1024xi32> {bindc_name = "a", uniq_name = "_QFomp_target_update_toEa"} - !CHECK-DAG: %[[BOUNDS:.*]] = omp.map.bounds - - !CHECK: %[[TO_MAP:.*]] = omp.map.info var_ptr(%[[A_ALLOC]] : !fir.ref>, !fir.array<1024xi32>) - !CHECK-SAME: map_clauses(to) capture(ByRef) - !CHECK-SAME: bounds(%[[BOUNDS]]) -> !fir.ref> {name = "a"} - - !CHECK: omp.target_update - !CHECK-SAME: motion_entries(%[[TO_MAP]] : !fir.ref>) - !$omp target update to(a) -end subroutine omp_target_update_to - -!=============================================================================== -! Target_Update `from` clause -!=============================================================================== - -subroutine omp_target_update_from - integer :: a(1024) - - !CHECK-DAG: %[[A_ALLOC:.*]] = fir.alloca !fir.array<1024xi32> {bindc_name = "a", uniq_name = "_QFomp_target_update_fromEa"} - !CHECK-DAG: %[[BOUNDS:.*]] = omp.map.bounds - - !CHECK: %[[FROM_MAP:.*]] = omp.map.info var_ptr(%[[A_ALLOC]] : !fir.ref>, !fir.array<1024xi32>) - !CHECK-SAME: map_clauses(from) capture(ByRef) - !CHECK-SAME: bounds(%[[BOUNDS]]) -> !fir.ref> {name = "a"} - - !CHECK: omp.target_update - !CHECK-SAME: motion_entries(%[[FROM_MAP]] : !fir.ref>) - !$omp target update from(a) -end subroutine omp_target_update_from - -!=============================================================================== -! Target_Update `if` clause -!=============================================================================== - -subroutine omp_target_update_if - integer :: a(1024) - logical :: i - - !CHECK-DAG: %[[A_ALLOC:.*]] = fir.alloca - !CHECK-DAG: %[[BOUNDS:.*]] = omp.map.bounds - !CHECK-DAG: %[[COND:.*]] = fir.convert %{{.*}} : (!fir.logical<4>) -> i1 - - !CHECK: %[[TO_MAP:.*]] = omp.map.info - - !CHECK: omp.target_update if(%[[COND]] : i1) - !CHECK-SAME: motion_entries(%[[TO_MAP]] : !fir.ref>) - !$omp target update to(a) if(i) -end subroutine omp_target_update_if - -!=============================================================================== -! Target_Update `device` clause -!=============================================================================== - -subroutine omp_target_update_device - integer :: a(1024) - - !CHECK-DAG: %[[A_ALLOC:.*]] = fir.alloca - !CHECK-DAG: %[[BOUNDS:.*]] = omp.map.bounds - !CHECK-DAG: %[[DEVICE:.*]] = arith.constant 1 : i32 - - !CHECK: %[[TO_MAP:.*]] = omp.map.info - - !CHECK: omp.target_update - !CHECK-SAME: device(%[[DEVICE]] : i32) - !CHECK-SAME: motion_entries(%[[TO_MAP]] : !fir.ref>) - !$omp target update to(a) device(1) -end subroutine omp_target_update_device - -!=============================================================================== -! Target_Update `nowait` clause -!=============================================================================== - -subroutine omp_target_update_nowait - integer :: a(1024) - - !CHECK-DAG: %[[A_ALLOC:.*]] = fir.alloca - !CHECK-DAG: %[[BOUNDS:.*]] = omp.map.bounds - - !CHECK: %[[TO_MAP:.*]] = omp.map.info - - !CHECK: omp.target_update - !CHECK-SAME: nowait - !CHECK-SAME: motion_entries(%[[TO_MAP]] : !fir.ref>) - !$omp target update to(a) nowait -end subroutine omp_target_update_nowait - -!=============================================================================== -! Target_Data with region -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target_data() { -subroutine omp_target_data - !CHECK: %[[VAL_0:.*]] = fir.alloca !fir.array<1024xi32> {bindc_name = "a", uniq_name = "_QFomp_target_dataEa"} - integer :: a(1024) - !CHECK: %[[BOUNDS:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP:.*]] = omp.map.info var_ptr(%[[VAL_0]] : !fir.ref>, !fir.array<1024xi32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "a"} - !CHECK: omp.target_data map_entries(%[[MAP]] : !fir.ref>) { - !$omp target data map(tofrom: a) - !CHECK: %[[VAL_1:.*]] = arith.constant 10 : i32 - !CHECK: %[[VAL_2:.*]] = arith.constant 1 : i64 - !CHECK: %[[VAL_3:.*]] = arith.constant 1 : i64 - !CHECK: %[[VAL_4:.*]] = arith.subi %[[VAL_2]], %[[VAL_3]] : i64 - !CHECK: %[[VAL_5:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_4]] : (!fir.ref>, i64) -> !fir.ref - !CHECK: fir.store %[[VAL_1]] to %[[VAL_5]] : !fir.ref - a(1) = 10 - !CHECK: omp.terminator - !$omp end target data - !CHECK: } -end subroutine omp_target_data - -!CHECK-LABEL: func.func @_QPomp_target_data_mt -subroutine omp_target_data_mt - integer :: a(1024) - integer :: b(1024) - !CHECK: %[[VAR_A:.*]] = fir.alloca !fir.array<1024xi32> {bindc_name = "a", uniq_name = "_QFomp_target_data_mtEa"} - !CHECK: %[[VAR_B:.*]] = fir.alloca !fir.array<1024xi32> {bindc_name = "b", uniq_name = "_QFomp_target_data_mtEb"} - !CHECK: %[[BOUNDS_A:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP_A:.*]] = omp.map.info var_ptr(%[[VAR_A]] : !fir.ref>, !fir.array<1024xi32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS_A]]) -> !fir.ref> {name = "a"} - !CHECK: omp.target_data map_entries(%[[MAP_A]] : !fir.ref>) { - !$omp target data map(a) - !CHECK: omp.terminator - !$omp end target data - !CHECK: } - !CHECK: %[[BOUNDS_B:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP_B:.*]] = omp.map.info var_ptr(%[[VAR_B]] : !fir.ref>, !fir.array<1024xi32>) map_clauses(always, from) capture(ByRef) bounds(%[[BOUNDS_B]]) -> !fir.ref> {name = "b"} - !CHECK: omp.target_data map_entries(%[[MAP_B]] : !fir.ref>) { - !$omp target data map(always, from : b) - !CHECK: omp.terminator - !$omp end target data - !CHECK: } -end subroutine omp_target_data_mt - -!=============================================================================== -! Target with region -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target() { -subroutine omp_target - !CHECK: %[[VAL_0:.*]] = fir.alloca !fir.array<1024xi32> {bindc_name = "a", uniq_name = "_QFomp_targetEa"} - integer :: a(1024) - !CHECK: %[[BOUNDS:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) - !CHECK: %[[MAP:.*]] = omp.map.info var_ptr(%[[VAL_0]] : !fir.ref>, !fir.array<1024xi32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "a"} - !CHECK: omp.target map_entries(%[[MAP]] -> %[[ARG_0:.*]] : !fir.ref>) { - !CHECK: ^bb0(%[[ARG_0]]: !fir.ref>): - !$omp target map(tofrom: a) - !CHECK: %[[VAL_1:.*]] = arith.constant 10 : i32 - !CHECK: %[[VAL_2:.*]] = arith.constant 1 : i64 - !CHECK: %[[VAL_3:.*]] = arith.constant 1 : i64 - !CHECK: %[[VAL_4:.*]] = arith.subi %[[VAL_2]], %[[VAL_3]] : i64 - !CHECK: %[[VAL_5:.*]] = fir.coordinate_of %[[ARG_0]], %[[VAL_4]] : (!fir.ref>, i64) -> !fir.ref - !CHECK: fir.store %[[VAL_1]] to %[[VAL_5]] : !fir.ref - a(1) = 10 - !CHECK: omp.terminator - !$omp end target - !CHECK: } -end subroutine omp_target - -!=============================================================================== -! Target implicit capture -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target_implicit() { -subroutine omp_target_implicit - !CHECK: %[[VAL_0:.*]] = fir.alloca !fir.array<1024xi32> {bindc_name = "a", uniq_name = "_QFomp_target_implicitEa"} - integer :: a(1024) - !CHECK: %[[MAP:.*]] = omp.map.info var_ptr(%[[VAL_0]] : !fir.ref>, !fir.array<1024xi32>) map_clauses(implicit, tofrom) capture(ByRef) bounds(%{{.*}}) -> !fir.ref> {name = "a"} - !CHECK: omp.target map_entries(%[[MAP]] -> %[[ARG_0:.*]] : !fir.ref>) { - !CHECK: ^bb0(%[[ARG_0]]: !fir.ref>): - !$omp target - !CHECK: %[[VAL_5:.*]] = fir.coordinate_of %[[ARG_0]], %{{.*}} : (!fir.ref>, i64) -> !fir.ref - a(1) = 10 - !CHECK: omp.terminator - !$omp end target - !CHECK: } -end subroutine omp_target_implicit - -!=============================================================================== -! Target implicit capture nested -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target_implicit_nested() { -subroutine omp_target_implicit_nested - integer::a, b - !CHECK: omp.target map_entries(%{{.*}} -> %[[ARG0:.*]], %{{.*}} -> %[[ARG1:.*]] : !fir.ref, !fir.ref) { - !CHECK: ^bb0(%[[ARG0]]: !fir.ref, %[[ARG1]]: !fir.ref): - !$omp target - !CHECK: fir.store %{{.*}} to %[[ARG0]] : !fir.ref - a = 10 - !$omp parallel - !CHECK: fir.store %{{.*}} to %[[ARG1]] : !fir.ref - b = 20 - !CHECK: omp.terminator - !$omp end parallel - !CHECK: omp.terminator - !$omp end target - !CHECK: } -end subroutine omp_target_implicit_nested - -!=============================================================================== -! Target implicit capture with bounds -!=============================================================================== - - -!CHECK-LABEL: func.func @_QPomp_target_implicit_bounds( -!CHECK: %[[VAL_0:.*]]: !fir.ref {fir.bindc_name = "n"}) { -subroutine omp_target_implicit_bounds(n) - !CHECK: %[[VAL_COPY:.*]] = fir.alloca i32 - !CHECK: %[[VAL_1:.*]] = fir.load %[[VAL_0]] : !fir.ref - !CHECK: fir.store %[[VAL_1]] to %[[VAL_COPY]] : !fir.ref - !CHECK: %[[VAL_2:.*]] = fir.convert %[[VAL_1]] : (i32) -> i64 - !CHECK: %[[VAL_3:.*]] = fir.convert %[[VAL_2]] : (i64) -> index - !CHECK: %[[VAL_4:.*]] = arith.constant 0 : index - !CHECK: %[[VAL_5:.*]] = arith.cmpi sgt, %[[VAL_3]], %[[VAL_4]] : index - !CHECK: %[[VAL_6:.*]] = arith.select %[[VAL_5]], %[[VAL_3]], %[[VAL_4]] : index - !CHECK: %[[VAL_7:.*]] = arith.constant 1024 : i64 - !CHECK: %[[VAL_8:.*]] = fir.convert %[[VAL_7]] : (i64) -> index - !CHECK: %[[VAL_9:.*]] = arith.constant 0 : index - !CHECK: %[[VAL_10:.*]] = arith.cmpi sgt, %[[VAL_8]], %[[VAL_9]] : index - !CHECK: %[[VAL_11:.*]] = arith.select %[[VAL_10]], %[[VAL_8]], %[[VAL_9]] : index - !CHECK: %[[VAL_12:.*]] = fir.alloca !fir.array, %[[VAL_6]] {bindc_name = "a", uniq_name = "_QFomp_target_implicit_boundsEa"} - integer :: n - integer :: a(n, 1024) - !CHECK: %[[VAL_13:.*]] = arith.constant 1 : index - !CHECK: %[[VAL_14:.*]] = arith.constant 0 : index - !CHECK: %[[VAL_15:.*]] = arith.subi %[[VAL_6]], %[[VAL_13]] : index - !CHECK: %[[VAL_16:.*]] = omp.map.bounds lower_bound(%[[VAL_14]] : index) upper_bound(%[[VAL_15]] : index) extent(%[[VAL_6]] : index) stride(%[[VAL_13]] : index) start_idx(%[[VAL_13]] : index) - !CHECK: %[[VAL_17:.*]] = arith.constant 0 : index - !CHECK: %[[VAL_18:.*]] = arith.subi %[[VAL_11]], %[[VAL_13]] : index - !CHECK: %[[VAL_19:.*]] = omp.map.bounds lower_bound(%[[VAL_17]] : index) upper_bound(%[[VAL_18]] : index) extent(%[[VAL_11]] : index) stride(%[[VAL_13]] : index) start_idx(%[[VAL_13]] : index) - !CHECK: %[[VAL_20:.*]] = omp.map.info var_ptr(%[[VAL_12]] : !fir.ref>, !fir.array) map_clauses(implicit, tofrom) capture(ByRef) bounds(%[[VAL_16]], %[[VAL_19]]) -> !fir.ref> {name = "a"} - !CHECK: %[[VAL_21:.*]] = omp.map.info var_ptr(%[[VAL_COPY]] : !fir.ref, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !fir.ref {name = ""} - !CHECK: omp.target map_entries(%[[VAL_20]] -> %[[VAL_22:.*]], %[[VAL_21]] -> %[[VAL_23:.*]] : !fir.ref>, !fir.ref) { - !CHECK: ^bb0(%[[VAL_22]]: !fir.ref>, %[[VAL_23]]: !fir.ref): - !$omp target - !CHECK: %[[VAL_24:.*]] = fir.load %[[VAL_23]] : !fir.ref - !CHECK: %[[VAL_25:.*]] = fir.convert %[[VAL_24]] : (i32) -> i64 - !CHECK: %[[VAL_26:.*]] = arith.constant 0 : index - !CHECK: %[[VAL_27:.*]] = fir.convert %[[VAL_25]] : (i64) -> index - !CHECK: %[[VAL_28:.*]] = arith.cmpi sgt, %[[VAL_27]], %[[VAL_26]] : index - !CHECK: %[[VAL_29:.*]] = arith.select %[[VAL_28]], %[[VAL_27]], %[[VAL_26]] : index - !CHECK: %[[VAL_30:.*]] = arith.constant 33 : i32 - !CHECK: %[[VAL_31:.*]] = fir.convert %[[VAL_22]] : (!fir.ref>) -> !fir.ref> - !CHECK: %[[VAL_32:.*]] = arith.constant 1 : index - !CHECK: %[[VAL_33:.*]] = arith.constant 0 : index - !CHECK: %[[VAL_34:.*]] = arith.constant 11 : i64 - !CHECK: %[[VAL_35:.*]] = fir.convert %[[VAL_34]] : (i64) -> index - !CHECK: %[[VAL_36:.*]] = arith.subi %[[VAL_35]], %[[VAL_32]] : index - !CHECK: %[[VAL_37:.*]] = arith.muli %[[VAL_32]], %[[VAL_36]] : index - !CHECK: %[[VAL_38:.*]] = arith.addi %[[VAL_37]], %[[VAL_33]] : index - !CHECK: %[[VAL_39:.*]] = arith.muli %[[VAL_32]], %[[VAL_29]] : index - !CHECK: %[[VAL_40:.*]] = arith.constant 22 : i64 - !CHECK: %[[VAL_41:.*]] = fir.convert %[[VAL_40]] : (i64) -> index - !CHECK: %[[VAL_42:.*]] = arith.subi %[[VAL_41]], %[[VAL_32]] : index - !CHECK: %[[VAL_43:.*]] = arith.muli %[[VAL_39]], %[[VAL_42]] : index - !CHECK: %[[VAL_44:.*]] = arith.addi %[[VAL_43]], %[[VAL_38]] : index - !CHECK: %[[VAL_45:.*]] = fir.coordinate_of %[[VAL_31]], %[[VAL_44]] : (!fir.ref>, index) -> !fir.ref - !CHECK: fir.store %[[VAL_30]] to %[[VAL_45]] : !fir.ref - a(11, 22) = 33 - !CHECK: omp.terminator - !$omp end target -!CHECK: } -end subroutine omp_target_implicit_bounds - -!=============================================================================== -! Target `thread_limit` clause -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target_thread_limit() { -subroutine omp_target_thread_limit - integer :: a - !CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(tofrom) capture(ByRef) -> !fir.ref {name = "a"} - !CHECK: %[[VAL_1:.*]] = arith.constant 64 : i32 - !CHECK: omp.target thread_limit(%[[VAL_1]] : i32) map_entries(%[[MAP]] -> %[[ARG_0:.*]] : !fir.ref) { - !CHECK: ^bb0(%[[ARG_0]]: !fir.ref): - !$omp target map(tofrom: a) thread_limit(64) - a = 10 - !CHECK: omp.terminator - !$omp end target - !CHECK: } -end subroutine omp_target_thread_limit - -!=============================================================================== -! Target `use_device_ptr` clause -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target_device_ptr() { -subroutine omp_target_device_ptr - use iso_c_binding, only : c_ptr, c_loc - type(c_ptr) :: a - integer, target :: b - !CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(tofrom) capture(ByRef) -> {{.*}} {name = "a"} - !CHECK: omp.target_data map_entries(%[[MAP]]{{.*}} - !$omp target data map(tofrom: a) use_device_ptr(a) - !CHECK: ^bb0(%[[VAL_1:.*]]: !fir.ref>): - !CHECK: {{.*}} = fir.coordinate_of %[[VAL_1:.*]], {{.*}} : (!fir.ref>, !fir.field) -> !fir.ref - a = c_loc(b) - !CHECK: omp.terminator - !$omp end target data - !CHECK: } -end subroutine omp_target_device_ptr - - !=============================================================================== - ! Target `use_device_addr` clause - !=============================================================================== - - !CHECK-LABEL: func.func @_QPomp_target_device_addr() { - subroutine omp_target_device_addr - integer, pointer :: a - !CHECK: %[[VAL_0:.*]] = fir.alloca !fir.box> {bindc_name = "a", uniq_name = "_QFomp_target_device_addrEa"} - !CHECK: %[[MAP_MEMBERS:.*]] = omp.map.info var_ptr({{.*}} : !fir.ref>>, i32) var_ptr_ptr({{.*}} : !fir.llvm_ptr>) map_clauses(tofrom) capture(ByRef) -> !fir.llvm_ptr> {name = ""} - !CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}} : !fir.ref>>, !fir.box>) map_clauses(tofrom) capture(ByRef) members(%[[MAP_MEMBERS]] : !fir.llvm_ptr>) -> !fir.ref>> {name = "a"} - !CHECK: omp.target_data map_entries(%[[MAP_MEMBERS]], %[[MAP]] : {{.*}}) use_device_addr(%[[VAL_0]] : !fir.ref>>) { - !$omp target data map(tofrom: a) use_device_addr(a) - !CHECK: ^bb0(%[[VAL_1:.*]]: !fir.ref>>): - !CHECK: {{.*}} = fir.load %[[VAL_1]] : !fir.ref>> - a = 10 - !CHECK: omp.terminator - !$omp end target data - !CHECK: } -end subroutine omp_target_device_addr - -!=============================================================================== -! Target with parallel loop -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target_parallel_do() { -subroutine omp_target_parallel_do - !CHECK: %[[C1024:.*]] = arith.constant 1024 : index - !CHECK: %[[VAL_0:.*]] = fir.alloca !fir.array<1024xi32> {bindc_name = "a", uniq_name = "_QFomp_target_parallel_doEa"} - integer :: a(1024) - !CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFomp_target_parallel_doEi"} - integer :: i - !CHECK: %[[C1:.*]] = arith.constant 1 : index - !CHECK: %[[C0:.*]] = arith.constant 0 : index - !CHECK: %[[SUB:.*]] = arith.subi %[[C1024]], %[[C1]] : index - !CHECK: %[[BOUNDS:.*]] = omp.map.bounds lower_bound(%[[C0]] : index) upper_bound(%[[SUB]] : index) extent(%[[C1024]] : index) stride(%[[C1]] : index) start_idx(%[[C1]] : index) - !CHECK: %[[MAP1:.*]] = omp.map.info var_ptr(%[[VAL_0]] : !fir.ref>, !fir.array<1024xi32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "a"} - !CHECK: %[[MAP2:.*]] = omp.map.info var_ptr(%[[VAL_1]] : !fir.ref, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !fir.ref {name = "i"} - !CHECK: omp.target map_entries(%[[MAP1]] -> %[[VAL_2:.*]], %[[MAP2]] -> %[[VAL_3:.*]] : !fir.ref>, !fir.ref) { - !CHECK: ^bb0(%[[VAL_2]]: !fir.ref>, %[[VAL_3]]: !fir.ref): - !CHECK-NEXT: omp.parallel - !$omp target parallel do map(tofrom: a) - !CHECK: %[[VAL_4:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} - !CHECK: %[[VAL_5:.*]] = arith.constant 1 : i32 - !CHECK: %[[VAL_6:.*]] = arith.constant 1024 : i32 - !CHECK: %[[VAL_7:.*]] = arith.constant 1 : i32 - !CHECK: omp.wsloop { - !CHECK: omp.loop_nest (%[[VAL_8:.*]]) : i32 = (%[[VAL_5]]) to (%[[VAL_6]]) inclusive step (%[[VAL_7]]) { - !CHECK: fir.store %[[VAL_8]] to %[[VAL_4]] : !fir.ref - !CHECK: %[[VAL_9:.*]] = arith.constant 10 : i32 - !CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_4]] : !fir.ref - !CHECK: %[[VAL_11:.*]] = fir.convert %[[VAL_10]] : (i32) -> i64 - !CHECK: %[[VAL_12:.*]] = arith.constant 1 : i64 - !CHECK: %[[VAL_13:.*]] = arith.subi %[[VAL_11]], %[[VAL_12]] : i64 - !CHECK: %[[VAL_14:.*]] = fir.coordinate_of %[[VAL_2]], %[[VAL_13]] : (!fir.ref>, i64) -> !fir.ref - !CHECK: fir.store %[[VAL_9]] to %[[VAL_14]] : !fir.ref - do i = 1, 1024 - a(i) = 10 - end do - !CHECK: omp.yield - !CHECK: } - !CHECK: omp.terminator - !CHECK: } - !CHECK: omp.terminator - !CHECK: } - !CHECK: omp.terminator - !CHECK: } - !$omp end target parallel do -end subroutine omp_target_parallel_do - -!=============================================================================== -! Target `is_device_ptr` clause -!=============================================================================== - -!CHECK-LABEL: func.func @_QPomp_target_is_device_ptr() { -subroutine omp_target_is_device_ptr - use iso_c_binding, only : c_ptr, c_loc - !CHECK: %[[VAL_0:.*]] = fir.alloca !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}> {bindc_name = "a", uniq_name = "_QFomp_target_is_device_ptrEa"} - type(c_ptr) :: a - !CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "b", fir.target, uniq_name = "_QFomp_target_is_device_ptrEb"} - integer, target :: b - !CHECK: %[[MAP_0:.*]] = omp.map.info var_ptr(%[[DEV_PTR:.*]] : !fir.ref>, !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>) map_clauses(tofrom) capture(ByRef) -> !fir.ref> {name = "a"} - !CHECK: %[[MAP_1:.*]] = omp.map.info var_ptr(%[[VAL_0:.*]] : !fir.ref, i32) map_clauses(tofrom) capture(ByRef) -> !fir.ref {name = "b"} - !CHECK: %[[MAP_2:.*]] = omp.map.info var_ptr(%[[DEV_PTR:.*]] : !fir.ref>, !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByRef) -> !fir.ref> {name = "a"} - !CHECK: omp.target is_device_ptr(%[[DEV_PTR:.*]] : !fir.ref>) map_entries(%[[MAP_0:.*]] -> %[[ARG0:.*]], %[[MAP_1:.*]] -> %[[ARG1:.*]], %[[MAP_2:.*]] -> %[[ARG2:.*]] : !fir.ref>, !fir.ref, !fir.ref>) { - !CHECK: ^bb0(%[[ARG0]]: !fir.ref>, %[[ARG1]]: !fir.ref, %[[ARG2]]: !fir.ref>): - !$omp target map(tofrom: a,b) is_device_ptr(a) - !CHECK: {{.*}} = fir.coordinate_of %[[VAL_0:.*]], {{.*}} : (!fir.ref>, !fir.field) -> !fir.ref - a = c_loc(b) - !CHECK: omp.terminator - !$omp end target - !CHECK: } -end subroutine omp_target_is_device_ptr - - !=============================================================================== - ! Target `has_device_addr` clause - !=============================================================================== - - !CHECK-LABEL: func.func @_QPomp_target_has_device_addr() { - subroutine omp_target_has_device_addr - !CHECK: %[[VAL_0:.*]] = fir.alloca !fir.box> {bindc_name = "a", uniq_name = "_QFomp_target_has_device_addrEa"} - integer, pointer :: a - !CHECK: omp.target has_device_addr(%[[VAL_0:.*]] : !fir.ref>>) map_entries({{.*}} -> {{.*}}, {{.*}} -> {{.*}} : !fir.llvm_ptr>, !fir.ref>>) { - !$omp target has_device_addr(a) - !CHECK: {{.*}} = fir.load %[[VAL_0:.*]] : !fir.ref>> - a = 10 - !CHECK: omp.terminator - !$omp end target - !CHECK: } -end subroutine omp_target_has_device_addr diff --git a/flang/test/Lower/OpenMP/FIR/target_cpu_features.f90 b/flang/test/Lower/OpenMP/FIR/target_cpu_features.f90 deleted file mode 100644 index 5154782e1ae17..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/target_cpu_features.f90 +++ /dev/null @@ -1,19 +0,0 @@ -!REQUIRES: amdgpu-registered-target, nvptx-registered-target -!RUN: %flang_fc1 -emit-fir -triple amdgcn-amd-amdhsa -target-cpu gfx908 -fopenmp -fopenmp-is-target-device %s -o - | FileCheck --check-prefix=AMDGCN %s -!RUN: %flang_fc1 -emit-fir -triple nvptx64-nvidia-cuda -target-cpu sm_80 -fopenmp -fopenmp-is-target-device %s -o - | FileCheck --check-prefix=NVPTX %s - -!=============================================================================== -! Target_Enter Simple -!=============================================================================== - -!AMDGCN: module attributes { -!AMDGCN-SAME: fir.target_cpu = "gfx908" -!AMDGCN-SAME: fir.target_features = #llvm.target_features<["+16-bit-insts", "+ci-insts", -!AMDGCN-SAME: "+dl-insts", "+dot1-insts", "+dot10-insts", "+dot2-insts", "+dot3-insts", -!AMDGCN-SAME: "+dot4-insts", "+dot5-insts", "+dot6-insts", "+dot7-insts", "+dpp", -!AMDGCN-SAME: "+gfx8-insts", "+gfx9-insts", "+gws", "+image-insts", "+mai-insts", -!AMDGCN-SAME: "+s-memrealtime", "+s-memtime-inst", "+wavefrontsize64"]> - -!NVPTX: module attributes { -!NVPTX-SAME: fir.target_cpu = "sm_80" -!NVPTX-SAME: fir.target_features = #llvm.target_features<["+ptx61", "+sm_80"]> diff --git a/flang/test/Lower/OpenMP/FIR/task.f90 b/flang/test/Lower/OpenMP/FIR/task.f90 deleted file mode 100644 index 012ac757d304a..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/task.f90 +++ /dev/null @@ -1,237 +0,0 @@ -! REQUIRES: openmp_runtime - -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -!CHECK-LABEL: func @_QPomp_task_simple() { -subroutine omp_task_simple - !CHECK: omp.task { - !$omp task - !CHECK: fir.call @_QPfoo() {{.*}}: () -> () - call foo() - !CHECK: omp.terminator - !$omp end task -end subroutine omp_task_simple - -!=============================================================================== -! `if` clause -!=============================================================================== - -!CHECK-LABEL: func @_QPomp_task_if(%{{.+}}) { -subroutine omp_task_if(bar) - logical, intent(inout) :: bar - !CHECK: omp.task if(%{{.+}}) { - !$omp task if(bar) - !CHECK: fir.call @_QPfoo() {{.*}}: () -> () - call foo() - !CHECK: omp.terminator - !$omp end task -end subroutine omp_task_if - -!=============================================================================== -! `final` clause -!=============================================================================== - -!CHECK-LABEL: func @_QPomp_task_final(%{{.+}}) { -subroutine omp_task_final(bar) - logical, intent(inout) :: bar - !CHECK: omp.task final(%{{.+}}) { - !$omp task final(bar) - !CHECK: fir.call @_QPfoo() {{.*}}: () -> () - call foo() - !CHECK: omp.terminator - !$omp end task -end subroutine omp_task_final - -!=============================================================================== -! `priority` clause -!=============================================================================== - -!CHECK-LABEL: func @_QPomp_task_priority(%{{.+}}) { -subroutine omp_task_priority(bar) - integer, intent(inout) :: bar - !CHECK: omp.task priority(%{{.+}}) { - !$omp task priority(bar) - !CHECK: fir.call @_QPfoo() {{.*}}: () -> () - call foo() - !CHECK: omp.terminator - !$omp end task -end subroutine omp_task_priority - -!=============================================================================== -! `allocate` clause -!=============================================================================== - -!CHECK-LABEL: func @_QPtask_allocate -subroutine task_allocate() - use omp_lib - integer :: x - !CHECK: omp.task allocate(%{{.+}} : i64 -> %{{.+}} : !fir.ref) { - !$omp task allocate(omp_high_bw_mem_alloc: x) private(x) - !CHECK: arith.addi - x = x + 12 - !CHECK: omp.terminator - !$omp end task -end subroutine task_allocate - -!=============================================================================== -! `depend` clause -!=============================================================================== - -!CHECK-LABEL: func @_QPtask_depend -subroutine task_depend() - integer :: x - !CHECK: omp.task depend(taskdependin -> %{{.+}} : !fir.ref) { - !$omp task depend(in : x) - !CHECK: arith.addi - x = x + 12 - !CHECK: omp.terminator - !$omp end task -end subroutine task_depend - -!CHECK-LABEL: func @_QPtask_depend_non_int -subroutine task_depend_non_int() - character(len = 15) :: x - integer, allocatable :: y - complex :: z - !CHECK: omp.task depend(taskdependin -> %{{.+}} : !fir.ref>, taskdependin -> %{{.+}} : !fir.ref>>, taskdependin -> %{{.+}} : !fir.ref>) { - !$omp task depend(in : x, y, z) - !CHECK: omp.terminator - !$omp end task -end subroutine task_depend_non_int - -!CHECK-LABEL: func @_QPtask_depend_all_kinds_one_task -subroutine task_depend_all_kinds_one_task() - integer :: x - !CHECK: omp.task depend(taskdependin -> %{{.+}} : !fir.ref, taskdependout -> %{{.+}} : !fir.ref, taskdependinout -> %{{.+}} : !fir.ref) { - !$omp task depend(in : x) depend(out : x) depend(inout : x) - !CHECK: arith.addi - x = x + 12 - !CHECK: omp.terminator - !$omp end task -end subroutine task_depend_all_kinds_one_task - -!CHECK-LABEL: func @_QPtask_depend_multi_var -subroutine task_depend_multi_var() - integer :: x - integer :: y - !CHECK: omp.task depend(taskdependin -> %{{.*}} : !fir.ref, taskdependin -> %{{.+}} : !fir.ref) { - !$omp task depend(in :x,y) - !CHECK: arith.addi - x = x + 12 - y = y + 12 - !CHECK: omp.terminator - !$omp end task -end subroutine task_depend_multi_var - -!CHECK-LABEL: func @_QPtask_depend_multi_task -subroutine task_depend_multi_task() - integer :: x - !CHECK: omp.task depend(taskdependout -> %{{.+}} : !fir.ref) - !$omp task depend(out : x) - !CHECK: arith.addi - x = x + 12 - !CHECK: omp.terminator - !$omp end task - !CHECK: omp.task depend(taskdependinout -> %{{.+}} : !fir.ref) - !$omp task depend(inout : x) - !CHECK: arith.addi - x = x + 12 - !CHECK: omp.terminator - !$omp end task - !CHECK: omp.task depend(taskdependin -> %{{.+}} : !fir.ref) - !$omp task depend(in : x) - !CHECK: arith.addi - x = x + 12 - !CHECK: omp.terminator - !$omp end task -end subroutine task_depend_multi_task - -!=============================================================================== -! `private` clause -!=============================================================================== -!CHECK-LABEL: func @_QPtask_private -subroutine task_private - type mytype - integer :: x - end type mytype - - !CHECK: %[[int_var:.+]] = fir.alloca i32 - !CHECK: %[[mytype_var:.+]] = fir.alloca !fir.type<_QFtask_privateTmytype{x:i32}> - integer :: int_var - type(mytype) :: mytype_var - - !CHECK: fir.call @_QPbar(%[[int_var]], %[[mytype_var]]) {{.*}}: (!fir.ref, !fir.ref>) -> () - call bar(int_var, mytype_var) - - !CHECK: omp.task { - !$omp task private(int_var, mytype_var) - !CHECK: %[[int_var_private:.+]] = fir.alloca i32 - !CHECK: %[[mytype_var_private:.+]] = fir.alloca !fir.type<_QFtask_privateTmytype{x:i32}> - - !CHECK: fir.call @_QPbar(%[[int_var_private]], %[[mytype_var_private]]) {{.*}}: (!fir.ref, !fir.ref>) -> () - call bar(int_var, mytype_var) - !CHECK: omp.terminator - !$omp end task -end subroutine task_private - -!=============================================================================== -! `firstprivate` clause -!=============================================================================== -!CHECK-LABEL: func @_QPtask_firstprivate -subroutine task_firstprivate - type mytype - integer :: x - end type mytype - - !CHECK: %[[int_var:.+]] = fir.alloca i32 - !CHECK: %[[mytype_var:.+]] = fir.alloca !fir.type<_QFtask_firstprivateTmytype{x:i32}> - integer :: int_var - type(mytype) :: mytype_var - - !CHECK: fir.call @_QPbaz(%[[int_var]], %[[mytype_var]]) {{.*}}: (!fir.ref, !fir.ref>) -> () - call baz(int_var, mytype_var) - - !CHECK: omp.task { - !$omp task firstprivate(int_var, mytype_var) - !CHECK: %[[int_var_firstprivate:.+]] = fir.alloca i32 - !CHECK: %[[int_var_load:.+]] = fir.load %[[int_var]] : !fir.ref - !CHECK: fir.store %[[int_var_load]] to %[[int_var_firstprivate]] : !fir.ref - !CHECK: %[[mytype_var_firstprivate:.+]] = fir.alloca !fir.type<_QFtask_firstprivateTmytype{x:i32}> - !CHECK: %[[mytype_var_load:.+]] = fir.load %[[mytype_var]] : !fir.ref> - !CHECK: fir.store %[[mytype_var_load]] to %[[mytype_var_firstprivate]] - !CHECK: fir.call @_QPbaz(%[[int_var_firstprivate]], %[[mytype_var_firstprivate]]) {{.*}}: (!fir.ref, !fir.ref>) -> () - call baz(int_var, mytype_var) - !CHECK: omp.terminator - !$omp end task -end subroutine task_firstprivate - -!=============================================================================== -! Multiple clauses -!=============================================================================== - -!CHECK-LABEL: func @_QPtask_multiple_clauses -subroutine task_multiple_clauses() - use omp_lib - - !CHECK: %[[x:.+]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFtask_multiple_clausesEx"} - !CHECK: %[[y:.+]] = fir.alloca i32 {bindc_name = "y", uniq_name = "_QFtask_multiple_clausesEy"} - !CHECK: %[[z:.+]] = fir.alloca i32 {bindc_name = "z", uniq_name = "_QFtask_multiple_clausesEz"} - integer :: x, y, z - logical :: buzz - - !CHECK: omp.task if(%{{.+}}) final(%{{.+}}) priority(%{{.+}}) allocate(%{{.+}} : i64 -> %{{.+}} : !fir.ref) { - !$omp task if(buzz) final(buzz) priority(z) allocate(omp_high_bw_mem_alloc: x) private(x) firstprivate(y) - - !CHECK: %[[x_priv:.+]] = fir.alloca i32 - !CHECK: %[[y_priv:.+]] = fir.alloca i32 - !CHECK: %[[y_load:.+]] = fir.load %[[y]] : !fir.ref - !CHECK: fir.store %[[y_load]] to %[[y_priv]] : !fir.ref - - !CHECK: arith.addi - x = x + 12 - !CHECK: arith.subi - y = y - 12 - - !CHECK: omp.terminator - !$omp end task -end subroutine task_multiple_clauses diff --git a/flang/test/Lower/OpenMP/FIR/taskgroup.f90 b/flang/test/Lower/OpenMP/FIR/taskgroup.f90 deleted file mode 100644 index 78b9da8e9b098..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/taskgroup.f90 +++ /dev/null @@ -1,21 +0,0 @@ -! REQUIRES: openmp_runtime - -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -!CHECK-LABEL: @_QPomp_taskgroup -subroutine omp_taskgroup -use omp_lib -integer :: allocated_x -!CHECK-DAG: %{{.*}} = fir.alloca i32 {bindc_name = "allocated_x", uniq_name = "_QFomp_taskgroupEallocated_x"} -!CHECK-DAG: %{{.*}} = arith.constant 4 : i64 - -!CHECK: omp.taskgroup allocate(%{{.*}} : i64 -> %0 : !fir.ref) -!$omp taskgroup allocate(omp_high_bw_mem_alloc: allocated_x) -!$omp task -!CHECK: fir.call @_QPwork() {{.*}}: () -> () - call work() -!CHECK: omp.terminator -!$omp end task -!CHECK: omp.terminator -!$omp end taskgroup -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/taskwait.f90 b/flang/test/Lower/OpenMP/FIR/taskwait.f90 deleted file mode 100644 index eed4f1b84a226..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/taskwait.f90 +++ /dev/null @@ -1,12 +0,0 @@ -!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect" -!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="OMPDialect" - -!FIRDialect-LABEL: @_QPomp_taskwait -subroutine omp_taskwait - !OMPDialect: omp.taskwait - !$omp taskwait - !FIRDialect: fir.call @_QPfoo() {{.*}}: () -> () - call foo() - !OMPDialect: omp.taskwait - !$omp taskwait -end subroutine omp_taskwait diff --git a/flang/test/Lower/OpenMP/FIR/taskyield.f90 b/flang/test/Lower/OpenMP/FIR/taskyield.f90 deleted file mode 100644 index ca0bc1d071df6..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/taskyield.f90 +++ /dev/null @@ -1,12 +0,0 @@ -!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect" -!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="OMPDialect" - -!FIRDialect-LABEL: @_QPomp_taskyield -subroutine omp_taskyield - !OMPDialect: omp.taskyield - !$omp taskyield - !FIRDialect: fir.call @_QPfoo() {{.*}}: () -> () - call foo() - !OMPDialect: omp.taskyield - !$omp taskyield -end subroutine omp_taskyield diff --git a/flang/test/Lower/OpenMP/FIR/teams.f90 b/flang/test/Lower/OpenMP/FIR/teams.f90 deleted file mode 100644 index 9c0593a24f2df..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/teams.f90 +++ /dev/null @@ -1,117 +0,0 @@ -! REQUIRES: openmp_runtime - -! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s - -! CHECK-LABEL: func @_QPteams_simple -subroutine teams_simple() - ! CHECK: omp.teams - !$omp teams - ! CHECK: fir.call - call f1() - ! CHECK: omp.terminator - !$omp end teams -end subroutine teams_simple - -!=============================================================================== -! `num_teams` clause -!=============================================================================== - -! CHECK-LABEL: func @_QPteams_numteams -subroutine teams_numteams(num_teams) - integer, intent(inout) :: num_teams - - ! CHECK: omp.teams - ! CHECK-SAME: num_teams( to %{{.*}}: i32) - !$omp teams num_teams(4) - ! CHECK: fir.call - call f1() - ! CHECK: omp.terminator - !$omp end teams - - ! CHECK: omp.teams - ! CHECK-SAME: num_teams( to %{{.*}}: i32) - !$omp teams num_teams(num_teams) - ! CHECK: fir.call - call f2() - ! CHECK: omp.terminator - !$omp end teams - -end subroutine teams_numteams - -!=============================================================================== -! `if` clause -!=============================================================================== - -! CHECK-LABEL: func @_QPteams_if -subroutine teams_if(alpha) - integer, intent(in) :: alpha - logical :: condition - - ! CHECK: omp.teams - ! CHECK-SAME: if(%{{.*}}) - !$omp teams if(.false.) - ! CHECK: fir.call - call f1() - ! CHECK: omp.terminator - !$omp end teams - - ! CHECK: omp.teams - ! CHECK-SAME: if(%{{.*}}) - !$omp teams if(alpha .le. 0) - ! CHECK: fir.call - call f2() - ! CHECK: omp.terminator - !$omp end teams - - ! CHECK: omp.teams - ! CHECK-SAME: if(%{{.*}}) - !$omp teams if(condition) - ! CHECK: fir.call - call f3() - ! CHECK: omp.terminator - !$omp end teams -end subroutine teams_if - -!=============================================================================== -! `thread_limit` clause -!=============================================================================== - -! CHECK-LABEL: func @_QPteams_threadlimit -subroutine teams_threadlimit(thread_limit) - integer, intent(inout) :: thread_limit - - ! CHECK: omp.teams - ! CHECK-SAME: thread_limit(%{{.*}}: i32) - !$omp teams thread_limit(4) - ! CHECK: fir.call - call f1() - ! CHECK: omp.terminator - !$omp end teams - - ! CHECK: omp.teams - ! CHECK-SAME: thread_limit(%{{.*}}: i32) - !$omp teams thread_limit(thread_limit) - ! CHECK: fir.call - call f2() - ! CHECK: omp.terminator - !$omp end teams - -end subroutine teams_threadlimit - -!=============================================================================== -! `allocate` clause -!=============================================================================== - -! CHECK-LABEL: func @_QPteams_allocate -subroutine teams_allocate() - use omp_lib - integer :: x - integer :: y - ! CHECK: omp.teams - ! CHECK-SAME: allocate(%{{.+}} : i64 -> %{{.+}} : !fir.ref) - !$omp teams allocate(omp_high_bw_mem_alloc: x) private(x) - ! CHECK: arith.addi - x = x + 12 - ! CHECK: omp.terminator - !$omp end teams -end subroutine teams_allocate diff --git a/flang/test/Lower/OpenMP/FIR/threadprivate-char-array-chararray.f90 b/flang/test/Lower/OpenMP/FIR/threadprivate-char-array-chararray.f90 deleted file mode 100644 index 3580add37ef44..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/threadprivate-char-array-chararray.f90 +++ /dev/null @@ -1,46 +0,0 @@ -! This test checks lowering of OpenMP Threadprivate Directive. -! Test for character, array, and character array. - -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -module test - character :: x - integer :: y(5) - character(5) :: z(5) - - !$omp threadprivate(x, y, z) - -!CHECK-DAG: fir.global @_QMtestEx : !fir.char<1> { -!CHECK-DAG: fir.global @_QMtestEy : !fir.array<5xi32> { -!CHECK-DAG: fir.global @_QMtestEz : !fir.array<5x!fir.char<1,5>> { - -contains - subroutine sub() -!CHECK-DAG: [[ADDR0:%.*]] = fir.address_of(@_QMtestEx) : !fir.ref> -!CHECK-DAG: [[NEWADDR0:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: [[ADDR1:%.*]] = fir.address_of(@_QMtestEy) : !fir.ref> -!CHECK-DAG: [[NEWADDR1:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: [[ADDR2:%.*]] = fir.address_of(@_QMtestEz) : !fir.ref>> -!CHECK-DAG: [[NEWADDR2:%.*]] = omp.threadprivate [[ADDR2]] : !fir.ref>> -> !fir.ref>> -!CHECK-DAG: %{{.*}} = fir.convert [[NEWADDR0]] : (!fir.ref>) -> !fir.ref -!CHECK-DAG: %{{.*}} = fir.embox [[NEWADDR1]](%{{.*}}) : (!fir.ref>, !fir.shape<1>) -> !fir.box> -!CHECK-DAG: %{{.*}} = fir.embox [[NEWADDR2]](%{{.*}}) : (!fir.ref>>, !fir.shape<1>) -> !fir.box>> - print *, x, y, z - - !$omp parallel -!CHECK-DAG: [[ADDR33:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: [[ADDR34:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: [[ADDR35:%.*]] = omp.threadprivate [[ADDR2]] : !fir.ref>> -> !fir.ref>> -!CHECK-DAG: %{{.*}} = fir.convert [[ADDR33]] : (!fir.ref>) -> !fir.ref -!CHECK-DAG: %{{.*}} = fir.embox [[ADDR34]](%{{.*}}) : (!fir.ref>, !fir.shape<1>) -> !fir.box> -!CHECK-DAG: %{{.*}} = fir.embox [[ADDR35]](%{{.*}}) : (!fir.ref>>, !fir.shape<1>) -> !fir.box>> - print *, x, y, z - !$omp end parallel - -!CHECK-DAG: %{{.*}} = fir.convert [[NEWADDR0]] : (!fir.ref>) -> !fir.ref -!CHECK-DAG: %{{.*}} = fir.embox [[NEWADDR1]](%{{.*}}) : (!fir.ref>, !fir.shape<1>) -> !fir.box> -!CHECK-DAG: %{{.*}} = fir.embox [[NEWADDR2]](%{{.*}}) : (!fir.ref>>, !fir.shape<1>) -> !fir.box>> - print *, x, y, z - - end -end diff --git a/flang/test/Lower/OpenMP/FIR/threadprivate-commonblock.f90 b/flang/test/Lower/OpenMP/FIR/threadprivate-commonblock.f90 deleted file mode 100644 index 49f592ec8121e..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/threadprivate-commonblock.f90 +++ /dev/null @@ -1,91 +0,0 @@ -! This test checks lowering of OpenMP Threadprivate Directive. -! Test for common block. - -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -module test - integer:: a - real :: b(2) - complex, pointer :: c, d(:) - character(5) :: e, f(2) - common /blk/ a, b, c, d, e, f - - !$omp threadprivate(/blk/) - -!CHECK: fir.global common @blk_(dense<0> : vector<103xi8>) : !fir.array<103xi8> - -contains - subroutine sub() -!CHECK: [[ADDR0:%.*]] = fir.address_of(@blk_) : !fir.ref> -!CHECK: [[NEWADDR0:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: [[ADDR1:%.*]] = fir.convert [[NEWADDR0]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[C0:%.*]] = arith.constant 0 : index -!CHECK-DAG: [[ADDR2:%.*]] = fir.coordinate_of [[ADDR1]], [[C0]] : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR3:%.*]] = fir.convert [[ADDR2]] : (!fir.ref) -> !fir.ref -!CHECK-DAG: [[ADDR4:%.*]] = fir.convert [[NEWADDR0]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[C1:%.*]] = arith.constant 4 : index -!CHECK-DAG: [[ADDR5:%.*]] = fir.coordinate_of [[ADDR4]], [[C1]] : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR6:%.*]] = fir.convert [[ADDR5]] : (!fir.ref) -> !fir.ref> -!CHECK-DAG: [[ADDR7:%.*]] = fir.convert [[NEWADDR0]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[C2:%.*]] = arith.constant 16 : index -!CHECK-DAG: [[ADDR8:%.*]] = fir.coordinate_of [[ADDR7]], [[C2]] : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR9:%.*]] = fir.convert [[ADDR8]] : (!fir.ref) -> !fir.ref>>> -!CHECK-DAG: [[ADDR10:%.*]] = fir.convert [[NEWADDR0]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[C3:%.*]] = arith.constant 40 : index -!CHECK-DAG: [[ADDR11:%.*]] = fir.coordinate_of [[ADDR10]], [[C3]] : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR12:%.*]] = fir.convert [[ADDR11]] : (!fir.ref) -> !fir.ref>>>> -!CHECK-DAG: [[ADDR13:%.*]] = fir.convert [[NEWADDR0]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[C4:%.*]] = arith.constant 88 : index -!CHECK-DAG: [[ADDR14:%.*]] = fir.coordinate_of [[ADDR13]], [[C4]] : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR15:%.*]] = fir.convert [[ADDR14]] : (!fir.ref) -> !fir.ref> -!CHECK-DAG: [[ADDR16:%.*]] = fir.convert [[NEWADDR0]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[C5:%.*]] = arith.constant 93 : index -!CHECK-DAG: [[ADDR17:%.*]] = fir.coordinate_of [[ADDR16]], [[C5]] : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR18:%.*]] = fir.convert [[ADDR17]] : (!fir.ref) -> !fir.ref>> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR3]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.embox [[ADDR6]](%{{.*}}) : (!fir.ref>, !fir.shape<1>) -> !fir.box> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR9]] : !fir.ref>>> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR12]] : !fir.ref>>>> -!CHECK-DAG: %{{.*}} = fir.convert [[ADDR15]] : (!fir.ref>) -> !fir.ref -!CHECK-DAG: %{{.*}} = fir.embox [[ADDR18]](%{{.*}}) : (!fir.ref>>, !fir.shape<1>) -> !fir.box>> - print *, a, b, c, d, e, f - - !$omp parallel -!CHECK: [[ADDR77:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: [[ADDR78:%.*]] = fir.convert [[ADDR77]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[ADDR79:%.*]] = fir.coordinate_of [[ADDR78]], [[C0:%.*]] : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR80:%.*]] = fir.convert [[ADDR79:%.*]] : (!fir.ref) -> !fir.ref -!CHECK-DAG: [[ADDR81:%.*]] = fir.convert [[ADDR77]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[ADDR82:%.*]] = fir.coordinate_of [[ADDR81]], [[C1:%.*]] : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR83:%.*]] = fir.convert [[ADDR82:%.*]] : (!fir.ref) -> !fir.ref> -!CHECK-DAG: [[ADDR84:%.*]] = fir.convert [[ADDR77]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[ADDR85:%.*]] = fir.coordinate_of [[ADDR84]], [[C2:%.*]] : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR86:%.*]] = fir.convert [[ADDR85:%.*]] : (!fir.ref) -> !fir.ref>>> -!CHECK-DAG: [[ADDR87:%.*]] = fir.convert [[ADDR77]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[ADDR88:%.*]] = fir.coordinate_of [[ADDR87]], [[C3:%.*]] : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR89:%.*]] = fir.convert [[ADDR88:%.*]] : (!fir.ref) -> !fir.ref>>>> -!CHECK-DAG: [[ADDR90:%.*]] = fir.convert [[ADDR77]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[ADDR91:%.*]] = fir.coordinate_of [[ADDR90]], [[C4:%.*]] : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR92:%.*]] = fir.convert [[ADDR91:%.*]] : (!fir.ref) -> !fir.ref> -!CHECK-DAG: [[ADDR93:%.*]] = fir.convert [[ADDR77]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[ADDR94:%.*]] = fir.coordinate_of [[ADDR93]], [[C5:%.*]] : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR95:%.*]] = fir.convert [[ADDR94:%.*]] : (!fir.ref) -> !fir.ref>> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR80]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.embox [[ADDR83]](%{{.*}}) : (!fir.ref>, !fir.shape<1>) -> !fir.box> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR86]] : !fir.ref>>> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR89]] : !fir.ref>>>> -!CHECK-DAG: %{{.*}} = fir.convert [[ADDR92]] : (!fir.ref>) -> !fir.ref -!CHECK-DAG: %{{.*}} = fir.embox [[ADDR95]](%{{.*}}) : (!fir.ref>>, !fir.shape<1>) -> !fir.box>> - print *, a, b, c, d, e, f - !$omp end parallel - -!CHECK-DAG: %{{.*}} = fir.load [[ADDR3]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.embox [[ADDR6]](%{{.*}}) : (!fir.ref>, !fir.shape<1>) -> !fir.box> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR9]] : !fir.ref>>> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR12]] : !fir.ref>>>> -!CHECK-DAG: %{{.*}} = fir.convert [[ADDR15]] : (!fir.ref>) -> !fir.ref -!CHECK-DAG: %{{.*}} = fir.embox [[ADDR18]](%{{.*}}) : (!fir.ref>>, !fir.shape<1>) -> !fir.box>> - print *, a, b, c, d, e, f - - end -end diff --git a/flang/test/Lower/OpenMP/FIR/threadprivate-integer-different-kinds.f90 b/flang/test/Lower/OpenMP/FIR/threadprivate-integer-different-kinds.f90 deleted file mode 100644 index 39c77406cc22c..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/threadprivate-integer-different-kinds.f90 +++ /dev/null @@ -1,67 +0,0 @@ -! This test checks lowering of OpenMP Threadprivate Directive. -! Test for variables with different kind. - -!REQUIRES: shell -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -program test - integer, save :: i - integer(kind=1), save :: i1 - integer(kind=2), save :: i2 - integer(kind=4), save :: i4 - integer(kind=8), save :: i8 - integer(kind=16), save :: i16 - -!CHECK-DAG: [[ADDR0:%.*]] = fir.address_of(@_QFEi) : !fir.ref -!CHECK-DAG: [[NEWADDR0:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR1:%.*]] = fir.address_of(@_QFEi1) : !fir.ref -!CHECK-DAG: [[NEWADDR1:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR2:%.*]] = fir.address_of(@_QFEi16) : !fir.ref -!CHECK-DAG: [[NEWADDR2:%.*]] = omp.threadprivate [[ADDR2]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR3:%.*]] = fir.address_of(@_QFEi2) : !fir.ref -!CHECK-DAG: [[NEWADDR3:%.*]] = omp.threadprivate [[ADDR3]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR4:%.*]] = fir.address_of(@_QFEi4) : !fir.ref -!CHECK-DAG: [[NEWADDR4:%.*]] = omp.threadprivate [[ADDR4]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR5:%.*]] = fir.address_of(@_QFEi8) : !fir.ref -!CHECK-DAG: [[NEWADDR5:%.*]] = omp.threadprivate [[ADDR5]] : !fir.ref -> !fir.ref - !$omp threadprivate(i, i1, i2, i4, i8, i16) - -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR0]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR1]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR2]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR3]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR4]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR5]] : !fir.ref - print *, i, i1, i2, i4, i8, i16 - - !$omp parallel -!CHECK-DAG: [[ADDR39:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR40:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR41:%.*]] = omp.threadprivate [[ADDR2]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR42:%.*]] = omp.threadprivate [[ADDR3]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR43:%.*]] = omp.threadprivate [[ADDR4]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR44:%.*]] = omp.threadprivate [[ADDR5]] : !fir.ref -> !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[ADDR39]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[ADDR40]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[ADDR41]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[ADDR42]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[ADDR43]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[ADDR44]] : !fir.ref - print *, i, i1, i2, i4, i8, i16 - !$omp end parallel - -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR0]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR1]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR2]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR3]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR4]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR5]] : !fir.ref - print *, i, i1, i2, i4, i8, i16 - -!CHECK-DAG: fir.global internal @_QFEi : i32 { -!CHECK-DAG: fir.global internal @_QFEi1 : i8 { -!CHECK-DAG: fir.global internal @_QFEi16 : i128 { -!CHECK-DAG: fir.global internal @_QFEi2 : i16 { -!CHECK-DAG: fir.global internal @_QFEi4 : i32 { -!CHECK-DAG: fir.global internal @_QFEi8 : i64 { -end diff --git a/flang/test/Lower/OpenMP/FIR/threadprivate-non-global.f90 b/flang/test/Lower/OpenMP/FIR/threadprivate-non-global.f90 deleted file mode 100644 index b089693b2097c..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/threadprivate-non-global.f90 +++ /dev/null @@ -1,91 +0,0 @@ -! This test checks lowering of OpenMP Threadprivate Directive. -! Test for non-character non-SAVEd non-initialized scalars with or without -! allocatable or pointer attribute in main program. - -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -program test - integer :: x - real :: y - logical :: z - complex :: w - integer, pointer :: a - real, allocatable :: b - -!CHECK-DAG: [[ADDR0:%.*]] = fir.address_of(@_QFEa) : !fir.ref>> -!CHECK-DAG: [[NEWADDR0:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref>> -> !fir.ref>> -!CHECK-DAG: [[ADDR1:%.*]] = fir.address_of(@_QFEb) : !fir.ref>> -!CHECK-DAG: [[NEWADDR1:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref>> -> !fir.ref>> -!CHECK-DAG: [[ADDR2:%.*]] = fir.address_of(@_QFEw) : !fir.ref> -!CHECK-DAG: [[NEWADDR2:%.*]] = omp.threadprivate [[ADDR2]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: [[ADDR3:%.*]] = fir.address_of(@_QFEx) : !fir.ref -!CHECK-DAG: [[NEWADDR3:%.*]] = omp.threadprivate [[ADDR3]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR4:%.*]] = fir.address_of(@_QFEy) : !fir.ref -!CHECK-DAG: [[NEWADDR4:%.*]] = omp.threadprivate [[ADDR4]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR5:%.*]] = fir.address_of(@_QFEz) : !fir.ref> -!CHECK-DAG: [[NEWADDR5:%.*]] = omp.threadprivate [[ADDR5]] : !fir.ref> -> !fir.ref> - !$omp threadprivate(x, y, z, w, a, b) - - call sub(a, b) - -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR3]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR4]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR5]] : !fir.ref> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR2]] : !fir.ref> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR0]] : !fir.ref>> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR1]] : !fir.ref>> - print *, x, y, z, w, a, b - - !$omp parallel -!CHECK-DAG: [[ADDR68:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref>> -> !fir.ref>> -!CHECK-DAG: [[ADDR69:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref>> -> !fir.ref>> -!CHECK-DAG: [[ADDR70:%.*]] = omp.threadprivate [[ADDR2]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: [[ADDR71:%.*]] = omp.threadprivate [[ADDR3]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR72:%.*]] = omp.threadprivate [[ADDR4]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR73:%.*]] = omp.threadprivate [[ADDR5]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR71]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[ADDR72]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[ADDR73]] : !fir.ref> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR70]] : !fir.ref> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR68]] : !fir.ref>> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR69]] : !fir.ref>> - print *, x, y, z, w, a, b - !$omp end parallel - -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR3]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR4]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR5]] : !fir.ref> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR2]] : !fir.ref> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR0]] : !fir.ref>> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR1]] : !fir.ref>> - print *, x, y, z, w, a, b - -!CHECK: return - -!CHECK-DAG: fir.global internal @_QFEa : !fir.box> { -!CHECK-DAG: [[Z0:%.*]] = fir.zero_bits !fir.ptr -!CHECK-DAG: [[E0:%.*]] = fir.embox [[Z0]] : (!fir.ptr) -> !fir.box> -!CHECK-DAG: fir.has_value [[E0]] : !fir.box> -!CHECK-DAG: } -!CHECK-DAG: fir.global internal @_QFEb : !fir.box> { -!CHECK-DAG: [[Z1:%.*]] = fir.zero_bits !fir.heap -!CHECK-DAG: [[E1:%.*]] = fir.embox [[Z1]] : (!fir.heap) -> !fir.box> -!CHECK-DAG: fir.has_value [[E1]] : !fir.box> -!CHECK-DAG: } -!CHECK-DAG: fir.global internal @_QFEw : !fir.complex<4> { -!CHECK-DAG: [[Z2:%.*]] = fir.undefined !fir.complex<4> -!CHECK-DAG: fir.has_value [[Z2]] : !fir.complex<4> -!CHECK-DAG: } -!CHECK-DAG: fir.global internal @_QFEx : i32 { -!CHECK-DAG: [[Z3:%.*]] = fir.undefined i32 -!CHECK-DAG: fir.has_value [[Z3]] : i32 -!CHECK-DAG: } -!CHECK-DAG: fir.global internal @_QFEy : f32 { -!CHECK-DAG: [[Z4:%.*]] = fir.undefined f32 -!CHECK-DAG: fir.has_value [[Z4]] : f32 -!CHECK-DAG: } -!CHECK-DAG: fir.global internal @_QFEz : !fir.logical<4> { -!CHECK-DAG: [[Z5:%.*]] = fir.undefined !fir.logical<4> -!CHECK-DAG: fir.has_value [[Z5]] : !fir.logical<4> -!CHECK-DAG: } -end diff --git a/flang/test/Lower/OpenMP/FIR/threadprivate-pointer-allocatable.f90 b/flang/test/Lower/OpenMP/FIR/threadprivate-pointer-allocatable.f90 deleted file mode 100644 index fd33c20f9f93d..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/threadprivate-pointer-allocatable.f90 +++ /dev/null @@ -1,51 +0,0 @@ -! This test checks lowering of OpenMP Threadprivate Directive. -! Test for allocatable and pointer variables. - -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -module test - integer, pointer :: x(:), m - real, allocatable :: y(:), n - - !$omp threadprivate(x, y, m, n) - -!CHECK-DAG: fir.global @_QMtestEm : !fir.box> { -!CHECK-DAG: fir.global @_QMtestEn : !fir.box> { -!CHECK-DAG: fir.global @_QMtestEx : !fir.box>> { -!CHECK-DAG: fir.global @_QMtestEy : !fir.box>> { - -contains - subroutine sub() -!CHECK-DAG: [[ADDR0:%.*]] = fir.address_of(@_QMtestEm) : !fir.ref>> -!CHECK-DAG: [[NEWADDR0:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref>> -> !fir.ref>> -!CHECK-DAG: [[ADDR1:%.*]] = fir.address_of(@_QMtestEn) : !fir.ref>> -!CHECK-DAG: [[NEWADDR1:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref>> -> !fir.ref>> -!CHECK-DAG: [[ADDR2:%.*]] = fir.address_of(@_QMtestEx) : !fir.ref>>> -!CHECK-DAG: [[NEWADDR2:%.*]] = omp.threadprivate [[ADDR2]] : !fir.ref>>> -> !fir.ref>>> -!CHECK-DAG: [[ADDR3:%.*]] = fir.address_of(@_QMtestEy) : !fir.ref>>> -!CHECK-DAG: [[NEWADDR3:%.*]] = omp.threadprivate [[ADDR3]] : !fir.ref>>> -> !fir.ref>>> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR2]] : !fir.ref>>> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR3]] : !fir.ref>>> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR0]] : !fir.ref>> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR1]] : !fir.ref>> - print *, x, y, m, n - - !$omp parallel -!CHECK-DAG: [[ADDR54:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref>> -> !fir.ref>> -!CHECK-DAG: [[ADDR55:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref>> -> !fir.ref>> -!CHECK-DAG: [[ADDR56:%.*]] = omp.threadprivate [[ADDR2]] : !fir.ref>>> -> !fir.ref>>> -!CHECK-DAG: [[ADDR57:%.*]] = omp.threadprivate [[ADDR3]] : !fir.ref>>> -> !fir.ref>>> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR56]] : !fir.ref>>> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR57]] : !fir.ref>>> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR54]] : !fir.ref>> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR55]] : !fir.ref>> - print *, x, y, m, n - !$omp end parallel - -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR2]] : !fir.ref>>> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR3]] : !fir.ref>>> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR0]] : !fir.ref>> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR1]] : !fir.ref>> - print *, x, y, m, n - end -end diff --git a/flang/test/Lower/OpenMP/FIR/threadprivate-real-logical-complex-derivedtype.f90 b/flang/test/Lower/OpenMP/FIR/threadprivate-real-logical-complex-derivedtype.f90 deleted file mode 100644 index 749fe5c8bf54d..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/threadprivate-real-logical-complex-derivedtype.f90 +++ /dev/null @@ -1,58 +0,0 @@ -! This test checks lowering of OpenMP Threadprivate Directive. -! Test for real, logical, complex, and derived type. - -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -module test - type my_type - integer :: t_i - real :: t_arr(5) - end type my_type - real :: x - complex :: y - logical :: z - type(my_type) :: t - - !$omp threadprivate(x, y, z, t) - -!CHECK-DAG: fir.global @_QMtestEt : !fir.type<_QMtestTmy_type{t_i:i32,t_arr:!fir.array<5xf32>}> { -!CHECK-DAG: fir.global @_QMtestEx : f32 { -!CHECK-DAG: fir.global @_QMtestEy : !fir.complex<4> { -!CHECK-DAG: fir.global @_QMtestEz : !fir.logical<4> { - -contains - subroutine sub() -!CHECK-DAG: [[ADDR0:%.*]] = fir.address_of(@_QMtestEt) : !fir.ref}>> -!CHECK-DAG: [[NEWADDR0:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref}>> -> !fir.ref}>> -!CHECK-DAG: [[ADDR1:%.*]] = fir.address_of(@_QMtestEx) : !fir.ref -!CHECK-DAG: [[NEWADDR1:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR2:%.*]] = fir.address_of(@_QMtestEy) : !fir.ref> -!CHECK-DAG: [[NEWADDR2:%.*]] = omp.threadprivate [[ADDR2]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: [[ADDR3:%.*]] = fir.address_of(@_QMtestEz) : !fir.ref> -!CHECK-DAG: [[NEWADDR3:%.*]] = omp.threadprivate [[ADDR3]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR1]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR2]] : !fir.ref> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR3]] : !fir.ref> -!CHECK-DAG: %{{.*}} = fir.coordinate_of [[NEWADDR0]] - print *, x, y, z, t%t_i - - !$omp parallel -!CHECK-DAG: [[ADDR38:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref}>> -> !fir.ref}>> -!CHECK-DAG: [[ADDR39:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR40:%.*]] = omp.threadprivate [[ADDR2]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: [[ADDR41:%.*]] = omp.threadprivate [[ADDR3]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR39]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[ADDR40]] : !fir.ref> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR41]] : !fir.ref> -!CHECK-DAG: %{{.*}} = fir.coordinate_of [[ADDR38]] - print *, x, y, z, t%t_i - !$omp end parallel - -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR1]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR2]] : !fir.ref> -!CHECK-DAG: %{{.*}} = fir.load [[NEWADDR3]] : !fir.ref> -!CHECK-DAG: %{{.*}} = fir.coordinate_of [[NEWADDR0]] - print *, x, y, z, t%t_i - - end -end diff --git a/flang/test/Lower/OpenMP/FIR/threadprivate-use-association-2.f90 b/flang/test/Lower/OpenMP/FIR/threadprivate-use-association-2.f90 deleted file mode 100644 index 6db5735c21f1e..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/threadprivate-use-association-2.f90 +++ /dev/null @@ -1,39 +0,0 @@ -! This test checks lowering of OpenMP Threadprivate Directive. -! Test for threadprivate variable double use in use association. - -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s -!RUN: bbc -emit-fir -hlfir=false -fopenmp %s -o - | FileCheck %s - -! CHECK-LABEL: fir.global @_QMmEx : i32 -module m - integer :: x - !$omp threadprivate(x) -end - -! CHECK-LABEL: func.func @_QMm2Ptest() { -! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QMmEx) : !fir.ref -! CHECK: %[[VAL_1:.*]] = omp.threadprivate %[[VAL_0]] : !fir.ref -> !fir.ref -! CHECK: fir.call @_QPbar(%[[VAL_1]]) {{.*}}: (!fir.ref) -> () -! CHECK: return -! CHECK: } -! -! CHECK-LABEL: func.func private @_QMm2FtestPinternal_test() {{.*}} { -! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QMmEx) : !fir.ref -! CHECK: %[[VAL_1:.*]] = omp.threadprivate %[[VAL_0]] : !fir.ref -> !fir.ref -! CHECK: fir.call @_QPbar(%[[VAL_1]]) {{.*}}: (!fir.ref) -> () -! CHECK: return -! CHECK: } - -module m2 - use m - contains - subroutine test() - use m - call bar(x) - contains - subroutine internal_test() - use m - call bar(x) - end - end -end diff --git a/flang/test/Lower/OpenMP/FIR/threadprivate-use-association.f90 b/flang/test/Lower/OpenMP/FIR/threadprivate-use-association.f90 deleted file mode 100644 index 685237430a1c4..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/threadprivate-use-association.f90 +++ /dev/null @@ -1,74 +0,0 @@ -! This test checks lowering of OpenMP Threadprivate Directive. -! Test for threadprivate variable in use association. - -!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -!CHECK-DAG: fir.global common @blk_(dense<0> : vector<24xi8>) : !fir.array<24xi8> -!CHECK-DAG: fir.global @_QMtestEy : f32 { - -module test - integer :: x - real :: y, z(5) - common /blk/ x, z - - !$omp threadprivate(y, /blk/) - -contains - subroutine sub() -! CHECK-LABEL: @_QMtestPsub -!CHECK-DAG: [[ADDR0:%.*]] = fir.address_of(@blk_) : !fir.ref> -!CHECK-DAG: [[NEWADDR0:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: [[ADDR1:%.*]] = fir.address_of(@_QMtestEy) : !fir.ref -!CHECK-DAG: [[NEWADDR1:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref -> !fir.ref - - !$omp parallel -!CHECK-DAG: [[ADDR2:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: [[ADDR3:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR4:%.*]] = fir.convert [[ADDR2]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[ADDR5:%.*]] = fir.coordinate_of [[ADDR4]], %{{.*}} : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR6:%.*]] = fir.convert [[ADDR5:%.*]] : (!fir.ref) -> !fir.ref -!CHECK-DAG: [[ADDR7:%.*]] = fir.convert [[ADDR2]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[ADDR8:%.*]] = fir.coordinate_of [[ADDR7]], %{{.*}} : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR9:%.*]] = fir.convert [[ADDR8:%.*]] : (!fir.ref) -> !fir.ref> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR6]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[ADDR3]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.embox [[ADDR9]](%{{.*}}) : (!fir.ref>, !fir.shape<1>) -> !fir.box> - print *, x, y, z - !$omp end parallel - end -end - -program main - use test - integer :: x1 - real :: z1(5) - common /blk/ x1, z1 - - !$omp threadprivate(/blk/) - - call sub() - -! CHECK-LABEL: @_QQmain() -!CHECK-DAG: [[ADDR0:%.*]] = fir.address_of(@blk_) : !fir.ref> -!CHECK-DAG: [[NEWADDR0:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: [[ADDR1:%.*]] = fir.address_of(@blk_) : !fir.ref> -!CHECK-DAG: [[NEWADDR1:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: [[ADDR2:%.*]] = fir.address_of(@_QMtestEy) : !fir.ref -!CHECK-DAG: [[NEWADDR2:%.*]] = omp.threadprivate [[ADDR2]] : !fir.ref -> !fir.ref - - !$omp parallel -!CHECK-DAG: [[ADDR4:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref> -> !fir.ref> -!CHECK-DAG: [[ADDR5:%.*]] = omp.threadprivate [[ADDR2]] : !fir.ref -> !fir.ref -!CHECK-DAG: [[ADDR6:%.*]] = fir.convert [[ADDR4]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[ADDR7:%.*]] = fir.coordinate_of [[ADDR6]], %{{.*}} : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR8:%.*]] = fir.convert [[ADDR7:%.*]] : (!fir.ref) -> !fir.ref -!CHECK-DAG: [[ADDR9:%.*]] = fir.convert [[ADDR4]] : (!fir.ref>) -> !fir.ref> -!CHECK-DAG: [[ADDR10:%.*]] = fir.coordinate_of [[ADDR9]], %{{.*}} : (!fir.ref>, index) -> !fir.ref -!CHECK-DAG: [[ADDR11:%.*]] = fir.convert [[ADDR10:%.*]] : (!fir.ref) -> !fir.ref> -!CHECK-DAG: %{{.*}} = fir.load [[ADDR8]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.load [[ADDR5]] : !fir.ref -!CHECK-DAG: %{{.*}} = fir.embox [[ADDR11]](%{{.*}}) : (!fir.ref>, !fir.shape<1>) -> !fir.box> - print *, x1, y, z1 - !$omp end parallel - -end diff --git a/flang/test/Lower/OpenMP/FIR/unstructured.f90 b/flang/test/Lower/OpenMP/FIR/unstructured.f90 deleted file mode 100644 index 6d1c9aab14640..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/unstructured.f90 +++ /dev/null @@ -1,365 +0,0 @@ -! Test unstructured code adjacent to and inside OpenMP constructs. - -! RUN: bbc %s -fopenmp -emit-fir -hlfir=false -o "-" | FileCheck %s - -! CHECK-LABEL: func @_QPss1{{.*}} { -! CHECK: br ^bb1 -! CHECK: ^bb1: // 2 preds: ^bb0, ^bb4 -! CHECK: cond_br %{{[0-9]*}}, ^bb2, ^bb5 -! CHECK: ^bb2: // pred: ^bb1 -! CHECK: cond_br %{{[0-9]*}}, ^bb3, ^bb4 -! CHECK: ^bb4: // pred: ^bb2 -! CHECK: fir.call @_FortranAioBeginExternalListOutput -! CHECK: br ^bb1 -! CHECK: ^bb5: // 2 preds: ^bb1, ^bb3 -! CHECK: omp.master { -! CHECK: @_FortranAioBeginExternalListOutput -! CHECK: omp.terminator -! CHECK: } -! CHECK: @_FortranAioBeginExternalListOutput -! CHECK: } -subroutine ss1(n) ! unstructured code followed by a structured OpenMP construct - do i = 1, 3 - if (i .eq. n) exit - print*, 'ss1-A', i - enddo - !$omp master - print*, 'ss1-B', i - !$omp end master - print* -end - -! CHECK-LABEL: func @_QPss2{{.*}} { -! CHECK: omp.master { -! CHECK: @_FortranAioBeginExternalListOutput -! CHECK: br ^bb1 -! CHECK: ^bb1: // 2 preds: ^bb0, ^bb4 -! CHECK: cond_br %{{[0-9]*}}, ^bb2, ^bb5 -! CHECK: ^bb2: // pred: ^bb1 -! CHECK: cond_br %{{[0-9]*}}, ^bb3, ^bb4 -! CHECK: ^bb3: // pred: ^bb2 -! CHECK: @_FortranAioBeginExternalListOutput -! CHECK: br ^bb1 -! CHECK: ^bb5: // 2 preds: ^bb1, ^bb3 -! CHECK: omp.terminator -! CHECK: } -! CHECK: @_FortranAioBeginExternalListOutput -! CHECK: @_FortranAioBeginExternalListOutput -! CHECK: } -subroutine ss2(n) ! unstructured OpenMP construct; loop exit inside construct - !$omp master - print*, 'ss2-A', n - do i = 1, 3 - if (i .eq. n) exit - print*, 'ss2-B', i - enddo - !$omp end master - print*, 'ss2-C', i - print* -end - -! CHECK-LABEL: func @_QPss3{{.*}} { -! CHECK: omp.parallel { -! CHECK: %[[ALLOCA_K:.*]] = fir.alloca i32 {bindc_name = "k", pinned} -! CHECK: %[[ALLOCA_1:.*]] = fir.alloca i32 {{{.*}}, pinned} -! CHECK: %[[ALLOCA_2:.*]] = fir.alloca i32 {{{.*}}, pinned} -! CHECK: br ^bb1 -! CHECK: ^bb1: // 2 preds: ^bb0, ^bb3 -! CHECK: cond_br %{{[0-9]*}}, ^bb2, ^bb4 -! CHECK: ^bb2: // pred: ^bb1 -! CHECK: omp.wsloop { -! CHECK: omp.loop_nest (%[[ARG1:.*]]) : {{.*}} { -! CHECK: fir.store %[[ARG1]] to %[[ALLOCA_2]] : !fir.ref -! CHECK: @_FortranAioBeginExternalListOutput -! CHECK: %[[LOAD_1:.*]] = fir.load %[[ALLOCA_2]] : !fir.ref -! CHECK: @_FortranAioOutputInteger32(%{{.*}}, %[[LOAD_1]]) -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.wsloop { -! CHECK: omp.loop_nest (%[[ARG2:.*]]) : {{.*}} { -! CHECK: fir.store %[[ARG2]] to %[[ALLOCA_1]] : !fir.ref -! CHECK: br ^bb1 -! CHECK: ^bb2: // 2 preds: ^bb1, ^bb5 -! CHECK: cond_br %{{[0-9]*}}, ^bb3, ^bb6 -! CHECK: ^bb3: // pred: ^bb2 -! CHECK: cond_br %{{[0-9]*}}, ^bb4, ^bb5 -! CHECK: ^bb4: // pred: ^bb3 -! CHECK: @_FortranAioBeginExternalListOutput -! CHECK: %[[LOAD_2:.*]] = fir.load %[[ALLOCA_K]] : !fir.ref -! CHECK: @_FortranAioOutputInteger32(%{{.*}}, %[[LOAD_2]]) -! CHECK: br ^bb2 -! CHECK: ^bb6: // 2 preds: ^bb2, ^bb4 -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: br ^bb1 -! CHECK: ^bb4: // pred: ^bb1 -! CHECK: omp.terminator -! CHECK: } -! CHECK: } -subroutine ss3(n) ! nested unstructured OpenMP constructs - !$omp parallel - do i = 1, 3 - !$omp do - do k = 1, 3 - print*, 'ss3-A', k - enddo - !$omp end do - !$omp do - do j = 1, 3 - do k = 1, 3 - if (k .eq. n) exit - print*, 'ss3-B', k - enddo - enddo - !$omp end do - enddo - !$omp end parallel -end - -! CHECK-LABEL: func @_QPss4{{.*}} { -! CHECK: omp.parallel { -! CHECK: %[[ALLOCA:.*]] = fir.alloca i32 {{{.*}}, pinned} -! CHECK: omp.wsloop { -! CHECK: omp.loop_nest (%[[ARG:.*]]) : {{.*}} { -! CHECK: fir.store %[[ARG]] to %[[ALLOCA]] : !fir.ref -! CHECK: %[[COND:.*]] = arith.cmpi eq, %{{.*}}, %{{.*}} -! CHECK: %[[COND_XOR:.*]] = arith.xori %[[COND]], %{{.*}} -! CHECK: fir.if %[[COND_XOR]] { -! CHECK: @_FortranAioBeginExternalListOutput -! CHECK: %[[LOAD:.*]] = fir.load %[[ALLOCA]] : !fir.ref -! CHECK: @_FortranAioOutputInteger32(%{{.*}}, %[[LOAD]]) -! CHECK: } else { -! CHECK: } -! CHECK-NEXT: omp.yield -! CHECK-NEXT: } -! CHECK-NEXT: omp.terminator -! CHECK-NEXT: } -! CHECK: omp.terminator -! CHECK-NEXT: } -subroutine ss4(n) ! CYCLE in OpenMP wsloop constructs - !$omp parallel - do i = 1, 3 - !$omp do - do j = 1, 3 - if (j .eq. n) cycle - print*, 'ss4', j - enddo - !$omp end do - enddo - !$omp end parallel -end - -! CHECK-LABEL: func @_QPss5() { -! CHECK: omp.parallel { -! CHECK: omp.wsloop { -! CHECK: omp.loop_nest {{.*}} { -! CHECK: br ^[[BB1:.*]] -! CHECK: ^[[BB1]]: -! CHECK: br ^[[BB2:.*]] -! CHECK: ^[[BB2]]: -! CHECK: cond_br %{{.*}}, ^[[BB3:.*]], ^[[BB6:.*]] -! CHECK: ^[[BB3]]: -! CHECK: cond_br %{{.*}}, ^[[BB4:.*]], ^[[BB3:.*]] -! CHECK: ^[[BB4]]: -! CHECK: br ^[[BB6]] -! CHECK: ^[[BB3]]: -! CHECK: br ^[[BB2]] -! CHECK: ^[[BB6]]: -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -subroutine ss5() ! EXIT inside OpenMP wsloop (inside parallel) - integer :: x - !$omp parallel private(x) - !$omp do - do j = 1, 3 - x = j * i - do k = 1, 3 - if (k .eq. n) exit - x = k - x = x + k - enddo - x = j - 222 - enddo - !$omp end do - !$omp end parallel -end - -! CHECK-LABEL: func @_QPss6() { -! CHECK: omp.parallel { -! CHECK: br ^[[BB1_OUTER:.*]] -! CHECK: ^[[BB1_OUTER]]: -! CHECK: cond_br %{{.*}}, ^[[BB2_OUTER:.*]], ^[[BB3_OUTER:.*]] -! CHECK: ^[[BB2_OUTER]]: -! CHECK: omp.wsloop { -! CHECK: omp.loop_nest {{.*}} { -! CHECK: br ^[[BB1:.*]] -! CHECK: ^[[BB1]]: -! CHECK: br ^[[BB2:.*]] -! CHECK: ^[[BB2]]: -! CHECK: cond_br %{{.*}}, ^[[BB3:.*]], ^[[BB6:.*]] -! CHECK: ^[[BB3]]: -! CHECK: cond_br %{{.*}}, ^[[BB4:.*]], ^[[BB5:.*]] -! CHECK: ^[[BB4]]: -! CHECK: br ^[[BB6]] -! CHECK: ^[[BB5]] -! CHECK: br ^[[BB2]] -! CHECK: ^[[BB6]]: -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: br ^[[BB1_OUTER]] -! CHECK: ^[[BB3_OUTER]]: -! CHECK: omp.terminator -! CHECK: } -subroutine ss6() ! EXIT inside OpenMP wsloop in a do loop (inside parallel) - integer :: x - !$omp parallel private(x) - do i = 1, 3 - !$omp do - do j = 1, 3 - x = j * i - do k = 1, 3 - if (k .eq. n) exit - x = k - x = x + k - enddo - x = j - 222 - enddo - !$omp end do - enddo - !$omp end parallel -end - -! CHECK-LABEL: func @_QPss7() { -! CHECK: br ^[[BB1_OUTER:.*]] -! CHECK: ^[[BB1_OUTER]]: -! CHECK: cond_br %{{.*}}, ^[[BB2_OUTER:.*]], ^[[BB3_OUTER:.*]] -! CHECK-NEXT: ^[[BB2_OUTER:.*]]: -! CHECK: omp.parallel { -! CHECK: omp.wsloop { -! CHECK: omp.loop_nest {{.*}} { -! CHECK: br ^[[BB1:.*]] -! CHECK-NEXT: ^[[BB1]]: -! CHECK: br ^[[BB2:.*]] -! CHECK-NEXT: ^[[BB2]]: -! CHECK: cond_br %{{.*}}, ^[[BB3:.*]], ^[[BB6:.*]] -! CHECK-NEXT: ^[[BB3]]: -! CHECK: cond_br %{{.*}}, ^[[BB4:.*]], ^[[BB5:.*]] -! CHECK-NEXT: ^[[BB4]]: -! CHECK: br ^[[BB6]] -! CHECK-NEXT: ^[[BB5]]: -! CHECK: br ^[[BB2]] -! CHECK-NEXT: ^[[BB6]]: -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: br ^[[BB1_OUTER]] -! CHECK-NEXT: ^[[BB3_OUTER]]: -! CHECK-NEXT: return -subroutine ss7() ! EXIT inside OpenMP parallel do (inside do loop) - integer :: x - do i = 1, 3 - !$omp parallel do private(x) - do j = 1, 3 - x = j * i - do k = 1, 3 - if (k .eq. n) exit - x = k - x = x + k - enddo - enddo - !$omp end parallel do - enddo -end - -! CHECK-LABEL: func @_QPss8() { -! CHECK: omp.parallel { -! CHECK: omp.wsloop { -! CHECK: omp.loop_nest {{.*}} { -! CHECK: br ^[[BB1:.*]] -! CHECK-NEXT: ^[[BB1]]: -! CHECK: br ^[[BB2:.*]] -! CHECK: ^[[BB2]]: -! CHECK: cond_br %{{.*}}, ^[[BB3:.*]], ^[[BB6:.*]] -! CHECK: ^[[BB3]]: -! CHECK: cond_br %{{.*}}, ^[[BB4:.*]], ^[[BB5:.*]] -! CHECK: ^[[BB4]]: -! CHECK-NEXT: br ^[[BB6]] -! CHECK: ^[[BB5]]: -! CHECK: br ^[[BB2]] -! CHECK-NEXT: ^[[BB6]]: -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -subroutine ss8() ! EXIT inside OpenMP parallel do - integer :: x - !$omp parallel do private(x) - do j = 1, 3 - x = j * i - do k = 1, 3 - if (k .eq. n) exit - x = k - x = x + k - enddo - enddo - !$omp end parallel do -end - -! CHECK-LABEL: func @_QPss9() { -! CHECK: omp.parallel { -! CHECK-NEXT: omp.parallel { -! CHECK: br ^[[BB1:.*]] -! CHECK: ^[[BB1]]: -! CHECK: cond_br %{{.*}}, ^[[BB2:.*]], ^[[BB5:.*]] -! CHECK-NEXT: ^[[BB2]]: -! CHECK: cond_br %{{.*}}, ^[[BB3:.*]], ^[[BB4:.*]] -! CHECK-NEXT: ^[[BB3]]: -! CHECK-NEXT: br ^[[BB5]] -! CHECK-NEXT: ^[[BB4]]: -! CHECK: br ^[[BB1]] -! CHECK-NEXT: ^[[BB5]]: -! CHECK: omp.terminator -! CHECK-NEXT: } -! CHECK: omp.terminator -! CHECK-NEXT } -! CHECK: } -subroutine ss9() ! EXIT inside OpenMP parallel (inside parallel) - integer :: x - !$omp parallel - !$omp parallel private(x) - do k = 1, 3 - if (k .eq. n) exit - x = k - x = x + k - end do - !$omp end parallel - !$omp end parallel -end - -! CHECK-LABEL: func @_QQmain -program p - call ss1(2) - call ss2(2) - call ss3(2) - call ss4(2) - call ss5() - call ss6() - call ss7() - call ss8() - call ss9() -end diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-chunks.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-chunks.f90 deleted file mode 100644 index e4b85fb447767..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-chunks.f90 +++ /dev/null @@ -1,84 +0,0 @@ -! This test checks that chunk size is passed correctly when lowering of -! OpenMP DO Directive(Worksharing) with chunk size - -! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s - -program wsloop - integer :: i - integer :: chunk - -! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "wsloop"} { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "chunk", uniq_name = "_QFEchunk"} - -!$OMP DO SCHEDULE(static, 4) - -do i=1, 9 - print*, i - -! CHECK: %[[VAL_2:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_3:.*]] = arith.constant 9 : i32 -! CHECK: %[[VAL_4:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_5:.*]] = arith.constant 4 : i32 -! CHECK: omp.wsloop schedule(static = %[[VAL_5]] : i32) nowait { -! CHECK-NEXT: omp.loop_nest (%[[ARG0:.*]]) : i32 = (%[[VAL_2]]) to (%[[VAL_3]]) inclusive step (%[[VAL_4]]) { -! CHECK: fir.store %[[ARG0]] to %[[STORE_IV:.*]] : !fir.ref -! CHECK: %[[LOAD_IV:.*]] = fir.load %[[STORE_IV]] : !fir.ref -! CHECK: {{.*}} = fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref, i32) -> i1 -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } - -end do -!$OMP END DO NOWAIT -!$OMP DO SCHEDULE(static, 2+2) - -do i=1, 9 - print*, i*2 - -! CHECK: %[[VAL_14:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_15:.*]] = arith.constant 9 : i32 -! CHECK: %[[VAL_16:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_17:.*]] = arith.constant 4 : i32 -! CHECK: omp.wsloop schedule(static = %[[VAL_17]] : i32) nowait { -! CHECK-NEXT: omp.loop_nest (%[[ARG1:.*]]) : i32 = (%[[VAL_14]]) to (%[[VAL_15]]) inclusive step (%[[VAL_16]]) { -! CHECK: fir.store %[[ARG1]] to %[[STORE_IV1:.*]] : !fir.ref -! CHECK: %[[VAL_24:.*]] = arith.constant 2 : i32 -! CHECK: %[[LOAD_IV1:.*]] = fir.load %[[STORE_IV1]] : !fir.ref -! CHECK: %[[VAL_25:.*]] = arith.muli %[[VAL_24]], %[[LOAD_IV1]] : i32 -! CHECK: {{.*}} = fir.call @_FortranAioOutputInteger32({{.*}}, %[[VAL_25]]) {{.*}}: (!fir.ref, i32) -> i1 -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } - -end do -!$OMP END DO NOWAIT -chunk = 6 -!$OMP DO SCHEDULE(static, chunk) - -do i=1, 9 - print*, i*3 -end do -!$OMP END DO NOWAIT -! CHECK: %[[VAL_28:.*]] = arith.constant 6 : i32 -! CHECK: fir.store %[[VAL_28]] to %[[VAL_0]] : !fir.ref -! CHECK: %[[VAL_29:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_30:.*]] = arith.constant 9 : i32 -! CHECK: %[[VAL_31:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_32:.*]] = fir.load %[[VAL_0]] : !fir.ref -! CHECK: omp.wsloop schedule(static = %[[VAL_32]] : i32) nowait { -! CHECK-NEXT: omp.loop_nest (%[[ARG2:.*]]) : i32 = (%[[VAL_29]]) to (%[[VAL_30]]) inclusive step (%[[VAL_31]]) { -! CHECK: fir.store %[[ARG2]] to %[[STORE_IV2:.*]] : !fir.ref -! CHECK: %[[VAL_39:.*]] = arith.constant 3 : i32 -! CHECK: %[[LOAD_IV2:.*]] = fir.load %[[STORE_IV2]] : !fir.ref -! CHECK: %[[VAL_40:.*]] = arith.muli %[[VAL_39]], %[[LOAD_IV2]] : i32 -! CHECK: {{.*}} = fir.call @_FortranAioOutputInteger32({{.*}}, %[[VAL_40]]) {{.*}}: (!fir.ref, i32) -> i1 -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -end diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-collapse.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-collapse.f90 deleted file mode 100644 index a2ba3ebfe1967..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-collapse.f90 +++ /dev/null @@ -1,66 +0,0 @@ -! This test checks lowering of OpenMP DO Directive(Worksharing) with collapse. - -! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s - -program wsloop_collapse - integer :: i, j, k - integer :: a, b, c - integer :: x -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "a", uniq_name = "_QFEa"} -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "b", uniq_name = "_QFEb"} -! CHECK: %[[VAL_2:.*]] = fir.alloca i32 {bindc_name = "c", uniq_name = "_QFEc"} -! CHECK: %[[VAL_3:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFEi"} -! CHECK: %[[VAL_4:.*]] = fir.alloca i32 {bindc_name = "j", uniq_name = "_QFEj"} -! CHECK: %[[VAL_5:.*]] = fir.alloca i32 {bindc_name = "k", uniq_name = "_QFEk"} -! CHECK: %[[VAL_6:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFEx"} - a=3 -! CHECK: %[[VAL_7:.*]] = arith.constant 3 : i32 -! CHECK: fir.store %[[VAL_7]] to %[[VAL_0]] : !fir.ref - b=2 -! CHECK: %[[VAL_8:.*]] = arith.constant 2 : i32 -! CHECK: fir.store %[[VAL_8]] to %[[VAL_1]] : !fir.ref - c=5 -! CHECK: %[[VAL_9:.*]] = arith.constant 5 : i32 -! CHECK: fir.store %[[VAL_9]] to %[[VAL_2]] : !fir.ref - x=0 -! CHECK: %[[VAL_10:.*]] = arith.constant 0 : i32 -! CHECK: fir.store %[[VAL_10]] to %[[VAL_6]] : !fir.ref - - !$omp do collapse(3) -! CHECK: %[[VAL_20:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_21:.*]] = fir.load %[[VAL_0]] : !fir.ref -! CHECK: %[[VAL_22:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_23:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_24:.*]] = fir.load %[[VAL_1]] : !fir.ref -! CHECK: %[[VAL_25:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_26:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_27:.*]] = fir.load %[[VAL_2]] : !fir.ref -! CHECK: %[[VAL_28:.*]] = arith.constant 1 : i32 - do i = 1, a - do j= 1, b - do k = 1, c -! CHECK: omp.wsloop { -! CHECK-NEXT: omp.loop_nest (%[[ARG0:.*]], %[[ARG1:.*]], %[[ARG2:.*]]) : i32 = (%[[VAL_20]], %[[VAL_23]], %[[VAL_26]]) to (%[[VAL_21]], %[[VAL_24]], %[[VAL_27]]) inclusive step (%[[VAL_22]], %[[VAL_25]], %[[VAL_28]]) { -! CHECK: fir.store %[[ARG0]] to %[[STORE_IV0:.*]] : !fir.ref -! CHECK: fir.store %[[ARG1]] to %[[STORE_IV1:.*]] : !fir.ref -! CHECK: fir.store %[[ARG2]] to %[[STORE_IV2:.*]] : !fir.ref -! CHECK: %[[VAL_12:.*]] = fir.load %[[VAL_6]] : !fir.ref -! CHECK: %[[LOAD_IV0:.*]] = fir.load %[[STORE_IV0]] : !fir.ref -! CHECK: %[[VAL_13:.*]] = arith.addi %[[VAL_12]], %[[LOAD_IV0]] : i32 -! CHECK: %[[LOAD_IV1:.*]] = fir.load %[[STORE_IV1]] : !fir.ref -! CHECK: %[[VAL_14:.*]] = arith.addi %[[VAL_13]], %[[LOAD_IV1]] : i32 -! CHECK: %[[LOAD_IV2:.*]] = fir.load %[[STORE_IV2]] : !fir.ref -! CHECK: %[[VAL_15:.*]] = arith.addi %[[VAL_14]], %[[LOAD_IV2]] : i32 -! CHECK: fir.store %[[VAL_15]] to %[[VAL_6]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } - x = x + i + j + k - end do - end do - end do - !$omp end do -! CHECK: return -! CHECK: } -end program wsloop_collapse diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-monotonic.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-monotonic.f90 deleted file mode 100644 index 941885bdb1e38..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-monotonic.f90 +++ /dev/null @@ -1,38 +0,0 @@ -! This test checks lowering of OpenMP DO Directive (Worksharing) with -! monotonic schedule modifier. - -! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s - -program wsloop_dynamic - integer :: i -!CHECK-LABEL: func @_QQmain() - -!$OMP PARALLEL -!CHECK: omp.parallel { - -!$OMP DO SCHEDULE(monotonic:dynamic) -!CHECK: %[[ALLOCA_IV:.*]] = fir.alloca i32 {{{.*}}, pinned} -!CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32 -!CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32 -!CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32 -!CHECK: omp.wsloop schedule(dynamic, monotonic) nowait { -!CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) { -!CHECK: fir.store %[[I]] to %[[ALLOCA_IV:.*]] : !fir.ref - - do i=1, 9 - print*, i -!CHECK: %[[RTBEGIN:.*]] = fir.call @_FortranAioBeginExternalListOutput -!CHECK: %[[LOAD:.*]] = fir.load %[[ALLOCA_IV]] : !fir.ref -!CHECK: fir.call @_FortranAioOutputInteger32(%[[RTBEGIN]], %[[LOAD]]) {{.*}}: (!fir.ref, i32) -> i1 -!CHECK: fir.call @_FortranAioEndIoStatement(%[[RTBEGIN]]) {{.*}}: (!fir.ref) -> i32 - end do -!CHECK: omp.yield -!CHECK: } -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - -!$OMP END DO NOWAIT -!$OMP END PARALLEL -end diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-nonmonotonic.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-nonmonotonic.f90 deleted file mode 100644 index 96a3e71f34b1e..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-nonmonotonic.f90 +++ /dev/null @@ -1,39 +0,0 @@ -! This test checks lowering of OpenMP DO Directive(Worksharing) with -! non-monotonic schedule modifier. - -! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s - -program wsloop_dynamic - integer :: i -!CHECK-LABEL: func @_QQmain() - - -!$OMP PARALLEL -!CHECK: omp.parallel { - -!$OMP DO SCHEDULE(nonmonotonic:dynamic) -!CHECK: %[[ALLOCA_IV:.*]] = fir.alloca i32 {{{.*}}, pinned} -!CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32 -!CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32 -!CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32 -!CHECK: omp.wsloop schedule(dynamic, nonmonotonic) nowait { -!CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) -!CHECK: fir.store %[[I]] to %[[ALLOCA_IV]] : !fir.ref - - do i=1, 9 - print*, i -!CHECK: %[[RTBEGIN:.*]] = fir.call @_FortranAioBeginExternalListOutput -!CHECK: %[[LOAD:.*]] = fir.load %[[ALLOCA_IV]] : !fir.ref -!CHECK: fir.call @_FortranAioOutputInteger32(%[[RTBEGIN]], %[[LOAD]]) {{.*}}: (!fir.ref, i32) -> i1 -!CHECK: fir.call @_FortranAioEndIoStatement(%[[RTBEGIN]]) {{.*}}: (!fir.ref) -> i32 - end do -!CHECK: omp.yield -!CHECK: } -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - -!$OMP END DO NOWAIT -!$OMP END PARALLEL -end diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-ordered.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-ordered.f90 deleted file mode 100644 index fec027608d991..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-ordered.f90 +++ /dev/null @@ -1,46 +0,0 @@ -! This test checks lowering of worksharing-loop construct with ordered clause. - -! RUN: bbc -fopenmp -emit-fir %s -o - | FileCheck %s - -! This checks lowering ordered clause specified without parameter -subroutine wsloop_ordered_no_para() - integer :: a(10), i - -! CHECK: omp.wsloop ordered(0) { -! CHECK-NEXT: omp.loop_nest (%{{.*}}) : i32 = (%{{.*}}) to (%{{.*}}) inclusive step (%{{.*}}) { -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } - - !$omp do ordered - do i = 2, 10 - !$omp ordered - a(i) = a(i-1) + 1 - !$omp end ordered - end do - !$omp end do - -end - -! This checks lowering ordered clause specified with a parameter -subroutine wsloop_ordered_with_para() - integer :: a(10), i - -! CHECK: func @_QPwsloop_ordered_with_para() { -! CHECK: omp.wsloop ordered(1) { -! CHECK-NEXT: omp.loop_nest (%{{.*}}) : i32 = (%{{.*}}) to (%{{.*}}) inclusive step (%{{.*}}) { -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } - - !$omp do ordered(1) - do i = 2, 10 - !!$omp ordered depend(sink: i-1) - a(i) = a(i-1) + 1 - !!$omp ordered depend(source) - end do - !$omp end do - -end diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-add-byref.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-add-byref.f90 deleted file mode 100644 index b6dfec09007e5..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-add-byref.f90 +++ /dev/null @@ -1,413 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp --force-byref-reduction %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -mmlir --force-byref-reduction %s -o - | FileCheck %s -! NOTE: Assertions have been autogenerated by utils/generate-test-checks.py - -! CHECK-LABEL: omp.declare_reduction @add_reduction_byref_f64 : !fir.ref -! CHECK-SAME: init { -! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): -! CHECK: %[[C0_1:.*]] = arith.constant 0.000000e+00 : f64 -! CHECK: %[[REF:.*]] = fir.alloca f64 -! CHECK: fir.store %[[C0_1]] to %[[REF]] : !fir.ref -! CHECK: omp.yield(%[[REF]] : !fir.ref) - -! CHECK-LABEL: } combiner { -! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref, %[[ARG1:.*]]: !fir.ref): -! CHECK: %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref -! CHECK: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref -! CHECK: %[[RES:.*]] = arith.addf %[[LD0]], %[[LD1]] fastmath : f64 -! CHECK: fir.store %[[RES]] to %[[ARG0]] : !fir.ref -! CHECK: omp.yield(%[[ARG0]] : !fir.ref) -! CHECK: } - -! CHECK-LABEL: omp.declare_reduction @add_reduction_byref_i64 : !fir.ref -! CHECK-SAME: init { -! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): -! CHECK: %[[C0_1:.*]] = arith.constant 0 : i64 -! CHECK: %[[REF:.*]] = fir.alloca i64 -! CHECK: fir.store %[[C0_1]] to %[[REF]] : !fir.ref -! CHECK: omp.yield(%[[REF]] : !fir.ref) - -! CHECK-LABEL: } combiner { -! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref, %[[ARG1:.*]]: !fir.ref): -! CHECK: %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref -! CHECK: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref -! CHECK: %[[RES:.*]] = arith.addi %[[LD0]], %[[LD1]] : i64 -! CHECK: fir.store %[[RES]] to %[[ARG0]] : !fir.ref -! CHECK: omp.yield(%[[ARG0]] : !fir.ref) -! CHECK: } - -! CHECK-LABEL: omp.declare_reduction @add_reduction_byref_f32 : !fir.ref -! CHECK-SAME: init { -! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): -! CHECK: %[[C0_1:.*]] = arith.constant 0.000000e+00 : f32 -! CHECK: %[[REF:.*]] = fir.alloca f32 -! CHECK: fir.store %[[C0_1]] to %[[REF]] : !fir.ref -! CHECK: omp.yield(%[[REF]] : !fir.ref) - -! CHECK-LABEL: } combiner { -! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref, %[[ARG1:.*]]: !fir.ref): -! CHECK: %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref -! CHECK: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref -! CHECK: %[[RES:.*]] = arith.addf %[[LD0]], %[[LD1]] fastmath : f32 -! CHECK: fir.store %[[RES]] to %[[ARG0]] : !fir.ref -! CHECK: omp.yield(%[[ARG0]] : !fir.ref) -! CHECK: } - -! CHECK-LABEL: omp.declare_reduction @add_reduction_byref_i32 : !fir.ref -! CHECK-SAME: init { -! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): -! CHECK: %[[C0_1:.*]] = arith.constant 0 : i32 -! CHECK: %[[REF:.*]] = fir.alloca i32 -! CHECK: fir.store %[[C0_1]] to %[[REF]] : !fir.ref -! CHECK: omp.yield(%[[REF]] : !fir.ref) - -! CHECK-LABEL: } combiner { -! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref, %[[ARG1:.*]]: !fir.ref): -! CHECK: %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref -! CHECK: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref -! CHECK: %[[RES:.*]] = arith.addi %[[LD0]], %[[LD1]] : i32 -! CHECK: fir.store %[[RES]] to %[[ARG0]] : !fir.ref -! CHECK: omp.yield(%[[ARG0]] : !fir.ref) -! CHECK: } - -! CHECK-LABEL: func.func @_QPsimple_int_reduction() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_int_reductionEi"} -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFsimple_int_reductionEx"} -! CHECK: %[[VAL_2:.*]] = arith.constant 0 : i32 -! CHECK: fir.store %[[VAL_2]] to %[[VAL_1]] : !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_3:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_4:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_5:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop byref reduction(@add_reduction_byref_i32 %[[VAL_1]] -> %[[VAL_7:.*]] : !fir.ref) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_8:.*]]) : i32 = (%[[VAL_4]]) to (%[[VAL_5]]) inclusive step (%[[VAL_6]]) { -! CHECK: fir.store %[[VAL_8]] to %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_11:.*]] = arith.addi %[[VAL_9]], %[[VAL_10]] : i32 -! CHECK: fir.store %[[VAL_11]] to %[[VAL_7]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine simple_int_reduction - integer :: x - x = 0 - !$omp parallel - !$omp do reduction(+:x) - do i=1, 100 - x = x + i - end do - !$omp end do - !$omp end parallel -end subroutine - - -! CHECK-LABEL: func.func @_QPsimple_real_reduction() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_real_reductionEi"} -! CHECK: %[[VAL_1:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFsimple_real_reductionEx"} -! CHECK: %[[VAL_2:.*]] = arith.constant 0.000000e+00 : f32 -! CHECK: fir.store %[[VAL_2]] to %[[VAL_1]] : !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_3:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_4:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_5:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop byref reduction(@add_reduction_byref_f32 %[[VAL_1]] -> %[[VAL_7:.*]] : !fir.ref) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_8:.*]]) : i32 = (%[[VAL_4]]) to (%[[VAL_5]]) inclusive step (%[[VAL_6]]) { -! CHECK: fir.store %[[VAL_8]] to %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_11:.*]] = fir.convert %[[VAL_10]] : (i32) -> f32 -! CHECK: %[[VAL_12:.*]] = arith.addf %[[VAL_9]], %[[VAL_11]] fastmath : f32 -! CHECK: fir.store %[[VAL_12]] to %[[VAL_7]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine simple_real_reduction - real :: x - x = 0.0 - !$omp parallel - !$omp do reduction(+:x) - do i=1, 100 - x = x + i - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPsimple_int_reduction_switch_order() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_int_reduction_switch_orderEi"} -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFsimple_int_reduction_switch_orderEx"} -! CHECK: %[[VAL_2:.*]] = arith.constant 0 : i32 -! CHECK: fir.store %[[VAL_2]] to %[[VAL_1]] : !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_3:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_4:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_5:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop byref reduction(@add_reduction_byref_i32 %[[VAL_1]] -> %[[VAL_7:.*]] : !fir.ref) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_8:.*]]) : i32 = (%[[VAL_4]]) to (%[[VAL_5]]) inclusive step (%[[VAL_6]]) { -! CHECK: fir.store %[[VAL_8]] to %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_11:.*]] = arith.addi %[[VAL_9]], %[[VAL_10]] : i32 -! CHECK: fir.store %[[VAL_11]] to %[[VAL_7]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine simple_int_reduction_switch_order - integer :: x - x = 0 - !$omp parallel - !$omp do reduction(+:x) - do i=1, 100 - x = i + x - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPsimple_real_reduction_switch_order() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_real_reduction_switch_orderEi"} -! CHECK: %[[VAL_1:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFsimple_real_reduction_switch_orderEx"} -! CHECK: %[[VAL_2:.*]] = arith.constant 0.000000e+00 : f32 -! CHECK: fir.store %[[VAL_2]] to %[[VAL_1]] : !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_3:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_4:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_5:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop byref reduction(@add_reduction_byref_f32 %[[VAL_1]] -> %[[VAL_7:.*]] : !fir.ref) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_8:.*]]) : i32 = (%[[VAL_4]]) to (%[[VAL_5]]) inclusive step (%[[VAL_6]]) { -! CHECK: fir.store %[[VAL_8]] to %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_10:.*]] = fir.convert %[[VAL_9]] : (i32) -> f32 -! CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_12:.*]] = arith.addf %[[VAL_10]], %[[VAL_11]] fastmath : f32 -! CHECK: fir.store %[[VAL_12]] to %[[VAL_7]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine simple_real_reduction_switch_order - real :: x - x = 0.0 - !$omp parallel - !$omp do reduction(+:x) - do i=1, 100 - x = i + x - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPmultiple_int_reductions_same_type() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFmultiple_int_reductions_same_typeEi"} -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFmultiple_int_reductions_same_typeEx"} -! CHECK: %[[VAL_2:.*]] = fir.alloca i32 {bindc_name = "y", uniq_name = "_QFmultiple_int_reductions_same_typeEy"} -! CHECK: %[[VAL_3:.*]] = fir.alloca i32 {bindc_name = "z", uniq_name = "_QFmultiple_int_reductions_same_typeEz"} -! CHECK: %[[VAL_4:.*]] = arith.constant 0 : i32 -! CHECK: fir.store %[[VAL_4]] to %[[VAL_1]] : !fir.ref -! CHECK: %[[VAL_5:.*]] = arith.constant 0 : i32 -! CHECK: fir.store %[[VAL_5]] to %[[VAL_2]] : !fir.ref -! CHECK: %[[VAL_6:.*]] = arith.constant 0 : i32 -! CHECK: fir.store %[[VAL_6]] to %[[VAL_3]] : !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_7:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_9:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_10:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop byref reduction(@add_reduction_byref_i32 %[[VAL_1]] -> %[[VAL_11:.*]] : !fir.ref, @add_reduction_byref_i32 %[[VAL_2]] -> %[[VAL_12:.*]] : !fir.ref, @add_reduction_byref_i32 %[[VAL_3]] -> %[[VAL_13:.*]] : !fir.ref) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_14:.*]]) : i32 = (%[[VAL_8]]) to (%[[VAL_9]]) inclusive step (%[[VAL_10]]) { -! CHECK: fir.store %[[VAL_14]] to %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_15:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_16:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_17:.*]] = arith.addi %[[VAL_15]], %[[VAL_16]] : i32 -! CHECK: fir.store %[[VAL_17]] to %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_18:.*]] = fir.load %[[VAL_12]] : !fir.ref -! CHECK: %[[VAL_19:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_20:.*]] = arith.addi %[[VAL_18]], %[[VAL_19]] : i32 -! CHECK: fir.store %[[VAL_20]] to %[[VAL_12]] : !fir.ref -! CHECK: %[[VAL_21:.*]] = fir.load %[[VAL_13]] : !fir.ref -! CHECK: %[[VAL_22:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_23:.*]] = arith.addi %[[VAL_21]], %[[VAL_22]] : i32 -! CHECK: fir.store %[[VAL_23]] to %[[VAL_13]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine multiple_int_reductions_same_type - integer :: x,y,z - x = 0 - y = 0 - z = 0 - !$omp parallel - !$omp do reduction(+:x,y,z) - do i=1, 100 - x = x + i - y = y + i - z = z + i - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPmultiple_real_reductions_same_type() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFmultiple_real_reductions_same_typeEi"} -! CHECK: %[[VAL_1:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFmultiple_real_reductions_same_typeEx"} -! CHECK: %[[VAL_2:.*]] = fir.alloca f32 {bindc_name = "y", uniq_name = "_QFmultiple_real_reductions_same_typeEy"} -! CHECK: %[[VAL_3:.*]] = fir.alloca f32 {bindc_name = "z", uniq_name = "_QFmultiple_real_reductions_same_typeEz"} -! CHECK: %[[VAL_4:.*]] = arith.constant 0.000000e+00 : f32 -! CHECK: fir.store %[[VAL_4]] to %[[VAL_1]] : !fir.ref -! CHECK: %[[VAL_5:.*]] = arith.constant 0.000000e+00 : f32 -! CHECK: fir.store %[[VAL_5]] to %[[VAL_2]] : !fir.ref -! CHECK: %[[VAL_6:.*]] = arith.constant 0.000000e+00 : f32 -! CHECK: fir.store %[[VAL_6]] to %[[VAL_3]] : !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_7:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_9:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_10:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop byref reduction(@add_reduction_byref_f32 %[[VAL_1]] -> %[[VAL_11:.*]] : !fir.ref, @add_reduction_byref_f32 %[[VAL_2]] -> %[[VAL_12:.*]] : !fir.ref, @add_reduction_byref_f32 %[[VAL_3]] -> %[[VAL_13:.*]] : !fir.ref) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_14:.*]]) : i32 = (%[[VAL_8]]) to (%[[VAL_9]]) inclusive step (%[[VAL_10]]) { -! CHECK: fir.store %[[VAL_14]] to %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_15:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_16:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_17:.*]] = fir.convert %[[VAL_16]] : (i32) -> f32 -! CHECK: %[[VAL_18:.*]] = arith.addf %[[VAL_15]], %[[VAL_17]] fastmath : f32 -! CHECK: fir.store %[[VAL_18]] to %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_19:.*]] = fir.load %[[VAL_12]] : !fir.ref -! CHECK: %[[VAL_20:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (i32) -> f32 -! CHECK: %[[VAL_22:.*]] = arith.addf %[[VAL_19]], %[[VAL_21]] fastmath : f32 -! CHECK: fir.store %[[VAL_22]] to %[[VAL_12]] : !fir.ref -! CHECK: %[[VAL_23:.*]] = fir.load %[[VAL_13]] : !fir.ref -! CHECK: %[[VAL_24:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_25:.*]] = fir.convert %[[VAL_24]] : (i32) -> f32 -! CHECK: %[[VAL_26:.*]] = arith.addf %[[VAL_23]], %[[VAL_25]] fastmath : f32 -! CHECK: fir.store %[[VAL_26]] to %[[VAL_13]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine multiple_real_reductions_same_type - real :: x,y,z - x = 0.0 - y = 0.0 - z = 0.0 - !$omp parallel - !$omp do reduction(+:x,y,z) - do i=1, 100 - x = x + i - y = y + i - z = z + i - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPmultiple_reductions_different_type() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFmultiple_reductions_different_typeEi"} -! CHECK: %[[VAL_1:.*]] = fir.alloca f64 {bindc_name = "w", uniq_name = "_QFmultiple_reductions_different_typeEw"} -! CHECK: %[[VAL_2:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFmultiple_reductions_different_typeEx"} -! CHECK: %[[VAL_3:.*]] = fir.alloca i64 {bindc_name = "y", uniq_name = "_QFmultiple_reductions_different_typeEy"} -! CHECK: %[[VAL_4:.*]] = fir.alloca f32 {bindc_name = "z", uniq_name = "_QFmultiple_reductions_different_typeEz"} -! CHECK: %[[VAL_5:.*]] = arith.constant 0 : i32 -! CHECK: fir.store %[[VAL_5]] to %[[VAL_2]] : !fir.ref -! CHECK: %[[VAL_6:.*]] = arith.constant 0 : i64 -! CHECK: fir.store %[[VAL_6]] to %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_7:.*]] = arith.constant 0.000000e+00 : f32 -! CHECK: fir.store %[[VAL_7]] to %[[VAL_4]] : !fir.ref -! CHECK: %[[VAL_8:.*]] = arith.constant 0.000000e+00 : f64 -! CHECK: fir.store %[[VAL_8]] to %[[VAL_1]] : !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_9:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_10:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_11:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_12:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop byref reduction(@add_reduction_byref_i32 %[[VAL_2]] -> %[[VAL_13:.*]] : !fir.ref, @add_reduction_byref_i64 %[[VAL_3]] -> %[[VAL_14:.*]] : !fir.ref, @add_reduction_byref_f32 %[[VAL_4]] -> %[[VAL_15:.*]] : !fir.ref, @add_reduction_byref_f64 %[[VAL_1]] -> %[[VAL_16:.*]] : !fir.ref) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_17:.*]]) : i32 = (%[[VAL_10]]) to (%[[VAL_11]]) inclusive step (%[[VAL_12]]) { -! CHECK: fir.store %[[VAL_17]] to %[[VAL_9]] : !fir.ref -! CHECK: %[[VAL_18:.*]] = fir.load %[[VAL_13]] : !fir.ref -! CHECK: %[[VAL_19:.*]] = fir.load %[[VAL_9]] : !fir.ref -! CHECK: %[[VAL_20:.*]] = arith.addi %[[VAL_18]], %[[VAL_19]] : i32 -! CHECK: fir.store %[[VAL_20]] to %[[VAL_13]] : !fir.ref -! CHECK: %[[VAL_21:.*]] = fir.load %[[VAL_14]] : !fir.ref -! CHECK: %[[VAL_22:.*]] = fir.load %[[VAL_9]] : !fir.ref -! CHECK: %[[VAL_23:.*]] = fir.convert %[[VAL_22]] : (i32) -> i64 -! CHECK: %[[VAL_24:.*]] = arith.addi %[[VAL_21]], %[[VAL_23]] : i64 -! CHECK: fir.store %[[VAL_24]] to %[[VAL_14]] : !fir.ref -! CHECK: %[[VAL_25:.*]] = fir.load %[[VAL_15]] : !fir.ref -! CHECK: %[[VAL_26:.*]] = fir.load %[[VAL_9]] : !fir.ref -! CHECK: %[[VAL_27:.*]] = fir.convert %[[VAL_26]] : (i32) -> f32 -! CHECK: %[[VAL_28:.*]] = arith.addf %[[VAL_25]], %[[VAL_27]] fastmath : f32 -! CHECK: fir.store %[[VAL_28]] to %[[VAL_15]] : !fir.ref -! CHECK: %[[VAL_29:.*]] = fir.load %[[VAL_16]] : !fir.ref -! CHECK: %[[VAL_30:.*]] = fir.load %[[VAL_9]] : !fir.ref -! CHECK: %[[VAL_31:.*]] = fir.convert %[[VAL_30]] : (i32) -> f64 -! CHECK: %[[VAL_32:.*]] = arith.addf %[[VAL_29]], %[[VAL_31]] fastmath : f64 -! CHECK: fir.store %[[VAL_32]] to %[[VAL_16]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - - -subroutine multiple_reductions_different_type - integer :: x - integer(kind=8) :: y - real :: z - real(kind=8) :: w - x = 0 - y = 0 - z = 0.0 - w = 0.0 - !$omp parallel - !$omp do reduction(+:x,y,z,w) - do i=1, 100 - x = x + i - y = y + i - z = z + i - w = w + i - end do - !$omp end do - !$omp end parallel -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-add.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-add.f90 deleted file mode 100644 index e0b9330b1a6d5..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-add.f90 +++ /dev/null @@ -1,388 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -! CHECK-LABEL: omp.declare_reduction @add_reduction_f64 : f64 init { -! CHECK: ^bb0(%[[VAL_0:.*]]: f64): -! CHECK: %[[VAL_1:.*]] = arith.constant 0.000000e+00 : f64 -! CHECK: omp.yield(%[[VAL_1]] : f64) - -! CHECK-LABEL: } combiner { -! CHECK: ^bb0(%[[VAL_0:.*]]: f64, %[[VAL_1:.*]]: f64): -! CHECK: %[[VAL_2:.*]] = arith.addf %[[VAL_0]], %[[VAL_1]] fastmath : f64 -! CHECK: omp.yield(%[[VAL_2]] : f64) -! CHECK: } - -! CHECK-LABEL: omp.declare_reduction @add_reduction_i64 : i64 init { -! CHECK: ^bb0(%[[VAL_0:.*]]: i64): -! CHECK: %[[VAL_1:.*]] = arith.constant 0 : i64 -! CHECK: omp.yield(%[[VAL_1]] : i64) - -! CHECK-LABEL: } combiner { -! CHECK: ^bb0(%[[VAL_0:.*]]: i64, %[[VAL_1:.*]]: i64): -! CHECK: %[[VAL_2:.*]] = arith.addi %[[VAL_0]], %[[VAL_1]] : i64 -! CHECK: omp.yield(%[[VAL_2]] : i64) -! CHECK: } - -! CHECK-LABEL: omp.declare_reduction @add_reduction_f32 : f32 init { -! CHECK: ^bb0(%[[VAL_0:.*]]: f32): -! CHECK: %[[VAL_1:.*]] = arith.constant 0.000000e+00 : f32 -! CHECK: omp.yield(%[[VAL_1]] : f32) - -! CHECK-LABEL: } combiner { -! CHECK: ^bb0(%[[VAL_0:.*]]: f32, %[[VAL_1:.*]]: f32): -! CHECK: %[[VAL_2:.*]] = arith.addf %[[VAL_0]], %[[VAL_1]] fastmath : f32 -! CHECK: omp.yield(%[[VAL_2]] : f32) -! CHECK: } - -! CHECK-LABEL: omp.declare_reduction @add_reduction_i32 : i32 init { -! CHECK: ^bb0(%[[VAL_0:.*]]: i32): -! CHECK: %[[VAL_1:.*]] = arith.constant 0 : i32 -! CHECK: omp.yield(%[[VAL_1]] : i32) - -! CHECK-LABEL: } combiner { -! CHECK: ^bb0(%[[VAL_0:.*]]: i32, %[[VAL_1:.*]]: i32): -! CHECK: %[[VAL_2:.*]] = arith.addi %[[VAL_0]], %[[VAL_1]] : i32 -! CHECK: omp.yield(%[[VAL_2]] : i32) -! CHECK: } - -! CHECK-LABEL: func.func @_QPsimple_int_reduction() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_int_reductionEi"} -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFsimple_int_reductionEx"} -! CHECK: %[[VAL_2:.*]] = arith.constant 0 : i32 -! CHECK: fir.store %[[VAL_2]] to %[[VAL_1]] : !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_3:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_4:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_5:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop reduction(@add_reduction_i32 %[[VAL_1]] -> %[[VAL_7:.*]] : !fir.ref) -! CHECK-NEXT: omp.loop_nest (%[[VAL_8:.*]]) : i32 = (%[[VAL_4]]) to (%[[VAL_5]]) inclusive step (%[[VAL_6]]) { -! CHECK: fir.store %[[VAL_8]] to %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_11:.*]] = arith.addi %[[VAL_9]], %[[VAL_10]] : i32 -! CHECK: fir.store %[[VAL_11]] to %[[VAL_7]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine simple_int_reduction - integer :: x - x = 0 - !$omp parallel - !$omp do reduction(+:x) - do i=1, 100 - x = x + i - end do - !$omp end do - !$omp end parallel -end subroutine - - -! CHECK-LABEL: func.func @_QPsimple_real_reduction() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_real_reductionEi"} -! CHECK: %[[VAL_1:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFsimple_real_reductionEx"} -! CHECK: %[[VAL_2:.*]] = arith.constant 0.000000e+00 : f32 -! CHECK: fir.store %[[VAL_2]] to %[[VAL_1]] : !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_3:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_4:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_5:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop reduction(@add_reduction_f32 %[[VAL_1]] -> %[[VAL_7:.*]] : !fir.ref) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_8:.*]]) : i32 = (%[[VAL_4]]) to (%[[VAL_5]]) inclusive step (%[[VAL_6]]) { -! CHECK: fir.store %[[VAL_8]] to %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_11:.*]] = fir.convert %[[VAL_10]] : (i32) -> f32 -! CHECK: %[[VAL_12:.*]] = arith.addf %[[VAL_9]], %[[VAL_11]] fastmath : f32 -! CHECK: fir.store %[[VAL_12]] to %[[VAL_7]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine simple_real_reduction - real :: x - x = 0.0 - !$omp parallel - !$omp do reduction(+:x) - do i=1, 100 - x = x + i - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPsimple_int_reduction_switch_order() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_int_reduction_switch_orderEi"} -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFsimple_int_reduction_switch_orderEx"} -! CHECK: %[[VAL_2:.*]] = arith.constant 0 : i32 -! CHECK: fir.store %[[VAL_2]] to %[[VAL_1]] : !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_3:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_4:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_5:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop reduction(@add_reduction_i32 %[[VAL_1]] -> %[[VAL_7:.*]] : !fir.ref) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_8:.*]]) : i32 = (%[[VAL_4]]) to (%[[VAL_5]]) inclusive step (%[[VAL_6]]) { -! CHECK: fir.store %[[VAL_8]] to %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_11:.*]] = arith.addi %[[VAL_9]], %[[VAL_10]] : i32 -! CHECK: fir.store %[[VAL_11]] to %[[VAL_7]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine simple_int_reduction_switch_order - integer :: x - x = 0 - !$omp parallel - !$omp do reduction(+:x) - do i=1, 100 - x = i + x - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPsimple_real_reduction_switch_order() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_real_reduction_switch_orderEi"} -! CHECK: %[[VAL_1:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFsimple_real_reduction_switch_orderEx"} -! CHECK: %[[VAL_2:.*]] = arith.constant 0.000000e+00 : f32 -! CHECK: fir.store %[[VAL_2]] to %[[VAL_1]] : !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_3:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_4:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_5:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop reduction(@add_reduction_f32 %[[VAL_1]] -> %[[VAL_7:.*]] : !fir.ref) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_8:.*]]) : i32 = (%[[VAL_4]]) to (%[[VAL_5]]) inclusive step (%[[VAL_6]]) { -! CHECK: fir.store %[[VAL_8]] to %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_10:.*]] = fir.convert %[[VAL_9]] : (i32) -> f32 -! CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_12:.*]] = arith.addf %[[VAL_10]], %[[VAL_11]] fastmath : f32 -! CHECK: fir.store %[[VAL_12]] to %[[VAL_7]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine simple_real_reduction_switch_order - real :: x - x = 0.0 - !$omp parallel - !$omp do reduction(+:x) - do i=1, 100 - x = i + x - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPmultiple_int_reductions_same_type() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFmultiple_int_reductions_same_typeEi"} -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFmultiple_int_reductions_same_typeEx"} -! CHECK: %[[VAL_2:.*]] = fir.alloca i32 {bindc_name = "y", uniq_name = "_QFmultiple_int_reductions_same_typeEy"} -! CHECK: %[[VAL_3:.*]] = fir.alloca i32 {bindc_name = "z", uniq_name = "_QFmultiple_int_reductions_same_typeEz"} -! CHECK: %[[VAL_4:.*]] = arith.constant 0 : i32 -! CHECK: fir.store %[[VAL_4]] to %[[VAL_1]] : !fir.ref -! CHECK: %[[VAL_5:.*]] = arith.constant 0 : i32 -! CHECK: fir.store %[[VAL_5]] to %[[VAL_2]] : !fir.ref -! CHECK: %[[VAL_6:.*]] = arith.constant 0 : i32 -! CHECK: fir.store %[[VAL_6]] to %[[VAL_3]] : !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_7:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_9:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_10:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop reduction(@add_reduction_i32 %[[VAL_1]] -> %[[VAL_11:.*]] : !fir.ref, @add_reduction_i32 %[[VAL_2]] -> %[[VAL_12:.*]] : !fir.ref, @add_reduction_i32 %[[VAL_3]] -> %[[VAL_13:.*]] : !fir.ref) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_14:.*]]) : i32 = (%[[VAL_8]]) to (%[[VAL_9]]) inclusive step (%[[VAL_10]]) { -! CHECK: fir.store %[[VAL_14]] to %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_15:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_16:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_17:.*]] = arith.addi %[[VAL_15]], %[[VAL_16]] : i32 -! CHECK: fir.store %[[VAL_17]] to %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_18:.*]] = fir.load %[[VAL_12]] : !fir.ref -! CHECK: %[[VAL_19:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_20:.*]] = arith.addi %[[VAL_18]], %[[VAL_19]] : i32 -! CHECK: fir.store %[[VAL_20]] to %[[VAL_12]] : !fir.ref -! CHECK: %[[VAL_21:.*]] = fir.load %[[VAL_13]] : !fir.ref -! CHECK: %[[VAL_22:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_23:.*]] = arith.addi %[[VAL_21]], %[[VAL_22]] : i32 -! CHECK: fir.store %[[VAL_23]] to %[[VAL_13]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine multiple_int_reductions_same_type - integer :: x,y,z - x = 0 - y = 0 - z = 0 - !$omp parallel - !$omp do reduction(+:x,y,z) - do i=1, 100 - x = x + i - y = y + i - z = z + i - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPmultiple_real_reductions_same_type() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFmultiple_real_reductions_same_typeEi"} -! CHECK: %[[VAL_1:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFmultiple_real_reductions_same_typeEx"} -! CHECK: %[[VAL_2:.*]] = fir.alloca f32 {bindc_name = "y", uniq_name = "_QFmultiple_real_reductions_same_typeEy"} -! CHECK: %[[VAL_3:.*]] = fir.alloca f32 {bindc_name = "z", uniq_name = "_QFmultiple_real_reductions_same_typeEz"} -! CHECK: %[[VAL_4:.*]] = arith.constant 0.000000e+00 : f32 -! CHECK: fir.store %[[VAL_4]] to %[[VAL_1]] : !fir.ref -! CHECK: %[[VAL_5:.*]] = arith.constant 0.000000e+00 : f32 -! CHECK: fir.store %[[VAL_5]] to %[[VAL_2]] : !fir.ref -! CHECK: %[[VAL_6:.*]] = arith.constant 0.000000e+00 : f32 -! CHECK: fir.store %[[VAL_6]] to %[[VAL_3]] : !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_7:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_9:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_10:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop reduction(@add_reduction_f32 %[[VAL_1]] -> %[[VAL_11:.*]] : !fir.ref, @add_reduction_f32 %[[VAL_2]] -> %[[VAL_12:.*]] : !fir.ref, @add_reduction_f32 %[[VAL_3]] -> %[[VAL_13:.*]] : !fir.ref) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_14:.*]]) : i32 = (%[[VAL_8]]) to (%[[VAL_9]]) inclusive step (%[[VAL_10]]) { -! CHECK: fir.store %[[VAL_14]] to %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_15:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_16:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_17:.*]] = fir.convert %[[VAL_16]] : (i32) -> f32 -! CHECK: %[[VAL_18:.*]] = arith.addf %[[VAL_15]], %[[VAL_17]] fastmath : f32 -! CHECK: fir.store %[[VAL_18]] to %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_19:.*]] = fir.load %[[VAL_12]] : !fir.ref -! CHECK: %[[VAL_20:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (i32) -> f32 -! CHECK: %[[VAL_22:.*]] = arith.addf %[[VAL_19]], %[[VAL_21]] fastmath : f32 -! CHECK: fir.store %[[VAL_22]] to %[[VAL_12]] : !fir.ref -! CHECK: %[[VAL_23:.*]] = fir.load %[[VAL_13]] : !fir.ref -! CHECK: %[[VAL_24:.*]] = fir.load %[[VAL_7]] : !fir.ref -! CHECK: %[[VAL_25:.*]] = fir.convert %[[VAL_24]] : (i32) -> f32 -! CHECK: %[[VAL_26:.*]] = arith.addf %[[VAL_23]], %[[VAL_25]] fastmath : f32 -! CHECK: fir.store %[[VAL_26]] to %[[VAL_13]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - -subroutine multiple_real_reductions_same_type - real :: x,y,z - x = 0.0 - y = 0.0 - z = 0.0 - !$omp parallel - !$omp do reduction(+:x,y,z) - do i=1, 100 - x = x + i - y = y + i - z = z + i - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPmultiple_reductions_different_type() { -! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFmultiple_reductions_different_typeEi"} -! CHECK: %[[VAL_1:.*]] = fir.alloca f64 {bindc_name = "w", uniq_name = "_QFmultiple_reductions_different_typeEw"} -! CHECK: %[[VAL_2:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFmultiple_reductions_different_typeEx"} -! CHECK: %[[VAL_3:.*]] = fir.alloca i64 {bindc_name = "y", uniq_name = "_QFmultiple_reductions_different_typeEy"} -! CHECK: %[[VAL_4:.*]] = fir.alloca f32 {bindc_name = "z", uniq_name = "_QFmultiple_reductions_different_typeEz"} -! CHECK: %[[VAL_5:.*]] = arith.constant 0 : i32 -! CHECK: fir.store %[[VAL_5]] to %[[VAL_2]] : !fir.ref -! CHECK: %[[VAL_6:.*]] = arith.constant 0 : i64 -! CHECK: fir.store %[[VAL_6]] to %[[VAL_3]] : !fir.ref -! CHECK: %[[VAL_7:.*]] = arith.constant 0.000000e+00 : f32 -! CHECK: fir.store %[[VAL_7]] to %[[VAL_4]] : !fir.ref -! CHECK: %[[VAL_8:.*]] = arith.constant 0.000000e+00 : f64 -! CHECK: fir.store %[[VAL_8]] to %[[VAL_1]] : !fir.ref -! CHECK: omp.parallel { -! CHECK: %[[VAL_9:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_10:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_11:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_12:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop reduction(@add_reduction_i32 %[[VAL_2]] -> %[[VAL_13:.*]] : !fir.ref, @add_reduction_i64 %[[VAL_3]] -> %[[VAL_14:.*]] : !fir.ref, @add_reduction_f32 %[[VAL_4]] -> %[[VAL_15:.*]] : !fir.ref, @add_reduction_f64 %[[VAL_1]] -> %[[VAL_16:.*]] : !fir.ref) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_17:.*]]) : i32 = (%[[VAL_10]]) to (%[[VAL_11]]) inclusive step (%[[VAL_12]]) { -! CHECK: fir.store %[[VAL_17]] to %[[VAL_9]] : !fir.ref -! CHECK: %[[VAL_18:.*]] = fir.load %[[VAL_13]] : !fir.ref -! CHECK: %[[VAL_19:.*]] = fir.load %[[VAL_9]] : !fir.ref -! CHECK: %[[VAL_20:.*]] = arith.addi %[[VAL_18]], %[[VAL_19]] : i32 -! CHECK: fir.store %[[VAL_20]] to %[[VAL_13]] : !fir.ref -! CHECK: %[[VAL_21:.*]] = fir.load %[[VAL_14]] : !fir.ref -! CHECK: %[[VAL_22:.*]] = fir.load %[[VAL_9]] : !fir.ref -! CHECK: %[[VAL_23:.*]] = fir.convert %[[VAL_22]] : (i32) -> i64 -! CHECK: %[[VAL_24:.*]] = arith.addi %[[VAL_21]], %[[VAL_23]] : i64 -! CHECK: fir.store %[[VAL_24]] to %[[VAL_14]] : !fir.ref -! CHECK: %[[VAL_25:.*]] = fir.load %[[VAL_15]] : !fir.ref -! CHECK: %[[VAL_26:.*]] = fir.load %[[VAL_9]] : !fir.ref -! CHECK: %[[VAL_27:.*]] = fir.convert %[[VAL_26]] : (i32) -> f32 -! CHECK: %[[VAL_28:.*]] = arith.addf %[[VAL_25]], %[[VAL_27]] fastmath : f32 -! CHECK: fir.store %[[VAL_28]] to %[[VAL_15]] : !fir.ref -! CHECK: %[[VAL_29:.*]] = fir.load %[[VAL_16]] : !fir.ref -! CHECK: %[[VAL_30:.*]] = fir.load %[[VAL_9]] : !fir.ref -! CHECK: %[[VAL_31:.*]] = fir.convert %[[VAL_30]] : (i32) -> f64 -! CHECK: %[[VAL_32:.*]] = arith.addf %[[VAL_29]], %[[VAL_31]] fastmath : f64 -! CHECK: fir.store %[[VAL_32]] to %[[VAL_16]] : !fir.ref -! CHECK: omp.yield -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: omp.terminator -! CHECK: } -! CHECK: return -! CHECK: } - - -subroutine multiple_reductions_different_type - integer :: x - integer(kind=8) :: y - real :: z - real(kind=8) :: w - x = 0 - y = 0 - z = 0.0 - w = 0.0 - !$omp parallel - !$omp do reduction(+:x,y,z,w) - do i=1, 100 - x = x + i - y = y + i - z = z + i - w = w + i - end do - !$omp end do - !$omp end parallel -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-iand-byref.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-iand-byref.f90 deleted file mode 100644 index b25ab84f60fe9..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-iand-byref.f90 +++ /dev/null @@ -1,48 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp --force-byref-reduction %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -mmlir --force-byref-reduction %s -o - | FileCheck %s - -!CHECK-LABEL: omp.declare_reduction @iand_byref_i32 : !fir.ref -!CHECK-SAME: init { -!CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): -!CHECK: %[[C0_1:.*]] = arith.constant -1 : i32 -!CHECK: %[[REF:.*]] = fir.alloca i32 -!CHECK: fir.store %[[C0_1]] to %[[REF]] : !fir.ref -!CHECK: omp.yield(%[[REF]] : !fir.ref) - -!CHECK-LABEL: } combiner { -!CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref, %[[ARG1:.*]]: !fir.ref): -!CHECK: %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref -!CHECK: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref -!CHECK: %[[RES:.*]] = arith.andi %[[LD0]], %[[LD1]] : i32 -!CHECK: fir.store %[[RES]] to %[[ARG0]] : !fir.ref -!CHECK: omp.yield(%[[ARG0]] : !fir.ref) -!CHECK: } - - -!CHECK-LABEL: @_QPreduction_iand -!CHECK-SAME: %[[Y_BOX:.*]]: !fir.box> -!CHECK: %[[X_REF:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFreduction_iandEx"} -!CHECK: omp.parallel -!CHECK: omp.wsloop byref reduction(@iand_byref_i32 %[[X_REF]] -> %[[PRV:.+]] : !fir.ref) -!CHECK-NEXT: omp.loop_nest -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[Y_I_REF:.*]] = fir.coordinate_of %[[Y_BOX]] -!CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref -!CHECK: %[[RES:.+]] = arith.andi %[[LPRV]], %[[Y_I]] : i32 -!CHECK: fir.store %[[RES]] to %[[PRV]] : !fir.ref -!CHECK: omp.yield -!CHECK: omp.terminator -!CHECK: omp.terminator - -subroutine reduction_iand(y) - integer :: x, y(:) - x = 0 - !$omp parallel - !$omp do reduction(iand:x) - do i=1, 100 - x = iand(x, y(i)) - end do - !$omp end do - !$omp end parallel - print *, x -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-iand.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-iand.f90 deleted file mode 100644 index dfc140d7d5f61..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-iand.f90 +++ /dev/null @@ -1,38 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -!CHECK: omp.declare_reduction @[[IAND_DECLARE_I:.*]] : i32 init { -!CHECK: %[[ZERO_VAL_I:.*]] = arith.constant -1 : i32 -!CHECK: omp.yield(%[[ZERO_VAL_I]] : i32) -!CHECK: combiner -!CHECK: ^bb0(%[[ARG0_I:.*]]: i32, %[[ARG1_I:.*]]: i32): -!CHECK: %[[IAND_VAL_I:.*]] = arith.andi %[[ARG0_I]], %[[ARG1_I]] : i32 -!CHECK: omp.yield(%[[IAND_VAL_I]] : i32) - -!CHECK-LABEL: @_QPreduction_iand -!CHECK-SAME: %[[Y_BOX:.*]]: !fir.box> -!CHECK: %[[X_REF:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFreduction_iandEx"} -!CHECK: omp.parallel -!CHECK: omp.wsloop reduction(@[[IAND_DECLARE_I]] %[[X_REF]] -> %[[PRV:.+]] : !fir.ref) -!CHECK-NEXT: omp.loop_nest -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[Y_I_REF:.*]] = fir.coordinate_of %[[Y_BOX]] -!CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref -!CHECK: %[[RES:.+]] = arith.andi %[[LPRV]], %[[Y_I]] : i32 -!CHECK: fir.store %[[RES]] to %[[PRV]] : !fir.ref -!CHECK: omp.yield -!CHECK: omp.terminator -!CHECK: omp.terminator - -subroutine reduction_iand(y) - integer :: x, y(:) - x = 0 - !$omp parallel - !$omp do reduction(iand:x) - do i=1, 100 - x = iand(x, y(i)) - end do - !$omp end do - !$omp end parallel - print *, x -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-ieor-byref.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-ieor-byref.f90 deleted file mode 100644 index 56eb087bae5a0..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-ieor-byref.f90 +++ /dev/null @@ -1,47 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp --force-byref-reduction %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mmlir --force-byref-reduction -fopenmp %s -o - | FileCheck %s - -! CHECK-LABEL: omp.declare_reduction @ieor_byref_i32 : !fir.ref -! CHECK-SAME: init { -! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): -! CHECK: %[[C0_1:.*]] = arith.constant 0 : i32 -! CHECK: %[[REF:.*]] = fir.alloca i32 -! CHECK: fir.store %[[C0_1]] to %[[REF]] : !fir.ref -! CHECK: omp.yield(%[[REF]] : !fir.ref) - -! CHECK-LABEL: } combiner { -! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref, %[[ARG1:.*]]: !fir.ref): -! CHECK: %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref -! CHECK: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref -! CHECK: %[[RES:.*]] = arith.xori %[[LD0]], %[[LD1]] : i32 -! CHECK: fir.store %[[RES]] to %[[ARG0]] : !fir.ref -! CHECK: omp.yield(%[[ARG0]] : !fir.ref) -! CHECK: } - -!CHECK-LABEL: @_QPreduction_ieor -!CHECK-SAME: %[[Y_BOX:.*]]: !fir.box> -!CHECK: %[[X_REF:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFreduction_ieorEx"} -!CHECK: omp.parallel -!CHECK: omp.wsloop byref reduction(@ieor_byref_i32 %[[X_REF]] -> %[[PRV:.+]] : !fir.ref) -!CHECK-NEXT: omp.loop_nest -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[Y_I_REF:.*]] = fir.coordinate_of %[[Y_BOX]] -!CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref -!CHECK: %[[RES:.+]] = arith.xori %[[LPRV]], %[[Y_I]] : i32 -!CHECK: fir.store %[[RES]] to %[[PRV]] : !fir.ref -!CHECK: omp.yield -!CHECK: omp.terminator -!CHECK: omp.terminator - -subroutine reduction_ieor(y) - integer :: x, y(:) - x = 0 - !$omp parallel - !$omp do reduction(ieor:x) - do i=1, 100 - x = ieor(x, y(i)) - end do - !$omp end do - !$omp end parallel - print *, x -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-ieor.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-ieor.f90 deleted file mode 100644 index 1ddf82b828cb0..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-ieor.f90 +++ /dev/null @@ -1,38 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -!CHECK: omp.declare_reduction @[[IEOR_DECLARE_I:.*]] : i32 init { -!CHECK: %[[ZERO_VAL_I:.*]] = arith.constant 0 : i32 -!CHECK: omp.yield(%[[ZERO_VAL_I]] : i32) -!CHECK: combiner -!CHECK: ^bb0(%[[ARG0_I:.*]]: i32, %[[ARG1_I:.*]]: i32): -!CHECK: %[[IEOR_VAL_I:.*]] = arith.xori %[[ARG0_I]], %[[ARG1_I]] : i32 -!CHECK: omp.yield(%[[IEOR_VAL_I]] : i32) - -!CHECK-LABEL: @_QPreduction_ieor -!CHECK-SAME: %[[Y_BOX:.*]]: !fir.box> -!CHECK: %[[X_REF:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFreduction_ieorEx"} -!CHECK: omp.parallel -!CHECK: omp.wsloop reduction(@[[IEOR_DECLARE_I]] %[[X_REF]] -> %[[PRV:.+]] : !fir.ref) -!CHECK-NEXT: omp.loop_nest -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[Y_I_REF:.*]] = fir.coordinate_of %[[Y_BOX]] -!CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref -!CHECK: %[[RES:.+]] = arith.xori %[[LPRV]], %[[Y_I]] : i32 -!CHECK: fir.store %[[RES]] to %[[PRV]] : !fir.ref -!CHECK: omp.yield -!CHECK: omp.terminator -!CHECK: omp.terminator - -subroutine reduction_ieor(y) - integer :: x, y(:) - x = 0 - !$omp parallel - !$omp do reduction(ieor:x) - do i=1, 100 - x = ieor(x, y(i)) - end do - !$omp end do - !$omp end parallel - print *, x -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-ior-byref.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-ior-byref.f90 deleted file mode 100644 index e761d24cd303b..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-ior-byref.f90 +++ /dev/null @@ -1,47 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp --force-byref-reduction %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -mmlir --force-byref-reduction %s -o - | FileCheck %s - -! CHECK-LABEL: omp.declare_reduction @ior_byref_i32 : !fir.ref -! CHECK-SAME: init { -! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref): -! CHECK: %[[C0_1:.*]] = arith.constant 0 : i32 -! CHECK: %[[REF:.*]] = fir.alloca i32 -! CHECK: fir.store %[[C0_1]] to %[[REF]] : !fir.ref -! CHECK: omp.yield(%[[REF]] : !fir.ref) - -! CHECK-LABEL: } combiner { -! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref, %[[ARG1:.*]]: !fir.ref): -! CHECK: %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref -! CHECK: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref -! CHECK: %[[RES:.*]] = arith.ori %[[LD0]], %[[LD1]] : i32 -! CHECK: fir.store %[[RES]] to %[[ARG0]] : !fir.ref -! CHECK: omp.yield(%[[ARG0]] : !fir.ref) -! CHECK: } - -!CHECK-LABEL: @_QPreduction_ior -!CHECK-SAME: %[[Y_BOX:.*]]: !fir.box> -!CHECK: %[[X_REF:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFreduction_iorEx"} -!CHECK: omp.parallel -!CHECK: omp.wsloop byref reduction(@ior_byref_i32 %[[X_REF]] -> %[[PRV:.+]] : !fir.ref) -!CHECK-NEXT: omp.loop_nest -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[Y_I_REF:.*]] = fir.coordinate_of %[[Y_BOX]] -!CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref -!CHECK: %[[RES:.+]] = arith.ori %[[LPRV]], %[[Y_I]] : i32 -!CHECK: fir.store %[[RES]] to %[[PRV]] : !fir.ref -!CHECK: omp.yield -!CHECK: omp.terminator -!CHECK: omp.terminator - -subroutine reduction_ior(y) - integer :: x, y(:) - x = 0 - !$omp parallel - !$omp do reduction(ior:x) - do i=1, 100 - x = ior(x, y(i)) - end do - !$omp end do - !$omp end parallel - print *, x -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-ior.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-ior.f90 deleted file mode 100644 index 148dbc909babe..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-ior.f90 +++ /dev/null @@ -1,38 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -!CHECK: omp.declare_reduction @[[IOR_DECLARE_I:.*]] : i32 init { -!CHECK: %[[ZERO_VAL_I:.*]] = arith.constant 0 : i32 -!CHECK: omp.yield(%[[ZERO_VAL_I]] : i32) -!CHECK: combiner -!CHECK: ^bb0(%[[ARG0_I:.*]]: i32, %[[ARG1_I:.*]]: i32): -!CHECK: %[[IOR_VAL_I:.*]] = arith.ori %[[ARG0_I]], %[[ARG1_I]] : i32 -!CHECK: omp.yield(%[[IOR_VAL_I]] : i32) - -!CHECK-LABEL: @_QPreduction_ior -!CHECK-SAME: %[[Y_BOX:.*]]: !fir.box> -!CHECK: %[[X_REF:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFreduction_iorEx"} -!CHECK: omp.parallel -!CHECK: omp.wsloop reduction(@[[IOR_DECLARE_I]] %[[X_REF]] -> %[[PRV:.+]] : !fir.ref) -!CHECK-NEXT: omp.loop_nest -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[Y_I_REF:.*]] = fir.coordinate_of %[[Y_BOX]] -!CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref -!CHECK: %[[RES:.+]] = arith.ori %[[LPRV]], %[[Y_I]] : i32 -!CHECK: fir.store %[[RES]] to %[[PRV]] : !fir.ref -!CHECK: omp.yield -!CHECK: omp.terminator -!CHECK: omp.terminator - -subroutine reduction_ior(y) - integer :: x, y(:) - x = 0 - !$omp parallel - !$omp do reduction(ior:x) - do i=1, 100 - x = ior(x, y(i)) - end do - !$omp end do - !$omp end parallel - print *, x -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-logical-eqv-byref.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-logical-eqv-byref.f90 deleted file mode 100644 index 17cd02a0ca7ff..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-logical-eqv-byref.f90 +++ /dev/null @@ -1,193 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp --force-byref-reduction %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -mmlir --force-byref-reduction %s -o - | FileCheck %s - -! NOTE: Assertions have been autogenerated by utils/generate-test-checks.py - -! CHECK-LABEL: omp.declare_reduction @eqv_reduction : !fir.ref> -! CHECK-SAME: init { -! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): -! CHECK: %[[VAL_1:.*]] = arith.constant true -! CHECK: %[[VAL_2:.*]] = fir.convert %[[VAL_1]] : (i1) -> !fir.logical<4> -! CHECK: %[[REF:.*]] = fir.alloca !fir.logical<4> -! CHECK: fir.store %[[VAL_2]] to %[[REF]] : !fir.ref> -! CHECK: omp.yield(%[[REF]] : !fir.ref>) - -! CHECK-LABEL: } combiner { -! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref>, %[[ARG1:.*]]: !fir.ref>): -! CHECK: %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref> -! CHECK: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref> -! CHECK: %[[VAL_2:.*]] = fir.convert %[[LD0]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_3:.*]] = fir.convert %[[LD1]] : (!fir.logical<4>) -> i1 -! CHECK: %[[RES:.*]] = arith.cmpi eq, %[[VAL_2]], %[[VAL_3]] : i1 -! CHECK: %[[VAL_5:.*]] = fir.convert %[[RES]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_5]] to %[[ARG0]] : !fir.ref> -! CHECK: omp.yield(%[[ARG0]] : !fir.ref>) -! CHECK: } - -! CHECK-LABEL: func.func @_QPsimple_reduction( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref>> {fir.bindc_name = "y"}) { -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_reductionEi"} -! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.logical<4> {bindc_name = "x", uniq_name = "_QFsimple_reductionEx"} -! CHECK: %[[VAL_3:.*]] = arith.constant true -! CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_3]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_4]] to %[[VAL_2]] : !fir.ref> -! CHECK: omp.parallel { -! CHECK: %[[VAL_5:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_7:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop byref reduction(@eqv_reduction %[[VAL_2]] -> %[[VAL_9:.*]] : !fir.ref>) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_10:.*]]) : i32 = (%[[VAL_6]]) to (%[[VAL_7]]) inclusive step (%[[VAL_8]]) { -! CHECK: fir.store %[[VAL_10]] to %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_9]] : !fir.ref> -! CHECK: %[[VAL_12:.*]] = fir.load %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_13:.*]] = fir.convert %[[VAL_12]] : (i32) -> i64 -! CHECK: %[[VAL_14:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_15:.*]] = arith.subi %[[VAL_13]], %[[VAL_14]] : i64 -! CHECK: %[[VAL_16:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_15]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_17:.*]] = fir.load %[[VAL_16]] : !fir.ref> -! CHECK: %[[VAL_18:.*]] = fir.convert %[[VAL_11]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_19:.*]] = fir.convert %[[VAL_17]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_20:.*]] = arith.cmpi eq, %[[VAL_18]], %[[VAL_19]] : i1 -! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_21]] to %[[VAL_9]] : !fir.ref> -! CHECK: omp.yield -! CHECK: omp.terminator -! CHECK: omp.terminator -! CHECK: return - -subroutine simple_reduction(y) - logical :: x, y(100) - x = .true. - !$omp parallel - !$omp do reduction(.eqv.:x) - do i=1, 100 - x = x .eqv. y(i) - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPsimple_reduction_switch_order( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref>> {fir.bindc_name = "y"}) { -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_reduction_switch_orderEi"} -! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.logical<4> {bindc_name = "x", uniq_name = "_QFsimple_reduction_switch_orderEx"} -! CHECK: %[[VAL_3:.*]] = arith.constant true -! CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_3]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_4]] to %[[VAL_2]] : !fir.ref> -! CHECK: omp.parallel { -! CHECK: %[[VAL_5:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_7:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop byref reduction(@eqv_reduction %[[VAL_2]] -> %[[VAL_9:.*]] : !fir.ref>) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_10:.*]]) : i32 = (%[[VAL_6]]) to (%[[VAL_7]]) inclusive step (%[[VAL_8]]) { -! CHECK: fir.store %[[VAL_10]] to %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_12:.*]] = fir.convert %[[VAL_11]] : (i32) -> i64 -! CHECK: %[[VAL_13:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_14:.*]] = arith.subi %[[VAL_12]], %[[VAL_13]] : i64 -! CHECK: %[[VAL_15:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_14]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_16:.*]] = fir.load %[[VAL_15]] : !fir.ref> -! CHECK: %[[VAL_17:.*]] = fir.load %[[VAL_9]] : !fir.ref> -! CHECK: %[[VAL_18:.*]] = fir.convert %[[VAL_16]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_19:.*]] = fir.convert %[[VAL_17]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_20:.*]] = arith.cmpi eq, %[[VAL_18]], %[[VAL_19]] : i1 -! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_21]] to %[[VAL_9]] : !fir.ref> -! CHECK: omp.yield -! CHECK: omp.terminator -! CHECK: omp.terminator -! CHECK: return - -subroutine simple_reduction_switch_order(y) - logical :: x, y(100) - x = .true. - !$omp parallel - !$omp do reduction(.eqv.:x) - do i=1, 100 - x = y(i) .eqv. x - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPmultiple_reductions( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref>> {fir.bindc_name = "w"}) { -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFmultiple_reductionsEi"} -! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.logical<4> {bindc_name = "x", uniq_name = "_QFmultiple_reductionsEx"} -! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.logical<4> {bindc_name = "y", uniq_name = "_QFmultiple_reductionsEy"} -! CHECK: %[[VAL_4:.*]] = fir.alloca !fir.logical<4> {bindc_name = "z", uniq_name = "_QFmultiple_reductionsEz"} -! CHECK: %[[VAL_5:.*]] = arith.constant true -! CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_5]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_6]] to %[[VAL_2]] : !fir.ref> -! CHECK: %[[VAL_7:.*]] = arith.constant true -! CHECK: %[[VAL_8:.*]] = fir.convert %[[VAL_7]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_8]] to %[[VAL_3]] : !fir.ref> -! CHECK: %[[VAL_9:.*]] = arith.constant true -! CHECK: %[[VAL_10:.*]] = fir.convert %[[VAL_9]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_10]] to %[[VAL_4]] : !fir.ref> -! CHECK: omp.parallel { -! CHECK: %[[VAL_11:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_12:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_13:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_14:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop byref reduction(@eqv_reduction %[[VAL_2]] -> %[[VAL_15:.*]] : !fir.ref>, @eqv_reduction %[[VAL_3]] -> %[[VAL_16:.*]] : !fir.ref>, @eqv_reduction %[[VAL_4]] -> %[[VAL_17:.*]] : !fir.ref>) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_18:.*]]) : i32 = (%[[VAL_12]]) to (%[[VAL_13]]) inclusive step (%[[VAL_14]]) { -! CHECK: fir.store %[[VAL_18]] to %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_19:.*]] = fir.load %[[VAL_15]] : !fir.ref> -! CHECK: %[[VAL_20:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (i32) -> i64 -! CHECK: %[[VAL_22:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_23:.*]] = arith.subi %[[VAL_21]], %[[VAL_22]] : i64 -! CHECK: %[[VAL_24:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_23]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_25:.*]] = fir.load %[[VAL_24]] : !fir.ref> -! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_19]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_27:.*]] = fir.convert %[[VAL_25]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_28:.*]] = arith.cmpi eq, %[[VAL_26]], %[[VAL_27]] : i1 -! CHECK: %[[VAL_29:.*]] = fir.convert %[[VAL_28]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_29]] to %[[VAL_15]] : !fir.ref> -! CHECK: %[[VAL_30:.*]] = fir.load %[[VAL_16]] : !fir.ref> -! CHECK: %[[VAL_31:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_32:.*]] = fir.convert %[[VAL_31]] : (i32) -> i64 -! CHECK: %[[VAL_33:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_34:.*]] = arith.subi %[[VAL_32]], %[[VAL_33]] : i64 -! CHECK: %[[VAL_35:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_34]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_36:.*]] = fir.load %[[VAL_35]] : !fir.ref> -! CHECK: %[[VAL_37:.*]] = fir.convert %[[VAL_30]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_38:.*]] = fir.convert %[[VAL_36]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_39:.*]] = arith.cmpi eq, %[[VAL_37]], %[[VAL_38]] : i1 -! CHECK: %[[VAL_40:.*]] = fir.convert %[[VAL_39]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_40]] to %[[VAL_16]] : !fir.ref> -! CHECK: %[[VAL_41:.*]] = fir.load %[[VAL_17]] : !fir.ref> -! CHECK: %[[VAL_42:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_43:.*]] = fir.convert %[[VAL_42]] : (i32) -> i64 -! CHECK: %[[VAL_44:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_45:.*]] = arith.subi %[[VAL_43]], %[[VAL_44]] : i64 -! CHECK: %[[VAL_46:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_45]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_47:.*]] = fir.load %[[VAL_46]] : !fir.ref> -! CHECK: %[[VAL_48:.*]] = fir.convert %[[VAL_41]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_49:.*]] = fir.convert %[[VAL_47]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_50:.*]] = arith.cmpi eq, %[[VAL_48]], %[[VAL_49]] : i1 -! CHECK: %[[VAL_51:.*]] = fir.convert %[[VAL_50]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_51]] to %[[VAL_17]] : !fir.ref> -! CHECK: omp.yield -! CHECK: omp.terminator -! CHECK: omp.terminator -! CHECK: return - -subroutine multiple_reductions(w) - logical :: x,y,z,w(100) - x = .true. - y = .true. - z = .true. - !$omp parallel - !$omp do reduction(.eqv.:x,y,z) - do i=1, 100 - x = x .eqv. w(i) - y = y .eqv. w(i) - z = z .eqv. w(i) - end do - !$omp end do - !$omp end parallel -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-logical-eqv.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-logical-eqv.f90 deleted file mode 100644 index e714e45540c39..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-logical-eqv.f90 +++ /dev/null @@ -1,187 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -! NOTE: Assertions have been autogenerated by utils/generate-test-checks.py - -! CHECK-LABEL: omp.declare_reduction @eqv_reduction : !fir.logical<4> init { -! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.logical<4>): -! CHECK: %[[VAL_1:.*]] = arith.constant true -! CHECK: %[[VAL_2:.*]] = fir.convert %[[VAL_1]] : (i1) -> !fir.logical<4> -! CHECK: omp.yield(%[[VAL_2]] : !fir.logical<4>) - -! CHECK-LABEL: } combiner { -! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.logical<4>, %[[VAL_1:.*]]: !fir.logical<4>): -! CHECK: %[[VAL_2:.*]] = fir.convert %[[VAL_0]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_3:.*]] = fir.convert %[[VAL_1]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_4:.*]] = arith.cmpi eq, %[[VAL_2]], %[[VAL_3]] : i1 -! CHECK: %[[VAL_5:.*]] = fir.convert %[[VAL_4]] : (i1) -> !fir.logical<4> -! CHECK: omp.yield(%[[VAL_5]] : !fir.logical<4>) -! CHECK: } - -! CHECK-LABEL: func.func @_QPsimple_reduction( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref>> {fir.bindc_name = "y"}) { -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_reductionEi"} -! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.logical<4> {bindc_name = "x", uniq_name = "_QFsimple_reductionEx"} -! CHECK: %[[VAL_3:.*]] = arith.constant true -! CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_3]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_4]] to %[[VAL_2]] : !fir.ref> -! CHECK: omp.parallel { -! CHECK: %[[VAL_5:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_7:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop reduction(@eqv_reduction %[[VAL_2]] -> %[[VAL_9:.*]] : !fir.ref>) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_10:.*]]) : i32 = (%[[VAL_6]]) to (%[[VAL_7]]) inclusive step (%[[VAL_8]]) { -! CHECK: fir.store %[[VAL_10]] to %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_9]] : !fir.ref> -! CHECK: %[[VAL_12:.*]] = fir.load %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_13:.*]] = fir.convert %[[VAL_12]] : (i32) -> i64 -! CHECK: %[[VAL_14:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_15:.*]] = arith.subi %[[VAL_13]], %[[VAL_14]] : i64 -! CHECK: %[[VAL_16:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_15]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_17:.*]] = fir.load %[[VAL_16]] : !fir.ref> -! CHECK: %[[VAL_18:.*]] = fir.convert %[[VAL_11]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_19:.*]] = fir.convert %[[VAL_17]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_20:.*]] = arith.cmpi eq, %[[VAL_18]], %[[VAL_19]] : i1 -! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_21]] to %[[VAL_9]] : !fir.ref> -! CHECK: omp.yield -! CHECK: omp.terminator -! CHECK: omp.terminator -! CHECK: return - -subroutine simple_reduction(y) - logical :: x, y(100) - x = .true. - !$omp parallel - !$omp do reduction(.eqv.:x) - do i=1, 100 - x = x .eqv. y(i) - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPsimple_reduction_switch_order( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref>> {fir.bindc_name = "y"}) { -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_reduction_switch_orderEi"} -! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.logical<4> {bindc_name = "x", uniq_name = "_QFsimple_reduction_switch_orderEx"} -! CHECK: %[[VAL_3:.*]] = arith.constant true -! CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_3]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_4]] to %[[VAL_2]] : !fir.ref> -! CHECK: omp.parallel { -! CHECK: %[[VAL_5:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_7:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop reduction(@eqv_reduction %[[VAL_2]] -> %[[VAL_9:.*]] : !fir.ref>) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_10:.*]]) : i32 = (%[[VAL_6]]) to (%[[VAL_7]]) inclusive step (%[[VAL_8]]) { -! CHECK: fir.store %[[VAL_10]] to %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_12:.*]] = fir.convert %[[VAL_11]] : (i32) -> i64 -! CHECK: %[[VAL_13:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_14:.*]] = arith.subi %[[VAL_12]], %[[VAL_13]] : i64 -! CHECK: %[[VAL_15:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_14]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_16:.*]] = fir.load %[[VAL_15]] : !fir.ref> -! CHECK: %[[VAL_17:.*]] = fir.load %[[VAL_9]] : !fir.ref> -! CHECK: %[[VAL_18:.*]] = fir.convert %[[VAL_16]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_19:.*]] = fir.convert %[[VAL_17]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_20:.*]] = arith.cmpi eq, %[[VAL_18]], %[[VAL_19]] : i1 -! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_21]] to %[[VAL_9]] : !fir.ref> -! CHECK: omp.yield -! CHECK: omp.terminator -! CHECK: omp.terminator -! CHECK: return - -subroutine simple_reduction_switch_order(y) - logical :: x, y(100) - x = .true. - !$omp parallel - !$omp do reduction(.eqv.:x) - do i=1, 100 - x = y(i) .eqv. x - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPmultiple_reductions( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref>> {fir.bindc_name = "w"}) { -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFmultiple_reductionsEi"} -! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.logical<4> {bindc_name = "x", uniq_name = "_QFmultiple_reductionsEx"} -! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.logical<4> {bindc_name = "y", uniq_name = "_QFmultiple_reductionsEy"} -! CHECK: %[[VAL_4:.*]] = fir.alloca !fir.logical<4> {bindc_name = "z", uniq_name = "_QFmultiple_reductionsEz"} -! CHECK: %[[VAL_5:.*]] = arith.constant true -! CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_5]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_6]] to %[[VAL_2]] : !fir.ref> -! CHECK: %[[VAL_7:.*]] = arith.constant true -! CHECK: %[[VAL_8:.*]] = fir.convert %[[VAL_7]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_8]] to %[[VAL_3]] : !fir.ref> -! CHECK: %[[VAL_9:.*]] = arith.constant true -! CHECK: %[[VAL_10:.*]] = fir.convert %[[VAL_9]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_10]] to %[[VAL_4]] : !fir.ref> -! CHECK: omp.parallel { -! CHECK: %[[VAL_11:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_12:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_13:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_14:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop reduction(@eqv_reduction %[[VAL_2]] -> %[[VAL_15:.*]] : !fir.ref>, @eqv_reduction %[[VAL_3]] -> %[[VAL_16:.*]] : !fir.ref>, @eqv_reduction %[[VAL_4]] -> %[[VAL_17:.*]] : !fir.ref>) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_18:.*]]) : i32 = (%[[VAL_12]]) to (%[[VAL_13]]) inclusive step (%[[VAL_14]]) { -! CHECK: fir.store %[[VAL_18]] to %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_19:.*]] = fir.load %[[VAL_15]] : !fir.ref> -! CHECK: %[[VAL_20:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (i32) -> i64 -! CHECK: %[[VAL_22:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_23:.*]] = arith.subi %[[VAL_21]], %[[VAL_22]] : i64 -! CHECK: %[[VAL_24:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_23]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_25:.*]] = fir.load %[[VAL_24]] : !fir.ref> -! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_19]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_27:.*]] = fir.convert %[[VAL_25]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_28:.*]] = arith.cmpi eq, %[[VAL_26]], %[[VAL_27]] : i1 -! CHECK: %[[VAL_29:.*]] = fir.convert %[[VAL_28]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_29]] to %[[VAL_15]] : !fir.ref> -! CHECK: %[[VAL_30:.*]] = fir.load %[[VAL_16]] : !fir.ref> -! CHECK: %[[VAL_31:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_32:.*]] = fir.convert %[[VAL_31]] : (i32) -> i64 -! CHECK: %[[VAL_33:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_34:.*]] = arith.subi %[[VAL_32]], %[[VAL_33]] : i64 -! CHECK: %[[VAL_35:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_34]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_36:.*]] = fir.load %[[VAL_35]] : !fir.ref> -! CHECK: %[[VAL_37:.*]] = fir.convert %[[VAL_30]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_38:.*]] = fir.convert %[[VAL_36]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_39:.*]] = arith.cmpi eq, %[[VAL_37]], %[[VAL_38]] : i1 -! CHECK: %[[VAL_40:.*]] = fir.convert %[[VAL_39]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_40]] to %[[VAL_16]] : !fir.ref> -! CHECK: %[[VAL_41:.*]] = fir.load %[[VAL_17]] : !fir.ref> -! CHECK: %[[VAL_42:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_43:.*]] = fir.convert %[[VAL_42]] : (i32) -> i64 -! CHECK: %[[VAL_44:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_45:.*]] = arith.subi %[[VAL_43]], %[[VAL_44]] : i64 -! CHECK: %[[VAL_46:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_45]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_47:.*]] = fir.load %[[VAL_46]] : !fir.ref> -! CHECK: %[[VAL_48:.*]] = fir.convert %[[VAL_41]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_49:.*]] = fir.convert %[[VAL_47]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_50:.*]] = arith.cmpi eq, %[[VAL_48]], %[[VAL_49]] : i1 -! CHECK: %[[VAL_51:.*]] = fir.convert %[[VAL_50]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_51]] to %[[VAL_17]] : !fir.ref> -! CHECK: omp.yield -! CHECK: omp.terminator -! CHECK: omp.terminator -! CHECK: return - -subroutine multiple_reductions(w) - logical :: x,y,z,w(100) - x = .true. - y = .true. - z = .true. - !$omp parallel - !$omp do reduction(.eqv.:x,y,z) - do i=1, 100 - x = x .eqv. w(i) - y = y .eqv. w(i) - z = z .eqv. w(i) - end do - !$omp end do - !$omp end parallel -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-logical-neqv-byref.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-logical-neqv-byref.f90 deleted file mode 100644 index 89d16c3191b26..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-logical-neqv-byref.f90 +++ /dev/null @@ -1,195 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp --force-byref-reduction %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -mmlir --force-byref-reduction %s -o - | FileCheck %s - -! NOTE: Assertions have been autogenerated by utils/generate-test-checks.py - - -! CHECK-LABEL: omp.declare_reduction @neqv_reduction : !fir.ref> -! CHECK-SAME: init { -! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref>): -! CHECK: %[[VAL_1:.*]] = arith.constant false -! CHECK: %[[VAL_2:.*]] = fir.convert %[[VAL_1]] : (i1) -> !fir.logical<4> -! CHECK: %[[REF:.*]] = fir.alloca !fir.logical<4> -! CHECK: fir.store %[[VAL_2]] to %[[REF]] : !fir.ref> -! CHECK: omp.yield(%[[REF]] : !fir.ref>) - -! CHECK-LABEL: } combiner { -! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref>, %[[ARG1:.*]]: !fir.ref>): -! CHECK: %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref> -! CHECK: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref> -! CHECK: %[[VAL_2:.*]] = fir.convert %[[LD0]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_3:.*]] = fir.convert %[[LD1]] : (!fir.logical<4>) -> i1 -! CHECK: %[[RES:.*]] = arith.cmpi ne, %[[VAL_2]], %[[VAL_3]] : i1 -! CHECK: %[[VAL_5:.*]] = fir.convert %[[RES]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_5]] to %[[ARG0]] : !fir.ref> -! CHECK: omp.yield(%[[ARG0]] : !fir.ref>) -! CHECK: } - -! CHECK-LABEL: func.func @_QPsimple_reduction( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref>> {fir.bindc_name = "y"}) { -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_reductionEi"} -! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.logical<4> {bindc_name = "x", uniq_name = "_QFsimple_reductionEx"} -! CHECK: %[[VAL_3:.*]] = arith.constant true -! CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_3]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_4]] to %[[VAL_2]] : !fir.ref> -! CHECK: omp.parallel { -! CHECK: %[[VAL_5:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_7:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop byref reduction(@neqv_reduction %[[VAL_2]] -> %[[VAL_9:.*]] : !fir.ref>) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_10:.*]]) : i32 = (%[[VAL_6]]) to (%[[VAL_7]]) inclusive step (%[[VAL_8]]) { -! CHECK: fir.store %[[VAL_10]] to %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_9]] : !fir.ref> -! CHECK: %[[VAL_12:.*]] = fir.load %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_13:.*]] = fir.convert %[[VAL_12]] : (i32) -> i64 -! CHECK: %[[VAL_14:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_15:.*]] = arith.subi %[[VAL_13]], %[[VAL_14]] : i64 -! CHECK: %[[VAL_16:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_15]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_17:.*]] = fir.load %[[VAL_16]] : !fir.ref> -! CHECK: %[[VAL_18:.*]] = fir.convert %[[VAL_11]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_19:.*]] = fir.convert %[[VAL_17]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_20:.*]] = arith.cmpi ne, %[[VAL_18]], %[[VAL_19]] : i1 -! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_21]] to %[[VAL_9]] : !fir.ref> -! CHECK: omp.yield -! CHECK: omp.terminator -! CHECK: omp.terminator -! CHECK: return - -subroutine simple_reduction(y) - logical :: x, y(100) - x = .true. - !$omp parallel - !$omp do reduction(.neqv.:x) - do i=1, 100 - x = x .neqv. y(i) - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPsimple_reduction_switch_order( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref>> {fir.bindc_name = "y"}) { -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_reduction_switch_orderEi"} -! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.logical<4> {bindc_name = "x", uniq_name = "_QFsimple_reduction_switch_orderEx"} -! CHECK: %[[VAL_3:.*]] = arith.constant true -! CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_3]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_4]] to %[[VAL_2]] : !fir.ref> -! CHECK: omp.parallel { -! CHECK: %[[VAL_5:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_7:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop byref reduction(@neqv_reduction %[[VAL_2]] -> %[[VAL_9:.*]] : !fir.ref>) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_10:.*]]) : i32 = (%[[VAL_6]]) to (%[[VAL_7]]) inclusive step (%[[VAL_8]]) { -! CHECK: fir.store %[[VAL_10]] to %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_12:.*]] = fir.convert %[[VAL_11]] : (i32) -> i64 -! CHECK: %[[VAL_13:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_14:.*]] = arith.subi %[[VAL_12]], %[[VAL_13]] : i64 -! CHECK: %[[VAL_15:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_14]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_16:.*]] = fir.load %[[VAL_15]] : !fir.ref> -! CHECK: %[[VAL_17:.*]] = fir.load %[[VAL_9]] : !fir.ref> -! CHECK: %[[VAL_18:.*]] = fir.convert %[[VAL_16]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_19:.*]] = fir.convert %[[VAL_17]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_20:.*]] = arith.cmpi ne, %[[VAL_18]], %[[VAL_19]] : i1 -! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_21]] to %[[VAL_9]] : !fir.ref> -! CHECK: omp.yield -! CHECK: omp.terminator -! CHECK: omp.terminator -! CHECK: return - -subroutine simple_reduction_switch_order(y) - logical :: x, y(100) - x = .true. - !$omp parallel - !$omp do reduction(.neqv.:x) - do i=1, 100 - x = y(i) .neqv. x - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPmultiple_reductions( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref>> {fir.bindc_name = "w"}) { -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFmultiple_reductionsEi"} -! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.logical<4> {bindc_name = "x", uniq_name = "_QFmultiple_reductionsEx"} -! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.logical<4> {bindc_name = "y", uniq_name = "_QFmultiple_reductionsEy"} -! CHECK: %[[VAL_4:.*]] = fir.alloca !fir.logical<4> {bindc_name = "z", uniq_name = "_QFmultiple_reductionsEz"} -! CHECK: %[[VAL_5:.*]] = arith.constant true -! CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_5]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_6]] to %[[VAL_2]] : !fir.ref> -! CHECK: %[[VAL_7:.*]] = arith.constant true -! CHECK: %[[VAL_8:.*]] = fir.convert %[[VAL_7]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_8]] to %[[VAL_3]] : !fir.ref> -! CHECK: %[[VAL_9:.*]] = arith.constant true -! CHECK: %[[VAL_10:.*]] = fir.convert %[[VAL_9]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_10]] to %[[VAL_4]] : !fir.ref> -! CHECK: omp.parallel { -! CHECK: %[[VAL_11:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_12:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_13:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_14:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop byref reduction(@neqv_reduction %[[VAL_2]] -> %[[VAL_15:.*]] : !fir.ref>, @neqv_reduction %[[VAL_3]] -> %[[VAL_16:.*]] : !fir.ref>, @neqv_reduction %[[VAL_4]] -> %[[VAL_17:.*]] : !fir.ref>) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_18:.*]]) : i32 = (%[[VAL_12]]) to (%[[VAL_13]]) inclusive step (%[[VAL_14]]) { -! CHECK: fir.store %[[VAL_18]] to %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_19:.*]] = fir.load %[[VAL_15]] : !fir.ref> -! CHECK: %[[VAL_20:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (i32) -> i64 -! CHECK: %[[VAL_22:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_23:.*]] = arith.subi %[[VAL_21]], %[[VAL_22]] : i64 -! CHECK: %[[VAL_24:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_23]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_25:.*]] = fir.load %[[VAL_24]] : !fir.ref> -! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_19]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_27:.*]] = fir.convert %[[VAL_25]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_28:.*]] = arith.cmpi ne, %[[VAL_26]], %[[VAL_27]] : i1 -! CHECK: %[[VAL_29:.*]] = fir.convert %[[VAL_28]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_29]] to %[[VAL_15]] : !fir.ref> -! CHECK: %[[VAL_30:.*]] = fir.load %[[VAL_16]] : !fir.ref> -! CHECK: %[[VAL_31:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_32:.*]] = fir.convert %[[VAL_31]] : (i32) -> i64 -! CHECK: %[[VAL_33:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_34:.*]] = arith.subi %[[VAL_32]], %[[VAL_33]] : i64 -! CHECK: %[[VAL_35:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_34]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_36:.*]] = fir.load %[[VAL_35]] : !fir.ref> -! CHECK: %[[VAL_37:.*]] = fir.convert %[[VAL_30]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_38:.*]] = fir.convert %[[VAL_36]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_39:.*]] = arith.cmpi ne, %[[VAL_37]], %[[VAL_38]] : i1 -! CHECK: %[[VAL_40:.*]] = fir.convert %[[VAL_39]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_40]] to %[[VAL_16]] : !fir.ref> -! CHECK: %[[VAL_41:.*]] = fir.load %[[VAL_17]] : !fir.ref> -! CHECK: %[[VAL_42:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_43:.*]] = fir.convert %[[VAL_42]] : (i32) -> i64 -! CHECK: %[[VAL_44:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_45:.*]] = arith.subi %[[VAL_43]], %[[VAL_44]] : i64 -! CHECK: %[[VAL_46:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_45]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_47:.*]] = fir.load %[[VAL_46]] : !fir.ref> -! CHECK: %[[VAL_48:.*]] = fir.convert %[[VAL_41]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_49:.*]] = fir.convert %[[VAL_47]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_50:.*]] = arith.cmpi ne, %[[VAL_48]], %[[VAL_49]] : i1 -! CHECK: %[[VAL_51:.*]] = fir.convert %[[VAL_50]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_51]] to %[[VAL_17]] : !fir.ref> -! CHECK: omp.yield -! CHECK: omp.terminator -! CHECK: omp.terminator -! CHECK: return - - -subroutine multiple_reductions(w) - logical :: x,y,z,w(100) - x = .true. - y = .true. - z = .true. - !$omp parallel - !$omp do reduction(.neqv.:x,y,z) - do i=1, 100 - x = x .neqv. w(i) - y = y .neqv. w(i) - z = z .neqv. w(i) - end do - !$omp end do - !$omp end parallel -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-logical-neqv.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-logical-neqv.f90 deleted file mode 100644 index 106e867f367b7..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-logical-neqv.f90 +++ /dev/null @@ -1,189 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s - -! NOTE: Assertions have been autogenerated by utils/generate-test-checks.py - - -! CHECK-LABEL: omp.declare_reduction @neqv_reduction : !fir.logical<4> init { -! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.logical<4>): -! CHECK: %[[VAL_1:.*]] = arith.constant false -! CHECK: %[[VAL_2:.*]] = fir.convert %[[VAL_1]] : (i1) -> !fir.logical<4> -! CHECK: omp.yield(%[[VAL_2]] : !fir.logical<4>) - -! CHECK-LABEL: } combiner { -! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.logical<4>, %[[VAL_1:.*]]: !fir.logical<4>): -! CHECK: %[[VAL_2:.*]] = fir.convert %[[VAL_0]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_3:.*]] = fir.convert %[[VAL_1]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_4:.*]] = arith.cmpi ne, %[[VAL_2]], %[[VAL_3]] : i1 -! CHECK: %[[VAL_5:.*]] = fir.convert %[[VAL_4]] : (i1) -> !fir.logical<4> -! CHECK: omp.yield(%[[VAL_5]] : !fir.logical<4>) -! CHECK: } - -! CHECK-LABEL: func.func @_QPsimple_reduction( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref>> {fir.bindc_name = "y"}) { -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_reductionEi"} -! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.logical<4> {bindc_name = "x", uniq_name = "_QFsimple_reductionEx"} -! CHECK: %[[VAL_3:.*]] = arith.constant true -! CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_3]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_4]] to %[[VAL_2]] : !fir.ref> -! CHECK: omp.parallel { -! CHECK: %[[VAL_5:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_7:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop reduction(@neqv_reduction %[[VAL_2]] -> %[[VAL_9:.*]] : !fir.ref>) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_10:.*]]) : i32 = (%[[VAL_6]]) to (%[[VAL_7]]) inclusive step (%[[VAL_8]]) { -! CHECK: fir.store %[[VAL_10]] to %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_9]] : !fir.ref> -! CHECK: %[[VAL_12:.*]] = fir.load %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_13:.*]] = fir.convert %[[VAL_12]] : (i32) -> i64 -! CHECK: %[[VAL_14:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_15:.*]] = arith.subi %[[VAL_13]], %[[VAL_14]] : i64 -! CHECK: %[[VAL_16:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_15]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_17:.*]] = fir.load %[[VAL_16]] : !fir.ref> -! CHECK: %[[VAL_18:.*]] = fir.convert %[[VAL_11]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_19:.*]] = fir.convert %[[VAL_17]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_20:.*]] = arith.cmpi ne, %[[VAL_18]], %[[VAL_19]] : i1 -! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_21]] to %[[VAL_9]] : !fir.ref> -! CHECK: omp.yield -! CHECK: omp.terminator -! CHECK: omp.terminator -! CHECK: return - -subroutine simple_reduction(y) - logical :: x, y(100) - x = .true. - !$omp parallel - !$omp do reduction(.neqv.:x) - do i=1, 100 - x = x .neqv. y(i) - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPsimple_reduction_switch_order( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref>> {fir.bindc_name = "y"}) { -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_reduction_switch_orderEi"} -! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.logical<4> {bindc_name = "x", uniq_name = "_QFsimple_reduction_switch_orderEx"} -! CHECK: %[[VAL_3:.*]] = arith.constant true -! CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_3]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_4]] to %[[VAL_2]] : !fir.ref> -! CHECK: omp.parallel { -! CHECK: %[[VAL_5:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_7:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop reduction(@neqv_reduction %[[VAL_2]] -> %[[VAL_9:.*]] : !fir.ref>) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_10:.*]]) : i32 = (%[[VAL_6]]) to (%[[VAL_7]]) inclusive step (%[[VAL_8]]) { -! CHECK: fir.store %[[VAL_10]] to %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_5]] : !fir.ref -! CHECK: %[[VAL_12:.*]] = fir.convert %[[VAL_11]] : (i32) -> i64 -! CHECK: %[[VAL_13:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_14:.*]] = arith.subi %[[VAL_12]], %[[VAL_13]] : i64 -! CHECK: %[[VAL_15:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_14]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_16:.*]] = fir.load %[[VAL_15]] : !fir.ref> -! CHECK: %[[VAL_17:.*]] = fir.load %[[VAL_9]] : !fir.ref> -! CHECK: %[[VAL_18:.*]] = fir.convert %[[VAL_16]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_19:.*]] = fir.convert %[[VAL_17]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_20:.*]] = arith.cmpi ne, %[[VAL_18]], %[[VAL_19]] : i1 -! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_21]] to %[[VAL_9]] : !fir.ref> -! CHECK: omp.yield -! CHECK: omp.terminator -! CHECK: omp.terminator -! CHECK: return - -subroutine simple_reduction_switch_order(y) - logical :: x, y(100) - x = .true. - !$omp parallel - !$omp do reduction(.neqv.:x) - do i=1, 100 - x = y(i) .neqv. x - end do - !$omp end do - !$omp end parallel -end subroutine - -! CHECK-LABEL: func.func @_QPmultiple_reductions( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref>> {fir.bindc_name = "w"}) { -! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFmultiple_reductionsEi"} -! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.logical<4> {bindc_name = "x", uniq_name = "_QFmultiple_reductionsEx"} -! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.logical<4> {bindc_name = "y", uniq_name = "_QFmultiple_reductionsEy"} -! CHECK: %[[VAL_4:.*]] = fir.alloca !fir.logical<4> {bindc_name = "z", uniq_name = "_QFmultiple_reductionsEz"} -! CHECK: %[[VAL_5:.*]] = arith.constant true -! CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_5]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_6]] to %[[VAL_2]] : !fir.ref> -! CHECK: %[[VAL_7:.*]] = arith.constant true -! CHECK: %[[VAL_8:.*]] = fir.convert %[[VAL_7]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_8]] to %[[VAL_3]] : !fir.ref> -! CHECK: %[[VAL_9:.*]] = arith.constant true -! CHECK: %[[VAL_10:.*]] = fir.convert %[[VAL_9]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_10]] to %[[VAL_4]] : !fir.ref> -! CHECK: omp.parallel { -! CHECK: %[[VAL_11:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} -! CHECK: %[[VAL_12:.*]] = arith.constant 1 : i32 -! CHECK: %[[VAL_13:.*]] = arith.constant 100 : i32 -! CHECK: %[[VAL_14:.*]] = arith.constant 1 : i32 -! CHECK: omp.wsloop reduction(@neqv_reduction %[[VAL_2]] -> %[[VAL_15:.*]] : !fir.ref>, @neqv_reduction %[[VAL_3]] -> %[[VAL_16:.*]] : !fir.ref>, @neqv_reduction %[[VAL_4]] -> %[[VAL_17:.*]] : !fir.ref>) { -! CHECK-NEXT: omp.loop_nest (%[[VAL_18:.*]]) : i32 = (%[[VAL_12]]) to (%[[VAL_13]]) inclusive step (%[[VAL_14]]) { -! CHECK: fir.store %[[VAL_18]] to %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_19:.*]] = fir.load %[[VAL_15]] : !fir.ref> -! CHECK: %[[VAL_20:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (i32) -> i64 -! CHECK: %[[VAL_22:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_23:.*]] = arith.subi %[[VAL_21]], %[[VAL_22]] : i64 -! CHECK: %[[VAL_24:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_23]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_25:.*]] = fir.load %[[VAL_24]] : !fir.ref> -! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_19]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_27:.*]] = fir.convert %[[VAL_25]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_28:.*]] = arith.cmpi ne, %[[VAL_26]], %[[VAL_27]] : i1 -! CHECK: %[[VAL_29:.*]] = fir.convert %[[VAL_28]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_29]] to %[[VAL_15]] : !fir.ref> -! CHECK: %[[VAL_30:.*]] = fir.load %[[VAL_16]] : !fir.ref> -! CHECK: %[[VAL_31:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_32:.*]] = fir.convert %[[VAL_31]] : (i32) -> i64 -! CHECK: %[[VAL_33:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_34:.*]] = arith.subi %[[VAL_32]], %[[VAL_33]] : i64 -! CHECK: %[[VAL_35:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_34]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_36:.*]] = fir.load %[[VAL_35]] : !fir.ref> -! CHECK: %[[VAL_37:.*]] = fir.convert %[[VAL_30]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_38:.*]] = fir.convert %[[VAL_36]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_39:.*]] = arith.cmpi ne, %[[VAL_37]], %[[VAL_38]] : i1 -! CHECK: %[[VAL_40:.*]] = fir.convert %[[VAL_39]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_40]] to %[[VAL_16]] : !fir.ref> -! CHECK: %[[VAL_41:.*]] = fir.load %[[VAL_17]] : !fir.ref> -! CHECK: %[[VAL_42:.*]] = fir.load %[[VAL_11]] : !fir.ref -! CHECK: %[[VAL_43:.*]] = fir.convert %[[VAL_42]] : (i32) -> i64 -! CHECK: %[[VAL_44:.*]] = arith.constant 1 : i64 -! CHECK: %[[VAL_45:.*]] = arith.subi %[[VAL_43]], %[[VAL_44]] : i64 -! CHECK: %[[VAL_46:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_45]] : (!fir.ref>>, i64) -> !fir.ref> -! CHECK: %[[VAL_47:.*]] = fir.load %[[VAL_46]] : !fir.ref> -! CHECK: %[[VAL_48:.*]] = fir.convert %[[VAL_41]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_49:.*]] = fir.convert %[[VAL_47]] : (!fir.logical<4>) -> i1 -! CHECK: %[[VAL_50:.*]] = arith.cmpi ne, %[[VAL_48]], %[[VAL_49]] : i1 -! CHECK: %[[VAL_51:.*]] = fir.convert %[[VAL_50]] : (i1) -> !fir.logical<4> -! CHECK: fir.store %[[VAL_51]] to %[[VAL_17]] : !fir.ref> -! CHECK: omp.yield -! CHECK: omp.terminator -! CHECK: omp.terminator -! CHECK: return - - -subroutine multiple_reductions(w) - logical :: x,y,z,w(100) - x = .true. - y = .true. - z = .true. - !$omp parallel - !$omp do reduction(.neqv.:x,y,z) - do i=1, 100 - x = x .neqv. w(i) - y = y .neqv. w(i) - z = z .neqv. w(i) - end do - !$omp end do - !$omp end parallel -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-max-byref.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-max-byref.f90 deleted file mode 100644 index a4244d11a5586..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-max-byref.f90 +++ /dev/null @@ -1,95 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp --force-byref-reduction -o - %s 2>&1 | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -mmlir --force-byref-reduction -o - %s 2>&1 | FileCheck %s - -!CHECK: omp.declare_reduction @max_byref_f32 : !fir.ref -!CHECK-SAME: init { -!CHECK: %[[MINIMUM_VAL:.*]] = arith.constant -3.40282347E+38 : f32 -!CHECK: %[[REF:.*]] = fir.alloca f32 -!CHECK: fir.store %[[MINIMUM_VAL]] to %[[REF]] : !fir.ref -!CHECK: omp.yield(%[[REF]] : !fir.ref) -!CHECK: combiner -!CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref, %[[ARG1:.*]]: !fir.ref): -!CHECK: %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref -!CHECK: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref -!CHECK: %[[RES:.*]] = arith.maxnumf %[[LD0]], %[[LD1]] {{.*}}: f32 -!CHECK: fir.store %[[RES]] to %[[ARG0]] : !fir.ref -!CHECK: omp.yield(%[[ARG0]] : !fir.ref) - -!CHECK-LABEL: omp.declare_reduction @max_byref_i32 : !fir.ref -!CHECK-SAME: init { -!CHECK: %[[MINIMUM_VAL:.*]] = arith.constant -2147483648 : i32 -!CHECK: fir.store %[[MINIMUM_VAL]] to %[[REF]] : !fir.ref -!CHECK: omp.yield(%[[REF]] : !fir.ref) -!CHECK: combiner -!CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref, %[[ARG1:.*]]: !fir.ref): -!CHECK: %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref -!CHECK: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref -!CHECK: %[[RES:.*]] = arith.maxsi %[[LD0]], %[[LD1]] : i32 -!CHECK: fir.store %[[RES]] to %[[ARG0]] : !fir.ref -!CHECK: omp.yield(%[[ARG0]] : !fir.ref) - -!CHECK-LABEL: @_QPreduction_max_int -!CHECK-SAME: %[[Y_BOX:.*]]: !fir.box> -!CHECK: %[[X_REF:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFreduction_max_intEx"} -!CHECK: omp.parallel -!CHECK: omp.wsloop byref reduction(@max_byref_i32 %[[X_REF]] -> %[[PRV:.+]] : !fir.ref) -!CHECK-NEXT: omp.loop_nest -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[Y_I_REF:.*]] = fir.coordinate_of %[[Y_BOX]] -!CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref -!CHECK: %[[RES:.+]] = arith.cmpi sgt, %[[LPRV]], %[[Y_I]] : i32 -!CHECK: %[[SEL:.+]] = arith.select %[[RES]], %[[LPRV]], %[[Y_I]] -!CHECK: fir.store %[[SEL]] to %[[PRV]] : !fir.ref -!CHECK: omp.yield -!CHECK: omp.terminator -!CHECK: omp.terminator - -!CHECK-LABEL: @_QPreduction_max_real -!CHECK-SAME: %[[Y_BOX:.*]]: !fir.box> -!CHECK: %[[X_REF:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFreduction_max_realEx"} -!CHECK: omp.parallel -!CHECK: omp.wsloop byref reduction(@max_byref_f32 %[[X_REF]] -> %[[PRV:.+]] : !fir.ref) -!CHECK-NEXT: omp.loop_nest -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[Y_I_REF:.*]] = fir.coordinate_of %[[Y_BOX]] -!CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref -!CHECK: %[[RES:.+]] = arith.cmpf ogt, %[[Y_I]], %[[LPRV]] {{.*}} : f32 -!CHECK: omp.yield -!CHECK: omp.terminator -!CHECK: omp.terminator - -subroutine reduction_max_int(y) - integer :: x, y(:) - x = 0 - !$omp parallel - !$omp do reduction(max:x) - do i=1, 100 - x = max(x, y(i)) - end do - !$omp end do - !$omp end parallel - print *, x -end subroutine - -subroutine reduction_max_real(y) - real :: x, y(:) - x = 0.0 - !$omp parallel - !$omp do reduction(max:x) - do i=1, 100 - x = max(y(i), x) - end do - !$omp end do - !$omp end parallel - print *, x - - !$omp parallel - !$omp do reduction(max:x) - do i=1, 100 - !CHECK-NOT: omp.reduction - if (y(i) .gt. x) x = y(i) - end do - !$omp end do - !$omp end parallel - print *, x -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-max.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-max.f90 deleted file mode 100644 index e000bc36ca3fb..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-max.f90 +++ /dev/null @@ -1,84 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp -o - %s 2>&1 | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s - -!CHECK: omp.declare_reduction @[[MAX_DECLARE_F:.*]] : f32 init { -!CHECK: %[[MINIMUM_VAL_F:.*]] = arith.constant -3.40282347E+38 : f32 -!CHECK: omp.yield(%[[MINIMUM_VAL_F]] : f32) -!CHECK: combiner -!CHECK: ^bb0(%[[ARG0_F:.*]]: f32, %[[ARG1_F:.*]]: f32): -!CHECK: %[[COMB_VAL_F:.*]] = arith.maxnumf %[[ARG0_F]], %[[ARG1_F]] {{.*}}: f32 -!CHECK: omp.yield(%[[COMB_VAL_F]] : f32) - -!CHECK: omp.declare_reduction @[[MAX_DECLARE_I:.*]] : i32 init { -!CHECK: %[[MINIMUM_VAL_I:.*]] = arith.constant -2147483648 : i32 -!CHECK: omp.yield(%[[MINIMUM_VAL_I]] : i32) -!CHECK: combiner -!CHECK: ^bb0(%[[ARG0_I:.*]]: i32, %[[ARG1_I:.*]]: i32): -!CHECK: %[[COMB_VAL_I:.*]] = arith.maxsi %[[ARG0_I]], %[[ARG1_I]] : i32 -!CHECK: omp.yield(%[[COMB_VAL_I]] : i32) - -!CHECK-LABEL: @_QPreduction_max_int -!CHECK-SAME: %[[Y_BOX:.*]]: !fir.box> -!CHECK: %[[X_REF:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFreduction_max_intEx"} -!CHECK: omp.parallel -!CHECK: omp.wsloop reduction(@[[MAX_DECLARE_I]] %[[X_REF]] -> %[[PRV:.+]] : !fir.ref) -!CHECK-NEXT: omp.loop_nest -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[Y_I_REF:.*]] = fir.coordinate_of %[[Y_BOX]] -!CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref -!CHECK: %[[RES:.+]] = arith.cmpi sgt, %[[LPRV]], %[[Y_I]] : i32 -!CHECK: %[[SEL:.+]] = arith.select %[[RES]], %[[LPRV]], %[[Y_I]] -!CHECK: fir.store %[[SEL]] to %[[PRV]] : !fir.ref -!CHECK: omp.yield -!CHECK: omp.terminator -!CHECK: omp.terminator - -!CHECK-LABEL: @_QPreduction_max_real -!CHECK-SAME: %[[Y_BOX:.*]]: !fir.box> -!CHECK: %[[X_REF:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFreduction_max_realEx"} -!CHECK: omp.parallel -!CHECK: omp.wsloop reduction(@[[MAX_DECLARE_F]] %[[X_REF]] -> %[[PRV:.+]] : !fir.ref) -!CHECK-NEXT: omp.loop_nest -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[Y_I_REF:.*]] = fir.coordinate_of %[[Y_BOX]] -!CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref -!CHECK: %[[RES:.+]] = arith.cmpf ogt, %[[Y_I]], %[[LPRV]] {{.*}} : f32 -!CHECK: omp.yield -!CHECK: omp.terminator -!CHECK: omp.terminator - -subroutine reduction_max_int(y) - integer :: x, y(:) - x = 0 - !$omp parallel - !$omp do reduction(max:x) - do i=1, 100 - x = max(x, y(i)) - end do - !$omp end do - !$omp end parallel - print *, x -end subroutine - -subroutine reduction_max_real(y) - real :: x, y(:) - x = 0.0 - !$omp parallel - !$omp do reduction(max:x) - do i=1, 100 - x = max(y(i), x) - end do - !$omp end do - !$omp end parallel - print *, x - - !$omp parallel - !$omp do reduction(max:x) - do i=1, 100 - !CHECK-NOT: omp.reduction - if (y(i) .gt. x) x = y(i) - end do - !$omp end do - !$omp end parallel - print *, x -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-min-byref.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-min-byref.f90 deleted file mode 100644 index 17435e1a194ca..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-min-byref.f90 +++ /dev/null @@ -1,95 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp --force-byref-reduction -o - %s 2>&1 | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mmlir --force-byref-reduction -fopenmp -o - %s 2>&1 | FileCheck %s - -!CHECK: omp.declare_reduction @min_byref_f32 : !fir.ref -!CHECK-SAME: init { -!CHECK: %[[MAXIMUM_VAL:.*]] = arith.constant 3.40282347E+38 : f32 -!CHECK: %[[REF:.*]] = fir.alloca f32 -!CHECK: fir.store %[[MAXIMUM_VAL]] to %[[REF]] : !fir.ref -!CHECK: omp.yield(%[[REF]] : !fir.ref) -!CHECK: combiner -!CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref, %[[ARG1:.*]]: !fir.ref): -!CHECK: %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref -!CHECK: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref -!CHECK: %[[RES:.*]] = arith.minnumf %[[LD0]], %[[LD1]] {{.*}}: f32 -!CHECK: fir.store %[[RES]] to %[[ARG0]] : !fir.ref -!CHECK: omp.yield(%[[ARG0]] : !fir.ref) - -!CHECK-LABEL: omp.declare_reduction @min_byref_i32 : !fir.ref -!CHECK-SAME: init { -!CHECK: %[[MAXIMUM_VAL:.*]] = arith.constant 2147483647 : i32 -!CHECK: fir.store %[[MAXIMUM_VAL]] to %[[REF]] : !fir.ref -!CHECK: omp.yield(%[[REF]] : !fir.ref) -!CHECK: combiner -!CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref, %[[ARG1:.*]]: !fir.ref): -!CHECK: %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref -!CHECK: %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref -!CHECK: %[[RES:.*]] = arith.minsi %[[LD0]], %[[LD1]] : i32 -!CHECK: fir.store %[[RES]] to %[[ARG0]] : !fir.ref -!CHECK: omp.yield(%[[ARG0]] : !fir.ref) - -!CHECK-LABEL: @_QPreduction_min_int -!CHECK-SAME: %[[Y_BOX:.*]]: !fir.box> -!CHECK: %[[X_REF:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFreduction_min_intEx"} -!CHECK: omp.parallel -!CHECK: omp.wsloop byref reduction(@min_byref_i32 %[[X_REF]] -> %[[PRV:.+]] : !fir.ref) -!CHECK-NEXT: omp.loop_nest -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[Y_I_REF:.*]] = fir.coordinate_of %[[Y_BOX]] -!CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref -!CHECK: %[[RES:.+]] = arith.cmpi slt, %[[LPRV]], %[[Y_I]] : i32 -!CHECK: %[[SEL:.+]] = arith.select %[[RES]], %[[LPRV]], %[[Y_I]] -!CHECK: fir.store %[[SEL]] to %[[PRV]] : !fir.ref -!CHECK: omp.yield -!CHECK: omp.terminator -!CHECK: omp.terminator - -!CHECK-LABEL: @_QPreduction_min_real -!CHECK-SAME: %[[Y_BOX:.*]]: !fir.box> -!CHECK: %[[X_REF:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFreduction_min_realEx"} -!CHECK: omp.parallel -!CHECK: omp.wsloop byref reduction(@min_byref_f32 %[[X_REF]] -> %[[PRV:.+]] : !fir.ref) -!CHECK-NEXT: omp.loop_nest -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[Y_I_REF:.*]] = fir.coordinate_of %[[Y_BOX]] -!CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref -!CHECK: %[[RES:.+]] = arith.cmpf ogt, %[[Y_I]], %[[LPRV]] {{.*}} : f32 -!CHECK: omp.yield -!CHECK: omp.terminator -!CHECK: omp.terminator - -subroutine reduction_min_int(y) - integer :: x, y(:) - x = 0 - !$omp parallel - !$omp do reduction(min:x) - do i=1, 100 - x = min(x, y(i)) - end do - !$omp end do - !$omp end parallel - print *, x -end subroutine - -subroutine reduction_min_real(y) - real :: x, y(:) - x = 0.0 - !$omp parallel - !$omp do reduction(min:x) - do i=1, 100 - x = min(y(i), x) - end do - !$omp end do - !$omp end parallel - print *, x - - !$omp parallel - !$omp do reduction(min:x) - do i=1, 100 - !CHECK-NOT: omp.reduction - if (y(i) .gt. x) x = y(i) - end do - !$omp end do - !$omp end parallel - print *, x -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-min.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-reduction-min.f90 deleted file mode 100644 index 1d18ece7297d4..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-reduction-min.f90 +++ /dev/null @@ -1,84 +0,0 @@ -! RUN: bbc -emit-fir -hlfir=false -fopenmp -o - %s 2>&1 | FileCheck %s -! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s - -!CHECK: omp.declare_reduction @[[MIN_DECLARE_F:.*]] : f32 init { -!CHECK: %[[MAXIMUM_VAL_F:.*]] = arith.constant 3.40282347E+38 : f32 -!CHECK: omp.yield(%[[MAXIMUM_VAL_F]] : f32) -!CHECK: combiner -!CHECK: ^bb0(%[[ARG0_F:.*]]: f32, %[[ARG1_F:.*]]: f32): -!CHECK: %[[COMB_VAL_F:.*]] = arith.minnumf %[[ARG0_F]], %[[ARG1_F]] {{.*}}: f32 -!CHECK: omp.yield(%[[COMB_VAL_F]] : f32) - -!CHECK: omp.declare_reduction @[[MIN_DECLARE_I:.*]] : i32 init { -!CHECK: %[[MAXIMUM_VAL_I:.*]] = arith.constant 2147483647 : i32 -!CHECK: omp.yield(%[[MAXIMUM_VAL_I]] : i32) -!CHECK: combiner -!CHECK: ^bb0(%[[ARG0_I:.*]]: i32, %[[ARG1_I:.*]]: i32): -!CHECK: %[[COMB_VAL_I:.*]] = arith.minsi %[[ARG0_I]], %[[ARG1_I]] : i32 -!CHECK: omp.yield(%[[COMB_VAL_I]] : i32) - -!CHECK-LABEL: @_QPreduction_min_int -!CHECK-SAME: %[[Y_BOX:.*]]: !fir.box> -!CHECK: %[[X_REF:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFreduction_min_intEx"} -!CHECK: omp.parallel -!CHECK: omp.wsloop reduction(@[[MIN_DECLARE_I]] %[[X_REF]] -> %[[PRV:.+]] : !fir.ref) -!CHECK-NEXT: omp.loop_nest -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[Y_I_REF:.*]] = fir.coordinate_of %[[Y_BOX]] -!CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref -!CHECK: %[[RES:.+]] = arith.cmpi slt, %[[LPRV]], %[[Y_I]] : i32 -!CHECK: %[[SEL:.+]] = arith.select %[[RES]], %[[LPRV]], %[[Y_I]] -!CHECK: fir.store %[[SEL]] to %[[PRV]] : !fir.ref -!CHECK: omp.yield -!CHECK: omp.terminator -!CHECK: omp.terminator - -!CHECK-LABEL: @_QPreduction_min_real -!CHECK-SAME: %[[Y_BOX:.*]]: !fir.box> -!CHECK: %[[X_REF:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFreduction_min_realEx"} -!CHECK: omp.parallel -!CHECK: omp.wsloop reduction(@[[MIN_DECLARE_F]] %[[X_REF]] -> %[[PRV:.+]] : !fir.ref) -!CHECK-NEXT: omp.loop_nest -!CHECK: %[[LPRV:.+]] = fir.load %[[PRV]] : !fir.ref -!CHECK: %[[Y_I_REF:.*]] = fir.coordinate_of %[[Y_BOX]] -!CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref -!CHECK: %[[RES:.+]] = arith.cmpf ogt, %[[Y_I]], %[[LPRV]] {{.*}} : f32 -!CHECK: omp.yield -!CHECK: omp.terminator -!CHECK: omp.terminator - -subroutine reduction_min_int(y) - integer :: x, y(:) - x = 0 - !$omp parallel - !$omp do reduction(min:x) - do i=1, 100 - x = min(x, y(i)) - end do - !$omp end do - !$omp end parallel - print *, x -end subroutine - -subroutine reduction_min_real(y) - real :: x, y(:) - x = 0.0 - !$omp parallel - !$omp do reduction(min:x) - do i=1, 100 - x = min(y(i), x) - end do - !$omp end do - !$omp end parallel - print *, x - - !$omp parallel - !$omp do reduction(min:x) - do i=1, 100 - !CHECK-NOT: omp.reduction - if (y(i) .gt. x) x = y(i) - end do - !$omp end do - !$omp end parallel - print *, x -end subroutine diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-simd.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-simd.f90 deleted file mode 100644 index 751e4c8c57094..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-simd.f90 +++ /dev/null @@ -1,37 +0,0 @@ -! This test checks lowering of OpenMP DO Directive(Worksharing) with -! simd schedule modifier. - -! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s - -program wsloop_dynamic - integer :: i -!CHECK-LABEL: func @_QQmain() - -!$OMP PARALLEL -!CHECK: omp.parallel { - -!$OMP DO SCHEDULE(simd: runtime) -!CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32 -!CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32 -!CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32 -!CHECK: omp.wsloop schedule(runtime, simd) nowait { -!CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) { -!CHECK: fir.store %[[I]] to %[[STORE:.*]] : !fir.ref - - do i=1, 9 - print*, i -!CHECK: %[[RTBEGIN:.*]] = fir.call @_FortranAioBeginExternalListOutput -!CHECK: %[[LOAD:.*]] = fir.load %[[STORE]] : !fir.ref -!CHECK: fir.call @_FortranAioOutputInteger32(%[[RTBEGIN]], %[[LOAD]]) {{.*}}: (!fir.ref, i32) -> i1 -!CHECK: fir.call @_FortranAioEndIoStatement(%[[RTBEGIN]]) {{.*}}: (!fir.ref) -> i32 - end do -!CHECK: omp.yield -!CHECK: } -!CHECK: omp.terminator -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - -!$OMP END DO NOWAIT -!$OMP END PARALLEL -end diff --git a/flang/test/Lower/OpenMP/FIR/wsloop-variable.f90 b/flang/test/Lower/OpenMP/FIR/wsloop-variable.f90 deleted file mode 100644 index 4bd8760122789..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop-variable.f90 +++ /dev/null @@ -1,187 +0,0 @@ -! This test checks lowering of OpenMP DO Directive(Worksharing) for different -! types of loop iteration variable, lower bound, upper bound, and step. - -!REQUIRES: shell -!RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - 2>&1 | FileCheck %s - -!CHECK: OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed into 64 bits. - -program wsloop_variable - integer(kind=1) :: i1_lb, i1_ub - integer(kind=2) :: i2, i2_ub, i2_s - integer(kind=4) :: i4_s - integer(kind=8) :: i8, i8_s - integer(kind=16) :: i16, i16_lb - real :: x - -!CHECK: %[[TMP0:.*]] = arith.constant 1 : i32 -!CHECK: %[[TMP1:.*]] = arith.constant 100 : i32 -!CHECK: %[[TMP2:.*]] = fir.convert %[[TMP0]] : (i32) -> i64 -!CHECK: %[[TMP3:.*]] = fir.convert %{{.*}} : (i8) -> i64 -!CHECK: %[[TMP4:.*]] = fir.convert %{{.*}} : (i16) -> i64 -!CHECK: %[[TMP5:.*]] = fir.convert %{{.*}} : (i128) -> i64 -!CHECK: %[[TMP6:.*]] = fir.convert %[[TMP1]] : (i32) -> i64 -!CHECK: %[[TMP7:.*]] = fir.convert %{{.*}} : (i32) -> i64 -!CHECK: omp.wsloop { -!CHECK-NEXT: omp.loop_nest (%[[ARG0:.*]], %[[ARG1:.*]]) : i64 = (%[[TMP2]], %[[TMP5]]) to (%[[TMP3]], %[[TMP6]]) inclusive step (%[[TMP4]], %[[TMP7]]) { -!CHECK: %[[ARG0_I16:.*]] = fir.convert %[[ARG0]] : (i64) -> i16 -!CHECK: fir.store %[[ARG0_I16]] to %[[STORE_IV0:.*]] : !fir.ref -!CHECK: fir.store %[[ARG1]] to %[[STORE_IV1:.*]] : !fir.ref -!CHECK: %[[LOAD_IV0:.*]] = fir.load %[[STORE_IV0]] : !fir.ref -!CHECK: %[[LOAD_IV0_I64:.*]] = fir.convert %[[LOAD_IV0]] : (i16) -> i64 -!CHECK: %[[LOAD_IV1:.*]] = fir.load %[[STORE_IV1]] : !fir.ref -!CHECK: %[[TMP10:.*]] = arith.addi %[[LOAD_IV0_I64]], %[[LOAD_IV1]] : i64 -!CHECK: %[[TMP11:.*]] = fir.convert %[[TMP10]] : (i64) -> f32 -!CHECK: fir.store %[[TMP11]] to %{{.*}} : !fir.ref -!CHECK: omp.yield -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - - !$omp do collapse(2) - do i2 = 1, i1_ub, i2_s - do i8 = i16_lb, 100, i4_s - x = i2 + i8 - end do - end do - !$omp end do - -!CHECK: %[[TMP12:.*]] = arith.constant 1 : i32 -!CHECK: %[[TMP13:.*]] = fir.convert %{{.*}} : (i8) -> i32 -!CHECK: %[[TMP14:.*]] = fir.convert %{{.*}} : (i64) -> i32 -!CHECK: omp.wsloop { -!CHECK-NEXT: omp.loop_nest (%[[ARG0:.*]]) : i32 = (%[[TMP12]]) to (%[[TMP13]]) inclusive step (%[[TMP14]]) { -!CHECK: %[[ARG0_I16:.*]] = fir.convert %[[ARG0]] : (i32) -> i16 -!CHECK: fir.store %[[ARG0_I16]] to %[[STORE3:.*]] : !fir.ref -!CHECK: %[[LOAD3:.*]] = fir.load %[[STORE3]] : !fir.ref -!CHECK: %[[TMP16:.*]] = fir.convert %[[LOAD3]] : (i16) -> f32 -!CHECK: fir.store %[[TMP16]] to %{{.*}} : !fir.ref -!CHECK: omp.yield -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - - !$omp do - do i2 = 1, i1_ub, i8_s - x = i2 - end do - !$omp end do - -!CHECK: %[[TMP17:.*]] = fir.convert %{{.*}} : (i8) -> i64 -!CHECK: %[[TMP18:.*]] = fir.convert %{{.*}} : (i16) -> i64 -!CHECK: %[[TMP19:.*]] = fir.convert %{{.*}} : (i32) -> i64 -!CHECK: omp.wsloop { -!CHECK-NEXT: omp.loop_nest (%[[ARG1:.*]]) : i64 = (%[[TMP17]]) to (%[[TMP18]]) inclusive step (%[[TMP19]]) { -!CHECK: %[[ARG1_I128:.*]] = fir.convert %[[ARG1]] : (i64) -> i128 -!CHECK: fir.store %[[ARG1_I128]] to %[[STORE4:.*]] : !fir.ref -!CHECK: %[[LOAD4:.*]] = fir.load %[[STORE4]] : !fir.ref -!CHECK: %[[TMP21:.*]] = fir.convert %[[LOAD4]] : (i128) -> f32 -!CHECK: fir.store %[[TMP21]] to %{{.*}} : !fir.ref -!CHECK: omp.yield -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - - !$omp do - do i16 = i1_lb, i2_ub, i4_s - x = i16 - end do - !$omp end do - -end program wsloop_variable - -!CHECK-LABEL: func.func @_QPwsloop_variable_sub() { -!CHECK: %[[IV2:.*]] = fir.alloca i8 {adapt.valuebyref, pinned} -!CHECK: %[[VAL_0:.*]] = fir.alloca i128 {bindc_name = "i16_lb", uniq_name = "_QFwsloop_variable_subEi16_lb"} -!CHECK: %[[VAL_1:.*]] = fir.alloca i8 {bindc_name = "i1_ub", uniq_name = "_QFwsloop_variable_subEi1_ub"} -!CHECK: %[[VAL_2:.*]] = fir.alloca i16 {bindc_name = "i2", uniq_name = "_QFwsloop_variable_subEi2"} -!CHECK: %[[VAL_3:.*]] = fir.alloca i16 {bindc_name = "i2_s", uniq_name = "_QFwsloop_variable_subEi2_s"} -!CHECK: %[[VAL_4:.*]] = fir.alloca i32 {bindc_name = "i4_s", uniq_name = "_QFwsloop_variable_subEi4_s"} -!CHECK: %[[VAL_5:.*]] = fir.alloca i64 {bindc_name = "i8", uniq_name = "_QFwsloop_variable_subEi8"} -!CHECK: %[[J1:.*]] = fir.alloca i8 {bindc_name = "j1", uniq_name = "_QFwsloop_variable_subEj1"} -!CHECK: %[[VAL_6:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFwsloop_variable_subEx"} -!CHECK: %[[VAL_7:.*]] = arith.constant 1 : i32 -!CHECK: %[[VAL_8:.*]] = fir.load %[[VAL_1]] : !fir.ref -!CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_3]] : !fir.ref -!CHECK: %[[VAL_10:.*]] = fir.convert %[[VAL_8]] : (i8) -> i32 -!CHECK: %[[VAL_11:.*]] = fir.convert %[[VAL_9]] : (i16) -> i32 -!CHECK: omp.wsloop { -!CHECK-NEXT: omp.loop_nest (%[[ARG0:.*]]) : i32 = (%[[VAL_7]]) to (%[[VAL_10]]) inclusive step (%[[VAL_11]]) { -!CHECK: %[[ARG0_I16:.*]] = fir.convert %[[ARG0]] : (i32) -> i16 -!CHECK: fir.store %[[ARG0_I16]] to %[[STORE_IV:.*]] : !fir.ref -!CHECK: %[[VAL_13:.*]] = fir.load %[[VAL_0]] : !fir.ref -!CHECK: %[[VAL_14:.*]] = fir.convert %[[VAL_13]] : (i128) -> index -!CHECK: %[[VAL_15:.*]] = arith.constant 100 : i32 -!CHECK: %[[VAL_16:.*]] = fir.convert %[[VAL_15]] : (i32) -> index -!CHECK: %[[VAL_17:.*]] = fir.load %[[VAL_4]] : !fir.ref -!CHECK: %[[VAL_18:.*]] = fir.convert %[[VAL_17]] : (i32) -> index -!CHECK: %[[LB:.*]] = fir.convert %[[VAL_14]] : (index) -> i64 -!CHECK: %[[VAL_19:.*]]:2 = fir.do_loop %[[VAL_20:[^ ]*]] = -!CHECK-SAME: %[[VAL_14]] to %[[VAL_16]] step %[[VAL_18]] -!CHECK-SAME: iter_args(%[[IV:.*]] = %[[LB]]) -> (index, i64) { -!CHECK: fir.store %[[IV]] to %[[VAL_5]] : !fir.ref -!CHECK: %[[LOAD_IV:.*]] = fir.load %[[STORE_IV]] : !fir.ref -!CHECK: %[[VAL_22:.*]] = fir.convert %[[LOAD_IV]] : (i16) -> i64 -!CHECK: %[[VAL_23:.*]] = fir.load %[[VAL_5]] : !fir.ref -!CHECK: %[[VAL_24:.*]] = arith.addi %[[VAL_22]], %[[VAL_23]] : i64 -!CHECK: %[[VAL_25:.*]] = fir.convert %[[VAL_24]] : (i64) -> f32 -!CHECK: fir.store %[[VAL_25]] to %[[VAL_6]] : !fir.ref -!CHECK: %[[VAL_26:.*]] = arith.addi %[[VAL_20]], %[[VAL_18]] : index -!CHECK: %[[STEPCAST:.*]] = fir.convert %[[VAL_18]] : (index) -> i64 -!CHECK: %[[IVLOAD:.*]] = fir.load %[[VAL_5]] : !fir.ref -!CHECK: %[[IVINC:.*]] = arith.addi %[[IVLOAD]], %[[STEPCAST]] -!CHECK: fir.result %[[VAL_26]], %[[IVINC]] : index, i64 -!CHECK: } -!CHECK: fir.store %[[VAL_19]]#1 to %[[VAL_5]] : !fir.ref -!CHECK: omp.yield -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - -subroutine wsloop_variable_sub - integer(kind=1) :: i1, i1_ub, j1 - integer(kind=2) :: i2, i2_s - integer(kind=4) :: i4_s - integer(kind=8) :: i8 - integer(kind=16) :: i16_lb - real :: x - - !$omp do - do i2 = 1, i1_ub, i2_s - do i8 = i16_lb, 100, i4_s - x = i2 + i8 - end do - end do - !$omp end do - -!CHECK: %[[C1:.*]] = arith.constant 1 : i32 -!CHECK: %[[C10:.*]] = arith.constant 10 : i32 -!CHECK: %[[C1_2:.*]] = arith.constant 1 : i32 -!CHECK: omp.wsloop { -!CHECK-NEXT: omp.loop_nest (%[[ARG0:.*]]) : i32 = (%[[C1]]) to (%[[C10]]) inclusive step (%[[C1_2]]) { -!CHECK: %[[ARG0_I8:.*]] = fir.convert %[[ARG0]] : (i32) -> i8 -!CHECK: fir.store %[[ARG0_I8]] to %[[IV2]] : !fir.ref -!CHECK: %[[IV2LOAD:.*]] = fir.load %[[IV2]] : !fir.ref -!CHECK: %[[J1LOAD:.*]] = fir.load %[[J1]] : !fir.ref -!CHECK: %[[VAL_27:.*]] = arith.cmpi eq, %[[IV2LOAD]], %[[J1LOAD]] : i8 -!CHECK: fir.if %[[VAL_27]] { -!CHECK: } else { -!CHECK: } -!CHECK: omp.yield -!CHECK: } -!CHECK: omp.terminator -!CHECK: } - - j1 = 5 - !$omp do - do i1 = 1, 10 - if (i1 .eq. j1) then - print *, "EQ" - end if - end do - !$omp end do - -!CHECK: return -!CHECK: } - -end diff --git a/flang/test/Lower/OpenMP/FIR/wsloop.f90 b/flang/test/Lower/OpenMP/FIR/wsloop.f90 deleted file mode 100644 index c9e428abdb440..0000000000000 --- a/flang/test/Lower/OpenMP/FIR/wsloop.f90 +++ /dev/null @@ -1,78 +0,0 @@ -! This test checks lowering of OpenMP DO Directive (Worksharing). - -! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s - -!CHECK-LABEL: func @_QPsimple_loop() -subroutine simple_loop - integer :: i - ! CHECK: omp.parallel - !$OMP PARALLEL - ! CHECK: %[[ALLOCA_IV:.*]] = fir.alloca i32 {{{.*}}, pinned} - ! CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32 - ! CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32 - ! CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32 - ! CHECK: omp.wsloop { - ! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) { - !$OMP DO - do i=1, 9 - ! CHECK: fir.store %[[I]] to %[[ALLOCA_IV:.*]] : !fir.ref - ! CHECK: %[[LOAD_IV:.*]] = fir.load %[[ALLOCA_IV]] : !fir.ref - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - ! CHECK: omp.yield - ! CHECK: omp.terminator - !$OMP END DO - ! CHECK: omp.terminator - !$OMP END PARALLEL -end subroutine - -!CHECK-LABEL: func @_QPsimple_loop_with_step() -subroutine simple_loop_with_step - integer :: i - ! CHECK: omp.parallel - !$OMP PARALLEL - ! CHECK: %[[ALLOCA_IV:.*]] = fir.alloca i32 {{{.*}}, pinned} - ! CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32 - ! CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32 - ! CHECK: %[[WS_STEP:.*]] = arith.constant 2 : i32 - ! CHECK: omp.wsloop { - ! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) { - ! CHECK: fir.store %[[I]] to %[[ALLOCA_IV]] : !fir.ref - ! CHECK: %[[LOAD_IV:.*]] = fir.load %[[ALLOCA_IV]] : !fir.ref - !$OMP DO - do i=1, 9, 2 - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - ! CHECK: omp.yield - ! CHECK: omp.terminator - !$OMP END DO - ! CHECK: omp.terminator - !$OMP END PARALLEL -end subroutine - -!CHECK-LABEL: func @_QPloop_with_schedule_nowait() -subroutine loop_with_schedule_nowait - integer :: i - ! CHECK: omp.parallel - !$OMP PARALLEL - ! CHECK: %[[ALLOCA_IV:.*]] = fir.alloca i32 {{{.*}}, pinned} - ! CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32 - ! CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32 - ! CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32 - ! CHECK: omp.wsloop schedule(runtime) nowait { - ! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) { - !$OMP DO SCHEDULE(runtime) - do i=1, 9 - ! CHECK: fir.store %[[I]] to %[[ALLOCA_IV]] : !fir.ref - ! CHECK: %[[LOAD_IV:.*]] = fir.load %[[ALLOCA_IV]] : !fir.ref - ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref, i32) -> i1 - print*, i - end do - ! CHECK: omp.yield - ! CHECK: omp.terminator - !$OMP END DO NOWAIT - ! CHECK: omp.terminator - !$OMP END PARALLEL -end subroutine