diff --git a/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp b/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp --- a/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp +++ b/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp @@ -770,6 +770,7 @@ BoolCmpIOpPattern, ConstantCompositeOpPattern, ConstantScalarOpPattern, CmpFOpPattern, CmpIOpPattern, IntLoadOpPattern, LoadOpPattern, ReturnOpPattern, SelectOpPattern, StoreOpPattern, + TypeCastingOpPattern, TypeCastingOpPattern, TypeCastingOpPattern, TypeCastingOpPattern, diff --git a/mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir b/mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir --- a/mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir +++ b/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