1 ; Test the passing of scalar values in GPRs, FPRs in 64-bit calls on z/OS.
3 ; RUN: llc < %s -mtriple=s390x-ibm-zos -mcpu=z10 | FileCheck %s
5 ; CHECK-LABEL: call_char:
7 define i8 @call_char(){
8 %retval = call i8 (i8) @pass_char(i8 8)
12 ; CHECK-LABEL: call_short:
14 define i16 @call_short() {
16 %retval = call i16 (i16) @pass_short(i16 16)
20 ; CHECK-LABEL: call_int:
23 define i32 @call_int() {
25 %retval = call i32 (i32, i32) @pass_int(i32 32, i32 33)
29 ; CHECK-LABEL: call_long:
33 define i64 @call_long() {
35 %retval = call i64 (i64, i64, i64) @pass_long(i64 64, i64 65, i64 66)
39 ; CHECK-LABEL: call_ptr:
41 define i32 @call_ptr(ptr %p1, ptr %p2) {
43 %retval = call i32 (ptr) @pass_ptr(ptr %p2)
47 ; CHECK-LABEL: call_integrals:
51 define i64 @call_integrals() {
53 %retval = call i64 (i64, i32, i16, i64) @pass_integrals0(i64 64, i32 32, i16 16, i64 128)
57 ; CHECK-LABEL: pass_char:
59 define signext i8 @pass_char(i8 signext %arg) {
64 ; CHECK-LABEL: pass_short:
66 define signext i16 @pass_short(i16 signext %arg) {
71 ; CHECK-LABEL: pass_int:
73 define signext i32 @pass_int(i32 signext %arg0, i32 signext %arg1) {
78 ; CHECK-LABEL: pass_long:
81 define signext i64 @pass_long(i64 signext %arg0, i64 signext %arg1, i64 signext %arg2) {
83 %N = add i64 %arg0, %arg1
84 %M = add i64 %N, %arg2
88 ; CHECK-LABEL: pass_integrals0:
91 define signext i64 @pass_integrals0(i64 signext %arg0, i32 signext %arg1, i16 signext %arg2, i64 signext %arg3) {
93 %N = sext i32 %arg1 to i64
94 %M = add i64 %arg3, %N
98 ; CHECK-LABEL: call_float:
99 ; CHECK: le 0,0({{[0-9]}})
100 define float @call_float() {
102 %ret = call float (float) @pass_float(float 0x400921FB60000000)
106 ; CHECK-LABEL: call_double:
107 ; CHECK: larl [[GENREG:[0-9]+]],L#{{CPI[0-9]+_[0-9]+}}
108 ; CHECK-NEXT: ld 0,0([[GENREG]])
109 define double @call_double() {
111 %ret = call double (double) @pass_double(double 3.141000e+00)
115 ; CHECK-LABEL: call_longdouble:
116 ; CHECK: larl [[GENREG:[0-9]+]],L#{{CPI[0-9]+_[0-9]+}}
117 ; CHECK-NEXT: ld 0,0([[GENREG]])
118 ; CHECK-NEXT: ld 2,8([[GENREG]])
119 define fp128 @call_longdouble() {
121 %ret = call fp128 (fp128) @pass_longdouble(fp128 0xLE0FC1518450562CD4000921FB5444261)
125 ; CHECK-LABEL: call_floats0
126 ; CHECK: larl [[GENREG:[0-9]+]],L#{{CPI[0-9]+_[0-9]+}}
127 ; CHECK-NEXT: ld 1,0([[GENREG]])
128 ; CHECK-NEXT: ld 3,8([[GENREG]])
132 define i64 @call_floats0(fp128 %arg0, double %arg1) {
134 %ret = call i64 (fp128, fp128, double) @pass_floats0(fp128 0xLE0FC1518450562CD4000921FB5444261, fp128 %arg0, double %arg1)
138 ; CHECK-LABEL: call_floats1
142 define i64 @call_floats1(fp128 %arg0, double %arg1) {
144 %ret = call i64 (double, fp128) @pass_floats1(double %arg1, fp128 %arg0)
148 ; CHECK-LABEL: pass_float:
149 ; CHECK: larl 1,L#{{CPI[0-9]+_[0-9]+}}
151 define float @pass_float(float %arg) {
153 %X = fadd float %arg, 0x400821FB60000000
157 ; CHECK-LABEL: pass_double:
158 ; CHECK: larl 1,L#{{CPI[0-9]+_[0-9]+}}
160 define double @pass_double(double %arg) {
162 %X = fadd double %arg, 1.414213e+00
166 ; CHECK-LABEL: pass_longdouble
167 ; CHECK: larl 1,L#{{CPI[0-9]+_[0-9]+}}
170 define fp128 @pass_longdouble(fp128 %arg) {
172 %X = fadd fp128 %arg, 0xL10000000000000004000921FB53C8D4F
176 ; CHECK-LABEL: pass_floats0
177 ; CHECK: larl 1,L#{{CPI[0-9]+_[0-9]+}}
181 define i64 @pass_floats0(fp128 %arg0, fp128 %arg1, double %arg2) {
182 %X = fadd fp128 %arg0, %arg1
183 %arg2_ext = fpext double %arg2 to fp128
184 %Y = fadd fp128 %X, %arg2_ext
185 %ret_bool = fcmp ueq fp128 %Y, 0xLE0FC1518450562CD4000921FB5444261
186 %ret = sext i1 %ret_bool to i64
190 declare i64 @pass_floats1(double %arg0, fp128 %arg1)
191 declare i32 @pass_ptr(ptr %arg)