[Mlir-commits] [mlir] d38c9e6 - [MLIR][Arith] Add Canonicalize test for trunci

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Dec 6 18:07:25 PST 2022


Author: liqinweng
Date: 2022-12-07T10:06:21+08:00
New Revision: d38c9e68b6a39b6040eb85e24cc4e0bc2983551b

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

LOG: [MLIR][Arith] Add Canonicalize test for trunci

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D139399

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/test/Dialect/Arith/canonicalize.mlir b/mlir/test/Dialect/Arith/canonicalize.mlir
index 0ab4931d35a75..d2439a246252c 100644
--- a/mlir/test/Dialect/Arith/canonicalize.mlir
+++ b/mlir/test/Dialect/Arith/canonicalize.mlir
@@ -420,6 +420,24 @@ func.func @truncConstant(%arg0: i8) -> i16 {
   return %tr : i16
 }
 
+// CHECK-LABEL: @truncExtui
+//       CHECK-NOT:  trunci
+//       CHECK:   return  %arg0
+func.func @truncExtui(%arg0: i32) -> i32 {
+  %extui = arith.extui %arg0 : i32 to i64
+  %trunci = arith.trunci %extui : i64 to i32
+  return %trunci : i32
+}
+
+// CHECK-LABEL: @truncExtsi
+//       CHECK-NOT:  trunci
+//       CHECK:   return  %arg0
+func.func @truncExtsi(%arg0: i32) -> i32 {
+  %extsi = arith.extsi %arg0 : i32 to i64
+  %trunci = arith.trunci %extsi : i64 to i32
+  return %trunci : i32
+}
+
 // CHECK-LABEL: @truncConstantSplat
 //       CHECK:   %[[cres:.+]] = arith.constant dense<-2> : vector<4xi8>
 //       CHECK:   return %[[cres]]


        


More information about the Mlir-commits mailing list