diff options
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/CodeGen/WebAssembly/reg-stackify.ll | 2 | ||||
-rw-r--r-- | llvm/test/MC/WebAssembly/basic-assembly.s | 4 | ||||
-rw-r--r-- | llvm/test/MC/WebAssembly/tail-call-encodings.s | 5 | ||||
-rw-r--r-- | llvm/test/MC/WebAssembly/type-index.s | 67 |
4 files changed, 73 insertions, 5 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/reg-stackify.ll b/llvm/test/CodeGen/WebAssembly/reg-stackify.ll index c0668afcefe..9a96016c98f 100644 --- a/llvm/test/CodeGen/WebAssembly/reg-stackify.ll +++ b/llvm/test/CodeGen/WebAssembly/reg-stackify.ll @@ -655,7 +655,7 @@ define i32 @stackpointer_dependency(i8* readnone) { ; NOREGS-NEXT: local.tee 0 ; NOREGS: i32.load 0 ; NOREGS-NEXT: i32.load 0 -; NOREGS-NEXT: i32.call_indirect +; NOREGS-NEXT: i32.call_indirect (i32, i32) -> (i32) %class.call_indirect = type { i32 (...)** } define i32 @call_indirect_stackify(%class.call_indirect** %objptr, i32 %arg) { %obj = load %class.call_indirect*, %class.call_indirect** %objptr diff --git a/llvm/test/MC/WebAssembly/basic-assembly.s b/llvm/test/MC/WebAssembly/basic-assembly.s index 23b1a0940f6..ac01dca3755 100644 --- a/llvm/test/MC/WebAssembly/basic-assembly.s +++ b/llvm/test/MC/WebAssembly/basic-assembly.s @@ -34,7 +34,7 @@ test0: i64.const 1234 i32.call something2 i32.const 0 - call_indirect 0 + call_indirect (i32, f64) -> () i32.const 1 i32.add local.tee 0 @@ -138,7 +138,7 @@ test0: # CHECK-NEXT: i64.const 1234 # CHECK-NEXT: i32.call something2 # CHECK-NEXT: i32.const 0 -# CHECK-NEXT: call_indirect 0 +# CHECK-NEXT: call_indirect (i32, f64) -> () # CHECK-NEXT: i32.const 1 # CHECK-NEXT: i32.add # CHECK-NEXT: local.tee 0 diff --git a/llvm/test/MC/WebAssembly/tail-call-encodings.s b/llvm/test/MC/WebAssembly/tail-call-encodings.s index a6e921b5434..69839adcfbf 100644 --- a/llvm/test/MC/WebAssembly/tail-call-encodings.s +++ b/llvm/test/MC/WebAssembly/tail-call-encodings.s @@ -16,7 +16,8 @@ foo1: foo2: .functype foo2 () -> () - # CHECK: return_call_indirect 0 # encoding: [0x13,0x00,0x00] - return_call_indirect 0 + # CHECK: return_call_indirect (i32) -> (i32) # encoding: [0x13, + # CHECK-NEXT: fixup A - offset: 1, value: .Ltypeindex0@TYPEINDEX, kind: fixup_uleb128_i32 + return_call_indirect (i32) -> (i32) end_function diff --git a/llvm/test/MC/WebAssembly/type-index.s b/llvm/test/MC/WebAssembly/type-index.s new file mode 100644 index 00000000000..707f6aa9894 --- /dev/null +++ b/llvm/test/MC/WebAssembly/type-index.s @@ -0,0 +1,67 @@ +# RUN: llvm-mc -triple=wasm32-unknown-unknown -mattr=+unimplemented-simd128,+nontrapping-fptoint,+exception-handling < %s | FileCheck %s +# Check that it converts to .o without errors: +# RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj -mattr=+unimplemented-simd128,+nontrapping-fptoint,+exception-handling < %s | obj2yaml | FileCheck -check-prefix=BIN %s + +# Minimal test for type indices in call_indirect. + +test0: + .functype test0 (i32) -> (i32) + call_indirect (f64) -> (f64) + end_function + +# CHECK: .text +# CHECK-LABEL: test0: +# CHECK-NEXT: .functype test0 (i32) -> (i32) +# CHECK-NEXT: call_indirect (f64) -> (f64) +# CHECK-NEXT: end_function + +# BIN: --- !WASM +# BIN-NEXT: FileHeader: +# BIN-NEXT: Version: 0x00000001 +# BIN-NEXT: Sections: +# BIN-NEXT: - Type: TYPE +# BIN-NEXT: Signatures: +# BIN-NEXT: - Index: 0 +# BIN-NEXT: ReturnType: I32 +# BIN-NEXT: ParamTypes: +# BIN-NEXT: - I32 +# BIN-NEXT: - Index: 1 +# BIN-NEXT: ReturnType: F64 +# BIN-NEXT: ParamTypes: +# BIN-NEXT: - F64 +# BIN-NEXT: - Type: IMPORT +# BIN-NEXT: Imports: +# BIN-NEXT: - Module: env +# BIN-NEXT: Field: __linear_memory +# BIN-NEXT: Kind: MEMORY +# BIN-NEXT: Memory: +# BIN-NEXT: Initial: 0x00000000 +# BIN-NEXT: - Module: env +# BIN-NEXT: Field: __indirect_function_table +# BIN-NEXT: Kind: TABLE +# BIN-NEXT: Table: +# BIN-NEXT: ElemType: FUNCREF +# BIN-NEXT: Limits: +# BIN-NEXT: Initial: 0x00000000 +# BIN-NEXT: - Type: FUNCTION +# BIN-NEXT: FunctionTypes: [ 0 ] +# BIN-NEXT: - Type: CODE +# BIN-NEXT: Relocations: +# BIN-NEXT: - Type: R_WASM_TYPE_INDEX_LEB +# BIN-NEXT: Index: 1 +# BIN-NEXT: Offset: 0x00000004 +# BIN-NEXT: Functions: +# BIN-NEXT: - Index: 0 +# BIN-NEXT: Locals: [] +# BIN-NEXT: Body: 118180808000000B +# BIN-NEXT: - Type: CUSTOM +# BIN-NEXT: Name: linking +# BIN-NEXT: Version: 2 +# BIN-NEXT: SymbolTable: +# BIN-NEXT: - Index: 0 +# BIN-NEXT: Kind: FUNCTION +# BIN-NEXT: Name: test0 +# BIN-NEXT: Flags: [ BINDING_LOCAL ] +# BIN-NEXT: Function: 0 +# BIN-NEXT: ... + |