1 ; Test 128-bit floating-point stores.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 ; Check stores with no offset.
6 define void @f1(i64 %src, double %val) {
8 ; CHECK: std %f0, 0(%r2)
9 ; CHECK: std %f2, 8(%r2)
11 %ptr = inttoptr i64 %src to fp128 *
12 %ext = fpext double %val to fp128
13 store fp128 %ext, fp128 *%ptr
17 ; Check the highest aligned offset that allows STD for both halves.
18 define void @f2(i64 %src, double %val) {
20 ; CHECK: std %f0, 4080(%r2)
21 ; CHECK: std %f2, 4088(%r2)
23 %add = add i64 %src, 4080
24 %ptr = inttoptr i64 %add to fp128 *
25 %ext = fpext double %val to fp128
26 store fp128 %ext, fp128 *%ptr
30 ; Check the next doubleword up, which requires a mixture of STD and STDY.
31 define void @f3(i64 %src, double %val) {
33 ; CHECK: std %f0, 4088(%r2)
34 ; CHECK: stdy %f2, 4096(%r2)
36 %add = add i64 %src, 4088
37 %ptr = inttoptr i64 %add to fp128 *
38 %ext = fpext double %val to fp128
39 store fp128 %ext, fp128 *%ptr
43 ; Check the next doubleword after that, which requires STDY for both halves.
44 define void @f4(i64 %src, double %val) {
46 ; CHECK: stdy %f0, 4096(%r2)
47 ; CHECK: stdy %f2, 4104(%r2)
49 %add = add i64 %src, 4096
50 %ptr = inttoptr i64 %add to fp128 *
51 %ext = fpext double %val to fp128
52 store fp128 %ext, fp128 *%ptr
56 ; Check the highest aligned offset that allows STDY for both halves.
57 define void @f5(i64 %src, double %val) {
59 ; CHECK: stdy %f0, 524272(%r2)
60 ; CHECK: stdy %f2, 524280(%r2)
62 %add = add i64 %src, 524272
63 %ptr = inttoptr i64 %add to fp128 *
64 %ext = fpext double %val to fp128
65 store fp128 %ext, fp128 *%ptr
69 ; Check the next doubleword up, which requires separate address logic.
70 ; Other sequences besides this one would be OK.
71 define void @f6(i64 %src, double %val) {
73 ; CHECK: lay %r1, 524280(%r2)
74 ; CHECK: std %f0, 0(%r1)
75 ; CHECK: std %f2, 8(%r1)
77 %add = add i64 %src, 524280
78 %ptr = inttoptr i64 %add to fp128 *
79 %ext = fpext double %val to fp128
80 store fp128 %ext, fp128 *%ptr
84 ; Check the highest aligned negative offset, which needs a combination of
86 define void @f7(i64 %src, double %val) {
88 ; CHECK: stdy %f0, -8(%r2)
89 ; CHECK: std %f2, 0(%r2)
91 %add = add i64 %src, -8
92 %ptr = inttoptr i64 %add to fp128 *
93 %ext = fpext double %val to fp128
94 store fp128 %ext, fp128 *%ptr
98 ; Check the next doubleword down, which requires STDY for both halves.
99 define void @f8(i64 %src, double %val) {
101 ; CHECK: stdy %f0, -16(%r2)
102 ; CHECK: stdy %f2, -8(%r2)
104 %add = add i64 %src, -16
105 %ptr = inttoptr i64 %add to fp128 *
106 %ext = fpext double %val to fp128
107 store fp128 %ext, fp128 *%ptr
111 ; Check the lowest offset that allows STDY for both halves.
112 define void @f9(i64 %src, double %val) {
114 ; CHECK: stdy %f0, -524288(%r2)
115 ; CHECK: stdy %f2, -524280(%r2)
117 %add = add i64 %src, -524288
118 %ptr = inttoptr i64 %add to fp128 *
119 %ext = fpext double %val to fp128
120 store fp128 %ext, fp128 *%ptr
124 ; Check the next doubleword down, which requires separate address logic.
125 ; Other sequences besides this one would be OK.
126 define void @f10(i64 %src, double %val) {
128 ; CHECK: agfi %r2, -524296
129 ; CHECK: std %f0, 0(%r2)
130 ; CHECK: std %f2, 8(%r2)
132 %add = add i64 %src, -524296
133 %ptr = inttoptr i64 %add to fp128 *
134 %ext = fpext double %val to fp128
135 store fp128 %ext, fp128 *%ptr
139 ; Check that indices are allowed.
140 define void @f11(i64 %src, i64 %index, double %val) {
142 ; CHECK: std %f0, 4088({{%r2,%r3|%r3,%r2}})
143 ; CHECK: stdy %f2, 4096({{%r2,%r3|%r3,%r2}})
145 %add1 = add i64 %src, %index
146 %add2 = add i64 %add1, 4088
147 %ptr = inttoptr i64 %add2 to fp128 *
148 %ext = fpext double %val to fp128
149 store fp128 %ext, fp128 *%ptr