1 ; Test multiplication of two f32s, producing an f64 result.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
7 ; Check register multiplication.
8 define double @f1(float %f1, float %f2) {
10 ; CHECK: mdebr %f0, %f2
12 %f1x = fpext float %f1 to double
13 %f2x = fpext float %f2 to double
14 %res = fmul double %f1x, %f2x
18 ; Check the low end of the MDEB range.
19 define double @f2(float %f1, ptr %ptr) {
21 ; CHECK: mdeb %f0, 0(%r2)
23 %f2 = load float, ptr %ptr
24 %f1x = fpext float %f1 to double
25 %f2x = fpext float %f2 to double
26 %res = fmul double %f1x, %f2x
30 ; Check the high end of the aligned MDEB range.
31 define double @f3(float %f1, ptr %base) {
33 ; CHECK: mdeb %f0, 4092(%r2)
35 %ptr = getelementptr float, ptr %base, i64 1023
36 %f2 = load float, ptr %ptr
37 %f1x = fpext float %f1 to double
38 %f2x = fpext float %f2 to double
39 %res = fmul double %f1x, %f2x
43 ; Check the next word up, which needs separate address logic.
44 ; Other sequences besides this one would be OK.
45 define double @f4(float %f1, ptr %base) {
47 ; CHECK: aghi %r2, 4096
48 ; CHECK: mdeb %f0, 0(%r2)
50 %ptr = getelementptr float, ptr %base, i64 1024
51 %f2 = load float, ptr %ptr
52 %f1x = fpext float %f1 to double
53 %f2x = fpext float %f2 to double
54 %res = fmul double %f1x, %f2x
58 ; Check negative displacements, which also need separate address logic.
59 define double @f5(float %f1, ptr %base) {
62 ; CHECK: mdeb %f0, 0(%r2)
64 %ptr = getelementptr float, ptr %base, i64 -1
65 %f2 = load float, ptr %ptr
66 %f1x = fpext float %f1 to double
67 %f2x = fpext float %f2 to double
68 %res = fmul double %f1x, %f2x
72 ; Check that MDEB allows indices.
73 define double @f6(float %f1, ptr %base, i64 %index) {
75 ; CHECK: sllg %r1, %r3, 2
76 ; CHECK: mdeb %f0, 400(%r1,%r2)
78 %ptr1 = getelementptr float, ptr %base, i64 %index
79 %ptr2 = getelementptr float, ptr %ptr1, i64 100
80 %f2 = load float, ptr %ptr2
81 %f1x = fpext float %f1 to double
82 %f2x = fpext float %f2 to double
83 %res = fmul double %f1x, %f2x
87 ; Check that multiplications of spilled values can use MDEB rather than MDEBR.
88 define float @f7(ptr %ptr0) {
90 ; CHECK: brasl %r14, foo@PLT
91 ; CHECK: mdeb %f0, 16{{[04]}}(%r15)
93 %ptr1 = getelementptr float, ptr %ptr0, i64 2
94 %ptr2 = getelementptr float, ptr %ptr0, i64 4
95 %ptr3 = getelementptr float, ptr %ptr0, i64 6
96 %ptr4 = getelementptr float, ptr %ptr0, i64 8
97 %ptr5 = getelementptr float, ptr %ptr0, i64 10
98 %ptr6 = getelementptr float, ptr %ptr0, i64 12
99 %ptr7 = getelementptr float, ptr %ptr0, i64 14
100 %ptr8 = getelementptr float, ptr %ptr0, i64 16
101 %ptr9 = getelementptr float, ptr %ptr0, i64 18
102 %ptr10 = getelementptr float, ptr %ptr0, i64 20
104 %val0 = load float, ptr %ptr0
105 %val1 = load float, ptr %ptr1
106 %val2 = load float, ptr %ptr2
107 %val3 = load float, ptr %ptr3
108 %val4 = load float, ptr %ptr4
109 %val5 = load float, ptr %ptr5
110 %val6 = load float, ptr %ptr6
111 %val7 = load float, ptr %ptr7
112 %val8 = load float, ptr %ptr8
113 %val9 = load float, ptr %ptr9
114 %val10 = load float, ptr %ptr10
116 %frob0 = fadd float %val0, %val0
117 %frob1 = fadd float %val1, %val1
118 %frob2 = fadd float %val2, %val2
119 %frob3 = fadd float %val3, %val3
120 %frob4 = fadd float %val4, %val4
121 %frob5 = fadd float %val5, %val5
122 %frob6 = fadd float %val6, %val6
123 %frob7 = fadd float %val7, %val7
124 %frob8 = fadd float %val8, %val8
125 %frob9 = fadd float %val9, %val9
126 %frob10 = fadd float %val9, %val10
128 store float %frob0, ptr %ptr0
129 store float %frob1, ptr %ptr1
130 store float %frob2, ptr %ptr2
131 store float %frob3, ptr %ptr3
132 store float %frob4, ptr %ptr4
133 store float %frob5, ptr %ptr5
134 store float %frob6, ptr %ptr6
135 store float %frob7, ptr %ptr7
136 store float %frob8, ptr %ptr8
137 store float %frob9, ptr %ptr9
138 store float %frob10, ptr %ptr10
140 %ret = call float @foo()
142 %accext0 = fpext float %ret to double
143 %ext0 = fpext float %frob0 to double
144 %mul0 = fmul double %accext0, %ext0
145 %extra0 = fmul double %mul0, 1.01
146 %trunc0 = fptrunc double %extra0 to float
148 %accext1 = fpext float %trunc0 to double
149 %ext1 = fpext float %frob1 to double
150 %mul1 = fmul double %accext1, %ext1
151 %extra1 = fmul double %mul1, 1.11
152 %trunc1 = fptrunc double %extra1 to float
154 %accext2 = fpext float %trunc1 to double
155 %ext2 = fpext float %frob2 to double
156 %mul2 = fmul double %accext2, %ext2
157 %extra2 = fmul double %mul2, 1.21
158 %trunc2 = fptrunc double %extra2 to float
160 %accext3 = fpext float %trunc2 to double
161 %ext3 = fpext float %frob3 to double
162 %mul3 = fmul double %accext3, %ext3
163 %extra3 = fmul double %mul3, 1.31
164 %trunc3 = fptrunc double %extra3 to float
166 %accext4 = fpext float %trunc3 to double
167 %ext4 = fpext float %frob4 to double
168 %mul4 = fmul double %accext4, %ext4
169 %extra4 = fmul double %mul4, 1.41
170 %trunc4 = fptrunc double %extra4 to float
172 %accext5 = fpext float %trunc4 to double
173 %ext5 = fpext float %frob5 to double
174 %mul5 = fmul double %accext5, %ext5
175 %extra5 = fmul double %mul5, 1.51
176 %trunc5 = fptrunc double %extra5 to float
178 %accext6 = fpext float %trunc5 to double
179 %ext6 = fpext float %frob6 to double
180 %mul6 = fmul double %accext6, %ext6
181 %extra6 = fmul double %mul6, 1.61
182 %trunc6 = fptrunc double %extra6 to float
184 %accext7 = fpext float %trunc6 to double
185 %ext7 = fpext float %frob7 to double
186 %mul7 = fmul double %accext7, %ext7
187 %extra7 = fmul double %mul7, 1.71
188 %trunc7 = fptrunc double %extra7 to float
190 %accext8 = fpext float %trunc7 to double
191 %ext8 = fpext float %frob8 to double
192 %mul8 = fmul double %accext8, %ext8
193 %extra8 = fmul double %mul8, 1.81
194 %trunc8 = fptrunc double %extra8 to float
196 %accext9 = fpext float %trunc8 to double
197 %ext9 = fpext float %frob9 to double
198 %mul9 = fmul double %accext9, %ext9
199 %extra9 = fmul double %mul9, 1.91
200 %trunc9 = fptrunc double %extra9 to float