1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s --mtriple=wasm32-unknown-unknown -mattr=+reference-types | FileCheck %s
4 %funcref = type ptr addrspace(20) ;; addrspace 20 is nonintegral
6 ; CHECK: .tabletype __funcref_call_table, funcref, 1
8 define void @call_funcref(%funcref %ref) {
9 ; CHECK-LABEL: call_funcref:
10 ; CHECK: .functype call_funcref (funcref) -> ()
11 ; CHECK-NEXT: # %bb.0:
12 ; CHECK-NEXT: i32.const 0
13 ; CHECK-NEXT: local.get 0
14 ; CHECK-NEXT: table.set __funcref_call_table
15 ; CHECK-NEXT: i32.const 0
16 ; CHECK-NEXT: call_indirect __funcref_call_table, () -> ()
17 ; CHECK-NEXT: i32.const 0
18 ; CHECK-NEXT: ref.null_func
19 ; CHECK-NEXT: table.set __funcref_call_table
20 ; CHECK-NEXT: # fallthrough-return
21 call addrspace(20) void %ref()
25 define float @call_funcref_with_args(%funcref %ref) {
26 ; CHECK-LABEL: call_funcref_with_args:
27 ; CHECK: .functype call_funcref_with_args (funcref) -> (f32)
28 ; CHECK-NEXT: .local f32
29 ; CHECK-NEXT: # %bb.0:
30 ; CHECK-NEXT: i32.const 0
31 ; CHECK-NEXT: local.get 0
32 ; CHECK-NEXT: table.set __funcref_call_table
33 ; CHECK-NEXT: f64.const 0x1p0
34 ; CHECK-NEXT: i32.const 2
35 ; CHECK-NEXT: i32.const 0
36 ; CHECK-NEXT: call_indirect __funcref_call_table, (f64, i32) -> (f32)
37 ; CHECK-NEXT: local.set 1
38 ; CHECK-NEXT: i32.const 0
39 ; CHECK-NEXT: ref.null_func
40 ; CHECK-NEXT: table.set __funcref_call_table
41 ; CHECK-NEXT: local.get 1
42 ; CHECK-NEXT: # fallthrough-return
43 %ret = call addrspace(20) float %ref(double 1.0, i32 2)