1; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers -verify-machineinstrs | FileCheck %s
2; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers -verify-machineinstrs -fast-isel | FileCheck %s
3
4; ModuleID = 'test/dot_s/indirect-import.c'
5source_filename = "test/dot_s/indirect-import.c"
6target triple = "wasm32"
7
8; CHECK: .functype extern_fd (f64) -> (f32)
9; CHECK: .functype extern_vj (i64) -> ()
10; CHECK: .functype extern_v () -> ()
11; CHECK: .functype extern_ijidf  (i64, i32, f64, f32) -> (i32)
12; CHECK: .functype extern_struct (i32) -> ()
13; CHECK: .functype extern_sret (i32) -> ()
14; CHECK: .functype extern_i128ret (i32, i64) -> ()
15
16%struct.big = type { float, double, i32 }
17
18; Function Attrs: nounwind
19; CHECK-LABEL: bar:
20define hidden i32 @bar() #0 {
21entry:
22  %fd = alloca float (double)*, align 4
23  %vj = alloca void (i64)*, align 4
24  %v = alloca void ()*, align 4
25  %ijidf = alloca i32 (i64, i32, double, float)*, align 4
26  %vs = alloca void (%struct.big*)*, align 4
27  %s = alloca void (%struct.big*)*, align 4
28  %i128ret = alloca i128 (i64)*, align 8
29
30; CHECK-DAG: i32.const       {{.+}}=, extern_fd
31; CHECK-DAG: i32.const       {{.+}}=, extern_vj
32  store float (double)* @extern_fd, float (double)** %fd, align 4
33  store void (i64)* @extern_vj, void (i64)** %vj, align 4
34  %0 = load void (i64)*, void (i64)** %vj, align 4
35  call void %0(i64 1)
36
37; CHECK: i32.const       {{.+}}=, extern_v
38  store void ()* @extern_v, void ()** %v, align 4
39  %1 = load void ()*, void ()** %v, align 4
40  call void %1()
41
42; CHECK: i32.const       {{.+}}=, extern_ijidf
43  store i32 (i64, i32, double, float)* @extern_ijidf, i32 (i64, i32, double, float)** %ijidf, align 4
44  %2 = load i32 (i64, i32, double, float)*, i32 (i64, i32, double, float)** %ijidf, align 4
45  %call = call i32 %2(i64 1, i32 2, double 3.000000e+00, float 4.000000e+00)
46
47; CHECK-DAG: i32.const       {{.+}}=, extern_struct
48; CHECK-DAG: i32.const       {{.+}}=, extern_sret
49  store void (%struct.big*)* @extern_struct, void (%struct.big*)** %vs, align 4
50  store void (%struct.big*)* @extern_sret, void (%struct.big*)** %s, align 4
51  %3 = load float (double)*, float (double)** %fd, align 4
52  %4 = ptrtoint float (double)* %3 to i32
53
54; CHECK: i32.const       {{.+}}=, extern_i128ret
55  store i128 (i64)* @extern_i128ret, i128 (i64)** %i128ret, align 8
56  %5 = load i128 (i64)*, i128 (i64)** %i128ret, align 8
57  %6 = call i128 %5(i64 1)
58
59  ret i32 %4
60}
61
62declare float @extern_fd(double) #1
63
64declare void @extern_vj(i64) #1
65
66declare void @extern_v() #1
67
68declare i32 @extern_ijidf(i64, i32, double, float) #1
69
70declare void @extern_struct(%struct.big* byval(%struct.big) align 8) #1
71
72declare void @extern_sret(%struct.big* sret(%struct.big)) #1
73
74declare i128 @extern_i128ret(i64) #1
75
76attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
77attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
78