[Mlir-commits] [mlir] [mlir][arith] Add truncation and extension integration tests (PR #98182)

Jakub Kuderski llvmlistbot at llvm.org
Sun Aug 25 11:06:44 PDT 2024


================
@@ -0,0 +1,90 @@
+// 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
+
+func.func @extsi_i1_i16(%v1 : i1) {
+    vector.print str "@extsi_i1_i16\n"
+    %0 = arith.extsi %v1 : i1 to i16
+    vector.print %0 : i16
+    return
+}
+
+func.func @extui_i1_i64(%v1 : i1) {
+    vector.print str "@extui_i1_i64\n"
+    %0 = arith.extui %v1 : i1 to i64
+    vector.print %0 : i64
+    return
+}
+
+func.func @trunci_i16_i8(%v1 : i16) {
+    vector.print str "@trunci_i16_i8\n"
+    %0 = arith.trunci %v1 : i16 to i8
+    vector.print %0 : i8
+    return
+}
+
+func.func @extsi() {
+    // ------------------------------------------------
+    // Test extending from i1
+    // ------------------------------------------------
+    %true = arith.constant -1 : i1
+
----------------
kuhar wrote:

Why do we use -1 here but `true` in the test below? Should we make this consistent across the test cases?

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


More information about the Mlir-commits mailing list