[Mlir-commits] [mlir] 2f5715d - [mlir][NFC] Rename the old Standard dialect test directory to Func

River Riddle llvmlistbot at llvm.org
Tue Mar 1 13:50:26 PST 2022


Author: River Riddle
Date: 2022-03-01T13:48:34-08:00
New Revision: 2f5715dc78328215d51d5664c72c632a6dac1046

URL: https://github.com/llvm/llvm-project/commit/2f5715dc78328215d51d5664c72c632a6dac1046
DIFF: https://github.com/llvm/llvm-project/commit/2f5715dc78328215d51d5664c72c632a6dac1046.diff

LOG: [mlir][NFC] Rename the old Standard dialect test directory to Func

The remanants of Standard was renamed to Func, but the test directory
remained named as Standard. In adidition to fixing the name, this commit
also moves the tests for operations not in the Func dialect to the proper
parent dialect test directory.

Added: 
    mlir/test/Dialect/Func/func-bufferize.mlir
    mlir/test/Dialect/Func/invalid.mlir
    mlir/test/Dialect/Math/expand-tanh.mlir

Modified: 
    mlir/test/Dialect/Arithmetic/canonicalize.mlir

Removed: 
    mlir/test/Dialect/Standard/canonicalize.mlir
    mlir/test/Dialect/Standard/expand-tanh.mlir
    mlir/test/Dialect/Standard/func-bufferize.mlir
    mlir/test/Dialect/Standard/invalid.mlir


################################################################################
diff  --git a/mlir/test/Dialect/Arithmetic/canonicalize.mlir b/mlir/test/Dialect/Arithmetic/canonicalize.mlir
index 4bdefac2ac5f5..4d1a415b82a5c 100644
--- a/mlir/test/Dialect/Arithmetic/canonicalize.mlir
+++ b/mlir/test/Dialect/Arithmetic/canonicalize.mlir
@@ -1,5 +1,82 @@
 // RUN: mlir-opt %s -canonicalize --split-input-file | FileCheck %s
 
