Skip to content

Commit 754d54b

Browse files
committed
One more integration test
1 parent 304ec01 commit 754d54b

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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-O3
10+
!RUN: %flang_fc1 -emit-fir -fopenmp -O3 %s -o - | FileCheck %s --check-prefix FIR-O3
11+
12+
!RUN: %flang_fc1 -emit-hlfir -fopenmp -O0 %s -o - | FileCheck %s --check-prefix HLFIR-O0
13+
!RUN: %flang_fc1 -emit-fir -fopenmp -O0 %s -o - | FileCheck %s --check-prefix FIR-O0
14+
15+
program test
16+
real :: arr_01(10)
17+
!$omp parallel workshare
18+
arr_01 = arr_01*2
19+
!$omp end parallel workshare
20+
end program
21+
22+
! HLFIR-O3: omp.parallel {
23+
! HLFIR-O3: omp.workshare {
24+
! HLFIR-O3: hlfir.elemental
25+
! HLFIR-O3: hlfir.assign
26+
! HLFIR-O3: hlfir.destroy
27+
! HLFIR-O3: omp.terminator
28+
! HLFIR-O3: omp.terminator
29+
30+
! FIR-O3: omp.parallel {
31+
! FIR-O3: omp.wsloop nowait {
32+
! FIR-O3: omp.loop_nest
33+
! FIR-O3: omp.terminator
34+
! FIR-O3: omp.barrier
35+
! FIR-O3: omp.terminator
36+
37+
! HLFIR-O0: omp.parallel {
38+
! HLFIR-O0: omp.workshare {
39+
! HLFIR-O0: hlfir.elemental
40+
! HLFIR-O0: hlfir.assign
41+
! HLFIR-O0: hlfir.destroy
42+
! HLFIR-O0: omp.terminator
43+
! HLFIR-O0: omp.terminator
44+
45+
! Check the copyprivate copy function
46+
! FIR-O0: func.func private @_workshare_copy_heap_{{.*}}(%[[DST:.*]]: {{.*}}, %[[SRC:.*]]: {{.*}})
47+
! FIR-O0: fir.load %[[SRC]]
48+
! FIR-O0: fir.store {{.*}} to %[[DST]]
49+
50+
! Check that we properly handle the temporary array
51+
! FIR-O0: omp.parallel {
52+
! FIR-O0: %[[CP:.*]] = fir.alloca !fir.heap<!fir.array<10xf32>>
53+
! FIR-O0: omp.single copyprivate(%[[CP]] -> @_workshare_copy_heap_
54+
! FIR-O0: fir.allocmem
55+
! FIR-O0: fir.store
56+
! FIR-O0: omp.terminator
57+
! FIR-O0: fir.load %[[CP]]
58+
! FIR-O0: omp.wsloop {
59+
! FIR-O0: omp.loop_nest
60+
! FIR-O0: omp.yield
61+
! FIR-O0: omp.terminator
62+
! FIR-O0: omp.single nowait {
63+
! FIR-O0: fir.call @_FortranAAssign
64+
! FIR-O0: fir.freemem
65+
! FIR-O0: omp.terminator
66+
! FIR-O0: omp.barrier
67+
! FIR-O0: omp.terminator

0 commit comments

Comments
 (0)