File tree 2 files changed +18
-4
lines changed
2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -849,8 +849,6 @@ void OmpStructureChecker::CheckSIMDNest(const parser::OpenMPConstruct &c) {
849
849
// The only OpenMP constructs that can be encountered during execution of
850
850
// a simd region are the `atomic` construct, the `loop` construct, the `simd`
851
851
// construct and the `ordered` construct with the `simd` clause.
852
- // TODO: Expand the check to include `LOOP` construct as well when it is
853
- // supported.
854
852
855
853
// Check if the parent context has the SIMD clause
856
854
// Please note that we use GetContext() instead of GetContextParent()
@@ -893,14 +891,15 @@ void OmpStructureChecker::CheckSIMDNest(const parser::OpenMPConstruct &c) {
893
891
}
894
892
}
895
893
},
896
- // Allowing SIMD construct
894
+ // Allowing SIMD and loop construct
897
895
[&](const parser::OpenMPLoopConstruct &c) {
898
896
const auto &beginLoopDir{
899
897
std::get<parser::OmpBeginLoopDirective>(c.t )};
900
898
const auto &beginDir{
901
899
std::get<parser::OmpLoopDirective>(beginLoopDir.t )};
902
900
if ((beginDir.v == llvm::omp::Directive::OMPD_simd) ||
903
- (beginDir.v == llvm::omp::Directive::OMPD_do_simd)) {
901
+ (beginDir.v == llvm::omp::Directive::OMPD_do_simd) ||
902
+ (beginDir.v == llvm::omp::Directive::OMPD_loop)) {
904
903
eligibleSIMD = true ;
905
904
}
906
905
},
Original file line number Diff line number Diff line change @@ -189,3 +189,18 @@ SUBROUTINE NESTED_BAD(N)
189
189
190
190
191
191
END SUBROUTINE NESTED_BAD
192
+
193
+ SUBROUTINE SIMD_LOOP (A , B , N )
194
+ REAL :: A(100 ), B(100 )
195
+ INTEGER :: I, J, N
196
+
197
+ ! $OMP SIMD
198
+ DO I = 1 , N
199
+ ! $OMP LOOP
200
+ DO J = 1 , N
201
+ B(J) = B(J) + A(J)
202
+ END DO
203
+ ! $OMP END LOOP
204
+ END DO
205
+ ! $OMP END SIMD
206
+ END SUBROUTINE
You can’t perform that action at this time.
0 commit comments