1 ; Test 64-bit floating-point loads.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
6 ; Test the low end of the LD range.
7 define double @f1(double *%src) {
9 ; CHECK: ld %f0, 0(%r2)
11 %val = load double, double *%src
15 ; Test the high end of the LD range.
16 define double @f2(double *%src) {
18 ; CHECK: ld %f0, 4088(%r2)
20 %ptr = getelementptr double, double *%src, i64 511
21 %val = load double, double *%ptr
25 ; Check the next doubleword up, which should use LDY instead of LD.
26 define double @f3(double *%src) {
28 ; CHECK: ldy %f0, 4096(%r2)
30 %ptr = getelementptr double, double *%src, i64 512
31 %val = load double, double *%ptr
35 ; Check the high end of the aligned LDY range.
36 define double @f4(double *%src) {
38 ; CHECK: ldy %f0, 524280(%r2)
40 %ptr = getelementptr double, double *%src, i64 65535
41 %val = load double, double *%ptr
45 ; Check the next doubleword up, which needs separate address logic.
46 ; Other sequences besides this one would be OK.
47 define double @f5(double *%src) {
49 ; CHECK: agfi %r2, 524288
50 ; CHECK: ld %f0, 0(%r2)
52 %ptr = getelementptr double, double *%src, i64 65536
53 %val = load double, double *%ptr
57 ; Check the high end of the negative aligned LDY range.
58 define double @f6(double *%src) {
60 ; CHECK: ldy %f0, -8(%r2)
62 %ptr = getelementptr double, double *%src, i64 -1
63 %val = load double, double *%ptr
67 ; Check the low end of the LDY range.
68 define double @f7(double *%src) {
70 ; CHECK: ldy %f0, -524288(%r2)
72 %ptr = getelementptr double, double *%src, i64 -65536
73 %val = load double, double *%ptr
77 ; Check the next doubleword down, which needs separate address logic.
78 ; Other sequences besides this one would be OK.
79 define double @f8(double *%src) {
81 ; CHECK: agfi %r2, -524296
82 ; CHECK: ld %f0, 0(%r2)
84 %ptr = getelementptr double, double *%src, i64 -65537
85 %val = load double, double *%ptr
89 ; Check that LD allows an index.
90 define double @f9(i64 %src, i64 %index) {
92 ; CHECK: ld %f0, 4095({{%r3,%r2|%r2,%r3}})
94 %add1 = add i64 %src, %index
95 %add2 = add i64 %add1, 4095
96 %ptr = inttoptr i64 %add2 to double *
97 %val = load double, double *%ptr
101 ; Check that LDY allows an index.
102 define double @f10(i64 %src, i64 %index) {
104 ; CHECK: ldy %f0, 4096({{%r3,%r2|%r2,%r3}})
106 %add1 = add i64 %src, %index
107 %add2 = add i64 %add1, 4096
108 %ptr = inttoptr i64 %add2 to double *
109 %val = load double, double *%ptr