brintos

brintos / llvm-project-archived public Read only

0
0
Text · 24.2 KiB · 7bd6837 Raw
872 lines · plain
1// RUN: mlir-opt -split-input-file %s -verify-diagnostics2 3func.func @test_index_cast_shape_error(%arg0 : tensor<index>) -> tensor<2xi64> {4  // expected-error @+1 {{'arith.index_cast' op failed to verify that input and output have the same tensor dimensions}}5  %0 = arith.index_cast %arg0 : tensor<index> to tensor<2xi64>6  return %0 : tensor<2xi64>7}8 9// -----10 11func.func @test_index_cast_shape_dim_error(%arg0 : tensor<2xindex>) -> tensor<?xi64> {12  // expected-error @+1 {{'arith.index_cast' op failed to verify that input and output have the same tensor dimensions}}13  %0 = arith.index_cast %arg0 : tensor<2xindex> to tensor<?xi64>14  return %0 : tensor<?xi64>15}16 17// -----18 19func.func @test_index_cast_tensor_error(%arg0 : tensor<index>) -> i64 {20  // expected-error @+1 {{'arith.index_cast' op requires the same shape for all operands and results}}21  %0 = arith.index_cast %arg0 : tensor<index> to i6422  return %0 : i6423}24 25// -----26 27func.func @non_signless_constant() {28  // expected-error @+1 {{'arith.constant' op integer return type must be signless}}29  %0 = arith.constant 0 : ui3230  return31}32 33// -----34 35func.func @complex_constant_wrong_attribute_type() {36  // expected-error @+1 {{'arith.constant' op failed to verify that all of {value, result} have same type}}37  %0 = "arith.constant" () {value = 1.0 : f32} : () -> complex<f32>38  return39}40 41// -----42 43func.func @non_signless_constant() {44  // expected-error @+1 {{'arith.constant' op integer return type must be signless}}45  %0 = arith.constant 0 : si3246  return47}48 49// -----50 51func.func @bitcast_different_bit_widths(%arg : f16) -> f32 {52  // expected-error@+1 {{are cast incompatible}}53  %res = arith.bitcast %arg : f16 to f3254  return %res : f3255}56 57// -----58 59func.func @constant() {60^bb:61  %x = "arith.constant"(){value = "xyz"} : () -> i32 // expected-error {{'arith.constant' op failed to verify that all of {value, result} have same type}}62  return63}64 65// -----66 67func.func @constant_out_of_range() {68^bb:69  %x = "arith.constant"(){value = 100} : () -> i1 // expected-error {{'arith.constant' op failed to verify that all of {value, result} have same type}}70  return71}72 73// -----74 75func.func @constant_invalid_scalable_1d_vec_initialization() {76^bb0:77  // expected-error@+1 {{'arith.constant' op intializing scalable vectors with elements attribute is not supported unless it's a vector splat}}78  %c = arith.constant dense<[0, 1]> : vector<[2] x i32>79  return80}81 82// -----83 84func.func @constant_invalid_scalable_2d_vec_initialization() {85^bb0:86  // expected-error@+1 {{'arith.constant' op intializing scalable vectors with elements attribute is not supported unless it's a vector splat}}87  %c = arith.constant dense<[[3, 3], [1, 1]]> : vector<2 x [2] x i32>88  return89}90 91// -----92 93func.func @constant_wrong_type() {94^bb:95  %x = "arith.constant"(){value = 10.} : () -> f32 // expected-error {{'arith.constant' op failed to verify that all of {value, result} have same type}}96  return97}98 99// -----100 101func.func @intlimit2() {102^bb:103  %0 = "arith.constant"() {value = 0} : () -> i16777215104  %1 = "arith.constant"() {value = 1} : () -> i16777216 // expected-error {{integer bitwidth is limited to 16777215 bits}}105  return106}107 108// -----109 110func.func @func_with_ops(f32) {111^bb0(%a : f32):112  %sf = arith.addf %a, %a, %a : f32  // expected-error {{expected ':'}}113}114 115// -----116 117func.func @func_with_ops(f32) {118^bb0(%a : f32):119  %sf = arith.addf(%a, %a) : f32  // expected-error {{expected SSA operand}}120}121 122// -----123 124func.func @func_with_ops(f32) {125^bb0(%a : f32):126  %sf = arith.addf{%a, %a} : f32  // expected-error {{expected SSA operand}}127}128 129// -----130 131func.func @func_with_ops(f32) {132^bb0(%a : f32):133  // expected-error@+1 {{'arith.addi' op operand #0 must be signless-integer-like}}134  %sf = arith.addi %a, %a : f32135}136 137// -----138 139func.func @func_with_ops(%a: f32) {140  // expected-error@+1 {{'arith.addui_extended' op operand #0 must be signless-integer-like}}141  %r:2 = arith.addui_extended %a, %a : f32, i32142  return143}144 145// -----146 147func.func @func_with_ops(%a: i32) {148  // expected-error@+1 {{'arith.addui_extended' op result #1 must be bool-like}}149  %r:2 = arith.addui_extended %a, %a : i32, i32150  return151}152 153// -----154 155func.func @func_with_ops(%a: vector<8xi32>) {156  // expected-error@+1 {{'arith.addui_extended' op if an operand is non-scalar, then all results must be non-scalar}}157  %r:2 = arith.addui_extended %a, %a : vector<8xi32>, i1158  return159}160 161// -----162 163func.func @func_with_ops(%a: vector<8xi32>) {164  // expected-error@+1 {{'arith.addui_extended' op all non-scalar operands/results must have the same shape and base type}}165  %r:2 = arith.addui_extended %a, %a : vector<8xi32>, tensor<8xi1>166  return167}168 169// -----170 171func.func @func_with_ops(i32) {172^bb0(%a : i32):173  %sf = arith.addf %a, %a : i32  // expected-error {{'arith.addf' op operand #0 must be floating-point-like}}174}175 176// -----177 178func.func @func_with_ops(i32) {179^bb0(%a : i32):180  // expected-error@+1 {{failed to satisfy constraint: allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}}181  %r = "arith.cmpi"(%a, %a) {predicate = 42} : (i32, i32) -> i1182}183 184// -----185 186// Comparison are defined for arguments of the same type.187func.func @func_with_ops(i32, i64) {188^bb0(%a : i32, %b : i64): // expected-note {{prior use here}}189  %r = arith.cmpi eq, %a, %b : i32 // expected-error {{use of value '%b' expects different type than prior uses}}190}191 192// -----193 194// Comparisons must have the "predicate" attribute.195func.func @func_with_ops(i32, i32) {196^bb0(%a : i32, %b : i32):197  %r = arith.cmpi %a, %b : i32 // expected-error {{expected string or keyword containing one of the following enum values}}198}199 200// -----201 202// Integer comparisons are not recognized for float types.203func.func @func_with_ops(f32, f32) {204^bb0(%a : f32, %b : f32):205  %r = arith.cmpi eq, %a, %b : f32 // expected-error {{'lhs' must be signless-integer-like, but got 'f32'}}206}207 208// -----209 210// Result type must be boolean like.211func.func @func_with_ops(i32, i32) {212^bb0(%a : i32, %b : i32):213  %r = "arith.cmpi"(%a, %b) {predicate = 0} : (i32, i32) -> i32 // expected-error {{op result #0 must be bool-like}}214}215 216// -----217 218func.func @func_with_ops(i32, i32) {219^bb0(%a : i32, %b : i32):220  // expected-error@+1 {{requires attribute 'predicate'}}221  %r = "arith.cmpi"(%a, %b) {foo = 1} : (i32, i32) -> i1222}223 224// -----225 226func.func @func_with_ops() {227^bb0:228  %c = arith.constant dense<0> : vector<42 x i32>229  // expected-error@+1 {{op failed to verify that result type has i1 element type and same shape as operands}}230  %r = "arith.cmpi"(%c, %c) {predicate = 0} : (vector<42 x i32>, vector<42 x i32>) -> vector<41 x i1>231}232 233// -----234 235func.func @func_with_ops() {236^bb0:237  %c = arith.constant dense<0> : tensor<42 x i32, "foo">238  // expected-error@+1 {{op failed to verify that result type has i1 element type and same shape as operands}}239  %r = "arith.cmpi"(%c, %c) {predicate = 0} : (tensor<42 x i32, "foo">, tensor<42 x i32, "foo">) -> tensor<42 x i1, "bar">240}241 242// -----243 244func.func @invalid_cmp_shape(%idx : () -> ()) {245  // expected-error@+1 {{'lhs' must be signless-integer-like, but got '() -> ()'}}246  %cmp = arith.cmpi eq, %idx, %idx : () -> ()247 248// -----249 250func.func @invalid_cmp_attr(%idx : i32) {251  // expected-error@+1 {{expected string or keyword containing one of the following enum values}}252  %cmp = arith.cmpi i1, %idx, %idx : i32253 254// -----255 256func.func @cmpf_generic_invalid_predicate_value(%a : f32) {257  // expected-error@+1 {{attribute 'predicate' failed to satisfy constraint: allowed 64-bit signless integer cases}}258  %r = "arith.cmpf"(%a, %a) {predicate = 42} : (f32, f32) -> i1259}260 261// -----262 263func.func @cmpf_canonical_invalid_predicate_value(%a : f32) {264  // expected-error@+1 {{expected string or keyword containing one of the following enum values}}265  %r = arith.cmpf foo, %a, %a : f32266}267 268// -----269 270func.func @cmpf_canonical_invalid_predicate_value_signed(%a : f32) {271  // expected-error@+1 {{expected string or keyword containing one of the following enum values}}272  %r = arith.cmpf sge, %a, %a : f32273}274 275// -----276 277func.func @cmpf_canonical_invalid_predicate_value_no_order(%a : f32) {278  // expected-error@+1 {{expected string or keyword containing one of the following enum values}}279  %r = arith.cmpf eq, %a, %a : f32280}281 282// -----283 284func.func @cmpf_canonical_no_predicate_attr(%a : f32, %b : f32) {285  %r = arith.cmpf %a, %b : f32 // expected-error {{}}286}287 288// -----289 290func.func @cmpf_generic_no_predicate_attr(%a : f32, %b : f32) {291  // expected-error@+1 {{requires attribute 'predicate'}}292  %r = "arith.cmpf"(%a, %b) {foo = 1} : (f32, f32) -> i1293}294 295// -----296 297func.func @cmpf_wrong_type(%a : i32, %b : i32) {298  %r = arith.cmpf oeq, %a, %b : i32 // expected-error {{must be floating-point-like}}299}300 301// -----302 303func.func @cmpf_generic_wrong_result_type(%a : f32, %b : f32) {304  // expected-error@+1 {{result #0 must be bool-like}}305  %r = "arith.cmpf"(%a, %b) {predicate = 0} : (f32, f32) -> f32306}307 308// -----309 310func.func @cmpf_canonical_wrong_result_type(%a : f32, %b : f32) -> f32 {311  %r = arith.cmpf oeq, %a, %b : f32 // expected-note {{prior use here}}312  // expected-error@+1 {{use of value '%r' expects different type than prior uses}}313  return %r : f32314}315 316// -----317 318func.func @cmpf_result_shape_mismatch(%a : vector<42xf32>) {319  // expected-error@+1 {{op failed to verify that result type has i1 element type and same shape as operands}}320  %r = "arith.cmpf"(%a, %a) {predicate = 0} : (vector<42 x f32>, vector<42 x f32>) -> vector<41 x i1>321}322 323// -----324 325func.func @cmpf_operand_shape_mismatch(%a : vector<42xf32>, %b : vector<41xf32>) {326  // expected-error@+1 {{op requires all operands to have the same type}}327  %r = "arith.cmpf"(%a, %b) {predicate = 0} : (vector<42 x f32>, vector<41 x f32>) -> vector<42 x i1>328}329 330// -----331 332func.func @cmpf_generic_operand_type_mismatch(%a : f32, %b : f64) {333  // expected-error@+1 {{op requires all operands to have the same type}}334  %r = "arith.cmpf"(%a, %b) {predicate = 0} : (f32, f64) -> i1335}336 337// -----338 339func.func @cmpf_canonical_type_mismatch(%a : f32, %b : f64) { // expected-note {{prior use here}}340  // expected-error@+1 {{use of value '%b' expects different type than prior uses}}341  %r = arith.cmpf oeq, %a, %b : f32342}343 344// -----345 346func.func @index_cast_index_to_index(%arg0: index) {347  // expected-error@+1 {{are cast incompatible}}348  %0 = arith.index_cast %arg0: index to index349  return350}351 352// -----353 354func.func @index_cast_float(%arg0: index, %arg1: f32) {355  // expected-error@+1 {{op result #0 must be signless-integer-like or memref of signless-integer, but got 'f32'}}356  %0 = arith.index_cast %arg0 : index to f32357  return358}359 360// -----361 362func.func @index_cast_float_to_index(%arg0: f32) {363  // expected-error@+1 {{op operand #0 must be signless-integer-like or memref of signless-integer, but got 'f32'}}364  %0 = arith.index_cast %arg0 : f32 to index365  return366}367 368// -----369 370func.func @sitofp_i32_to_i64(%arg0 : i32) {371  // expected-error@+1 {{op result #0 must be floating-point-like, but got 'i64'}}372  %0 = arith.sitofp %arg0 : i32 to i64373  return374}375 376// -----377 378func.func @sitofp_f32_to_i32(%arg0 : f32) {379  // expected-error@+1 {{op operand #0 must be signless-fixed-width-integer-like, but got 'f32'}}380  %0 = arith.sitofp %arg0 : f32 to i32381  return382}383 384// -----385 386func.func @fpext_f32_to_f16(%arg0 : f32) {387  // expected-error@+1 {{are cast incompatible}}388  %0 = arith.extf %arg0 : f32 to f16389  return390}391 392// -----393 394func.func @fpext_f16_to_f16(%arg0 : f16) {395  // expected-error@+1 {{are cast incompatible}}396  %0 = arith.extf %arg0 : f16 to f16397  return398}399 400// -----401 402func.func @fpext_i32_to_f32(%arg0 : i32) {403  // expected-error@+1 {{op operand #0 must be floating-point-like, but got 'i32'}}404  %0 = arith.extf %arg0 : i32 to f32405  return406}407 408// -----409 410func.func @fpext_f32_to_i32(%arg0 : f32) {411  // expected-error@+1 {{op result #0 must be floating-point-like, but got 'i32'}}412  %0 = arith.extf %arg0 : f32 to i32413  return414}415 416// -----417 418func.func @fpext_vec(%arg0 : vector<2xf16>) {419  // expected-error@+1 {{op requires the same shape for all operands and results}}420  %0 = arith.extf %arg0 : vector<2xf16> to vector<3xf32>421  return422}423 424// -----425 426func.func @fpext_vec_f32_to_f16(%arg0 : vector<2xf32>) {427  // expected-error@+1 {{are cast incompatible}}428  %0 = arith.extf %arg0 : vector<2xf32> to vector<2xf16>429  return430}431 432// -----433 434func.func @fpext_vec_f16_to_f16(%arg0 : vector<2xf16>) {435  // expected-error@+1 {{are cast incompatible}}436  %0 = arith.extf %arg0 : vector<2xf16> to vector<2xf16>437  return438}439 440// -----441 442func.func @fpext_vec_i32_to_f32(%arg0 : vector<2xi32>) {443  // expected-error@+1 {{op operand #0 must be floating-point-like, but got 'vector<2xi32>'}}444  %0 = arith.extf %arg0 : vector<2xi32> to vector<2xf32>445  return446}447 448// -----449 450func.func @fpext_vec_f32_to_i32(%arg0 : vector<2xf32>) {451  // expected-error@+1 {{op result #0 must be floating-point-like, but got 'vector<2xi32>'}}452  %0 = arith.extf %arg0 : vector<2xf32> to vector<2xi32>453  return454}455 456// -----457 458func.func @fpext_vec_f32_to_i32(%arg0 : tensor<2xf32, "foo">) {459  // expected-error@+1 {{op operand type 'tensor<2xf32, "foo">' and result type 'tensor<2xf64, "bar">' are cast incompatible}}460  %0 = arith.extf %arg0 : tensor<2xf32, "foo"> to tensor<2xf64, "bar">461  return462}463 464// -----465 466func.func @fptrunc_f16_to_f32(%arg0 : f16) {467  // expected-error@+1 {{are cast incompatible}}468  %0 = arith.truncf %arg0 : f16 to f32469  return470}471 472// -----473 474func.func @fptrunc_f32_to_f32(%arg0 : f32) {475  // expected-error@+1 {{are cast incompatible}}476  %0 = arith.truncf %arg0 : f32 to f32477  return478}479 480// -----481 482func.func @fptrunc_i32_to_f32(%arg0 : i32) {483  // expected-error@+1 {{op operand #0 must be floating-point-like, but got 'i32'}}484  %0 = arith.truncf %arg0 : i32 to f32485  return486}487 488// -----489 490func.func @fptrunc_f32_to_i32(%arg0 : f32) {491  // expected-error@+1 {{op result #0 must be floating-point-like, but got 'i32'}}492  %0 = arith.truncf %arg0 : f32 to i32493  return494}495 496// -----497 498func.func @fptrunc_vec(%arg0 : vector<2xf16>) {499  // expected-error@+1 {{op requires the same shape for all operands and results}}500  %0 = arith.truncf %arg0 : vector<2xf16> to vector<3xf32>501  return502}503 504// -----505 506func.func @fptrunc_vec_f16_to_f32(%arg0 : vector<2xf16>) {507  // expected-error@+1 {{are cast incompatible}}508  %0 = arith.truncf %arg0 : vector<2xf16> to vector<2xf32>509  return510}511 512// -----513 514func.func @fptrunc_vec_f32_to_f32(%arg0 : vector<2xf32>) {515  // expected-error@+1 {{are cast incompatible}}516  %0 = arith.truncf %arg0 : vector<2xf32> to vector<2xf32>517  return518}519 520// -----521 522func.func @fptrunc_vec_i32_to_f32(%arg0 : vector<2xi32>) {523  // expected-error@+1 {{op operand #0 must be floating-point-like, but got 'vector<2xi32>'}}524  %0 = arith.truncf %arg0 : vector<2xi32> to vector<2xf32>525  return526}527 528// -----529 530func.func @fptrunc_vec_f32_to_i32(%arg0 : vector<2xf32>) {531  // expected-error@+1 {{op result #0 must be floating-point-like, but got 'vector<2xi32>'}}532  %0 = arith.truncf %arg0 : vector<2xf32> to vector<2xi32>533  return534}535 536// -----537 538func.func @sexti_index_as_operand(%arg0 : index) {539  // expected-error@+1 {{op operand #0 must be signless-fixed-width-integer-like, but got 'index'}}540  %0 = arith.extsi %arg0 : index to i128541  return542}543 544// -----545 546func.func @zexti_index_as_operand(%arg0 : index) {547  // expected-error@+1 {{op operand #0 must be signless-fixed-width-integer-like, but got 'index'}}548  %0 = arith.extui %arg0 : index to i128549  return550}551 552// -----553 554func.func @trunci_index_as_operand(%arg0 : index) {555  // expected-error@+1 {{op operand #0 must be signless-fixed-width-integer-like, but got 'index'}}556  %2 = arith.trunci %arg0 : index to i128557  return558}559 560// -----561 562func.func @sexti_index_as_result(%arg0 : i1) {563  // expected-error@+1 {{op result #0 must be signless-fixed-width-integer-like, but got 'index'}}564  %0 = arith.extsi %arg0 : i1 to index565  return566}567 568// -----569 570func.func @zexti_index_as_operand(%arg0 : i1) {571  // expected-error@+1 {{op result #0 must be signless-fixed-width-integer-like, but got 'index'}}572  %0 = arith.extui %arg0 : i1 to index573  return574}575 576// -----577 578func.func @trunci_index_as_result(%arg0 : i128) {579  // expected-error@+1 {{op result #0 must be signless-fixed-width-integer-like, but got 'index'}}580  %2 = arith.trunci %arg0 : i128 to index581  return582}583 584// -----585 586func.func @sexti_cast_to_narrower(%arg0 : i16) {587  // expected-error@+1 {{are cast incompatible}}588  %0 = arith.extsi %arg0 : i16 to i15589  return590}591 592// -----593 594func.func @zexti_cast_to_narrower(%arg0 : i16) {595  // expected-error@+1 {{are cast incompatible}}596  %0 = arith.extui %arg0 : i16 to i15597  return598}599 600// -----601 602func.func @trunci_cast_to_wider(%arg0 : i16) {603  // expected-error@+1 {{are cast incompatible}}604  %0 = arith.trunci %arg0 : i16 to i17605  return606}607 608// -----609 610func.func @sexti_cast_to_same_width(%arg0 : i16) {611  // expected-error@+1 {{are cast incompatible}}612  %0 = arith.extsi %arg0 : i16 to i16613  return614}615 616// -----617 618func.func @zexti_cast_to_same_width(%arg0 : i16) {619  // expected-error@+1 {{are cast incompatible}}620  %0 = arith.extui %arg0 : i16 to i16621  return622}623 624// -----625 626func.func @trunci_cast_to_same_width(%arg0 : i16) {627  // expected-error@+1 {{are cast incompatible}}628  %0 = arith.trunci %arg0 : i16 to i16629  return630}631 632// -----633 634func.func @trunci_scalable_to_fl(%arg0 : vector<[4]xi32>) {635  // expected-error@+1 {{'arith.trunci' op requires the same shape for all operands and results}}636  %0 = arith.trunci %arg0 : vector<[4]xi32> to vector<4xi8>637  return638}639 640// -----641 642func.func @truncf_scalable_to_fl(%arg0 : vector<[4]xf64>) {643  // expected-error@+1 {{'arith.truncf' op requires the same shape for all operands and results}}644  %0 = arith.truncf %arg0 : vector<[4]xf64> to vector<4xf32>645  return646}647 648// -----649 650func.func @extui_scalable_to_fl(%arg0 : vector<[4]xi32>) {651  // expected-error@+1 {{'arith.extui' op requires the same shape for all operands and results}}652  %0 = arith.extui %arg0 : vector<[4]xi32> to vector<4xi64>653  return654}655 656// -----657 658func.func @extsi_scalable_to_fl(%arg0 : vector<[4]xi32>) {659  // expected-error@+1 {{'arith.extsi' op requires the same shape for all operands and results}}660  %0 = arith.extsi %arg0 : vector<[4]xi32> to vector<4xi64>661  return662}663 664// -----665 666func.func @extsi_tensor_dim(%arg0 : tensor<4xi32>) {667  // expected-error@+1 {{'arith.extsi' op failed to verify that input and output have the same tensor dimensions}}668  %0 = arith.extsi %arg0 : tensor<4xi32> to tensor<?xi64>669  return670}671 672// -----673 674func.func @extf_scalable_to_fl(%arg0 : vector<[4]xf32>) {675  // expected-error@+1 {{'arith.extf' op requires the same shape for all operands and results}}676  %0 = arith.extf %arg0 : vector<[4]xf32> to vector<4xf64>677  return678}679 680// -----681 682func.func @fptoui_scalable_to_fl(%arg0 : vector<[4]xf64>) {683  // expected-error@+1 {{'arith.fptoui' op requires the same shape for all operands and results}}684  %0 = arith.fptoui %arg0 : vector<[4]xf64> to vector<4xi32>685  return686}687 688// -----689 690func.func @fptosi_scalable_to_fl(%arg0 : vector<[4]xf32>) {691  // expected-error@+1 {{'arith.fptosi' op requires the same shape for all operands and results}}692  %0 = arith.fptosi %arg0 : vector<[4]xf32> to vector<4xi32>693  return694}695 696// -----697 698func.func @uitofp_scalable_to_fl(%arg0 : vector<[4]xi32>) {699  // expected-error@+1 {{'arith.uitofp' op requires the same shape for all operands and results}}700  %0 = arith.uitofp %arg0 : vector<[4]xi32> to vector<4xf32>701  return702}703 704// -----705 706func.func @sitofp_scalable_to_fl(%arg0 : vector<[4]xi32>) {707  // expected-error@+1 {{'arith.sitofp' op requires the same shape for all operands and results}}708  %0 = arith.sitofp %arg0 : vector<[4]xi32> to vector<4xf32>709  return710}711 712// -----713 714func.func @bitcast_scalable_to_fl(%arg0 : vector<[4]xf32>) {715  // expected-error@+1 {{'arith.bitcast' op requires the same shape for all operands and results}}716  %0 = arith.bitcast %arg0 : vector<[4]xf32> to vector<4xi32>717  return718}719 720// -----721 722func.func @bitcast_tensor_dim(%arg0 : tensor<4xf32>) {723  // expected-error@+1 {{'arith.bitcast' op failed to verify that input and output have the same tensor dimensions}}724  %0 = arith.bitcast %arg0 : tensor<4xf32> to tensor<?xi32>725  return726}727 728// -----729 730func.func @bitcast_tensor_dim(%arg0 : tensor<?xf32>) {731  // expected-error@+1 {{'arith.bitcast' op failed to verify that input and output have the same tensor dimensions}}732  %0 = arith.bitcast %arg0 : tensor<?xf32> to tensor<4xi32>733  return734}735 736// -----737 738func.func @trunci_fl_to_scalable(%arg0 : vector<4xi32>) {739  // expected-error@+1 {{'arith.trunci' op requires the same shape for all operands and results}}740  %0 = arith.trunci %arg0 : vector<4xi32> to vector<[4]xi8>741  return742}743 744// -----745 746func.func @truncf_fl_to_scalable(%arg0 : vector<4xf64>) {747  // expected-error@+1 {{'arith.truncf' op requires the same shape for all operands and results}}748  %0 = arith.truncf %arg0 : vector<4xf64> to vector<[4]xf32>749  return750}751 752// -----753 754func.func @truncf_tensor_dim(%arg0 : tensor<4xf64>) {755  // expected-error@+1 {{'arith.truncf' op failed to verify that input and output have the same tensor dimensions}}756  %0 = arith.truncf %arg0 : tensor<4xf64> to tensor<?xf32>757  return758}759 760// -----761 762func.func @extui_fl_to_scalable(%arg0 : vector<4xi32>) {763  // expected-error@+1 {{'arith.extui' op requires the same shape for all operands and results}}764  %0 = arith.extui %arg0 : vector<4xi32> to vector<[4]xi64>765  return766}767 768// -----769 770func.func @extsi_fl_to_scalable(%arg0 : vector<4xi32>) {771  // expected-error@+1 {{'arith.extsi' op requires the same shape for all operands and results}}772  %0 = arith.extsi %arg0 : vector<4xi32> to vector<[4]xi64>773  return774}775 776// -----777 778func.func @extf_fl_to_scalable(%arg0 : vector<4xf32>) {779  // expected-error@+1 {{'arith.extf' op requires the same shape for all operands and results}}780  %0 = arith.extf %arg0 : vector<4xf32> to vector<[4]xf64>781  return782}783 784// -----785 786func.func @fptoui_fl_to_scalable(%arg0 : vector<4xf64>) {787  // expected-error@+1 {{'arith.fptoui' op requires the same shape for all operands and results}}788  %0 = arith.fptoui %arg0 : vector<4xf64> to vector<[4]xi32>789  return790}791 792// -----793 794func.func @fptosi_fl_to_scalable(%arg0 : vector<4xf32>) {795  // expected-error@+1 {{'arith.fptosi' op requires the same shape for all operands and results}}796  %0 = arith.fptosi %arg0 : vector<4xf32> to vector<[4]xi32>797  return798}799 800// -----801 802func.func @uitofp_fl_to_scalable(%arg0 : vector<4xi32>) {803  // expected-error@+1 {{'arith.uitofp' op requires the same shape for all operands and results}}804  %0 = arith.uitofp %arg0 : vector<4xi32> to vector<[4]xf32>805  return806}807 808// -----809 810func.func @sitofp_fl_to_scalable(%arg0 : vector<4xi32>) {811  // expected-error@+1 {{'arith.sitofp' op requires the same shape for all operands and results}}812  %0 = arith.sitofp %arg0 : vector<4xi32> to vector<[4]xf32>813  return814}815 816// -----817 818func.func @bitcast_fl_to_scalable(%arg0 : vector<4xf32>) {819  // expected-error@+1 {{'arith.bitcast' op requires the same shape for all operands and results}}820  %0 = arith.bitcast %arg0 : vector<4xf32> to vector<[4]xi32>821  return822}823 824// -----825 826func.func @func() {827  %c0 = arith.constant  // expected-error {{expected attribute value}}828 829  %x = arith.constant 1 : i32830}831 832// -----833 834func.func @disallow_zero_rank_tensor_with_ranked_tensor(%arg0 : tensor<i1>, %arg1 : tensor<2xi64>, %arg2 : tensor<2xi64>) -> tensor<2xi64> {835  // expected-error @+1 {{'arith.select' op failed to verify that condition is signless i1 or has matching shape}}836  %0 = arith.select %arg0, %arg1, %arg2 : tensor<i1>, tensor<2xi64>837  return %0 : tensor<2xi64>838}839 840// -----841 842func.func @disallow_zero_rank_tensor_with_unranked_tensor(%arg0 : tensor<i1>, %arg1 : tensor<2x?xi64>, %arg2 : tensor<2x?xi64>) -> tensor<2x?xi64> {843  // expected-error @+1 {{'arith.select' op failed to verify that condition is signless i1 or has matching shape}}844  %0 = arith.select %arg0, %arg1, %arg2 : tensor<i1>, tensor<2x?xi64>845  return %0 : tensor<2x?xi64>846}847 848// -----849 850func.func @select_tensor_encoding(851  %arg0 : tensor<8xi1, "bar">, %arg1 : tensor<8xi32, "foo">, %arg2 : tensor<8xi32, "foo">) -> tensor<8xi32, "foo"> {852  // expected-error @+1 {{'arith.select' op expected condition type to have the same shape as the result type}}853  %0 = arith.select %arg0, %arg1, %arg2 : tensor<8xi1, "bar">, tensor<8xi32, "foo">854  return %0 : tensor<8xi32, "foo">855}856 857// -----858 859func.func @bitcast_index_0(%arg0 : i64) -> index {860  // expected-error @+1 {{'arith.bitcast' op result #0 must be signless-integer-or-float-like or memref of signless-integer or float, but got 'index'}}861  %0 = arith.bitcast %arg0 : i64 to index862  return %0 : index863}864 865// -----866 867func.func @bitcast_index_1(%arg0 : index) -> i64 {868  // expected-error @+1 {{'arith.bitcast' op operand #0 must be signless-integer-or-float-like or memref of signless-integer or float, but got 'index'}}869  %0 = arith.bitcast %arg0 : index to i64870  return %0 : i64871}872