-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Flang][OpenMP] NFC: Port three tests with minimal changes to HLFIR flow
These are modified versions of tests from flang/test/Lower/OpenMP/FIR.
- Loading branch information
1 parent
bd7ca98
commit 6d30d94
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
flang/test/Lower/OpenMP/omp-declare-target-program-var.f90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes=HOST,ALL | ||
!RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefix=ALL | ||
|
||
PROGRAM main | ||
! HOST-DAG: %[[I_REF:.*]] = fir.alloca f32 {bindc_name = "i", uniq_name = "_QFEi"} | ||
! HOST-DAG: %[[I_DECL:.*]]:2 = hlfir.declare %[[I_REF]] {uniq_name = "_QFEi"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>) | ||
REAL :: I | ||
! ALL-DAG: fir.global internal @_QFEi {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : f32 { | ||
! ALL-DAG: %[[UNDEF:.*]] = fir.undefined f32 | ||
! ALL-DAG: fir.has_value %[[UNDEF]] : f32 | ||
! ALL-DAG: } | ||
!$omp declare target(I) | ||
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
! 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-hlfir -fopenmp %s -o - | FileCheck %s | ||
|
||
subroutine ordered | ||
integer :: i | ||
integer :: a(20) | ||
|
||
!CHECK: omp.ordered_region { | ||
!$OMP ORDERED | ||
a(i) = a(i-1) + 1 | ||
!CHECK: omp.terminator | ||
!CHECK-NEXT: } | ||
!$OMP END ORDERED | ||
|
||
!CHECK: omp.ordered_region { | ||
!$OMP ORDERED THREADS | ||
a(i) = a(i-1) + 1 | ||
!CHECK: omp.terminator | ||
!CHECK-NEXT: } | ||
!$OMP END ORDERED | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s | ||
|
||
!CHECK-LABEL: @_QPomp_taskgroup | ||
subroutine omp_taskgroup | ||
use omp_lib | ||
integer :: allocated_x | ||
!CHECK: %[[ALLOC_X_REF:.*]] = fir.alloca i32 {bindc_name = "allocated_x", uniq_name = "_QFomp_taskgroupEallocated_x"} | ||
!CHECK-NEXT: %[[ALLOC_X_DECL:.*]]:2 = hlfir.declare %[[ALLOC_X_REF]] {uniq_name = "_QFomp_taskgroupEallocated_x"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) | ||
!CHECK: %[[C1:.*]] = arith.constant 1 : i32 | ||
|
||
!CHECK: omp.taskgroup allocate(%[[C1]] : i32 -> %[[ALLOC_X_DECL]]#1 : !fir.ref<i32>) | ||
!$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 |