1 ; Test moves of integers to 8-byte memory locations.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
6 define void @f1(i64 *%a) {
8 ; CHECK: mvghi 0(%r2), 0
14 ; Check the high end of the signed 16-bit range.
15 define void @f2(i64 *%a) {
17 ; CHECK: mvghi 0(%r2), 32767
19 store i64 32767, i64 *%a
23 ; Check the next value up, which can't use MVGHI.
24 define void @f3(i64 *%a) {
28 store i64 32768, i64 *%a
33 define void @f4(i64 *%a) {
35 ; CHECK: mvghi 0(%r2), -1
41 ; Check the low end of the MVGHI range.
42 define void @f5(i64 *%a) {
44 ; CHECK: mvghi 0(%r2), -32768
46 store i64 -32768, i64 *%a
50 ; Check the next value down, which can't use MVGHI.
51 define void @f6(i64 *%a) {
55 store i64 -32769, i64 *%a
59 ; Check the high end of the MVGHI range.
60 define void @f7(i64 *%a) {
62 ; CHECK: mvghi 4088(%r2), 42
64 %ptr = getelementptr i64 *%a, i64 511
65 store i64 42, i64 *%ptr
69 ; Check the next doubleword up, which needs separate address logic.
70 ; Other sequences besides this one would be OK.
71 define void @f8(i64 *%a) {
73 ; CHECK: aghi %r2, 4096
74 ; CHECK: mvghi 0(%r2), 42
76 %ptr = getelementptr i64 *%a, i64 512
77 store i64 42, i64 *%ptr
81 ; Check negative displacements, which also need separate address logic.
82 define void @f9(i64 *%a) {
85 ; CHECK: mvghi 0(%r2), 42
87 %ptr = getelementptr i64 *%a, i64 -1
88 store i64 42, i64 *%ptr
92 ; Check that MVGHI does not allow an index
93 define void @f10(i64 %src, i64 %index) {
96 ; CHECK: mvghi 0(%r2), 42
98 %add = add i64 %src, %index
99 %ptr = inttoptr i64 %add to i64 *
100 store i64 42, i64 *%ptr