1 ; Test the "T" asm constraint, which accepts addresses that have a base,
2 ; an index and a 20-bit displacement.
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu -no-integrated-as | FileCheck %s
6 ; Check the lowest range.
7 define void @f1(i64 %base) {
9 ; CHECK: blah -524288(%r2)
11 %add = add i64 %base, -524288
12 %addr = inttoptr i64 %add to i64 *
13 call void asm "blah $0", "=*T" (i64 *%addr)
17 ; Check the next lowest byte.
18 define void @f2(i64 %base) {
20 ; CHECK: agfi %r2, -524289
23 %add = add i64 %base, -524289
24 %addr = inttoptr i64 %add to i64 *
25 call void asm "blah $0", "=*T" (i64 *%addr)
29 ; Check the highest range.
30 define void @f3(i64 %base) {
32 ; CHECK: blah 524287(%r2)
34 %add = add i64 %base, 524287
35 %addr = inttoptr i64 %add to i64 *
36 call void asm "blah $0", "=*T" (i64 *%addr)
40 ; Check the next highest byte.
41 define void @f4(i64 %base) {
43 ; CHECK: agfi %r2, 524288
46 %add = add i64 %base, 524288
47 %addr = inttoptr i64 %add to i64 *
48 call void asm "blah $0", "=*T" (i64 *%addr)
52 ; Check that indices are allowed
53 define void @f5(i64 %base, i64 %index) {
55 ; CHECK: blah 0(%r3,%r2)
57 %add = add i64 %base, %index
58 %addr = inttoptr i64 %add to i64 *
59 call void asm "blah $0", "=*T" (i64 *%addr)
63 ; Check that indices and displacements are allowed simultaneously
64 define void @f6(i64 %base, i64 %index) {
66 ; CHECK: blah 524287(%r3,%r2)
68 %add = add i64 %base, 524287
69 %addi = add i64 %add, %index
70 %addr = inttoptr i64 %addi to i64 *
71 call void asm "blah $0", "=*T" (i64 *%addr)