xref: /llvm-project/llvm/test/CodeGen/ARM/eh-dispcont.ll (revision bed1c7f061aa12417aa081e334afdba45767b938)
1; RUN: llc -mtriple armv7-apple-ios -relocation-model=pic -o - %s | FileCheck %s -check-prefix=ARM-PIC -check-prefix=ARM
2; RUN: llc -mtriple armv7-apple-ios -relocation-model=static -o - %s | FileCheck %s -check-prefix=ARM-NOPIC -check-prefix=ARM
3; RUN: llc -mtriple armv7-apple-ios -relocation-model=dynamic-no-pic -o - %s | FileCheck %s -check-prefix=ARM-NOPIC -check-prefix=ARM
4; RUN: llc -mtriple thumbv6-apple-ios -relocation-model=pic -o - %s | FileCheck %s -check-prefix=THUMB1-PIC -check-prefix=THUMB1
5; RUN: llc -mtriple thumbv6-apple-ios -relocation-model=static -o - %s | FileCheck %s -check-prefix=THUMB1-NOPIC -check-prefix=THUMB1
6; RUN: llc -mtriple thumbv6-apple-ios -relocation-model=dynamic-no-pic -o - %s | FileCheck %s -check-prefix=THUMB1-NOPIC -check-prefix=THUMB1
7
8@_ZTIi = external constant ptr
9
10define i32 @main() #0 personality ptr @__gxx_personality_sj0 {
11entry:
12  %exception = tail call ptr @__cxa_allocate_exception(i32 4) #1
13  store i32 1, ptr %exception, align 4
14  invoke void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null) #2
15          to label %unreachable unwind label %lpad
16
17lpad:                                             ; preds = %entry
18  %0 = landingpad { ptr, i32 }
19          catch ptr null
20  %1 = extractvalue { ptr, i32 } %0, 0
21  %2 = tail call ptr @__cxa_begin_catch(ptr %1) #1
22  tail call void @__cxa_end_catch()
23  ret i32 0
24
25unreachable:                                      ; preds = %entry
26  unreachable
27}
28
29declare ptr @__cxa_allocate_exception(i32)
30
31declare void @__cxa_throw(ptr, ptr, ptr)
32
33declare ptr @__cxa_begin_catch(ptr)
34
35declare void @__cxa_end_catch()
36
37declare i32 @__gxx_personality_sj0(...)
38
39attributes #0 = { ssp }
40attributes #1 = { nounwind }
41attributes #2 = { noreturn }
42
43; ARM: vst1.64
44; ARM: vst1.64
45
46; ARM-PIC: cxa_throw
47; ARM-PIC: trap
48; ARM-PIC: adr [[REG1:r[0-9]+]], [[LJTI:.*]]
49; ARM-PIC: ldr [[REG0:r[0-9]+]], [r{{[0-9]+}}, [[REG1]]]
50; ARM-PIC: add pc, [[REG0]], [[REG1]]
51; ARM-PIC: [[LJTI]]
52; ARM-PIC: .data_region jt32
53; ARM-PIC: .long [[LABEL:LBB0_[0-9]]]-[[LJTI]]
54; ARM-PIC: .end_data_region
55; ARM-PIC: [[LABEL]]
56
57; ARM-NOPIC: cxa_throw
58; ARM-NOPIC: trap
59; ARM-NOPIC: adr [[REG1:r[0-9]+]], [[LJTI:.*]]
60; ARM-NOPIC: ldr [[REG0:r[0-9]+]], [r{{[0-9]+}}, [[REG1]]]
61; ARM-NOPIC: mov pc, [[REG0]]
62; ARM-NOPIC: [[LJTI]]
63; ARM-NOPIC: .data_region jt32
64; ARM-NOPIC: .long [[LABEL:LBB0_[0-9]]]
65; ARM-NOPIC: .end_data_region
66; ARM-NOPIC: [[LABEL]]
67
68; ARM: vld1.64
69; ARM: vld1.64
70
71; On Thumb1 targets, we have no way to preserve the floating-point registers.
72; If all other code is built for Thumb1 or is built soft-float, this is not a
73; problem as the FP regs don't need saving. However, if this code is linked
74; against ARM code that uses the FP regs, they won't be restored correctly. We
75; don't support this use-case, but have no way to prevent it in the compiler.
76
77; THUMB1: push {{[^d]*$}}
78; THUMB1-NOT: vst
79
80; THUMB1-PIC: cxa_throw
81; THUMB1-PIC: trap
82; THUMB1-PIC: adr [[REG1:r[0-9]+]], [[LJTI:.*]]
83; THUMB1-PIC: adds [[REG0:r[0-9]+]], [[REG0]], [[REG1]]
84; THUMB1-PIC: ldr [[REG0]]
85; THUMB1-PIC: adds [[REG0]], [[REG0]], [[REG1]]
86; THUMB1-PIC: mov pc, [[REG0]]
87; THUMB1-PIC: [[LJTI]]
88; THUMB1-PIC: .data_region jt32
89; THUMB1-PIC: .long [[LABEL:LBB0_[0-9]]]-[[LJTI]]
90; THUMB1-PIC: .end_data_region
91; THUMB1-PIC: [[LABEL]]
92
93; THUMB1-NOPIC: cxa_throw
94; THUMB1-NOPIC: trap
95; THUMB1-NOPIC: adr [[REG1:r[0-9]+]], [[LJTI:.*]]
96; THUMB1-NOPIC: adds [[REG0:r[0-9]+]], [[REG0]], [[REG1]]
97; THUMB1-NOPIC: ldr [[REG0]]
98; THUMB1-NOPIC: mov pc, [[REG0]]
99; THUMB1-NOPIC: [[LJTI]]
100; THUMB1-NOPIC: .data_region jt32
101; THUMB1-NOPIC: .long [[LABEL:LBB0_[0-9]]]+1
102; THUMB1-NOPIC: .end_data_region
103; THUMB1-NOPIC: [[LABEL]]
104
105; THUMB1-NOT: vld
106; THUMB1: pop {{[^d]*$}}
107