+// CHECK-LABEL: @select_same_val
+//       CHECK:   return %arg1
+func @select_same_val(%arg0: i1, %arg1: i64) -> i64 {
+  %0 = arith.select %arg0, %arg1, %arg1 : i64
+  return %0 : i64
+}
+
+// CHECK-LABEL: @select_cmp_eq_select
+//       CHECK:   return %arg1
+func @select_cmp_eq_select(%arg0: i64, %arg1: i64) -> i64 {
+  %0 = arith.cmpi eq, %arg0, %arg1 : i64
+  %1 = arith.select %0, %arg0, %arg1 : i64
+  return %1 : i64
+}
+
+// CHECK-LABEL: @select_cmp_ne_select
+//       CHECK:   return %arg0
+func @select_cmp_ne_select(%arg0: i64, %arg1: i64) -> i64 {
+  %0 = arith.cmpi ne, %arg0, %arg1 : i64
+  %1 = arith.select %0, %arg0, %arg1 : i64
+  return %1 : i64
+}
+
+// CHECK-LABEL: @select_extui
+//       CHECK:   %[[res:.+]] = arith.extui %arg0 : i1 to i64
+//       CHECK:   return %[[res]]
+func @select_extui(%arg0: i1) -> i64 {
+  %c0_i64 = arith.constant 0 : i64
+  %c1_i64 = arith.constant 1 : i64
+  %res = arith.select %arg0, %c1_i64, %c0_i64 : i64
+  return %res : i64
+}
+
+// CHECK-LABEL: @select_extui2
+// CHECK-DAG:  %true = arith.constant true
+// CHECK-DAG:  %[[xor:.+]] = arith.xori %arg0, %true : i1
+// CHECK-DAG:  %[[res:.+]] = arith.extui %[[xor]] : i1 to i64
+//       CHECK:   return %[[res]]
+func @select_extui2(%arg0: i1) -> i64 {
+  %c0_i64 = arith.constant 0 : i64
+  %c1_i64 = arith.constant 1 : i64
+  %res = arith.select %arg0, %c0_i64, %c1_i64 : i64
+  return %res : i64
+}
+
+// CHECK-LABEL: @select_extui_i1
+//  CHECK-NEXT:   return %arg0
+func @select_extui_i1(%arg0: i1) -> i1 {
+  %c0_i1 = arith.constant false
+  %c1_i1 = arith.constant true
+  %res = arith.select %arg0, %c1_i1, %c0_i1 : i1
+  return %res : i1
+}
+
+// CHECK-LABEL: @selToNot
+//       CHECK:       %[[trueval:.+]] = arith.constant true
+//       CHECK:       %[[res:.+]] = arith.xori %arg0, %[[trueval]] : i1
+//       CHECK:   return %[[res]]
+func @selToNot(%arg0: i1) -> i1 {
+  %true = arith.constant true
+  %false = arith.constant false
+  %res = arith.select %arg0, %false, %true : i1
+  return %res : i1
+}
+
+// CHECK-LABEL: @selToArith
+//       CHECK-NEXT:       %[[trueval:.+]] = arith.constant true
+//       CHECK-NEXT:       %[[notcmp:.+]] = arith.xori %arg0, %[[trueval]] : i1
+//       CHECK-NEXT:       %[[condtrue:.+]] = arith.andi %arg0, %arg1 : i1
+//       CHECK-NEXT:       %[[condfalse:.+]] = arith.andi %[[notcmp]], %arg2 : i1
+//       CHECK-NEXT:       %[[res:.+]] = arith.ori %[[condtrue]], %[[condfalse]] : i1
+//       CHECK:   return %[[res]]
+func @selToArith(%arg0: i1, %arg1 : i1, %arg2 : i1) -> i1 {
+  %res = arith.select %arg0, %arg1, %arg2 : i1
+  return %res : i1
+}
+
 // Test case: Folding of comparisons with equal operands.
 // CHECK-LABEL: @cmpi_equal_operands
 //   CHECK-DAG:   %[[T:.*]] = arith.constant true

diff  --git a/mlir/test/Dialect/Standard/func-bufferize.mlir b/mlir/test/Dialect/Func/func-bufferize.mlir
similarity index 100%
rename from mlir/test/Dialect/Standard/func-bufferize.mlir
rename to mlir/test/Dialect/Func/func-bufferize.mlir

