1 ; RUN: llc -O0 -fast-isel -mtriple=aarch64-apple-ios -o - %s | FileCheck %s
2 ; RUN: not llc -O0 -mtriple=aarch64-apple-ios -o /dev/null -fast-isel -fast-isel-abort=3 %s 2> %t
3 ; RUN: FileCheck %s --check-prefix=CHECK-ERRORS < %t
5 ; The issue here is that FastISel cannot emit an ADDrr where one of the inputs
6 ; is SP. This only ever crops up with function calls, and then only if the
7 ; argument is at an offset > 2^12 * size from SP.
9 ; If FastISel ever starts coping with this and emits an "add xD, sp, xM" it's
10 ; critical to check the encoding as well as the textual assembly. An ADDXrs with
11 ; SP as an operand will still print with SP, but will actually mean XZR.
13 ; CHECK-ERRORS: LLVM ERROR: FastISel missed call
17 ; CHECK-DAG: mov x[[SP:[0-9]+]], sp
18 ; CHECK-DAG: mov [[TMP:w[0-9]+]], #4104
19 ; CHECK: mov w[[OFFSET:[0-9]+]], [[TMP]]
20 ; CHECK: strb w0, [x[[SP]], x[[OFFSET]]]
22 define void @foo(i8 %in) {
23 call void @bar(i64 undef, i64 undef, i64 undef, i64 undef,
24 i64 undef, i64 undef, i64 undef, i64 undef, ; All regs gone.
25 i64 undef, i64 undef, i64 undef, i64 undef, ; sp + 32
26 i64 undef, i64 undef, i64 undef, i64 undef, ; sp + 64
27 i64 undef, i64 undef, i64 undef, i64 undef,
28 i64 undef, i64 undef, i64 undef, i64 undef, ; sp + 128
29 i64 undef, i64 undef, i64 undef, i64 undef,
30 i64 undef, i64 undef, i64 undef, i64 undef,
31 i64 undef, i64 undef, i64 undef, i64 undef,
32 i64 undef, i64 undef, i64 undef, i64 undef, ; sp + 256
33 i64 undef, i64 undef, i64 undef, i64 undef,
34 i64 undef, i64 undef, i64 undef, i64 undef,
35 i64 undef, i64 undef, i64 undef, i64 undef,
36 i64 undef, i64 undef, i64 undef, i64 undef,
37 i64 undef, i64 undef, i64 undef, i64 undef,
38 i64 undef, i64 undef, i64 undef, i64 undef,
39 i64 undef, i64 undef, i64 undef, i64 undef,
40 i64 undef, i64 undef, i64 undef, i64 undef, ; sp + 512
41 i64 undef, i64 undef, i64 undef, i64 undef,
42 i64 undef, i64 undef, i64 undef, i64 undef,
43 i64 undef, i64 undef, i64 undef, i64 undef,
44 i64 undef, i64 undef, i64 undef, i64 undef,
45 i64 undef, i64 undef, i64 undef, i64 undef,
46 i64 undef, i64 undef, i64 undef, i64 undef,
47 i64 undef, i64 undef, i64 undef, i64 undef,
48 i64 undef, i64 undef, i64 undef, i64 undef,
49 i64 undef, i64 undef, i64 undef, i64 undef,
50 i64 undef, i64 undef, i64 undef, i64 undef,
51 i64 undef, i64 undef, i64 undef, i64 undef,
52 i64 undef, i64 undef, i64 undef, i64 undef,
53 i64 undef, i64 undef, i64 undef, i64 undef,
54 i64 undef, i64 undef, i64 undef, i64 undef,
55 i64 undef, i64 undef, i64 undef, i64 undef,
56 i64 undef, i64 undef, i64 undef, i64 undef, ; sp + 1024
57 i64 undef, i64 undef, i64 undef, i64 undef,
58 i64 undef, i64 undef, i64 undef, i64 undef,
59 i64 undef, i64 undef, i64 undef, i64 undef,
60 i64 undef, i64 undef, i64 undef, i64 undef,
61 i64 undef, i64 undef, i64 undef, i64 undef,
62 i64 undef, i64 undef, i64 undef, i64 undef,
63 i64 undef, i64 undef, i64 undef, i64 undef,
64 i64 undef, i64 undef, i64 undef, i64 undef,
65 i64 undef, i64 undef, i64 undef, i64 undef,
66 i64 undef, i64 undef, i64 undef, i64 undef,
67 i64 undef, i64 undef, i64 undef, i64 undef,
68 i64 undef, i64 undef, i64 undef, i64 undef,
69 i64 undef, i64 undef, i64 undef, i64 undef,
70 i64 undef, i64 undef, i64 undef, i64 undef,
71 i64 undef, i64 undef, i64 undef, i64 undef,
72 i64 undef, i64 undef, i64 undef, i64 undef,
73 i64 undef, i64 undef, i64 undef, i64 undef,
74 i64 undef, i64 undef, i64 undef, i64 undef,
75 i64 undef, i64 undef, i64 undef, i64 undef,
76 i64 undef, i64 undef, i64 undef, i64 undef,
77 i64 undef, i64 undef, i64 undef, i64 undef,
78 i64 undef, i64 undef, i64 undef, i64 undef,
79 i64 undef, i64 undef, i64 undef, i64 undef,
80 i64 undef, i64 undef, i64 undef, i64 undef,
81 i64 undef, i64 undef, i64 undef, i64 undef,
82 i64 undef, i64 undef, i64 undef, i64 undef,
83 i64 undef, i64 undef, i64 undef, i64 undef,
84 i64 undef, i64 undef, i64 undef, i64 undef,
85 i64 undef, i64 undef, i64 undef, i64 undef,
86 i64 undef, i64 undef, i64 undef, i64 undef,
87 i64 undef, i64 undef, i64 undef, i64 undef,
88 i64 undef, i64 undef, i64 undef, i64 undef, ; sp + 2048
89 i64 undef, i64 undef, i64 undef, i64 undef,
90 i64 undef, i64 undef, i64 undef, i64 undef,
91 i64 undef, i64 undef, i64 undef, i64 undef,
92 i64 undef, i64 undef, i64 undef, i64 undef,
93 i64 undef, i64 undef, i64 undef, i64 undef,
94 i64 undef, i64 undef, i64 undef, i64 undef,
95 i64 undef, i64 undef, i64 undef, i64 undef,
96 i64 undef, i64 undef, i64 undef, i64 undef,
97 i64 undef, i64 undef, i64 undef, i64 undef,
98 i64 undef, i64 undef, i64 undef, i64 undef,
99 i64 undef, i64 undef, i64 undef, i64 undef,
100 i64 undef, i64 undef, i64 undef, i64 undef,
101 i64 undef, i64 undef, i64 undef, i64 undef,
102 i64 undef, i64 undef, i64 undef, i64 undef,
103 i64 undef, i64 undef, i64 undef, i64 undef,
104 i64 undef, i64 undef, i64 undef, i64 undef,
105 i64 undef, i64 undef, i64 undef, i64 undef,
106 i64 undef, i64 undef, i64 undef, i64 undef,
107 i64 undef, i64 undef, i64 undef, i64 undef,
108 i64 undef, i64 undef, i64 undef, i64 undef,
109 i64 undef, i64 undef, i64 undef, i64 undef,
110 i64 undef, i64 undef, i64 undef, i64 undef,
111 i64 undef, i64 undef, i64 undef, i64 undef,
112 i64 undef, i64 undef, i64 undef, i64 undef,
113 i64 undef, i64 undef, i64 undef, i64 undef,
114 i64 undef, i64 undef, i64 undef, i64 undef,
115 i64 undef, i64 undef, i64 undef, i64 undef,
116 i64 undef, i64 undef, i64 undef, i64 undef,
117 i64 undef, i64 undef, i64 undef, i64 undef,
118 i64 undef, i64 undef, i64 undef, i64 undef,
119 i64 undef, i64 undef, i64 undef, i64 undef,
120 i64 undef, i64 undef, i64 undef, i64 undef,
121 i64 undef, i64 undef, i64 undef, i64 undef,
122 i64 undef, i64 undef, i64 undef, i64 undef,
123 i64 undef, i64 undef, i64 undef, i64 undef,
124 i64 undef, i64 undef, i64 undef, i64 undef,
125 i64 undef, i64 undef, i64 undef, i64 undef,
126 i64 undef, i64 undef, i64 undef, i64 undef,
127 i64 undef, i64 undef, i64 undef, i64 undef,
128 i64 undef, i64 undef, i64 undef, i64 undef,
129 i64 undef, i64 undef, i64 undef, i64 undef,
130 i64 undef, i64 undef, i64 undef, i64 undef,
131 i64 undef, i64 undef, i64 undef, i64 undef,
132 i64 undef, i64 undef, i64 undef, i64 undef,
133 i64 undef, i64 undef, i64 undef, i64 undef,
134 i64 undef, i64 undef, i64 undef, i64 undef,
135 i64 undef, i64 undef, i64 undef, i64 undef,
136 i64 undef, i64 undef, i64 undef, i64 undef,
137 i64 undef, i64 undef, i64 undef, i64 undef,
138 i64 undef, i64 undef, i64 undef, i64 undef,
139 i64 undef, i64 undef, i64 undef, i64 undef,
140 i64 undef, i64 undef, i64 undef, i64 undef,
141 i64 undef, i64 undef, i64 undef, i64 undef,
142 i64 undef, i64 undef, i64 undef, i64 undef,
143 i64 undef, i64 undef, i64 undef, i64 undef,
144 i64 undef, i64 undef, i64 undef, i64 undef,
145 i64 undef, i64 undef, i64 undef, i64 undef,
146 i64 undef, i64 undef, i64 undef, i64 undef,
147 i64 undef, i64 undef, i64 undef, i64 undef,
148 i64 undef, i64 undef, i64 undef, i64 undef,
149 i64 undef, i64 undef, i64 undef, i64 undef,
150 i64 undef, i64 undef, i64 undef, i64 undef,
151 i64 undef, i64 undef, i64 undef, i64 undef,
152 i64 undef, i64 undef, i64 undef, i64 undef, ; sp + 4096
153 i64 undef, ; sp + 4104 (i.e. not uimm12 or uimm12 << 12).
158 declare void @bar(i64, i64, i64, i64,
159 i64, i64, i64, i64, ; All regs gone.
160 i64, i64, i64, i64, ; sp + 32
161 i64, i64, i64, i64, ; sp + 64
163 i64, i64, i64, i64, ; sp + 128
167 i64, i64, i64, i64, ; sp + 256
175 i64, i64, i64, i64, ; sp + 512
191 i64, i64, i64, i64, ; sp + 1024
223 i64, i64, i64, i64, ; sp + 2048
287 i64, i64, i64, i64, ; sp + 4096