135 lines · plain
1// RUN: mlir-opt %s -split-input-file -verify-diagnostics2 3// -----4 5func.func @arm_sve_convert_from_svbool__bad_mask_type(%bool: vector<2x[16]xi1>) -> vector<2x[8]xi2> {6 // expected-error@+1 {{'result' must be trailing scalable vector of 1-bit signless integer values with dim -1 having a size of {16, 8, 4, 2, 1}, but got 'vector<2x[8]xi2>'}}7 %mask = arm_sve.convert_from_svbool %bool : vector<2x[8]xi2>8 return %mask : vector<2x[8]xi2>9}10 11// -----12 13func.func @arm_sve_convert_from_svbool__bad_mask_shape(%bool : vector<[16]xi1>) -> vector<[7]xi1> {14 // expected-error@+1 {{'result' must be trailing scalable vector of 1-bit signless integer values with dim -1 having a size of {16, 8, 4, 2, 1}, but got 'vector<[7]xi1>'}}15 %mask = arm_sve.convert_from_svbool %bool : vector<[7]xi1>16 return %mask : vector<[7]xi1>17}18 19// -----20 21func.func @arm_sve_convert_from_svbool__bad_mask_scalability(%bool : vector<[4]x[16]xi1>) -> vector<[4]x[8]xi1> {22 // expected-error@+1 {{'result' must be trailing scalable vector of 1-bit signless integer values with dim -1 having a size of {16, 8, 4, 2, 1}, but got 'vector<[4]x[8]xi1>'}}23 %mask = arm_sve.convert_from_svbool %bool : vector<[4]x[8]xi1>24 return %mask : vector<[4]x[8]xi1>25}26 27// -----28 29func.func @arm_sve_convert_to_svbool__bad_mask_type(%mask: vector<2x[8]xi2>) -> vector<2x[16]xi1> {30 // expected-error@+1 {{'source' must be trailing scalable vector of 1-bit signless integer values with dim -1 having a size of {16, 8, 4, 2, 1}, but got 'vector<2x[8]xi2>'}}31 %bool = arm_sve.convert_to_svbool %mask : vector<2x[8]xi2>32 return %bool : vector<2x[16]xi1>33}34 35// -----36 37func.func @arm_sve_convert_to_svbool__bad_mask_shape(%mask : vector<[7]xi1>) -> vector<[16]xi1> {38 // expected-error@+1 {{'source' must be trailing scalable vector of 1-bit signless integer values with dim -1 having a size of {16, 8, 4, 2, 1}, but got 'vector<[7]xi1>'}}39 %bool = arm_sve.convert_to_svbool %mask : vector<[7]xi1>40 return41}42 43// -----44 45func.func @arm_sve_convert_to_svbool__bad_mask_scalability(%mask : vector<[4]x[8]xi1>) -> vector<[4]x[16]xi1> {46 // expected-error@+1 {{'source' must be trailing scalable vector of 1-bit signless integer values with dim -1 having a size of {16, 8, 4, 2, 1}, but got 'vector<[4]x[8]xi1>'}}47 %bool = arm_sve.convert_to_svbool %mask : vector<[4]x[8]xi1>48 return49}50 51 52// -----53 54func.func @arm_sve_zip_x2_bad_vector_type(%a : vector<[7]xi8>) {55 // expected-error@+1 {{op operand #0 must be an SVE vector with element size <= 64-bit, but got 'vector<[7]xi8>'}}56 arm_sve.zip.x2 %a, %a : vector<[7]xi8>57 return58}59 60// -----61 62func.func @arm_sve_zip_x4_bad_vector_type(%a : vector<[5]xf64>) {63 // expected-error@+1 {{op operand #0 must be an SVE vector with element size <= 64-bit, but got 'vector<[5]xf64>'}}64 arm_sve.zip.x4 %a, %a, %a, %a : vector<[5]xf64>65 return66}67 68// -----69 70func.func @arm_sve_psel_bad_vector_type(%a : vector<[7]xi1>, %index: index) {71 // expected-error@+1 {{op operand #0 must be vector<[1]xi1>, vector<[2]xi1>, vector<[4]xi1>, vector<[8]xi1>, or vector<[16]xi1>, but got 'vector<[7]xi1>'}}72 arm_sve.psel %a, %a[%index] : vector<[7]xi1>, vector<[7]xi1>73 return74}75 76// -----77 78func.func @bfmmla_invalid_element_type_lhs_rhs(%acc: vector<[4]xf32>,79 %lhs: vector<[8]xf16>,80 %rhs: vector<[8]xf16>) -> vector<[4]xf32> {81 // expected-error@+1 {{operand #1 must be scalable vector of bfloat16 type values of length 8, but got 'vector<[8]xf16>'}}82 %0 = arm_sve.intr.bfmmla %acc, %lhs, %rhs : vector<[8]xf16> to vector<[4]xf32>83 return %0 : vector<[4]xf32>84}85 86// -----87 88func.func @bfmmla_invalid_dimension_lhs_rhs(%acc: vector<[4]xf32>,89 %lhs: vector<[4]xbf16>,90 %rhs: vector<[4]xbf16>) -> vector<[4]xf32> {91 // expected-error@+1 {{operand #1 must be scalable vector of bfloat16 type values of length 8, but got 'vector<[4]xbf16>}}92 %0 = arm_sve.intr.bfmmla %acc, %lhs, %rhs : vector<[4]xbf16> to vector<[4]xf32>93 return %0 : vector<[4]xf32>94}95 96// -----97 98func.func @bfmmla_fixed_dimension_lhs_rhs(%acc: vector<[4]xf32>,99 %lhs: vector<8xbf16>,100 %rhs: vector<8xbf16>) -> vector<[4]xf32> {101 // expected-error@+1 {{operand #1 must be scalable vector of bfloat16 type values of length 8, but got 'vector<8xbf16>}}102 %0 = arm_sve.intr.bfmmla %acc, %lhs, %rhs : vector<8xbf16> to vector<[4]xf32>103 return %0 : vector<[4]xf32>104}105 106// -----107 108func.func @bfmmla_invalid_element_type_acc(%acc: vector<[4]xi32>,109 %lhs: vector<[8]xbf16>,110 %rhs: vector<[8]xbf16>) -> vector<[4]xi32> {111 // expected-error@+1 {{operand #0 must be scalable vector of 32-bit float values of length 4, but got 'vector<[4]xi32>'}}112 %0 = arm_sve.intr.bfmmla %acc, %lhs, %rhs : vector<[8]xbf16> to vector<[4]xi32>113 return %0 : vector<[4]xi32>114}115 116// -----117 118func.func @bfmmla_invalid_dimension_acc(%acc: vector<[8]xf32>,119 %lhs: vector<[8]xbf16>,120 %rhs: vector<[8]xbf16>) -> vector<[8]xf32> {121 // expected-error@+1 {{operand #0 must be scalable vector of 32-bit float values of length 4, but got 'vector<[8]xf32>'}}122 %0 = arm_sve.intr.bfmmla %acc, %lhs, %rhs : vector<[8]xbf16> to vector<[8]xf32>123 return %0 : vector<[8]xf32>124}125 126// -----127 128func.func @bfmmla_fixed_dimension_acc(%acc: vector<4xf32>,129 %lhs: vector<[8]xbf16>,130 %rhs: vector<[8]xbf16>) -> vector<4xf32> {131 // expected-error@+1 {{operand #0 must be scalable vector of 32-bit float values of length 4, but got 'vector<4xf32>'}}132 %0 = arm_sve.intr.bfmmla %acc, %lhs, %rhs : vector<[8]xbf16> to vector<4xf32>133 return %0 : vector<4xf32>134}135