File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -867,8 +867,6 @@ void OmpStructureChecker::CheckSIMDNest(const parser::OpenMPConstruct &c) {
867
867
// The only OpenMP constructs that can be encountered during execution of
868
868
// a simd region are the `atomic` construct, the `loop` construct, the `simd`
869
869
// construct and the `ordered` construct with the `simd` clause.
870
- // TODO: Expand the check to include `LOOP` construct as well when it is
871
- // supported.
872
870
873
871
// Check if the parent context has the SIMD clause
874
872
// Please note that we use GetContext() instead of GetContextParent()
@@ -911,14 +909,15 @@ void OmpStructureChecker::CheckSIMDNest(const parser::OpenMPConstruct &c) {
911
909
}
912
910
}
913
911
},
914
- // Allowing SIMD construct
912
+ // Allowing SIMD and loop construct
915
913
[&](const parser::OpenMPLoopConstruct &c) {
916
914
const auto &beginLoopDir{
917
915
std::get<parser::OmpBeginLoopDirective>(c.t )};
918
916
const auto &beginDir{
919
917
std::get<parser::OmpLoopDirective>(beginLoopDir.t )};
920
918
if ((beginDir.v == llvm::omp::Directive::OMPD_simd) ||
921
- (beginDir.v == llvm::omp::Directive::OMPD_do_simd)) {
919
+ (beginDir.v == llvm::omp::Directive::OMPD_do_simd) ||
920
+ (beginDir.v == llvm::omp::Directive::OMPD_loop)) {
922
921
eligibleSIMD = true ;
923
922
}
924
923
},
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