xref: /llvm-project/llvm/test/CodeGen/Mips/eh.ll (revision cfc1a8787829623ad7427bb7e71f380f6d241262)
1; RUN: llc  < %s -mtriple=mipsel | FileCheck %s -check-prefix=CHECK-EL
2; RUN: llc  < %s -mtriple=mips   | FileCheck %s -check-prefix=CHECK-EB
3
4@g1 = global double 0.000000e+00, align 8
5@_ZTId = external constant ptr
6
7define void @_Z1fd(double %i2) personality ptr @__gxx_personality_v0 {
8entry:
9; CHECK-EL:  addiu $sp, $sp
10; CHECK-EL:  .cfi_def_cfa_offset
11; CHECK-EL:  sdc1 $f20
12; CHECK-EL:  sw  $ra
13; CHECK-EL:  .cfi_offset 52, -8
14; CHECK-EL:  .cfi_offset 53, -4
15; CHECK-EB:  .cfi_offset 53, -8
16; CHECK-EB:  .cfi_offset 52, -4
17; CHECK-EL:  .cfi_offset 31, -12
18
19  %exception = tail call ptr @__cxa_allocate_exception(i32 8) nounwind
20  store double 3.200000e+00, ptr %exception, align 8
21  invoke void @__cxa_throw(ptr %exception, ptr @_ZTId, ptr null) noreturn
22          to label %unreachable unwind label %lpad
23
24lpad:                                             ; preds = %entry
25; CHECK-EL:  # %lpad
26; CHECK-EL:  bne $5
27
28  %exn.val = landingpad { ptr, i32 }
29           cleanup
30           catch ptr @_ZTId
31  %exn = extractvalue { ptr, i32 } %exn.val, 0
32  %sel = extractvalue { ptr, i32 } %exn.val, 1
33  %0 = tail call i32 @llvm.eh.typeid.for(ptr @_ZTId) nounwind
34  %1 = icmp eq i32 %sel, %0
35  br i1 %1, label %catch, label %eh.resume
36
37catch:                                            ; preds = %lpad
38  %2 = tail call ptr @__cxa_begin_catch(ptr %exn) nounwind
39  %exn.scalar = load double, ptr %2, align 8
40  %add = fadd double %exn.scalar, %i2
41  store double %add, ptr @g1, align 8
42  tail call void @__cxa_end_catch() nounwind
43  ret void
44
45eh.resume:                                        ; preds = %lpad
46  resume { ptr, i32 } %exn.val
47
48unreachable:                                      ; preds = %entry
49  unreachable
50}
51
52declare ptr @__cxa_allocate_exception(i32)
53
54declare i32 @__gxx_personality_v0(...)
55
56declare i32 @llvm.eh.typeid.for(ptr) nounwind
57
58declare void @__cxa_throw(ptr, ptr, ptr)
59
60declare ptr @__cxa_begin_catch(ptr)
61
62declare void @__cxa_end_catch()
63