blob: 83a64a933c275e56935521bbc97da1522174ea03 [file] [log] [blame]
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00001; Test 64-bit floating-point loads.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5; Test the low end of the LD range.
6define double @f1(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +00007; CHECK-LABEL: f1:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00008; CHECK: ld %f0, 0(%r2)
9; CHECK: br %r14
10 %val = load double *%src
11 ret double %val
12}
13
14; Test the high end of the LD range.
15define double @f2(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000016; CHECK-LABEL: f2:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000017; CHECK: ld %f0, 4088(%r2)
18; CHECK: br %r14
David Blaikie79e6c742015-02-27 19:29:02 +000019 %ptr = getelementptr double, double *%src, i64 511
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000020 %val = load double *%ptr
21 ret double %val
22}
23
24; Check the next doubleword up, which should use LDY instead of LD.
25define double @f3(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000026; CHECK-LABEL: f3:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000027; CHECK: ldy %f0, 4096(%r2)
28; CHECK: br %r14
David Blaikie79e6c742015-02-27 19:29:02 +000029 %ptr = getelementptr double, double *%src, i64 512
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000030 %val = load double *%ptr
31 ret double %val
32}
33
34; Check the high end of the aligned LDY range.
35define double @f4(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000036; CHECK-LABEL: f4:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000037; CHECK: ldy %f0, 524280(%r2)
38; CHECK: br %r14
David Blaikie79e6c742015-02-27 19:29:02 +000039 %ptr = getelementptr double, double *%src, i64 65535
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000040 %val = load double *%ptr
41 ret double %val
42}
43
44; Check the next doubleword up, which needs separate address logic.
45; Other sequences besides this one would be OK.
46define double @f5(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000047; CHECK-LABEL: f5:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000048; CHECK: agfi %r2, 524288
49; CHECK: ld %f0, 0(%r2)
50; CHECK: br %r14
David Blaikie79e6c742015-02-27 19:29:02 +000051 %ptr = getelementptr double, double *%src, i64 65536
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000052 %val = load double *%ptr
53 ret double %val
54}
55
56; Check the high end of the negative aligned LDY range.
57define double @f6(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000058; CHECK-LABEL: f6:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000059; CHECK: ldy %f0, -8(%r2)
60; CHECK: br %r14
David Blaikie79e6c742015-02-27 19:29:02 +000061 %ptr = getelementptr double, double *%src, i64 -1
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000062 %val = load double *%ptr
63 ret double %val
64}
65
66; Check the low end of the LDY range.
67define double @f7(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000068; CHECK-LABEL: f7:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000069; CHECK: ldy %f0, -524288(%r2)
70; CHECK: br %r14
David Blaikie79e6c742015-02-27 19:29:02 +000071 %ptr = getelementptr double, double *%src, i64 -65536
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000072 %val = load double *%ptr
73 ret double %val
74}
75
76; Check the next doubleword down, which needs separate address logic.
77; Other sequences besides this one would be OK.
78define double @f8(double *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000079; CHECK-LABEL: f8:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000080; CHECK: agfi %r2, -524296
81; CHECK: ld %f0, 0(%r2)
82; CHECK: br %r14
David Blaikie79e6c742015-02-27 19:29:02 +000083 %ptr = getelementptr double, double *%src, i64 -65537
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000084 %val = load double *%ptr
85 ret double %val
86}
87
88; Check that LD allows an index.
89define double @f9(i64 %src, i64 %index) {
Stephen Lind24ab202013-07-14 06:24:09 +000090; CHECK-LABEL: f9:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000091; CHECK: ld %f0, 4095({{%r3,%r2|%r2,%r3}})
92; CHECK: br %r14
93 %add1 = add i64 %src, %index
94 %add2 = add i64 %add1, 4095
95 %ptr = inttoptr i64 %add2 to double *
96 %val = load double *%ptr
97 ret double %val
98}
99
100; Check that LDY allows an index.
101define double @f10(i64 %src, i64 %index) {
Stephen Lind24ab202013-07-14 06:24:09 +0000102; CHECK-LABEL: f10:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000103; CHECK: ldy %f0, 4096({{%r3,%r2|%r2,%r3}})
104; CHECK: br %r14
105 %add1 = add i64 %src, %index
106 %add2 = add i64 %add1, 4096
107 %ptr = inttoptr i64 %add2 to double *
108 %val = load double *%ptr
109 ret double %val
110}