[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / llvm / test / CodeGen / ARM / ehabi.ll
blobd1a4e9a6bccad046368d21f12b5dbb6047f5c177
1 ; ARM EHABI integrated test
3 ; This test case checks whether the ARM unwind directives are properly
4 ; generated or not.
6 ; The purpose of the test:
7 ; (1) .fnstart and .fnend directives should wrap the function.
8 ; (2) .setfp directive should be available if frame pointer is not eliminated.
9 ; (3) .save directive should come with push instruction.
10 ; (4) .vsave directive should come with vpush instruction.
11 ; (5) .pad directive should come with stack pointer adjustment.
12 ; (6) .cantunwind directive should be available if the function is marked with
13 ;     nounwind function attribute.
15 ; We have to check several cases:
16 ; (1) arm with -frame-pointer=all
17 ; (2) arm without -frame-pointer=all
18 ; (3) armv7 with -frame-pointer=all
19 ; (4) armv7 without -frame-pointer=all
21 ; RUN: llc -mtriple arm-unknown-linux-gnueabi \
22 ; RUN:     -frame-pointer=all -filetype=asm -o - %s \
23 ; RUN:   | FileCheck %s --check-prefix=CHECK-FP
25 ; RUN: llc -mtriple arm-unknown-linux-gnueabi \
26 ; RUN:     -filetype=asm -o - %s \
27 ; RUN:   | FileCheck %s --check-prefix=CHECK-FP-ELIM
29 ; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
30 ; RUN:     -frame-pointer=all -filetype=asm -o - %s \
31 ; RUN:   | FileCheck %s --check-prefix=CHECK-V7-FP
33 ; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
34 ; RUN:     -filetype=asm -o - %s \
35 ; RUN:   | FileCheck %s --check-prefix=CHECK-V7-FP-ELIM
37 ; RUN: llc -mtriple arm-unknown-linux-musleabi \
38 ; RUN:     -frame-pointer=all -filetype=asm -o - %s \
39 ; RUN:   | FileCheck %s --check-prefix=CHECK-FP
41 ; RUN: llc -mtriple arm-unknown-linux-musleabi \
42 ; RUN:     -filetype=asm -o - %s \
43 ; RUN:   | FileCheck %s --check-prefix=CHECK-FP-ELIM
45 ; RUN: llc -mtriple armv7-unknown-linux-musleabi \
46 ; RUN:     -frame-pointer=all -filetype=asm -o - %s \
47 ; RUN:   | FileCheck %s --check-prefix=CHECK-V7-FP
49 ; RUN: llc -mtriple armv7-unknown-linux-musleabi \
50 ; RUN:     -filetype=asm -o - %s \
51 ; RUN:   | FileCheck %s --check-prefix=CHECK-V7-FP-ELIM
53 ; RUN: llc -mtriple arm-unknown-linux-androideabi \
54 ; RUN:     -frame-pointer=all -filetype=asm -o - %s \
55 ; RUN:   | FileCheck %s --check-prefix=CHECK-FP
57 ; RUN: llc -mtriple arm-unknown-linux-androideabi \
58 ; RUN:     -filetype=asm -o - %s \
59 ; RUN:   | FileCheck %s --check-prefix=CHECK-FP-ELIM
61 ; RUN: llc -mtriple armv7-unknown-linux-androideabi \
62 ; RUN:     -frame-pointer=all -filetype=asm -o - %s \
63 ; RUN:   | FileCheck %s --check-prefix=CHECK-V7-FP
65 ; RUN: llc -mtriple armv7-unknown-linux-androideabi \
66 ; RUN:     -filetype=asm -o - %s \
67 ; RUN:   | FileCheck %s --check-prefix=CHECK-V7-FP-ELIM
69 ; RUN: llc -mtriple arm-unknown-netbsd-eabi \
70 ; RUN:     -frame-pointer=all -filetype=asm -o - %s \
71 ; RUN:   | FileCheck %s --check-prefix=DWARF-FP
73 ; RUN: llc -mtriple arm-unknown-netbsd-eabi \
74 ; RUN:     -filetype=asm -o - %s \
75 ; RUN:   | FileCheck %s --check-prefix=DWARF-FP-ELIM
77 ; RUN: llc -mtriple armv7-unknown-netbsd-eabi \
78 ; RUN:     -frame-pointer=all -filetype=asm -o - %s \
79 ; RUN:   | FileCheck %s --check-prefix=DWARF-V7-FP
81 ; RUN: llc -mtriple armv7-unknown-netbsd-eabi \
82 ; RUN:     -filetype=asm -o - %s \
83 ; RUN:   | FileCheck %s --check-prefix=DWARF-V7-FP-ELIM
85 ; RUN: llc -mtriple thumbv7-windows-gnu \
86 ; RUN:     -filetype=asm -exception-model=dwarf -o - %s \
87 ; RUN:   | FileCheck %s --check-prefix=DWARF-WIN-FP-ELIM
89 ; RUN: llc -mtriple thumbv7-windows-gnu \
90 ; RUN:     -filetype=asm -o - %s \
91 ; RUN:   | FileCheck %s --check-prefix=SEH-WIN-FP-ELIM
93 ;-------------------------------------------------------------------------------
94 ; Test 1
95 ;-------------------------------------------------------------------------------
96 ; This is the LLVM assembly generated from following C++ code:
98 ;   extern void print(int, int, int, int, int);
99 ;   extern void print(double, double, double, double, double);
101 ;   void test(int a, int b, int c, int d, int e,
102 ;             double m, double n, double p, double q, double r) {
103 ;     try {
104 ;       print(a, b, c, d, e);
105 ;     } catch (...) {
106 ;       print(m, n, p, q, r);
107 ;     }
108 ;   }
110 declare void @_Z5printiiiii(i32, i32, i32, i32, i32)
112 declare void @_Z5printddddd(double, double, double, double, double)
114 define void @_Z4testiiiiiddddd(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e,
115                                double %m, double %n, double %p,
116                                double %q, double %r) personality ptr @__gxx_personality_v0 {
117 entry:
118   invoke void @_Z5printiiiii(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e)
119           to label %try.cont unwind label %lpad
121 lpad:
122   %0 = landingpad { ptr, i32 }
123           catch ptr null
124   %1 = extractvalue { ptr, i32 } %0, 0
125   %2 = tail call ptr @__cxa_begin_catch(ptr %1)
126   invoke void @_Z5printddddd(double %m, double %n, double %p,
127                              double %q, double %r)
128           to label %invoke.cont2 unwind label %lpad1
130 invoke.cont2:
131   tail call void @__cxa_end_catch()
132   br label %try.cont
134 try.cont:
135   ret void
137 lpad1:
138   %3 = landingpad { ptr, i32 }
139           cleanup
140   invoke void @__cxa_end_catch()
141           to label %eh.resume unwind label %terminate.lpad
143 eh.resume:
144   resume { ptr, i32 } %3
146 terminate.lpad:
147   %4 = landingpad { ptr, i32 }
148           catch ptr null
149   %5 = extractvalue { ptr, i32 } %4, 0
150   tail call void @__clang_call_terminate(ptr %5)
151   unreachable
154 declare void @__clang_call_terminate(ptr)
156 declare i32 @__gxx_personality_v0(...)
158 declare ptr @__cxa_begin_catch(ptr)
160 declare void @__cxa_end_catch()
162 declare void @_ZSt9terminatev()
164 ; CHECK-FP-LABEL: _Z4testiiiiiddddd:
165 ; CHECK-FP:   .fnstart
166 ; CHECK-FP:   .save  {r4, r5, r6, r7, r8, r9, r10, r11, lr}
167 ; CHECK-FP:   push   {r4, r5, r6, r7, r8, r9, r10, r11, lr}
168 ; CHECK-FP:   .setfp r11, sp, #28
169 ; CHECK-FP:   add    r11, sp, #28
170 ; CHECK-FP:   .pad   #44
171 ; CHECK-FP:   sub    sp, sp, #44
172 ; CHECK-FP:   .personality __gxx_personality_v0
173 ; CHECK-FP:   .handlerdata
174 ; CHECK-FP:   .fnend
176 ; CHECK-FP-ELIM-LABEL: _Z4testiiiiiddddd:
177 ; CHECK-FP-ELIM:   .fnstart
178 ; CHECK-FP-ELIM:   .save {r4, r5, r6, r7, r8, r9, r10, r11, lr}
179 ; CHECK-FP-ELIM:   push  {r4, r5, r6, r7, r8, r9, r10, r11, lr}
180 ; CHECK-FP-ELIM:   .pad  #36
181 ; CHECK-FP-ELIM:   sub   sp, sp, #36
182 ; CHECK-FP-ELIM:   .personality __gxx_personality_v0
183 ; CHECK-FP-ELIM:   .handlerdata
184 ; CHECK-FP-ELIM:   .fnend
186 ; CHECK-V7-FP-LABEL: _Z4testiiiiiddddd:
187 ; CHECK-V7-FP:   .fnstart
188 ; CHECK-V7-FP:   .save  {r11, lr}
189 ; CHECK-V7-FP:   push   {r11, lr}
190 ; CHECK-V7-FP:   .setfp r11, sp
191 ; CHECK-V7-FP:   mov    r11, sp
192 ; CHECK-V7-FP:   .vsave {d8, d9, d10, d11, d12}
193 ; CHECK-V7-FP:   vpush  {d8, d9, d10, d11, d12}
194 ; CHECK-V7-FP:   .pad   #24
195 ; CHECK-V7-FP:   sub    sp, sp, #24
196 ; CHECK-V7-FP:   .personality __gxx_personality_v0
197 ; CHECK-V7-FP:   .handlerdata
198 ; CHECK-V7-FP:   .fnend
200 ; CHECK-V7-FP-ELIM-LABEL: _Z4testiiiiiddddd:
201 ; CHECK-V7-FP-ELIM:   .fnstart
202 ; CHECK-V7-FP-ELIM:   .save  {r11, lr}
203 ; CHECK-V7-FP-ELIM:   push   {r11, lr}
204 ; CHECK-V7-FP-ELIM:   .vsave {d8, d9, d10, d11, d12}
205 ; CHECK-V7-FP-ELIM:   vpush  {d8, d9, d10, d11, d12}
206 ; CHECK-V7-FP-ELIM:   .pad   #24
207 ; CHECK-V7-FP-ELIM:   sub    sp, sp, #24
208 ; CHECK-V7-FP-ELIM:   .personality __gxx_personality_v0
209 ; CHECK-V7-FP-ELIM:   .handlerdata
210 ; CHECK-V7-FP-ELIM:   .fnend
212 ; DWARF-FP-LABEL: _Z4testiiiiiddddd:
213 ; DWARF-FP:    .cfi_startproc
214 ; DWARF-FP:    .cfi_personality 0, __gxx_personality_v0
215 ; DWARF-FP:    .cfi_lsda 0, .Lexception0
216 ; DWARF-FP:    push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
217 ; DWARF-FP:    .cfi_def_cfa_offset 36
218 ; DWARF-FP:    .cfi_offset lr, -4
219 ; DWARF-FP:    .cfi_offset r11, -8
220 ; DWARF-FP:    .cfi_offset r10, -12
221 ; DWARF-FP:    .cfi_offset r9, -16
222 ; DWARF-FP:    .cfi_offset r8, -20
223 ; DWARF-FP:    .cfi_offset r7, -24
224 ; DWARF-FP:    .cfi_offset r6, -28
225 ; DWARF-FP:    .cfi_offset r5, -32
226 ; DWARF-FP:    .cfi_offset r4, -36
227 ; DWARF-FP:    add r11, sp, #28
228 ; DWARF-FP:    .cfi_def_cfa r11, 8
229 ; DWARF-FP:    sub sp, sp, #44
230 ; DWARF-FP:    sub sp, r11, #28
231 ; DWARF-FP:    pop {r4, r5, r6, r7, r8, r9, r10, r11, lr}
232 ; DWARF-FP:    mov pc, lr
233 ; DWARF-FP:    .cfi_endproc
235 ; DWARF-FP-ELIM-LABEL: _Z4testiiiiiddddd:
236 ; DWARF-FP-ELIM:    .cfi_startproc
237 ; DWARF-FP-ELIM:    .cfi_personality 0, __gxx_personality_v0
238 ; DWARF-FP-ELIM:    .cfi_lsda 0, .Lexception0
239 ; DWARF-FP-ELIM:    push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
240 ; DWARF-FP-ELIM:    .cfi_def_cfa_offset 36
241 ; DWARF-FP-ELIM:    .cfi_offset lr, -4
242 ; DWARF-FP-ELIM:    .cfi_offset r11, -8
243 ; DWARF-FP-ELIM:    .cfi_offset r10, -12
244 ; DWARF-FP-ELIM:    .cfi_offset r9, -16
245 ; DWARF-FP-ELIM:    .cfi_offset r8, -20
246 ; DWARF-FP-ELIM:    .cfi_offset r7, -24
247 ; DWARF-FP-ELIM:    .cfi_offset r6, -28
248 ; DWARF-FP-ELIM:    .cfi_offset r5, -32
249 ; DWARF-FP-ELIM:    .cfi_offset r4, -36
250 ; DWARF-FP-ELIM:    sub sp, sp, #36
251 ; DWARF-FP-ELIM:    .cfi_def_cfa_offset 72
252 ; DWARF-FP-ELIM:    add sp, sp, #36
253 ; DWARF-FP-ELIM:    pop {r4, r5, r6, r7, r8, r9, r10, r11, lr}
254 ; DWARF-FP-ELIM:    mov pc, lr
255 ; DWARF-FP-ELIM:    .cfi_endproc
257 ; DWARF-V7-FP-LABEL: _Z4testiiiiiddddd:
258 ; DWARF-V7-FP:    .cfi_startproc
259 ; DWARF-V7-FP:    .cfi_personality 0, __gxx_personality_v0
260 ; DWARF-V7-FP:    .cfi_lsda 0, .Lexception0
261 ; DWARF-V7-FP:    push {r11, lr}
262 ; DWARF-V7-FP:    .cfi_def_cfa_offset 8
263 ; DWARF-V7-FP:    .cfi_offset lr, -4
264 ; DWARF-V7-FP:    .cfi_offset r11, -8
265 ; DWARF-V7-FP:    mov r11, sp
266 ; DWARF-V7-FP:    .cfi_def_cfa_register r11
267 ; DWARF-V7-FP:    vpush {d8, d9, d10, d11, d12}
268 ; DWARF-V7-FP:    .cfi_offset d12, -16
269 ; DWARF-V7-FP:    .cfi_offset d11, -24
270 ; DWARF-V7-FP:    .cfi_offset d10, -32
271 ; DWARF-V7-FP:    .cfi_offset d9, -40
272 ; DWARF-V7-FP:    sub sp, sp, #24
273 ; DWARF-V7-FP:    sub sp, r11, #40
274 ; DWARF-V7-FP:    vpop {d8, d9, d10, d11, d12}
275 ; DWARF-V7-FP:    pop {r11, pc}
276 ; DWARF-V7-FP:    .cfi_endproc
278 ; DWARF-V7-FP-ELIM-LABEL: _Z4testiiiiiddddd:
279 ; DWARF-V7-FP-ELIM:    .cfi_startproc
280 ; DWARF-V7-FP-ELIM:    .cfi_personality 0, __gxx_personality_v0
281 ; DWARF-V7-FP-ELIM:    .cfi_lsda 0, .Lexception0
282 ; DWARF-V7-FP-ELIM:    push {r11, lr}
283 ; DWARF-V7-FP-ELIM:    .cfi_def_cfa_offset 8
284 ; DWARF-V7-FP-ELIM:    .cfi_offset lr, -4
285 ; DWARF-V7-FP-ELIM:    .cfi_offset r11, -8
286 ; DWARF-V7-FP-ELIM:    vpush {d8, d9, d10, d11, d12}
287 ; DWARF-V7-FP-ELIM:    .cfi_offset d12, -16
288 ; DWARF-V7-FP-ELIM:    .cfi_offset d11, -24
289 ; DWARF-V7-FP-ELIM:    .cfi_offset d10, -32
290 ; DWARF-V7-FP-ELIM:    .cfi_offset d9, -40
291 ; DWARF-V7-FP-ELIM:    sub sp, sp, #24
292 ; DWARF-V7-FP-ELIM:    .cfi_def_cfa_offset 72
293 ; DWARF-V7-FP-ELIM:    add sp, sp, #24
294 ; DWARF-V7-FP-ELIM:    vpop {d8, d9, d10, d11, d12}
295 ; DWARF-V7-FP-ELIM:    pop {r11, pc}
296 ; DWARF-V7-FP-ELIM:    .cfi_endproc
298 ; DWARF-WIN-FP-ELIM-LABEL: _Z4testiiiiiddddd:
299 ; DWARF-WIN-FP-ELIM:    .cfi_startproc
300 ; DWARF-WIN-FP-ELIM:    .cfi_personality 0, __gxx_personality_v0
301 ; DWARF-WIN-FP-ELIM:    .cfi_lsda 0, .Lexception0
302 ; DWARF-WIN-FP-ELIM:    push {r4, lr}
303 ; DWARF-WIN-FP-ELIM:    .cfi_def_cfa_offset 8
304 ; DWARF-WIN-FP-ELIM:    .cfi_offset lr, -4
305 ; DWARF-WIN-FP-ELIM:    .cfi_offset r4, -8
306 ; DWARF-WIN-FP-ELIM:    vpush {d8, d9, d10, d11, d12}
307 ; DWARF-WIN-FP-ELIM:    .cfi_offset d12, -16
308 ; DWARF-WIN-FP-ELIM:    .cfi_offset d11, -24
309 ; DWARF-WIN-FP-ELIM:    .cfi_offset d10, -32
310 ; DWARF-WIN-FP-ELIM:    .cfi_offset d9, -40
311 ; DWARF-WIN-FP-ELIM:    sub sp, #8
312 ; DWARF-WIN-FP-ELIM:    .cfi_def_cfa_offset 56
313 ; DWARF-WIN-FP-ELIM:    add sp, #8
314 ; DWARF-WIN-FP-ELIM:    vpop {d8, d9, d10, d11, d12}
315 ; DWARF-WIN-FP-ELIM:    pop {r4, pc}
316 ; DWARF-WIN-FP-ELIM:    .cfi_endproc
318 ; SEH-WIN-FP-ELIM-LABEL: _Z4testiiiiiddddd:
319 ; SEH-WIN-FP-ELIM:    .seh_proc _Z4testiiiiiddddd
320 ; SEH-WIN-FP-ELIM:    .seh_handler __gxx_personality_v0, %unwind, %except
321 ; SEH-WIN-FP-ELIM:    push {r4, lr}
322 ; SEH-WIN-FP-ELIM:    .seh_save_regs {r4, lr}
323 ; SEH-WIN-FP-ELIM:    vpush {d8, d9, d10, d11, d12}
324 ; SEH-WIN-FP-ELIM:    .seh_save_fregs {d8-d12}
325 ; SEH-WIN-FP-ELIM:    sub sp, #8
326 ; SEH-WIN-FP-ELIM:    .seh_stackalloc 8
327 ; SEH-WIN-FP-ELIM:    .seh_endprologue
328 ; SEH-WIN-FP-ELIM:    .seh_startepilogue
329 ; SEH-WIN-FP-ELIM:    add sp, #8
330 ; SEH-WIN-FP-ELIM:    .seh_stackalloc 8
331 ; SEH-WIN-FP-ELIM:    vpop {d8, d9, d10, d11, d12}
332 ; SEH-WIN-FP-ELIM:    .seh_save_fregs {d8-d12}
333 ; SEH-WIN-FP-ELIM:    pop {r4, pc}
334 ; SEH-WIN-FP-ELIM:    .seh_save_regs {r4, lr}
335 ; SEH-WIN-FP-ELIM:    .seh_endepilogue
336 ; SEH-WIN-FP-ELIM:    .seh_endproc
338 ;-------------------------------------------------------------------------------
339 ; Test 2
340 ;-------------------------------------------------------------------------------
342 declare void @throw_exception_2()
344 define void @test2() {
345 entry:
346   call void @throw_exception_2()
347   ret void
350 ; CHECK-FP-LABEL: test2:
351 ; CHECK-FP:   .fnstart
352 ; CHECK-FP:   .save  {r11, lr}
353 ; CHECK-FP:   push   {r11, lr}
354 ; CHECK-FP:   .setfp r11, sp
355 ; CHECK-FP:   mov    r11, sp
356 ; CHECK-FP:   pop    {r11, lr}
357 ; CHECK-FP:   mov    pc, lr
358 ; CHECK-FP:   .fnend
360 ; CHECK-FP-ELIM-LABEL: test2:
361 ; CHECK-FP-ELIM:   .fnstart
362 ; CHECK-FP-ELIM:   .save {r11, lr}
363 ; CHECK-FP-ELIM:   push  {r11, lr}
364 ; CHECK-FP-ELIM:   pop   {r11, lr}
365 ; CHECK-FP-ELIM:   mov   pc, lr
366 ; CHECK-FP-ELIM:   .fnend
368 ; CHECK-V7-FP-LABEL: test2:
369 ; CHECK-V7-FP:   .fnstart
370 ; CHECK-V7-FP:   .save  {r11, lr}
371 ; CHECK-V7-FP:   push   {r11, lr}
372 ; CHECK-V7-FP:   .setfp r11, sp
373 ; CHECK-V7-FP:   mov    r11, sp
374 ; CHECK-V7-FP:   pop    {r11, pc}
375 ; CHECK-V7-FP:   .fnend
377 ; CHECK-V7-FP-ELIM-LABEL: test2:
378 ; CHECK-V7-FP-ELIM:   .fnstart
379 ; CHECK-V7-FP-ELIM:   .save {r11, lr}
380 ; CHECK-V7-FP-ELIM:   push  {r11, lr}
381 ; CHECK-V7-FP-ELIM:   pop   {r11, pc}
382 ; CHECK-V7-FP-ELIM:   .fnend
384 ; DWARF-FP-LABEL: test2:
385 ; DWARF-FP:    .cfi_startproc
386 ; DWARF-FP:    push {r11, lr}
387 ; DWARF-FP:    .cfi_def_cfa_offset 8
388 ; DWARF-FP:    .cfi_offset lr, -4
389 ; DWARF-FP:    .cfi_offset r11, -8
390 ; DWARF-FP:    mov  r11, sp
391 ; DWARF-FP:    .cfi_def_cfa_register r11
392 ; DWARF-FP:    pop  {r11, lr}
393 ; DWARF-FP:    mov  pc, lr
394 ; DWARF-FP:    .cfi_endproc
396 ; DWARF-FP-ELIM-LABEL: test2:
397 ; DWARF-FP-ELIM:    .cfi_startproc
398 ; DWARF-FP-ELIM:    push {r11, lr}
399 ; DWARF-FP-ELIM:    .cfi_def_cfa_offset 8
400 ; DWARF-FP-ELIM:    .cfi_offset lr, -4
401 ; DWARF-FP-ELIM:    .cfi_offset r11, -8
402 ; DWARF-FP-ELIM:    pop  {r11, lr}
403 ; DWARF-FP-ELIM:    mov  pc, lr
404 ; DWARF-FP-ELIM:    .cfi_endproc
406 ; DWARF-V7-FP-LABEL: test2:
407 ; DWARF-V7-FP:    .cfi_startproc
408 ; DWARF-V7-FP:    push {r11, lr}
409 ; DWARF-V7-FP:    .cfi_def_cfa_offset 8
410 ; DWARF-V7-FP:    .cfi_offset lr, -4
411 ; DWARF-V7-FP:    .cfi_offset r11, -8
412 ; DWARF-V7-FP:    mov  r11, sp
413 ; DWARF-V7-FP:    .cfi_def_cfa_register r11
414 ; DWARF-V7-FP:    pop  {r11, pc}
415 ; DWARF-V7-FP:    .cfi_endproc
417 ; DWARF-V7-FP-ELIM-LABEL: test2:
418 ; DWARF-V7-FP-ELIM:    .cfi_startproc
419 ; DWARF-V7-FP-ELIM:    push {r11, lr}
420 ; DWARF-V7-FP-ELIM:    .cfi_def_cfa_offset 8
421 ; DWARF-V7-FP-ELIM:    .cfi_offset lr, -4
422 ; DWARF-V7-FP-ELIM:    .cfi_offset r11, -8
423 ; DWARF-V7-FP-ELIM:    pop  {r11, pc}
424 ; DWARF-V7-FP-ELIM:    .cfi_endproc
426 ; DWARF-WIN-FP-ELIM-LABEL: test2:
427 ; DWARF-WIN-FP-ELIM:    .cfi_startproc
428 ; DWARF-WIN-FP-ELIM:    push.w {r11, lr}
429 ; DWARF-WIN-FP-ELIM:    .cfi_def_cfa_offset 8
430 ; DWARF-WIN-FP-ELIM:    .cfi_offset lr, -4
431 ; DWARF-WIN-FP-ELIM:    .cfi_offset r11, -8
432 ; DWARF-WIN-FP-ELIM:    pop.w  {r11, pc}
433 ; DWARF-WIN-FP-ELIM:    .cfi_endproc
435 ; SEH-WIN-FP-ELIM-LABEL: test2:
436 ; SEH-WIN-FP-ELIM:    .seh_proc test2
437 ; SEH-WIN-FP-ELIM:    push.w {r11, lr}
438 ; SEH-WIN-FP-ELIM:    .seh_save_regs_w {r11, lr}
439 ; SEH-WIN-FP-ELIM:    .seh_endprologue
440 ; SEH-WIN-FP-ELIM:    .seh_startepilogue
441 ; SEH-WIN-FP-ELIM:    pop.w  {r11, pc}
442 ; SEH-WIN-FP-ELIM:    .seh_endepilogue
443 ; SEH-WIN-FP-ELIM:    .seh_endproc
446 ;-------------------------------------------------------------------------------
447 ; Test 3
448 ;-------------------------------------------------------------------------------
450 declare void @throw_exception_3(i32)
452 define i32 @test3(i32 %a, i32 %b, i32 %c, i32 %d,
453                   i32 %e, i32 %f, i32 %g, i32 %h) {
454 entry:
455   %add = add nsw i32 %b, %a
456   %add1 = add nsw i32 %add, %c
457   %add2 = add nsw i32 %add1, %d
458   tail call void @throw_exception_3(i32 %add2)
459   %add3 = add nsw i32 %f, %e
460   %add4 = add nsw i32 %add3, %g
461   %add5 = add nsw i32 %add4, %h
462   tail call void @throw_exception_3(i32 %add5)
463   %add6 = add nsw i32 %add5, %add2
464   ret i32 %add6
467 ; CHECK-FP-LABEL: test3:
468 ; CHECK-FP:   .fnstart
469 ; CHECK-FP:   .save  {r4, r5, r11, lr}
470 ; CHECK-FP:   push   {r4, r5, r11, lr}
471 ; CHECK-FP:   .setfp r11, sp, #8
472 ; CHECK-FP:   add    r11, sp, #8
473 ; CHECK-FP:   pop    {r4, r5, r11, lr}
474 ; CHECK-FP:   mov    pc, lr
475 ; CHECK-FP:   .fnend
477 ; CHECK-FP-ELIM-LABEL: test3:
478 ; CHECK-FP-ELIM:   .fnstart
479 ; CHECK-FP-ELIM:   .save {r4, r5, r11, lr}
480 ; CHECK-FP-ELIM:   push  {r4, r5, r11, lr}
481 ; CHECK-FP-ELIM:   pop   {r4, r5, r11, lr}
482 ; CHECK-FP-ELIM:   mov   pc, lr
483 ; CHECK-FP-ELIM:   .fnend
485 ; CHECK-V7-FP-LABEL: test3:
486 ; CHECK-V7-FP:   .fnstart
487 ; CHECK-V7-FP:   .save  {r4, r5, r11, lr}
488 ; CHECK-V7-FP:   push   {r4, r5, r11, lr}
489 ; CHECK-V7-FP:   .setfp r11, sp, #8
490 ; CHECK-V7-FP:   add    r11, sp, #8
491 ; CHECK-V7-FP:   pop    {r4, r5, r11, pc}
492 ; CHECK-V7-FP:   .fnend
494 ; CHECK-V7-FP-ELIM-LABEL: test3:
495 ; CHECK-V7-FP-ELIM:   .fnstart
496 ; CHECK-V7-FP-ELIM:   .save {r4, r5, r11, lr}
497 ; CHECK-V7-FP-ELIM:   push  {r4, r5, r11, lr}
498 ; CHECK-V7-FP-ELIM:   pop   {r4, r5, r11, pc}
499 ; CHECK-V7-FP-ELIM:   .fnend
501 ; DWARF-FP-LABEL: test3:
502 ; DWARF-FP:    .cfi_startproc
503 ; DWARF-FP:    push {r4, r5, r11, lr}
504 ; DWARF-FP:    .cfi_def_cfa_offset 16
505 ; DWARF-FP:    .cfi_offset lr, -4
506 ; DWARF-FP:    .cfi_offset r11, -8
507 ; DWARF-FP:    .cfi_offset r5, -12
508 ; DWARF-FP:    .cfi_offset r4, -16
509 ; DWARF-FP:    add  r11, sp, #8
510 ; DWARF-FP:    .cfi_def_cfa r11, 8
511 ; DWARF-FP:    pop  {r4, r5, r11, lr}
512 ; DWARF-FP:    mov  pc, lr
513 ; DWARF-FP:    .cfi_endproc
515 ; DWARF-FP-ELIM-LABEL: test3:
516 ; DWARF-FP-ELIM:    .cfi_startproc
517 ; DWARF-FP-ELIM:    push {r4, r5, r11, lr}
518 ; DWARF-FP-ELIM:    .cfi_def_cfa_offset 16
519 ; DWARF-FP-ELIM:    .cfi_offset lr, -4
520 ; DWARF-FP-ELIM:    .cfi_offset r11, -8
521 ; DWARF-FP-ELIM:    .cfi_offset r5, -12
522 ; DWARF-FP-ELIM:    .cfi_offset r4, -16
523 ; DWARF-FP-ELIM:    pop  {r4, r5, r11, lr}
524 ; DWARF-FP-ELIM:    mov  pc, lr
525 ; DWARF-FP-ELIM:    .cfi_endproc
527 ; DWARF-V7-FP-LABEL: test3:
528 ; DWARF-V7-FP:    .cfi_startproc
529 ; DWARF-V7-FP:    push {r4, r5, r11, lr}
530 ; DWARF-V7-FP:    .cfi_def_cfa_offset 16
531 ; DWARF-V7-FP:    .cfi_offset lr, -4
532 ; DWARF-V7-FP:    .cfi_offset r11, -8
533 ; DWARF-V7-FP:    .cfi_offset r5, -12
534 ; DWARF-V7-FP:    .cfi_offset r4, -16
535 ; DWARF-V7-FP:    add  r11, sp, #8
536 ; DWARF-V7-FP:    .cfi_def_cfa r11, 8
537 ; DWARF-V7-FP:    pop  {r4, r5, r11, pc}
538 ; DWARF-V7-FP:    .cfi_endproc
540 ; DWARF-V7-FP-ELIM-LABEL: test3:
541 ; DWARF-V7-FP-ELIM:    .cfi_startproc
542 ; DWARF-V7-FP-ELIM:    push {r4, r5, r11, lr}
543 ; DWARF-V7-FP-ELIM:    .cfi_def_cfa_offset 16
544 ; DWARF-V7-FP-ELIM:    .cfi_offset lr, -4
545 ; DWARF-V7-FP-ELIM:    .cfi_offset r11, -8
546 ; DWARF-V7-FP-ELIM:    .cfi_offset r5, -12
547 ; DWARF-V7-FP-ELIM:    .cfi_offset r4, -16
548 ; DWARF-V7-FP-ELIM:    pop  {r4, r5, r11, pc}
549 ; DWARF-V7-FP-ELIM:    .cfi_endproc
551 ; DWARF-WIN-FP-ELIM-LABEL: test3:
552 ; DWARF-WIN-FP-ELIM:    .cfi_startproc
553 ; DWARF-WIN-FP-ELIM:    push.w {r4, r5, r11, lr}
554 ; DWARF-WIN-FP-ELIM:    .cfi_def_cfa_offset 16
555 ; DWARF-WIN-FP-ELIM:    .cfi_offset lr, -4
556 ; DWARF-WIN-FP-ELIM:    .cfi_offset r11, -8
557 ; DWARF-WIN-FP-ELIM:    .cfi_offset r5, -12
558 ; DWARF-WIN-FP-ELIM:    .cfi_offset r4, -16
559 ; DWARF-WIN-FP-ELIM:    pop.w  {r4, r5, r11, pc}
560 ; DWARF-WIN-FP-ELIM:    .cfi_endproc
562 ; SEH-WIN-FP-ELIM-LABEL: test3:
563 ; SEH-WIN-FP-ELIM:    .seh_proc test3
564 ; SEH-WIN-FP-ELIM:    push.w {r4, r5, r11, lr}
565 ; SEH-WIN-FP-ELIM:    .seh_save_regs_w {r4-r5, r11, lr}
566 ; SEH-WIN-FP-ELIM:    .seh_endprologue
567 ; SEH-WIN-FP-ELIM:    .seh_startepilogue
568 ; SEH-WIN-FP-ELIM:    pop.w  {r4, r5, r11, pc}
569 ; SEH-WIN-FP-ELIM:    .seh_save_regs_w {r4-r5, r11, lr}
570 ; SEH-WIN-FP-ELIM:    .seh_endepilogue
571 ; SEH-WIN-FP-ELIM:    .seh_endproc
574 ;-------------------------------------------------------------------------------
575 ; Test 4
576 ;-------------------------------------------------------------------------------
578 define void @test4() nounwind "frame-pointer"="none" {
579 entry:
580   ret void
583 ; CHECK-FP-LABEL: test4:
584 ; CHECK-FP:   .fnstart
585 ; CHECK-FP:   mov pc, lr
586 ; CHECK-FP:   .cantunwind
587 ; CHECK-FP:   .fnend
589 ; CHECK-FP-ELIM-LABEL: test4:
590 ; CHECK-FP-ELIM:   .fnstart
591 ; CHECK-FP-ELIM:   mov pc, lr
592 ; CHECK-FP-ELIM:   .cantunwind
593 ; CHECK-FP-ELIM:   .fnend
595 ; CHECK-V7-FP-LABEL: test4:
596 ; CHECK-V7-FP:   .fnstart
597 ; CHECK-V7-FP:   bx lr
598 ; CHECK-V7-FP:   .cantunwind
599 ; CHECK-V7-FP:   .fnend
601 ; CHECK-V7-FP-ELIM-LABEL: test4:
602 ; CHECK-V7-FP-ELIM:   .fnstart
603 ; CHECK-V7-FP-ELIM:   bx lr
604 ; CHECK-V7-FP-ELIM:   .cantunwind
605 ; CHECK-V7-FP-ELIM:   .fnend
607 ; DWARF-FP-LABEL: test4:
608 ; DWARF-FP-NOT: .cfi_startproc
609 ; DWARF-FP:    mov pc, lr
610 ; DWARF-FP-NOT: .cfi_endproc
611 ; DWARF-FP:    .size test4,
613 ; DWARF-FP-ELIM-LABEL: test4:
614 ; DWARF-FP-ELIM-NOT: .cfi_startproc
615 ; DWARF-FP-ELIM:     mov pc, lr
616 ; DWARF-FP-ELIM-NOT: .cfi_endproc
617 ; DWARF-FP-ELIM:     .size test4,
619 ; DWARF-V7-FP-LABEL: test4:
620 ; DWARF-V7-FP-NOT: .cfi_startproc
621 ; DWARF-V7-FP:    bx lr
622 ; DWARF-V7-FP-NOT: .cfi_endproc
623 ; DWARF-V7-FP:    .size test4,
625 ; DWARF-V7-FP-ELIM-LABEL: test4:
626 ; DWARF-V7-FP-ELIM-NOT: .cfi_startproc
627 ; DWARF-V7-FP-ELIM:     bx lr
628 ; DWARF-V7-FP-ELIM-NOT: .cfi_endproc
629 ; DWARF-V7-FP-ELIM:     .size test4,
631 ; DWARF-WIN-FP-ELIM-LABEL: test4:
632 ; DWARF-WIN-FP-ELIM-NOT: .cfi_startproc
633 ; DWARF-WIN-FP-ELIM:     bx lr
634 ; DWARF-WIN-FP-ELIM-NOT: .cfi_endproc
636 ; SEH-WIN-FP-ELIM-LABEL: test4:
637 ; SEH-WIN-FP-ELIM-NOT: .seh_proc test4
638 ; SEH-WIN-FP-ELIM:     bx lr
639 ; SEH-WIN-FP-ELIM-NOT: .seh_endproc