1 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 \
2 ; RUN: | FileCheck -check-prefix=CHECK -check-prefix=CHECK-SCALAR %s
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 \
4 ; RUN: | FileCheck -check-prefix=CHECK -check-prefix=CHECK-VECTOR %s
6 declare double @llvm.fma.f64(double %f1, double %f2, double %f3)
8 define double @f1(double %f1, double %f2, double %acc) {
10 ; CHECK-SCALAR: madbr %f4, %f0, %f2
11 ; CHECK-SCALAR: ldr %f0, %f4
12 ; CHECK-VECTOR: wfmadb %f0, %f0, %f2, %f4
14 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)
18 define double @f2(double %f1, double *%ptr, double %acc) {
20 ; CHECK: madb %f2, %f0, 0(%r2)
23 %f2 = load double, double *%ptr
24 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)
28 define double @f3(double %f1, double *%base, double %acc) {
30 ; CHECK: madb %f2, %f0, 4088(%r2)
33 %ptr = getelementptr double, double *%base, i64 511
34 %f2 = load double, double *%ptr
35 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)
39 define double @f4(double %f1, double *%base, double %acc) {
40 ; The important thing here is that we don't generate an out-of-range
41 ; displacement. Other sequences besides this one would be OK.
44 ; CHECK: aghi %r2, 4096
45 ; CHECK: madb %f2, %f0, 0(%r2)
48 %ptr = getelementptr double, double *%base, i64 512
49 %f2 = load double, double *%ptr
50 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)
54 define double @f5(double %f1, double *%base, double %acc) {
55 ; Here too the important thing is that we don't generate an out-of-range
56 ; displacement. Other sequences besides this one would be OK.
60 ; CHECK: madb %f2, %f0, 0(%r2)
63 %ptr = getelementptr double, double *%base, i64 -1
64 %f2 = load double, double *%ptr
65 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)
69 define double @f6(double %f1, double *%base, i64 %index, double %acc) {
71 ; CHECK: sllg %r1, %r3, 3
72 ; CHECK: madb %f2, %f0, 0(%r1,%r2)
75 %ptr = getelementptr double, double *%base, i64 %index
76 %f2 = load double, double *%ptr
77 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)
81 define double @f7(double %f1, double *%base, i64 %index, double %acc) {
83 ; CHECK: sllg %r1, %r3, 3
84 ; CHECK: madb %f2, %f0, 4088({{%r1,%r2|%r2,%r1}})
87 %index2 = add i64 %index, 511
88 %ptr = getelementptr double, double *%base, i64 %index2
89 %f2 = load double, double *%ptr
90 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)
94 define double @f8(double %f1, double *%base, i64 %index, double %acc) {
96 ; CHECK: sllg %r1, %r3, 3
97 ; CHECK: lay %r1, 4096({{%r1,%r2|%r2,%r1}})
98 ; CHECK: madb %f2, %f0, 0(%r1)
101 %index2 = add i64 %index, 512
102 %ptr = getelementptr double, double *%base, i64 %index2
103 %f2 = load double, double *%ptr
104 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)