16d0c7bc1SPaulo Matos; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types | FileCheck %s 26d0c7bc1SPaulo Matos 380fb7823SAlex Bradbury%funcref = type ptr addrspace(20) ;; addrspace 20 is nonintegral 46d0c7bc1SPaulo Matos 56d0c7bc1SPaulo Matos@funcref_table = local_unnamed_addr addrspace(1) global [0 x %funcref] undef 66d0c7bc1SPaulo Matos 76d0c7bc1SPaulo Matos; CHECK: .tabletype __funcref_call_table, funcref, 1 86d0c7bc1SPaulo Matos 9*1bd1a440SPaulo Matosdeclare %funcref @llvm.wasm.table.get.funcref(ptr addrspace(1), i32) nounwind 10*1bd1a440SPaulo Matos 11c67c9cfeSPaulo Matosdefine void @call_funcref_from_table(i32 %i) { 126d0c7bc1SPaulo Matos; CHECK-LABEL: call_funcref_from_table: 136d0c7bc1SPaulo Matos; CHECK-NEXT: .functype call_funcref_from_table (i32) -> () 146d0c7bc1SPaulo Matos; CHECK-NEXT: i32.const 0 156d0c7bc1SPaulo Matos; CHECK-NEXT: local.get 0 166d0c7bc1SPaulo Matos; CHECK-NEXT: table.get funcref_table 176d0c7bc1SPaulo Matos; CHECK-NEXT: table.set __funcref_call_table 186d0c7bc1SPaulo Matos; CHECK-NEXT: i32.const 0 196d0c7bc1SPaulo Matos; CHECK-NEXT: call_indirect __funcref_call_table, () -> () 206d0c7bc1SPaulo Matos; CHECK-NEXT: i32.const 0 21a96d8285SPaulo Matos; CHECK-NEXT: ref.null_func 226d0c7bc1SPaulo Matos; CHECK-NEXT: table.set __funcref_call_table 236d0c7bc1SPaulo Matos; CHECK-NEXT: end_function 24*1bd1a440SPaulo Matos %ref = call %funcref @llvm.wasm.table.get.funcref(ptr addrspace(1) @funcref_table, i32 %i) 2580fb7823SAlex Bradbury call addrspace(20) void %ref() 26c67c9cfeSPaulo Matos ret void 27c67c9cfeSPaulo Matos} 286d0c7bc1SPaulo Matos 29b5b5f0acSPaulo Matos; CHECK: .tabletype funcref_table, funcref 30c67c9cfeSPaulo Matos; CHECK-LABEL: funcref_table: 316d0c7bc1SPaulo Matos 32