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: msdbr %f4, %f0, %f2
11 ; CHECK-SCALAR: ldr %f0, %f4
12 ; CHECK-VECTOR: wfmsdb %f0, %f0, %f2, %f4
14 %negacc = fneg double %acc
15 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %negacc)
19 define double @f2(double %f1, double *%ptr, double %acc) {
21 ; CHECK: msdb %f2, %f0, 0(%r2)
24 %f2 = load double, double *%ptr
25 %negacc = fneg double %acc
26 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %negacc)
30 define double @f3(double %f1, double *%base, double %acc) {
32 ; CHECK: msdb %f2, %f0, 4088(%r2)
35 %ptr = getelementptr double, double *%base, i64 511
36 %f2 = load double, double *%ptr
37 %negacc = fneg double %acc
38 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %negacc)
42 define double @f4(double %f1, double *%base, double %acc) {
43 ; The important thing here is that we don't generate an out-of-range
44 ; displacement. Other sequences besides this one would be OK.
47 ; CHECK: aghi %r2, 4096
48 ; CHECK: msdb %f2, %f0, 0(%r2)
51 %ptr = getelementptr double, double *%base, i64 512
52 %f2 = load double, double *%ptr
53 %negacc = fneg double %acc
54 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %negacc)
58 define double @f5(double %f1, double *%base, double %acc) {
59 ; Here too the important thing is that we don't generate an out-of-range
60 ; displacement. Other sequences besides this one would be OK.
64 ; CHECK: msdb %f2, %f0, 0(%r2)
67 %ptr = getelementptr double, double *%base, i64 -1
68 %f2 = load double, double *%ptr
69 %negacc = fneg double %acc
70 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %negacc)
74 define double @f6(double %f1, double *%base, i64 %index, double %acc) {
76 ; CHECK: sllg %r1, %r3, 3
77 ; CHECK: msdb %f2, %f0, 0(%r1,%r2)
80 %ptr = getelementptr double, double *%base, i64 %index
81 %f2 = load double, double *%ptr
82 %negacc = fneg double %acc
83 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %negacc)
87 define double @f7(double %f1, double *%base, i64 %index, double %acc) {
89 ; CHECK: sllg %r1, %r3, 3
90 ; CHECK: msdb %f2, %f0, 4088({{%r1,%r2|%r2,%r1}})
93 %index2 = add i64 %index, 511
94 %ptr = getelementptr double, double *%base, i64 %index2
95 %f2 = load double, double *%ptr
96 %negacc = fneg double %acc
97 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %negacc)
101 define double @f8(double %f1, double *%base, i64 %index, double %acc) {
103 ; CHECK: sllg %r1, %r3, 3
104 ; CHECK: lay %r1, 4096({{%r1,%r2|%r2,%r1}})
105 ; CHECK: msdb %f2, %f0, 0(%r1)
106 ; CHECK: ldr %f0, %f2
108 %index2 = add i64 %index, 512
109 %ptr = getelementptr double, double *%base, i64 %index2
110 %f2 = load double, double *%ptr
111 %negacc = fneg double %acc
112 %res = call double @llvm.fma.f64 (double %f1, double %f2, double %negacc)