1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=csky -csky-no-aliases --code-model=small -mattr=+2e3 < %s \
3 ; RUN: | FileCheck -check-prefixes=SMALL,CHECK %s
4 ; RUN: llc -mtriple=csky -csky-no-aliases --code-model=medium -mattr=+2e3 < %s \
5 ; RUN: | FileCheck -check-prefixes=MEDIUM,CHECK %s
6 ; RUN: llc -mtriple=csky -csky-no-aliases --code-model=small -relocation-model=pic -mattr=+2e3 < %s \
7 ; RUN: | FileCheck -check-prefixes=SMALL-PIC,CHECK %s
8 ; RUN: llc -mtriple=csky -csky-no-aliases --code-model=medium -relocation-model=pic -mattr=+2e3 < %s \
9 ; RUN: | FileCheck -check-prefixes=MEDIUM-PIC,CHECK %s
11 declare void @throw_exception()
13 declare i32 @__gxx_personality_v0(...)
15 declare ptr @__cxa_begin_catch(ptr)
17 declare void @__cxa_end_catch()
19 ; CHECK: .cfi_startproc
20 ; PersonalityEncoding = DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4
21 ; CHECK-NEXT: .cfi_personality 155, DW.ref.__gxx_personality_v0
22 ; LSDAEncoding = DW_EH_PE_pcrel | DW_EH_PE_sdata4
23 ; CHECK-NEXT: .cfi_lsda 27, .Lexception0
25 define void @test1() personality ptr @__gxx_personality_v0 {
26 ; SMALL: # %bb.0: # %entry
27 ; SMALL-NEXT: subi16 sp, sp, 4
28 ; SMALL-NEXT: .cfi_def_cfa_offset 4
29 ; SMALL-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
30 ; SMALL-NEXT: .cfi_offset lr, -4
31 ; SMALL-NEXT: .cfi_def_cfa_offset 4
33 ; SMALL-NEXT: jsri32 [.LCPI0_0]
35 ; SMALL-NEXT: .LBB0_1: # %try.cont
36 ; SMALL-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
37 ; SMALL-NEXT: addi16 sp, sp, 4
39 ; SMALL-NEXT: .LBB0_2: # %lpad
41 ; SMALL-NEXT: jsri32 [.LCPI0_1]
42 ; SMALL-NEXT: jsri32 [.LCPI0_2]
43 ; SMALL-NEXT: br32 .LBB0_1
44 ; SMALL-NEXT: .p2align 1
45 ; SMALL-NEXT: # %bb.3:
46 ; SMALL-NEXT: .p2align 2
47 ; SMALL-NEXT: .LCPI0_0:
48 ; SMALL-NEXT: .long throw_exception
49 ; SMALL-NEXT: .LCPI0_1:
50 ; SMALL-NEXT: .long __cxa_begin_catch
51 ; SMALL-NEXT: .LCPI0_2:
52 ; SMALL-NEXT: .long __cxa_end_catch
54 ; MEDIUM: # %bb.0: # %entry
55 ; MEDIUM-NEXT: subi16 sp, sp, 4
56 ; MEDIUM-NEXT: .cfi_def_cfa_offset 4
57 ; MEDIUM-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
58 ; MEDIUM-NEXT: .cfi_offset lr, -4
59 ; MEDIUM-NEXT: .cfi_def_cfa_offset 4
60 ; MEDIUM-NEXT: .Ltmp0:
61 ; MEDIUM-NEXT: jsri32 [.LCPI0_0]
62 ; MEDIUM-NEXT: .Ltmp1:
63 ; MEDIUM-NEXT: .LBB0_1: # %try.cont
64 ; MEDIUM-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
65 ; MEDIUM-NEXT: addi16 sp, sp, 4
67 ; MEDIUM-NEXT: .LBB0_2: # %lpad
68 ; MEDIUM-NEXT: .Ltmp2:
69 ; MEDIUM-NEXT: jsri32 [.LCPI0_1]
70 ; MEDIUM-NEXT: jsri32 [.LCPI0_2]
71 ; MEDIUM-NEXT: br32 .LBB0_1
72 ; MEDIUM-NEXT: .p2align 1
73 ; MEDIUM-NEXT: # %bb.3:
74 ; MEDIUM-NEXT: .p2align 2
75 ; MEDIUM-NEXT: .LCPI0_0:
76 ; MEDIUM-NEXT: .long throw_exception
77 ; MEDIUM-NEXT: .LCPI0_1:
78 ; MEDIUM-NEXT: .long __cxa_begin_catch
79 ; MEDIUM-NEXT: .LCPI0_2:
80 ; MEDIUM-NEXT: .long __cxa_end_catch
82 ; SMALL-PIC: # %bb.0: # %entry
83 ; SMALL-PIC-NEXT: subi16 sp, sp, 8
84 ; SMALL-PIC-NEXT: .cfi_def_cfa_offset 8
85 ; SMALL-PIC-NEXT: st32.w rgb, (sp, 4) # 4-byte Folded Spill
86 ; SMALL-PIC-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
87 ; SMALL-PIC-NEXT: .cfi_offset rgb, -4
88 ; SMALL-PIC-NEXT: .cfi_offset lr, -8
89 ; SMALL-PIC-NEXT: .cfi_def_cfa_offset 8
90 ; SMALL-PIC-NEXT: lrw32 rgb, [.LCPI0_0]
91 ; SMALL-PIC-NEXT: .Ltmp0:
92 ; SMALL-PIC-NEXT: lrw32 a0, [.LCPI0_1]
93 ; SMALL-PIC-NEXT: ldr32.w a0, (rgb, a0 << 0)
94 ; SMALL-PIC-NEXT: jsr16 a0
95 ; SMALL-PIC-NEXT: .Ltmp1:
96 ; SMALL-PIC-NEXT: .LBB0_1: # %try.cont
97 ; SMALL-PIC-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
98 ; SMALL-PIC-NEXT: ld32.w rgb, (sp, 4) # 4-byte Folded Reload
99 ; SMALL-PIC-NEXT: addi16 sp, sp, 8
100 ; SMALL-PIC-NEXT: rts16
101 ; SMALL-PIC-NEXT: .LBB0_2: # %lpad
102 ; SMALL-PIC-NEXT: .Ltmp2:
103 ; SMALL-PIC-NEXT: lrw32 a1, [.LCPI0_2]
104 ; SMALL-PIC-NEXT: ldr32.w a1, (rgb, a1 << 0)
105 ; SMALL-PIC-NEXT: jsr16 a1
106 ; SMALL-PIC-NEXT: lrw32 a0, [.LCPI0_3]
107 ; SMALL-PIC-NEXT: ldr32.w a0, (rgb, a0 << 0)
108 ; SMALL-PIC-NEXT: jsr16 a0
109 ; SMALL-PIC-NEXT: br32 .LBB0_1
110 ; SMALL-PIC-NEXT: .p2align 1
111 ; SMALL-PIC-NEXT: # %bb.3:
112 ; SMALL-PIC-NEXT: .p2align 2
113 ; SMALL-PIC-NEXT: .LCPI0_0:
114 ; SMALL-PIC-NEXT: .long _GLOBAL_OFFSET_TABLE_
115 ; SMALL-PIC-NEXT: .LCPI0_1:
116 ; SMALL-PIC-NEXT: .long throw_exception@PLT
117 ; SMALL-PIC-NEXT: .LCPI0_2:
118 ; SMALL-PIC-NEXT: .long __cxa_begin_catch@PLT
119 ; SMALL-PIC-NEXT: .LCPI0_3:
120 ; SMALL-PIC-NEXT: .long __cxa_end_catch@PLT
122 ; MEDIUM-PIC: # %bb.0: # %entry
123 ; MEDIUM-PIC-NEXT: subi16 sp, sp, 8
124 ; MEDIUM-PIC-NEXT: .cfi_def_cfa_offset 8
125 ; MEDIUM-PIC-NEXT: st32.w rgb, (sp, 4) # 4-byte Folded Spill
126 ; MEDIUM-PIC-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
127 ; MEDIUM-PIC-NEXT: .cfi_offset rgb, -4
128 ; MEDIUM-PIC-NEXT: .cfi_offset lr, -8
129 ; MEDIUM-PIC-NEXT: .cfi_def_cfa_offset 8
130 ; MEDIUM-PIC-NEXT: lrw32 rgb, [.LCPI0_0]
131 ; MEDIUM-PIC-NEXT: .Ltmp0:
132 ; MEDIUM-PIC-NEXT: lrw32 a0, [.LCPI0_1]
133 ; MEDIUM-PIC-NEXT: ldr32.w a0, (rgb, a0 << 0)
134 ; MEDIUM-PIC-NEXT: jsr16 a0
135 ; MEDIUM-PIC-NEXT: .Ltmp1:
136 ; MEDIUM-PIC-NEXT: .LBB0_1: # %try.cont
137 ; MEDIUM-PIC-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
138 ; MEDIUM-PIC-NEXT: ld32.w rgb, (sp, 4) # 4-byte Folded Reload
139 ; MEDIUM-PIC-NEXT: addi16 sp, sp, 8
140 ; MEDIUM-PIC-NEXT: rts16
141 ; MEDIUM-PIC-NEXT: .LBB0_2: # %lpad
142 ; MEDIUM-PIC-NEXT: .Ltmp2:
143 ; MEDIUM-PIC-NEXT: lrw32 a1, [.LCPI0_2]
144 ; MEDIUM-PIC-NEXT: ldr32.w a1, (rgb, a1 << 0)
145 ; MEDIUM-PIC-NEXT: jsr16 a1
146 ; MEDIUM-PIC-NEXT: lrw32 a0, [.LCPI0_3]
147 ; MEDIUM-PIC-NEXT: ldr32.w a0, (rgb, a0 << 0)
148 ; MEDIUM-PIC-NEXT: jsr16 a0
149 ; MEDIUM-PIC-NEXT: br32 .LBB0_1
150 ; MEDIUM-PIC-NEXT: .p2align 1
151 ; MEDIUM-PIC-NEXT: # %bb.3:
152 ; MEDIUM-PIC-NEXT: .p2align 2
153 ; MEDIUM-PIC-NEXT: .LCPI0_0:
154 ; MEDIUM-PIC-NEXT: .long _GLOBAL_OFFSET_TABLE_
155 ; MEDIUM-PIC-NEXT: .LCPI0_1:
156 ; MEDIUM-PIC-NEXT: .long throw_exception@PLT
157 ; MEDIUM-PIC-NEXT: .LCPI0_2:
158 ; MEDIUM-PIC-NEXT: .long __cxa_begin_catch@PLT
159 ; MEDIUM-PIC-NEXT: .LCPI0_3:
160 ; MEDIUM-PIC-NEXT: .long __cxa_end_catch@PLT
162 invoke void @throw_exception() to label %try.cont unwind label %lpad
165 %0 = landingpad { ptr, i32 }
167 %1 = extractvalue { ptr, i32 } %0, 0
168 %2 = tail call ptr @__cxa_begin_catch(ptr %1)
169 tail call void @__cxa_end_catch()
176 ; CHECK-LABEL: GCC_except_table0:
177 ; CHECK-NEXT: .Lexception0:
178 ; CHECK-NEXT: .byte 255 # @LPStart Encoding = omit
179 ; TTypeEncoding = DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4
180 ; CHECK-NEXT: .byte 155 # @TType Encoding = indirect pcrel sdata4
181 ; CHECK: .Lttbaseref0:
182 ; CallSiteEncoding = dwarf::DW_EH_PE_udata4
183 ; CHECK-NEXT: .byte 1 # Call site Encoding = uleb128
184 ; CHECK-NEXT: .uleb128 .Lcst_end0-.Lcst_begin0
185 ; CHECK-NEXT: .Lcst_begin0:
186 ; CHECK-NEXT: .uleb128 .Ltmp0-.Lfunc_begin0 # >> Call Site 1 <<
187 ; CHECK-NEXT: .uleb128 .Ltmp1-.Ltmp0 # Call between .Ltmp0 and .Ltmp1
188 ; CHECK-NEXT: .uleb128 .Ltmp2-.Lfunc_begin0 # jumps to .Ltmp2
189 ; CHECK-NEXT: .byte 1 # On action: 1
190 ; CHECK-NEXT: .uleb128 .Ltmp1-.Lfunc_begin0 # >> Call Site 2 <<
191 ; CHECK-NEXT: .uleb128 .Lfunc_end0-.Ltmp1 # Call between .Ltmp1 and .Lfunc_end0
192 ; CHECK-NEXT: .byte 0 # has no landing pad
193 ; CHECK-NEXT: .byte 0 # On action: cleanup