brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.6 KiB · 5df3255 Raw
329 lines · plain
1// RUN: mlir-opt --test-data-layout-query %s | FileCheck %s2 3// CHECK-LABEL: @no_layout_builtin4func.func @no_layout_builtin() {5  // CHECK: alignment = 46  // CHECK: bitsize = 327  // CHECK: index = 08  // CHECK: preferred = 49  // CHECK: size = 410  "test.data_layout_query"() : () -> i3211  // CHECK: alignment = 812  // CHECK: bitsize = 6413  // CHECK: index = 014  // CHECK: preferred = 815  // CHECK: size = 816  "test.data_layout_query"() : () -> f6417  // CHECK: alignment = 418  // CHECK: bitsize = 6419  // CHECK: index = 020  // CHECK: preferred = 421  // CHECK: size = 822  "test.data_layout_query"() : () -> complex<f32>23  // CHECK: alignment = 124  // CHECK: bitsize = 1425  // CHECK: index = 026  // CHECK: preferred = 127  // CHECK: size = 228  "test.data_layout_query"() : () -> complex<i6>29  // CHECK: alignment = 430  // CHECK: bitsize = 6431  // CHECK: index = 6432  // CHECK: preferred = 833  // CHECK: size = 834  "test.data_layout_query"() : () -> index35  // CHECK: alignment = 1636  // CHECK: bitsize = 12837  // CHECK: index = 038  // CHECK: preferred = 1639  // CHECK: size = 1640  "test.data_layout_query"() : () -> vector<4xi32>41  // CHECK: alignment = 1642  // CHECK: bitsize = {minimal_size = 128 : index, scalable}43  // CHECK: index = 044  // CHECK: preferred = 1645  // CHECK: size = {minimal_size = 16 : index, scalable}46  "test.data_layout_query"() : () -> vector<[4]xi32>47  return48 49}50 51// CHECK-LABEL: @no_layout_custom52func.func @no_layout_custom() {53  // CHECK: alignment = 154  // CHECK: bitsize = 155  // CHECK: index = 156  // CHECK: preferred = 157  // CHECK: size = 158  "test.data_layout_query"() : () -> !test.test_type_with_layout<10>59  return60}61 62// CHECK-LABEL: @layout_op_no_layout63func.func @layout_op_no_layout() {64  "test.op_with_data_layout"() ({65    // CHECK: alignment = 166    // CHECK: bitsize = 167    // CHECK: index = 168    // CHECK: preferred = 169    // CHECK: size = 170    "test.data_layout_query"() : () -> !test.test_type_with_layout<1000>71    "test.maybe_terminator"() : () -> ()72  }) : () -> ()73  return74}75 76// CHECK-LABEL: @layout_op77func.func @layout_op() {78  "test.op_with_data_layout"() ({79    // CHECK: alignment = 2080    // CHECK: bitsize = 1081    // CHECK: index = 3082    // CHECK: preferred = 183    // CHECK: size = 284    "test.data_layout_query"() : () -> !test.test_type_with_layout<10>85    "test.maybe_terminator"() : () -> ()86  }) { dlti.dl_spec = #dlti.dl_spec<87      #dlti.dl_entry<!test.test_type_with_layout<10>, ["size", 10]>,88      #dlti.dl_entry<!test.test_type_with_layout<20>, ["alignment", 20]>,89      #dlti.dl_entry<!test.test_type_with_layout<30>, ["index", 30]>90  >} : () -> ()91  return92}93 94// Make sure the outer op with layout may be missing the spec.95// CHECK-LABEL: @nested_inner_only96func.func @nested_inner_only() {97  "test.op_with_data_layout"() ({98    "test.op_with_data_layout"() ({99      // CHECK: alignment = 20100      // CHECK: bitsize = 10101      // CHECK: index = 30102      // CHECK: preferred = 1103      // CHECK: size = 2104      "test.data_layout_query"() : () -> !test.test_type_with_layout<10>105      "test.maybe_terminator"() : () -> ()106    }) { dlti.dl_spec = #dlti.dl_spec<107        #dlti.dl_entry<!test.test_type_with_layout<10>, ["size", 10]>,108        #dlti.dl_entry<!test.test_type_with_layout<20>, ["alignment", 20]>,109        #dlti.dl_entry<!test.test_type_with_layout<30>, ["index", 30]>110    >} : () -> ()111    "test.maybe_terminator"() : () -> ()112  }) : () -> ()113  return114}115 116// Make sure the inner op with layout may be missing the spec.117// CHECK-LABEL: @nested_outer_only118func.func @nested_outer_only() {119  "test.op_with_data_layout"() ({120    "test.op_with_data_layout"() ({121      // CHECK: alignment = 20122      // CHECK: bitsize = 10123      // CHECK: index = 30124      // CHECK: preferred = 1125      // CHECK: size = 2126      "test.data_layout_query"() : () -> !test.test_type_with_layout<10>127      "test.maybe_terminator"() : () -> ()128    }) : () -> ()129    "test.maybe_terminator"() : () -> ()130  }) { dlti.dl_spec = #dlti.dl_spec<131      #dlti.dl_entry<!test.test_type_with_layout<10>, ["size", 10]>,132      #dlti.dl_entry<!test.test_type_with_layout<20>, ["alignment", 20]>,133      #dlti.dl_entry<!test.test_type_with_layout<30>, ["index", 30]>134    >} : () -> ()135  return136}137 138// CHECK-LABEL: @nested_middle_only139func.func @nested_middle_only() {140  "test.op_with_data_layout"() ({141    "test.op_with_data_layout"() ({142      "test.op_with_data_layout"() ({143        // CHECK: alignment = 20144        // CHECK: bitsize = 10145        // CHECK: index = 30146        // CHECK: preferred = 1147        // CHECK: size = 2148        "test.data_layout_query"() : () -> !test.test_type_with_layout<10>149        "test.maybe_terminator"() : () -> ()150    }) : () -> ()151    "test.maybe_terminator"() : () -> ()152    }) { dlti.dl_spec = #dlti.dl_spec<153        #dlti.dl_entry<!test.test_type_with_layout<10>, ["size", 10]>,154        #dlti.dl_entry<!test.test_type_with_layout<20>, ["alignment", 20]>,155        #dlti.dl_entry<!test.test_type_with_layout<30>, ["index", 30]>156      >} : () -> ()157    "test.maybe_terminator"() : () -> ()158  }) : () -> ()159  return160}161 162// CHECK-LABEL: @nested_combine_with_missing163func.func @nested_combine_with_missing() {164  "test.op_with_data_layout"() ({165    "test.op_with_data_layout"() ({166      "test.op_with_data_layout"() ({167        // CHECK: alignment = 20168        // CHECK: bitsize = 10169        // CHECK: index = 21170        // CHECK: preferred = 30171        // CHECK: size = 2172        "test.data_layout_query"() : () -> !test.test_type_with_layout<10>173        "test.maybe_terminator"() : () -> ()174      }) : () -> ()175    "test.maybe_terminator"() : () -> ()176    }) { dlti.dl_spec = #dlti.dl_spec<177        #dlti.dl_entry<!test.test_type_with_layout<10>, ["size", 10]>,178        #dlti.dl_entry<!test.test_type_with_layout<20>, ["alignment", 20]>179      >} : () -> ()180    // CHECK: alignment = 1181    // CHECK: bitsize = 42182    // CHECK: index = 21183    // CHECK: preferred = 30184    // CHECK: size = 6185    "test.data_layout_query"() : () -> !test.test_type_with_layout<10>186    "test.maybe_terminator"() : () -> ()187  }) { dlti.dl_spec = #dlti.dl_spec<188      #dlti.dl_entry<!test.test_type_with_layout<10>, ["size", 42]>,189      #dlti.dl_entry<!test.test_type_with_layout<30>, ["preferred", 30]>,190      #dlti.dl_entry<!test.test_type_with_layout<40>, ["index", 21]>191  >}: () -> ()192  return193}194 195// CHECK-LABEL: @nested_combine_all196func.func @nested_combine_all() {197  "test.op_with_data_layout"() ({198    "test.op_with_data_layout"() ({199      "test.op_with_data_layout"() ({200        // CHECK: alignment = 20201        // CHECK: bitsize = 3202        // CHECK: index = 40203        // CHECK: preferred = 30204        // CHECK: size = 1205        "test.data_layout_query"() : () -> !test.test_type_with_layout<10>206        "test.maybe_terminator"() : () -> ()207      }) { dlti.dl_spec = #dlti.dl_spec<208          #dlti.dl_entry<!test.test_type_with_layout<10>, ["size", 3]>,209          #dlti.dl_entry<!test.test_type_with_layout<30>, ["preferred", 30]>210        >} : () -> ()211      // CHECK: alignment = 20212      // CHECK: bitsize = 10213      // CHECK: index = 40214      // CHECK: preferred = 30215      // CHECK: size = 2216      "test.data_layout_query"() : () -> !test.test_type_with_layout<10>217      "test.maybe_terminator"() : () -> ()218    }) { dlti.dl_spec = #dlti.dl_spec<219        #dlti.dl_entry<!test.test_type_with_layout<10>, ["size", 10]>,220        #dlti.dl_entry<!test.test_type_with_layout<20>, ["alignment", 20]>,221        #dlti.dl_entry<!test.test_type_with_layout<40>, ["index", 40]>222      >} : () -> ()223    // CHECK: alignment = 1224    // CHECK: bitsize = 42225    // CHECK: index = 1226    // CHECK: preferred = 30227    // CHECK: size = 6228    "test.data_layout_query"() : () -> !test.test_type_with_layout<10>229    "test.maybe_terminator"() : () -> ()230  }) { dlti.dl_spec = #dlti.dl_spec<231      #dlti.dl_entry<!test.test_type_with_layout<10>, ["size", 42]>,232      #dlti.dl_entry<!test.test_type_with_layout<30>, ["preferred", 30]>233  >}: () -> ()234  return235}236 237// CHECK-LABEL: @integers238func.func @integers() {239  "test.op_with_data_layout"() ({240    // CHECK: alignment = 8241    // CHECK: bitsize = 32242    // CHECK: index = 0243    // CHECK: preferred = 8244    "test.data_layout_query"() : () -> i32245    // CHECK: alignment = 16246    // CHECK: bitsize = 56247    // CHECK: index = 0248    // CHECK: preferred = 16249    "test.data_layout_query"() : () -> i56250    // CHECK: alignment = 16251    // CHECK: bitsize = 64252    // CHECK: index = 0253    // CHECK: preferred = 16254    "test.data_layout_query"() : () -> i64255    // CHECK: alignment = 16256    // CHECK: bitsize = 128257    // CHECK: index = 0258    // CHECK: preferred = 16259    "test.data_layout_query"() : () -> i128260    "test.maybe_terminator"() : () -> ()261  }) { dlti.dl_spec = #dlti.dl_spec<262      #dlti.dl_entry<i32, dense<64> : vector<1xi64>>,263      #dlti.dl_entry<i64, dense<128> : vector<1xi64>>264    >} : () -> ()265  "test.op_with_data_layout"() ({266    // CHECK: alignment = 8267    // CHECK: bitsize = 32268    // CHECK: index = 0269    // CHECK: preferred = 16270    "test.data_layout_query"() : () -> i32271    // CHECK: alignment = 16272    // CHECK: bitsize = 56273    // CHECK: index = 0274    // CHECK: preferred = 32275    "test.data_layout_query"() : () -> i56276    // CHECK: alignment = 16277    // CHECK: bitsize = 64278    // CHECK: index = 0279    // CHECK: preferred = 32280    "test.data_layout_query"() : () -> i64281    // CHECK: alignment = 16282    // CHECK: bitsize = 128283    // CHECK: index = 0284    // CHECK: preferred = 32285    "test.data_layout_query"() : () -> i128286    "test.maybe_terminator"() : () -> ()287  }) { dlti.dl_spec = #dlti.dl_spec<288      #dlti.dl_entry<i32, dense<[64, 128]> : vector<2xi64>>,289      #dlti.dl_entry<i64, dense<[128, 256]> : vector<2xi64>>290    >} : () -> ()291  return292}293 294func.func @floats() {295  "test.op_with_data_layout"() ({296    // CHECK: alignment = 8297    // CHECK: bitsize = 32298    // CHECK: index = 0299    // CHECK: preferred = 8300    "test.data_layout_query"() : () -> f32301    // CHECK: alignment = 16302    // CHECK: bitsize = 80303    // CHECK: index = 0304    // CHECK: preferred = 16305    "test.data_layout_query"() : () -> f80306    "test.maybe_terminator"() : () -> ()307  }) { dlti.dl_spec = #dlti.dl_spec<308      #dlti.dl_entry<f32, dense<64> : vector<1xi64>>,309      #dlti.dl_entry<f80, dense<128> : vector<1xi64>>310    >} : () -> ()311  "test.op_with_data_layout"() ({312    // CHECK: alignment = 8313    // CHECK: bitsize = 32314    // CHECK: index = 0315    // CHECK: preferred = 16316    "test.data_layout_query"() : () -> f32317    // CHECK: alignment = 16318    // CHECK: bitsize = 80319    // CHECK: index = 0320    // CHECK: preferred = 32321    "test.data_layout_query"() : () -> f80322    "test.maybe_terminator"() : () -> ()323  }) { dlti.dl_spec = #dlti.dl_spec<324      #dlti.dl_entry<f32, dense<[64, 128]> : vector<2xi64>>,325      #dlti.dl_entry<f80, dense<[128, 256]> : vector<2xi64>>326    >} : () -> ()327  return328}329