1
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
3
declare double @llvm.fma.f64(double %f1, double %f2, double %f3)
5
define double @f1(double %f1, double %f2, double %acc) {
7
; CHECK: madbr %f4, %f0, %f2
10
%res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)
14
define double @f2(double %f1, double *%ptr, double %acc) {
16
; CHECK: madb %f2, %f0, 0(%r2)
19
%f2 = load double *%ptr
20
%res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)
24
define double @f3(double %f1, double *%base, double %acc) {
26
; CHECK: madb %f2, %f0, 4088(%r2)
29
%ptr = getelementptr double *%base, i64 511
30
%f2 = load double *%ptr
31
%res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)
35
define double @f4(double %f1, double *%base, double %acc) {
36
; The important thing here is that we don't generate an out-of-range
37
; displacement. Other sequences besides this one would be OK.
40
; CHECK: aghi %r2, 4096
41
; CHECK: madb %f2, %f0, 0(%r2)
44
%ptr = getelementptr double *%base, i64 512
45
%f2 = load double *%ptr
46
%res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)
50
define double @f5(double %f1, double *%base, double %acc) {
51
; Here too the important thing is that we don't generate an out-of-range
52
; displacement. Other sequences besides this one would be OK.
56
; CHECK: madb %f2, %f0, 0(%r2)
59
%ptr = getelementptr double *%base, i64 -1
60
%f2 = load double *%ptr
61
%res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)
65
define double @f6(double %f1, double *%base, i64 %index, double %acc) {
67
; CHECK: sllg %r1, %r3, 3
68
; CHECK: madb %f2, %f0, 0(%r1,%r2)
71
%ptr = getelementptr double *%base, i64 %index
72
%f2 = load double *%ptr
73
%res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)
77
define double @f7(double %f1, double *%base, i64 %index, double %acc) {
79
; CHECK: sllg %r1, %r3, 3
80
; CHECK: madb %f2, %f0, 4088({{%r1,%r2|%r2,%r1}})
83
%index2 = add i64 %index, 511
84
%ptr = getelementptr double *%base, i64 %index2
85
%f2 = load double *%ptr
86
%res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)
90
define double @f8(double %f1, double *%base, i64 %index, double %acc) {
92
; CHECK: sllg %r1, %r3, 3
93
; CHECK: lay %r1, 4096({{%r1,%r2|%r2,%r1}})
94
; CHECK: madb %f2, %f0, 0(%r1)
97
%index2 = add i64 %index, 512
98
%ptr = getelementptr double *%base, i64 %index2
99
%f2 = load double *%ptr
100
%res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc)