1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=avr | FileCheck %s
4 define void @add_r_i8(i8 signext %0, i8 signext %1) {
5 ; CHECK-LABEL: add_r_i8:
7 ; CHECK-NEXT: mov r20, r22
8 ; CHECK-NEXT: mov r22, r24
10 ; CHECK-NEXT: mov r24, r22
11 ; CHECK-NEXT: add r24, r20
13 ; CHECK-NEXT: call foo8
15 %3 = tail call i8 asm sideeffect "mov $0, $1\0Aadd $0, $2", "=r,r,r"(i8 %0, i8 %1)
16 tail call void @foo8(i8 signext %3, i8 signext %0, i8 signext %1)
20 declare void @foo8(i8 signext, i8 signext, i8 signext)
22 define void @add_r_i16(i16 signext %0, i16 signext %1) {
23 ; CHECK-LABEL: add_r_i16:
25 ; CHECK-NEXT: mov r20, r22
26 ; CHECK-NEXT: mov r21, r23
27 ; CHECK-NEXT: mov r22, r24
28 ; CHECK-NEXT: mov r23, r25
30 ; CHECK-NEXT: mov r24, r22
31 ; CHECK-NEXT: mov r25, r23
32 ; CHECK-NEXT: add r24, r20
33 ; CHECK-NEXT: adc r25, r21
35 ; CHECK-NEXT: call foo16
37 %3 = tail call i16 asm sideeffect "mov ${0:A}, ${1:A}\0Amov ${0:B}, ${1:B}\0Aadd ${0:A}, ${2:A}\0Aadc ${0:B}, ${2:B}", "=r,r,r"(i16 %0, i16 %1)
38 tail call void @foo16(i16 signext %3, i16 signext %0, i16 signext %1)
42 declare void @foo16(i16 signext, i16 signext, i16 signext)
44 define void @add_a_i8(i8 signext %0, i8 signext %1) {
45 ; CHECK-LABEL: add_a_i8:
47 ; CHECK-NEXT: mov r20, r22
48 ; CHECK-NEXT: mov r22, r24
50 ; CHECK-NEXT: mov r23, r22
51 ; CHECK-NEXT: add r23, r20
53 ; CHECK-NEXT: mov r24, r23
54 ; CHECK-NEXT: call foo8
56 %3 = tail call i8 asm sideeffect "mov $0, $1\0Aadd $0, $2", "=a,a,a"(i8 %0, i8 %1)
57 tail call void @foo8(i8 signext %3, i8 signext %0, i8 signext %1)
61 define void @add_a_i16(i16 signext %0, i16 signext %1) {
62 ; CHECK-LABEL: add_a_i16:
64 ; CHECK-NEXT: mov r20, r22
65 ; CHECK-NEXT: mov r21, r23
66 ; CHECK-NEXT: mov r22, r24
67 ; CHECK-NEXT: mov r23, r25
69 ; CHECK-NEXT: mov r18, r22
70 ; CHECK-NEXT: mov r19, r23
71 ; CHECK-NEXT: add r18, r20
72 ; CHECK-NEXT: adc r19, r21
74 ; CHECK-NEXT: mov r24, r18
75 ; CHECK-NEXT: mov r25, r19
76 ; CHECK-NEXT: call foo16
78 %3 = tail call i16 asm sideeffect "mov ${0:A}, ${1:A}\0Amov ${0:B}, ${1:B}\0Aadd ${0:A}, ${2:A}\0Aadc ${0:B}, ${2:B}", "=a,a,a"(i16 %0, i16 %1)
79 tail call void @foo16(i16 signext %3, i16 signext %0, i16 signext %1)
83 define void @add_d_i8(i8 signext %0, i8 signext %1) {
84 ; CHECK-LABEL: add_d_i8:
86 ; CHECK-NEXT: mov r20, r22
87 ; CHECK-NEXT: mov r22, r24
89 ; CHECK-NEXT: mov r24, r22
90 ; CHECK-NEXT: add r24, r20
92 ; CHECK-NEXT: call foo8
94 %3 = tail call i8 asm sideeffect "mov $0, $1\0Aadd $0, $2", "=d,d,d"(i8 %0, i8 %1)
95 tail call void @foo8(i8 signext %3, i8 signext %0, i8 signext %1)
99 define void @add_d_i16(i16 signext %0, i16 signext %1) {
100 ; CHECK-LABEL: add_d_i16:
102 ; CHECK-NEXT: mov r20, r22
103 ; CHECK-NEXT: mov r21, r23
104 ; CHECK-NEXT: mov r22, r24
105 ; CHECK-NEXT: mov r23, r25
107 ; CHECK-NEXT: mov r24, r22
108 ; CHECK-NEXT: mov r25, r23
109 ; CHECK-NEXT: add r24, r20
110 ; CHECK-NEXT: adc r25, r21
111 ; CHECK-NEXT: ;NO_APP
112 ; CHECK-NEXT: call foo16
114 %3 = tail call i16 asm sideeffect "mov ${0:A}, ${1:A}\0Amov ${0:B}, ${1:B}\0Aadd ${0:A}, ${2:A}\0Aadc ${0:B}, ${2:B}", "=d,d,d"(i16 %0, i16 %1)
115 tail call void @foo16(i16 signext %3, i16 signext %0, i16 signext %1)
119 define void @add_l_i8(i8 signext %0, i8 signext %1) {
120 ; CHECK-LABEL: add_l_i8:
122 ; CHECK-NEXT: push r13
123 ; CHECK-NEXT: push r14
124 ; CHECK-NEXT: push r15
125 ; CHECK-NEXT: mov r15, r22
126 ; CHECK-NEXT: mov r14, r24
128 ; CHECK-NEXT: mov r13, r14
129 ; CHECK-NEXT: add r13, r15
130 ; CHECK-NEXT: ;NO_APP
131 ; CHECK-NEXT: mov r24, r13
132 ; CHECK-NEXT: mov r22, r14
133 ; CHECK-NEXT: mov r20, r15
134 ; CHECK-NEXT: call foo8
135 ; CHECK-NEXT: pop r15
136 ; CHECK-NEXT: pop r14
137 ; CHECK-NEXT: pop r13
139 %3 = tail call i8 asm sideeffect "mov $0, $1\0Aadd $0, $2", "=l,l,l"(i8 %0, i8 %1)
140 tail call void @foo8(i8 signext %3, i8 signext %0, i8 signext %1)
144 define void @add_l_i16(i16 signext %0, i16 signext %1) {
145 ; CHECK-LABEL: add_l_i16:
147 ; CHECK-NEXT: push r10
148 ; CHECK-NEXT: push r11
149 ; CHECK-NEXT: push r12
150 ; CHECK-NEXT: push r13
151 ; CHECK-NEXT: push r14
152 ; CHECK-NEXT: push r15
153 ; CHECK-NEXT: mov r14, r22
154 ; CHECK-NEXT: mov r15, r23
155 ; CHECK-NEXT: mov r12, r24
156 ; CHECK-NEXT: mov r13, r25
158 ; CHECK-NEXT: mov r10, r12
159 ; CHECK-NEXT: mov r11, r13
160 ; CHECK-NEXT: add r10, r14
161 ; CHECK-NEXT: adc r11, r15
162 ; CHECK-NEXT: ;NO_APP
163 ; CHECK-NEXT: mov r24, r10
164 ; CHECK-NEXT: mov r25, r11
165 ; CHECK-NEXT: mov r22, r12
166 ; CHECK-NEXT: mov r23, r13
167 ; CHECK-NEXT: mov r20, r14
168 ; CHECK-NEXT: mov r21, r15
169 ; CHECK-NEXT: call foo16
170 ; CHECK-NEXT: pop r15
171 ; CHECK-NEXT: pop r14
172 ; CHECK-NEXT: pop r13
173 ; CHECK-NEXT: pop r12
174 ; CHECK-NEXT: pop r11
175 ; CHECK-NEXT: pop r10
177 %3 = tail call i16 asm sideeffect "mov ${0:A}, ${1:A}\0Amov ${0:B}, ${1:B}\0Aadd ${0:A}, ${2:A}\0Aadc ${0:B}, ${2:B}", "=l,l,l"(i16 %0, i16 %1)
178 tail call void @foo16(i16 signext %3, i16 signext %0, i16 signext %1)
182 define void @add_b_i8(i8 signext %0, i8 signext %1) {
183 ; CHECK-LABEL: add_b_i8:
185 ; CHECK-NEXT: mov r20, r22
186 ; CHECK-NEXT: mov r22, r24
187 ; CHECK-NEXT: mov r30, r22
189 ; CHECK-NEXT: mov r30, r30
190 ; CHECK-NEXT: add r30, r20
191 ; CHECK-NEXT: ;NO_APP
192 ; CHECK-NEXT: mov r24, r30
193 ; CHECK-NEXT: call foo8
195 %3 = tail call i8 asm sideeffect "mov $0, $1\0Aadd $0, $2", "=b,b,r"(i8 %0, i8 %1)
196 tail call void @foo8(i8 signext %3, i8 signext %0, i8 signext %1)
200 define void @add_b_i16(i16 signext %0, i16 signext %1) {
201 ; CHECK-LABEL: add_b_i16:
203 ; CHECK-NEXT: mov r20, r22
204 ; CHECK-NEXT: mov r21, r23
205 ; CHECK-NEXT: mov r22, r24
206 ; CHECK-NEXT: mov r23, r25
207 ; CHECK-NEXT: mov r30, r22
208 ; CHECK-NEXT: mov r31, r23
210 ; CHECK-NEXT: mov r30, r30
211 ; CHECK-NEXT: mov r31, r31
212 ; CHECK-NEXT: add r30, r20
213 ; CHECK-NEXT: adc r31, r21
214 ; CHECK-NEXT: ;NO_APP
215 ; CHECK-NEXT: mov r24, r30
216 ; CHECK-NEXT: mov r25, r31
217 ; CHECK-NEXT: call foo16
219 %3 = tail call i16 asm sideeffect "mov ${0:A}, ${1:A}\0Amov ${0:B}, ${1:B}\0Aadd ${0:A}, ${2:A}\0Aadc ${0:B}, ${2:B}", "=b,b,r"(i16 %0, i16 %1)
220 tail call void @foo16(i16 signext %3, i16 signext %0, i16 signext %1)
224 define void @add_e_i8(i8 signext %0, i8 signext %1) {
225 ; CHECK-LABEL: add_e_i8:
227 ; CHECK-NEXT: mov r30, r22
228 ; CHECK-NEXT: mov r22, r24
229 ; CHECK-NEXT: mov r26, r22
230 ; CHECK-NEXT: mov r27, r23
232 ; CHECK-NEXT: mov r26, r26
233 ; CHECK-NEXT: add r26, r30
234 ; CHECK-NEXT: ;NO_APP
235 ; CHECK-NEXT: mov r24, r26
236 ; CHECK-NEXT: ; kill: def $r22 killed $r22 killed $r23r22
237 ; CHECK-NEXT: mov r20, r30
238 ; CHECK-NEXT: call foo8
240 %3 = tail call i8 asm sideeffect "mov $0, $1\0Aadd $0, $2", "=e,e,e"(i8 %0, i8 %1)
241 tail call void @foo8(i8 signext %3, i8 signext %0, i8 signext %1)
245 define void @add_e_i16(i16 signext %0, i16 signext %1) {
246 ; CHECK-LABEL: add_e_i16:
248 ; CHECK-NEXT: mov r30, r22
249 ; CHECK-NEXT: mov r31, r23
250 ; CHECK-NEXT: mov r22, r24
251 ; CHECK-NEXT: mov r23, r25
252 ; CHECK-NEXT: mov r26, r22
253 ; CHECK-NEXT: mov r27, r23
255 ; CHECK-NEXT: mov r26, r26
256 ; CHECK-NEXT: mov r27, r27
257 ; CHECK-NEXT: add r26, r30
258 ; CHECK-NEXT: adc r27, r31
259 ; CHECK-NEXT: ;NO_APP
260 ; CHECK-NEXT: mov r24, r26
261 ; CHECK-NEXT: mov r25, r27
262 ; CHECK-NEXT: mov r20, r30
263 ; CHECK-NEXT: mov r21, r31
264 ; CHECK-NEXT: call foo16
266 %3 = tail call i16 asm sideeffect "mov ${0:A}, ${1:A}\0Amov ${0:B}, ${1:B}\0Aadd ${0:A}, ${2:A}\0Aadc ${0:B}, ${2:B}", "=e,e,e"(i16 %0, i16 %1)
267 tail call void @foo16(i16 signext %3, i16 signext %0, i16 signext %1)
271 define void @add_t_i8(i8 signext %0, i8 signext %1) {
272 ; CHECK-LABEL: add_t_i8:
274 ; CHECK-NEXT: mov r20, r22
275 ; CHECK-NEXT: mov r22, r24
277 ; CHECK-NEXT: mov r0, r22
278 ; CHECK-NEXT: add r0, r20
279 ; CHECK-NEXT: ;NO_APP
280 ; CHECK-NEXT: mov r24, r0
281 ; CHECK-NEXT: call foo8
283 %3 = tail call i8 asm sideeffect "mov $0, $1\0Aadd $0, $2", "=t,r,r"(i8 %0, i8 %1)
284 tail call void @foo8(i8 signext %3, i8 signext %0, i8 signext %1)
288 define void @add_w_i8(i8 signext %0, i8 signext %1) {
289 ; CHECK-LABEL: add_w_i8:
291 ; CHECK-NEXT: mov r26, r22
292 ; CHECK-NEXT: mov r30, r24
294 ; CHECK-NEXT: mov r24, r30
295 ; CHECK-NEXT: add r24, r26
296 ; CHECK-NEXT: ;NO_APP
297 ; CHECK-NEXT: ; kill: def $r24 killed $r24 killed $r25r24
298 ; CHECK-NEXT: mov r22, r30
299 ; CHECK-NEXT: mov r20, r26
300 ; CHECK-NEXT: call foo8
302 %3 = tail call i8 asm sideeffect "mov $0, $1\0Aadd $0, $2", "=w,w,w"(i8 %0, i8 %1)
303 tail call void @foo8(i8 signext %3, i8 signext %0, i8 signext %1)
307 define void @add_w_i16(i16 signext %0, i16 signext %1) {
308 ; CHECK-LABEL: add_w_i16:
310 ; CHECK-NEXT: mov r26, r22
311 ; CHECK-NEXT: mov r27, r23
312 ; CHECK-NEXT: mov r30, r24
313 ; CHECK-NEXT: mov r31, r25
315 ; CHECK-NEXT: mov r24, r30
316 ; CHECK-NEXT: mov r25, r31
317 ; CHECK-NEXT: add r24, r26
318 ; CHECK-NEXT: adc r25, r27
319 ; CHECK-NEXT: ;NO_APP
320 ; CHECK-NEXT: mov r22, r30
321 ; CHECK-NEXT: mov r23, r31
322 ; CHECK-NEXT: mov r20, r26
323 ; CHECK-NEXT: mov r21, r27
324 ; CHECK-NEXT: call foo16
326 %3 = tail call i16 asm sideeffect "mov ${0:A}, ${1:A}\0Amov ${0:B}, ${1:B}\0Aadd ${0:A}, ${2:A}\0Aadc ${0:B}, ${2:B}", "=w,w,w"(i16 %0, i16 %1)
327 tail call void @foo16(i16 signext %3, i16 signext %0, i16 signext %1)
331 define void @add_xyz_i8(i8 signext %0, i8 signext %1) {
332 ; CHECK-LABEL: add_xyz_i8:
334 ; CHECK-NEXT: push r28
335 ; CHECK-NEXT: push r29
336 ; CHECK-NEXT: mov r20, r22
337 ; CHECK-NEXT: mov r22, r24
338 ; CHECK-NEXT: mov r28, r22
339 ; CHECK-NEXT: mov r29, r23
340 ; CHECK-NEXT: mov r26, r20
341 ; CHECK-NEXT: mov r27, r21
343 ; CHECK-NEXT: mov r30, r28
344 ; CHECK-NEXT: add r30, r26
345 ; CHECK-NEXT: ;NO_APP
346 ; CHECK-NEXT: mov r24, r30
347 ; CHECK-NEXT: mov r25, r31
348 ; CHECK-NEXT: ; kill: def $r24 killed $r24 killed $r25r24
349 ; CHECK-NEXT: ; kill: def $r22 killed $r22 killed $r23r22
350 ; CHECK-NEXT: ; kill: def $r20 killed $r20 killed $r21r20
351 ; CHECK-NEXT: call foo8
352 ; CHECK-NEXT: pop r29
353 ; CHECK-NEXT: pop r28
355 %3 = tail call i8 asm sideeffect "mov $0, $1\0Aadd $0, $2", "=z,y,x"(i8 %0, i8 %1)
356 tail call void @foo8(i8 signext %3, i8 signext %0, i8 signext %1)
360 define void @add_xyz_i16(i16 signext %0, i16 signext %1) {
361 ; CHECK-LABEL: add_xyz_i16:
363 ; CHECK-NEXT: push r28
364 ; CHECK-NEXT: push r29
365 ; CHECK-NEXT: mov r20, r22
366 ; CHECK-NEXT: mov r21, r23
367 ; CHECK-NEXT: mov r22, r24
368 ; CHECK-NEXT: mov r23, r25
369 ; CHECK-NEXT: mov r28, r22
370 ; CHECK-NEXT: mov r29, r23
371 ; CHECK-NEXT: mov r26, r20
372 ; CHECK-NEXT: mov r27, r21
374 ; CHECK-NEXT: mov r30, r28
375 ; CHECK-NEXT: mov r31, r29
376 ; CHECK-NEXT: add r30, r26
377 ; CHECK-NEXT: adc r31, r27
378 ; CHECK-NEXT: ;NO_APP
379 ; CHECK-NEXT: mov r24, r30
380 ; CHECK-NEXT: mov r25, r31
381 ; CHECK-NEXT: call foo16
382 ; CHECK-NEXT: pop r29
383 ; CHECK-NEXT: pop r28
385 %3 = tail call i16 asm sideeffect "mov ${0:A}, ${1:A}\0Amov ${0:B}, ${1:B}\0Aadd ${0:A}, ${2:A}\0Aadc ${0:B}, ${2:B}", "=z,y,x"(i16 %0, i16 %1)
386 tail call void @foo16(i16 signext %3, i16 signext %0, i16 signext %1)