Skip to content

[mlir][arith] Remove some e2e tests #112012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

banach-space
Copy link
Contributor

@banach-space banach-space commented Oct 11, 2024

I am removing the recently added integration test for various Arith Ops.
These operations and their lowerings are effectively already verified by
the Arith-to-LLVM conversion tests in:

  • "mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir"

I've noticed that a few variants of arith.cmpi were missing in that
file - those are added here as well.

This is a follow-up for this discussion:

See also the recent update to our guidelines on e2e tests in MLIR:

I am removing the recently added integration test for various Arith Ops.
These operations and their lowerings are effectively already verified by
the Arith-to-LLVM conversion tests in:
  * "mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir"

I've noticed that a few variants of arith.cmpi were missing in that file
- those are added here as well.

This is a follow-up for this discussion:
  * llvm#92272

See also the recent update to our guidelines on e2e tests in MLIR:
  * llvm/mlir-www#203
@llvmbot
Copy link
Member

llvmbot commented Oct 11, 2024

@llvm/pr-subscribers-mlir

Author: Andrzej Warzyński (banach-space)

Changes

I am removing the recently added integration test for various Arith Ops.
These operations and their lowerings are effectively already verified by
the Arith-to-LLVM conversion tests in:

  • "mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir"

I've noticed that a few variants of arith.cmpi were missing in that file

  • those are added here as well.

This is a follow-up for this discussion:

See also the recent update to our guidelines on e2e tests in MLIR:


Full diff: https://github.com/llvm/llvm-project/pull/112012.diff

4 Files Affected:

  • (modified) mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir (+26-14)
  • (removed) mlir/test/Integration/Dialect/Arith/CPU/addition.mlir (-88)
  • (removed) mlir/test/Integration/Dialect/Arith/CPU/comparison.mlir (-174)
  • (removed) mlir/test/Integration/Dialect/Arith/CPU/multiplication.mlir (-119)
diff --git a/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir b/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
index d3bdbe89a54876..64c40f1aba43bc 100644
--- a/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
+++ b/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
@@ -46,33 +46,45 @@ func.func @ops(f32, f32, i32, i32, f64) -> (f32, i32) {
   %1 = arith.subi %arg2, %arg3: i32
 // CHECK: = llvm.icmp "slt" %arg2, %1 : i32
   %2 = arith.cmpi slt, %arg2, %1 : i32
+// CHECK: = llvm.icmp "sle" %arg2, %1 : i32
+  %3 = arith.cmpi sle, %arg2, %1 : i32
+// CHECK: = llvm.icmp "sgt" %arg2, %1 : i32
+  %4 = arith.cmpi sgt, %arg2, %1 : i32
+// CHECK: = llvm.icmp "ult" %arg2, %1 : i32
+  %5 = arith.cmpi ult, %arg2, %1 : i32
+// CHECK: = llvm.icmp "ule" %arg2, %1 : i32
+  %6 = arith.cmpi ule, %arg2, %1 : i32
+// CHECK: = llvm.icmp "ugt" %arg2, %1 : i32
+  %7 = arith.cmpi ugt, %arg2, %1 : i32
+// CHECK: = llvm.icmp "eq" %arg2, %1 : i32
+  %8 = arith.cmpi eq, %arg2, %1 : i32
 // CHECK: = llvm.sdiv %arg2, %arg3 : i32
-  %3 = arith.divsi %arg2, %arg3 : i32
+  %9 = arith.divsi %arg2, %arg3 : i32
 // CHECK: = llvm.udiv %arg2, %arg3 : i32
-  %4 = arith.divui %arg2, %arg3 : i32
+  %10 = arith.divui %arg2, %arg3 : i32
 // CHECK: = llvm.srem %arg2, %arg3 : i32
-  %5 = arith.remsi %arg2, %arg3 : i32
+  %11 = arith.remsi %arg2, %arg3 : i32
 // CHECK: = llvm.urem %arg2, %arg3 : i32
-  %6 = arith.remui %arg2, %arg3 : i32
+  %12 = arith.remui %arg2, %arg3 : i32
 // CHECK: = llvm.fdiv %arg0, %arg1 : f32
-  %8 = arith.divf %arg0, %arg1 : f32
+  %13 = arith.divf %arg0, %arg1 : f32
 // CHECK: = llvm.frem %arg0, %arg1 : f32
-  %9 = arith.remf %arg0, %arg1 : f32
+  %14 = arith.remf %arg0, %arg1 : f32
 // CHECK: = llvm.and %arg2, %arg3 : i32
-  %10 = arith.andi %arg2, %arg3 : i32
+  %15 = arith.andi %arg2, %arg3 : i32
 // CHECK: = llvm.or %arg2, %arg3 : i32
-  %11 = arith.ori %arg2, %arg3 : i32
+  %16 = arith.ori %arg2, %arg3 : i32
 // CHECK: = llvm.xor %arg2, %arg3 : i32
-  %12 = arith.xori %arg2, %arg3 : i32
+  %17 = arith.xori %arg2, %arg3 : i32
 // CHECK: = llvm.mlir.constant(7.900000e-01 : f64) : f64
-  %15 = arith.constant 7.9e-01 : f64
+  %18 = arith.constant 7.9e-01 : f64
 // CHECK: = llvm.shl %arg2, %arg3 : i32
-  %16 = arith.shli %arg2, %arg3 : i32
+  %19 = arith.shli %arg2, %arg3 : i32
 // CHECK: = llvm.ashr %arg2, %arg3 : i32
-  %17 = arith.shrsi %arg2, %arg3 : i32
+  %20 = arith.shrsi %arg2, %arg3 : i32
 // CHECK: = llvm.lshr %arg2, %arg3 : i32
-  %18 = arith.shrui %arg2, %arg3 : i32
-  return %0, %4 : f32, i32
+  %21 = arith.shrui %arg2, %arg3 : i32
+  return %0, %10 : f32, i32
 }
 
 // Checking conversion of index types to integers using i1, assuming no target
