• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test multiple return values (LLVM ABI extension)
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -verify-machineinstrs| FileCheck %s
4; RUN: llc < %s -mtriple=s390x-linux-gnu -verify-machineinstrs \
5; RUN:   -mattr=soft-float | FileCheck %s --check-prefix=SOFT-FLOAT
6
7; Up to four integer return values fit into GPRs.
8define { i64, i64, i64, i64 } @f1() {
9; CHECK-LABEL: f1:
10; CHECK: lghi %r2, 0
11; CHECK: lghi %r3, 1
12; CHECK: lghi %r4, 2
13; CHECK: lghi %r5, 3
14; CHECK: br %r14
15  ret { i64, i64, i64, i64 } { i64 0, i64 1, i64 2, i64 3 }
16}
17
18; More than four integer return values use sret.
19define { i64, i64, i64, i64, i64 } @f2() {
20; CHECK-LABEL: f2:
21; CHECK: mvghi 32(%r2), 4
22; CHECK: mvghi 24(%r2), 3
23; CHECK: mvghi 16(%r2), 2
24; CHECK: mvghi 8(%r2), 1
25; CHECK: mvghi 0(%r2), 0
26; CHECK: br %r14
27  ret { i64, i64, i64, i64, i64 } { i64 0, i64 1, i64 2, i64 3, i64 4 }
28}
29
30; Up to four floating-point return values fit into FPRs.
31define { double, double, double, double } @f3() {
32; CHECK-LABEL: f3:
33; CHECK: larl [[TMP:%r[0-5]]], .LCPI
34; CHECK: ldeb %f0, 0([[TMP]])
35; CHECK: larl [[TMP:%r[0-5]]], .LCPI
36; CHECK: ldeb %f2, 0([[TMP]])
37; CHECK: larl [[TMP:%r[0-5]]], .LCPI
38; CHECK: ldeb %f4, 0([[TMP]])
39; CHECK: larl [[TMP:%r[0-5]]], .LCPI
40; CHECK: ldeb %f6, 0([[TMP]])
41; CHECK: br %r14
42
43; SOFT-FLOAT-LABEL: f3:
44; SOFT-FLOAT-NOT: %{{[fv]}}
45; SOFT-FLOAT: llihh   %r2, 16368
46; SOFT-FLOAT-NEXT: llihh   %r3, 16384
47; SOFT-FLOAT-NEXT: llihh   %r4, 16392
48; SOFT-FLOAT-NEXT: llihh   %r5, 16400
49; SOFT-FLOAT-NEXT: br      %r14
50  ret { double, double, double, double }
51      { double 1.0, double 2.0, double 3.0, double 4.0 }
52}
53
54; More than four floating-point return values use sret.
55define { double, double, double, double, double } @f4() {
56; CHECK-LABEL: f4:
57; CHECK: llihh [[TMP:%r[0-5]]], 16404
58; CHECK: stg [[TMP]], 32(%r2)
59; CHECK: llihh [[TMP:%r[0-5]]], 16400
60; CHECK: stg [[TMP]], 24(%r2)
61; CHECK: llihh [[TMP:%r[0-5]]], 16392
62; CHECK: stg [[TMP]], 16(%r2)
63; CHECK: llihh [[TMP:%r[0-5]]], 16384
64; CHECK: stg [[TMP]], 8(%r2)
65; CHECK: llihh [[TMP:%r[0-5]]], 16368
66; CHECK: stg [[TMP]], 0(%r2)
67; CHECK: br %r14
68
69; SOFT-FLOAT-LABEL: f4:
70; SOFT-FLOAT-NOT: %{{[fv]}}
71; SOFT-FLOAT-NOT: %r2
72; SOFT-FLOAT: llihh   %r0, 16404
73; SOFT-FLOAT-NEXT: stg     %r0, 32(%r2)
74; SOFT-FLOAT-NEXT: llihh   %r0, 16400
75; SOFT-FLOAT-NEXT: stg     %r0, 24(%r2)
76; SOFT-FLOAT-NEXT: llihh   %r0, 16392
77; SOFT-FLOAT-NEXT: stg     %r0, 16(%r2)
78; SOFT-FLOAT-NEXT: llihh   %r0, 16384
79; SOFT-FLOAT-NEXT: stg     %r0, 8(%r2)
80; SOFT-FLOAT-NEXT: llihh   %r0, 16368
81; SOFT-FLOAT-NEXT: stg     %r0, 0(%r2)
82; SOFT-FLOAT-NEXT: br      %r14
83  ret { double, double, double, double, double }
84      { double 1.0, double 2.0, double 3.0, double 4.0, double 5.0 }
85}
86