• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test the "T" asm constraint, which accepts addresses that have a base,
2; an index and a 20-bit displacement.
3;
4; RUN: llc < %s -mtriple=s390x-linux-gnu -no-integrated-as | FileCheck %s
5
6; Check the lowest range.
7define void @f1(i64 %base) {
8; CHECK-LABEL: f1:
9; CHECK: blah -524288(%r2)
10; CHECK: br %r14
11  %add = add i64 %base, -524288
12  %addr = inttoptr i64 %add to i64 *
13  call void asm "blah $0", "=*T" (i64 *%addr)
14  ret void
15}
16
17; Check the next lowest byte.
18define void @f2(i64 %base) {
19; CHECK-LABEL: f2:
20; CHECK: agfi %r2, -524289
21; CHECK: blah 0(%r2)
22; CHECK: br %r14
23  %add = add i64 %base, -524289
24  %addr = inttoptr i64 %add to i64 *
25  call void asm "blah $0", "=*T" (i64 *%addr)
26  ret void
27}
28
29; Check the highest range.
30define void @f3(i64 %base) {
31; CHECK-LABEL: f3:
32; CHECK: blah 524287(%r2)
33; CHECK: br %r14
34  %add = add i64 %base, 524287
35  %addr = inttoptr i64 %add to i64 *
36  call void asm "blah $0", "=*T" (i64 *%addr)
37  ret void
38}
39
40; Check the next highest byte.
41define void @f4(i64 %base) {
42; CHECK-LABEL: f4:
43; CHECK: agfi %r2, 524288
44; CHECK: blah 0(%r2)
45; CHECK: br %r14
46  %add = add i64 %base, 524288
47  %addr = inttoptr i64 %add to i64 *
48  call void asm "blah $0", "=*T" (i64 *%addr)
49  ret void
50}
51
52; Check that indices are allowed
53define void @f5(i64 %base, i64 %index) {
54; CHECK-LABEL: f5:
55; CHECK: blah 0(%r3,%r2)
56; CHECK: br %r14
57  %add = add i64 %base, %index
58  %addr = inttoptr i64 %add to i64 *
59  call void asm "blah $0", "=*T" (i64 *%addr)
60  ret void
61}
62
63; Check that indices and displacements are allowed simultaneously
64define void @f6(i64 %base, i64 %index) {
65; CHECK-LABEL: f6:
66; CHECK: blah 524287(%r3,%r2)
67; CHECK: br %r14
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)
72  ret void
73}
74