Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/Todo/reduction-task.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ subroutine reduction_task()

!$omp parallel reduction(task, +:i)
i = i + 1
!$omp end parallel
!$omp end parallel
end subroutine reduction_task
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/allocatable-array-bounds.f90
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
subroutine read_write_section()
integer, allocatable :: sp_read(:)
integer, allocatable :: sp_write(:)
allocate(sp_read(10))
allocate(sp_read(10))
allocate(sp_write(10))
sp_write = (/0,0,0,0,0,0,0,0,0,0/)
sp_read = (/1,2,3,4,5,6,7,8,9,10/)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/allocatable-map.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
!HLFIRDIALECT: %[[POINTER_MAP:.*]] = omp.map.info var_ptr(%[[POINTER]]#1 : !fir.ref<!fir.box<!fir.ptr<i32>>>, !fir.box<!fir.ptr<i32>>) map_clauses(always, to) capture(ByRef) members(%[[POINTER_MAP_MEMBER]] : [0] : !fir.llvm_ptr<!fir.ref<i32>>) -> !fir.ref<!fir.box<!fir.ptr<i32>>> {name = "point"}
!HLFIRDIALECT: omp.target map_entries(%[[POINTER_MAP]] -> {{.*}}, %[[POINTER_MAP_MEMBER]] -> {{.*}} : !fir.ref<!fir.box<!fir.ptr<i32>>>, !fir.llvm_ptr<!fir.ref<i32>>) {
subroutine pointer_routine()
integer, pointer :: point
integer, pointer :: point
!$omp target map(tofrom:point)
point = 1
!$omp end target
Expand Down
6 changes: 3 additions & 3 deletions flang/test/Lower/OpenMP/atomic-capture.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


program OmpAtomicCapture
use omp_lib
use omp_lib

!CHECK: %[[VAL_X_ALLOCA:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFEx"}
!CHECK: %[[VAL_X_DECLARE:.*]]:2 = hlfir.declare %[[VAL_X_ALLOCA]] {{.*}}
Expand All @@ -25,7 +25,7 @@ program OmpAtomicCapture
!CHECK: omp.atomic.read %[[VAL_X_DECLARE]]#0 = %[[VAL_Y_DECLARE]]#0 : !fir.ref<i32>, !fir.ref<i32>, i32
!CHECK: }
!$omp atomic hint(omp_sync_hint_uncontended) capture
y = x * y
y = x * y
x = y
!$omp end atomic

Expand All @@ -43,7 +43,7 @@ program OmpAtomicCapture
!CHECK: }
!$omp atomic hint(omp_lock_hint_nonspeculative) capture acquire
x = y
y = 2 * 10 + (8 - x)
y = 2 * 10 + (8 - x)
!$omp end atomic
end program

Expand Down
4 changes: 2 additions & 2 deletions flang/test/Lower/OpenMP/atomic-read-complex.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ program atomic_read_complex
complex(4) :: c41, c42
! Test complex(8) - double precision (16 bytes)
complex(8) :: c81, c82

c42 = (1.0_4, 1.0_4)
c82 = (1.0_8, 1.0_8)

Expand All @@ -25,7 +25,7 @@ program atomic_read_complex
! CHECK: call void @__atomic_load(i64 8, ptr {{.*}}, ptr {{.*}}, i32 {{.*}})
!$omp atomic read
c41 = c42

! Double precision complex: 16 bytes (this was broken before the fix)
! CHECK: call void @__atomic_load(i64 16, ptr {{.*}}, ptr {{.*}}, i32 {{.*}})
!$omp atomic read
Expand Down
10 changes: 5 additions & 5 deletions flang/test/Lower/OpenMP/atomic-update.f90
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ program OmpAtomicUpdate
!CHECK: omp.yield(%[[TEMP]] : i32)
!CHECK: }
!$omp atomic update
a = a + b
a = a + b

!CHECK: %[[VAL_c1:.*]] = arith.constant 1 : i32
!CHECK: omp.atomic.update %[[VAL_Y_DECLARE]]#0 : !fir.ref<i32> {
!CHECK: ^bb0(%[[ARG:.*]]: i32):
!CHECK: %[[TEMP:.*]] = arith.addi %[[ARG]], %[[VAL_c1]] : i32
!CHECK: omp.yield(%[[TEMP]] : i32)
!CHECK: }
!$omp atomic
!$omp atomic
y = y + 1

