blob: 098cfef6b21748a14b63235a49e56108113f629e [file] [log] [blame]
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00001; Test 64-bit floating-point loads.
2;
Ulrich Weigand49506d72015-05-05 19:28:34 +00003; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
4; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00005
6; Test the low end of the LD range.
7define double @f1(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +00008; CHECK-LABEL: f1:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00009; CHECK: ld %f0, 0(%r2)
10; CHECK: br %r14
Ulrich Weigand9dd23b82018-07-20 12:12:10 +000011 %val = load double, double *%src
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000012 ret double %val
13}
14
15; Test the high end of the LD range.
16define double @f2(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000017; CHECK-LABEL: f2:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000018; CHECK: ld %f0, 4088(%r2)
19; CHECK: br %r14
David Blaikie79e6c742015-02-27 19:29:02 +000020 %ptr = getelementptr double, double *%src, i64 511
Ulrich Weigand9dd23b82018-07-20 12:12:10 +000021 %val = load double, double *%ptr
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000022 ret double %val
23}
24
25; Check the next doubleword up, which should use LDY instead of LD.
26define double @f3(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000027; CHECK-LABEL: f3:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000028; CHECK: ldy %f0, 4096(%r2)
29; CHECK: br %r14
David Blaikie79e6c742015-02-27 19:29:02 +000030 %ptr = getelementptr double, double *%src, i64 512
Ulrich Weigand9dd23b82018-07-20 12:12:10 +000031 %val = load double, double *%ptr
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000032 ret double %val
33}
34
35; Check the high end of the aligned LDY range.
36define double @f4(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000037; CHECK-LABEL: f4:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000038; CHECK: ldy %f0, 524280(%r2)
39; CHECK: br %r14
David Blaikie79e6c742015-02-27 19:29:02 +000040 %ptr = getelementptr double, double *%src, i64 65535
Ulrich Weigand9dd23b82018-07-20 12:12:10 +000041 %val = load double, double *%ptr
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000042 ret double %val
43}
44
45; Check the next doubleword up, which needs separate address logic.
46; Other sequences besides this one would be OK.
47define double @f5(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000048; CHECK-LABEL: f5:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000049; CHECK: agfi %r2, 524288
50; CHECK: ld %f0, 0(%r2)
51; CHECK: br %r14
David Blaikie79e6c742015-02-27 19:29:02 +000052 %ptr = getelementptr double, double *%src, i64 65536
Ulrich Weigand9dd23b82018-07-20 12:12:10 +000053 %val = load double, double *%ptr
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000054 ret double %val
55}
56
57; Check the high end of the negative aligned LDY range.
58define double @f6(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000059; CHECK-LABEL: f6:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000060; CHECK: ldy %f0, -8(%r2)
61; CHECK: br %r14
David Blaikie79e6c742015-02-27 19:29:02 +000062 %ptr = getelementptr double, double *%src, i64 -1
Ulrich Weigand9dd23b82018-07-20 12:12:10 +000063 %val = load double, double *%ptr
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000064 ret double %val
65}
66
67; Check the low end of the LDY range.
68define double @f7(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000069; CHECK-LABEL: f7:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000070; CHECK: ldy %f0, -524288(%r2)
71; CHECK: br %r14
David Blaikie79e6c742015-02-27 19:29:02 +000072 %ptr = getelementptr double, double *%src, i64 -65536
Ulrich Weigand9dd23b82018-07-20 12:12:10 +000073 %val = load double, double *%ptr
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000074 ret double %val
75}
76
77; Check the next doubleword down, which needs separate address logic.
78; Other sequences besides this one would be OK.
79define double @f8(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000080; CHECK-LABEL: f8:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000081; CHECK: agfi %r2, -524296
82; CHECK: ld %f0, 0(%r2)
83; CHECK: br %r14
David Blaikie79e6c742015-02-27 19:29:02 +000084 %ptr = getelementptr double, double *%src, i64 -65537
Ulrich Weigand9dd23b82018-07-20 12:12:10 +000085 %val = load double, double *%ptr
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000086 ret double %val
87}
88
89; Check that LD allows an index.
90define double @f9(i64 %src, i64 %index) {
Stephen Lind24ab202013-07-14 06:24:09 +000091; CHECK-LABEL: f9:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000092; CHECK: ld %f0, 4095({{%r3,%r2|%r2,%r3}})
93; CHECK: br %r14
94 %add1 = add i64 %src, %index
95 %add2 = add i64 %add1, 4095
96 %ptr = inttoptr i64 %add2 to double *
Ulrich Weigand9dd23b82018-07-20 12:12:10 +000097 %val = load double, double *%ptr
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000098 ret double %val
99}
100
101; Check that LDY allows an index.
102define double @f10(i64 %src, i64 %index) {
Stephen Lind24ab202013-07-14 06:24:09 +0000103; CHECK-LABEL: f10:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000104; CHECK: ldy %f0, 4096({{%r3,%r2|%r2,%r3}})
105; CHECK: br %r14
106 %add1 = add i64 %src, %index
107 %add2 = add i64 %add1, 4096
108 %ptr = inttoptr i64 %add2 to double *
Ulrich Weigand9dd23b82018-07-20 12:12:10 +0000109 %val = load double, double *%ptr
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000110 ret double %val
111}