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: std r0, 16(r1)
12 ; PPC64LE-NEXT: stdu r1, -32(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: std r0, 16(r1)
24 ; PPC64BE-NEXT: stdu r1, -48(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
80 ; PPC64LE-NEXT: #NO_APP
81 ; PPC64LE-NEXT: # %bb.1: # %return
82 ; PPC64LE-NEXT: extsw r3, r3
84 ; PPC64LE-NEXT: .Ltmp0: # Block address taken
85 ; PPC64LE-NEXT: .LBB3_2: # %return_early
86 ; PPC64LE-NEXT: mflr r0
87 ; PPC64LE-NEXT: std r0, 16(r1)
88 ; PPC64LE-NEXT: stdu r1, -32(r1)
89 ; PPC64LE-NEXT: li r3, 0
90 ; PPC64LE-NEXT: addi r1, r1, 32
91 ; PPC64LE-NEXT: ld r0, 16(r1)
92 ; PPC64LE-NEXT: mtlr r0
93 ; PPC64LE-NEXT: extsw r3, r3
96 ; PPC64BE-LABEL: ClobberLR_BR:
97 ; PPC64BE: # %bb.0: # %entry
100 ; PPC64BE-NEXT: #NO_APP
101 ; PPC64BE-NEXT: # %bb.1: # %return
102 ; PPC64BE-NEXT: extsw r3, r3
104 ; PPC64BE-NEXT: .Ltmp0: # Block address taken
105 ; PPC64BE-NEXT: .LBB3_2: # %return_early
106 ; PPC64BE-NEXT: mflr r0
107 ; PPC64BE-NEXT: std r0, 16(r1)
108 ; PPC64BE-NEXT: stdu r1, -48(r1)
109 ; PPC64BE-NEXT: li r3, 0
110 ; PPC64BE-NEXT: addi r1, r1, 48
111 ; PPC64BE-NEXT: ld r0, 16(r1)
112 ; PPC64BE-NEXT: mtlr r0
113 ; PPC64BE-NEXT: extsw r3, r3
116 callbr void asm sideeffect "nop", "X,~{lr}"(i8* blockaddress(@ClobberLR_BR, %return_early))
117 to label %return [label %return_early]
123 %retval.0 = phi i32 [ 0, %return_early ], [ %in, %entry ]
127 define dso_local signext i32 @ClobberR5_BR(i32 signext %in) #0 {
128 ; PPC64LE-LABEL: ClobberR5_BR:
129 ; PPC64LE: # %bb.0: # %entry
132 ; PPC64LE-NEXT: #NO_APP
133 ; PPC64LE-NEXT: # %bb.1: # %return
134 ; PPC64LE-NEXT: extsw r3, r3
136 ; PPC64LE-NEXT: .Ltmp1: # Block address taken
137 ; PPC64LE-NEXT: .LBB4_2: # %return_early
138 ; PPC64LE-NEXT: li r3, 0
139 ; PPC64LE-NEXT: extsw r3, r3
142 ; PPC64BE-LABEL: ClobberR5_BR:
143 ; PPC64BE: # %bb.0: # %entry
146 ; PPC64BE-NEXT: #NO_APP
147 ; PPC64BE-NEXT: # %bb.1: # %return
148 ; PPC64BE-NEXT: extsw r3, r3
150 ; PPC64BE-NEXT: .Ltmp1: # Block address taken
151 ; PPC64BE-NEXT: .LBB4_2: # %return_early
152 ; PPC64BE-NEXT: li r3, 0
153 ; PPC64BE-NEXT: extsw r3, r3
156 callbr void asm sideeffect "nop", "X,~{r5}"(i8* blockaddress(@ClobberR5_BR, %return_early))
157 to label %return [label %return_early]
163 %retval.0 = phi i32 [ 0, %return_early ], [ %in, %entry ]
169 define dso_local void @DefLR() local_unnamed_addr #0 {
170 ; PPC64LE-LABEL: DefLR:
171 ; PPC64LE: # %bb.0: # %entry
172 ; PPC64LE-NEXT: mflr r0
173 ; PPC64LE-NEXT: std r0, 16(r1)
174 ; PPC64LE-NEXT: stdu r1, -32(r1)
176 ; PPC64LE-NEXT: #NO_APP
177 ; PPC64LE-NEXT: addi r1, r1, 32
178 ; PPC64LE-NEXT: ld r0, 16(r1)
179 ; PPC64LE-NEXT: mtlr r0
182 ; PPC64BE-LABEL: DefLR:
183 ; PPC64BE: # %bb.0: # %entry
184 ; PPC64BE-NEXT: mflr r0
185 ; PPC64BE-NEXT: std r0, 16(r1)
186 ; PPC64BE-NEXT: stdu r1, -48(r1)
188 ; PPC64BE-NEXT: #NO_APP
189 ; PPC64BE-NEXT: addi r1, r1, 48
190 ; PPC64BE-NEXT: ld r0, 16(r1)
191 ; PPC64BE-NEXT: mtlr r0
194 tail call i64 asm sideeffect "", "={lr}"()
198 define dso_local void @EarlyClobberLR() local_unnamed_addr #0 {
199 ; PPC64LE-LABEL: EarlyClobberLR:
200 ; PPC64LE: # %bb.0: # %entry
201 ; PPC64LE-NEXT: mflr r0
202 ; PPC64LE-NEXT: std r0, 16(r1)
203 ; PPC64LE-NEXT: stdu r1, -32(r1)
205 ; PPC64LE-NEXT: #NO_APP
206 ; PPC64LE-NEXT: addi r1, r1, 32
207 ; PPC64LE-NEXT: ld r0, 16(r1)
208 ; PPC64LE-NEXT: mtlr r0
211 ; PPC64BE-LABEL: EarlyClobberLR:
212 ; PPC64BE: # %bb.0: # %entry
213 ; PPC64BE-NEXT: mflr r0
214 ; PPC64BE-NEXT: std r0, 16(r1)
215 ; PPC64BE-NEXT: stdu r1, -48(r1)
217 ; PPC64BE-NEXT: #NO_APP
218 ; PPC64BE-NEXT: addi r1, r1, 48
219 ; PPC64BE-NEXT: ld r0, 16(r1)
220 ; PPC64BE-NEXT: mtlr r0
223 tail call i64 asm sideeffect "", "=&{lr}"()
227 define dso_local void @ClobberMulti() local_unnamed_addr #0 {
228 ; PPC64LE-LABEL: ClobberMulti:
229 ; PPC64LE: # %bb.0: # %entry
230 ; PPC64LE-NEXT: mflr r0
231 ; PPC64LE-NEXT: std r15, -136(r1) # 8-byte Folded Spill
232 ; PPC64LE-NEXT: std r16, -128(r1) # 8-byte Folded Spill
233 ; PPC64LE-NEXT: std r0, 16(r1)
234 ; PPC64LE-NEXT: stdu r1, -176(r1)
236 ; PPC64LE-NEXT: #NO_APP
237 ; PPC64LE-NEXT: addi r1, r1, 176
238 ; PPC64LE-NEXT: ld r0, 16(r1)
239 ; PPC64LE-NEXT: ld r16, -128(r1) # 8-byte Folded Reload
240 ; PPC64LE-NEXT: ld r15, -136(r1) # 8-byte Folded Reload
241 ; PPC64LE-NEXT: mtlr r0
244 ; PPC64BE-LABEL: ClobberMulti:
245 ; PPC64BE: # %bb.0: # %entry
246 ; PPC64BE-NEXT: mflr r0
247 ; PPC64BE-NEXT: std r0, 16(r1)
248 ; PPC64BE-NEXT: stdu r1, -192(r1)
249 ; PPC64BE-NEXT: std r15, 56(r1) # 8-byte Folded Spill
250 ; PPC64BE-NEXT: std r16, 64(r1) # 8-byte Folded Spill
252 ; PPC64BE-NEXT: #NO_APP
253 ; PPC64BE-NEXT: ld r16, 64(r1) # 8-byte Folded Reload
254 ; PPC64BE-NEXT: ld r15, 56(r1) # 8-byte Folded Reload
255 ; PPC64BE-NEXT: addi r1, r1, 192
256 ; PPC64BE-NEXT: ld r0, 16(r1)
257 ; PPC64BE-NEXT: mtlr r0
260 tail call void asm sideeffect "", "~{lr},~{r15},~{r16}"()
264 attributes #0 = { nounwind }