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