Revert 374373: [Codegen] Alter the default promotion for saturating adds and subs
[llvm-core.git] / test / CodeGen / AArch64 / fast-isel-sp-adjust.ll
blob62815daa6c5100aa1688605f3a1d277918df05e2
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
15 ; CHECK-LABEL: foo:
16 ; CHECK: sub
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).
154                  i8 %in)
155   ret void
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
162                   i64, i64, i64, i64,
163                   i64, i64, i64, i64, ; sp + 128
164                   i64, i64, i64, i64,
165                   i64, i64, i64, i64,
166                   i64, i64, i64, i64,
167                   i64, i64, i64, i64, ; sp + 256
168                   i64, i64, i64, i64,
169                   i64, i64, i64, i64,
170                   i64, i64, i64, i64,
171                   i64, i64, i64, i64,
172                   i64, i64, i64, i64,
173                   i64, i64, i64, i64,
174                   i64, i64, i64, i64,
175                   i64, i64, i64, i64, ; sp + 512
176                   i64, i64, i64, i64,
177                   i64, i64, i64, i64,
178                   i64, i64, i64, i64,
179                   i64, i64, i64, i64,
180                   i64, i64, i64, i64,
181                   i64, i64, i64, i64,
182                   i64, i64, i64, i64,
183                   i64, i64, i64, i64,
184                   i64, i64, i64, i64,
185                   i64, i64, i64, i64,
186                   i64, i64, i64, i64,
187                   i64, i64, i64, i64,
188                   i64, i64, i64, i64,
189                   i64, i64, i64, i64,
190                   i64, i64, i64, i64,
191                   i64, i64, i64, i64, ; sp + 1024
192                   i64, i64, i64, i64,
193                   i64, i64, i64, i64,
194                   i64, i64, i64, i64,
195                   i64, i64, i64, i64,
196                   i64, i64, i64, i64,
197                   i64, i64, i64, i64,
198                   i64, i64, i64, i64,
199                   i64, i64, i64, i64,
200                   i64, i64, i64, i64,
201                   i64, i64, i64, i64,
202                   i64, i64, i64, i64,
203                   i64, i64, i64, i64,
204                   i64, i64, i64, i64,
205                   i64, i64, i64, i64,
206                   i64, i64, i64, i64,
207                   i64, i64, i64, i64,
208                   i64, i64, i64, i64,
209                   i64, i64, i64, i64,
210                   i64, i64, i64, i64,
211                   i64, i64, i64, i64,
212                   i64, i64, i64, i64,
213                   i64, i64, i64, i64,
214                   i64, i64, i64, i64,
215                   i64, i64, i64, i64,
216                   i64, i64, i64, i64,
217                   i64, i64, i64, i64,
218                   i64, i64, i64, i64,
219                   i64, i64, i64, i64,
220                   i64, i64, i64, i64,
221                   i64, i64, i64, i64,
222                   i64, i64, i64, i64,
223                   i64, i64, i64, i64, ; sp + 2048
224                   i64, i64, i64, i64,
225                   i64, i64, i64, i64,
226                   i64, i64, i64, i64,
227                   i64, i64, i64, i64,
228                   i64, i64, i64, i64,
229                   i64, i64, i64, i64,
230                   i64, i64, i64, i64,
231                   i64, i64, i64, i64,
232                   i64, i64, i64, i64,
233                   i64, i64, i64, i64,
234                   i64, i64, i64, i64,
235                   i64, i64, i64, i64,
236                   i64, i64, i64, i64,
237                   i64, i64, i64, i64,
238                   i64, i64, i64, i64,
239                   i64, i64, i64, i64,
240                   i64, i64, i64, i64,
241                   i64, i64, i64, i64,
242                   i64, i64, i64, i64,
243                   i64, i64, i64, i64,
244                   i64, i64, i64, i64,
245                   i64, i64, i64, i64,
246                   i64, i64, i64, i64,
247                   i64, i64, i64, i64,
248                   i64, i64, i64, i64,
249                   i64, i64, i64, i64,
250                   i64, i64, i64, i64,
251                   i64, i64, i64, i64,
252                   i64, i64, i64, i64,
253                   i64, i64, i64, i64,
254                   i64, i64, i64, i64,
255                   i64, i64, i64, i64,
256                   i64, i64, i64, i64,
257                   i64, i64, i64, i64,
258                   i64, i64, i64, i64,
259                   i64, i64, i64, i64,
260                   i64, i64, i64, i64,
261                   i64, i64, i64, i64,
262                   i64, i64, i64, i64,
263                   i64, i64, i64, i64,
264                   i64, i64, i64, i64,
265                   i64, i64, i64, i64,
266                   i64, i64, i64, i64,
267                   i64, i64, i64, i64,
268                   i64, i64, i64, i64,
269                   i64, i64, i64, i64,
270                   i64, i64, i64, i64,
271                   i64, i64, i64, i64,
272                   i64, i64, i64, i64,
273                   i64, i64, i64, i64,
274                   i64, i64, i64, i64,
275                   i64, i64, i64, i64,
276                   i64, i64, i64, i64,
277                   i64, i64, i64, i64,
278                   i64, i64, i64, i64,
279                   i64, i64, i64, i64,
280                   i64, i64, i64, i64,
281                   i64, i64, i64, i64,
282                   i64, i64, i64, i64,
283                   i64, i64, i64, i64,
284                   i64, i64, i64, i64,
285                   i64, i64, i64, i64,
286                   i64, i64, i64, i64,
287                   i64, i64, i64, i64, ; sp + 4096
288                   i64,
289                   i8)