1; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+multivalue | FileCheck %s
2; RUN: llc < %s --filetype=obj -mattr=+multivalue | obj2yaml | FileCheck %s --check-prefix OBJ
3
4; Test that the multivalue returns, function types, and block types
5; work as expected.
6
7target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
8target triple = "wasm32-unknown-unknown"
9
10%pair = type { i32, i32 }
11%packed_pair = type <{ i32, i32 }>
12
13; CHECK-LABEL: pair_ident:
14; CHECK-NEXT: .functype pair_ident (i32, i32) -> (i32, i32)
15; CHECK-NEXT: return $0, $1{{$}}
16define %pair @pair_ident(%pair %p) {
17  ret %pair %p
18}
19
20; CHECK-LABEL: packed_pair_ident:
21; CHECK-NEXT: .functype packed_pair_ident (i32, i32) -> (i32, i32)
22; CHECK-NEXT: return $0, $1{{$}}
23define %packed_pair @packed_pair_ident(%packed_pair %p) {
24  ret %packed_pair %p
25}
26
27; CHECK-LABEL: minimal_loop:
28; CHECK-NEXT: .functype minimal_loop (i32) -> (i32, i64)
29; CHECK-NEXT: .LBB{{[0-9]+}}_1:
30; CHECK-NEXT: loop () -> (i32, i64)
31; CHECK-NEXT: br 0{{$}}
32; CHECK-NEXT: .LBB{{[0-9]+}}_2:
33; CHECK-NEXT: end_loop{{$}}
34define {i32, i64} @minimal_loop(i32* %p) {
35entry:
36  br label %loop
37loop:
38  br label %loop
39}
40
41; CHECK-LABEL: .section .custom_section.target_features
42; CHECK-NEXT: .int8 1
43; CHECK-NEXT: .int8 43
44; CHECK-NEXT: .int8 10
45; CHECK-NEXT: .ascii "multivalue"
46
47; OBJ-LABEL:  - Type:            TYPE
48; OBJ-NEXT:     Signatures:
49; OBJ-NEXT:       - Index:           0
50; OBJ-NEXT:         ParamTypes:
51; OBJ-NEXT:           - I32
52; OBJ-NEXT:           - I32
53; OBJ-NEXT:         ReturnTypes:
54; OBJ-NEXT:           - I32
55; OBJ-NEXT:           - I32
56; OBJ-NEXT:       - Index:           1
57; OBJ-NEXT:         ParamTypes:
58; OBJ-NEXT:           - I32
59; OBJ-NEXT:         ReturnTypes:
60; OBJ-NEXT:           - I32
61; OBJ-NEXT:           - I64
62