1; RUN: llc -march=riscv32 --code-model=small  < %s \
2; RUN:     | FileCheck %s
3; RUN: llc -march=riscv32 --code-model=medium < %s \
4; RUN:     | FileCheck %s
5; RUN: llc -march=riscv32 --code-model=small  -relocation-model=pic < %s \
6; RUN:     | FileCheck %s
7; RUN: llc -march=riscv32 --code-model=medium -relocation-model=pic < %s \
8; RUN:     | FileCheck %s
9; RUN: llc -march=riscv64 --code-model=small  < %s \
10; RUN:     | FileCheck %s
11; RUN: llc -march=riscv64 --code-model=medium < %s \
12; RUN:     | FileCheck %s
13; RUN: llc -march=riscv64 --code-model=small  -relocation-model=pic < %s \
14; RUN:     | FileCheck %s
15; RUN: llc -march=riscv64 --code-model=medium -relocation-model=pic < %s \
16; RUN:     | FileCheck %s
17
18declare void @throw_exception()
19
20declare i32 @__gxx_personality_v0(...)
21
22declare i8* @__cxa_begin_catch(i8*)
23
24declare void @__cxa_end_catch()
25
26; CHECK-LABEL: test1:
27; CHECK: .cfi_startproc
28; PersonalityEncoding = DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4
29; CHECK-NEXT:	.cfi_personality 155, DW.ref.__gxx_personality_v0
30; LSDAEncoding = DW_EH_PE_pcrel | DW_EH_PE_sdata4
31; CHECK-NEXT:	.cfi_lsda 27, .Lexception0
32
33define void @test1() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
34entry:
35  invoke void @throw_exception() to label %try.cont unwind label %lpad
36
37lpad:
38  %0 = landingpad { i8*, i32 }
39          catch i8* null
40  %1 = extractvalue { i8*, i32 } %0, 0
41  %2 = tail call i8* @__cxa_begin_catch(i8* %1)
42  tail call void @__cxa_end_catch()
43  br label %try.cont
44
45try.cont:
46  ret void
47}
48
49; CHECK-LABEL: GCC_except_table0:
50; CHECK-NEXT: .Lexception0:
51; CHECK-NEXT: .byte	255 # @LPStart Encoding = omit
52; TTypeEncoding = DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4
53; CHECK-NEXT: .byte 155 # @TType Encoding = indirect pcrel sdata4
54; CHECK: .Lttbaseref0:
55; CallSiteEncoding = dwarf::DW_EH_PE_udata4
56; CHECK-NEXT: .byte	3                       # Call site Encoding = udata4
57; CHECK-NEXT: .uleb128 .Lcst_end0-.Lcst_begin0
58; CHECK-NEXT: cst_begin0:
59; CHECK-NEXT: .word .Ltmp0-.Lfunc_begin0   # >> Call Site 1 <<
60; CHECK-NEXT: .word .Ltmp1-.Ltmp0          #   Call between .Ltmp0 and .Ltmp1
61; CHECK-NEXT: .word .Ltmp2-.Lfunc_begin0   #     jumps to .Ltmp2
62; CHECK-NEXT: .byte	1                       #   On action: 1
63; CHECK-NEXT: .word .Ltmp1-.Lfunc_begin0   # >> Call Site 2 <<
64; CHECK-NEXT: .word .Lfunc_end0-.Ltmp1     #   Call between .Ltmp1 and .Lfunc_end0
65; CHECK-NEXT: .word	0                       #     has no landing pad
66; CHECK-NEXT: .byte	0                       #   On action: cleanup
67