Skip to content

Commit a8a6196

Browse files
committed
Add llvm ir test
1 parent 35c0757 commit a8a6196

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
; RUN: llc < %s -mcpu=mvp -mattr=+reference-types | FileCheck %s
2+
3+
target triple = "wasm32-unknown-unknown"
4+
5+
; CHECK-LABEL: test_function_pointer_signature_void:
6+
; CHECK-NEXT: .functype test_function_pointer_signature_void (i32) -> ()
7+
; CHECK-NEXT: .local funcref
8+
; CHECK: local.get 0
9+
; CHECK-NEXT: table.get __indirect_function_table
10+
; CHECK-NEXT: local.tee 1
11+
; CHECK-NEXT: ref.test (f32, f64, i32) -> (f32)
12+
; CHECK-NEXT: call use
13+
; CHECK-NEXT: local.get 1
14+
; CHECK-NEXT: ref.test (f32, f64, i32) -> (i32)
15+
; CHECK-NEXT: call use
16+
; CHECK-NEXT: local.get 1
17+
; CHECK-NEXT: ref.test (i32, i32, i32) -> (i32)
18+
; CHECK-NEXT: call use
19+
; CHECK-NEXT: local.get 1
20+
; CHECK-NEXT: ref.test (i32, i32, i32) -> ()
21+
; CHECK-NEXT: call use
22+
; CHECK-NEXT: local.get 1
23+
; CHECK-NEXT: ref.test () -> ()
24+
; CHECK-NEXT: call use
25+
26+
; Function Attrs: nounwind
27+
define void @test_function_pointer_signature_void(ptr noundef %func) local_unnamed_addr #0 {
28+
entry:
29+
%0 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, float 0.000000e+00, float 0.000000e+00, double 0.000000e+00, i32 0)
30+
tail call void @use(i32 noundef %0) #3
31+
%1 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, i32 0, float 0.000000e+00, double 0.000000e+00, i32 0)
32+
tail call void @use(i32 noundef %1) #3
33+
%2 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, i32 0, i32 0, i32 0, i32 0)
34+
tail call void @use(i32 noundef %2) #3
35+
%3 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, token poison, i32 0, i32 0, i32 0)
36+
tail call void @use(i32 noundef %3) #3
37+
%4 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, token poison)
38+
tail call void @use(i32 noundef %4) #3
39+
ret void
40+
}
41+
42+
declare void @use(i32 noundef) local_unnamed_addr #1

0 commit comments

Comments
 (0)