1; Test 32-bit floating-point loads.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5; Test the low end of the LE range.
6define float @f1(float *%src) {
7; CHECK-LABEL: f1:
8; CHECK: le %f0, 0(%r2)
9; CHECK: br %r14
10  %val = load float , float *%src
11  ret float %val
12}
13
14; Test the high end of the LE range.
15define float @f2(float *%src) {
16; CHECK-LABEL: f2:
17; CHECK: le %f0, 4092(%r2)
18; CHECK: br %r14
19  %ptr = getelementptr float, float *%src, i64 1023
20  %val = load float , float *%ptr
21  ret float %val
22}
23
24; Check the next word up, which should use LEY instead of LE.
25define float @f3(float *%src) {
26; CHECK-LABEL: f3:
27; CHECK: ley %f0, 4096(%r2)
28; CHECK: br %r14
29  %ptr = getelementptr float, float *%src, i64 1024
30  %val = load float , float *%ptr
31  ret float %val
32}
33
34; Check the high end of the aligned LEY range.
35define float @f4(float *%src) {
36; CHECK-LABEL: f4:
37; CHECK: ley %f0, 524284(%r2)
38; CHECK: br %r14
39  %ptr = getelementptr float, float *%src, i64 131071
40  %val = load float , float *%ptr
41  ret float %val
42}
43
44; Check the next word up, which needs separate address logic.
45; Other sequences besides this one would be OK.
46define float @f5(float *%src) {
47; CHECK-LABEL: f5:
48; CHECK: agfi %r2, 524288
49; CHECK: le %f0, 0(%r2)
50; CHECK: br %r14
51  %ptr = getelementptr float, float *%src, i64 131072
52  %val = load float , float *%ptr
53  ret float %val
54}
55
56; Check the high end of the negative aligned LEY range.
57define float @f6(float *%src) {
58; CHECK-LABEL: f6:
59; CHECK: ley %f0, -4(%r2)
60; CHECK: br %r14
61  %ptr = getelementptr float, float *%src, i64 -1
62  %val = load float , float *%ptr
63  ret float %val
64}
65
66; Check the low end of the LEY range.
67define float @f7(float *%src) {
68; CHECK-LABEL: f7:
69; CHECK: ley %f0, -524288(%r2)
70; CHECK: br %r14
71  %ptr = getelementptr float, float *%src, i64 -131072
72  %val = load float , float *%ptr
73  ret float %val
74}
75
76; Check the next word down, which needs separate address logic.
77; Other sequences besides this one would be OK.
78define float @f8(float *%src) {
79; CHECK-LABEL: f8:
80; CHECK: agfi %r2, -524292
81; CHECK: le %f0, 0(%r2)
82; CHECK: br %r14
83  %ptr = getelementptr float, float *%src, i64 -131073
84  %val = load float , float *%ptr
85  ret float %val
86}
87
88; Check that LE allows an index.
89define float @f9(i64 %src, i64 %index) {
90; CHECK-LABEL: f9:
91; CHECK: le %f0, 4092({{%r3,%r2|%r2,%r3}})
92; CHECK: br %r14
93  %add1 = add i64 %src, %index
94  %add2 = add i64 %add1, 4092
95  %ptr = inttoptr i64 %add2 to float *
96  %val = load float , float *%ptr
97  ret float %val
98}
99
100; Check that LEY allows an index.
101define float @f10(i64 %src, i64 %index) {
102; CHECK-LABEL: f10:
103; CHECK: ley %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 float *
108  %val = load float , float *%ptr
109  ret float %val
110}
111