1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -mtriple=m68k %s -stop-after=finalize-isel -o - | FileCheck %s
4 ; We want to make sure caller doesn't pop the stack for callees using
5 ; the M68k_RTD CC. However, we've implemented some frame optimization
6 ; techniques to eliminate as many as frame setup/destroy instructions.
7 ; Therefore, to make test case small and concise, we check the MIR generated
10 declare dso_local m68k_rtdcc void @callee(i32 noundef)
11 declare dso_local m68k_rtdcc void @va_callee(i32 noundef, ...)
13 define dso_local i32 @caller(ptr noundef %y) {
14 ; CHECK-LABEL: name: caller
16 ; CHECK-NEXT: [[MOV32rp:%[0-9]+]]:ar32 = MOV32rp 0, %fixed-stack.0, implicit-def dead $ccr :: (load (s32) from %fixed-stack.0, align 8)
17 ; CHECK-NEXT: [[MOV32rj:%[0-9]+]]:xr32 = MOV32rj killed [[MOV32rp]], implicit-def dead $ccr :: (load (s32) from %ir.y)
18 ; CHECK-NEXT: ADJCALLSTACKDOWN 4, 0, implicit-def dead $sp, implicit-def dead $ccr, implicit $sp
19 ; CHECK-NEXT: [[COPY:%[0-9]+]]:ar32 = COPY $sp
20 ; CHECK-NEXT: MOV32jr [[COPY]], [[MOV32rj]], implicit-def dead $ccr :: (store (s32) into stack, align 2)
21 ; CHECK-NEXT: CALLb @callee, csr_std, implicit $sp, implicit-def $sp
22 ; CHECK-NEXT: ADJCALLSTACKUP 4, 4, implicit-def dead $sp, implicit-def dead $ccr, implicit $sp
23 ; CHECK-NEXT: $d0 = COPY [[MOV32rj]]
24 ; CHECK-NEXT: RET 0, $d0
26 %0 = load i32, ptr %y, align 4
27 call m68k_rtdcc void @callee(i32 noundef %0)
31 define dso_local i32 @va_caller(ptr noundef %y) {
32 ; CHECK-LABEL: name: va_caller
34 ; CHECK-NEXT: [[MOV32rp:%[0-9]+]]:ar32 = MOV32rp 0, %fixed-stack.0, implicit-def dead $ccr :: (load (s32) from %fixed-stack.0, align 8)
35 ; CHECK-NEXT: [[MOV32rj:%[0-9]+]]:xr32 = MOV32rj killed [[MOV32rp]], implicit-def dead $ccr :: (load (s32) from %ir.y)
36 ; CHECK-NEXT: ADJCALLSTACKDOWN 4, 0, implicit-def dead $sp, implicit-def dead $ccr, implicit $sp
37 ; CHECK-NEXT: [[COPY:%[0-9]+]]:ar32 = COPY $sp
38 ; CHECK-NEXT: MOV32jr [[COPY]], [[MOV32rj]], implicit-def dead $ccr :: (store (s32) into stack, align 2)
39 ; CHECK-NEXT: CALLb @va_callee, csr_std, implicit $sp, implicit-def $sp
40 ; CHECK-NEXT: ADJCALLSTACKUP 4, 0, implicit-def dead $sp, implicit-def dead $ccr, implicit $sp
41 ; CHECK-NEXT: $d0 = COPY [[MOV32rj]]
42 ; CHECK-NEXT: RET 0, $d0
44 %0 = load i32, ptr %y, align 4
45 call m68k_rtdcc void (i32, ...) @va_callee(i32 noundef %0)