1 ; Test calling functions with multiple return values (LLVM ABI extension) 2 ; 3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 4 5 ; Up to four integer return values fit into GPRs. 6 declare { i64, i64, i64, i64 } @bar1() 7 8 define i64 @f1() { 9 ; CHECK-LABEL: f1: 10 ; CHECK: brasl %r14, bar1 11 ; CHECK: lgr %r2, %r5 12 ; CHECK: br %r14 13 %mret = call { i64, i64, i64, i64 } @bar1() 14 %ret = extractvalue { i64, i64, i64, i64 } %mret, 3 15 ret i64 %ret 16 } 17 18 ; More than four integer return values use sret. 19 declare { i64, i64, i64, i64, i64 } @bar2() 20 21 define i64 @f2() { 22 ; CHECK-LABEL: f2: 23 ; CHECK: la %r2, 160(%r15) 24 ; CHECK: brasl %r14, bar2 25 ; CHECK: lg %r2, 192(%r15) 26 ; CHECK: br %r14 27 %mret = call { i64, i64, i64, i64, i64 } @bar2() 28 %ret = extractvalue { i64, i64, i64, i64, i64 } %mret, 4 29 ret i64 %ret 30 } 31 32 ; Up to four floating-point return values fit into GPRs. 33 declare { double, double, double, double } @bar3() 34 35 define double @f3() { 36 ; CHECK-LABEL: f3: 37 ; CHECK: brasl %r14, bar3 38 ; CHECK: ldr %f0, %f6 39 ; CHECK: br %r14 40 %mret = call { double, double, double, double } @bar3() 41 %ret = extractvalue { double, double, double, double } %mret, 3 42 ret double %ret 43 } 44 45 ; More than four integer return values use sret. 46 declare { double, double, double, double, double } @bar4() 47 48 define double @f4() { 49 ; CHECK-LABEL: f4: 50 ; CHECK: la %r2, 160(%r15) 51 ; CHECK: brasl %r14, bar4 52 ; CHECK: ld %f0, 192(%r15) 53 ; CHECK: br %r14 54 %mret = call { double, double, double, double, double } @bar4() 55 %ret = extractvalue { double, double, double, double, double } %mret, 4 56 ret double %ret 57 } 58