1 ; RUN: llc -enable-machine-outliner -verify-machineinstrs -mtriple=armv7-- \
2 ; RUN: -stop-after=machine-outliner < %s | FileCheck %s --check-prefix=ARM
3 ; RUN: llc -enable-machine-outliner -verify-machineinstrs -mtriple=thumbv7-- \
4 ; RUN: -stop-after=machine-outliner < %s | FileCheck %s --check-prefix=THUMB
5 ; RUN: llc -enable-machine-outliner -verify-machineinstrs \
6 ; RUN: -mtriple=thumbv7-apple-darwin -stop-after=machine-outliner < %s \
7 ; RUN: | FileCheck %s --check-prefix=MACHO
8 ; RUN: llc -enable-machine-outliner -verify-machineinstrs -mtriple=thumbv5-- \
9 ; RUN: --stop-after=machine-outliner < %s | FileCheck %s --check-prefix=THUMB1
10 ; RUN: llc -verify-machineinstrs -mtriple=thumbv8m.main \
11 ; RUN: --stop-after=machine-outliner < %s | FileCheck %s --check-prefix=THUMB
13 declare i32 @thunk_called_fn(i32, i32, i32, i32)
18 ; ARM-NEXT: liveins: $r11, $lr
19 ; ARM: $sp = frame-setup STMDB_UPD $sp, 14 /* CC::al */, $noreg, killed $r11, killed $lr
20 ; ARM-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 8
21 ; ARM-NEXT: frame-setup CFI_INSTRUCTION offset $lr, -4
22 ; ARM-NEXT: frame-setup CFI_INSTRUCTION offset $r11, -8
23 ; ARM-NEXT: BL @OUTLINED_FUNCTION_0{{.*}}
24 ; ARM-NEXT: renamable $r0 = ADDri killed renamable $r0, 8, 14 /* CC::al */, $noreg, $noreg
25 ; ARM-NEXT: $sp = frame-destroy LDMIA_RET $sp, 14 /* CC::al */, $noreg, def $r11, def $pc, implicit killed $r0
27 ; THUMB-LABEL: name: a
29 ; THUMB-NEXT: liveins: $r7, $lr
30 ; THUMB: frame-setup tPUSH 14 /* CC::al */, $noreg, killed $r7, killed $lr
31 ; THUMB-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 8
32 ; THUMB-NEXT: frame-setup CFI_INSTRUCTION offset $lr, -4
33 ; THUMB-NEXT: frame-setup CFI_INSTRUCTION offset $r7, -8
34 ; THUMB-NEXT: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_0{{.*}}
35 ; THUMB-NEXT: renamable $r0, dead $cpsr = tADDi8 killed renamable $r0, 8, 14 /* CC::al */, $noreg
36 ; THUMB-NEXT: tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc
38 ; MACHO-LABEL: name: a
40 ; MACHO-NEXT: liveins: $lr
41 ; MACHO: early-clobber $sp = frame-setup t2STR_PRE killed $lr, $sp, -4, 14 /* CC::al */, $noreg
42 ; MACHO-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 4
43 ; MACHO-NEXT: frame-setup CFI_INSTRUCTION offset $lr, -4
44 ; MACHO-NEXT: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_0{{.*}}
45 ; MACHO-NEXT: renamable $r0, dead $cpsr = tADDi8 killed renamable $r0, 8, 14 /* CC::al */, $noreg
46 ; MACHO-NEXT: $lr, $sp = frame-destroy t2LDR_POST $sp, 4, 14 /* CC::al */, $noreg
47 ; MACHO-NEXT: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
49 ; THUMB1-NOT: OUTLINED_FUNCTION_0
52 %call = tail call i32 @thunk_called_fn(i32 1, i32 2, i32 3, i32 4)
53 %cx = add i32 %call, 8
60 ; ARM-NEXT: liveins: $r11, $lr
61 ; ARM: $sp = frame-setup STMDB_UPD $sp, 14 /* CC::al */, $noreg, killed $r11, killed $lr
62 ; ARM-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 8
63 ; ARM-NEXT: frame-setup CFI_INSTRUCTION offset $lr, -4
64 ; ARM-NEXT: frame-setup CFI_INSTRUCTION offset $r11, -8
65 ; ARM-NEXT: BL @OUTLINED_FUNCTION_0{{.*}}
66 ; ARM-NEXT: renamable $r0 = ADDri killed renamable $r0, 88, 14 /* CC::al */, $noreg, $noreg
67 ; ARM-NEXT: $sp = frame-destroy LDMIA_RET $sp, 14 /* CC::al */, $noreg, def $r11, def $pc, implicit killed $r0
69 ; THUMB-LABEL: name: b
71 ; THUMB-NEXT: liveins: $r7, $lr
72 ; THUMB: frame-setup tPUSH 14 /* CC::al */, $noreg, killed $r7, killed $lr
73 ; THUMB-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 8
74 ; THUMB-NEXT: frame-setup CFI_INSTRUCTION offset $lr, -4
75 ; THUMB-NEXT: frame-setup CFI_INSTRUCTION offset $r7, -8
76 ; THUMB-NEXT: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_0{{.*}}
77 ; THUMB-NEXT: renamable $r0, dead $cpsr = tADDi8 killed renamable $r0, 88, 14 /* CC::al */, $noreg
78 ; THUMB-NEXT: tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc
80 ; MACHO-LABEL: name: b
82 ; MACHO-NEXT: liveins: $lr
83 ; MACHO: early-clobber $sp = frame-setup t2STR_PRE killed $lr, $sp, -4, 14 /* CC::al */, $noreg
84 ; MACHO-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 4
85 ; MACHO-NEXT: frame-setup CFI_INSTRUCTION offset $lr, -4
86 ; MACHO-NEXT: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_0{{.*}}
87 ; MACHO-NEXT: renamable $r0, dead $cpsr = tADDi8 killed renamable $r0, 88, 14 /* CC::al */, $noreg
88 ; MACHO-NEXT: $lr, $sp = frame-destroy t2LDR_POST $sp, 4, 14 /* CC::al */, $noreg
89 ; MACHO-NEXT: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
91 %call = tail call i32 @thunk_called_fn(i32 1, i32 2, i32 3, i32 4)
92 %cx = add i32 %call, 88
96 ; ARM-LABEL: name: OUTLINED_FUNCTION_0
98 ; ARM-NEXT: liveins: $r10, $r9, $r8, $r7, $r6, $r5, $r4, $d15, $d14, $d13, $d12, $d11, $d10, $d9, $d8
99 ; ARM: $r0 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
100 ; ARM-NEXT: $r1 = MOVi 2, 14 /* CC::al */, $noreg, $noreg
101 ; ARM-NEXT: $r2 = MOVi 3, 14 /* CC::al */, $noreg, $noreg
102 ; ARM-NEXT: $r3 = MOVi 4, 14 /* CC::al */, $noreg, $noreg
103 ; ARM-NEXT: TAILJMPd @thunk_called_fn, implicit $sp
105 ; THUMB-LABEL: name: OUTLINED_FUNCTION_0
107 ; THUMB-NEXT: liveins: $r11, $r10, $r9, $r8, $r6, $r5, $r4, $d15, $d14, $d13, $d12, $d11, $d10, $d9, $d8
108 ; THUMB: $r0, dead $cpsr = tMOVi8 1, 14 /* CC::al */, $noreg
109 ; THUMB-NEXT: $r1, dead $cpsr = tMOVi8 2, 14 /* CC::al */, $noreg
110 ; THUMB-NEXT: $r2, dead $cpsr = tMOVi8 3, 14 /* CC::al */, $noreg
111 ; THUMB-NEXT: $r3, dead $cpsr = tMOVi8 4, 14 /* CC::al */, $noreg
112 ; THUMB-NEXT: tTAILJMPdND @thunk_called_fn, 14 /* CC::al */, $noreg, implicit $sp
114 ; MACHO-LABEL: name: OUTLINED_FUNCTION_0
116 ; MACHO-NEXT: liveins: $r7, $r6, $r5, $r4, $r11, $r10, $r8, $d15, $d14, $d13, $d12, $d11, $d10, $d9, $d8
117 ; MACHO: $r0, dead $cpsr = tMOVi8 1, 14 /* CC::al */, $noreg
118 ; MACHO-NEXT: $r1, dead $cpsr = tMOVi8 2, 14 /* CC::al */, $noreg
119 ; MACHO-NEXT: $r2, dead $cpsr = tMOVi8 3, 14 /* CC::al */, $noreg
120 ; MACHO-NEXT: $r3, dead $cpsr = tMOVi8 4, 14 /* CC::al */, $noreg
121 ; MACHO-NEXT: tTAILJMPd @thunk_called_fn, 14 /* CC::al */, $noreg, implicit $sp
123 attributes #0 = { minsize optsize }