• 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
5; Up to four integer return values fit into GPRs.
6define { i64, i64, i64, i64 } @f1() {
7; CHECK-LABEL: f1:
8; CHECK: lghi %r2, 0
9; CHECK: lghi %r3, 1
10; CHECK: lghi %r4, 2
11; CHECK: lghi %r5, 3
12; CHECK: br %r14
13  ret { i64, i64, i64, i64 } { i64 0, i64 1, i64 2, i64 3 }
14}
15
16; More than four integer return values use sret.
17define { i64, i64, i64, i64, i64 } @f2() {
18; CHECK-LABEL: f2:
19; CHECK: mvghi 32(%r2), 4
20; CHECK: mvghi 24(%r2), 3
21; CHECK: mvghi 16(%r2), 2
22; CHECK: mvghi 8(%r2), 1
23; CHECK: mvghi 0(%r2), 0
24; CHECK: br %r14
25  ret { i64, i64, i64, i64, i64 } { i64 0, i64 1, i64 2, i64 3, i64 4 }
26}
27
28; Up to four floating-point return values fit into FPRs.
29define { double, double, double, double } @f3() {
30; CHECK-LABEL: f3:
31; CHECK: larl [[TMP:%r[0-5]]], .LCPI
32; CHECK: ldeb %f0, 0([[TMP]])
33; CHECK: larl [[TMP:%r[0-5]]], .LCPI
34; CHECK: ldeb %f2, 0([[TMP]])
35; CHECK: larl [[TMP:%r[0-5]]], .LCPI
36; CHECK: ldeb %f4, 0([[TMP]])
37; CHECK: larl [[TMP:%r[0-5]]], .LCPI
38; CHECK: ldeb %f6, 0([[TMP]])
39; CHECK: br %r14
40  ret { double, double, double, double }
41      { double 1.0, double 2.0, double 3.0, double 4.0 }
42}
43
44; More than four floating-point return values use sret.
45define { double, double, double, double, double } @f4() {
46; CHECK-LABEL: f4:
47; CHECK: llihh [[TMP:%r[0-5]]], 16404
48; CHECK: stg [[TMP]], 32(%r2)
49; CHECK: llihh [[TMP:%r[0-5]]], 16400
50; CHECK: stg [[TMP]], 24(%r2)
51; CHECK: llihh [[TMP:%r[0-5]]], 16392
52; CHECK: stg [[TMP]], 16(%r2)
53; CHECK: llihh [[TMP:%r[0-5]]], 16384
54; CHECK: stg [[TMP]], 8(%r2)
55; CHECK: llihh [[TMP:%r[0-5]]], 16368
56; CHECK: stg [[TMP]], 0(%r2)
57; CHECK: br %r14
58  ret { double, double, double, double, double }
59      { double 1.0, double 2.0, double 3.0, double 4.0, double 5.0 }
60}
61