[mlir][spirv] Lower sexti -> SConvert

This commit is contained in:
Benjamin Kramer 2021-02-12 15:04:12 +01:00
parent fea06efe7c
commit 530d6ea97b
2 changed files with 15 additions and 0 deletions

View File

@ -1182,6 +1182,7 @@ void populateStandardToSPIRVPatterns(MLIRContext *context,
TypeCastingOpPattern<IndexCastOp, spirv::SConvertOp>, TypeCastingOpPattern<IndexCastOp, spirv::SConvertOp>,
TypeCastingOpPattern<SIToFPOp, spirv::ConvertSToFOp>, TypeCastingOpPattern<SIToFPOp, spirv::ConvertSToFOp>,
TypeCastingOpPattern<UIToFPOp, spirv::ConvertUToFOp>, TypeCastingOpPattern<UIToFPOp, spirv::ConvertUToFOp>,
TypeCastingOpPattern<SignExtendIOp, spirv::SConvertOp>,
TypeCastingOpPattern<ZeroExtendIOp, spirv::UConvertOp>, TypeCastingOpPattern<ZeroExtendIOp, spirv::UConvertOp>,
TypeCastingOpPattern<TruncateIOp, spirv::SConvertOp>, TypeCastingOpPattern<TruncateIOp, spirv::SConvertOp>,
TypeCastingOpPattern<FPToSIOp, spirv::ConvertFToSOp>, TypeCastingOpPattern<FPToSIOp, spirv::ConvertFToSOp>,

View File

@ -675,6 +675,20 @@ spv.func @uitofp_vec_i1_f64(%arg0: vector<4xi1>) -> vector<4xf64> "None" {
spv.ReturnValue %2 : vector<4xf64> spv.ReturnValue %2 : vector<4xf64>
} }
// CHECK-LABEL: @sexti1
func @sexti1(%arg0: i16) -> i64 {
// CHECK: spv.SConvert %{{.*}} : i16 to i64
%0 = std.sexti %arg0 : i16 to i64
return %0 : i64
}
// CHECK-LABEL: @sexti2
func @sexti2(%arg0 : i32) -> i64 {
// CHECK: spv.SConvert %{{.*}} : i32 to i64
%0 = std.sexti %arg0 : i32 to i64
return %0 : i64
}
// CHECK-LABEL: @zexti1 // CHECK-LABEL: @zexti1
func @zexti1(%arg0: i16) -> i64 { func @zexti1(%arg0: i16) -> i64 {
// CHECK: spv.UConvert %{{.*}} : i16 to i64 // CHECK: spv.UConvert %{{.*}} : i16 to i64