xref: /aosp_15_r20/external/llvm/test/CodeGen/WebAssembly/indirect-import.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -verify-machineinstrs | FileCheck %s
2; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -verify-machineinstrs -fast-isel | FileCheck %s
3
4; ModuleID = 'test/dot_s/indirect-import.c'
5source_filename = "test/dot_s/indirect-import.c"
6target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
7target triple = "wasm32"
8
9%struct.big = type { float, double, i32 }
10
11; Function Attrs: nounwind
12; CHECK: bar:
13define hidden i32 @bar() #0 {
14entry:
15  %fd = alloca float (double)*, align 4
16  %vj = alloca void (i64)*, align 4
17  %v = alloca void ()*, align 4
18  %ijidf = alloca i32 (i64, i32, double, float)*, align 4
19  %vs = alloca void (%struct.big*)*, align 4
20  %s = alloca void (%struct.big*)*, align 4
21
22; CHECK: i32.const       {{.+}}=, extern_fd@FUNCTION
23  store float (double)* @extern_fd, float (double)** %fd, align 4
24; CHECK: i32.const       {{.+}}=, extern_vj@FUNCTION
25  store void (i64)* @extern_vj, void (i64)** %vj, align 4
26  %0 = load void (i64)*, void (i64)** %vj, align 4
27  call void %0(i64 1)
28
29; CHECK: i32.const       {{.+}}=, extern_v@FUNCTION
30  store void ()* @extern_v, void ()** %v, align 4
31  %1 = load void ()*, void ()** %v, align 4
32  call void %1()
33
34; CHECK: i32.const       {{.+}}=, extern_ijidf@FUNCTION
35  store i32 (i64, i32, double, float)* @extern_ijidf, i32 (i64, i32, double, float)** %ijidf, align 4
36  %2 = load i32 (i64, i32, double, float)*, i32 (i64, i32, double, float)** %ijidf, align 4
37  %call = call i32 %2(i64 1, i32 2, double 3.000000e+00, float 4.000000e+00)
38
39; CHECK: i32.const       {{.+}}=, extern_struct@FUNCTION
40  store void (%struct.big*)* @extern_struct, void (%struct.big*)** %vs, align 4
41
42; CHECK: i32.const       {{.+}}=, extern_sret@FUNCTION
43  store void (%struct.big*)* @extern_sret, void (%struct.big*)** %s, align 4
44  %3 = load float (double)*, float (double)** %fd, align 4
45  %4 = ptrtoint float (double)* %3 to i32
46  ret i32 %4
47}
48
49declare float @extern_fd(double) #1
50
51declare void @extern_vj(i64) #1
52
53declare void @extern_v() #1
54
55declare i32 @extern_ijidf(i64, i32, double, float) #1
56
57declare void @extern_struct(%struct.big* byval align 8) #1
58
59declare void @extern_sret(%struct.big* sret) #1
60
61declare i128 @extern_i128ret(i64) #1
62
63attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "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" }
64attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "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" }
65
66
67; CHECK: .functype       extern_fd, f32, f64
68; CHECK: .functype       extern_vj, void, i64
69; CHECK: .functype       extern_v, void
70; CHECK: .functype       extern_ijidf, i32, i64, i32, f64, f32
71; CHECK: .functype       extern_struct, void, i32
72; CHECK: .functype       extern_sret, void, i32
73; CHECK: .functype       extern_i128ret, void, i32, i64
74