1 ; Test multiple return values (LLVM ABI extension)
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
7 ; Up to four integer return values fit into GPRs.
8 define { i64, i64, i64, i64 } @f1() {
15 ret { i64, i64, i64, i64 } { i64 0, i64 1, i64 2, i64 3 }
18 ; More than four integer return values use sret.
19 define { i64, i64, i64, i64, i64 } @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
27 ret { i64, i64, i64, i64, i64 } { i64 0, i64 1, i64 2, i64 3, i64 4 }
30 ; Up to four floating-point return values fit into FPRs.
31 define { double, double, double, double } @f3() {
33 ; CHECK: larl [[TMP:%r[0-5]]], .LCPI
34 ; CHECK: ld %f0, 0([[TMP]])
35 ; CHECK: larl [[TMP:%r[0-5]]], .LCPI
36 ; CHECK: ld %f2, 0([[TMP]])
37 ; CHECK: larl [[TMP:%r[0-5]]], .LCPI
38 ; CHECK: ld %f4, 0([[TMP]])
39 ; CHECK: larl [[TMP:%r[0-5]]], .LCPI
40 ; CHECK: ld %f6, 0([[TMP]])
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 }
54 ; More than four floating-point return values use sret.
55 define { double, double, double, double, double } @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)
69 ; SOFT-FLOAT-LABEL: f4:
70 ; SOFT-FLOAT-NOT: %{{[fv]}}
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 }