xref: /aosp_15_r20/external/llvm/test/CodeGen/SystemZ/asm-03.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; Test the "S" asm constraint, which accepts addresses that have a base
2*9880d681SAndroid Build Coastguard Worker; and a 20-bit displacement.
3*9880d681SAndroid Build Coastguard Worker;
4*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=s390x-linux-gnu -no-integrated-as | FileCheck %s
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; Check the lowest range.
7*9880d681SAndroid Build Coastguard Workerdefine void @f1(i64 %base) {
8*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f1:
9*9880d681SAndroid Build Coastguard Worker; CHECK: blah -524288(%r2)
10*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
11*9880d681SAndroid Build Coastguard Worker  %add = add i64 %base, -524288
12*9880d681SAndroid Build Coastguard Worker  %addr = inttoptr i64 %add to i64 *
13*9880d681SAndroid Build Coastguard Worker  call void asm "blah $0", "=*S" (i64 *%addr)
14*9880d681SAndroid Build Coastguard Worker  ret void
15*9880d681SAndroid Build Coastguard Worker}
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker; Check the next lowest byte.
18*9880d681SAndroid Build Coastguard Workerdefine void @f2(i64 %base) {
19*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f2:
20*9880d681SAndroid Build Coastguard Worker; CHECK: agfi %r2, -524289
21*9880d681SAndroid Build Coastguard Worker; CHECK: blah 0(%r2)
22*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
23*9880d681SAndroid Build Coastguard Worker  %add = add i64 %base, -524289
24*9880d681SAndroid Build Coastguard Worker  %addr = inttoptr i64 %add to i64 *
25*9880d681SAndroid Build Coastguard Worker  call void asm "blah $0", "=*S" (i64 *%addr)
26*9880d681SAndroid Build Coastguard Worker  ret void
27*9880d681SAndroid Build Coastguard Worker}
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Worker; Check the highest range.
30*9880d681SAndroid Build Coastguard Workerdefine void @f3(i64 %base) {
31*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f3:
32*9880d681SAndroid Build Coastguard Worker; CHECK: blah 524287(%r2)
33*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
34*9880d681SAndroid Build Coastguard Worker  %add = add i64 %base, 524287
35*9880d681SAndroid Build Coastguard Worker  %addr = inttoptr i64 %add to i64 *
36*9880d681SAndroid Build Coastguard Worker  call void asm "blah $0", "=*S" (i64 *%addr)
37*9880d681SAndroid Build Coastguard Worker  ret void
38*9880d681SAndroid Build Coastguard Worker}
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Worker; Check the next highest byte.
41*9880d681SAndroid Build Coastguard Workerdefine void @f4(i64 %base) {
42*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f4:
43*9880d681SAndroid Build Coastguard Worker; CHECK: agfi %r2, 524288
44*9880d681SAndroid Build Coastguard Worker; CHECK: blah 0(%r2)
45*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
46*9880d681SAndroid Build Coastguard Worker  %add = add i64 %base, 524288
47*9880d681SAndroid Build Coastguard Worker  %addr = inttoptr i64 %add to i64 *
48*9880d681SAndroid Build Coastguard Worker  call void asm "blah $0", "=*S" (i64 *%addr)
49*9880d681SAndroid Build Coastguard Worker  ret void
50*9880d681SAndroid Build Coastguard Worker}
51