1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=arm-- -run-pass=machine-outliner -verify-machineinstrs \
3# RUN: %s -o - | FileCheck %s
4
5--- |
6  define void @outline_no_save_ok_arm() #0 { ret void }
7  define void @outline_no_save_ko_arm() #0 { ret void }
8  define void @outline_no_save_ok_thumb() #1 { ret void }
9  define void @outline_no_save_ko_thumb() #1 { ret void }
10
11  declare void @foo()
12
13  attributes #0 = { minsize optsize }
14  attributes #1 = { minsize optsize "target-features"="+armv7-a,+thumb-mode" }
15...
16---
17
18name:           outline_no_save_ok_arm
19tracksRegLiveness: true
20body:             |
21  ; CHECK-LABEL: name: outline_no_save_ok_arm
22  ; CHECK: bb.0:
23  ; CHECK:   BL @OUTLINED_FUNCTION_1
24  ; CHECK: bb.1:
25  ; CHECK:   BL @OUTLINED_FUNCTION_1
26  ; CHECK: bb.2:
27  ; CHECK:   BX_RET 14 /* CC::al */, $noreg
28  bb.0:
29    $r2 = MOVi 1, 14, $noreg, $noreg
30    $r2 = MOVi 1, 14, $noreg, $noreg
31    $r2 = MOVi 1, 14, $noreg, $noreg
32    $r2 = MOVi 1, 14, $noreg, $noreg
33    $r3 = LDRi12 $sp, 8, 14, $noreg
34  bb.1:
35    $r2 = MOVi 1, 14, $noreg, $noreg
36    $r2 = MOVi 1, 14, $noreg, $noreg
37    $r2 = MOVi 1, 14, $noreg, $noreg
38    $r2 = MOVi 1, 14, $noreg, $noreg
39    $r3 = LDRi12 $sp, 8, 14, $noreg
40  bb.2:
41    BX_RET 14, $noreg
42...
43---
44
45name:           outline_no_save_ko_arm
46tracksRegLiveness: true
47body:             |
48  ; CHECK-LABEL: name: outline_no_save_ko_arm
49  ; CHECK-NOT: OUTLINED_FUNCTION
50  bb.0:
51    liveins: $lr
52    $r2 = MOVi 2, 14, $noreg, $noreg
53    $r2 = MOVi 2, 14, $noreg, $noreg
54    $r2 = MOVi 2, 14, $noreg, $noreg
55    $r2 = MOVi 2, 14, $noreg, $noreg
56    $r3 = LDRi12 $sp, 8, 14, $noreg
57    $r2 = MOVr $lr, 14, $noreg, $noreg
58  bb.1:
59    $r2 = MOVi 2, 14, $noreg, $noreg
60    $r2 = MOVi 2, 14, $noreg, $noreg
61    $r2 = MOVi 2, 14, $noreg, $noreg
62    $r2 = MOVi 2, 14, $noreg, $noreg
63    $r3 = LDRi12 $sp, 8, 14, $noreg
64    $r4 = MOVi 4, 14, $noreg, $noreg
65    BL @foo
66  bb.2:
67    liveins: $lr
68    BX_RET 14, $noreg
69...
70---
71
72name:           outline_no_save_ok_thumb
73tracksRegLiveness: true
74body:             |
75  ; CHECK-LABEL: name: outline_no_save_ok_thumb
76  ; CHECK: bb.0:
77  ; CHECK:   tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_0
78  ; CHECK: bb.1:
79  ; CHECK:   tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_0
80  ; CHECK: bb.2:
81  ; CHECK:   tBX_RET 14 /* CC::al */, $noreg
82  bb.0:
83    $r2 = t2MOVi 1, 14, $noreg, $noreg
84    $r2 = t2MOVi 1, 14, $noreg, $noreg
85    $r2 = t2MOVi 1, 14, $noreg, $noreg
86    $r2 = t2MOVi 1, 14, $noreg, $noreg
87    t2STRi12 $r2, $sp, 0, 14, $noreg
88  bb.1:
89    $r2 = t2MOVi 1, 14, $noreg, $noreg
90    $r2 = t2MOVi 1, 14, $noreg, $noreg
91    $r2 = t2MOVi 1, 14, $noreg, $noreg
92    $r2 = t2MOVi 1, 14, $noreg, $noreg
93    t2STRi12 $r2, $sp, 0, 14, $noreg
94  bb.2:
95    tBX_RET 14, $noreg
96...
97---
98
99name:           outline_no_save_ko_thumb
100tracksRegLiveness: true
101body:             |
102  ; CHECK-LABEL: name: outline_no_save_ko_thumb
103  ; CHECK-NOT: OUTLINED_FUNCTION
104  bb.0:
105    liveins: $lr
106    $r2 = t2MOVi 2, 14, $noreg, $noreg
107    $r2 = t2MOVi 2, 14, $noreg, $noreg
108    $r2 = t2MOVi 2, 14, $noreg, $noreg
109    $r2 = t2MOVi 2, 14, $noreg, $noreg
110    t2STRi12 $r2, $sp, 0, 14, $noreg
111    $r2 = tMOVr $lr, 14, $noreg
112  bb.1:
113    $r2 = t2MOVi 2, 14, $noreg, $noreg
114    $r2 = t2MOVi 2, 14, $noreg, $noreg
115    $r2 = t2MOVi 2, 14, $noreg, $noreg
116    $r2 = t2MOVi 2, 14, $noreg, $noreg
117    t2STRi12 $r2, $sp, 0, 14, $noreg
118    $r4 = t2MOVi 3, 14, $noreg, $noreg
119    tBL 14, $noreg, @foo
120  bb.2:
121    liveins: $lr, $r0, $r6, $r7, $r8, $r9, $r10, $r11
122    tBX_RET 14, $noreg
123
124  ; CHECK-LABEL: name: OUTLINED_FUNCTION_0
125  ; CHECK: bb.0:
126  ; CHECK:   $r2 = t2MOVi 1, 14 /* CC::al */, $noreg, $noreg
127  ; CHECK:   $r2 = t2MOVi 1, 14 /* CC::al */, $noreg, $noreg
128  ; CHECK:   $r2 = t2MOVi 1, 14 /* CC::al */, $noreg, $noreg
129  ; CHECK:   $r2 = t2MOVi 1, 14 /* CC::al */, $noreg, $noreg
130  ; CHECK:   t2STRi12 $r2, $sp, 0, 14 /* CC::al */, $noreg
131  ; CHECK:   tBX_RET 14 /* CC::al */, $noreg
132
133  ; CHECK-LABEL: name: OUTLINED_FUNCTION_1
134  ; CHECK: bb.0:
135  ; CHECK:   $r2 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
136  ; CHECK:   $r2 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
137  ; CHECK:   $r2 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
138  ; CHECK:   $r2 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
139  ; CHECK:   $r3 = LDRi12 $sp, 8, 14 /* CC::al */, $noreg
140  ; CHECK:   MOVPCLR 14 /* CC::al */, $noreg
141