1 ; Test 64-bit addition in which the second operand is variable.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
8 define i64 @f1(i64 %a, i64 %b) {
10 ; CHECK: msgr %r2, %r3
16 ; Check MSG with no displacement.
17 define i64 @f2(i64 %a, i64 *%src) {
19 ; CHECK: msg %r2, 0(%r3)
21 %b = load i64, i64 *%src
26 ; Check the high end of the aligned MSG range.
27 define i64 @f3(i64 %a, i64 *%src) {
29 ; CHECK: msg %r2, 524280(%r3)
31 %ptr = getelementptr i64, i64 *%src, i64 65535
32 %b = load i64, i64 *%ptr
37 ; Check the next doubleword up, which needs separate address logic.
38 ; Other sequences besides this one would be OK.
39 define i64 @f4(i64 %a, i64 *%src) {
41 ; CHECK: agfi %r3, 524288
42 ; CHECK: msg %r2, 0(%r3)
44 %ptr = getelementptr i64, i64 *%src, i64 65536
45 %b = load i64, i64 *%ptr
50 ; Check the high end of the negative aligned MSG range.
51 define i64 @f5(i64 %a, i64 *%src) {
53 ; CHECK: msg %r2, -8(%r3)
55 %ptr = getelementptr i64, i64 *%src, i64 -1
56 %b = load i64, i64 *%ptr
61 ; Check the low end of the MSG range.
62 define i64 @f6(i64 %a, i64 *%src) {
64 ; CHECK: msg %r2, -524288(%r3)
66 %ptr = getelementptr i64, i64 *%src, i64 -65536
67 %b = load i64, i64 *%ptr
72 ; Check the next doubleword down, which needs separate address logic.
73 ; Other sequences besides this one would be OK.
74 define i64 @f7(i64 %a, i64 *%src) {
76 ; CHECK: agfi %r3, -524296
77 ; CHECK: msg %r2, 0(%r3)
79 %ptr = getelementptr i64, i64 *%src, i64 -65537
80 %b = load i64, i64 *%ptr
85 ; Check that MSG allows an index.
86 define i64 @f8(i64 %a, i64 %src, i64 %index) {
88 ; CHECK: msg %r2, 524280({{%r4,%r3|%r3,%r4}})
90 %add1 = add i64 %src, %index
91 %add2 = add i64 %add1, 524280
92 %ptr = inttoptr i64 %add2 to i64 *
93 %b = load i64, i64 *%ptr
98 ; Check that multiplications of spilled values can use MSG rather than MSGR.
99 define i64 @f9(i64 *%ptr0) {
101 ; CHECK: brasl %r14, foo@PLT
102 ; CHECK: msg %r2, 160(%r15)
104 %ptr1 = getelementptr i64, i64 *%ptr0, i64 2
105 %ptr2 = getelementptr i64, i64 *%ptr0, i64 4
106 %ptr3 = getelementptr i64, i64 *%ptr0, i64 6
107 %ptr4 = getelementptr i64, i64 *%ptr0, i64 8
108 %ptr5 = getelementptr i64, i64 *%ptr0, i64 10
109 %ptr6 = getelementptr i64, i64 *%ptr0, i64 12
110 %ptr7 = getelementptr i64, i64 *%ptr0, i64 14
111 %ptr8 = getelementptr i64, i64 *%ptr0, i64 16
112 %ptr9 = getelementptr i64, i64 *%ptr0, i64 18
114 %val0 = load i64, i64 *%ptr0
115 %val1 = load i64, i64 *%ptr1
116 %val2 = load i64, i64 *%ptr2
117 %val3 = load i64, i64 *%ptr3
118 %val4 = load i64, i64 *%ptr4
119 %val5 = load i64, i64 *%ptr5
120 %val6 = load i64, i64 *%ptr6
121 %val7 = load i64, i64 *%ptr7
122 %val8 = load i64, i64 *%ptr8
123 %val9 = load i64, i64 *%ptr9
125 %ret = call i64 @foo()
127 %mul0 = mul i64 %ret, %val0
128 %mul1 = mul i64 %mul0, %val1
129 %mul2 = mul i64 %mul1, %val2
130 %mul3 = mul i64 %mul2, %val3
131 %mul4 = mul i64 %mul3, %val4
132 %mul5 = mul i64 %mul4, %val5
133 %mul6 = mul i64 %mul5, %val6
134 %mul7 = mul i64 %mul6, %val7
135 %mul8 = mul i64 %mul7, %val8
136 %mul9 = mul i64 %mul8, %val9