Better fix for this testcase. Update it to the new EH scheme entirely.
[oota-llvm.git] / test / CodeGen / Mips / eh.ll
1 ; RUN: llc  < %s -march=mipsel -mcpu=4ke | FileCheck %s -check-prefix=CHECK-EL
2 ; RUN: llc  < %s -march=mips   -mcpu=4ke | FileCheck %s -check-prefix=CHECK-EB
3
4 @g1 = global double 0.000000e+00, align 8
5 @_ZTId = external constant i8*
6
7 define void @_Z1fd(double %i2) {
8 entry:
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:  sw  $17
14 ; CHECK-EL:  sw  $16
15 ; CHECK-EL:  .cfi_offset 52, -8
16 ; CHECK-EL:  .cfi_offset 53, -4
17 ; CHECK-EB:  .cfi_offset 53, -8
18 ; CHECK-EB:  .cfi_offset 52, -4
19 ; CHECK-EL:  .cfi_offset 31, -12
20 ; CHECK-EL:  .cfi_offset 17, -16
21 ; CHECK-EL:  .cfi_offset 16, -20
22 ; CHECK-EL:  .cprestore 
23
24   %exception = tail call i8* @__cxa_allocate_exception(i32 8) nounwind
25   %0 = bitcast i8* %exception to double*
26   store double 3.200000e+00, double* %0, align 8, !tbaa !0
27   invoke void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTId to i8*), i8* null) noreturn
28           to label %unreachable unwind label %lpad
29
30 lpad:                                             ; preds = %entry
31 ; CHECK-EL:  # %lpad
32 ; CHECK-EL:  lw  $gp
33 ; CHECK-EL:  beq $5
34
35   %exn.val = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
36            catch i8* bitcast (i8** @_ZTId to i8*)
37   %exn = extractvalue { i8*, i32 } %exn.val, 0
38   %sel = extractvalue { i8*, i32 } %exn.val, 1
39   %1 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTId to i8*)) nounwind
40   %2 = icmp eq i32 %sel, %1
41   br i1 %2, label %catch, label %eh.resume
42
43 catch:                                            ; preds = %lpad
44   %3 = tail call i8* @__cxa_begin_catch(i8* %exn) nounwind
45   %4 = bitcast i8* %3 to double*
46   %exn.scalar = load double* %4, align 8
47   %add = fadd double %exn.scalar, %i2
48   store double %add, double* @g1, align 8, !tbaa !0
49   tail call void @__cxa_end_catch() nounwind
50   ret void
51
52 eh.resume:                                        ; preds = %lpad
53   resume { i8*, i32 } %exn.val
54
55 unreachable:                                      ; preds = %entry
56   unreachable
57 }
58
59 declare i8* @__cxa_allocate_exception(i32)
60
61 declare i8* @llvm.eh.exception() nounwind readonly
62
63 declare i32 @__gxx_personality_v0(...)
64
65 declare i32 @llvm.eh.selector(i8*, i8*, ...) nounwind
66
67 declare i32 @llvm.eh.typeid.for(i8*) nounwind
68
69 declare void @llvm.eh.resume(i8*, i32)
70
71 declare void @__cxa_throw(i8*, i8*, i8*)
72
73 declare i8* @__cxa_begin_catch(i8*)
74
75 declare void @__cxa_end_catch()
76
77 !0 = metadata !{metadata !"double", metadata !1}
78 !1 = metadata !{metadata !"omnipotent char", metadata !2}
79 !2 = metadata !{metadata !"Simple C/C++ TBAA", null}