diff --git a/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir b/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
deleted file mode 100644
index b6acfd53c1f5d9..00000000000000
--- a/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
+++ /dev/null
@@ -1,88 +0,0 @@
-// 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 @addi_i1(%v1 : i1, %v2 : i1) {
-  vector.print str "@addi_i1\n"
-  %res = arith.addi %v1, %v2 : i1
-  vector.print %res : i1
-  return
-}
-
-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-LABEL: @addi_i1
-  // CHECK-NEXT:  1
-  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) -> ()
-
-  // ------------------------------------------------
-  // TODO: Test i8, i16 etc..
-  // ------------------------------------------------
-
-  return
-}
-
-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
-}
-
-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-LABEL: @addui_extended_i1
-  // CHECK-NEXT:  0
-  // CHECK-NEXT:  1
-  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) -> ()
-
-  // CHECK-LABEL: @addui_extended_i1
-  // CHECK-NEXT:  1
-  // CHECK-NEXT:  0
-  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) -> ()
-
-  // ------------------------------------------------
-  // TODO: Test i8, i16 etc.. 
-  // ------------------------------------------------
-  return
-}
-
-func.func @entry() {
-  func.call @addi() : () -> ()
-  func.call @addi_extended() : () -> ()
-  return
-}
diff --git a/mlir/test/Integration/Dialect/Arith/CPU/comparison.mlir b/mlir/test/Integration/Dialect/Arith/CPU/comparison.mlir
deleted file mode 100644
index 418fbb0c0a94c7..00000000000000
--- a/mlir/test/Integration/Dialect/Arith/CPU/comparison.mlir
+++ /dev/null
@@ -1,174 +0,0 @@
-// 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 @cmpi_eq_i1(%v1 : i1, %v2 : i1) {
-  vector.print str "@cmpi_eq_i1\n"
-  %res = arith.cmpi eq, %v1, %v2 : i1
-  vector.print %res : i1
-  return
-}
-
-func.func @cmpi_slt_i1(%v1 : i1, %v2 : i1) {
-  vector.print str "@cmpi_slt_i1\n"
-  %res = arith.cmpi slt, %v1, %v2 : i1
-  vector.print %res : i1
-  return
-}
-
-func.func @cmpi_sle_i1(%v1 : i1, %v2 : i1) {
-  vector.print str "@cmpi_sle_i1\n"
-  %res = arith.cmpi sle, %v1, %v2 : i1
-  vector.print %res : i1
-  return
-}
-
-func.func @cmpi_sgt_i1(%v1 : i1, %v2 : i1) {
-  vector.print str "@cmpi_sgt_i1\n"
-  %res = arith.cmpi sgt, %v1, %v2 : i1
-  vector.print %res : i1
-  return
-}
-
-func.func @cmpi_sge_i1(%v1 : i1, %v2 : i1) {
-  vector.print str "@cmpi_sge_i1\n"
-  %res = arith.cmpi sge, %v1, %v2 : i1
-  vector.print %res : i1
-  return
-}
-
-func.func @cmpi_eq() {
-  // ------------------------------------------------
-  // Test i1
-  // ------------------------------------------------
-  %false_i1 = arith.constant 0 : i1
-  %true_i1 = arith.constant 1 : i1
-  %true_i1_n1 = arith.constant -1 : i1
-
-  // int values 1 and -1 are represented with the same bitvector (`0b1`)
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_eq_i1(%true_i1, %true_i1_n1) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  0
-  func.call @cmpi_eq_i1(%false_i1, %true_i1) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  0
-  func.call @cmpi_eq_i1(%true_i1, %false_i1) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_eq_i1(%true_i1, %true_i1) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_eq_i1(%false_i1, %false_i1) : (i1, i1) -> ()
-
-  %false = arith.constant false
-  %true = arith.constant true
-
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_eq_i1(%true, %true_i1) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_eq_i1(%false, %false_i1) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_eq_i1(%true, %true_i1_n1) : (i1, i1) -> ()
-
-  // ------------------------------------------------
-  // TODO: Test i8, i16 etc..
-  // ------------------------------------------------
-  return
-}
-
-func.func @cmpi_signed() {
-  // ------------------------------------------------
-  // Test i1
-  // ------------------------------------------------
-  %false_i1 = arith.constant 0 : i1
-  %true_i1 = arith.constant 1 : i1
-  %true_i1_n1 = arith.constant -1 : i1
-
-  // int values 1 and -1 are represented with the same bitvector (`0b1`)
-  // But, bitvector `1` is interpreted as int value -1 in signed comparison
-
-  // CHECK-LABEL: @cmpi_sge_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_sge_i1(%false_i1, %true_i1_n1) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_sge_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_sge_i1(%false_i1, %true_i1) : (i1, i1) -> ()
-  
-  // CHECK-LABEL: @cmpi_sge_i1
-  // CHECK-NEXT:  0
-  func.call @cmpi_sge_i1(%true_i1, %false_i1) : (i1, i1) -> ()
-
-  %false = arith.constant false
-  %true = arith.constant true
-
-  // CHECK-LABEL: @cmpi_slt_i1
-  // CHECK-NEXT:  0
-  func.call @cmpi_slt_i1(%false, %true) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_sle_i1
-  // CHECK-NEXT:  0
-  func.call @cmpi_sle_i1(%false, %true) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_sgt_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_sgt_i1(%false, %true) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_sge_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_sge_i1(%false, %true) : (i1, i1) -> ()
-  
-  // CHECK-LABEL: @cmpi_sge_i1
-  // CHECK-NEXT:  0
-  func.call @cmpi_sge_i1(%true, %false) : (i1, i1) -> ()
-  
-  // ------------------------------------------------
-  // TODO: Test i8, i16 etc..
-  // ------------------------------------------------
-  return
-}
-
-func.func @cmpi_ult_index(%v1 : index, %v2 : index) {
-  vector.print str "@cmpi_ult_index\n"
-  %res = arith.cmpi ult, %v1, %v2 : index
-  vector.print %res : i1
-  return
-}
-
-func.func @cmpi_unsigned() {
-  // ------------------------------------------------
-  // Test index
-  // ------------------------------------------------
-  // 0 `ult` -2^63 = true
-  %zero = arith.constant 0 : index
-  %index_min = arith.constant -9223372036854775808 : index
-
-  // CHECK-LABEL: @cmpi_ult_index
-  // CHECK-NEXT: 1
-  func.call @cmpi_ult_index(%zero, %index_min) : (index, index) -> ()
-  
-  // ------------------------------------------------
-  // TODO: i1, i8, i16, uge, ule etc.. 
-  // ------------------------------------------------
-  return
-}
-
-func.func @entry() {
-  func.call @cmpi_eq() : () -> ()
-  func.call @cmpi_signed() : () -> ()
-  func.call @cmpi_unsigned() : () -> ()
-  return
-}
diff --git a/mlir/test/Integration/Dialect/Arith/CPU/multiplication.mlir b/mlir/test/Integration/Dialect/Arith/CPU/multiplication.mlir
deleted file mode 100644
index 21fd816788431e..00000000000000
--- a/mlir/test/Integration/Dialect/Arith/CPU/multiplication.mlir
+++ /dev/null
@@ -1,119 +0,0 @@
-// 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 @mulsi_extended_i1(%v1 : i1, %v2 : i1) {
-  vector.print str "@mulsi_extended_i1\n"
-  %low, %high = arith.mulsi_extended %v1, %v2 : i1
-  vector.print %low : i1
-  vector.print %high : i1
-  return
-}
-
-func.func @mulsi_extended_i8(%v1 : i8, %v2 : i8) {
-  vector.print str "@mulsi_extended_i8\n"
-  %low, %high = arith.mulsi_extended %v1, %v2 : i8
-  vector.print %low : i8
-  vector.print %high : i8
-  return
-}
-
-func.func @mulsi_extended() {
-  // ------------------------------------------------
-  // Test i1
-  // ------------------------------------------------
-
-  // mulsi_extended on i1, tests for overflow bit
-  // mulsi_extended 1, 1 : i1 = (1, 0)
-  %true = arith.constant true
-  %false = arith.constant false
-
-  // CHECK-LABEL: @mulsi_extended_i1
-  // CHECK-NEXT:  1
-  // CHECK-NEXT:  0
-  func.call @mulsi_extended_i1(%true, %true) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @mulsi_extended_i1
-  // CHECK-NEXT:  0
-  // CHECK-NEXT:  0
-  func.call @mulsi_extended_i1(%true, %false) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @mulsi_extended_i1
-  // CHECK-NEXT:  0
-  // CHECK-NEXT:  0
-  func.call @mulsi_extended_i1(%false, %true) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @mulsi_extended_i1
-  // CHECK-NEXT:  0
-  // CHECK-NEXT:  0
-  func.call @mulsi_extended_i1(%false, %false) : (i1, i1) -> ()
-
-  // ------------------------------------------------
-  // Test i8
-  // ------------------------------------------------
-  // mulsi extended versions, with overflow
-  %c_100_i8 = arith.constant -100 : i8
-
-  // mulsi_extended -100, -100 : i8 = (16, 39)
-  // CHECK-LABEL: @mulsi_extended_i8
-  // CHECK-NEXT:  16
-  // CHECK-NEXT:  39
-  func.call @mulsi_extended_i8(%c_100_i8, %c_100_i8) : (i8, i8) -> ()
-
-  // ------------------------------------------------
-  // TODO: Test i16, i32 etc.. 
-  // ------------------------------------------------
-  return
-}
-
-func.func @mului_extended_i8(%v1 : i8, %v2 : i8) {
-  vector.print str "@mului_extended_i8\n"
-  %low, %high = arith.mului_extended %v1, %v2 : i8
-  vector.print %low : i8
-  vector.print %high : i8
-  return
-}
-
-func.func @mului_extended() {
-  // ------------------------------------------------
-  // Test i8
-  // ------------------------------------------------
-  %c_n100_i8 = arith.constant -100 : i8
-  %c_156_i8 = arith.constant 156 : i8
-
-  // mului_extended -100, -100 : i8 = (16, 95)
-  // and on equivalent representations (e.g. 156 === -100 (mod 256))
-
-  // CHECK-LABEL: @mului_extended_i8
-  // CHECK-NEXT:  16
-  // CHECK-NEXT:  95
-  func.call @mului_extended_i8(%c_n100_i8, %c_n100_i8) : (i8, i8) -> ()
-
-  // CHECK-LABEL: @mului_extended_i8
-  // CHECK-NEXT:  16
-  // CHECK-NEXT:  95
-  func.call @mului_extended_i8(%c_n100_i8, %c_156_i8) : (i8, i8) -> ()
-
-  // CHECK-LABEL: @mului_extended_i8
-  // CHECK-NEXT:  16
-  // CHECK-NEXT:  95
-  func.call @mului_extended_i8(%c_156_i8, %c_n100_i8) : (i8, i8) -> ()
-
-  // CHECK-LABEL: @mului_extended_i8
-  // CHECK-NEXT:  16
-  // CHECK-NEXT:  95
-  func.call @mului_extended_i8(%c_156_i8, %c_156_i8) : (i8, i8) -> ()
-
-  // ------------------------------------------------
-  // TODO: Test i1, i16, i32 etc.. 
-  // ------------------------------------------------
-  return
-}
-
-func.func @entry() {
-  func.call @mulsi_extended() : () -> ()
-  func.call @mului_extended() : () -> ()
-  return
-}

