1 ; Test 64-bit GPR loads.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 ; Check LG with no displacement.
6 define i64 @f1(ptr %src) {
8 ; CHECK: lg %r2, 0(%r2)
10 %val = load i64, ptr %src
14 ; Check the high end of the aligned LG range.
15 define i64 @f2(ptr %src) {
17 ; CHECK: lg %r2, 524280(%r2)
19 %ptr = getelementptr i64, ptr %src, i64 65535
20 %val = load i64, ptr %ptr
24 ; Check the next doubleword up, which needs separate address logic.
25 ; Other sequences besides this one would be OK.
26 define i64 @f3(ptr %src) {
28 ; CHECK: agfi %r2, 524288
29 ; CHECK: lg %r2, 0(%r2)
31 %ptr = getelementptr i64, ptr %src, i64 65536
32 %val = load i64, ptr %ptr
36 ; Check the high end of the negative aligned LG range.
37 define i64 @f4(ptr %src) {
39 ; CHECK: lg %r2, -8(%r2)
41 %ptr = getelementptr i64, ptr %src, i64 -1
42 %val = load i64, ptr %ptr
46 ; Check the low end of the LG range.
47 define i64 @f5(ptr %src) {
49 ; CHECK: lg %r2, -524288(%r2)
51 %ptr = getelementptr i64, ptr %src, i64 -65536
52 %val = load i64, ptr %ptr
56 ; Check the next doubleword down, which needs separate address logic.
57 ; Other sequences besides this one would be OK.
58 define i64 @f6(ptr %src) {
60 ; CHECK: agfi %r2, -524296
61 ; CHECK: lg %r2, 0(%r2)
63 %ptr = getelementptr i64, ptr %src, i64 -65537
64 %val = load i64, ptr %ptr
68 ; Check that LG allows an index.
69 define i64 @f7(i64 %src, i64 %index) {
71 ; CHECK: lg %r2, 524287({{%r3,%r2|%r2,%r3}})
73 %add1 = add i64 %src, %index
74 %add2 = add i64 %add1, 524287
75 %ptr = inttoptr i64 %add2 to ptr
76 %val = load i64, ptr %ptr