Skip to content

Commit 712d385

Browse files
committed
R4: Moved Taskloop directives to be parsed as Loop Directives
1 parent 00c24c4 commit 712d385

File tree

6 files changed

+36
-93
lines changed

6 files changed

+36
-93
lines changed

flang/include/flang/Semantics/openmp-directive-sets.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,10 @@ static const OmpDirectiveSet compositeConstructSet{
206206

207207
static const OmpDirectiveSet blockConstructSet{
208208
Directive::OMPD_masked,
209-
Directive::OMPD_masked_taskloop,
210-
Directive::OMPD_masked_taskloop_simd,
211209
Directive::OMPD_master,
212210
Directive::OMPD_ordered,
213211
Directive::OMPD_parallel,
214212
Directive::OMPD_parallel_masked,
215-
Directive::OMPD_parallel_masked_taskloop,
216-
Directive::OMPD_parallel_masked_taskloop_simd,
217213
Directive::OMPD_parallel_workshare,
218214
Directive::OMPD_single,
219215
Directive::OMPD_target,

flang/lib/Parser/openmp-parsers.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,15 @@ TYPE_PARSER(sourced(construct<OmpLoopDirective>(first(
378378
"DISTRIBUTE" >> pure(llvm::omp::Directive::OMPD_distribute),
379379
"DO SIMD" >> pure(llvm::omp::Directive::OMPD_do_simd),
380380
"DO" >> pure(llvm::omp::Directive::OMPD_do),
381+
"MASKED TASKLOOP SIMD" >>
382+
pure(llvm::omp::Directive::OMPD_masked_taskloop_simd),
383+
"MASKED TASKLOOP" >> pure(llvm::omp::Directive::OMPD_masked_taskloop),
381384
"PARALLEL DO SIMD" >> pure(llvm::omp::Directive::OMPD_parallel_do_simd),
382385
"PARALLEL DO" >> pure(llvm::omp::Directive::OMPD_parallel_do),
386+
"PARALLEL MASKED TASKLOOP SIMD" >>
387+
pure(llvm::omp::Directive::OMPD_parallel_masked_taskloop_simd),
388+
"PARALLEL MASKED TASKLOOP" >>
389+
pure(llvm::omp::Directive::OMPD_parallel_masked_taskloop),
383390
"SIMD" >> pure(llvm::omp::Directive::OMPD_simd),
384391
"TARGET PARALLEL DO SIMD" >>
385392
pure(llvm::omp::Directive::OMPD_target_parallel_do_simd),
@@ -488,16 +495,10 @@ TYPE_PARSER(
488495
endOfLine)
489496

490497
// Directives enclosing structured-block
491-
TYPE_PARSER(construct<OmpBlockDirective>(first("MASKED TASKLOOP SIMD" >>
492-
pure(llvm::omp::Directive::OMPD_masked_taskloop_simd),
493-
"MASKED TASKLOOP" >> pure(llvm::omp::Directive::OMPD_masked_taskloop),
498+
TYPE_PARSER(construct<OmpBlockDirective>(first(
494499
"MASKED" >> pure(llvm::omp::Directive::OMPD_masked),
495500
"MASTER" >> pure(llvm::omp::Directive::OMPD_master),
496501
"ORDERED" >> pure(llvm::omp::Directive::OMPD_ordered),
497-
"PARALLEL MASKED TASKLOOP SIMD" >>
498-
pure(llvm::omp::Directive::OMPD_parallel_masked_taskloop_simd),
499-
"PARALLEL MASKED TASKLOOP" >>
500-
pure(llvm::omp::Directive::OMPD_parallel_masked_taskloop),
501502
"PARALLEL MASKED" >> pure(llvm::omp::Directive::OMPD_parallel_masked),
502503
"PARALLEL WORKSHARE" >> pure(llvm::omp::Directive::OMPD_parallel_workshare),
503504
"PARALLEL" >> pure(llvm::omp::Directive::OMPD_parallel),

flang/lib/Parser/unparse.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,12 +2194,24 @@ class UnparseVisitor {
21942194
case llvm::omp::Directive::OMPD_do_simd:
21952195
Word("DO SIMD ");
21962196
break;
2197+
case llvm::omp::Directive::OMPD_masked_taskloop_simd:
2198+
Word("MASKED TASKLOOP SIMD");
2199+
break;
2200+
case llvm::omp::Directive::OMPD_masked_taskloop:
2201+
Word("MASKED TASKLOOP");
2202+
break;
21972203
case llvm::omp::Directive::OMPD_parallel_do:
21982204
Word("PARALLEL DO ");
21992205
break;
22002206
case llvm::omp::Directive::OMPD_parallel_do_simd:
22012207
Word("PARALLEL DO SIMD ");
22022208
break;
2209+
case llvm::omp::Directive::OMPD_parallel_masked_taskloop_simd:
2210+
Word("PARALLEL MASKED TASKLOOP SIMD");
2211+
break;
2212+
case llvm::omp::Directive::OMPD_parallel_masked_taskloop:
2213+
Word("PARALLEL MASKED TASKLOOP");
2214+
break;
22032215
case llvm::omp::Directive::OMPD_simd:
22042216
Word("SIMD ");
22052217
break;
@@ -2283,12 +2295,6 @@ class UnparseVisitor {
22832295
}
22842296
void Unparse(const OmpBlockDirective &x) {
22852297
switch (x.v) {
2286-
case llvm::omp::Directive::OMPD_masked_taskloop_simd:
2287-
Word("MASKED TASKLOOP SIMD");
2288-
break;
2289-
case llvm::omp::Directive::OMPD_masked_taskloop:
2290-
Word("MASKED TASKLOOP");
2291-
break;
22922298
case llvm::omp::Directive::OMPD_masked:
22932299
Word("MASKED");
22942300
break;
@@ -2298,12 +2304,6 @@ class UnparseVisitor {
22982304
case llvm::omp::Directive::OMPD_ordered:
22992305
Word("ORDERED ");
23002306
break;
2301-
case llvm::omp::Directive::OMPD_parallel_masked_taskloop_simd:
2302-
Word("PARALLEL MASKED TASKLOOP SIMD");
2303-
break;
2304-
case llvm::omp::Directive::OMPD_parallel_masked_taskloop:
2305-
Word("PARALLEL MASKED TASKLOOP");
2306-
break;
23072307
case llvm::omp::Directive::OMPD_parallel_masked:
23082308
Word("PARALLEL MASKED");
23092309
break;

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,11 +1503,7 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPBlockConstruct &x) {
15031503
const auto &beginBlockDir{std::get<parser::OmpBeginBlockDirective>(x.t)};
15041504
const auto &beginDir{std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
15051505
switch (beginDir.v) {
1506-
case llvm::omp::Directive::OMPD_masked_taskloop_simd:
1507-
case llvm::omp::Directive::OMPD_masked_taskloop:
15081506
case llvm::omp::Directive::OMPD_masked:
1509-
case llvm::omp::Directive::OMPD_parallel_masked_taskloop_simd:
1510-
case llvm::omp::Directive::OMPD_parallel_masked_taskloop:
15111507
case llvm::omp::Directive::OMPD_parallel_masked:
15121508
case llvm::omp::Directive::OMPD_master:
15131509
case llvm::omp::Directive::OMPD_ordered:
@@ -1538,11 +1534,7 @@ void OmpAttributeVisitor::Post(const parser::OpenMPBlockConstruct &x) {
15381534
const auto &beginBlockDir{std::get<parser::OmpBeginBlockDirective>(x.t)};
15391535
const auto &beginDir{std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
15401536
switch (beginDir.v) {
1541-
case llvm::omp::Directive::OMPD_masked_taskloop_simd:
1542-
case llvm::omp::Directive::OMPD_masked_taskloop:
15431537
case llvm::omp::Directive::OMPD_masked:
1544-
case llvm::omp::Directive::OMPD_parallel_masked_taskloop_simd:
1545-
case llvm::omp::Directive::OMPD_parallel_masked_taskloop:
15461538
case llvm::omp::Directive::OMPD_parallel_masked:
15471539
case llvm::omp::Directive::OMPD_parallel:
15481540
case llvm::omp::Directive::OMPD_single:
@@ -1610,8 +1602,12 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPLoopConstruct &x) {
16101602
case llvm::omp::Directive::OMPD_distribute_simd:
16111603
case llvm::omp::Directive::OMPD_do:
16121604
case llvm::omp::Directive::OMPD_do_simd:
1605+
case llvm::omp::Directive::OMPD_masked_taskloop_simd:
1606+
case llvm::omp::Directive::OMPD_masked_taskloop:
16131607
case llvm::omp::Directive::OMPD_parallel_do:
16141608
case llvm::omp::Directive::OMPD_parallel_do_simd:
1609+
case llvm::omp::Directive::OMPD_parallel_masked_taskloop_simd:
1610+
case llvm::omp::Directive::OMPD_parallel_masked_taskloop:
16151611
case llvm::omp::Directive::OMPD_simd:
16161612
case llvm::omp::Directive::OMPD_target_parallel_do:
16171613
case llvm::omp::Directive::OMPD_target_parallel_do_simd:
Lines changed: 4 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,15 @@
11

22
! This test checks lowering of OpenMP masked Directive.
33

4-
// RUN: not flang-new -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s
4+
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
5+
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
6+
7+
! CHECK: not yet implemented: Unhandled Directive masked
58

69
subroutine test_masked()
710
integer :: c = 1
8-
// CHECK: not yet implemented: Unhandled Directive masked
911
!$omp masked
1012
c = c + 1
1113
!$omp end masked
12-
// CHECK: not yet implemented: Unhandled Directive masked
13-
!$omp masked filter(1)
14-
c = c + 2
15-
!$omp end masked
16-
end subroutine
17-
18-
subroutine test_masked_taskloop_simd()
19-
integer :: i, j = 1
20-
// CHECK: not yet implemented: Unhandled Directive masked
21-
!$omp masked taskloop simd
22-
do i=1,10
23-
j = j + 1
24-
end do
25-
!$omp end masked taskloop simd
26-
end subroutine
27-
28-
subroutine test_masked_taskloop
29-
integer :: i, j = 1
30-
// CHECK: not yet implemented: Unhandled Directive masked
31-
!$omp masked taskloop filter(2)
32-
do i=1,10
33-
j = j + 1
34-
end do
35-
!$omp end masked taskloop
3614
end subroutine
3715

38-
subroutine test_parallel_masked
39-
integer, parameter :: i = 1, j = 1
40-
integer :: c = 2
41-
// CHECK: not yet implemented: Unhandled Directive masked
42-
!$omp parallel masked filter(i+j)
43-
c = c + 2
44-
!$omp end parallel masked
45-
end subroutine
46-
47-
subroutine test_parallel_masked_taskloop_simd
48-
integer :: i, j = 1
49-
// CHECK: not yet implemented: Unhandled Directive masked
50-
!$omp parallel masked taskloop simd
51-
do i=1,10
52-
j = j + 1
53-
end do
54-
!$omp end parallel masked taskloop simd
55-
end subroutine
56-
57-
subroutine test_parallel_masked_taskloop
58-
integer :: i, j = 1
59-
// CHECK: not yet implemented: Unhandled Directive masked
60-
!$omp parallel masked taskloop filter(2)
61-
do i=1,10
62-
j = j + 1
63-
end do
64-
!$omp end parallel masked taskloop
65-
end subroutine

flang/test/Parser/OpenMP/masked-unparse.f90

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ subroutine test_masked()
2424

2525
subroutine test_masked_taskloop_simd()
2626
integer :: i, j = 1
27-
!PARSE-TREE: OmpBeginBlockDirective
28-
!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = masked taskloop simd
27+
!PARSE-TREE: OmpBeginLoopDirective
28+
!PARSE-TREE-NEXT: OmpLoopDirective -> llvm::omp::Directive = masked taskloop simd
2929
!CHECK: !$omp masked taskloop simd
3030
!$omp masked taskloop simd
3131
do i=1,10
@@ -36,8 +36,8 @@ subroutine test_masked_taskloop_simd()
3636

3737
subroutine test_masked_taskloop
3838
integer :: i, j = 1
39-
!PARSE-TREE: OmpBeginBlockDirective
40-
!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = masked taskloop
39+
!PARSE-TREE: OmpBeginLoopDirective
40+
!PARSE-TREE-NEXT: OmpLoopDirective -> llvm::omp::Directive = masked taskloop
4141
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Filter -> Scalar -> Integer -> Expr = '2_4'
4242
!PARSE-TREE-NEXT: LiteralConstant -> IntLiteralConstant = '2'
4343
!CHECK: !$omp masked taskloop filter(2_4)
@@ -67,8 +67,8 @@ subroutine test_parallel_masked
6767

6868
subroutine test_parallel_masked_taskloop_simd
6969
integer :: i, j = 1
70-
!PARSE-TREE: OmpBeginBlockDirective
71-
!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = parallel masked taskloop simd
70+
!PARSE-TREE: OmpBeginLoopDirective
71+
!PARSE-TREE-NEXT: OmpLoopDirective -> llvm::omp::Directive = parallel masked taskloop simd
7272
!CHECK: !$omp parallel masked taskloop simd
7373
!$omp parallel masked taskloop simd
7474
do i=1,10
@@ -79,8 +79,8 @@ subroutine test_parallel_masked_taskloop_simd
7979

8080
subroutine test_parallel_masked_taskloop
8181
integer :: i, j = 1
82-
!PARSE-TREE: OmpBeginBlockDirective
83-
!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = parallel masked taskloop
82+
!PARSE-TREE: OmpBeginLoopDirective
83+
!PARSE-TREE-NEXT: OmpLoopDirective -> llvm::omp::Directive = parallel masked taskloop
8484
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Filter -> Scalar -> Integer -> Expr = '2_4'
8585
!PARSE-TREE-NEXT: LiteralConstant -> IntLiteralConstant = '2'
8686
!CHECK: !$omp parallel masked taskloop filter(2_4)

0 commit comments

Comments
 (0)