fixed to test only the feature, not the feature and a CPU
[oota-llvm.git] / test / CodeGen / X86 / gcc_except_table_functions.ll
1 ; RUN: llc -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s
2
3 ; This test demonstrates that it is possible to use functions for typeinfo
4 ; instead of global variables. While __gxx_personality_v0 would never know what
5 ; to do with them, other EH schemes such as SEH might use them.
6
7 declare i32 @__gxx_personality_v0(...)
8 declare void @filt0()
9 declare void @filt1()
10 declare void @_Z1fv()
11 declare i32 @llvm.eh.typeid.for(i8*)
12
13 define i32 @main() uwtable {
14 entry:
15   invoke void @_Z1fv()
16           to label %try.cont unwind label %lpad
17
18 try.cont:
19   ret i32 0
20
21 lpad:
22   %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
23           catch i8* bitcast (void ()* @filt0 to i8*)
24           catch i8* bitcast (void ()* @filt1 to i8*)
25   %sel = extractvalue { i8*, i32 } %0, 1
26   %id0 = call i32 @llvm.eh.typeid.for(i8* bitcast (void ()* @filt0 to i8*))
27   %is_f0 = icmp eq i32 %sel, %id0
28   br i1 %is_f0, label %try.cont, label %check_f1
29
30 check_f1:
31   %id1 = call i32 @llvm.eh.typeid.for(i8* bitcast (void ()* @filt1 to i8*))
32   %is_f1 = icmp eq i32 %sel, %id1
33   br i1 %is_f1, label %try.cont, label %eh.resume
34
35 eh.resume:
36   resume { i8*, i32 } %0
37 }
38
39 ; CHECK-LABEL: main:
40 ; CHECK: .cfi_startproc
41 ; CHECK: .cfi_personality 3, __gxx_personality_v0
42 ; CHECK: .cfi_lsda 3, .Lexception0
43 ; CHECK: .cfi_def_cfa_offset 16
44 ; CHECK: callq _Z1fv
45 ; CHECK: retq
46 ; CHECK: cmpl $2, %edx
47 ; CHECK: je
48 ; CHECK: cmpl $1, %edx
49 ; CHECK: je
50 ; CHECK: callq _Unwind_Resume
51 ; CHECK: .cfi_endproc
52 ; CHECK: GCC_except_table0:
53 ; CHECK: Lexception0: