1 ; Test moves of integers to 8-byte memory locations.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
6 define void @f1(ptr %a) {
8 ; CHECK: mvghi 0(%r2), 0
14 ; Check the high end of the signed 16-bit range.
15 define void @f2(ptr %a) {
17 ; CHECK: mvghi 0(%r2), 32767
19 store i64 32767, ptr %a
23 ; Check the next value up, which can't use MVGHI.
24 define void @f3(ptr %a) {
28 store i64 32768, ptr %a
33 define void @f4(ptr %a) {
35 ; CHECK: mvghi 0(%r2), -1
41 ; Check the low end of the MVGHI range.
42 define void @f5(ptr %a) {
44 ; CHECK: mvghi 0(%r2), -32768
46 store i64 -32768, ptr %a
50 ; Check the next value down, which can't use MVGHI.
51 define void @f6(ptr %a) {
55 store i64 -32769, ptr %a
59 ; Check the high end of the MVGHI range.
60 define void @f7(ptr %a) {
62 ; CHECK: mvghi 4088(%r2), 42
64 %ptr = getelementptr i64, ptr %a, i64 511
65 store i64 42, ptr %ptr
69 ; Check the next doubleword up, which is out of range. We prefer STG
71 define void @f8(ptr %a) {
73 ; CHECK: lghi [[TMP:%r[0-5]]], 42
74 ; CHECK: stg [[TMP]], 4096(%r2)
76 %ptr = getelementptr i64, ptr %a, i64 512
77 store i64 42, ptr %ptr
81 ; Check negative displacements, for which we again prefer STG.
82 define void @f9(ptr %a) {
84 ; CHECK: lghi [[TMP:%r[0-5]]], 42
85 ; CHECK: stg [[TMP]], -8(%r2)
87 %ptr = getelementptr i64, ptr %a, i64 -1
88 store i64 42, ptr %ptr
92 ; Check that MVGHI does not allow an index.
93 define void @f10(i64 %src, i64 %index) {
95 ; CHECK: lghi [[TMP:%r[0-5]]], 42
96 ; CHECK: stg [[TMP]], 0({{%r2,%r3|%r3,%r2}})
98 %add = add i64 %src, %index
99 %ptr = inttoptr i64 %add to ptr
100 store i64 42, ptr %ptr