Skip to content

Commit 9d509b3

Browse files
committed
more tests added, comments updated
1 parent 1d9d292 commit 9d509b3

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

mlir/test/Integration/Dialect/Arith/CPU/comparison.mlir

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
// RUN: --shared-libs=%mlir_c_runner_utils | \
55
// RUN: FileCheck %s --match-full-lines
66

7+
func.func @cmpi_eq_i1(%v1 : i1, %v2 : i1) {
8+
vector.print str "@cmpi_eq_i1\n"
9+
%res = arith.cmpi eq, %v1, %v2 : i1
10+
vector.print %res : i1
11+
return
12+
}
13+
714
func.func @cmpi_slt_i1(%v1 : i1, %v2 : i1) {
815
vector.print str "@cmpi_slt_i1\n"
916
%res = arith.cmpi slt, %v1, %v2 : i1
@@ -40,9 +47,12 @@ func.func @cmpi_signed() {
4047
%true_i1 = arith.constant 1 : i1
4148
%true_i1_n1 = arith.constant -1 : i1
4249

43-
// sge 0 -1, sge 0 1, should be true
44-
// since the bitvector `1` is interpreted as the int value -1 in signed comparisons
45-
// sge 0 -1 == sge 0 1 == true (1)
50+
// int values 1 and -1 represent the same bitvector
51+
// CHECK-LABEL: @cmpi_eq_i1
52+
// CHECK-NEXT: 1
53+
func.call @cmpi_eq_i1(%true_i1, %true_i1_n1) : (i1, i1) -> ()
54+
55+
// But, bitvector `1` is interpreted as int value -1 in signed comparison
4656

4757
// CHECK-LABEL: @cmpi_sge_i1
4858
// CHECK-NEXT: 1
@@ -55,8 +65,6 @@ func.func @cmpi_signed() {
5565
%false = arith.constant false
5666
%true = arith.constant true
5767

58-
// slt 0 1 = false, sle 0 1 = false, sgt 0 1 = true, sge 0 1 = true, sge 1 0 = false
59-
6068
// CHECK-LABEL: @cmpi_slt_i1
6169
// CHECK-NEXT: 0
6270
func.call @cmpi_slt_i1(%false, %true) : (i1, i1) -> ()

0 commit comments

Comments
 (0)