1 ; Test moves of integers to 8-byte memory locations. 2 ; 3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 4 5 ; Check moves of zero. 6 define void @f1(i64 *%a) { 7 ; CHECK-LABEL: f1: 8 ; CHECK: mvghi 0(%r2), 0 9 ; CHECK: br %r14 10 store i64 0, i64 *%a 11 ret void 12 } 13 14 ; Check the high end of the signed 16-bit range. 15 define void @f2(i64 *%a) { 16 ; CHECK-LABEL: f2: 17 ; CHECK: mvghi 0(%r2), 32767 18 ; CHECK: br %r14 19 store i64 32767, i64 *%a 20 ret void 21 } 22 23 ; Check the next value up, which can't use MVGHI. 24 define void @f3(i64 *%a) { 25 ; CHECK-LABEL: f3: 26 ; CHECK-NOT: mvghi 27 ; CHECK: br %r14 28 store i64 32768, i64 *%a 29 ret void 30 } 31 32 ; Check moves of -1. 33 define void @f4(i64 *%a) { 34 ; CHECK-LABEL: f4: 35 ; CHECK: mvghi 0(%r2), -1 36 ; CHECK: br %r14 37 store i64 -1, i64 *%a 38 ret void 39 } 40 41 ; Check the low end of the MVGHI range. 42 define void @f5(i64 *%a) { 43 ; CHECK-LABEL: f5: 44 ; CHECK: mvghi 0(%r2), -32768 45 ; CHECK: br %r14 46 store i64 -32768, i64 *%a 47 ret void 48 } 49 50 ; Check the next value down, which can't use MVGHI. 51 define void @f6(i64 *%a) { 52 ; CHECK-LABEL: f6: 53 ; CHECK-NOT: mvghi 54 ; CHECK: br %r14 55 store i64 -32769, i64 *%a 56 ret void 57 } 58 59 ; Check the high end of the MVGHI range. 60 define void @f7(i64 *%a) { 61 ; CHECK-LABEL: f7: 62 ; CHECK: mvghi 4088(%r2), 42 63 ; CHECK: br %r14 64 %ptr = getelementptr i64 *%a, i64 511 65 store i64 42, i64 *%ptr 66 ret void 67 } 68 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) { 72 ; CHECK-LABEL: f8: 73 ; CHECK: aghi %r2, 4096 74 ; CHECK: mvghi 0(%r2), 42 75 ; CHECK: br %r14 76 %ptr = getelementptr i64 *%a, i64 512 77 store i64 42, i64 *%ptr 78 ret void 79 } 80 81 ; Check negative displacements, which also need separate address logic. 82 define void @f9(i64 *%a) { 83 ; CHECK-LABEL: f9: 84 ; CHECK: aghi %r2, -8 85 ; CHECK: mvghi 0(%r2), 42 86 ; CHECK: br %r14 87 %ptr = getelementptr i64 *%a, i64 -1 88 store i64 42, i64 *%ptr 89 ret void 90 } 91 92 ; Check that MVGHI does not allow an index 93 define void @f10(i64 %src, i64 %index) { 94 ; CHECK-LABEL: f10: 95 ; CHECK: agr %r2, %r3 96 ; CHECK: mvghi 0(%r2), 42 97 ; CHECK: br %r14 98 %add = add i64 %src, %index 99 %ptr = inttoptr i64 %add to i64 * 100 store i64 42, i64 *%ptr 101 ret void 102 } 103