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