blob: f112328346d8f31c8a160c77a2ee7b5bf419ab86 [file] [log] [blame]
Stephen Hines36b56882014-04-23 16:57:46 -07001; RUN: llc < %s -march=sparc -relocation-model=static | FileCheck -check-prefix=V8ABS %s
2; RUN: llc < %s -march=sparc -relocation-model=pic | FileCheck -check-prefix=V8PIC %s
Stephen Hines36b56882014-04-23 16:57:46 -07003; RUN: llc < %s -march=sparcv9 -relocation-model=static | FileCheck -check-prefix=V9ABS %s
4; RUN: llc < %s -march=sparcv9 -relocation-model=pic | FileCheck -check-prefix=V9PIC %s
Venkatraman Govindaraju30ec8a32013-09-26 15:11:00 +00005
6
7%struct.__fundamental_type_info_pseudo = type { %struct.__type_info_pseudo }
8%struct.__type_info_pseudo = type { i8*, i8* }
9
10@_ZTIi = external constant %struct.__fundamental_type_info_pseudo
11@_ZTIf = external constant %struct.__fundamental_type_info_pseudo
Stephen Hines36b56882014-04-23 16:57:46 -070012@.cst = private unnamed_addr constant [12 x i8] c"catched int\00", align 64
13@.cst1 = private unnamed_addr constant [14 x i8] c"catched float\00", align 64
Venkatraman Govindaraju30ec8a32013-09-26 15:11:00 +000014
Stephen Hines36b56882014-04-23 16:57:46 -070015; V8ABS-LABEL: main:
16; V8ABS: .cfi_startproc
17; V8ABS: .cfi_personality 0, __gxx_personality_v0
18; V8ABS: .cfi_lsda 0,
19; V8ABS: .cfi_def_cfa_register {{30|%fp}}
20; V8ABS: .cfi_window_save
21; V8ABS: .cfi_register 15, 31
Venkatraman Govindaraju30ec8a32013-09-26 15:11:00 +000022
Stephen Hines36b56882014-04-23 16:57:46 -070023; V8ABS: call __cxa_throw
24; V8ABS: call __cxa_throw
Venkatraman Govindaraju30ec8a32013-09-26 15:11:00 +000025
Stephen Hines36b56882014-04-23 16:57:46 -070026; V8ABS: call __cxa_begin_catch
27; V8ABS: call __cxa_end_catch
Venkatraman Govindaraju30ec8a32013-09-26 15:11:00 +000028
Stephen Hines36b56882014-04-23 16:57:46 -070029; V8ABS: call __cxa_begin_catch
30; V8ABS: call __cxa_end_catch
Venkatraman Govindaraju30ec8a32013-09-26 15:11:00 +000031
Stephen Hines36b56882014-04-23 16:57:46 -070032; V8ABS: .cfi_endproc
33
34; V8PIC-LABEL: main:
35; V8PIC: .cfi_startproc
36; V8PIC: .cfi_personality 155, DW.ref.__gxx_personality_v0
37; V8PIC: .cfi_lsda 27,
38; V8PIC: .cfi_def_cfa_register {{30|%fp}}
39; V8PIC: .cfi_window_save
40; V8PIC: .cfi_register 15, 31
41; V8PIC: .section .gcc_except_table
42; V8PIC-NOT: .section
43; V8PIC: .word %r_disp32(.L_ZTIi.DW.stub)
44; V8PIC: .data
45; V8PIC: .L_ZTIi.DW.stub:
46; V8PIC-NEXT: .word _ZTIi
47
Stephen Hines36b56882014-04-23 16:57:46 -070048
49; V9ABS-LABEL: main:
50; V9ABS: .cfi_startproc
51; V9ABS: .cfi_personality 0, __gxx_personality_v0
52; V9ABS: .cfi_lsda 27,
53; V9ABS: .cfi_def_cfa_register {{30|%fp}}
54; V9ABS: .cfi_window_save
55; V9ABS: .cfi_register 15, 31
56; V9ABS: .section .gcc_except_table
57; V9ABS-NOT: .section
58; V9ABS: .xword _ZTIi
59
60; V9PIC-LABEL: main:
61; V9PIC: .cfi_startproc
62; V9PIC: .cfi_personality 155, DW.ref.__gxx_personality_v0
63; V9PIC: .cfi_lsda 27,
64; V9PIC: .cfi_def_cfa_register {{30|%fp}}
65; V9PIC: .cfi_window_save
66; V9PIC: .cfi_register 15, 31
67; V9PIC: .section .gcc_except_table
68; V9PIC-NOT: .section
69; V9PIC: .word %r_disp32(.L_ZTIi.DW.stub)
70; V9PIC: .data
71; V9PIC: .L_ZTIi.DW.stub:
72; V9PIC-NEXT: .xword _ZTIi
73
Pirama Arumuga Nainarf3ef5332016-03-03 15:48:50 -080074define i32 @main(i32 %argc, i8** nocapture readnone %argv) unnamed_addr #0 personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 {
Venkatraman Govindaraju30ec8a32013-09-26 15:11:00 +000075entry:
76 %0 = icmp eq i32 %argc, 2
77 %1 = tail call i8* @__cxa_allocate_exception(i32 4) #1
78 br i1 %0, label %"3", label %"4"
79
80"3": ; preds = %entry
81 %2 = bitcast i8* %1 to i32*
82 store i32 0, i32* %2, align 4
83 invoke void @__cxa_throw(i8* %1, i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIi to i8*), void (i8*)* null) #2
84 to label %3 unwind label %"8"
85
86; <label>:3 ; preds = %"3"
87 unreachable
88
89"4": ; preds = %entry
90 %4 = bitcast i8* %1 to float*
91 store float 1.000000e+00, float* %4, align 4
92
93
94 invoke void @__cxa_throw(i8* %1, i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIf to i8*), void (i8*)* null) #2
95 to label %5 unwind label %"8"
96
97; <label>:5 ; preds = %"4"
98 unreachable
99
100"5": ; preds = %"13", %"11"
101 %6 = phi i32 [ 2, %"13" ], [ 0, %"11" ]
102 ret i32 %6
103
104"8": ; preds = %"4", %"3"
Pirama Arumuga Nainarf3ef5332016-03-03 15:48:50 -0800105 %exc = landingpad { i8*, i32 }
Venkatraman Govindaraju30ec8a32013-09-26 15:11:00 +0000106 catch %struct.__fundamental_type_info_pseudo* @_ZTIi
107 catch %struct.__fundamental_type_info_pseudo* @_ZTIf
108 %exc_ptr12 = extractvalue { i8*, i32 } %exc, 0
109 %filter13 = extractvalue { i8*, i32 } %exc, 1
110 %typeid = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIi to i8*))
111 %7 = icmp eq i32 %filter13, %typeid
112 br i1 %7, label %"11", label %8
113
114; <label>:8 ; preds = %"8"
115 %typeid8 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIf to i8*))
116 %9 = icmp eq i32 %filter13, %typeid8
117 br i1 %9, label %"13", label %"9"
118
119"9": ; preds = %8
120 resume { i8*, i32 } %exc
121
122"11": ; preds = %"8"
123 %10 = tail call i8* @__cxa_begin_catch(i8* %exc_ptr12) #1
Pirama Arumuga Nainar4c5e43d2015-04-08 08:55:49 -0700124 %11 = tail call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.cst, i32 0, i32 0))
Venkatraman Govindaraju30ec8a32013-09-26 15:11:00 +0000125 tail call void @__cxa_end_catch() #1
126 br label %"5"
127
128"13": ; preds = %8
129 %12 = tail call i8* @__cxa_begin_catch(i8* %exc_ptr12) #1
Pirama Arumuga Nainar4c5e43d2015-04-08 08:55:49 -0700130 %13 = tail call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.cst1, i32 0, i32 0))
Venkatraman Govindaraju30ec8a32013-09-26 15:11:00 +0000131 tail call void @__cxa_end_catch() #1
132 br label %"5"
133}
134
135; Function Attrs: nounwind
136declare i8* @__cxa_allocate_exception(i32) #1
137
138; Function Attrs: noreturn
139declare void @__cxa_throw(i8*, i8*, void (i8*)*) #2
140
141declare void @__cxa_end_catch()
142
143; Function Attrs: nounwind readnone
144declare i32 @llvm.eh.typeid.for(i8*) #3
145
146; Function Attrs: nounwind
147declare i8* @__cxa_begin_catch(i8*) #1
148
149; Function Attrs: nounwind
150declare i32 @puts(i8* nocapture readonly) #1
151
152declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*)
153
154attributes #0 = { "no-frame-pointer-elim-non-leaf"="false" }
155attributes #1 = { nounwind }
156attributes #2 = { noreturn }
157attributes #3 = { nounwind readnone }