!CHECK: %[[VAL_X_LOADED:.*]] = fir.load %[[VAL_X_DECLARE]]#0 : !fir.ref<i32>
Expand All @@ -91,7 +91,7 @@ program OmpAtomicUpdate
!CHECK: omp.yield(%[[TEMP]] : i32)
!CHECK: }
!$omp atomic update
z = x * z
z = x * z

!CHECK: %[[VAL_c1:.*]] = arith.constant 1 : i32
!CHECK: omp.atomic.update hint(uncontended) memory_order(relaxed) %[[VAL_X_DECLARE]]#0 : !fir.ref<i32> {
Expand All @@ -110,7 +110,7 @@ program OmpAtomicUpdate
!CHECK: %[[TEMP:.*]] = arith.select {{.*}} : i32
!CHECK: omp.yield(%[[TEMP]] : i32)
!CHECK: }
!$omp atomic update relaxed
!$omp atomic update relaxed
y = max(y, c, d)

!CHECK: %[[VAL_X_LOADED:.*]] = fir.load %[[VAL_X_DECLARE]]#0 : !fir.ref<i32>
Expand Down Expand Up @@ -211,7 +211,7 @@ program OmpAtomicUpdate
!CHECK: %[[RESULT:.*]] = fir.convert %[[EXT]] : (f32) -> i32
!CHECK: omp.yield(%[[RESULT]] : i32)
!$omp atomic update
w = w + g
w = w + g
end program OmpAtomicUpdate

! Check that the clean-ups associated with the function call
Expand Down
8 changes: 4 additions & 4 deletions flang/test/Lower/OpenMP/atomic-write-complex.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ program atomic_write_complex

! Test complex(4) - single precision (8 bytes)
complex(4) :: c41, c42
! Test complex(8) - double precision (16 bytes)
! Test complex(8) - double precision (16 bytes)
complex(8) :: c81, c82

c42 = (1.0_4, 1.0_4)
c82 = (1.0_8, 1.0_8)

! CHECK-LABEL: define {{.*}} @_QQmain

! Single precision complex: 8 bytes
! CHECK: call void @__atomic_store(i64 8, ptr {{.*}}, ptr {{.*}}, i32 {{.*}})
!$omp atomic write
c41 = c42

! Double precision complex: 16 bytes (this was broken before the fix)
! CHECK: call void @__atomic_store(i64 16, ptr {{.*}}, ptr {{.*}}, i32 {{.*}})
!$omp atomic write
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/copyin.f90
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ subroutine common_2()
integer :: y
common /d/ x, y
!$omp threadprivate(/d/)

!$omp parallel do copyin(/d/)
do i = 1, x
y = y + i
Expand Down
8 changes: 4 additions & 4 deletions flang/test/Lower/OpenMP/declare-target-func-and-subr.f90
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
!RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 %s -o - | FileCheck %s --check-prefixes ALL,HOST
!RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 -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
! 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()
Expand Down Expand Up @@ -94,8 +94,8 @@ END FUNCTION FUNC_NAME_AS_RESULT

!! -----

! Check specification valid forms of declare target with subroutines
! utilising device_type and to clauses as well as the default
! 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()
Expand Down
20 changes: 10 additions & 10 deletions flang/test/Lower/OpenMP/default-clause-byref.f90
Original file line number Diff line number Diff line change
Expand Up @@ -197,21 +197,21 @@ subroutine nested_default_clause_tests
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
!$omp parallel firstprivate(x) private(y) shared(w) default(private)
!$omp parallel firstprivate(x) private(y) shared(w) default(private)
!$omp parallel default(private)
y = 20
x = 10
!$omp end parallel
x = 10
!$omp end parallel

!$omp parallel default(firstprivate) shared(y) private(w)
!$omp parallel default(firstprivate) shared(y) private(w)
y = 30
w = 40
w = 40
z = 50
k = 40
!$omp end parallel
!$omp end parallel


