1; Test calling functions with multiple return values (LLVM ABI extension)
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
4; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 -mattr=soft-float \
5; RUN:   | FileCheck %s --check-prefix=SOFT-FLOAT
6
7; Up to eight vector return values fit into VRs.
8declare { <2 x double>, <2 x double>, <2 x double>, <2 x double>,
9          <2 x double>, <2 x double>, <2 x double>, <2 x double> } @bar1()
10
11define <2 x double> @f1() {
12; CHECK-LABEL: f1:
13; CHECK: brasl %r14, bar1
14; CHECK: vlr %v24, %v31
15; CHECK: br %r14
16
17; SOFT-FLOAT-LABEL: f1:
18; SOFT-FLOAT-NOT: %{{[fv]}}
19; SOFT-FLOAT: brasl   %r14, bar1
20; SOFT-FLOAT-NEXT: lg      %r3, 280(%r15)
21; SOFT-FLOAT-NEXT: lg      %r2, 272(%r15)
22; SOFT-FLOAT-NEXT: lmg     %r14, %r15, 400(%r15)
23; SOFT-FLOAT-NEXT: br      %r14
24  %mret = call { <2 x double>, <2 x double>,
25                 <2 x double>, <2 x double>,
26                 <2 x double>, <2 x double>,
27                 <2 x double>, <2 x double> } @bar1()
28  %ret = extractvalue { <2 x double>, <2 x double>,
29                        <2 x double>, <2 x double>,
30                        <2 x double>, <2 x double>,
31                        <2 x double>, <2 x double> } %mret, 7
32  ret <2 x double> %ret
33}
34
35; More than eight vector return values use sret.
36declare { <2 x double>, <2 x double>, <2 x double>, <2 x double>,
37          <2 x double>, <2 x double>, <2 x double>, <2 x double>,
38          <2 x double> } @bar2()
39
40define <2 x double> @f2() {
41; CHECK-LABEL: f2:
42; CHECK: la %r2, 160(%r15)
43; CHECK: brasl %r14, bar2
44; CHECK: vl  %v24, 288(%r15)
45; CHECK: br %r14
46
47; SOFT-FLOAT-LABEL: f2:
48; SOFT-FLOAT-NOT: %{{[fv]}}
49; SOFT-FLOAT: brasl   %r14, bar2
50; SOFT-FLOAT-NEXT: lg      %r3, 296(%r15)
51; SOFT-FLOAT-NEXT: lg      %r2, 288(%r15)
52; SOFT-FLOAT-NEXT: lmg     %r14, %r15, 416(%r15)
53; SOFT-FLOAT-NEXT: br      %r14
54  %mret = call { <2 x double>, <2 x double>,
55                 <2 x double>, <2 x double>,
56                 <2 x double>, <2 x double>,
57                 <2 x double>, <2 x double>,
58                 <2 x double> } @bar2()
59  %ret = extractvalue { <2 x double>, <2 x double>,
60                        <2 x double>, <2 x double>,
61                        <2 x double>, <2 x double>,
62                        <2 x double>, <2 x double>,
63                        <2 x double> } %mret, 8
64  ret <2 x double> %ret
65}
66