[Mlir-commits] [mlir] [mlir][arith] Add more canonicalization and integration tests coverage (PR #92272)

Jacob Yu llvmlistbot at llvm.org
Wed May 15 13:54:17 PDT 2024


================
@@ -0,0 +1,52 @@
+// Regression test suite from an independent development of Arith's
+// semantics and a fuzzer
+
+// RUN: mlir-opt %s --convert-scf-to-cf --convert-cf-to-llvm --convert-vector-to-llvm \
+// RUN:             --convert-func-to-llvm --convert-arith-to-llvm | \
+// RUN:   mlir-cpu-runner -e entry -entry-point-result=void \
+// RUN:                   --shared-libs=%mlir_c_runner_utils | \
+// RUN:   FileCheck %s --match-full-lines
+
+module {
+  func.func @extsiOnI1() {
+    %true = arith.constant -1 : i1
+    %0 = arith.extsi %true : i1 to i16
+    vector.print %true : i1
+    vector.print %0 : i16
+    return
+  }
+
+  func.func @extuiOn1I1() {
+    %true = arith.constant true
+    %0 = arith.extui %true : i1 to i64
+    vector.print %true : i1
+    vector.print %0 : i64
+    return
+  }
+
+  func.func @trunciI16ToI8() {
+    %c20194_i16 = arith.constant 20194 : i16
+    %0 = arith.trunci %c20194_i16 : i16 to i8
+    vector.print %c20194_i16 : i16
+    vector.print %0 : i8
+    return
+  }
+
+  func.func @entry() {
+
+    // CHECK:      1
----------------
pingshiyu wrote:

it's interesting indeed! length-1 bitvectors _should_ represent -1 under interpretation, but it is _printed_ as 1 by vector.print
I do not know/recall if there's a reason for this - just is the semantics the current compiler implements

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


More information about the Mlir-commits mailing list