!CHECK: omp.parallel private({{.*}} {{.*}}#0 -> %[[PRIVATE_X:.*]], {{.*}} {{.*}}#0 -> %[[PRIVATE_Y:.*]], {{.*}} {{.*}}#0 -> %[[PRIVATE_Z:.*]] : {{.*}}) {
!CHECK: %[[PRIVATE_X_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_X]] {uniq_name = "_QFnested_default_clause_testsEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[PRIVATE_Y_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_Y]] {uniq_name = "_QFnested_default_clause_testsEy"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
Expand Down Expand Up @@ -240,8 +240,8 @@ subroutine nested_default_clause_tests
!$omp parallel default(private) shared(z)
w = x + z
!$omp end parallel
!$omp end parallel
!$omp end parallel

!CHECK: omp.parallel private({{.*}} {{.*}}#0 -> %[[PRIVATE_X:.*]], {{.*}} {{.*}}#0 -> %[[PRIVATE_Y:.*]], {{.*}} {{.*}}#0 -> %[[PRIVATE_W:.*]], {{.*}} {{.*}}#0 -> %[[PRIVATE_Z:.*]] : {{.*}}) {
!CHECK: %[[PRIVATE_X_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_X]] {uniq_name = "_QFnested_default_clause_testsEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[PRIVATE_Y_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_Y]] {uniq_name = "_QFnested_default_clause_testsEy"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
Expand Down Expand Up @@ -283,7 +283,7 @@ subroutine nested_default_clause_tests
!CHECK: omp.terminator
!CHECK: }
!CHECK: return
!CHECK: }
!CHECK: }
!$omp parallel default(firstprivate)
!$omp single
x = y
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/default-clause.f90
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ subroutine skipped_default_clause_checks()
!CHECK: %[[VAR_X_DECLARE_INNER:.*]] = hlfir.declare %[[CONVERT_INNER]] storage(%[[BLK_THREADPRIVATE_INNER]][0]) {uniq_name = "_QFthreadprivate_with_defaultEx"} : (!fir.ref<i32>, !fir.ref<!fir.array<4xi8>>) -> (!fir.ref<i32>, !fir.ref<i32>)
subroutine threadprivate_with_default
integer :: x
common /blk/ x
common /blk/ x
!$omp threadprivate (/blk/)

!$omp parallel do default(private)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ subroutine delayed_privatization_private_firstprivate
! CHECK: %[[VAR2_DECL:.*]]:2 = hlfir.declare %[[VAR2_ALLOC]]

! CHECK: omp.parallel private(
! CHECK-SAME: @[[VAR1_PRIVATIZER_SYM]] %[[VAR1_DECL]]#0 -> %{{[^,]+}},
! CHECK-SAME: @[[VAR1_PRIVATIZER_SYM]] %[[VAR1_DECL]]#0 -> %{{[^,]+}},
! CHECK-SAME: @[[VAR2_PRIVATIZER_SYM]] %[[VAR2_DECL]]#0 -> %{{.*}} :
! CHECK-SAME: !fir.ref<i32>, !fir.ref<i32>) {
36 changes: 18 additions & 18 deletions flang/test/Lower/OpenMP/derived-type-map.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ subroutine mapType_derived_implicit
integer(4) :: array(10)
integer(4) :: int
end type scalar_and_array
type(scalar_and_array) :: scalar_arr
type(scalar_and_array) :: scalar_arr

!$omp target
scalar_arr%int = 1
!$omp end target
Expand Down Expand Up @@ -49,8 +49,8 @@ subroutine mapType_derived_explicit
integer(4) :: array(10)
integer(4) :: int
end type scalar_and_array
type(scalar_and_array) :: scalar_arr
type(scalar_and_array) :: scalar_arr

!$omp target map(tofrom: scalar_arr)
scalar_arr%int = 1
!$omp end target
Expand All @@ -69,8 +69,8 @@ subroutine mapType_derived_explicit_single_member
integer(4) :: array(10)
integer(4) :: int
end type scalar_and_array
type(scalar_and_array) :: scalar_arr
type(scalar_and_array) :: scalar_arr

!$omp target map(tofrom: scalar_arr%array)
scalar_arr%array(1) = 1
!$omp end target
Expand All @@ -90,13 +90,13 @@ subroutine mapType_derived_explicit_multiple_members
integer(4) :: array(10)
integer(4) :: int
end type scalar_and_array
type(scalar_and_array) :: scalar_arr
type(scalar_and_array) :: scalar_arr

!$omp target map(tofrom: scalar_arr%int, scalar_arr%real)
scalar_arr%int = 1
!$omp end target
end subroutine mapType_derived_explicit_multiple_members

!CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.type<_QFmaptype_derived_explicit_member_with_boundsTscalar_and_array{real:f32,array:!fir.array<10xi32>,int:i32}> {bindc_name = "scalar_arr", uniq_name = "_QFmaptype_derived_explicit_member_with_boundsEscalar_arr"}
!CHECK: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]] {uniq_name = "_QFmaptype_derived_explicit_member_with_boundsEscalar_arr"} : (!fir.ref<!fir.type<_QFmaptype_derived_explicit_member_with_boundsTscalar_and_array{real:f32,array:!fir.array<10xi32>,int:i32}>>) -> (!fir.ref<!fir.type<_QFmaptype_derived_explicit_member_with_boundsTscalar_and_array{real:f32,array:!fir.array<10xi32>,int:i32}>>, !fir.ref<!fir.type<_QFmaptype_derived_explicit_member_with_boundsTscalar_and_array{real:f32,array:!fir.array<10xi32>,int:i32}>>)
!CHECK: %[[MEMBER:.*]] = hlfir.designate %[[DECLARE]]#0{"array"} shape %{{.*}} : (!fir.ref<!fir.type<_QFmaptype_derived_explicit_member_with_boundsTscalar_and_array{real:f32,array:!fir.array<10xi32>,int:i32}>>, !fir.shape<1>) -> !fir.ref<!fir.array<10xi32>>
Expand All @@ -113,8 +113,8 @@ subroutine mapType_derived_explicit_member_with_bounds
integer(4) :: array(10)
integer(4) :: int
end type scalar_and_array
type(scalar_and_array) :: scalar_arr
type(scalar_and_array) :: scalar_arr

