brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.1 KiB · f904e72 Raw
150 lines · plain
1// RUN: mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics %s | FileCheck %s2 3module attributes { dlti.dl_spec = #dlti.dl_spec<4  #dlti.dl_entry<!ptr.ptr<#test.const_memory_space>, #ptr.spec<size = 32, abi = 32, preferred = 64>>,5  #dlti.dl_entry<!ptr.ptr<#test.const_memory_space<5>>,#ptr.spec<size = 64, abi = 64, preferred = 64>>,6  #dlti.dl_entry<!ptr.ptr<#test.const_memory_space<4>>, #ptr.spec<size = 32, abi = 64, preferred = 64, index = 24>>,7  #dlti.dl_entry<"dlti.default_memory_space", #test.const_memory_space<7>>,8  #dlti.dl_entry<"dlti.alloca_memory_space", #test.const_memory_space<5>>,9  #dlti.dl_entry<"dlti.global_memory_space", #test.const_memory_space<2>>,10  #dlti.dl_entry<"dlti.program_memory_space", #test.const_memory_space<3>>,11  #dlti.dl_entry<"dlti.stack_alignment", 128 : i64>12>} {13  // CHECK-LABEL: @spec14  func.func @spec() {15    // CHECK: alignment = 416    // CHECK: alloca_memory_space = #test.const_memory_space<5>17    // CHECK: bitsize = 3218    // CHECK: default_memory_space = #test.const_memory_space<7>19    // CHECK: global_memory_space = #test.const_memory_space<2>20    // CHECK: index = 3221    // CHECK: preferred = 822    // CHECK: program_memory_space = #test.const_memory_space<3>23    // CHECK: size = 424    // CHECK: stack_alignment = 12825    "test.data_layout_query"() : () -> !ptr.ptr<#test.const_memory_space>26    // CHECK: alignment = 127    // CHECK: alloca_memory_space = #test.const_memory_space<5>28    // CHECK: bitsize = 6429    // CHECK: default_memory_space = #test.const_memory_space<7>30    // CHECK: global_memory_space = #test.const_memory_space<2>31    // CHECK: index = 6432    // CHECK: preferred = 133    // CHECK: program_memory_space = #test.const_memory_space<3>34    // CHECK: size = 835    // CHECK: stack_alignment = 12836    "test.data_layout_query"() : () -> !ptr.ptr<#test.const_memory_space<3>>37    // CHECK: alignment = 838    // CHECK: alloca_memory_space = #test.const_memory_space<5>39    // CHECK: bitsize = 6440    // CHECK: default_memory_space = #test.const_memory_space<7>41    // CHECK: global_memory_space = #test.const_memory_space<2>42    // CHECK: index = 6443    // CHECK: preferred = 844    // CHECK: program_memory_space = #test.const_memory_space<3>45    // CHECK: size = 846    // CHECK: stack_alignment = 12847    "test.data_layout_query"() : () -> !ptr.ptr<#test.const_memory_space<5>>48    // CHECK: alignment = 849    // CHECK: alloca_memory_space = #test.const_memory_space<5>50    // CHECK: bitsize = 3251    // CHECK: default_memory_space = #test.const_memory_space<7>52    // CHECK: global_memory_space = #test.const_memory_space<2>53    // CHECK: index = 2454    // CHECK: preferred = 855    // CHECK: program_memory_space = #test.const_memory_space<3>56    // CHECK: size = 457    // CHECK: stack_alignment = 12858    "test.data_layout_query"() : () -> !ptr.ptr<#test.const_memory_space<4>>59    return60  }61}62 63// -----64 65module attributes { dlti.dl_spec = #dlti.dl_spec<66  #dlti.dl_entry<!ptr.ptr<#test.const_memory_space>, #ptr.spec<size = 32, abi = 32, preferred = 32>>,67  #dlti.dl_entry<"dlti.default_memory_space", #test.const_memory_space>68>} {69  // CHECK-LABEL: @default_memory_space70  func.func @default_memory_space() {71    // CHECK: alignment = 472    // CHECK: bitsize = 3273    // CHECK: index = 3274    // CHECK: preferred = 475    // CHECK: size = 476    "test.data_layout_query"() : () -> !ptr.ptr<#test.const_memory_space>77    // CHECK: alignment = 478    // CHECK: bitsize = 3279    // CHECK: index = 3280    // CHECK: preferred = 481    // CHECK: size = 482    "test.data_layout_query"() : () -> !ptr.ptr<#test.const_memory_space<1>>83    // CHECK: alignment = 484    // CHECK: bitsize = 3285    // CHECK: index = 3286    // CHECK: preferred = 487    // CHECK: size = 488    "test.data_layout_query"() : () -> !ptr.ptr<#test.const_memory_space<2>>89    return90  }91}92 93// -----94 95// expected-error@+2 {{preferred alignment is expected to be at least as large as ABI alignment}}96module attributes { dlti.dl_spec = #dlti.dl_spec<97  #dlti.dl_entry<!ptr.ptr<#test.const_memory_space>, #ptr.spec<size = 64, abi = 64, preferred = 32>>98>} {99  func.func @pointer() {100    return101  }102}103 104// -----105 106// expected-error@+2 {{size entry must be divisible by 8}}107module attributes { dlti.dl_spec = #dlti.dl_spec<108  #dlti.dl_entry<!ptr.ptr<#test.const_memory_space>, #ptr.spec<size = 33, abi = 32, preferred = 32>>109>} {110  func.func @pointer() {111    return112  }113}114 115 116// -----117 118// expected-error@+2 {{abi entry must be divisible by 8}}119module attributes { dlti.dl_spec = #dlti.dl_spec<120  #dlti.dl_entry<!ptr.ptr<#test.const_memory_space>, #ptr.spec<size = 32, abi = 33, preferred = 64>>121>} {122  func.func @pointer() {123    return124  }125}126 127 128// -----129 130// expected-error@+2 {{preferred entry must be divisible by 8}}131module attributes { dlti.dl_spec = #dlti.dl_spec<132  #dlti.dl_entry<!ptr.ptr<#test.const_memory_space>, #ptr.spec<size = 32, abi = 32, preferred = 33>>133>} {134  func.func @pointer() {135    return136  }137}138 139 140// -----141 142// expected-error@+2 {{index entry must be divisible by 8}}143module attributes { dlti.dl_spec = #dlti.dl_spec<144  #dlti.dl_entry<!ptr.ptr<#test.const_memory_space>, #ptr.spec<size = 32, abi = 32, preferred = 32, index = 33>>145>} {146  func.func @pointer() {147    return148  }149}150