@llvmbot
Copy link
Member

llvmbot commented Oct 11, 2024

@llvm/pr-subscribers-mlir-arith

Author: Andrzej Warzyński (banach-space)

Changes

I am removing the recently added integration test for various Arith Ops.
These operations and their lowerings are effectively already verified by
the Arith-to-LLVM conversion tests in:

  • "mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir"

I've noticed that a few variants of arith.cmpi were missing in that file

  • those are added here as well.

This is a follow-up for this discussion:

See also the recent update to our guidelines on e2e tests in MLIR:


Full diff: https://github.com/llvm/llvm-project/pull/112012.diff

4 Files Affected:

  • (modified) mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir (+26-14)
  • (removed) mlir/test/Integration/Dialect/Arith/CPU/addition.mlir (-88)
  • (removed) mlir/test/Integration/Dialect/Arith/CPU/comparison.mlir (-174)
  • (removed) mlir/test/Integration/Dialect/Arith/CPU/multiplication.mlir (-119)
diff --git a/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir b/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
index d3bdbe89a54876..64c40f1aba43bc 100644
--- a/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
+++ b/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
@@ -46,33 +46,45 @@ func.func @ops(f32, f32, i32, i32, f64) -> (f32, i32) {
   %1 = arith.subi %arg2, %arg3: i32
 // CHECK: = llvm.icmp "slt" %arg2, %1 : i32
   %2 = arith.cmpi slt, %arg2, %1 : i32
+// CHECK: = llvm.icmp "sle" %arg2, %1 : i32
+  %3 = arith.cmpi sle, %arg2, %1 : i32
+// CHECK: = llvm.icmp "sgt" %arg2, %1 : i32
+  %4 = arith.cmpi sgt, %arg2, %1 : i32
+// CHECK: = llvm.icmp "ult" %arg2, %1 : i32
+  %5 = arith.cmpi ult, %arg2, %1 : i32
+// CHECK: = llvm.icmp "ule" %arg2, %1 : i32
+  %6 = arith.cmpi ule, %arg2, %1 : i32
+// CHECK: = llvm.icmp "ugt" %arg2, %1 : i32
+  %7 = arith.cmpi ugt, %arg2, %1 : i32
+// CHECK: = llvm.icmp "eq" %arg2, %1 : i32
+  %8 = arith.cmpi eq, %arg2, %1 : i32
 // CHECK: = llvm.sdiv %arg2, %arg3 : i32
-  %3 = arith.divsi %arg2, %arg3 : i32
+  %9 = arith.divsi %arg2, %arg3 : i32
 // CHECK: = llvm.udiv %arg2, %arg3 : i32
-  %4 = arith.divui %arg2, %arg3 : i32
+  %10 = arith.divui %arg2, %arg3 : i32
 // CHECK: = llvm.srem %arg2, %arg3 : i32
-  %5 = arith.remsi %arg2, %arg3 : i32
+  %11 = arith.remsi %arg2, %arg3 : i32
 // CHECK: = llvm.urem %arg2, %arg3 : i32
-  %6 = arith.remui %arg2, %arg3 : i32
+  %12 = arith.remui %arg2, %arg3 : i32
 // CHECK: = llvm.fdiv %arg0, %arg1 : f32
-  %8 = arith.divf %arg0, %arg1 : f32
+  %13 = arith.divf %arg0, %arg1 : f32
 // CHECK: = llvm.frem %arg0, %arg1 : f32
-  %9 = arith.remf %arg0, %arg1 : f32
+  %14 = arith.remf %arg0, %arg1 : f32
 // CHECK: = llvm.and %arg2, %arg3 : i32
-  %10 = arith.andi %arg2, %arg3 : i32
+  %15 = arith.andi %arg2, %arg3 : i32
 // CHECK: = llvm.or %arg2, %arg3 : i32
-  %11 = arith.ori %arg2, %arg3 : i32
+  %16 = arith.ori %arg2, %arg3 : i32
 // CHECK: = llvm.xor %arg2, %arg3 : i32
-  %12 = arith.xori %arg2, %arg3 : i32
+  %17 = arith.xori %arg2, %arg3 : i32
 // CHECK: = llvm.mlir.constant(7.900000e-01 : f64) : f64
-  %15 = arith.constant 7.9e-01 : f64
+  %18 = arith.constant 7.9e-01 : f64
 // CHECK: = llvm.shl %arg2, %arg3 : i32
-  %16 = arith.shli %arg2, %arg3 : i32
+  %19 = arith.shli %arg2, %arg3 : i32
 // CHECK: = llvm.ashr %arg2, %arg3 : i32
-  %17 = arith.shrsi %arg2, %arg3 : i32
+  %20 = arith.shrsi %arg2, %arg3 : i32
 // CHECK: = llvm.lshr %arg2, %arg3 : i32
-  %18 = arith.shrui %arg2, %arg3 : i32
-  return %0, %4 : f32, i32
+  %21 = arith.shrui %arg2, %arg3 : i32
+  return %0, %10 : f32, i32
 }
 
 // Checking conversion of index types to integers using i1, assuming no target
