brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 79283f1 Raw
57 lines · plain
1// RUN: mlir-opt %s -test-elements-attr-interface -verify-diagnostics2 3// Parsing external resources does not work on big-endian platforms currently4// XFAIL: target={{(s390x|sparc.*)-.*}}5 6// This test contains various `ElementsAttr` attributes, and tests the support7// for iterating the values of these attributes using various native C++ types.8// This tests that the abstract iteration of ElementsAttr works properly, and9// is properly failable when necessary.10 11// expected-error@below {{Test iterating `int64_t`: unable to iterate type}}12// expected-error@below {{Test iterating `uint64_t`: 10, 11, 12, 13, 14}}13// expected-error@below {{Test iterating `APInt`: 10, 11, 12, 13, 14}}14// expected-error@below {{Test iterating `IntegerAttr`: 10 : i64, 11 : i64, 12 : i64, 13 : i64, 14 : i64}}15arith.constant #test.i64_elements<[10, 11, 12, 13, 14]> : tensor<5xi64>16 17// expected-error@below {{Test iterating `int64_t`: 10, 11, 12, 13, 14}}18// expected-error@below {{Test iterating `uint64_t`: 10, 11, 12, 13, 14}}19// expected-error@below {{Test iterating `APInt`: 10, 11, 12, 13, 14}}20// expected-error@below {{Test iterating `IntegerAttr`: 10 : i64, 11 : i64, 12 : i64, 13 : i64, 14 : i64}}21arith.constant dense<[10, 11, 12, 13, 14]> : tensor<5xi64>22 23// This test is expected to only be called on integer elements.24// expected-error@below {{Test iterating `int64_t`: expected element type to be an integer type}}25// expected-error@below {{Test iterating `uint64_t`: expected element type to be an integer type}}26// expected-error@below {{Test iterating `APInt`: expected element type to be an integer type}}27// expected-error@below {{Test iterating `IntegerAttr`: expected element type to be an integer type}}28arith.constant dense<[1.1, 1.2, 1.3]> : tensor<3xf32>29 30// Check that we don't crash on empty element attributes.31// expected-error@below {{Test iterating `int64_t`: }}32// expected-error@below {{Test iterating `uint64_t`: }}33// expected-error@below {{Test iterating `APInt`: }}34// expected-error@below {{Test iterating `IntegerAttr`: }}35arith.constant dense<> : tensor<0xi64>36 37// Check that we handle an external constant parsed from the config.38// expected-error@below {{Test iterating `int64_t`: unable to iterate type}}39// expected-error@below {{Test iterating `uint64_t`: 1, 2, 3}}40// expected-error@below {{Test iterating `APInt`: unable to iterate type}}41// expected-error@below {{Test iterating `IntegerAttr`: unable to iterate type}}42arith.constant #test.e1di64_elements<blob1> : tensor<3xi64>43 44{-#45  dialect_resources: {46    test: {47      blob1: "0x08000000010000000000000002000000000000000300000000000000"48    }49  }50#-}51 52// expected-error@below {{Test iterating `int64_t`: 0, 0, 1}}53// expected-error@below {{Test iterating `uint64_t`: 0, 0, 1}}54// expected-error@below {{Test iterating `APInt`: 0, 0, 1}}55// expected-error@below {{Test iterating `IntegerAttr`: 0 : i64, 0 : i64, 1 : i64}}56arith.constant sparse<[[0, 0, 2]], 1> : vector <1x1x3xi64>57