1 ; Test the "R" asm constraint, which accepts addresses that have a base,
2 ; an index and a 12-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) {
11 %addr = inttoptr i64 %base to ptr
12 call void asm "blah $0", "=*R" (ptr elementtype(i64) %addr)
16 ; Check the next lowest byte.
17 define void @f2(i64 %base) {
22 %add = add i64 %base, -1
23 %addr = inttoptr i64 %add to ptr
24 call void asm "blah $0", "=*R" (ptr elementtype(i64) %addr)
28 ; Check the highest range.
29 define void @f3(i64 %base) {
31 ; CHECK: blah 4095(%r2)
33 %add = add i64 %base, 4095
34 %addr = inttoptr i64 %add to ptr
35 call void asm "blah $0", "=*R" (ptr elementtype(i64) %addr)
39 ; Check the next highest byte.
40 define void @f4(i64 %base) {
42 ; CHECK: aghi %r2, 4096
45 %add = add i64 %base, 4096
46 %addr = inttoptr i64 %add to ptr
47 call void asm "blah $0", "=*R" (ptr elementtype(i64) %addr)
51 ; Check that indices are allowed
52 define void @f5(i64 %base, i64 %index) {
54 ; CHECK: blah 0(%r3,%r2)
56 %add = add i64 %base, %index
57 %addr = inttoptr i64 %add to ptr
58 call void asm "blah $0", "=*R" (ptr elementtype(i64) %addr)
62 ; Check that indices and displacements are allowed simultaneously
63 define void @f6(i64 %base, i64 %index) {
65 ; CHECK: blah 4095(%r3,%r2)
67 %add = add i64 %base, 4095
68 %addi = add i64 %add, %index
69 %addr = inttoptr i64 %addi to ptr
70 call void asm "blah $0", "=*R" (ptr elementtype(i64) %addr)
74 ; Check that LAY is used if there is an index but the displacement is too large
75 define void @f7(i64 %base, i64 %index) {
77 ; CHECK: lay %r1, 4096(%r3,%r2)
80 %add = add i64 %base, 4096
81 %addi = add i64 %add, %index
82 %addr = inttoptr i64 %addi to ptr
83 call void asm "blah $0", "=*R" (ptr elementtype(i64) %addr)