[Mlir-commits] [mlir] [mlir][arith] adding addition regression tests (PR #96973)
Jacob Yu
llvmlistbot at llvm.org
Tue Jul 2 13:59:48 PDT 2024
https://github.com/pingshiyu updated https://github.com/llvm/llvm-project/pull/96973
>From 1dc9f4d4c395e26b550fd6c257d87efe2725bed3 Mon Sep 17 00:00:00 2001
From: pingshiyu <pingshiyu at gmail.com>
Date: Thu, 27 Jun 2024 22:55:54 +0100
Subject: [PATCH 1/6] adding addition unit tests
---
.../Dialect/Arith/CPU/addition.mlir | 57 +++++++++++++++++++
1 file changed, 57 insertions(+)
create mode 100644 mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
diff --git a/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir b/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
new file mode 100644
index 0000000000000..0833ebf1c8ecc
--- /dev/null
+++ b/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
@@ -0,0 +1,57 @@
+// Tests arith operations on i1 type.
+// These tests are intended to be target agnostic: they should yield the same results
+// regardless of the target platform.
+
+// 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 @zero_plus_one_on_i1() {
+ // addi on i1
+ // addi(0, 1) : i1 = 1 : i1; addi(0, -1) : i1 = 1
+ // CHECK: 1
+ // CHECK-NEXT: 1
+ // CHECK-NEXT: 1
+ %false = arith.constant 0 : i1
+ %true = arith.constant 1 : i1
+ %true_0 = arith.constant -1 : i1
+ vector.print %true_0 : i1
+ %0 = arith.addi %false, %true : i1
+ vector.print %0 : i1
+ %1 = arith.addi %false, %true_0 : i1
+ vector.print %1 : i1
+ return
+}
+
+func.func @addui_extended_i1() {
+ // addui_extended on i1
+ // addui_extended 1 1 : i1 = 0, 1
+ // CHECK-NEXT: 0
+ // CHECK-NEXT: 1
+ %true = arith.constant 1 : i1
+ %sum, %overflow = arith.addui_extended %true, %true : i1, i1
+ vector.print %sum : i1
+ vector.print %overflow : i1
+ return
+}
+
+func.func @addui_extended_overflow_bit_is_n1() {
+ // addui_extended overflow bit is treated as -1
+ // addui_extended -1633386 -1643386 = ... 1 (overflow because negative numbers are large positive numbers)
+ // CHECK-NEXT: 0
+ %c-16433886_i64 = arith.constant -16433886 : i64
+ %sum, %overflow = arith.addui_extended %c-16433886_i64, %c-16433886_i64 : i64, i1
+ %false = arith.constant false
+ %0 = arith.cmpi sge, %overflow, %false : i1
+ vector.print %0 : i1 // but prints as "1"
+ return
+}
+
+func.func @entry() {
+ func.call @zero_plus_one_on_i1() : () -> ()
+ func.call @addui_extended_i1() : () -> ()
+ func.call @addui_extended_overflow_bit_is_n1() : () -> ()
+ return
+}
>From dc39c96d5e03246fdf3dabcf6c7810c28e962775 Mon Sep 17 00:00:00 2001
From: pingshiyu <pingshiyu at gmail.com>
Date: Fri, 28 Jun 2024 12:28:49 +0100
Subject: [PATCH 2/6] reindented
---
.../Dialect/Arith/CPU/addition.mlir | 72 +++++++++----------
1 file changed, 36 insertions(+), 36 deletions(-)
diff --git a/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir b/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
index 0833ebf1c8ecc..b3a4cb039b0dc 100644
--- a/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
+++ b/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
@@ -9,49 +9,49 @@
// RUN: FileCheck %s --match-full-lines
func.func @zero_plus_one_on_i1() {
- // addi on i1
- // addi(0, 1) : i1 = 1 : i1; addi(0, -1) : i1 = 1
- // CHECK: 1
- // CHECK-NEXT: 1
- // CHECK-NEXT: 1
- %false = arith.constant 0 : i1
- %true = arith.constant 1 : i1
- %true_0 = arith.constant -1 : i1
- vector.print %true_0 : i1
- %0 = arith.addi %false, %true : i1
- vector.print %0 : i1
- %1 = arith.addi %false, %true_0 : i1
- vector.print %1 : i1
- return
+ // addi on i1
+ // addi(0, 1) : i1 = 1 : i1; addi(0, -1) : i1 = 1
+ // CHECK: 1
+ // CHECK-NEXT: 1
+ // CHECK-NEXT: 1
+ %false = arith.constant 0 : i1
+ %true = arith.constant 1 : i1
+ %true_0 = arith.constant -1 : i1
+ vector.print %true_0 : i1
+ %0 = arith.addi %false, %true : i1
+ vector.print %0 : i1
+ %1 = arith.addi %false, %true_0 : i1
+ vector.print %1 : i1
+ return
}
func.func @addui_extended_i1() {
- // addui_extended on i1
- // addui_extended 1 1 : i1 = 0, 1
- // CHECK-NEXT: 0
- // CHECK-NEXT: 1
- %true = arith.constant 1 : i1
- %sum, %overflow = arith.addui_extended %true, %true : i1, i1
- vector.print %sum : i1
- vector.print %overflow : i1
- return
+ // addui_extended on i1
+ // addui_extended 1 1 : i1 = 0, 1
+ // CHECK-NEXT: 0
+ // CHECK-NEXT: 1
+ %true = arith.constant 1 : i1
+ %sum, %overflow = arith.addui_extended %true, %true : i1, i1
+ vector.print %sum : i1
+ vector.print %overflow : i1
+ return
}
func.func @addui_extended_overflow_bit_is_n1() {
- // addui_extended overflow bit is treated as -1
- // addui_extended -1633386 -1643386 = ... 1 (overflow because negative numbers are large positive numbers)
- // CHECK-NEXT: 0
- %c-16433886_i64 = arith.constant -16433886 : i64
- %sum, %overflow = arith.addui_extended %c-16433886_i64, %c-16433886_i64 : i64, i1
- %false = arith.constant false
- %0 = arith.cmpi sge, %overflow, %false : i1
- vector.print %0 : i1 // but prints as "1"
- return
+ // addui_extended overflow bit is treated as -1
+ // addui_extended -1633386 -1643386 = ... 1 (overflow because negative numbers are large positive numbers)
+ // CHECK-NEXT: 0
+ %c-16433886_i64 = arith.constant -16433886 : i64
+ %sum, %overflow = arith.addui_extended %c-16433886_i64, %c-16433886_i64 : i64, i1
+ %false = arith.constant false
+ %0 = arith.cmpi sge, %overflow, %false : i1
+ vector.print %0 : i1 // but prints as "1"
+ return
}
func.func @entry() {
- func.call @zero_plus_one_on_i1() : () -> ()
- func.call @addui_extended_i1() : () -> ()
- func.call @addui_extended_overflow_bit_is_n1() : () -> ()
- return
+ func.call @zero_plus_one_on_i1() : () -> ()
+ func.call @addui_extended_i1() : () -> ()
+ func.call @addui_extended_overflow_bit_is_n1() : () -> ()
+ return
}
>From fb7b9d29d876b01d459f7c9f2cce64cbbef82f71 Mon Sep 17 00:00:00 2001
From: pingshiyu <pingshiyu at gmail.com>
Date: Sat, 29 Jun 2024 18:41:58 +0100
Subject: [PATCH 3/6] addition tests updated and refactored
---
.../Dialect/Arith/CPU/addition.mlir | 79 +++++++++++++------
1 file changed, 56 insertions(+), 23 deletions(-)
diff --git a/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir b/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
index b3a4cb039b0dc..a9d441c4f3fb0 100644
--- a/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
+++ b/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
@@ -8,50 +8,83 @@
// RUN: --shared-libs=%mlir_c_runner_utils | \
// RUN: FileCheck %s --match-full-lines
-func.func @zero_plus_one_on_i1() {
+func.func @add_i1(%v1 : i1, %v2 : i1) -> (i1) {
+ %res = arith.addi %v1, %v2 : i1
+ return %res : i1
+}
+
+func.func @additions_i1() {
// addi on i1
// addi(0, 1) : i1 = 1 : i1; addi(0, -1) : i1 = 1
- // CHECK: 1
- // CHECK-NEXT: 1
- // CHECK-NEXT: 1
%false = arith.constant 0 : i1
%true = arith.constant 1 : i1
- %true_0 = arith.constant -1 : i1
- vector.print %true_0 : i1
- %0 = arith.addi %false, %true : i1
+
+ // CHECK: 1
+ %0 = func.call @add_i1(%false, %true) : (i1, i1) -> i1
vector.print %0 : i1
- %1 = arith.addi %false, %true_0 : i1
+
+ // CHECK-NEXT: 1
+ %true_based_on_non_zero_val = arith.constant -1 : i1
+ %1 = func.call @add_i1(%false, %true_based_on_non_zero_val) : (i1, i1) -> i1
vector.print %1 : i1
return
}
-func.func @addui_extended_i1() {
+func.func @addui_extended_i1(%v1 : i1, %v2 : i1) -> (i1, i1) {
+ %res, %overflow = arith.addui_extended %v1, %v2 : i1, i1
+ return %res, %overflow : i1, i1
+}
+
+func.func @additions_extended_i1() {
// addui_extended on i1
// addui_extended 1 1 : i1 = 0, 1
+ %true = arith.constant 1 : i1
+ %false = arith.constant 0 : i1
+
// CHECK-NEXT: 0
// CHECK-NEXT: 1
- %true = arith.constant 1 : i1
- %sum, %overflow = arith.addui_extended %true, %true : i1, i1
- vector.print %sum : i1
- vector.print %overflow : i1
+ %sum_tt, %overflow_tt = func.call @addui_extended_i1(%true, %true) : (i1, i1) -> (i1, i1)
+ vector.print %sum_tt : i1
+ vector.print %overflow_tt : i1
+
+ // CHECK-NEXT: 1
+ // CHECK-NEXT: 0
+ %sum_tf, %overflow_tf = func.call @addui_extended_i1(%true, %false) : (i1, i1) -> (i1, i1)
+ vector.print %sum_tf : i1
+ vector.print %overflow_tf : i1
+
+ // CHECK-NEXT: 1
+ // CHECK-NEXT: 0
+ %sum_ft, %overflow_ft = func.call @addui_extended_i1(%false, %true) : (i1, i1) -> (i1, i1)
+ vector.print %sum_ft : i1
+ vector.print %overflow_ft : i1
+
+ // CHECK-NEXT: 0
+ // CHECK-NEXT: 0
+ %sum_ff, %overflow_ff = func.call @addui_extended_i1(%false, %false) : (i1, i1) -> (i1, i1)
+ vector.print %sum_ff : i1
+ vector.print %overflow_ff : i1
return
}
-func.func @addui_extended_overflow_bit_is_n1() {
- // addui_extended overflow bit is treated as -1
- // addui_extended -1633386 -1643386 = ... 1 (overflow because negative numbers are large positive numbers)
- // CHECK-NEXT: 0
- %c-16433886_i64 = arith.constant -16433886 : i64
- %sum, %overflow = arith.addui_extended %c-16433886_i64, %c-16433886_i64 : i64, i1
+func.func @addui_extended_overflow_bit_is_treated_as_n1_in_comparisons() {
+ // check that addui_extended overflow bit is treated as -1 in comparison operations
+ // in the case of an overflow
+ // addui_extended -1 -1 = (..., overflow_bit)
+ // assert(overflow_bit <= 0)
+ %1 = arith.constant -1 : i64
+ %sum, %overflow = arith.addui_extended %1, %1 : i64, i1
%false = arith.constant false
%0 = arith.cmpi sge, %overflow, %false : i1
- vector.print %0 : i1 // but prints as "1"
+
+ // CHECK-NEXT: 0
+ vector.print %0 : i1
return
}
func.func @entry() {
- func.call @zero_plus_one_on_i1() : () -> ()
- func.call @addui_extended_i1() : () -> ()
- func.call @addui_extended_overflow_bit_is_n1() : () -> ()
+ func.call @additions_i1() : () -> ()
+ func.call @additions_extended_i1() : () -> ()
+ func.call @addui_extended_overflow_bit_is_treated_as_n1_in_comparisons() : () -> ()
return
}
>From 8474d6bb968e4778d7db2aed185d9e3b04742402 Mon Sep 17 00:00:00 2001
From: pingshiyu <pingshiyu at gmail.com>
Date: Sat, 29 Jun 2024 21:12:37 +0100
Subject: [PATCH 4/6] tidied up test oracle
---
.../Dialect/Arith/CPU/addition.mlir | 22 +++++++------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir b/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
index a9d441c4f3fb0..9e2367f650c51 100644
--- a/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
+++ b/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
@@ -10,6 +10,7 @@
func.func @add_i1(%v1 : i1, %v2 : i1) -> (i1) {
%res = arith.addi %v1, %v2 : i1
+ vector.print %res : i1
return %res : i1
}
@@ -21,17 +22,18 @@ func.func @additions_i1() {
// CHECK: 1
%0 = func.call @add_i1(%false, %true) : (i1, i1) -> i1
- vector.print %0 : i1
// CHECK-NEXT: 1
%true_based_on_non_zero_val = arith.constant -1 : i1
%1 = func.call @add_i1(%false, %true_based_on_non_zero_val) : (i1, i1) -> i1
- vector.print %1 : i1
+
return
}
func.func @addui_extended_i1(%v1 : i1, %v2 : i1) -> (i1, i1) {
%res, %overflow = arith.addui_extended %v1, %v2 : i1, i1
+ vector.print %res : i1
+ vector.print %overflow : i1
return %res, %overflow : i1, i1
}
@@ -43,27 +45,19 @@ func.func @additions_extended_i1() {
// CHECK-NEXT: 0
// CHECK-NEXT: 1
- %sum_tt, %overflow_tt = func.call @addui_extended_i1(%true, %true) : (i1, i1) -> (i1, i1)
- vector.print %sum_tt : i1
- vector.print %overflow_tt : i1
+ func.call @addui_extended_i1(%true, %true) : (i1, i1) -> (i1, i1)
// CHECK-NEXT: 1
// CHECK-NEXT: 0
- %sum_tf, %overflow_tf = func.call @addui_extended_i1(%true, %false) : (i1, i1) -> (i1, i1)
- vector.print %sum_tf : i1
- vector.print %overflow_tf : i1
+ func.call @addui_extended_i1(%true, %false) : (i1, i1) -> (i1, i1)
// CHECK-NEXT: 1
// CHECK-NEXT: 0
- %sum_ft, %overflow_ft = func.call @addui_extended_i1(%false, %true) : (i1, i1) -> (i1, i1)
- vector.print %sum_ft : i1
- vector.print %overflow_ft : i1
+ func.call @addui_extended_i1(%false, %true) : (i1, i1) -> (i1, i1)
// CHECK-NEXT: 0
// CHECK-NEXT: 0
- %sum_ff, %overflow_ff = func.call @addui_extended_i1(%false, %false) : (i1, i1) -> (i1, i1)
- vector.print %sum_ff : i1
- vector.print %overflow_ff : i1
+ func.call @addui_extended_i1(%false, %false) : (i1, i1) -> (i1, i1)
return
}
>From 1900d2239add84ecbd1d47730ae94667d7f81f22 Mon Sep 17 00:00:00 2001
From: pingshiyu <pingshiyu at gmail.com>
Date: Mon, 1 Jul 2024 15:51:36 +0100
Subject: [PATCH 5/6] reformatted in the same way as for multiplication
---
.../Dialect/Arith/CPU/addition.mlir | 66 +++++++++++++------
1 file changed, 45 insertions(+), 21 deletions(-)
diff --git a/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir b/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
index 9e2367f650c51..974ed347cc6d5 100644
--- a/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
+++ b/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
@@ -8,56 +8,80 @@
// RUN: --shared-libs=%mlir_c_runner_utils | \
// RUN: FileCheck %s --match-full-lines
-func.func @add_i1(%v1 : i1, %v2 : i1) -> (i1) {
+func.func @addi_i1(%v1 : i1, %v2 : i1) -> (i1) {
+ vector.print str "@addi_i1\n"
%res = arith.addi %v1, %v2 : i1
vector.print %res : i1
return %res : i1
}
-func.func @additions_i1() {
+func.func @addi() {
+ // ------------------------------------------------
+ // Test i1
+ // ------------------------------------------------
+
// addi on i1
// addi(0, 1) : i1 = 1 : i1; addi(0, -1) : i1 = 1
%false = arith.constant 0 : i1
%true = arith.constant 1 : i1
- // CHECK: 1
- %0 = func.call @add_i1(%false, %true) : (i1, i1) -> i1
+ // CHECK-LABEL: @addi_i1
+ // CHECK-NEXT: 1
+ func.call @addi_i1(%false, %true) : (i1, i1) -> i1
- // CHECK-NEXT: 1
+ // CHECK-LABEL: @addi_i1
+ // CHECK-NEXT: 1
%true_based_on_non_zero_val = arith.constant -1 : i1
- %1 = func.call @add_i1(%false, %true_based_on_non_zero_val) : (i1, i1) -> i1
+ func.call @addi_i1(%false, %true_based_on_non_zero_val) : (i1, i1) -> i1
+
+ // ------------------------------------------------
+ // Test i8, i16 etc.. TODO
+ // ------------------------------------------------
return
}
func.func @addui_extended_i1(%v1 : i1, %v2 : i1) -> (i1, i1) {
+ vector.print str "@addui_extended_i1\n"
%res, %overflow = arith.addui_extended %v1, %v2 : i1, i1
vector.print %res : i1
vector.print %overflow : i1
return %res, %overflow : i1, i1
}
-func.func @additions_extended_i1() {
+func.func @addi_extended() {
+ // ------------------------------------------------
+ // Test i1
+ // ------------------------------------------------
+
// addui_extended on i1
// addui_extended 1 1 : i1 = 0, 1
%true = arith.constant 1 : i1
%false = arith.constant 0 : i1
- // CHECK-NEXT: 0
- // CHECK-NEXT: 1
+ // CHECK-LABEL: @addui_extended_i1
+ // CHECK-NEXT: 0
+ // CHECK-NEXT: 1
func.call @addui_extended_i1(%true, %true) : (i1, i1) -> (i1, i1)
- // CHECK-NEXT: 1
- // CHECK-NEXT: 0
+ // CHECK-LABEL: @addui_extended_i1
+ // CHECK-NEXT: 1
+ // CHECK-NEXT: 0
func.call @addui_extended_i1(%true, %false) : (i1, i1) -> (i1, i1)
- // CHECK-NEXT: 1
- // CHECK-NEXT: 0
+ // CHECK-LABEL: @addui_extended_i1
+ // CHECK-NEXT: 1
+ // CHECK-NEXT: 0
func.call @addui_extended_i1(%false, %true) : (i1, i1) -> (i1, i1)
- // CHECK-NEXT: 0
- // CHECK-NEXT: 0
+ // CHECK-LABEL: @addui_extended_i1
+ // CHECK-NEXT: 0
+ // CHECK-NEXT: 0
func.call @addui_extended_i1(%false, %false) : (i1, i1) -> (i1, i1)
+
+ // ------------------------------------------------
+ // Test i8, i16 etc.. TODO
+ // ------------------------------------------------
return
}
@@ -66,19 +90,19 @@ func.func @addui_extended_overflow_bit_is_treated_as_n1_in_comparisons() {
// in the case of an overflow
// addui_extended -1 -1 = (..., overflow_bit)
// assert(overflow_bit <= 0)
- %1 = arith.constant -1 : i64
- %sum, %overflow = arith.addui_extended %1, %1 : i64, i1
+ %n1 = arith.constant -1 : i64
+ %sum, %overflow = arith.addui_extended %n1, %n1 : i64, i1
%false = arith.constant false
- %0 = arith.cmpi sge, %overflow, %false : i1
+ %overflow_ge_zero = arith.cmpi sge, %overflow, %false : i1
// CHECK-NEXT: 0
- vector.print %0 : i1
+ vector.print %overflow_ge_zero : i1
return
}
func.func @entry() {
- func.call @additions_i1() : () -> ()
- func.call @additions_extended_i1() : () -> ()
+ func.call @addi() : () -> ()
+ func.call @addi_extended() : () -> ()
func.call @addui_extended_overflow_bit_is_treated_as_n1_in_comparisons() : () -> ()
return
}
>From 8c71e34cb0958dfa1f02325fda2e5dcf78112ccb Mon Sep 17 00:00:00 2001
From: pingshiyu <pingshiyu at gmail.com>
Date: Tue, 2 Jul 2024 21:59:35 +0100
Subject: [PATCH 6/6] moving test to comparisons, removed return value
---
.../Dialect/Arith/CPU/addition.mlir | 36 ++++++-------------
1 file changed, 10 insertions(+), 26 deletions(-)
diff --git a/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir b/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
index 974ed347cc6d5..0c6231907abd1 100644
--- a/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
+++ b/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
@@ -8,11 +8,11 @@
// RUN: --shared-libs=%mlir_c_runner_utils | \
// RUN: FileCheck %s --match-full-lines
-func.func @addi_i1(%v1 : i1, %v2 : i1) -> (i1) {
+func.func @addi_i1(%v1 : i1, %v2 : i1) {
vector.print str "@addi_i1\n"
%res = arith.addi %v1, %v2 : i1
vector.print %res : i1
- return %res : i1
+ return
}
func.func @addi() {
@@ -27,12 +27,12 @@ func.func @addi() {
// CHECK-LABEL: @addi_i1
// CHECK-NEXT: 1
- func.call @addi_i1(%false, %true) : (i1, i1) -> i1
+ func.call @addi_i1(%false, %true) : (i1, i1) -> ()
// CHECK-LABEL: @addi_i1
// CHECK-NEXT: 1
%true_based_on_non_zero_val = arith.constant -1 : i1
- func.call @addi_i1(%false, %true_based_on_non_zero_val) : (i1, i1) -> i1
+ func.call @addi_i1(%false, %true_based_on_non_zero_val) : (i1, i1) -> ()
// ------------------------------------------------
// Test i8, i16 etc.. TODO
@@ -41,12 +41,12 @@ func.func @addi() {
return
}
-func.func @addui_extended_i1(%v1 : i1, %v2 : i1) -> (i1, i1) {
+func.func @addui_extended_i1(%v1 : i1, %v2 : i1) {
vector.print str "@addui_extended_i1\n"
%res, %overflow = arith.addui_extended %v1, %v2 : i1, i1
vector.print %res : i1
vector.print %overflow : i1
- return %res, %overflow : i1, i1
+ return
}
func.func @addi_extended() {
@@ -62,22 +62,22 @@ func.func @addi_extended() {
// CHECK-LABEL: @addui_extended_i1
// CHECK-NEXT: 0
// CHECK-NEXT: 1
- func.call @addui_extended_i1(%true, %true) : (i1, i1) -> (i1, i1)
+ func.call @addui_extended_i1(%true, %true) : (i1, i1) -> ()
// CHECK-LABEL: @addui_extended_i1
// CHECK-NEXT: 1
// CHECK-NEXT: 0
- func.call @addui_extended_i1(%true, %false) : (i1, i1) -> (i1, i1)
+ func.call @addui_extended_i1(%true, %false) : (i1, i1) -> ()
// CHECK-LABEL: @addui_extended_i1
// CHECK-NEXT: 1
// CHECK-NEXT: 0
- func.call @addui_extended_i1(%false, %true) : (i1, i1) -> (i1, i1)
+ func.call @addui_extended_i1(%false, %true) : (i1, i1) -> ()
// CHECK-LABEL: @addui_extended_i1
// CHECK-NEXT: 0
// CHECK-NEXT: 0
- func.call @addui_extended_i1(%false, %false) : (i1, i1) -> (i1, i1)
+ func.call @addui_extended_i1(%false, %false) : (i1, i1) -> ()
// ------------------------------------------------
// Test i8, i16 etc.. TODO
@@ -85,24 +85,8 @@ func.func @addi_extended() {
return
}
-func.func @addui_extended_overflow_bit_is_treated_as_n1_in_comparisons() {
- // check that addui_extended overflow bit is treated as -1 in comparison operations
- // in the case of an overflow
- // addui_extended -1 -1 = (..., overflow_bit)
- // assert(overflow_bit <= 0)
- %n1 = arith.constant -1 : i64
- %sum, %overflow = arith.addui_extended %n1, %n1 : i64, i1
- %false = arith.constant false
- %overflow_ge_zero = arith.cmpi sge, %overflow, %false : i1
-
- // CHECK-NEXT: 0
- vector.print %overflow_ge_zero : i1
- return
-}
-
func.func @entry() {
func.call @addi() : () -> ()
func.call @addi_extended() : () -> ()
- func.call @addui_extended_overflow_bit_is_treated_as_n1_in_comparisons() : () -> ()
return
}
More information about the Mlir-commits
mailing list