These ops have the same operands and result shapes.
Differential Revision: https://reviews.llvm.org/D81664
// Base class for standard cast operations. Requires single operand and result,
// but does not constrain them to specific types.
class CastOp<string mnemonic, list<OpTrait> traits = []> :
- Std_Op<mnemonic, !listconcat(traits, [NoSideEffect])> {
+ Std_Op<mnemonic,
+ !listconcat(traits, [NoSideEffect, SameOperandsAndResultShape])> {
let results = (outs AnyType);
// CHECK-LABEL: test_index_cast_shape_error
func @test_index_cast_shape_error(%arg0 : tensor<index>) -> tensor<2xi64> {
- // expected-error @+1 {{operand type 'tensor<index>' and result type 'tensor<2xi64>' are cast incompatible}}
+ // expected-error @+1 {{requires the same shape for all operands and results}}
%0 = index_cast %arg0 : tensor<index> to tensor<2xi64>
return %0 : tensor<2xi64>
}
// CHECK-LABEL: test_index_cast_tensor_error
func @test_index_cast_tensor_error(%arg0 : tensor<index>) -> i64 {
- // expected-error @+1 {{operand type 'tensor<index>' and result type 'i64' are cast incompatible}}
+ // expected-error @+1 {{requires the same shape for all operands and results}}
%0 = index_cast %arg0 : tensor<index> to i64
return %0 : i64
}
// -----
func @fpext_vec(%arg0 : vector<2xf16>) {
- // expected-error@+1 {{are cast incompatible}}
+ // expected-error@+1 {{requires the same shape for all operands and results}}
%0 = fpext %arg0 : vector<2xf16> to vector<3xf32>
return
}
// -----
func @fptrunc_vec(%arg0 : vector<2xf16>) {
- // expected-error@+1 {{are cast incompatible}}
+ // expected-error@+1 {{requires the same shape for all operands and results}}
%0 = fptrunc %arg0 : vector<2xf16> to vector<3xf32>
return
}