1 ; Test subtractions of a sign-extended i32 from an i64.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
6 define i64 @f1(i64 %a, i32 %b) {
10 %bext = sext i32 %b to i64
11 %sub = sub i64 %a, %bext
15 ; Check SGF with no displacement.
16 define i64 @f2(i64 %a, i32 *%src) {
18 ; CHECK: sgf %r2, 0(%r3)
21 %bext = sext i32 %b to i64
22 %sub = sub i64 %a, %bext
26 ; Check the high end of the aligned SGF range.
27 define i64 @f3(i64 %a, i32 *%src) {
29 ; CHECK: sgf %r2, 524284(%r3)
31 %ptr = getelementptr i32 *%src, i64 131071
33 %bext = sext i32 %b to i64
34 %sub = sub i64 %a, %bext
38 ; Check the next word up, which needs separate address logic.
39 ; Other sequences besides this one would be OK.
40 define i64 @f4(i64 %a, i32 *%src) {
42 ; CHECK: agfi %r3, 524288
43 ; CHECK: sgf %r2, 0(%r3)
45 %ptr = getelementptr i32 *%src, i64 131072
47 %bext = sext i32 %b to i64
48 %sub = sub i64 %a, %bext
52 ; Check the high end of the negative aligned SGF range.
53 define i64 @f5(i64 %a, i32 *%src) {
55 ; CHECK: sgf %r2, -4(%r3)
57 %ptr = getelementptr i32 *%src, i64 -1
59 %bext = sext i32 %b to i64
60 %sub = sub i64 %a, %bext
64 ; Check the low end of the SGF range.
65 define i64 @f6(i64 %a, i32 *%src) {
67 ; CHECK: sgf %r2, -524288(%r3)
69 %ptr = getelementptr i32 *%src, i64 -131072
71 %bext = sext i32 %b to i64
72 %sub = sub i64 %a, %bext
76 ; Check the next word down, which needs separate address logic.
77 ; Other sequences besides this one would be OK.
78 define i64 @f7(i64 %a, i32 *%src) {
80 ; CHECK: agfi %r3, -524292
81 ; CHECK: sgf %r2, 0(%r3)
83 %ptr = getelementptr i32 *%src, i64 -131073
85 %bext = sext i32 %b to i64
86 %sub = sub i64 %a, %bext
90 ; Check that SGF allows an index.
91 define i64 @f8(i64 %a, i64 %src, i64 %index) {
93 ; CHECK: sgf %r2, 524284({{%r4,%r3|%r3,%r4}})
95 %add1 = add i64 %src, %index
96 %add2 = add i64 %add1, 524284
97 %ptr = inttoptr i64 %add2 to i32 *
99 %bext = sext i32 %b to i64
100 %sub = sub i64 %a, %bext