[flang-commits] [flang] [flang] Implement !DIR$ UNROLL_AND_JAM [N] (PR #125046)

Asher Mancinelli via flang-commits flang-commits at lists.llvm.org
Tue Feb 11 07:04:09 PST 2025


================
@@ -0,0 +1,37 @@
+! RUN: %flang_fc1 -emit-llvm -o - %s | FileCheck %s
+
+! CHECK-LABEL: unroll_and_jam_dir
+subroutine unroll_and_jam_dir
+  integer :: a(10)
+  !dir$ unroll_and_jam 4
+  ! CHECK:   br i1 {{.*}}, label {{.*}}, label {{.*}}, !llvm.loop ![[ANNOTATION:.*]]
+  do i=1,10
+     a(i)=i
+  end do
+end subroutine unroll_and_jam_dir
+
+! CHECK-LABEL: unroll_and_jam_dir_0
+subroutine unroll_and_jam_dir_0
+  integer :: a(10)
+  !dir$ unroll_and_jam 0
+  ! CHECK:   br i1 {{.*}}, label {{.*}}, label {{.*}}, !llvm.loop ![[ANNOTATION_DISABLE:.*]]
+  do i=1,10
+  a(i)=i
+  end do
+end subroutine unroll_and_jam_dir_0
+
+! CHECK-LABEL: unroll_and_jam_dir_1
+subroutine unroll_and_jam_dir_1
+  integer :: a(10)
+  !dir$ unroll_and_jam 1 
+  ! CHECK:   br i1 {{.*}}, label {{.*}}, label {{.*}}, !llvm.loop ![[ANNOTATION_DISABLE]]
+  do i=1,10
+  a(i)=i
+  end do
+end subroutine unroll_and_jam_dir_1
----------------
ashermancinelli wrote:

Maybe add an unroll and jam test with no unrolling factor to this test so we can see what the metadata will look like? I expect to see an annotation only enabling the pass without specifying a factor, but it would still be nice to see in the test.

https://github.com/llvm/llvm-project/pull/125046


More information about the flang-commits mailing list