1 ; RUN: llc < %s -march=xcore | FileCheck %s
4 declare i32 @__gxx_personality_v0(...)
5 declare i32 @llvm.eh.typeid.for(i8*) nounwind readnone
6 declare i8* @__cxa_begin_catch(i8*)
7 declare void @__cxa_end_catch()
8 declare i8* @__cxa_allocate_exception(i32)
9 declare void @__cxa_throw(i8*, i8*, i8*)
11 @_ZTIi = external constant i8*
12 @_ZTId = external constant i8*
14 ; CHECK-LABEL: fn_typeid:
15 ; CHECK: .cfi_startproc
19 define i32 @fn_typeid() {
21 %0 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) 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 i8* @__cxa_allocate_exception(i32 4) nounwind
38 call void @__cxa_throw(i8* %0, i8* bitcast (i8** @_ZTIi to i8*), i8* 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 i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
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 { i8*, i32 }
82 catch i8* bitcast (i8** @_ZTIi to i8*)
83 catch i8* bitcast (i8** @_ZTId to i8*)
84 %1 = extractvalue { i8*, i32 } %0, 0
85 %2 = extractvalue { i8*, i32 } %0, 1
86 %3 = call i8* @__cxa_begin_catch(i8* %1) nounwind
87 %4 = bitcast i8* %3 to i32*
88 %5 = load i32, i32* %4
89 call void @__cxa_end_catch() nounwind
91 ; CHECK: eq r0, r6, r5
92 ; CHECK: bf r0, [[RETURN]]
94 ; CHECK: bl _Unwind_Resume
95 ; CHECK: [[END:.L[a-zA-Z0-9_]+]]
97 %6 = icmp eq i32 %5, %2
98 br i1 %6, label %Resume, label %Exit
100 resume { i8*, i32 } %0
108 ; CHECK: .uleb128 [[TTBASE:.Lttbase[0-9]+]]-[[TTBASEREF:.Lttbaseref[0-9]+]]
109 ; CHECK: [[TTBASEREF]]:
111 ; CHECK: .uleb128 [[CST_END:.Lcst_end[0-9]+]]-[[CST_BEGIN:.Lcst_begin[0-9]+]]
112 ; CHECK: [[CST_BEGIN]]:
113 ; CHECK: .uleb128 [[PRE_G]]-[[START]]
114 ; CHECK: .uleb128 [[POST_G]]-[[PRE_G]]
115 ; CHECK: .uleb128 [[LANDING]]-[[START]]
117 ; CHECK: .uleb128 [[POST_G]]-[[START]]
118 ; CHECK: .uleb128 [[END]]-[[POST_G]]
121 ; CHECK: [[CST_END]]: