[flang-commits] [flang] [Flang][Test] Add some missing tests (PR #110468)

Thirumalai Shaktivel via flang-commits flang-commits at lists.llvm.org
Mon Sep 30 01:42:08 PDT 2024


https://github.com/Thirumalai-Shaktivel created https://github.com/llvm/llvm-project/pull/110468

- At most one Collapse clause in SIMD construct
- A DO loop must follow the SIMD directive

>From 9cf8af055c695d92dba8fbce9ba6b9767219f733 Mon Sep 17 00:00:00 2001
From: Thirumalai-Shaktivel <thirumalaishaktivel at gmail.com>
Date: Mon, 30 Sep 2024 08:28:22 +0000
Subject: [PATCH] [Flang][Test] Add some missing tests, - At most one Collapse
 clause in SIMD construct - A DO loop must follow the SIMD directive

---
 flang/test/Semantics/OpenMP/do-collapse.f90      | 8 +++++++-
 flang/test/Semantics/OpenMP/loop-association.f90 | 6 ++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/flang/test/Semantics/OpenMP/do-collapse.f90 b/flang/test/Semantics/OpenMP/do-collapse.f90
index 4f2512937ace4e..480bd45b79b839 100644
--- a/flang/test/Semantics/OpenMP/do-collapse.f90
+++ b/flang/test/Semantics/OpenMP/do-collapse.f90
@@ -30,5 +30,11 @@ program omp_doCollapse
       do
       end do
     end do
-end program omp_doCollapse
 
+  !ERROR: At most one COLLAPSE clause can appear on the SIMD directive
+  !$omp simd collapse(2) collapse(1)
+  do i = 1, 4
+    j = j + i + 1
+  end do
+  !$omp end simd
+end program omp_doCollapse
diff --git a/flang/test/Semantics/OpenMP/loop-association.f90 b/flang/test/Semantics/OpenMP/loop-association.f90
index d2167663c5ddea..9fac508e6128a7 100644
--- a/flang/test/Semantics/OpenMP/loop-association.f90
+++ b/flang/test/Semantics/OpenMP/loop-association.f90
@@ -131,4 +131,10 @@
   !$omp end parallel do simd
   !ERROR: The END PARALLEL DO SIMD directive must follow the DO loop associated with the loop construct
   !$omp end parallel do simd
+
+  !ERROR: A DO loop must follow the SIMD directive
+  !$omp simd
+    a = i + 1
+  !ERROR: The END SIMD directive must follow the DO loop associated with the loop construct
+  !$omp end simd
 end



More information about the flang-commits mailing list