1 ; Test moves of integers to 4-byte memory locations.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
6 define void @f1(ptr %a) {
8 ; CHECK: mvhi 0(%r2), 0
14 ; Check the high end of the signed 16-bit range.
15 define void @f2(ptr %a) {
17 ; CHECK: mvhi 0(%r2), 32767
19 store i32 32767, ptr %a
23 ; Check the next value up, which can't use MVHI.
24 define void @f3(ptr %a) {
28 store i32 32768, ptr %a
33 define void @f4(ptr %a) {
35 ; CHECK: mvhi 0(%r2), -1
41 ; Check the low end of the MVHI range.
42 define void @f5(ptr %a) {
44 ; CHECK: mvhi 0(%r2), -32768
46 store i32 -32768, ptr %a
50 ; Check the next value down, which can't use MVHI.
51 define void @f6(ptr %a) {
55 store i32 -32769, ptr %a
59 ; Check the high end of the MVHI range.
60 define void @f7(ptr %a) {
62 ; CHECK: mvhi 4092(%r2), 42
64 %ptr = getelementptr i32, ptr %a, i64 1023
65 store i32 42, ptr %ptr
69 ; Check the next word up, which is out of range. We prefer STY in that case.
70 define void @f8(ptr %a) {
72 ; CHECK: lhi [[TMP:%r[0-5]]], 42
73 ; CHECK: sty [[TMP]], 4096(%r2)
75 %ptr = getelementptr i32, ptr %a, i64 1024
76 store i32 42, ptr %ptr
80 ; Check negative displacements, for which we again prefer STY.
81 define void @f9(ptr %a) {
83 ; CHECK: lhi [[TMP:%r[0-5]]], 42
84 ; CHECK: sty [[TMP]], -4(%r2)
86 %ptr = getelementptr i32, ptr %a, i64 -1
87 store i32 42, ptr %ptr
91 ; Check that MVHI does not allow an index.
92 define void @f10(i64 %src, i64 %index) {
94 ; CHECK: lhi [[TMP:%r[0-5]]], 42
95 ; CHECK: st [[TMP]], 0({{%r2,%r3|%r3,%r2}})
97 %add = add i64 %src, %index
98 %ptr = inttoptr i64 %add to ptr
99 store i32 42, ptr %ptr