[Mlir-commits] [mlir] Add a structured if operation (PR #67234)

Simon Camphausen llvmlistbot at llvm.org
Mon Sep 25 08:24:46 PDT 2023


================
@@ -0,0 +1,70 @@
+// RUN: mlir-opt -allow-unregistered-dialect -convert-scf-to-emitc %s | FileCheck %s
+
+func.func @test_if(%arg0: i1, %arg1: f32) {
+  emitc.if %arg0 {
+     %0 = emitc.call "func_const"(%arg1) : (f32) -> i32
+  }
+  return
+}
+// CHECK-LABEL: func.func @test_if(
+// CHECK-SAME:                     %[[VAL_0:.*]]: i1,
+// CHECK-SAME:                     %[[VAL_1:.*]]: f32) {
+// CHECK-NEXT:    emitc.if %[[VAL_0]] {
+// CHECK-NEXT:      %[[VAL_2:.*]] = emitc.call "func_const"(%[[VAL_1]]) : (f32) -> i32
+// CHECK-NEXT:    }
+// CHECK-NEXT:    return
+// CHECK-NEXT:  }
+
+
+func.func @test_if_else(%arg0: i1, %arg1: f32) {
+  emitc.if %arg0 {
----------------
simon-camp wrote:

`scf.if`

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


More information about the Mlir-commits mailing list