1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=powerpc64le-unknown-linux-unknown -verify-machineinstrs %s \
3 ; RUN: -ppc-asm-full-reg-names -o - | FileCheck %s --check-prefix=PPC64LE
4 ; RUN: llc -mtriple=powerpc64-unknown-linux-unknown -verify-machineinstrs %s \
5 ; RUN: -ppc-asm-full-reg-names -o - | FileCheck %s --check-prefix=PPC64BE
7 define dso_local void @ClobberLR() local_unnamed_addr #0 {
8 ; PPC64LE-LABEL: ClobberLR:
9 ; PPC64LE: # %bb.0: # %entry
10 ; PPC64LE-NEXT: mflr r0
11 ; PPC64LE-NEXT: stdu r1, -32(r1)
12 ; PPC64LE-NEXT: std r0, 48(r1)
14 ; PPC64LE-NEXT: #NO_APP
15 ; PPC64LE-NEXT: addi r1, r1, 32
16 ; PPC64LE-NEXT: ld r0, 16(r1)
17 ; PPC64LE-NEXT: mtlr r0
20 ; PPC64BE-LABEL: ClobberLR:
21 ; PPC64BE: # %bb.0: # %entry
22 ; PPC64BE-NEXT: mflr r0
23 ; PPC64BE-NEXT: stdu r1, -48(r1)
24 ; PPC64BE-NEXT: std r0, 64(r1)
26 ; PPC64BE-NEXT: #NO_APP
27 ; PPC64BE-NEXT: addi r1, r1, 48
28 ; PPC64BE-NEXT: ld r0, 16(r1)
29 ; PPC64BE-NEXT: mtlr r0
32 tail call void asm sideeffect "", "~{lr}"()
36 define dso_local void @ClobberR5() local_unnamed_addr #0 {
37 ; PPC64LE-LABEL: ClobberR5:
38 ; PPC64LE: # %bb.0: # %entry
40 ; PPC64LE-NEXT: #NO_APP
43 ; PPC64BE-LABEL: ClobberR5:
44 ; PPC64BE: # %bb.0: # %entry
46 ; PPC64BE-NEXT: #NO_APP
49 tail call void asm sideeffect "", "~{r5}"()
53 define dso_local void @ClobberR15() local_unnamed_addr #0 {
54 ; PPC64LE-LABEL: ClobberR15:
55 ; PPC64LE: # %bb.0: # %entry
56 ; PPC64LE-NEXT: std r15, -136(r1) # 8-byte Folded Spill
58 ; PPC64LE-NEXT: #NO_APP
59 ; PPC64LE-NEXT: ld r15, -136(r1) # 8-byte Folded Reload
62 ; PPC64BE-LABEL: ClobberR15:
63 ; PPC64BE: # %bb.0: # %entry
64 ; PPC64BE-NEXT: std r15, -136(r1) # 8-byte Folded Spill
66 ; PPC64BE-NEXT: #NO_APP
67 ; PPC64BE-NEXT: ld r15, -136(r1) # 8-byte Folded Reload
70 tail call void asm sideeffect "", "~{r15}"()
74 ;; Test for INLINEASM_BR
75 define dso_local signext i32 @ClobberLR_BR(i32 signext %in) #0 {
76 ; PPC64LE-LABEL: ClobberLR_BR:
77 ; PPC64LE: # %bb.0: # %entry
78 ; PPC64LE-NEXT: mflr r0
79 ; PPC64LE-NEXT: stdu r1, -32(r1)
80 ; PPC64LE-NEXT: std r0, 48(r1)
83 ; PPC64LE-NEXT: #NO_APP
84 ; PPC64LE-NEXT: .LBB3_1: # %return
85 ; PPC64LE-NEXT: addi r1, r1, 32
86 ; PPC64LE-NEXT: ld r0, 16(r1)
87 ; PPC64LE-NEXT: mtlr r0
89 ; PPC64LE-NEXT: .LBB3_2: # Block address taken
90 ; PPC64LE-NEXT: # %return_early
91 ; PPC64LE-NEXT: # Label of block must be emitted
92 ; PPC64LE-NEXT: li r3, 0
93 ; PPC64LE-NEXT: b .LBB3_1
95 ; PPC64BE-LABEL: ClobberLR_BR:
96 ; PPC64BE: # %bb.0: # %entry
97 ; PPC64BE-NEXT: mflr r0
98 ; PPC64BE-NEXT: stdu r1, -48(r1)
99 ; PPC64BE-NEXT: std r0, 64(r1)
102 ; PPC64BE-NEXT: #NO_APP
103 ; PPC64BE-NEXT: .LBB3_1: # %return
104 ; PPC64BE-NEXT: addi r1, r1, 48
105 ; PPC64BE-NEXT: ld r0, 16(r1)
106 ; PPC64BE-NEXT: mtlr r0
108 ; PPC64BE-NEXT: .LBB3_2: # Block address taken
109 ; PPC64BE-NEXT: # %return_early
110 ; PPC64BE-NEXT: # Label of block must be emitted
111 ; PPC64BE-NEXT: li r3, 0
112 ; PPC64BE-NEXT: b .LBB3_1
114 callbr void asm sideeffect "nop", "!i,~{lr}"()
115 to label %return [label %return_early]
121 %retval.0 = phi i32 [ 0, %return_early ], [ %in, %entry ]
125 define dso_local signext i32 @ClobberR5_BR(i32 signext %in) #0 {
126 ; PPC64LE-LABEL: ClobberR5_BR:
127 ; PPC64LE: # %bb.0: # %entry
130 ; PPC64LE-NEXT: #NO_APP
131 ; PPC64LE-NEXT: # %bb.1: # %return
133 ; PPC64LE-NEXT: .LBB4_2: # Block address taken
134 ; PPC64LE-NEXT: # %return_early
135 ; PPC64LE-NEXT: # Label of block must be emitted
136 ; PPC64LE-NEXT: li r3, 0
139 ; PPC64BE-LABEL: ClobberR5_BR:
140 ; PPC64BE: # %bb.0: # %entry
143 ; PPC64BE-NEXT: #NO_APP
144 ; PPC64BE-NEXT: # %bb.1: # %return
146 ; PPC64BE-NEXT: .LBB4_2: # Block address taken
147 ; PPC64BE-NEXT: # %return_early
148 ; PPC64BE-NEXT: # Label of block must be emitted
149 ; PPC64BE-NEXT: li r3, 0
152 callbr void asm sideeffect "nop", "!i,~{r5}"()
153 to label %return [label %return_early]
159 %retval.0 = phi i32 [ 0, %return_early ], [ %in, %entry ]
165 define dso_local void @DefLR() local_unnamed_addr #0 {
166 ; PPC64LE-LABEL: DefLR:
167 ; PPC64LE: # %bb.0: # %entry
168 ; PPC64LE-NEXT: mflr r0
169 ; PPC64LE-NEXT: stdu r1, -32(r1)
170 ; PPC64LE-NEXT: std r0, 48(r1)
172 ; PPC64LE-NEXT: #NO_APP
173 ; PPC64LE-NEXT: addi r1, r1, 32
174 ; PPC64LE-NEXT: ld r0, 16(r1)
175 ; PPC64LE-NEXT: mtlr r0
178 ; PPC64BE-LABEL: DefLR:
179 ; PPC64BE: # %bb.0: # %entry
180 ; PPC64BE-NEXT: mflr r0
181 ; PPC64BE-NEXT: stdu r1, -48(r1)
182 ; PPC64BE-NEXT: std r0, 64(r1)
184 ; PPC64BE-NEXT: #NO_APP
185 ; PPC64BE-NEXT: addi r1, r1, 48
186 ; PPC64BE-NEXT: ld r0, 16(r1)
187 ; PPC64BE-NEXT: mtlr r0
190 tail call i64 asm sideeffect "", "={lr}"()
194 define dso_local void @EarlyClobberLR() local_unnamed_addr #0 {
195 ; PPC64LE-LABEL: EarlyClobberLR:
196 ; PPC64LE: # %bb.0: # %entry
197 ; PPC64LE-NEXT: mflr r0
198 ; PPC64LE-NEXT: stdu r1, -32(r1)
199 ; PPC64LE-NEXT: std r0, 48(r1)
201 ; PPC64LE-NEXT: #NO_APP
202 ; PPC64LE-NEXT: addi r1, r1, 32
203 ; PPC64LE-NEXT: ld r0, 16(r1)
204 ; PPC64LE-NEXT: mtlr r0
207 ; PPC64BE-LABEL: EarlyClobberLR:
208 ; PPC64BE: # %bb.0: # %entry
209 ; PPC64BE-NEXT: mflr r0
210 ; PPC64BE-NEXT: stdu r1, -48(r1)
211 ; PPC64BE-NEXT: std r0, 64(r1)
213 ; PPC64BE-NEXT: #NO_APP
214 ; PPC64BE-NEXT: addi r1, r1, 48
215 ; PPC64BE-NEXT: ld r0, 16(r1)
216 ; PPC64BE-NEXT: mtlr r0
219 tail call i64 asm sideeffect "", "=&{lr}"()
223 define dso_local void @ClobberMulti() local_unnamed_addr #0 {
224 ; PPC64LE-LABEL: ClobberMulti:
225 ; PPC64LE: # %bb.0: # %entry
226 ; PPC64LE-NEXT: mflr r0
227 ; PPC64LE-NEXT: std r15, -136(r1) # 8-byte Folded Spill
228 ; PPC64LE-NEXT: std r16, -128(r1) # 8-byte Folded Spill
229 ; PPC64LE-NEXT: stdu r1, -176(r1)
230 ; PPC64LE-NEXT: std r0, 192(r1)
232 ; PPC64LE-NEXT: #NO_APP
233 ; PPC64LE-NEXT: addi r1, r1, 176
234 ; PPC64LE-NEXT: ld r0, 16(r1)
235 ; PPC64LE-NEXT: ld r16, -128(r1) # 8-byte Folded Reload
236 ; PPC64LE-NEXT: ld r15, -136(r1) # 8-byte Folded Reload
237 ; PPC64LE-NEXT: mtlr r0
240 ; PPC64BE-LABEL: ClobberMulti:
241 ; PPC64BE: # %bb.0: # %entry
242 ; PPC64BE-NEXT: mflr r0
243 ; PPC64BE-NEXT: stdu r1, -192(r1)
244 ; PPC64BE-NEXT: std r0, 208(r1)
245 ; PPC64BE-NEXT: std r15, 56(r1) # 8-byte Folded Spill
246 ; PPC64BE-NEXT: std r16, 64(r1) # 8-byte Folded Spill
248 ; PPC64BE-NEXT: #NO_APP
249 ; PPC64BE-NEXT: ld r16, 64(r1) # 8-byte Folded Reload
250 ; PPC64BE-NEXT: ld r15, 56(r1) # 8-byte Folded Reload
251 ; PPC64BE-NEXT: addi r1, r1, 192
252 ; PPC64BE-NEXT: ld r0, 16(r1)
253 ; PPC64BE-NEXT: mtlr r0
256 tail call void asm sideeffect "", "~{lr},~{r15},~{r16}"()
260 attributes #0 = { nounwind }