Home | History | Annotate | Download | only in WebAssembly
      1 ; RUN: llc < %s -asm-verbose=false | FileCheck %s
      2 
      3 ; Test that basic functions assemble as expected.
      4 
      5 target datalayout = "e-p:32:32-i64:64-n32:64-S128"
      6 target triple = "wasm32-unknown-unknown"
      7 
      8 ; CHECK-LABEL: f0:
      9 ; CHECK: return{{$}}
     10 ; CHECK: .size f0,
     11 define void @f0() {
     12   ret void
     13 }
     14 
     15 ; CHECK-LABEL: f1:
     16 ; CHECK-NEXT: .result i32{{$}}
     17 ; CHECK-NEXT: i32.const $push[[NUM:[0-9]+]]=, 0{{$}}
     18 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
     19 ; CHECK: .size f1,
     20 define i32 @f1() {
     21   ret i32 0
     22 }
     23 
     24 ; CHECK-LABEL: f2:
     25 ; CHECK-NEXT: .param i32, f32{{$}}
     26 ; CHECK-NEXT: .result i32{{$}}
     27 ; CHECK-NEXT: i32.const $push[[NUM:[0-9]+]]=, 0{{$}}
     28 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
     29 ; CHECK: .size f2,
     30 define i32 @f2(i32 %p1, float %p2) {
     31   ret i32 0
     32 }
     33 
     34 ; CHECK-LABEL: f3:
     35 ; CHECK-NEXT: .param i32, f32{{$}}
     36 ; CHECK-NOT: local
     37 ; CHECK-NEXT: return{{$}}
     38 ; CHECK: .size f3,
     39 define void @f3(i32 %p1, float %p2) {
     40   ret void
     41 }
     42 
     43 ; CHECK-LABEL: f4:
     44 ; CHECK-NEXT: .param i32{{$}}
     45 ; CHECK-NEXT: .result i32{{$}}
     46 ; CHECK-NEXT: local
     47 define i32 @f4(i32 %x) {
     48 entry:
     49    %c = trunc i32 %x to i1
     50    br i1 %c, label %true, label %false
     51 true:
     52    ret i32 0
     53 false:
     54    ret i32 1
     55 }
     56 
     57 ; CHECK-LABEL: f5:
     58 ; CHECK-NEXT: .result f32{{$}}
     59 ; CHECK-NEXT: unreachable
     60 define float @f5()  {
     61  unreachable
     62 }
     63