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
78 ; PPC64LE-NEXT: mflr r0
79 ; PPC64LE-NEXT: std r0, 16(r1)
80 ; PPC64LE-NEXT: stdu r1, -32(r1)
83 ; PPC64LE-NEXT: #NO_APP
84 ; PPC64LE-NEXT: .LBB3_1: # %return
85 ; PPC64LE-NEXT: extsw r3, r3
86 ; PPC64LE-NEXT: addi r1, r1, 32
87 ; PPC64LE-NEXT: ld r0, 16(r1)
88 ; PPC64LE-NEXT: mtlr r0
90 ; PPC64LE-NEXT: .Ltmp0: # Block address taken
91 ; PPC64LE-NEXT: .LBB3_2: # %return_early
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: std r0, 16(r1)
99 ; PPC64BE-NEXT: stdu r1, -48(r1)
102 ; PPC64BE-NEXT: #NO_APP
103 ; PPC64BE-NEXT: .LBB3_1: # %return
104 ; PPC64BE-NEXT: extsw r3, r3
105 ; PPC64BE-NEXT: addi r1, r1, 48
106 ; PPC64BE-NEXT: ld r0, 16(r1)
107 ; PPC64BE-NEXT: mtlr r0
109 ; PPC64BE-NEXT: .Ltmp0: # Block address taken
110 ; PPC64BE-NEXT: .LBB3_2: # %return_early
111 ; PPC64BE-NEXT: li r3, 0
112 ; PPC64BE-NEXT: b .LBB3_1
114 callbr void asm sideeffect "nop", "i,~{lr}"(i8* blockaddress(@ClobberLR_BR, %return_early))
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
132 ; PPC64LE-NEXT: extsw r3, r3
134 ; PPC64LE-NEXT: .Ltmp1: # Block address taken
135 ; PPC64LE-NEXT: .LBB4_2: # %return_early
136 ; PPC64LE-NEXT: li r3, 0
137 ; PPC64LE-NEXT: extsw r3, r3
140 ; PPC64BE-LABEL: ClobberR5_BR:
141 ; PPC64BE: # %bb.0: # %entry
144 ; PPC64BE-NEXT: #NO_APP
145 ; PPC64BE-NEXT: # %bb.1: # %return
146 ; PPC64BE-NEXT: extsw r3, r3
148 ; PPC64BE-NEXT: .Ltmp1: # Block address taken
149 ; PPC64BE-NEXT: .LBB4_2: # %return_early
150 ; PPC64BE-NEXT: li r3, 0
151 ; PPC64BE-NEXT: extsw r3, r3
154 callbr void asm sideeffect "nop", "i,~{r5}"(i8* blockaddress(@ClobberR5_BR, %return_early))
155 to label %return [label %return_early]
161 %retval.0 = phi i32 [ 0, %return_early ], [ %in, %entry ]
167 define dso_local void @DefLR() local_unnamed_addr #0 {
168 ; PPC64LE-LABEL: DefLR:
169 ; PPC64LE: # %bb.0: # %entry
170 ; PPC64LE-NEXT: mflr r0
171 ; PPC64LE-NEXT: std r0, 16(r1)
172 ; PPC64LE-NEXT: stdu r1, -32(r1)
174 ; PPC64LE-NEXT: #NO_APP
175 ; PPC64LE-NEXT: addi r1, r1, 32
176 ; PPC64LE-NEXT: ld r0, 16(r1)
177 ; PPC64LE-NEXT: mtlr r0
180 ; PPC64BE-LABEL: DefLR:
181 ; PPC64BE: # %bb.0: # %entry
182 ; PPC64BE-NEXT: mflr r0
183 ; PPC64BE-NEXT: std r0, 16(r1)
184 ; PPC64BE-NEXT: stdu r1, -48(r1)
186 ; PPC64BE-NEXT: #NO_APP
187 ; PPC64BE-NEXT: addi r1, r1, 48
188 ; PPC64BE-NEXT: ld r0, 16(r1)
189 ; PPC64BE-NEXT: mtlr r0
192 tail call i64 asm sideeffect "", "={lr}"()
196 define dso_local void @EarlyClobberLR() local_unnamed_addr #0 {
197 ; PPC64LE-LABEL: EarlyClobberLR:
198 ; PPC64LE: # %bb.0: # %entry
199 ; PPC64LE-NEXT: mflr r0
200 ; PPC64LE-NEXT: std r0, 16(r1)
201 ; PPC64LE-NEXT: stdu r1, -32(r1)
203 ; PPC64LE-NEXT: #NO_APP
204 ; PPC64LE-NEXT: addi r1, r1, 32
205 ; PPC64LE-NEXT: ld r0, 16(r1)
206 ; PPC64LE-NEXT: mtlr r0
209 ; PPC64BE-LABEL: EarlyClobberLR:
210 ; PPC64BE: # %bb.0: # %entry
211 ; PPC64BE-NEXT: mflr r0
212 ; PPC64BE-NEXT: std r0, 16(r1)
213 ; PPC64BE-NEXT: stdu r1, -48(r1)
215 ; PPC64BE-NEXT: #NO_APP
216 ; PPC64BE-NEXT: addi r1, r1, 48
217 ; PPC64BE-NEXT: ld r0, 16(r1)
218 ; PPC64BE-NEXT: mtlr r0
221 tail call i64 asm sideeffect "", "=&{lr}"()
225 define dso_local void @ClobberMulti() local_unnamed_addr #0 {
226 ; PPC64LE-LABEL: ClobberMulti:
227 ; PPC64LE: # %bb.0: # %entry
228 ; PPC64LE-NEXT: mflr r0
229 ; PPC64LE-NEXT: std r15, -136(r1) # 8-byte Folded Spill
230 ; PPC64LE-NEXT: std r16, -128(r1) # 8-byte Folded Spill
231 ; PPC64LE-NEXT: std r0, 16(r1)
232 ; PPC64LE-NEXT: stdu r1, -176(r1)
234 ; PPC64LE-NEXT: #NO_APP
235 ; PPC64LE-NEXT: addi r1, r1, 176
236 ; PPC64LE-NEXT: ld r0, 16(r1)
237 ; PPC64LE-NEXT: ld r16, -128(r1) # 8-byte Folded Reload
238 ; PPC64LE-NEXT: ld r15, -136(r1) # 8-byte Folded Reload
239 ; PPC64LE-NEXT: mtlr r0
242 ; PPC64BE-LABEL: ClobberMulti:
243 ; PPC64BE: # %bb.0: # %entry
244 ; PPC64BE-NEXT: mflr r0
245 ; PPC64BE-NEXT: std r0, 16(r1)
246 ; PPC64BE-NEXT: stdu r1, -192(r1)
247 ; PPC64BE-NEXT: std r15, 56(r1) # 8-byte Folded Spill
248 ; PPC64BE-NEXT: std r16, 64(r1) # 8-byte Folded Spill
250 ; PPC64BE-NEXT: #NO_APP
251 ; PPC64BE-NEXT: ld r16, 64(r1) # 8-byte Folded Reload
252 ; PPC64BE-NEXT: ld r15, 56(r1) # 8-byte Folded Reload
253 ; PPC64BE-NEXT: addi r1, r1, 192
254 ; PPC64BE-NEXT: ld r0, 16(r1)
255 ; PPC64BE-NEXT: mtlr r0
258 tail call void asm sideeffect "", "~{lr},~{r15},~{r16}"()
262 attributes #0 = { nounwind }