[PATCH] D79143: [mlir][StandardToSPIRV] Add support for lowering integer casting.
Han-Chung Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 30 19:33:38 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbe0ad5b034b2: [mlir][StandardToSPIRV] Add support for lowering integer casting. (authored by hanchung).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79143/new/
https://reviews.llvm.org/D79143
Files:
mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp
mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir
Index: mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir
===================================================================
--- mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir
+++ mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir
@@ -501,6 +501,34 @@
return %0 : f64
}
+// CHECK-LABEL: @zexti1
+func @zexti1(%arg0: i16) -> i64 {
+ // CHECK: spv.UConvert %{{.*}} : i16 to i64
+ %0 = std.zexti %arg0 : i16 to i64
+ return %0 : i64
+}
+
+// CHECK-LABEL: @zexti2
+func @zexti2(%arg0 : i32) -> i64 {
+ // CHECK: spv.UConvert %{{.*}} : i32 to i64
+ %0 = std.zexti %arg0 : i32 to i64
+ return %0 : i64
+}
+
+// CHECK-LABEL: @trunci1
+func @trunci1(%arg0 : i64) -> i16 {
+ // CHECK: spv.SConvert %{{.*}} : i64 to i16
+ %0 = std.trunci %arg0 : i64 to i16
+ return %0 : i16
+}
+
+// CHECK-LABEL: @trunci2
+func @trunci2(%arg0: i32) -> i16 {
+ // CHECK: spv.SConvert %{{.*}} : i32 to i16
+ %0 = std.trunci %arg0 : i32 to i16
+ return %0 : i16
+}
+
} // end module
// -----
Index: mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp
===================================================================
--- mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp
+++ mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp
@@ -770,6 +770,8 @@
CmpFOpPattern, CmpIOpPattern, IntLoadOpPattern, LoadOpPattern,
ReturnOpPattern, SelectOpPattern, StoreOpPattern,
TypeCastingOpPattern<SIToFPOp, spirv::ConvertSToFOp>,
+ TypeCastingOpPattern<ZeroExtendIOp, spirv::UConvertOp>,
+ TypeCastingOpPattern<TruncateIOp, spirv::SConvertOp>,
TypeCastingOpPattern<FPExtOp, spirv::FConvertOp>,
TypeCastingOpPattern<FPTruncOp, spirv::FConvertOp>, XOrOpPattern>(
context, typeConverter);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79143.261422.patch
Type: text/x-patch
Size: 1781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200501/89168442/attachment.bin>
More information about the llvm-commits
mailing list