125 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc --mtriple=loongarch32 -mattr=+32s,+d --verify-machineinstrs < %s \3; RUN: | FileCheck %s --check-prefix=LA324; RUN: llc --mtriple=loongarch64 -mattr=+d --verify-machineinstrs < %s \5; RUN: | FileCheck %s --check-prefix=LA646 7declare void @foo(ptr %p);8declare void @bar(ptr %p);9declare dso_local i32 @__gxx_personality_v0(...)10 11;; Before getExceptionPointerRegister() and getExceptionSelectorRegister()12;; lowering hooks were defined this would trigger an assertion during live13;; variable analysis.14 15define void @caller(ptr %p) personality ptr @__gxx_personality_v0 {16; LA32-LABEL: caller:17; LA32: # %bb.0: # %entry18; LA32-NEXT: addi.w $sp, $sp, -1619; LA32-NEXT: .cfi_def_cfa_offset 1620; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill21; LA32-NEXT: st.w $fp, $sp, 8 # 4-byte Folded Spill22; LA32-NEXT: st.w $s0, $sp, 4 # 4-byte Folded Spill23; LA32-NEXT: .cfi_offset 1, -424; LA32-NEXT: .cfi_offset 22, -825; LA32-NEXT: .cfi_offset 23, -1226; LA32-NEXT: move $fp, $a027; LA32-NEXT: beqz $a0, .LBB0_228; LA32-NEXT: # %bb.1: # %bb229; LA32-NEXT: .Ltmp0:30; LA32-NEXT: move $a0, $fp31; LA32-NEXT: bl bar32; LA32-NEXT: .Ltmp1:33; LA32-NEXT: b .LBB0_334; LA32-NEXT: .LBB0_2: # %bb135; LA32-NEXT: .Ltmp2:36; LA32-NEXT: move $a0, $fp37; LA32-NEXT: bl foo38; LA32-NEXT: .Ltmp3:39; LA32-NEXT: .LBB0_3: # %end240; LA32-NEXT: ld.w $s0, $sp, 4 # 4-byte Folded Reload41; LA32-NEXT: ld.w $fp, $sp, 8 # 4-byte Folded Reload42; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload43; LA32-NEXT: addi.w $sp, $sp, 1644; LA32-NEXT: ret45; LA32-NEXT: .LBB0_4: # %lpad46; LA32-NEXT: .Ltmp4:47; LA32-NEXT: move $s0, $a048; LA32-NEXT: move $a0, $fp49; LA32-NEXT: bl callee50; LA32-NEXT: move $a0, $s051; LA32-NEXT: bl _Unwind_Resume52;53; LA64-LABEL: caller:54; LA64: # %bb.0: # %entry55; LA64-NEXT: addi.d $sp, $sp, -3256; LA64-NEXT: .cfi_def_cfa_offset 3257; LA64-NEXT: st.d $ra, $sp, 24 # 8-byte Folded Spill58; LA64-NEXT: st.d $fp, $sp, 16 # 8-byte Folded Spill59; LA64-NEXT: st.d $s0, $sp, 8 # 8-byte Folded Spill60; LA64-NEXT: .cfi_offset 1, -861; LA64-NEXT: .cfi_offset 22, -1662; LA64-NEXT: .cfi_offset 23, -2463; LA64-NEXT: move $fp, $a064; LA64-NEXT: beqz $a0, .LBB0_265; LA64-NEXT: # %bb.1: # %bb266; LA64-NEXT: .Ltmp0:67; LA64-NEXT: move $a0, $fp68; LA64-NEXT: pcaddu18i $ra, %call36(bar)69; LA64-NEXT: jirl $ra, $ra, 070; LA64-NEXT: .Ltmp1:71; LA64-NEXT: b .LBB0_372; LA64-NEXT: .LBB0_2: # %bb173; LA64-NEXT: .Ltmp2:74; LA64-NEXT: move $a0, $fp75; LA64-NEXT: pcaddu18i $ra, %call36(foo)76; LA64-NEXT: jirl $ra, $ra, 077; LA64-NEXT: .Ltmp3:78; LA64-NEXT: .LBB0_3: # %end279; LA64-NEXT: ld.d $s0, $sp, 8 # 8-byte Folded Reload80; LA64-NEXT: ld.d $fp, $sp, 16 # 8-byte Folded Reload81; LA64-NEXT: ld.d $ra, $sp, 24 # 8-byte Folded Reload82; LA64-NEXT: addi.d $sp, $sp, 3283; LA64-NEXT: ret84; LA64-NEXT: .LBB0_4: # %lpad85; LA64-NEXT: .Ltmp4:86; LA64-NEXT: move $s0, $a087; LA64-NEXT: move $a0, $fp88; LA64-NEXT: pcaddu18i $ra, %call36(callee)89; LA64-NEXT: jirl $ra, $ra, 090; LA64-NEXT: move $a0, $s091; LA64-NEXT: pcaddu18i $ra, %call36(_Unwind_Resume)92; LA64-NEXT: jirl $ra, $ra, 093entry:94 %0 = icmp eq ptr %p, null95 br i1 %0, label %bb1, label %bb296 97bb1:98 invoke void @foo(ptr %p) to label %end1 unwind label %lpad99 100bb2:101 invoke void @bar(ptr %p) to label %end2 unwind label %lpad102 103lpad:104 %1 = landingpad { ptr, i32 } cleanup105 call void @callee(ptr %p)106 resume { ptr, i32 } %1107 108end1:109 ret void110 111end2:112 ret void113}114 115define internal void @callee(ptr %p) {116; LA32-LABEL: callee:117; LA32: # %bb.0:118; LA32-NEXT: ret119;120; LA64-LABEL: callee:121; LA64: # %bb.0:122; LA64-NEXT: ret123 ret void124}125