1 ; Test 32-bit GPR stores.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
6 define void @f1(ptr %dst, i32 %val) {
8 ; CHECK: st %r3, 0(%r2)
10 store i32 %val, ptr %dst
14 ; Test a truncating i64 store.
15 define void @f2(ptr %dst, i64 %val) {
16 %word = trunc i64 %val to i32
17 store i32 %word, ptr %dst
21 ; Check the high end of the aligned ST range.
22 define void @f3(ptr %dst, i32 %val) {
24 ; CHECK: st %r3, 4092(%r2)
26 %ptr = getelementptr i32, ptr %dst, i64 1023
27 store i32 %val, ptr %ptr
31 ; Check the next word up, which should use STY instead of ST.
32 define void @f4(ptr %dst, i32 %val) {
34 ; CHECK: sty %r3, 4096(%r2)
36 %ptr = getelementptr i32, ptr %dst, i64 1024
37 store i32 %val, ptr %ptr
41 ; Check the high end of the aligned STY range.
42 define void @f5(ptr %dst, i32 %val) {
44 ; CHECK: sty %r3, 524284(%r2)
46 %ptr = getelementptr i32, ptr %dst, i64 131071
47 store i32 %val, ptr %ptr
51 ; Check the next word up, which needs separate address logic.
52 ; Other sequences besides this one would be OK.
53 define void @f6(ptr %dst, i32 %val) {
55 ; CHECK: agfi %r2, 524288
56 ; CHECK: st %r3, 0(%r2)
58 %ptr = getelementptr i32, ptr %dst, i64 131072
59 store i32 %val, ptr %ptr
63 ; Check the high end of the negative aligned STY range.
64 define void @f7(ptr %dst, i32 %val) {
66 ; CHECK: sty %r3, -4(%r2)
68 %ptr = getelementptr i32, ptr %dst, i64 -1
69 store i32 %val, ptr %ptr
73 ; Check the low end of the STY range.
74 define void @f8(ptr %dst, i32 %val) {
76 ; CHECK: sty %r3, -524288(%r2)
78 %ptr = getelementptr i32, ptr %dst, i64 -131072
79 store i32 %val, ptr %ptr
83 ; Check the next word down, which needs separate address logic.
84 ; Other sequences besides this one would be OK.
85 define void @f9(ptr %dst, i32 %val) {
87 ; CHECK: agfi %r2, -524292
88 ; CHECK: st %r3, 0(%r2)
90 %ptr = getelementptr i32, ptr %dst, i64 -131073
91 store i32 %val, ptr %ptr
95 ; Check that ST allows an index.
96 define void @f10(i64 %dst, i64 %index, i32 %val) {
98 ; CHECK: st %r4, 4095(%r3,%r2)
100 %add1 = add i64 %dst, %index
101 %add2 = add i64 %add1, 4095
102 %ptr = inttoptr i64 %add2 to ptr
103 store i32 %val, ptr %ptr
107 ; Check that STY allows an index.
108 define void @f11(i64 %dst, i64 %index, i32 %val) {
110 ; CHECK: sty %r4, 4096(%r3,%r2)
112 %add1 = add i64 %dst, %index
113 %add2 = add i64 %add1, 4096
114 %ptr = inttoptr i64 %add2 to ptr
115 store i32 %val, ptr %ptr