[Mlir-commits] [mlir] b736179 - [NFC][OpenMP] Add test for simd directive with nested loop

Dominik Adamski llvmlistbot at llvm.org
Fri Aug 19 03:46:13 PDT 2022


Author: Dominik Adamski
Date: 2022-08-19T05:45:32-05:00
New Revision: b736179e344974650061f94b3582ac1332e73edf

URL: https://github.com/llvm/llvm-project/commit/b736179e344974650061f94b3582ac1332e73edf
DIFF: https://github.com/llvm/llvm-project/commit/b736179e344974650061f94b3582ac1332e73edf.diff

LOG: [NFC][OpenMP] Add test for simd directive with nested loop

This test is follow up of the review: https://reviews.llvm.org/D131402

Co-Author of the patch: Kiran Chandramohan

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D132215

Added: 
    

Modified: 
    mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir b/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir
index b457811ac32c9..94a5a62722366 100644
--- a/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir
+++ b/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir
@@ -116,3 +116,32 @@ func.func @threadprivate(%a: !llvm.ptr<i32>) -> () {
   %1 = omp.threadprivate %a : !llvm.ptr<i32> -> !llvm.ptr<i32>
   return
 }
+
+// -----
+
+// CHECK:      llvm.func @simdloop_block_arg(%[[LOWER:.*]]: i32, %[[UPPER:.*]]: i32, %[[ITER:.*]]: i64) {
+// CHECK:      omp.simdloop   for  (%[[ARG_0:.*]]) : i32 =
+// CHECK-SAME:     (%[[LOWER]]) to (%[[UPPER]]) inclusive step (%[[LOWER]]) {
+// CHECK:      llvm.br ^[[BB1:.*]](%[[ITER]] : i64)
+// CHECK:        ^[[BB1]](%[[VAL_0:.*]]: i64):
+// CHECK:          %[[VAL_1:.*]] = llvm.icmp "slt" %[[VAL_0]], %[[ITER]] : i64
+// CHECK:          llvm.cond_br %[[VAL_1]], ^[[BB2:.*]], ^[[BB3:.*]]
+// CHECK:        ^[[BB2]]:
+// CHECK:          %[[VAL_2:.*]] = llvm.add %[[VAL_0]], %[[ITER]]  : i64
+// CHECK:          llvm.br ^[[BB1]](%[[VAL_2]] : i64)
+// CHECK:        ^[[BB3]]:
+// CHECK:          omp.yield
+func.func @simdloop_block_arg(%val : i32, %ub : i32, %i : index) {
+  omp.simdloop   for  (%arg0) : i32 = (%val) to (%ub) inclusive step (%val) {
+    cf.br ^bb1(%i : index)
+  ^bb1(%0: index):
+    %1 = arith.cmpi slt, %0, %i : index
+    cf.cond_br %1, ^bb2, ^bb3
+  ^bb2:
+    %2 = arith.addi %0, %i : index
+    cf.br ^bb1(%2 : index)
+  ^bb3:
+    omp.yield
+  }
+  return
+}


        


More information about the Mlir-commits mailing list