Skip to content

Commit d234efe

Browse files
committed
Test coverage for all changes
1 parent 99d20f9 commit d234efe

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
!===----------------------------------------------------------------------===!
2+
! This directory can be used to add Integration tests involving multiple
3+
! stages of the compiler (for eg. from Fortran to LLVM IR). It should not
4+
! contain executable tests. We should only add tests here sparingly and only
5+
! if there is no other way to test. Repeat this message in each test that is
6+
! added to this directory and sub-directories.
7+
!===----------------------------------------------------------------------===!
8+
9+
!RUN: %flang_fc1 -emit-hlfir -fopenmp -O3 %s -o - | FileCheck %s --check-prefix HLFIR
10+
!RUN: %flang_fc1 -emit-fir -fopenmp -O3 %s -o - | FileCheck %s --check-prefix FIR
11+
12+
subroutine sb1(x, y)
13+
integer :: x(:)
14+
integer :: y(:)
15+
!$omp parallel workshare
16+
x = y
17+
!$omp end parallel workshare
18+
end subroutine
19+
20+
! HLFIR: omp.parallel {
21+
! HLFIR: omp.workshare {
22+
! HLFIR: hlfir.assign
23+
! HLFIR: omp.terminator
24+
! HLFIR: }
25+
! HLFIR: omp.terminator
26+
! HLFIR: }
27+
28+
! FIR: omp.parallel {
29+
! FIR: omp.wsloop nowait {
30+
! FIR: omp.loop_nest
31+
! FIR: omp.terminator
32+
! FIR: }
33+
! FIR: omp.barrier
34+
! FIR: omp.terminator
35+
! FIR: }
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
!===----------------------------------------------------------------------===!
2+
! This directory can be used to add Integration tests involving multiple
3+
! stages of the compiler (for eg. from Fortran to LLVM IR). It should not
4+
! contain executable tests. We should only add tests here sparingly and only
5+
! if there is no other way to test. Repeat this message in each test that is
6+
! added to this directory and sub-directories.
7+
!===----------------------------------------------------------------------===!
8+
9+
!RUN: %flang_fc1 -emit-hlfir -fopenmp -O3 %s -o - | FileCheck %s --check-prefix HLFIR
10+
!RUN: %flang_fc1 -emit-fir -fopenmp -O3 %s -o - | FileCheck %s --check-prefix FIR
11+
12+
subroutine sb1(a, x)
13+
integer :: a
14+
integer :: x(:)
15+
!$omp parallel workshare
16+
x = a
17+
!$omp end parallel workshare
18+
end subroutine
19+
20+
! HLFIR: omp.parallel {
21+
! HLFIR: omp.workshare {
22+
! HLFIR: %[[SCALAR:.*]] = fir.load %1#0 : !fir.ref<i32>
23+
! HLFIR: hlfir.assign %[[SCALAR]] to
24+
! HLFIR: omp.terminator
25+
! HLFIR: }
26+
! HLFIR: omp.terminator
27+
! HLFIR: }
28+
29+
! FIR: omp.parallel {
30+
! FIR: %[[SCALAR_ALLOCA:.*]] = fir.alloca i32
31+
! FIR: omp.single copyprivate(%[[SCALAR_ALLOCA]] -> @_workshare_copy_i32 : !fir.ref<i32>) {
32+
! FIR: %[[SCALAR_LOAD:.*]] = fir.load %{{.*}} : !fir.ref<i32>
33+
! FIR: fir.store %[[SCALAR_LOAD]] to %[[SCALAR_ALLOCA]] : !fir.ref<i32>
34+
! FIR: omp.terminator
35+
! FIR: }
36+
! FIR: %[[SCALAR_RELOAD:.*]] = fir.load %[[SCALAR_ALLOCA]] : !fir.ref<i32>
37+
! FIR: %6:3 = fir.box_dims %3, %c0 : (!fir.box<!fir.array<?xi32>>, index) -> (index, index, index)
38+
! FIR: omp.wsloop nowait {
39+
! FIR: omp.loop_nest (%arg2) : index = (%c1) to (%6#1) inclusive step (%c1) {
40+
! FIR: fir.store %[[SCALAR_RELOAD]]
41+
! FIR: omp.yield
42+
! FIR: }
43+
! FIR: omp.terminator
44+
! FIR: }
45+
! FIR: omp.barrier
46+
! FIR: omp.terminator

0 commit comments

Comments
 (0)