1 ; RUN: llc < %s -march=xcore | FileCheck %s
4 declare i32 @__gxx_personality_v0(...)
5 declare i32 @llvm.eh.typeid.for(ptr) nounwind readnone
6 declare ptr @__cxa_begin_catch(ptr)
7 declare void @__cxa_end_catch()
8 declare ptr @__cxa_allocate_exception(i32)
9 declare void @__cxa_throw(ptr, ptr, ptr)
11 @_ZTIi = external constant ptr
12 @_ZTId = external constant ptr
14 ; CHECK-LABEL: fn_typeid:
15 ; CHECK: .cfi_startproc
19 define i32 @fn_typeid() {
21 %0 = call i32 @llvm.eh.typeid.for(ptr @_ZTIi) nounwind
25 ; CHECK-LABEL: fn_throw
26 ; CHECK: .cfi_startproc
28 ; CHECK: .cfi_def_cfa_offset 4
29 ; CHECK: .cfi_offset 15, 0
31 ; CHECK: bl __cxa_allocate_exception
32 ; CHECK: ldaw r1, dp[_ZTIi]
34 ; CHECK: bl __cxa_throw
35 define void @fn_throw() {
37 %0 = call ptr @__cxa_allocate_exception(i32 4) nounwind
38 call void @__cxa_throw(ptr %0, ptr @_ZTIi, ptr null) noreturn
42 ; CHECK-LABEL: fn_catch:
43 ; CHECK-NEXT: [[START:.L[a-zA-Z0-9_]+]]
44 ; CHECK: .cfi_startproc
45 ; CHECK: .cfi_personality 0, __gxx_personality_v0
46 ; CHECK: .cfi_lsda 0, [[LSDA:.L[a-zA-Z0-9_]+]]
48 ; CHECK: .cfi_def_cfa_offset 16
49 ; CHECK: .cfi_offset 15, 0
50 define void @fn_catch() personality ptr @__gxx_personality_v0 {
53 ; N.B. we alloc no variables, hence force compiler to spill
54 ; CHECK: stw r4, sp[3]
55 ; CHECK: .cfi_offset 4, -4
56 ; CHECK: stw r5, sp[2]
57 ; CHECK: .cfi_offset 5, -8
58 ; CHECK: stw r6, sp[1]
59 ; CHECK: .cfi_offset 6, -12
60 ; CHECK: [[PRE_G:.L[a-zA-Z0-9_]+]]
62 ; CHECK: [[POST_G:.L[a-zA-Z0-9_]+]]
63 ; CHECK: [[RETURN:.L[a-zA-Z0-9_]+]]
64 ; CHECK: ldw r6, sp[1]
65 ; CHECK: ldw r5, sp[2]
66 ; CHECK: ldw r4, sp[3]
68 invoke void @g() to label %cont unwind label %lpad
72 ; CHECK: {{.L[a-zA-Z0-9_]+}}
73 ; CHECK: [[LANDING:.L[a-zA-Z0-9_]+]]
76 ; CHECK: bl __cxa_begin_catch
77 ; CHECK: ldw r6, r0[0]
78 ; CHECK: bl __cxa_end_catch
80 %0 = landingpad { ptr, i32 }
84 %1 = extractvalue { ptr, i32 } %0, 0
85 %2 = extractvalue { ptr, i32 } %0, 1
86 %3 = call ptr @__cxa_begin_catch(ptr %1) nounwind
88 call void @__cxa_end_catch() nounwind
90 ; CHECK: eq r0, r6, r5
91 ; CHECK: bf r0, [[RETURN]]
93 ; CHECK: bl _Unwind_Resume
94 ; CHECK: [[END:.L[a-zA-Z0-9_]+]]
96 %5 = icmp eq i32 %4, %2
97 br i1 %5, label %Resume, label %Exit
99 resume { ptr, i32 } %0
107 ; CHECK: .uleb128 [[TTBASE:.Lttbase[0-9]+]]-[[TTBASEREF:.Lttbaseref[0-9]+]]
108 ; CHECK: [[TTBASEREF]]:
110 ; CHECK: .uleb128 [[CST_END:.Lcst_end[0-9]+]]-[[CST_BEGIN:.Lcst_begin[0-9]+]]
111 ; CHECK: [[CST_BEGIN]]:
112 ; CHECK: .uleb128 [[PRE_G]]-[[START]]
113 ; CHECK: .uleb128 [[POST_G]]-[[PRE_G]]
114 ; CHECK: .uleb128 [[LANDING]]-[[START]]
116 ; CHECK: .uleb128 [[POST_G]]-[[START]]
117 ; CHECK: .uleb128 [[END]]-[[POST_G]]
120 ; CHECK: [[CST_END]]: