1 ; Test 32-bit multiplication in which the second operand is variable.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
6 define i32 @f1(i32 %a, i32 %b) {
14 ; Check the low end of the MS range.
15 define i32 @f2(i32 %a, i32 *%src) {
17 ; CHECK: ms %r2, 0(%r3)
24 ; Check the high end of the aligned MS range.
25 define i32 @f3(i32 %a, i32 *%src) {
27 ; CHECK: ms %r2, 4092(%r3)
29 %ptr = getelementptr i32 *%src, i64 1023
35 ; Check the next word up, which should use MSY instead of MS.
36 define i32 @f4(i32 %a, i32 *%src) {
38 ; CHECK: msy %r2, 4096(%r3)
40 %ptr = getelementptr i32 *%src, i64 1024
46 ; Check the high end of the aligned MSY range.
47 define i32 @f5(i32 %a, i32 *%src) {
49 ; CHECK: msy %r2, 524284(%r3)
51 %ptr = getelementptr i32 *%src, i64 131071
57 ; Check the next word up, which needs separate address logic.
58 ; Other sequences besides this one would be OK.
59 define i32 @f6(i32 %a, i32 *%src) {
61 ; CHECK: agfi %r3, 524288
62 ; CHECK: ms %r2, 0(%r3)
64 %ptr = getelementptr i32 *%src, i64 131072
70 ; Check the high end of the negative aligned MSY range.
71 define i32 @f7(i32 %a, i32 *%src) {
73 ; CHECK: msy %r2, -4(%r3)
75 %ptr = getelementptr i32 *%src, i64 -1
81 ; Check the low end of the MSY range.
82 define i32 @f8(i32 %a, i32 *%src) {
84 ; CHECK: msy %r2, -524288(%r3)
86 %ptr = getelementptr i32 *%src, i64 -131072
92 ; Check the next word down, which needs separate address logic.
93 ; Other sequences besides this one would be OK.
94 define i32 @f9(i32 %a, i32 *%src) {
96 ; CHECK: agfi %r3, -524292
97 ; CHECK: ms %r2, 0(%r3)
99 %ptr = getelementptr i32 *%src, i64 -131073
101 %mul = mul i32 %a, %b
105 ; Check that MS allows an index.
106 define i32 @f10(i32 %a, i64 %src, i64 %index) {
108 ; CHECK: ms %r2, 4092({{%r4,%r3|%r3,%r4}})
110 %add1 = add i64 %src, %index
111 %add2 = add i64 %add1, 4092
112 %ptr = inttoptr i64 %add2 to i32 *
114 %mul = mul i32 %a, %b
118 ; Check that MSY allows an index.
119 define i32 @f11(i32 %a, i64 %src, i64 %index) {
121 ; CHECK: msy %r2, 4096({{%r4,%r3|%r3,%r4}})
123 %add1 = add i64 %src, %index
124 %add2 = add i64 %add1, 4096
125 %ptr = inttoptr i64 %add2 to i32 *
127 %mul = mul i32 %a, %b