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