[PATCH] D79644: [mlir][StandardToSPIRV] Add support for lowering index_cast to SPIR-V.
Han-Chung Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 8 12:20:25 PDT 2020
hanchung created this revision.
hanchung added reviewers: antiagainst, denis13, mravishankar.
Herald added subscribers: llvm-commits, Kayjukh, frgossen, grosul1, bader, Joonsoo, stephenneuendorffer, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, shauheen, jpienaar, rriddle, mehdi_amini, arphaman.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D79644
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
@@ -461,6 +461,20 @@
max_compute_workgroup_size = dense<[128, 128, 64]> : vector<3xi32>}>
} {
+// CHECK-LABEL: index_cast1
+func @index_cast1(%arg0: i16) {
+ // CHECK: spv.UConvert %{{.+}} : i16 to i32
+ %0 = index_cast %arg0 : i16 to index
+ return
+}
+
+// CHECK-LABEL: index_cast2
+func @index_cast2(%arg0: index) {
+ // CHECK: spv.UConvert %{{.+}} : i32 to i16
+ %0 = index_cast %arg0 : index to i16
+ return
+}
+
// CHECK-LABEL: @fpext1
func @fpext1(%arg0: f16) -> f64 {
// CHECK: spv.FConvert %{{.*}} : f16 to f64
Index: mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp
===================================================================
--- mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp
+++ mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp
@@ -770,6 +770,7 @@
BoolCmpIOpPattern, ConstantCompositeOpPattern, ConstantScalarOpPattern,
CmpFOpPattern, CmpIOpPattern, IntLoadOpPattern, LoadOpPattern,
ReturnOpPattern, SelectOpPattern, StoreOpPattern,
+ TypeCastingOpPattern<IndexCastOp, spirv::UConvertOp>,
TypeCastingOpPattern<SIToFPOp, spirv::ConvertSToFOp>,
TypeCastingOpPattern<ZeroExtendIOp, spirv::UConvertOp>,
TypeCastingOpPattern<TruncateIOp, spirv::SConvertOp>,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79644.262926.patch
Type: text/x-patch
Size: 1544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200508/319296db/attachment.bin>
More information about the llvm-commits
mailing list