[Mlir-commits] [mlir] [mlir][EmitC] Add logical operators (PR #83123)
Simon Camphausen
llvmlistbot at llvm.org
Wed Feb 28 07:22:25 PST 2024
================
@@ -0,0 +1,14 @@
+// RUN: mlir-translate -mlir-to-cpp %s | FileCheck %s
+
+func.func @logical(%arg0: i32, %arg1: i32) -> () {
+ %0 = emitc.logical_and %arg0, %arg1 : i32, i32
+ %1 = emitc.logical_not %arg0 : i32
+ %2 = emitc.logical_or %arg0, %arg1 : i32, i32
+
+ return
+}
+
+// CHECK-LABEL: void logical
+// CHECK-NEXT: bool [[V2:[^ ]*]] = [[V0:[^ ]*]] && [[V1:[^ ]*]];
+// CHECK-NEXT: bool [[V3:[^ ]*]] = ![[V0:[^ ]*]];
+// CHECK-NEXT: bool [[V4:[^ ]*]] = [[V0:[^ ]*]] || [[V1:[^ ]*]];
----------------
simon-camp wrote:
The captures can be deleted I think (untested though).
```suggestion
// CHECK-NEXT: bool [[V3:[^ ]*]] = ![[V0]];
// CHECK-NEXT: bool [[V4:[^ ]*]] = [[V0]] || [[V1]];
```
https://github.com/llvm/llvm-project/pull/83123
More information about the Mlir-commits
mailing list