1 ; Test 64-bit floating-point addition.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 \
4 ; RUN: | FileCheck -check-prefix=CHECK -check-prefix=CHECK-SCALAR %s
5 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 -verify-machineinstrs | FileCheck %s
8 ; Check register addition.
9 define double @f1(double %f1, double %f2) {
11 ; CHECK: adbr %f0, %f2
13 %res = fadd double %f1, %f2
17 ; Check the low end of the ADB range.
18 define double @f2(double %f1, double *%ptr) {
20 ; CHECK: adb %f0, 0(%r2)
22 %f2 = load double, double *%ptr
23 %res = fadd double %f1, %f2
27 ; Check the high end of the aligned ADB range.
28 define double @f3(double %f1, double *%base) {
30 ; CHECK: adb %f0, 4088(%r2)
32 %ptr = getelementptr double, double *%base, i64 511
33 %f2 = load double, double *%ptr
34 %res = fadd double %f1, %f2
38 ; Check the next doubleword up, which needs separate address logic.
39 ; Other sequences besides this one would be OK.
40 define double @f4(double %f1, double *%base) {
42 ; CHECK: aghi %r2, 4096
43 ; CHECK: adb %f0, 0(%r2)
45 %ptr = getelementptr double, double *%base, i64 512
46 %f2 = load double, double *%ptr
47 %res = fadd double %f1, %f2
51 ; Check negative displacements, which also need separate address logic.
52 define double @f5(double %f1, double *%base) {
55 ; CHECK: adb %f0, 0(%r2)
57 %ptr = getelementptr double, double *%base, i64 -1
58 %f2 = load double, double *%ptr
59 %res = fadd double %f1, %f2
63 ; Check that ADB allows indices.
64 define double @f6(double %f1, double *%base, i64 %index) {
66 ; CHECK: sllg %r1, %r3, 3
67 ; CHECK: adb %f0, 800(%r1,%r2)
69 %ptr1 = getelementptr double, double *%base, i64 %index
70 %ptr2 = getelementptr double, double *%ptr1, i64 100
71 %f2 = load double, double *%ptr2
72 %res = fadd double %f1, %f2
76 ; Check that additions of spilled values can use ADB rather than ADBR.
77 define double @f7(double *%ptr0) {
79 ; CHECK: brasl %r14, foo@PLT
80 ; CHECK-SCALAR: adb %f0, 160(%r15)
82 %ptr1 = getelementptr double, double *%ptr0, i64 2
83 %ptr2 = getelementptr double, double *%ptr0, i64 4
84 %ptr3 = getelementptr double, double *%ptr0, i64 6
85 %ptr4 = getelementptr double, double *%ptr0, i64 8
86 %ptr5 = getelementptr double, double *%ptr0, i64 10
87 %ptr6 = getelementptr double, double *%ptr0, i64 12
88 %ptr7 = getelementptr double, double *%ptr0, i64 14
89 %ptr8 = getelementptr double, double *%ptr0, i64 16
90 %ptr9 = getelementptr double, double *%ptr0, i64 18
91 %ptr10 = getelementptr double, double *%ptr0, i64 20
93 %val0 = load double, double *%ptr0
94 %val1 = load double, double *%ptr1
95 %val2 = load double, double *%ptr2
96 %val3 = load double, double *%ptr3
97 %val4 = load double, double *%ptr4
98 %val5 = load double, double *%ptr5
99 %val6 = load double, double *%ptr6
100 %val7 = load double, double *%ptr7
101 %val8 = load double, double *%ptr8
102 %val9 = load double, double *%ptr9
103 %val10 = load double, double *%ptr10
105 %ret = call double @foo()
107 %add0 = fadd double %ret, %val0
108 %add1 = fadd double %add0, %val1
109 %add2 = fadd double %add1, %val2
110 %add3 = fadd double %add2, %val3
111 %add4 = fadd double %add3, %val4
112 %add5 = fadd double %add4, %val5
113 %add6 = fadd double %add5, %val6
114 %add7 = fadd double %add6, %val7
115 %add8 = fadd double %add7, %val8
116 %add9 = fadd double %add8, %val9
117 %add10 = fadd double %add9, %val10