!$omp target map(tofrom: scalar_arr%array(2:5))
scalar_arr%array(3) = 3
!$omp end target
Expand All @@ -141,8 +141,8 @@ subroutine mapType_derived_nested_explicit_single_member
type(nested) :: nest
integer(4) :: int
end type scalar_and_array
type(scalar_and_array) :: scalar_arr

type(scalar_and_array) :: scalar_arr

!$omp target map(tofrom: scalar_arr%nest%array)
scalar_arr%nest%array(1) = 1
Expand Down Expand Up @@ -173,7 +173,7 @@ subroutine mapType_derived_nested_explicit_multiple_members
integer(4) :: int
end type scalar_and_array

type(scalar_and_array) :: scalar_arr
type(scalar_and_array) :: scalar_arr

!$omp target map(tofrom: scalar_arr%nest%int, scalar_arr%nest%real)
scalar_arr%nest%int = 1
Expand Down Expand Up @@ -205,9 +205,9 @@ subroutine mapType_derived_nested_explicit_member_with_bounds
type(nested) :: nest
integer(4) :: int
end type scalar_and_array
type(scalar_and_array) :: scalar_arr

type(scalar_and_array) :: scalar_arr

!$omp target map(tofrom: scalar_arr%nest%array(2:5))
scalar_arr%nest%array(3) = 3
!$omp end target
Expand Down Expand Up @@ -239,7 +239,7 @@ subroutine mapType_multilpe_derived_nested_explicit_member
type(nested) :: nest
integer(4) :: int
end type scalar_and_array

type(scalar_and_array) :: scalar_arr1
type(scalar_and_array) :: scalar_arr2

Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/distribute.f90
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ subroutine distribute_allocate()
! CHECK-NEXT: omp.loop_nest
do i = 1, 10
x = i
! CHECK: omp.yield
! CHECK: omp.yield
end do

!$omp end distribute
Expand Down
4 changes: 2 additions & 2 deletions flang/test/Lower/OpenMP/generic-loop-rewriting.f90
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ end subroutine target_teams_loop
!CHECK: %[[UB:.*]] = arith.constant 10 : i32
!CHECK: %[[STEP:.*]] = arith.constant 1 : i32

!CHECK: omp.parallel private(@{{.*}} %[[I_DECL]]#0
!CHECK: omp.parallel private(@{{.*}} %[[I_DECL]]#0
!CHECK-SAME: -> %[[I_PRIV_ARG:[^[:space:]]+]] : !fir.ref<i32>) {
!CHECK: omp.distribute {
!CHECK: omp.wsloop {

!CHECK: omp.loop_nest (%{{.*}}) : i32 =
!CHECK: omp.loop_nest (%{{.*}}) : i32 =
!CHECK-SAME: (%[[LB]]) to (%[[UB]]) inclusive step (%[[STEP]]) {
!CHECK: %[[I_PRIV_DECL:.*]]:2 = hlfir.declare %[[I_PRIV_ARG]]
!CHECK: hlfir.assign %{{.*}} to %[[I_PRIV_DECL]]#0 : i32, !fir.ref<i32>
Expand Down
Loading