diff --git a/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir b/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
deleted file mode 100644
index b6acfd53c1f5d9..00000000000000
--- a/mlir/test/Integration/Dialect/Arith/CPU/addition.mlir
+++ /dev/null
@@ -1,88 +0,0 @@
-// 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 @addi_i1(%v1 : i1, %v2 : i1) {
-  vector.print str "@addi_i1\n"
-  %res = arith.addi %v1, %v2 : i1
-  vector.print %res : i1
-  return
-}
-
-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-LABEL: @addi_i1
-  // CHECK-NEXT:  1
-  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) -> ()
-
-  // ------------------------------------------------
-  // TODO: Test i8, i16 etc..
-  // ------------------------------------------------
-
-  return
-}
-
-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
-}
-
-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-LABEL: @addui_extended_i1
-  // CHECK-NEXT:  0
-  // CHECK-NEXT:  1
-  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) -> ()
-
-  // CHECK-LABEL: @addui_extended_i1
-  // CHECK-NEXT:  1
-  // CHECK-NEXT:  0
-  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) -> ()
-
-  // ------------------------------------------------
-  // TODO: Test i8, i16 etc.. 
-  // ------------------------------------------------
-  return
-}
-
-func.func @entry() {
-  func.call @addi() : () -> ()
-  func.call @addi_extended() : () -> ()
-  return
-}
diff --git a/mlir/test/Integration/Dialect/Arith/CPU/comparison.mlir b/mlir/test/Integration/Dialect/Arith/CPU/comparison.mlir
deleted file mode 100644
index 418fbb0c0a94c7..00000000000000
--- a/mlir/test/Integration/Dialect/Arith/CPU/comparison.mlir
+++ /dev/null
@@ -1,174 +0,0 @@
-// 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 @cmpi_eq_i1(%v1 : i1, %v2 : i1) {
-  vector.print str "@cmpi_eq_i1\n"
-  %res = arith.cmpi eq, %v1, %v2 : i1
-  vector.print %res : i1
-  return
-}
-
-func.func @cmpi_slt_i1(%v1 : i1, %v2 : i1) {
-  vector.print str "@cmpi_slt_i1\n"
-  %res = arith.cmpi slt, %v1, %v2 : i1
-  vector.print %res : i1
-  return
-}
-
-func.func @cmpi_sle_i1(%v1 : i1, %v2 : i1) {
-  vector.print str "@cmpi_sle_i1\n"
-  %res = arith.cmpi sle, %v1, %v2 : i1
-  vector.print %res : i1
-  return
-}
-
-func.func @cmpi_sgt_i1(%v1 : i1, %v2 : i1) {
-  vector.print str "@cmpi_sgt_i1\n"
-  %res = arith.cmpi sgt, %v1, %v2 : i1
-  vector.print %res : i1
-  return
-}
-
-func.func @cmpi_sge_i1(%v1 : i1, %v2 : i1) {
-  vector.print str "@cmpi_sge_i1\n"
-  %res = arith.cmpi sge, %v1, %v2 : i1
-  vector.print %res : i1
-  return
-}
-
-func.func @cmpi_eq() {
-  // ------------------------------------------------
-  // Test i1
-  // ------------------------------------------------
-  %false_i1 = arith.constant 0 : i1
-  %true_i1 = arith.constant 1 : i1
-  %true_i1_n1 = arith.constant -1 : i1
-
-  // int values 1 and -1 are represented with the same bitvector (`0b1`)
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_eq_i1(%true_i1, %true_i1_n1) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  0
-  func.call @cmpi_eq_i1(%false_i1, %true_i1) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  0
-  func.call @cmpi_eq_i1(%true_i1, %false_i1) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_eq_i1(%true_i1, %true_i1) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_eq_i1(%false_i1, %false_i1) : (i1, i1) -> ()
-
-  %false = arith.constant false
-  %true = arith.constant true
-
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_eq_i1(%true, %true_i1) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_eq_i1(%false, %false_i1) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_eq_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_eq_i1(%true, %true_i1_n1) : (i1, i1) -> ()
-
-  // ------------------------------------------------
-  // TODO: Test i8, i16 etc..
-  // ------------------------------------------------
-  return
-}
-
-func.func @cmpi_signed() {
-  // ------------------------------------------------
-  // Test i1
-  // ------------------------------------------------
-  %false_i1 = arith.constant 0 : i1
-  %true_i1 = arith.constant 1 : i1
-  %true_i1_n1 = arith.constant -1 : i1
-
-  // int values 1 and -1 are represented with the same bitvector (`0b1`)
-  // But, bitvector `1` is interpreted as int value -1 in signed comparison
-
-  // CHECK-LABEL: @cmpi_sge_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_sge_i1(%false_i1, %true_i1_n1) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_sge_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_sge_i1(%false_i1, %true_i1) : (i1, i1) -> ()
-  
-  // CHECK-LABEL: @cmpi_sge_i1
-  // CHECK-NEXT:  0
-  func.call @cmpi_sge_i1(%true_i1, %false_i1) : (i1, i1) -> ()
-
-  %false = arith.constant false
-  %true = arith.constant true
-
-  // CHECK-LABEL: @cmpi_slt_i1
-  // CHECK-NEXT:  0
-  func.call @cmpi_slt_i1(%false, %true) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_sle_i1
-  // CHECK-NEXT:  0
-  func.call @cmpi_sle_i1(%false, %true) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_sgt_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_sgt_i1(%false, %true) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @cmpi_sge_i1
-  // CHECK-NEXT:  1
-  func.call @cmpi_sge_i1(%false, %true) : (i1, i1) -> ()
-  
-  // CHECK-LABEL: @cmpi_sge_i1
-  // CHECK-NEXT:  0
-  func.call @cmpi_sge_i1(%true, %false) : (i1, i1) -> ()
-  
-  // ------------------------------------------------
-  // TODO: Test i8, i16 etc..
-  // ------------------------------------------------
-  return
-}
-
-func.func @cmpi_ult_index(%v1 : index, %v2 : index) {
-  vector.print str "@cmpi_ult_index\n"
-  %res = arith.cmpi ult, %v1, %v2 : index
-  vector.print %res : i1
-  return
-}
-
-func.func @cmpi_unsigned() {
-  // ------------------------------------------------
-  // Test index
-  // ------------------------------------------------
-  // 0 `ult` -2^63 = true
-  %zero = arith.constant 0 : index
-  %index_min = arith.constant -9223372036854775808 : index
-
-  // CHECK-LABEL: @cmpi_ult_index
-  // CHECK-NEXT: 1
-  func.call @cmpi_ult_index(%zero, %index_min) : (index, index) -> ()
-  
-  // ------------------------------------------------
-  // TODO: i1, i8, i16, uge, ule etc.. 
-  // ------------------------------------------------
-  return
-}
-
-func.func @entry() {
-  func.call @cmpi_eq() : () -> ()
-  func.call @cmpi_signed() : () -> ()
-  func.call @cmpi_unsigned() : () -> ()
-  return
-}
diff --git a/mlir/test/Integration/Dialect/Arith/CPU/multiplication.mlir b/mlir/test/Integration/Dialect/Arith/CPU/multiplication.mlir
deleted file mode 100644
index 21fd816788431e..00000000000000
--- a/mlir/test/Integration/Dialect/Arith/CPU/multiplication.mlir
+++ /dev/null
@@ -1,119 +0,0 @@
-// 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 @mulsi_extended_i1(%v1 : i1, %v2 : i1) {
-  vector.print str "@mulsi_extended_i1\n"
-  %low, %high = arith.mulsi_extended %v1, %v2 : i1
-  vector.print %low : i1
-  vector.print %high : i1
-  return
-}
-
-func.func @mulsi_extended_i8(%v1 : i8, %v2 : i8) {
-  vector.print str "@mulsi_extended_i8\n"
-  %low, %high = arith.mulsi_extended %v1, %v2 : i8
-  vector.print %low : i8
-  vector.print %high : i8
-  return
-}
-
-func.func @mulsi_extended() {
-  // ------------------------------------------------
-  // Test i1
-  // ------------------------------------------------
-
-  // mulsi_extended on i1, tests for overflow bit
-  // mulsi_extended 1, 1 : i1 = (1, 0)
-  %true = arith.constant true
-  %false = arith.constant false
-
-  // CHECK-LABEL: @mulsi_extended_i1
-  // CHECK-NEXT:  1
-  // CHECK-NEXT:  0
-  func.call @mulsi_extended_i1(%true, %true) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @mulsi_extended_i1
-  // CHECK-NEXT:  0
-  // CHECK-NEXT:  0
-  func.call @mulsi_extended_i1(%true, %false) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @mulsi_extended_i1
-  // CHECK-NEXT:  0
-  // CHECK-NEXT:  0
-  func.call @mulsi_extended_i1(%false, %true) : (i1, i1) -> ()
-
-  // CHECK-LABEL: @mulsi_extended_i1
-  // CHECK-NEXT:  0
-  // CHECK-NEXT:  0
-  func.call @mulsi_extended_i1(%false, %false) : (i1, i1) -> ()
-
-  // ------------------------------------------------
-  // Test i8
-  // ------------------------------------------------
-  // mulsi extended versions, with overflow
-  %c_100_i8 = arith.constant -100 : i8
-
-  // mulsi_extended -100, -100 : i8 = (16, 39)
-  // CHECK-LABEL: @mulsi_extended_i8
-  // CHECK-NEXT:  16
-  // CHECK-NEXT:  39
-  func.call @mulsi_extended_i8(%c_100_i8, %c_100_i8) : (i8, i8) -> ()
-
-  // ------------------------------------------------
-  // TODO: Test i16, i32 etc.. 
-  // ------------------------------------------------
-  return
-}
-
-func.func @mului_extended_i8(%v1 : i8, %v2 : i8) {
-  vector.print str "@mului_extended_i8\n"
-  %low, %high = arith.mului_extended %v1, %v2 : i8
-  vector.print %low : i8
-  vector.print %high : i8
-  return
-}
-
-func.func @mului_extended() {
-  // ------------------------------------------------
-  // Test i8
-  // ------------------------------------------------
-  %c_n100_i8 = arith.constant -100 : i8
-  %c_156_i8 = arith.constant 156 : i8
-
-  // mului_extended -100, -100 : i8 = (16, 95)
-  // and on equivalent representations (e.g. 156 === -100 (mod 256))
-
-  // CHECK-LABEL: @mului_extended_i8
-  // CHECK-NEXT:  16
-  // CHECK-NEXT:  95
-  func.call @mului_extended_i8(%c_n100_i8, %c_n100_i8) : (i8, i8) -> ()
-
-  // CHECK-LABEL: @mului_extended_i8
-  // CHECK-NEXT:  16
-  // CHECK-NEXT:  95
-  func.call @mului_extended_i8(%c_n100_i8, %c_156_i8) : (i8, i8) -> ()
-
-  // CHECK-LABEL: @mului_extended_i8
-  // CHECK-NEXT:  16
-  // CHECK-NEXT:  95
-  func.call @mului_extended_i8(%c_156_i8, %c_n100_i8) : (i8, i8) -> ()
-
-  // CHECK-LABEL: @mului_extended_i8
-  // CHECK-NEXT:  16
-  // CHECK-NEXT:  95
-  func.call @mului_extended_i8(%c_156_i8, %c_156_i8) : (i8, i8) -> ()
-
-  // ------------------------------------------------
-  // TODO: Test i1, i16, i32 etc.. 
-  // ------------------------------------------------
-  return
-}
-
-func.func @entry() {
-  func.call @mulsi_extended() : () -> ()
-  func.call @mului_extended() : () -> ()
-  return
-}

@banach-space
Copy link
Contributor Author

CC @pingshiyu

@banach-space
Copy link
Contributor Author

@joker-eph , shall I go ahead with this?

@banach-space banach-space merged commit 37ad65f into llvm:main Oct 16, 2024
11 checks passed
@banach-space banach-space deleted the andrzej/remove_arith_e2e_1 branch November 8, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants