1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv64 -mattr=+v,+m < %s \
6 @_ZTIi = external dso_local constant ptr
8 declare void @_Z3fooiiiiiiiiiiPi(i32 signext %0, i32 signext %1, i32 signext %2, i32 signext %3, i32 signext %4, i32 signext %5, i32 signext %6, i32 signext %7, i32 %8, i32 %9, i32 %10)
10 declare dso_local ptr @__cxa_allocate_exception(i64)
12 declare dso_local void @__cxa_throw(ptr, ptr, ptr)
14 define signext i32 @foo() #1 personality ptr @__gxx_personality_v0 {
16 ; CHECK: # %bb.0: # %entry
17 ; CHECK-NEXT: addi sp, sp, -32
18 ; CHECK-NEXT: .cfi_def_cfa_offset 32
19 ; CHECK-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
20 ; CHECK-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
21 ; CHECK-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
22 ; CHECK-NEXT: .cfi_offset ra, -8
23 ; CHECK-NEXT: .cfi_offset s0, -16
24 ; CHECK-NEXT: .cfi_offset s1, -24
25 ; CHECK-NEXT: addi s0, sp, 32
26 ; CHECK-NEXT: .cfi_def_cfa s0, 0
28 ; CHECK-NEXT: addi sp, sp, -32
29 ; CHECK-NEXT: li a0, 0
30 ; CHECK-NEXT: li a1, 0
31 ; CHECK-NEXT: li a2, 0
32 ; CHECK-NEXT: li a3, 0
33 ; CHECK-NEXT: li a4, 0
34 ; CHECK-NEXT: li a5, 0
35 ; CHECK-NEXT: li a6, 0
36 ; CHECK-NEXT: li a7, 0
37 ; CHECK-NEXT: call _Z3fooiiiiiiiiiiPi
38 ; CHECK-NEXT: addi sp, sp, 32
40 ; CHECK-NEXT: # %bb.1: # %try.cont.unreachable
41 ; CHECK-NEXT: .LBB0_2: # %lpad
43 ; CHECK-NEXT: sext.w a1, a1
44 ; CHECK-NEXT: li a2, 1
45 ; CHECK-NEXT: bne a1, a2, .LBB0_4
46 ; CHECK-NEXT: # %bb.3: # %catch
47 ; CHECK-NEXT: call __cxa_begin_catch
48 ; CHECK-NEXT: lw s1, 0(a0)
49 ; CHECK-NEXT: call __cxa_end_catch
50 ; CHECK-NEXT: mv a0, s1
51 ; CHECK-NEXT: addi sp, s0, -32
52 ; CHECK-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
53 ; CHECK-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
54 ; CHECK-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
55 ; CHECK-NEXT: addi sp, sp, 32
57 ; CHECK-NEXT: .LBB0_4: # %ehcleanup
58 ; CHECK-NEXT: call _Unwind_Resume
60 invoke void @_Z3fooiiiiiiiiiiPi(i32 signext poison, i32 signext poison, i32 signext poison, i32 signext poison, i32 signext poison, i32 signext poison, i32 signext poison, i32 signext poison, i32 poison, i32 poison, i32 poison)
61 to label %try.cont.unreachable unwind label %lpad
64 %0 = landingpad { ptr, i32 }
67 %1 = extractvalue { ptr, i32 } %0, 1
68 %2 = call i32 @llvm.eh.typeid.for(ptr nonnull @_ZTIi)
69 %matches = icmp eq i32 %1, %2
70 br i1 %matches, label %catch, label %ehcleanup
73 %3 = extractvalue { ptr, i32 } %0, 0
74 %4 = call ptr @__cxa_begin_catch(ptr %3)
75 %5 = load i32, ptr %4, align 4
76 call void @__cxa_end_catch()
83 resume { ptr, i32 } %0
86 declare i32 @__gxx_personality_v0(...)
88 declare i32 @llvm.eh.typeid.for(ptr)
90 declare ptr @__cxa_begin_catch(ptr)
91 declare void @__cxa_end_catch()
93 attributes #1 = { "frame-pointer"="all"}