1 // RUN: mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics %s | FileCheck %s
3 module attributes { dlti.dl_spec = #dlti.dl_spec<
4 #dlti.dl_entry<!ptr.ptr, #ptr.spec<size = 32, abi = 32, preferred = 64>>,
5 #dlti.dl_entry<!ptr.ptr<5>,#ptr.spec<size = 64, abi = 64, preferred = 64>>,
6 #dlti.dl_entry<!ptr.ptr<4>, #ptr.spec<size = 32, abi = 64, preferred = 64, index = 24>>,
7 #dlti.dl_entry<"dlti.alloca_memory_space", 5 : ui64>,
8 #dlti.dl_entry<"dlti.global_memory_space", 2 : ui64>,
9 #dlti.dl_entry<"dlti.program_memory_space", 3 : ui64>,
10 #dlti.dl_entry<"dlti.stack_alignment", 128 : i64>
14 // CHECK: alignment = 4
15 // CHECK: alloca_memory_space = 5
16 // CHECK: bitsize = 32
17 // CHECK: global_memory_space = 2
19 // CHECK: preferred = 8
20 // CHECK: program_memory_space = 3
22 // CHECK: stack_alignment = 128
23 "test.data_layout_query"() : () -> !ptr.ptr
24 // CHECK: alignment = 4
25 // CHECK: alloca_memory_space = 5
26 // CHECK: bitsize = 32
27 // CHECK: global_memory_space = 2
29 // CHECK: preferred = 8
30 // CHECK: program_memory_space = 3
32 // CHECK: stack_alignment = 128
33 "test.data_layout_query"() : () -> !ptr.ptr<3>
34 // CHECK: alignment = 8
35 // CHECK: alloca_memory_space = 5
36 // CHECK: bitsize = 64
37 // CHECK: global_memory_space = 2
39 // CHECK: preferred = 8
40 // CHECK: program_memory_space = 3
42 // CHECK: stack_alignment = 128
43 "test.data_layout_query"() : () -> !ptr.ptr<5>
44 // CHECK: alignment = 8
45 // CHECK: alloca_memory_space = 5
46 // CHECK: bitsize = 32
47 // CHECK: global_memory_space = 2
49 // CHECK: preferred = 8
50 // CHECK: program_memory_space = 3
52 // CHECK: stack_alignment = 128
53 "test.data_layout_query"() : () -> !ptr.ptr<4>
60 // expected-error@+2 {{preferred alignment is expected to be at least as large as ABI alignment}}
61 module attributes { dlti.dl_spec = #dlti.dl_spec<
62 #dlti.dl_entry<!ptr.ptr, #ptr.spec<size = 64, abi = 64, preferred = 32>>
64 func.func @pointer() {
71 // expected-error@+2 {{size entry must be divisible by 8}}
72 module attributes { dlti.dl_spec = #dlti.dl_spec<
73 #dlti.dl_entry<!ptr.ptr, #ptr.spec<size = 33, abi = 32, preferred = 32>>
75 func.func @pointer() {
83 // expected-error@+2 {{abi entry must be divisible by 8}}
84 module attributes { dlti.dl_spec = #dlti.dl_spec<
85 #dlti.dl_entry<!ptr.ptr, #ptr.spec<size = 32, abi = 33, preferred = 64>>
87 func.func @pointer() {
95 // expected-error@+2 {{preferred entry must be divisible by 8}}
96 module attributes { dlti.dl_spec = #dlti.dl_spec<
97 #dlti.dl_entry<!ptr.ptr, #ptr.spec<size = 32, abi = 32, preferred = 33>>
99 func.func @pointer() {
107 // expected-error@+2 {{index entry must be divisible by 8}}
108 module attributes { dlti.dl_spec = #dlti.dl_spec<
109 #dlti.dl_entry<!ptr.ptr, #ptr.spec<size = 32, abi = 32, preferred = 32, index = 33>>
111 func.func @pointer() {