1// RUN: mlir-opt --split-input-file --verify-diagnostics --test-data-layout-query %s | FileCheck %s 2 3// expected-error@below {{expected integer attribute in the data layout entry for 'index'}} 4module attributes { dlti.dl_spec = #dlti.dl_spec< 5 #dlti.dl_entry<index, [32]>>} { 6} 7 8// ----- 9 10// expected-error@below {{expected a dense i64 elements attribute}} 11module attributes {dlti.dl_spec = #dlti.dl_spec< 12#dlti.dl_entry<i32, dense<[64,128]> : vector<2xi32>>> 13} {} 14 15// ----- 16 17// expected-error@below {{expected 1 or 2 elements}} 18module attributes {dlti.dl_spec = #dlti.dl_spec< 19#dlti.dl_entry<i32, dense<[64,64,64]> : vector<3xi64>>> 20} {} 21 22// ----- 23 24// expected-error@below {{preferred alignment is expected to be greater than or equal to the abi alignment}} 25module attributes {dlti.dl_spec = #dlti.dl_spec< 26#dlti.dl_entry<i32, dense<[64,32]> : vector<2xi64>>> 27} {} 28 29// ----- 30 31// expected-error@below {{the 'test' dialect does not support identifier data layout entries}} 32"test.op_with_data_layout"() { dlti.dl_spec = #dlti.dl_spec< 33 #dlti.dl_entry<index, 32>, 34 #dlti.dl_entry<"test.foo", [32]>>} : () -> () 35 36// ----- 37 38// CHECK-LABEL: @index 39module @index attributes { dlti.dl_spec = #dlti.dl_spec< 40 #dlti.dl_entry<index, 32>>} { 41 func.func @query() { 42 // CHECK: bitsize = 32 43 // CHECK: index = 32 44 "test.data_layout_query"() : () -> index 45 return 46 } 47} 48 49// ----- 50 51// CHECK-LABEL: @index_default 52module @index_default { 53 func.func @query() { 54 // CHECK: bitsize = 64 55 "test.data_layout_query"() : () -> index 56 return 57 } 58} 59