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: rcall 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: rcall 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: rcall 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: rcall 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: rcall 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: rcall 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: rcall 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: rcall 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: rcall 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: rcall 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
231 ; CHECK-NEXT: mov r26, r26
232 ; CHECK-NEXT: add r26, r30
233 ; CHECK-NEXT: ;NO_APP
234 ; CHECK-NEXT: mov r20, r30
235 ; CHECK-NEXT: mov r24, r26
236 ; CHECK-NEXT: rcall foo8
238 %3 = tail call i8 asm sideeffect "mov $0, $1\0Aadd $0, $2", "=e,e,e"(i8 %0, i8 %1)
239 tail call void @foo8(i8 signext %3, i8 signext %0, i8 signext %1)
243 define void @add_e_i16(i16 signext %0, i16 signext %1) {
244 ; CHECK-LABEL: add_e_i16:
246 ; CHECK-NEXT: mov r30, r22
247 ; CHECK-NEXT: mov r31, r23
248 ; CHECK-NEXT: mov r22, r24
249 ; CHECK-NEXT: mov r23, r25
250 ; CHECK-NEXT: mov r26, r22
251 ; CHECK-NEXT: mov r27, r23
253 ; CHECK-NEXT: mov r26, r26
254 ; CHECK-NEXT: mov r27, r27
255 ; CHECK-NEXT: add r26, r30
256 ; CHECK-NEXT: adc r27, r31
257 ; CHECK-NEXT: ;NO_APP
258 ; CHECK-NEXT: mov r24, r26
259 ; CHECK-NEXT: mov r25, r27
260 ; CHECK-NEXT: mov r20, r30
261 ; CHECK-NEXT: mov r21, r31
262 ; CHECK-NEXT: rcall foo16
264 %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)
265 tail call void @foo16(i16 signext %3, i16 signext %0, i16 signext %1)
269 define void @add_t_i8(i8 signext %0, i8 signext %1) {
270 ; CHECK-LABEL: add_t_i8:
272 ; CHECK-NEXT: mov r20, r22
273 ; CHECK-NEXT: mov r22, r24
275 ; CHECK-NEXT: mov r0, r22
276 ; CHECK-NEXT: add r0, r20
277 ; CHECK-NEXT: ;NO_APP
278 ; CHECK-NEXT: mov r24, r0
279 ; CHECK-NEXT: rcall foo8
281 %3 = tail call i8 asm sideeffect "mov $0, $1\0Aadd $0, $2", "=t,r,r"(i8 %0, i8 %1)
282 tail call void @foo8(i8 signext %3, i8 signext %0, i8 signext %1)
286 define void @add_w_i8(i8 signext %0, i8 signext %1) {
287 ; CHECK-LABEL: add_w_i8:
289 ; CHECK-NEXT: mov r26, r22
290 ; CHECK-NEXT: mov r30, r24
292 ; CHECK-NEXT: mov r24, r30
293 ; CHECK-NEXT: add r24, r26
294 ; CHECK-NEXT: ;NO_APP
295 ; CHECK-NEXT: mov r22, r30
296 ; CHECK-NEXT: mov r20, r26
297 ; CHECK-NEXT: rcall foo8
299 %3 = tail call i8 asm sideeffect "mov $0, $1\0Aadd $0, $2", "=w,w,w"(i8 %0, i8 %1)
300 tail call void @foo8(i8 signext %3, i8 signext %0, i8 signext %1)
304 define void @add_w_i16(i16 signext %0, i16 signext %1) {
305 ; CHECK-LABEL: add_w_i16:
307 ; CHECK-NEXT: mov r26, r22
308 ; CHECK-NEXT: mov r27, r23
309 ; CHECK-NEXT: mov r30, r24
310 ; CHECK-NEXT: mov r31, r25
312 ; CHECK-NEXT: mov r24, r30
313 ; CHECK-NEXT: mov r25, r31
314 ; CHECK-NEXT: add r24, r26
315 ; CHECK-NEXT: adc r25, r27
316 ; CHECK-NEXT: ;NO_APP
317 ; CHECK-NEXT: mov r22, r30
318 ; CHECK-NEXT: mov r23, r31
319 ; CHECK-NEXT: mov r20, r26
320 ; CHECK-NEXT: mov r21, r27
321 ; CHECK-NEXT: rcall foo16
323 %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)
324 tail call void @foo16(i16 signext %3, i16 signext %0, i16 signext %1)
328 define void @add_xyz_i8(i8 signext %0, i8 signext %1) {
329 ; CHECK-LABEL: add_xyz_i8:
331 ; CHECK-NEXT: push r28
332 ; CHECK-NEXT: push r29
333 ; CHECK-NEXT: mov r20, r22
334 ; CHECK-NEXT: mov r22, r24
335 ; CHECK-NEXT: mov r28, r22
336 ; CHECK-NEXT: mov r29, r23
337 ; CHECK-NEXT: mov r26, r20
338 ; CHECK-NEXT: mov r27, r21
340 ; CHECK-NEXT: mov r30, r28
341 ; CHECK-NEXT: add r30, r26
342 ; CHECK-NEXT: ;NO_APP
343 ; CHECK-NEXT: mov r24, r30
344 ; CHECK-NEXT: mov r25, r31
345 ; CHECK-NEXT: rcall foo8
346 ; CHECK-NEXT: pop r29
347 ; CHECK-NEXT: pop r28
349 %3 = tail call i8 asm sideeffect "mov $0, $1\0Aadd $0, $2", "=z,y,x"(i8 %0, i8 %1)
350 tail call void @foo8(i8 signext %3, i8 signext %0, i8 signext %1)
354 define void @add_xyz_i16(i16 signext %0, i16 signext %1) {
355 ; CHECK-LABEL: add_xyz_i16:
357 ; CHECK-NEXT: push r28
358 ; CHECK-NEXT: push r29
359 ; CHECK-NEXT: mov r20, r22
360 ; CHECK-NEXT: mov r21, r23
361 ; CHECK-NEXT: mov r22, r24
362 ; CHECK-NEXT: mov r23, r25
363 ; CHECK-NEXT: mov r28, r22
364 ; CHECK-NEXT: mov r29, r23
365 ; CHECK-NEXT: mov r26, r20
366 ; CHECK-NEXT: mov r27, r21
368 ; CHECK-NEXT: mov r30, r28
369 ; CHECK-NEXT: mov r31, r29
370 ; CHECK-NEXT: add r30, r26
371 ; CHECK-NEXT: adc r31, r27
372 ; CHECK-NEXT: ;NO_APP
373 ; CHECK-NEXT: mov r24, r30
374 ; CHECK-NEXT: mov r25, r31
375 ; CHECK-NEXT: rcall foo16
376 ; CHECK-NEXT: pop r29
377 ; CHECK-NEXT: pop r28
379 %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)
380 tail call void @foo16(i16 signext %3, i16 signext %0, i16 signext %1)
386 define i16* @ldi_dreg_symbol() {
387 ; CHECK-LABEL: ldi_dreg_symbol:
390 ; CHECK-NEXT: ldi r25, hi8(gvar)
391 ; CHECK-NEXT: ldi r24, lo8(gvar)
392 ; CHECK-NEXT: ;NO_APP
394 %1 = tail call i16* asm sideeffect "ldi ${0:B}, hi8($1)\0A\09ldi ${0:A}, lo8($1)", "=d,i"(i16* @gvar)
398 define i16* @ldi_dreg_imm() {
399 ; CHECK-LABEL: ldi_dreg_imm:
402 ; CHECK-NEXT: ldi r25, hi8(2345)
403 ; CHECK-NEXT: ldi r24, lo8(2345)
404 ; CHECK-NEXT: ;NO_APP
406 %1 = tail call i16* asm sideeffect "ldi ${0:B}, hi8($1)\0A\09ldi ${0:A}, lo8($1)", "=d,i"(i16 2345)