brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.4 KiB · e843dab Raw
289 lines · plain
1# RUN: llvm-mc -triple=wasm32-unknown-unknown -mattr=+tail-call,+reference-types,atomics,+simd128,+nontrapping-fptoint < %s | FileCheck %s2# Check that it converts to .o without errors, but don't check any output:3# RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj -mattr=+tail-call,+reference-types,+atomics,+simd128,+nontrapping-fptoint -o %t.o < %s4 5.functype   something1 () -> ()6.functype   something2 (i64) -> (i32, f64)7.functype   something3 () -> (i32)8.globaltype __stack_pointer, i329 10empty_func:11    .functype empty_func () -> ()12    end_function13 14test0:15# local labels can appear between label and its .functype.16.Ltest0begin:17    # Test all types:18    .functype   test0 (i32, i64) -> (i32)19    .tagtype  __cpp_exception i3220    .local      f32, f64, v128, v12821    # Explicit getlocal/setlocal:22    local.get   223    local.set   224    # Immediates:25    f32.const   -1.026    drop27    f32.const   -infinity28    drop29    v128.const  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1530    drop31    v128.const  0, 1, 2, 3, 4, 5, 6, 732    drop33    local.get   034    f64.const   0x1.999999999999ap135    # Indirect addressing:36    f64.store   1234:p2align=437    i32.const   -138    f64.const   nan39    f64.store   1234     # Natural alignment (3)40    # Loops, conditionals, binary ops, calls etc:41    block       f3242    f32.const   2.043    i32.const   144    local.get   045    i32.ge_s46    br_if       0        # 0: down to label047.LBB0_1:48    loop        void      # label1:49    call        something150    i64.const   123451    call        something252    i32.const   053    call_indirect (i32, f64) -> ()54    i32.const   155    i32.const   256    i32.add57    local.tee   058    local.get   059    i32.lt_s60    br_if       0        # 0: up to label161.LBB0_2:62    end_loop63    end_block            # label0:64    drop65    block       i3266    block       void67    block       void68    block       void69    block       () -> (i32, i32)70    i32.const   171    i32.const   272    end_block73    drop74    br_table {0, 1, 2}   # 2 entries, default75    end_block            # first entry jumps here.76    i32.const   177    br          278    end_block            # second entry jumps here.79    i32.const   280    br          181    end_block            # default jumps here.82    i32.const   383    end_block            # "switch" exit.84    if                   # void85    i32.const   086    if          i3287    i32.const   088    end_if89    drop90    else91    end_if92    block       void93    i32.const   294    return95    end_block96    block       void97    return_call something398    end_block99    block       void100    i32.const   3101    return_call_indirect () -> (i32)102    end_block103    local.get   4104    local.get   5105    f32x4.add106    drop107    # Test correct parsing of instructions with / and : in them:108    # TODO: enable once instruction has been added.109    #i32x4.trunc_sat_f32x4_s110    f32.const   1.0111    i32.trunc_f32_s112    i32.atomic.load 0113    i32.const   0114    memory.atomic.notify 0115    drop116.LBB0_3:117    i32.const   .L.str118    i32.load8_u .L.str+2119    i32.load16_u .L.str:p2align=0120.LBB0_4:121    #i32.trunc_sat_f32_s122    global.get  __stack_pointer123    global.set  __stack_pointer124    end_function125 126    .section    .rodata..L.str,"",@127    .hidden     .L.str128    .type       .L.str,@object129.L.str:130    .int8       'H'131    .asciz      "ello, World!"132    .int16      1234133    .int64      5000000000134    .int32      2000000000135    .size       .L.str, 28136 137    .data138    .int8       73139 140    .section    .init_array.42,"",@141    .p2align    2142    .int32      test0143 144    .ident      "clang version 9.0.0 (trunk 364502) (llvm/trunk 364571)"145 146.tabletype empty_externref_table, externref147empty_externref_table:148 149.tabletype empty_funcref_table, funcref150empty_funcref_table:151 152.tabletype empty_exnref_table, exnref153empty_exnref_table:154 155# CHECK:           .globaltype __stack_pointer, i32156 157# CHECK-LABEL: empty_func:158# CHECK-NEXT:      .functype	empty_func () -> ()159# CHECK-NEXT:      end_function160# CHECK-LABEL: test0:161# CHECK-NEXT:  .Ltest0begin:162# CHECK-NEXT:      .functype   test0 (i32, i64) -> (i32)163# CHECK-NEXT:      .tagtype  __cpp_exception i32164# CHECK-NEXT:      .local      f32, f64165# CHECK-NEXT:      local.get   2166# CHECK-NEXT:      local.set   2167# CHECK-NEXT:      f32.const   -0x1p0168# CHECK-NEXT:      drop169# CHECK-NEXT:      f32.const   -infinity170# CHECK-NEXT:      drop171# CHECK-NEXT:      v128.const  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15172# CHECK-NEXT:      drop173# CHECK-NEXT:      v128.const  0, 1, 2, 3, 4, 5, 6, 7174# CHECK-NEXT:      drop175# CHECK-NEXT:      local.get   0176# CHECK-NEXT:      f64.const   0x1.999999999999ap1177# CHECK-NEXT:      f64.store   1234:p2align=4178# CHECK-NEXT:      i32.const   -1179# CHECK-NEXT:      f64.const   nan180# CHECK-NEXT:      f64.store   1234181# CHECK-NEXT:      block       f32182# CHECK-NEXT:      f32.const   0x1p1183# CHECK-NEXT:      i32.const   1184# CHECK-NEXT:      local.get   0185# CHECK-NEXT:      i32.ge_s186# CHECK-NEXT:      br_if       0       # 0: down to label0187# CHECK-NEXT:  .LBB0_1:188# CHECK-NEXT:      loop                # label1:189# CHECK-NEXT:      call        something1190# CHECK-NEXT:      i64.const   1234191# CHECK-NEXT:      call        something2192# CHECK-NEXT:      i32.const   0193# CHECK-NEXT:      call_indirect __indirect_function_table, (i32, f64) -> ()194# CHECK-NEXT:      i32.const   1195# CHECK-NEXT:      i32.const   2196# CHECK-NEXT:      i32.add197# CHECK-NEXT:      local.tee   0198# CHECK-NEXT:      local.get   0199# CHECK-NEXT:      i32.lt_s200# CHECK-NEXT:      br_if       0       # 0: up to label1201# CHECK-NEXT:  .LBB0_2:202# CHECK-NEXT:      end_loop203# CHECK-NEXT:      end_block           # label0:204# CHECK-NEXT:      drop205# CHECK-NEXT:      block       i32206# CHECK-NEXT:      block207# CHECK-NEXT:      block208# CHECK-NEXT:      block209# CHECK-NEXT:      block       () -> (i32, i32)210# CHECK-NEXT:      i32.const   1211# CHECK-NEXT:      i32.const   2212# CHECK-NEXT:      end_block213# CHECK-NEXT:      drop214# CHECK-NEXT:      br_table {0, 1, 2}  # 1: down to label4215# CHECK-NEXT:                          # 2: down to label3216# CHECK-NEXT:      end_block           # label5:217# CHECK-NEXT:      i32.const   1218# CHECK-NEXT:      br          2       # 2: down to label2219# CHECK-NEXT:      end_block           # label4:220# CHECK-NEXT:      i32.const   2221# CHECK-NEXT:      br          1       # 1: down to label2222# CHECK-NEXT:      end_block           # label3:223# CHECK-NEXT:      i32.const   3224# CHECK-NEXT:      end_block           # label2:225# CHECK-NEXT:      if226# CHECK-NEXT:      i32.const   0227# CHECK-NEXT:      if          i32228# CHECK-NEXT:      i32.const   0229# CHECK-NEXT:      end_if230# CHECK-NEXT:      drop231# CHECK-NEXT:      else232# CHECK-NEXT:      end_if233# CHECK-NEXT:      block234# CHECK-NEXT:      i32.const   2235# CHECK-NEXT:      return236# CHECK-NEXT:      end_block237# CHECK-NEXT:      block238# CHECK-NEXT:      return_call something3239# CHECK-NEXT:      end_block240# CHECK-NEXT:      block241# CHECK-NEXT:      i32.const   3242# CHECK-NEXT:      return_call_indirect __indirect_function_table, () -> (i32)243# CHECK-NEXT:      end_block244# CHECK-NEXT:      local.get   4245# CHECK-NEXT:      local.get   5246# CHECK-NEXT:      f32x4.add247# CHECK-NEXT:      drop248# CHECK-NEXT:      f32.const   0x1p0249# CHECK-NEXT:      i32.trunc_f32_s250# CHECK-NEXT:      i32.atomic.load 0251# CHECK-NEXT:      i32.const   0252# CHECK-NEXT:      memory.atomic.notify 0253# CHECK-NEXT:      drop254# CHECK-NEXT:  .LBB0_3:255# CHECK-NEXT:      i32.const   .L.str256# CHECK-NEXT:      i32.load8_u .L.str+2257# CHECK-NEXT:      i32.load16_u .L.str:p2align=0258# CHECK-NEXT:  .LBB0_4:259# CHECK-NEXT:      global.get  __stack_pointer260# CHECK-NEXT:      global.set  __stack_pointer261# CHECK-NEXT:      end_function262 263# CHECK:           .section    .rodata..L.str,"",@264# CHECK-NEXT:      .hidden     .L.str265# CHECK-NEXT:  .L.str:266# CHECK-NEXT:      .int8       72267# CHECK-NEXT:      .asciz      "ello, World!"268# CHECK-NEXT:      .int16      1234269# CHECK-NEXT:      .int64      5000000000270# CHECK-NEXT:      .int32      2000000000271# CHECK-NEXT:      .size       .L.str, 28272 273# CHECK:           .data274# CHECK-EMPTY:275# CHECK-NEXT:      .int8       73276 277# CHECK:           .section    .init_array.42,"",@278# CHECK-NEXT:      .p2align    2279# CHECK-NEXT:      .int32      test0280 281# CHECK:           .tabletype empty_externref_table, externref282# CHECK-NEXT: empty_externref_table:283 284# CHECK:           .tabletype empty_funcref_table, funcref285# CHECK-NEXT: empty_funcref_table:286 287# CHECK:           .tabletype empty_exnref_table, exnref288# CHECK-NEXT: empty_exnref_table:289