blob: 68f8e95b5e73f6ae83ccafd93070a8d3dd366dd7 [file] [log] [blame]
Joerg Sonnenbergercf86ce12014-05-07 07:49:34 +00001; RUN: llc -mtriple=arm-netbsd-eabi -o - -filetype=asm %s | \
2; RUN: FileCheck %s
3; RUN: llc -mtriple=arm-netbsd-eabi -o - -filetype=asm %s \
4; RUN: -relocation-model=pic | FileCheck -check-prefix=CHECK-PIC %s
Renato Golina78995c2015-02-27 16:35:27 +00005; RUN: llc -mtriple=armv7-bitrig-gnueabihf -o - -filetype=asm %s | \
6; RUN: FileCheck %s
7; RUN: llc -mtriple=armv7-bitrig-gnueabihf -o - -filetype=asm %s \
8; RUN: -relocation-model=pic | FileCheck -check-prefix=CHECK-PIC %s
Joerg Sonnenbergercf86ce12014-05-07 07:49:34 +00009
10; ModuleID = 'test.cc'
11target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32-S64"
12target triple = "armv5e--netbsd-eabi"
13
14%struct.exception = type { i8 }
15
16@_ZTVN10__cxxabiv117__class_type_infoE = external global i8*
17@_ZTS9exception = linkonce_odr constant [11 x i8] c"9exception\00"
David Blaikief72d05b2015-03-13 18:20:45 +000018@_ZTI9exception = linkonce_odr unnamed_addr constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv117__class_type_infoE, i32 2) to i8*), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_ZTS9exception, i32 0, i32 0) }
Joerg Sonnenbergercf86ce12014-05-07 07:49:34 +000019
David Majnemer7fddecc2015-06-17 20:52:32 +000020define void @f() uwtable personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
Joerg Sonnenbergercf86ce12014-05-07 07:49:34 +000021 %1 = alloca i8*
22 %2 = alloca i32
23 %e = alloca %struct.exception*, align 4
24 invoke void @g()
25 to label %3 unwind label %4
26
27 br label %16
28
David Majnemer7fddecc2015-06-17 20:52:32 +000029 %5 = landingpad { i8*, i32 }
Joerg Sonnenbergercf86ce12014-05-07 07:49:34 +000030 catch i8* bitcast ({ i8*, i8* }* @_ZTI9exception to i8*)
31 %6 = extractvalue { i8*, i32 } %5, 0
32 store i8* %6, i8** %1
33 %7 = extractvalue { i8*, i32 } %5, 1
34 store i32 %7, i32* %2
35 br label %8
36
David Blaikiea79ac142015-02-27 21:17:42 +000037 %9 = load i32, i32* %2
Joerg Sonnenbergercf86ce12014-05-07 07:49:34 +000038 %10 = call i32 @llvm.eh.typeid.for(i8* bitcast ({ i8*, i8* }* @_ZTI9exception to i8*)) nounwind
39 %11 = icmp eq i32 %9, %10
40 br i1 %11, label %12, label %17
41
David Blaikiea79ac142015-02-27 21:17:42 +000042 %13 = load i8*, i8** %1
Joerg Sonnenbergercf86ce12014-05-07 07:49:34 +000043 %14 = call i8* @__cxa_begin_catch(i8* %13) #3
44 %15 = bitcast i8* %14 to %struct.exception*
45 store %struct.exception* %15, %struct.exception** %e
46 call void @__cxa_end_catch()
47 br label %16
48
49 ret void
50
David Blaikiea79ac142015-02-27 21:17:42 +000051 %18 = load i8*, i8** %1
52 %19 = load i32, i32* %2
Joerg Sonnenbergercf86ce12014-05-07 07:49:34 +000053 %20 = insertvalue { i8*, i32 } undef, i8* %18, 0
54 %21 = insertvalue { i8*, i32 } %20, i32 %19, 1
55 resume { i8*, i32 } %21
56}
57
58declare void @g()
59
60declare i32 @__gxx_personality_v0(...)
61
62declare i32 @llvm.eh.typeid.for(i8*) nounwind readnone
63
64declare i8* @__cxa_begin_catch(i8*)
65
66declare void @__cxa_end_catch()
67
68; CHECK: .cfi_personality 0,
69; CHECK: .cfi_lsda 0,
70; CHECK: @TType Encoding = absptr
71; CHECK: @ Call site Encoding = udata4
72; CHECK-PIC: .cfi_personality 155,
73; CHECK-PIC: .cfi_lsda 27,
74; CHECK-PIC: @TType Encoding = indirect pcrel sdata4
75; CHECK-PIC: @ Call site Encoding = udata4