# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py # RUN: llc -mtriple=loongarch64 -x mir -run-pass=prologepilog -verify-machineinstrs < %s | FileCheck %s --check-prefix=LA64 # RUN: llc -mtriple=loongarch32 -x mir -run-pass=prologepilog -verify-machineinstrs < %s | FileCheck %s --check-prefix=LA32 --- | ; Function Attrs: uwtable define void @no_reserved_call_frame(i64 %n) #0 { entry: %v = alloca i32, i64 %n, align 4 call void @callee_stack_args(ptr %v, [518 x i64] poison) ret void } declare void @callee_stack_args(ptr, [518 x i64]) attributes #0 = { uwtable "frame-pointer"="none" "probe-stack"="inline-asm" } ... --- name: no_reserved_call_frame alignment: 4 exposesReturnsTwice: false legalized: false regBankSelected: false selected: false failedISel: false tracksRegLiveness: true hasWinCFI: false noPhis: true isSSA: false noVRegs: true hasFakeUses: false callsEHReturn: false callsUnwindInit: false hasEHContTarget: false hasEHScopes: false hasEHFunclets: false isOutlined: false debugInstrRef: false failsVerification: false tracksDebugUserValues: true registers: [] liveins: - { reg: '$r4', virtual-reg: '' } frameInfo: isFrameAddressTaken: false isReturnAddressTaken: false hasStackMap: false hasPatchPoint: false stackSize: 0 offsetAdjustment: 0 maxAlignment: 8 adjustsStack: true hasCalls: true framePointerPolicy: none stackProtector: '' functionContext: '' maxCallFrameSize: 4294967295 cvBytesOfCalleeSavedRegisters: 0 hasOpaqueSPAdjustment: false hasVAStart: false hasMustTailInVarArgFunc: false hasTailCall: false isCalleeSavedInfoValid: false localFrameSize: 0 fixedStack: [] stack: - { id: 0, name: v, type: variable-sized, offset: 0, alignment: 1, stack-id: default, callee-saved-register: '', callee-saved-restored: true, debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } entry_values: [] callSites: [] debugValueSubstitutions: [] constants: [] machineFunctionInfo: {} body: | ; LA64-LABEL: name: no_reserved_call_frame ; LA64: bb.0.entry: ; LA64-NEXT: successors: %bb.1(0x80000000) ; LA64-NEXT: liveins: $r4, $r1 ; LA64-NEXT: {{ $}} ; LA64-NEXT: $r3 = frame-setup ADDI_D $r3, -16 ; LA64-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 ; LA64-NEXT: ST_D killed $r1, $r3, 8 :: (store (s64) into %stack.1) ; LA64-NEXT: ST_D killed $r22, $r3, 0 :: (store (s64) into %stack.2) ; LA64-NEXT: frame-setup CFI_INSTRUCTION offset $r1, -8 ; LA64-NEXT: frame-setup CFI_INSTRUCTION offset $r22, -16 ; LA64-NEXT: $r22 = frame-setup ADDI_D $r3, 16 ; LA64-NEXT: frame-setup CFI_INSTRUCTION def_cfa $r22, 0 ; LA64-NEXT: renamable $r4 = SLLI_D killed renamable $r4, 2 ; LA64-NEXT: renamable $r4 = nuw ADDI_D killed renamable $r4, 15 ; LA64-NEXT: renamable $r4 = BSTRINS_D killed renamable $r4, $r0, 3, 0 ; LA64-NEXT: renamable $r4 = SUB_D $r3, killed renamable $r4 ; LA64-NEXT: renamable $r5 = LU12I_W 1 ; LA64-NEXT: {{ $}} ; LA64-NEXT: bb.1.entry: ; LA64-NEXT: successors: %bb.2(0x40000000), %bb.1(0x40000000) ; LA64-NEXT: liveins: $r4, $r5 ; LA64-NEXT: {{ $}} ; LA64-NEXT: $r3 = SUB_D $r3, renamable $r5 ; LA64-NEXT: ST_D $r0, $r3, 0 ; LA64-NEXT: BLTU renamable $r4, $r3, %bb.1 ; LA64-NEXT: {{ $}} ; LA64-NEXT: bb.2.entry: ; LA64-NEXT: liveins: $r4 ; LA64-NEXT: {{ $}} ; LA64-NEXT: $r3 = OR renamable $r4, $r0 ; LA64-NEXT: $r5 = LU12I_W 1 ; LA64-NEXT: $r3 = SUB_D $r3, killed $r5 ; LA64-NEXT: PseudoCALL_MEDIUM target-flags(loongarch-call-plt) @callee_stack_args, csr_ilp32d_lp64d, implicit-def dead $r1, implicit-def dead $r20, implicit $r4, implicit undef $r5, implicit undef $r6, implicit undef $r7, implicit undef $r8, implicit undef $r9, implicit undef $r10, implicit undef $r11, implicit-def $r3 ; LA64-NEXT: $r4 = LU12I_W 1 ; LA64-NEXT: $r3 = ADD_D $r3, killed $r4 ; LA64-NEXT: $r3 = frame-destroy ADDI_D $r22, -16 ; LA64-NEXT: $r22 = LD_D $r3, 0 :: (load (s64) from %stack.2) ; LA64-NEXT: $r1 = LD_D $r3, 8 :: (load (s64) from %stack.1) ; LA64-NEXT: $r3 = frame-destroy ADDI_D $r3, 16 ; LA64-NEXT: PseudoRET ; ; LA32-LABEL: name: no_reserved_call_frame ; LA32: bb.0.entry: ; LA32-NEXT: successors: %bb.1(0x80000000) ; LA32-NEXT: liveins: $r4, $r1 ; LA32-NEXT: {{ $}} ; LA32-NEXT: $r3 = frame-setup ADDI_W $r3, -16 ; LA32-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 ; LA32-NEXT: ST_W killed $r1, $r3, 12 :: (store (s32) into %stack.1) ; LA32-NEXT: ST_W killed $r22, $r3, 8 :: (store (s32) into %stack.2) ; LA32-NEXT: frame-setup CFI_INSTRUCTION offset $r1, -4 ; LA32-NEXT: frame-setup CFI_INSTRUCTION offset $r22, -8 ; LA32-NEXT: $r22 = frame-setup ADDI_W $r3, 16 ; LA32-NEXT: frame-setup CFI_INSTRUCTION def_cfa $r22, 0 ; LA32-NEXT: renamable $r4 = SLLI_D killed renamable $r4, 2 ; LA32-NEXT: renamable $r4 = nuw ADDI_D killed renamable $r4, 15 ; LA32-NEXT: renamable $r4 = BSTRINS_D killed renamable $r4, $r0, 3, 0 ; LA32-NEXT: renamable $r4 = SUB_D $r3, killed renamable $r4 ; LA32-NEXT: renamable $r5 = LU12I_W 1 ; LA32-NEXT: {{ $}} ; LA32-NEXT: bb.1.entry: ; LA32-NEXT: successors: %bb.2(0x40000000), %bb.1(0x40000000) ; LA32-NEXT: liveins: $r4, $r5 ; LA32-NEXT: {{ $}} ; LA32-NEXT: $r3 = SUB_D $r3, renamable $r5 ; LA32-NEXT: ST_D $r0, $r3, 0 ; LA32-NEXT: BLTU renamable $r4, $r3, %bb.1 ; LA32-NEXT: {{ $}} ; LA32-NEXT: bb.2.entry: ; LA32-NEXT: liveins: $r4 ; LA32-NEXT: {{ $}} ; LA32-NEXT: $r3 = OR renamable $r4, $r0 ; LA32-NEXT: $r5 = LU12I_W 1 ; LA32-NEXT: $r3 = SUB_W $r3, killed $r5 ; LA32-NEXT: PseudoCALL_MEDIUM target-flags(loongarch-call-plt) @callee_stack_args, csr_ilp32d_lp64d, implicit-def dead $r1, implicit-def dead $r20, implicit $r4, implicit undef $r5, implicit undef $r6, implicit undef $r7, implicit undef $r8, implicit undef $r9, implicit undef $r10, implicit undef $r11, implicit-def $r3 ; LA32-NEXT: $r4 = LU12I_W 1 ; LA32-NEXT: $r3 = ADD_W $r3, killed $r4 ; LA32-NEXT: $r3 = frame-destroy ADDI_W $r22, -16 ; LA32-NEXT: $r22 = LD_W $r3, 8 :: (load (s32) from %stack.2) ; LA32-NEXT: $r1 = LD_W $r3, 12 :: (load (s32) from %stack.1) ; LA32-NEXT: $r3 = frame-destroy ADDI_W $r3, 16 ; LA32-NEXT: PseudoRET bb.0.entry: successors: %bb.1(0x80000000) liveins: $r4 renamable $r4 = SLLI_D killed renamable $r4, 2 renamable $r4 = nuw ADDI_D killed renamable $r4, 15 renamable $r4 = BSTRINS_D killed renamable $r4, $r0, 3, 0 renamable $r4 = SUB_D $r3, killed renamable $r4 renamable $r5 = LU12I_W 1 bb.1.entry: successors: %bb.2(0x40000000), %bb.1(0x40000000) liveins: $r4, $r5 $r3 = SUB_D $r3, renamable $r5 ST_D $r0, $r3, 0 BLTU renamable $r4, $r3, %bb.1 bb.2.entry: liveins: $r4 $r3 = OR renamable $r4, $r0 ADJCALLSTACKDOWN 4088, 0, implicit-def dead $r3, implicit $r3 PseudoCALL_MEDIUM target-flags(loongarch-call-plt) @callee_stack_args, csr_ilp32d_lp64d, implicit-def dead $r1, implicit-def dead $r20, implicit $r4, implicit undef $r5, implicit undef $r6, implicit undef $r7, implicit undef $r8, implicit undef $r9, implicit undef $r10, implicit undef $r11, implicit-def $r3 ADJCALLSTACKUP 4088, 0, implicit-def dead $r3, implicit $r3 PseudoRET ...