[flang-commits] [flang] 0d80597 - [Flang][OpenMP] NFC: Move flush llvm lowering test to a separate file

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Tue Sep 26 07:55:28 PDT 2023


Author: Kiran Chandramohan
Date: 2023-09-26T14:55:07Z
New Revision: 0d8059793ed541fc43fcdf19329ba11cf1e018fd

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

LOG: [Flang][OpenMP] NFC: Move flush llvm lowering test to a separate file

Added: 
    

Modified: 
    flang/test/Fir/convert-to-llvm-openmp-and-fir.fir

Removed: 
    


################################################################################
diff  --git a/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir b/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir
index 501a2bee29321a3..21334e4aacd613b 100644
--- a/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir
+++ b/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir
@@ -827,4 +827,40 @@ func.func @sub_() {
     omp.terminator
   }
   return
-} 
+}
+
+// -----
+
+// CHECK-LABEL:  llvm.func @flush_standalone_
+// CHECK-SAME:   %[[ARG_A:.*]]: !llvm.ptr<i32> {fir.bindc_name = "a"}, %[[ARG_B:.*]]: !llvm.ptr<i32> {fir.bindc_name = "b"}, %[[ARG_C:.*]]: !llvm.ptr<i32> {fir.bindc_name = "c"})
+  func.func @flush_standalone_(%arg0: !fir.ref<i32> {fir.bindc_name = "a"}, %arg1: !fir.ref<i32> {fir.bindc_name = "b"}, %arg2: !fir.ref<i32> {fir.bindc_name = "c"}) {
+// CHECK:   omp.flush(%[[ARG_A]], %[[ARG_B]], %[[ARG_C]] : !llvm.ptr<i32>, !llvm.ptr<i32>, !llvm.ptr<i32>)
+    omp.flush(%arg0, %arg1, %arg2 : !fir.ref<i32>, !fir.ref<i32>, !fir.ref<i32>)
+// CHECK:   omp.flush
+    omp.flush
+    return
+  }
+
+// CHECK-LABEL:  llvm.func @flush_parallel_
+// CHECK-SAME:   %[[ARG_A:.*]]: !llvm.ptr<i32> {fir.bindc_name = "a"}, %[[ARG_B:.*]]: !llvm.ptr<i32> {fir.bindc_name = "b"}, %[[ARG_C:.*]]: !llvm.ptr<i32> {fir.bindc_name = "c"})
+  func.func @flush_parallel_(%arg0: !fir.ref<i32> {fir.bindc_name = "a"}, %arg1: !fir.ref<i32> {fir.bindc_name = "b"}, %arg2: !fir.ref<i32> {fir.bindc_name = "c"}) {
+// CHECK:    omp.parallel   {
+    omp.parallel   {
+// CHECK:      omp.flush(%[[ARG_A]], %[[ARG_B]], %[[ARG_C]] : !llvm.ptr<i32>, !llvm.ptr<i32>, !llvm.ptr<i32>)
+      omp.flush(%arg0, %arg1, %arg2 : !fir.ref<i32>, !fir.ref<i32>, !fir.ref<i32>)
+// CHECK:      omp.flush
+      omp.flush
+// CHECK:      %[[A_VAL:.*]] = llvm.load %[[ARG_A]] : !llvm.ptr<i32>
+      %0 = fir.load %arg0 : !fir.ref<i32>
+// CHECK:      %[[B_VAL:.*]] = llvm.load %[[ARG_B]] : !llvm.ptr<i32>
+      %1 = fir.load %arg1 : !fir.ref<i32>
+// CHECK:      %[[C_VAL:.*]] = llvm.add %[[A_VAL]], %[[B_VAL]]  : i32
+      %2 = arith.addi %0, %1 : i32
+// CHECK:      llvm.store %[[C_VAL]], %[[ARG_C]] : !llvm.ptr<i32>
+      fir.store %2 to %arg2 : !fir.ref<i32>
+// CHECK:      omp.terminator
+      omp.terminator
+// CHECK:    }
+    }
+    return
+  }


        


More information about the flang-commits mailing list