1 ; Test multiplication of two f32s, producing an f32 result.
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=z14 | FileCheck %s
9 ; Check register multiplication.
10 define float @f1(float %f1, float %f2) {
12 ; CHECK: meebr %f0, %f2
14 %res = fmul float %f1, %f2
18 ; Check the low end of the MEEB range.
19 define float @f2(float %f1, ptr %ptr) {
21 ; CHECK: meeb %f0, 0(%r2)
23 %f2 = load float, ptr %ptr
24 %res = fmul float %f1, %f2
28 ; Check the high end of the aligned MEEB range.
29 define float @f3(float %f1, ptr %base) {
31 ; CHECK: meeb %f0, 4092(%r2)
33 %ptr = getelementptr float, ptr %base, i64 1023
34 %f2 = load float, ptr %ptr
35 %res = fmul float %f1, %f2
39 ; Check the next word up, which needs separate address logic.
40 ; Other sequences besides this one would be OK.
41 define float @f4(float %f1, ptr %base) {
43 ; CHECK: aghi %r2, 4096
44 ; CHECK: meeb %f0, 0(%r2)
46 %ptr = getelementptr float, ptr %base, i64 1024
47 %f2 = load float, ptr %ptr
48 %res = fmul float %f1, %f2
52 ; Check negative displacements, which also need separate address logic.
53 define float @f5(float %f1, ptr %base) {
56 ; CHECK: meeb %f0, 0(%r2)
58 %ptr = getelementptr float, ptr %base, i64 -1
59 %f2 = load float, ptr %ptr
60 %res = fmul float %f1, %f2
64 ; Check that MEEB allows indices.
65 define float @f6(float %f1, ptr %base, i64 %index) {
67 ; CHECK: sllg %r1, %r3, 2
68 ; CHECK: meeb %f0, 400(%r1,%r2)
70 %ptr1 = getelementptr float, ptr %base, i64 %index
71 %ptr2 = getelementptr float, ptr %ptr1, i64 100
72 %f2 = load float, ptr %ptr2
73 %res = fmul float %f1, %f2
77 ; Check that multiplications of spilled values can use MEEB rather than MEEBR.
78 define float @f7(ptr %ptr0) {
80 ; CHECK: brasl %r14, foo@PLT
81 ; CHECK-SCALAR: meeb %f0, 16{{[04]}}(%r15)
83 %ptr1 = getelementptr float, ptr %ptr0, i64 2
84 %ptr2 = getelementptr float, ptr %ptr0, i64 4
85 %ptr3 = getelementptr float, ptr %ptr0, i64 6
86 %ptr4 = getelementptr float, ptr %ptr0, i64 8
87 %ptr5 = getelementptr float, ptr %ptr0, i64 10
88 %ptr6 = getelementptr float, ptr %ptr0, i64 12
89 %ptr7 = getelementptr float, ptr %ptr0, i64 14
90 %ptr8 = getelementptr float, ptr %ptr0, i64 16
91 %ptr9 = getelementptr float, ptr %ptr0, i64 18
92 %ptr10 = getelementptr float, ptr %ptr0, i64 20
94 %val0 = load float, ptr %ptr0
95 %val1 = load float, ptr %ptr1
96 %val2 = load float, ptr %ptr2
97 %val3 = load float, ptr %ptr3
98 %val4 = load float, ptr %ptr4
99 %val5 = load float, ptr %ptr5
100 %val6 = load float, ptr %ptr6
101 %val7 = load float, ptr %ptr7
102 %val8 = load float, ptr %ptr8
103 %val9 = load float, ptr %ptr9
104 %val10 = load float, ptr %ptr10
106 %ret = call float @foo()
108 %mul0 = fmul float %ret, %val0
109 %mul1 = fmul float %mul0, %val1
110 %mul2 = fmul float %mul1, %val2
111 %mul3 = fmul float %mul2, %val3
112 %mul4 = fmul float %mul3, %val4
113 %mul5 = fmul float %mul4, %val5
114 %mul6 = fmul float %mul5, %val6
115 %mul7 = fmul float %mul6, %val7
116 %mul8 = fmul float %mul7, %val8
117 %mul9 = fmul float %mul8, %val9
118 %mul10 = fmul float %mul9, %val10
123 ; Check that reassociation flags do not get in the way of MEEB.
124 define float @f8(ptr %x) {
128 %0 = load float, ptr %x, align 8
129 %arrayidx1 = getelementptr inbounds float, ptr %x, i64 1
130 %1 = load float, ptr %arrayidx1, align 8
131 %add = fmul reassoc nsz arcp contract afn float %1, %0