1 ; Test 32-bit GPR loads.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 ; Check the low end of the L range.
6 define i32 @f1(i32 *%src) {
10 %val = load i32, i32 *%src
14 ; Check the high end of the aligned L range.
15 define i32 @f2(i32 *%src) {
17 ; CHECK: l %r2, 4092(%r2)
19 %ptr = getelementptr i32, i32 *%src, i64 1023
20 %val = load i32, i32 *%ptr
24 ; Check the next word up, which should use LY instead of L.
25 define i32 @f3(i32 *%src) {
27 ; CHECK: ly %r2, 4096(%r2)
29 %ptr = getelementptr i32, i32 *%src, i64 1024
30 %val = load i32, i32 *%ptr
34 ; Check the high end of the aligned LY range.
35 define i32 @f4(i32 *%src) {
37 ; CHECK: ly %r2, 524284(%r2)
39 %ptr = getelementptr i32, i32 *%src, i64 131071
40 %val = load i32, i32 *%ptr
44 ; Check the next word up, which needs separate address logic.
45 ; Other sequences besides this one would be OK.
46 define i32 @f5(i32 *%src) {
48 ; CHECK: agfi %r2, 524288
49 ; CHECK: l %r2, 0(%r2)
51 %ptr = getelementptr i32, i32 *%src, i64 131072
52 %val = load i32, i32 *%ptr
56 ; Check the high end of the negative aligned LY range.
57 define i32 @f6(i32 *%src) {
59 ; CHECK: ly %r2, -4(%r2)
61 %ptr = getelementptr i32, i32 *%src, i64 -1
62 %val = load i32, i32 *%ptr
66 ; Check the low end of the LY range.
67 define i32 @f7(i32 *%src) {
69 ; CHECK: ly %r2, -524288(%r2)
71 %ptr = getelementptr i32, i32 *%src, i64 -131072
72 %val = load i32, i32 *%ptr
76 ; Check the next word down, which needs separate address logic.
77 ; Other sequences besides this one would be OK.
78 define i32 @f8(i32 *%src) {
80 ; CHECK: agfi %r2, -524292
81 ; CHECK: l %r2, 0(%r2)
83 %ptr = getelementptr i32, i32 *%src, i64 -131073
84 %val = load i32, i32 *%ptr
88 ; Check that L allows an index.
89 define i32 @f9(i64 %src, i64 %index) {
91 ; CHECK: l %r2, 4095({{%r3,%r2|%r2,%r3}})
93 %add1 = add i64 %src, %index
94 %add2 = add i64 %add1, 4095
95 %ptr = inttoptr i64 %add2 to i32 *
96 %val = load i32, i32 *%ptr
100 ; Check that LY allows an index.
101 define i32 @f10(i64 %src, i64 %index) {
103 ; CHECK: ly %r2, 4096({{%r3,%r2|%r2,%r3}})
105 %add1 = add i64 %src, %index
106 %add2 = add i64 %add1, 4096
107 %ptr = inttoptr i64 %add2 to i32 *
108 %val = load i32, i32 *%ptr