xref: /aosp_15_r20/external/llvm/test/CodeGen/SystemZ/asm-17.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; Test explicit register names.
2*9880d681SAndroid Build Coastguard Worker;
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s  -verify-machineinstrs -mtriple=s390x-linux-gnu -no-integrated-as \
4*9880d681SAndroid Build Coastguard Worker; RUN:   | FileCheck %s
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; Test i32 GPRs.
7*9880d681SAndroid Build Coastguard Workerdefine i32 @f1() {
8*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f1:
9*9880d681SAndroid Build Coastguard Worker; CHECK: lhi %r4, 1
10*9880d681SAndroid Build Coastguard Worker; CHECK: blah %r4
11*9880d681SAndroid Build Coastguard Worker; CHECK: lr %r2, %r4
12*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
13*9880d681SAndroid Build Coastguard Worker  %ret = call i32 asm "blah $0", "={r4},0" (i32 1)
14*9880d681SAndroid Build Coastguard Worker  ret i32 %ret
15*9880d681SAndroid Build Coastguard Worker}
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker; Test i64 GPRs.
18*9880d681SAndroid Build Coastguard Workerdefine i64 @f2() {
19*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f2:
20*9880d681SAndroid Build Coastguard Worker; CHECK: lghi %r4, 1
21*9880d681SAndroid Build Coastguard Worker; CHECK: blah %r4
22*9880d681SAndroid Build Coastguard Worker; CHECK: lgr %r2, %r4
23*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
24*9880d681SAndroid Build Coastguard Worker  %ret = call i64 asm "blah $0", "={r4},0" (i64 1)
25*9880d681SAndroid Build Coastguard Worker  ret i64 %ret
26*9880d681SAndroid Build Coastguard Worker}
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker; Test i32 FPRs.
29*9880d681SAndroid Build Coastguard Workerdefine float @f3() {
30*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f3:
31*9880d681SAndroid Build Coastguard Worker; CHECK: lzer %f4
32*9880d681SAndroid Build Coastguard Worker; CHECK: blah %f4
33*9880d681SAndroid Build Coastguard Worker; CHECK: ler %f0, %f4
34*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
35*9880d681SAndroid Build Coastguard Worker  %ret = call float asm "blah $0", "={f4},0" (float 0.0)
36*9880d681SAndroid Build Coastguard Worker  ret float %ret
37*9880d681SAndroid Build Coastguard Worker}
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Worker; Test i64 FPRs.
40*9880d681SAndroid Build Coastguard Workerdefine double @f4() {
41*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f4:
42*9880d681SAndroid Build Coastguard Worker; CHECK: lzdr %f4
43*9880d681SAndroid Build Coastguard Worker; CHECK: blah %f4
44*9880d681SAndroid Build Coastguard Worker; CHECK: ldr %f0, %f4
45*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
46*9880d681SAndroid Build Coastguard Worker  %ret = call double asm "blah $0", "={f4},0" (double 0.0)
47*9880d681SAndroid Build Coastguard Worker  ret double %ret
48*9880d681SAndroid Build Coastguard Worker}
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard Worker; Test i128 FPRs.
51*9880d681SAndroid Build Coastguard Workerdefine void @f5(fp128 *%dest) {
52*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f5:
53*9880d681SAndroid Build Coastguard Worker; CHECK: lzxr %f4
54*9880d681SAndroid Build Coastguard Worker; CHECK: blah %f4
55*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: std %f4, 0(%r2)
56*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: std %f6, 8(%r2)
57*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
58*9880d681SAndroid Build Coastguard Worker  %ret = call fp128 asm "blah $0", "={f4},0" (fp128 0xL00000000000000000000000000000000)
59*9880d681SAndroid Build Coastguard Worker  store fp128 %ret, fp128 *%dest
60*9880d681SAndroid Build Coastguard Worker  ret void
61*9880d681SAndroid Build Coastguard Worker}
62*9880d681SAndroid Build Coastguard Worker
63*9880d681SAndroid Build Coastguard Worker; Test clobbers of GPRs and CC.
64*9880d681SAndroid Build Coastguard Workerdefine i32 @f6(i32 %in) {
65*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f6:
66*9880d681SAndroid Build Coastguard Worker; CHECK: lr [[REG:%r[01345]]], %r2
67*9880d681SAndroid Build Coastguard Worker; CHECK: blah
68*9880d681SAndroid Build Coastguard Worker; CHECK: lr %r2, [[REG]]
69*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
70*9880d681SAndroid Build Coastguard Worker  call void asm sideeffect "blah", "~{r2},~{cc}"()
71*9880d681SAndroid Build Coastguard Worker  ret i32 %in
72*9880d681SAndroid Build Coastguard Worker}
73*9880d681SAndroid Build Coastguard Worker
74*9880d681SAndroid Build Coastguard Worker; Test clobbers of FPRs and CC.
75*9880d681SAndroid Build Coastguard Workerdefine float @f7(float %in) {
76*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f7:
77*9880d681SAndroid Build Coastguard Worker; CHECK: ler [[REG:%f[1-7]]], %f0
78*9880d681SAndroid Build Coastguard Worker; CHECK: blah
79*9880d681SAndroid Build Coastguard Worker; CHECK: ler %f0, [[REG]]
80*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
81*9880d681SAndroid Build Coastguard Worker  call void asm sideeffect "blah", "~{f0},~{cc}"()
82*9880d681SAndroid Build Coastguard Worker  ret float %in
83*9880d681SAndroid Build Coastguard Worker}
84*9880d681SAndroid Build Coastguard Worker
85*9880d681SAndroid Build Coastguard Worker; Test that both registers in a GR128 pair get hoisted.
86*9880d681SAndroid Build Coastguard Workerdefine void @f8(i32 %count) {
87*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f8
88*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: lhi %r0, 0
89*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: lhi %r1, 1
90*9880d681SAndroid Build Coastguard Worker; CHECK: %loop
91*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: %r
92*9880d681SAndroid Build Coastguard Worker; CHECK: blah %r0, %r1
93*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
94*9880d681SAndroid Build Coastguard Workerentry:
95*9880d681SAndroid Build Coastguard Worker  br label %loop
96*9880d681SAndroid Build Coastguard Worker
97*9880d681SAndroid Build Coastguard Workerloop:
98*9880d681SAndroid Build Coastguard Worker  %this = phi i32 [ %count, %entry ], [ %next, %loop ]
99*9880d681SAndroid Build Coastguard Worker  call void asm sideeffect "blah $0, $1", "{r0},{r1}" (i32 0, i32 1)
100*9880d681SAndroid Build Coastguard Worker  %next = sub i32 %this, 1
101*9880d681SAndroid Build Coastguard Worker  %cmp = icmp ne i32 %next, 0
102*9880d681SAndroid Build Coastguard Worker  br i1 %cmp, label %loop, label %exit
103*9880d681SAndroid Build Coastguard Worker
104*9880d681SAndroid Build Coastguard Workerexit:
105*9880d681SAndroid Build Coastguard Worker  ret void
106*9880d681SAndroid Build Coastguard Worker}
107