diff  --git a/mlir/test/Dialect/Standard/invalid.mlir b/mlir/test/Dialect/Func/invalid.mlir
similarity index 78%
rename from mlir/test/Dialect/Standard/invalid.mlir
rename to mlir/test/Dialect/Func/invalid.mlir
index e9359936a1962..ce64b5f90950a 100644
--- a/mlir/test/Dialect/Standard/invalid.mlir
+++ b/mlir/test/Dialect/Func/invalid.mlir
@@ -8,11 +8,7 @@ func @unsupported_attribute() {
 
 // -----
 
-func @return_i32_f32() -> (i32, f32) {
-  %0 = arith.constant 1 : i32
-  %1 = arith.constant 1. : f32
-  return %0, %1 : i32, f32
-}
+func @return_i32_f32() -> (i32, f32)
 
 func @call() {
   // expected-error @+3 {{op result type mismatch at index 0}}

diff  --git a/mlir/test/Dialect/Standard/expand-tanh.mlir b/mlir/test/Dialect/Math/expand-tanh.mlir
similarity index 100%
rename from mlir/test/Dialect/Standard/expand-tanh.mlir
rename to mlir/test/Dialect/Math/expand-tanh.mlir

diff  --git a/mlir/test/Dialect/Standard/canonicalize.mlir b/mlir/test/Dialect/Standard/canonicalize.mlir
deleted file mode 100644
index 2c3f977b4cf7f..0000000000000
--- a/mlir/test/Dialect/Standard/canonicalize.mlir
+++ /dev/null
@@ -1,88 +0,0 @@
-// RUN: mlir-opt %s -canonicalize --split-input-file | FileCheck %s
-
-// CHECK-LABEL: @select_same_val
-//       CHECK:   return %arg1
-func @select_same_val(%arg0: i1, %arg1: i64) -> i64 {
-  %0 = arith.select %arg0, %arg1, %arg1 : i64
-  return %0 : i64
-}
-
-// -----
-
-// CHECK-LABEL: @select_cmp_eq_select
-//       CHECK:   return %arg1
-func @select_cmp_eq_select(%arg0: i64, %arg1: i64) -> i64 {
-  %0 = arith.cmpi eq, %arg0, %arg1 : i64
-  %1 = arith.select %0, %arg0, %arg1 : i64
-  return %1 : i64
-}
-
-// -----
-
-// CHECK-LABEL: @select_cmp_ne_select
-//       CHECK:   return %arg0
-func @select_cmp_ne_select(%arg0: i64, %arg1: i64) -> i64 {
-  %0 = arith.cmpi ne, %arg0, %arg1 : i64
-  %1 = arith.select %0, %arg0, %arg1 : i64
-  return %1 : i64
-}
-
-// -----
-
-// CHECK-LABEL: @select_extui
-//       CHECK:   %[[res:.+]] = arith.extui %arg0 : i1 to i64
-//       CHECK:   return %[[res]]
-func @select_extui(%arg0: i1) -> i64 {
-  %c0_i64 = arith.constant 0 : i64
-  %c1_i64 = arith.constant 1 : i64
-  %res = arith.select %arg0, %c1_i64, %c0_i64 : i64
-  return %res : i64
-}
-
-// CHECK-LABEL: @select_extui2
-// CHECK-DAG:  %true = arith.constant true
-// CHECK-DAG:  %[[xor:.+]] = arith.xori %arg0, %true : i1
-// CHECK-DAG:  %[[res:.+]] = arith.extui %[[xor]] : i1 to i64
-//       CHECK:   return %[[res]]
-func @select_extui2(%arg0: i1) -> i64 {
-  %c0_i64 = arith.constant 0 : i64
-  %c1_i64 = arith.constant 1 : i64
-  %res = arith.select %arg0, %c0_i64, %c1_i64 : i64
-  return %res : i64
-}
-
-// -----
-
-// CHECK-LABEL: @select_extui_i1
-//  CHECK-NEXT:   return %arg0
-func @select_extui_i1(%arg0: i1) -> i1 {
-  %c0_i1 = arith.constant false
-  %c1_i1 = arith.constant true
-  %res = arith.select %arg0, %c1_i1, %c0_i1 : i1
-  return %res : i1
-}
-
-// -----
-
-// CHECK-LABEL: @selToNot
-//       CHECK:       %[[trueval:.+]] = arith.constant true
-//       CHECK:       %[[res:.+]] = arith.xori %arg0, %[[trueval]] : i1
-//       CHECK:   return %[[res]]
-func @selToNot(%arg0: i1) -> i1 {
-  %true = arith.constant true
-  %false = arith.constant false
-  %res = arith.select %arg0, %false, %true : i1
-  return %res : i1
-}
-
-// CHECK-LABEL: @selToArith
-//       CHECK-NEXT:       %[[trueval:.+]] = arith.constant true
-//       CHECK-NEXT:       %[[notcmp:.+]] = arith.xori %arg0, %[[trueval]] : i1
-//       CHECK-NEXT:       %[[condtrue:.+]] = arith.andi %arg0, %arg1 : i1
-//       CHECK-NEXT:       %[[condfalse:.+]] = arith.andi %[[notcmp]], %arg2 : i1
-//       CHECK-NEXT:       %[[res:.+]] = arith.ori %[[condtrue]], %[[condfalse]] : i1
-//       CHECK:   return %[[res]]
-func @selToArith(%arg0: i1, %arg1 : i1, %arg2 : i1) -> i1 {
-  %res = arith.select %arg0, %arg1, %arg2 : i1
-  return %res : i1
-}


        


More information about the Mlir-commits mailing list