1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s --check-prefix=X64
5 define i16 @test_mul_by_1(i16 %x) {
6 ; X86-LABEL: test_mul_by_1:
8 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
11 ; X64-LABEL: test_mul_by_1:
13 ; X64-NEXT: movl %edi, %eax
14 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
16 %mul = mul nsw i16 %x, 1
20 define i16 @test_mul_by_2(i16 %x) {
21 ; X86-LABEL: test_mul_by_2:
23 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
24 ; X86-NEXT: addl %eax, %eax
25 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
28 ; X64-LABEL: test_mul_by_2:
30 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
31 ; X64-NEXT: leal (%rdi,%rdi), %eax
32 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
34 %mul = mul nsw i16 %x, 2
38 define i16 @test_mul_by_3(i16 %x) {
39 ; X86-LABEL: test_mul_by_3:
41 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
42 ; X86-NEXT: leal (%eax,%eax,2), %eax
43 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
46 ; X64-LABEL: test_mul_by_3:
48 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
49 ; X64-NEXT: leal (%rdi,%rdi,2), %eax
50 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
52 %mul = mul nsw i16 %x, 3
56 define i16 @test_mul_by_4(i16 %x) {
57 ; X86-LABEL: test_mul_by_4:
59 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
60 ; X86-NEXT: shll $2, %eax
61 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
64 ; X64-LABEL: test_mul_by_4:
66 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
67 ; X64-NEXT: leal (,%rdi,4), %eax
68 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
70 %mul = mul nsw i16 %x, 4
74 define i16 @test_mul_by_5(i16 %x) {
75 ; X86-LABEL: test_mul_by_5:
77 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
78 ; X86-NEXT: leal (%eax,%eax,4), %eax
79 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
82 ; X64-LABEL: test_mul_by_5:
84 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
85 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
86 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
88 %mul = mul nsw i16 %x, 5
92 define i16 @test_mul_by_6(i16 %x) {
93 ; X86-LABEL: test_mul_by_6:
95 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
96 ; X86-NEXT: addl %eax, %eax
97 ; X86-NEXT: leal (%eax,%eax,2), %eax
98 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
101 ; X64-LABEL: test_mul_by_6:
103 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
104 ; X64-NEXT: addl %edi, %edi
105 ; X64-NEXT: leal (%rdi,%rdi,2), %eax
106 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
108 %mul = mul nsw i16 %x, 6
112 define i16 @test_mul_by_7(i16 %x) {
113 ; X86-LABEL: test_mul_by_7:
115 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
116 ; X86-NEXT: leal (,%ecx,8), %eax
117 ; X86-NEXT: subl %ecx, %eax
118 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
121 ; X64-LABEL: test_mul_by_7:
123 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
124 ; X64-NEXT: leal (,%rdi,8), %eax
125 ; X64-NEXT: subl %edi, %eax
126 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
128 %mul = mul nsw i16 %x, 7
132 define i16 @test_mul_by_8(i16 %x) {
133 ; X86-LABEL: test_mul_by_8:
135 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
136 ; X86-NEXT: shll $3, %eax
137 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
140 ; X64-LABEL: test_mul_by_8:
142 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
143 ; X64-NEXT: leal (,%rdi,8), %eax
144 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
146 %mul = mul nsw i16 %x, 8
150 define i16 @test_mul_by_9(i16 %x) {
151 ; X86-LABEL: test_mul_by_9:
153 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
154 ; X86-NEXT: leal (%eax,%eax,8), %eax
155 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
158 ; X64-LABEL: test_mul_by_9:
160 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
161 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
162 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
164 %mul = mul nsw i16 %x, 9
168 define i16 @test_mul_by_10(i16 %x) {
169 ; X86-LABEL: test_mul_by_10:
171 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
172 ; X86-NEXT: addl %eax, %eax
173 ; X86-NEXT: leal (%eax,%eax,4), %eax
174 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
177 ; X64-LABEL: test_mul_by_10:
179 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
180 ; X64-NEXT: addl %edi, %edi
181 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
182 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
184 %mul = mul nsw i16 %x, 10
188 define i16 @test_mul_by_11(i16 %x) {
189 ; X86-LABEL: test_mul_by_11:
191 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
192 ; X86-NEXT: leal (%eax,%eax,4), %ecx
193 ; X86-NEXT: leal (%eax,%ecx,2), %eax
194 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
197 ; X64-LABEL: test_mul_by_11:
199 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
200 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
201 ; X64-NEXT: leal (%rdi,%rax,2), %eax
202 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
204 %mul = mul nsw i16 %x, 11
208 define i16 @test_mul_by_12(i16 %x) {
209 ; X86-LABEL: test_mul_by_12:
211 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
212 ; X86-NEXT: shll $2, %eax
213 ; X86-NEXT: leal (%eax,%eax,2), %eax
214 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
217 ; X64-LABEL: test_mul_by_12:
219 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
220 ; X64-NEXT: shll $2, %edi
221 ; X64-NEXT: leal (%rdi,%rdi,2), %eax
222 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
224 %mul = mul nsw i16 %x, 12
228 define i16 @test_mul_by_13(i16 %x) {
229 ; X86-LABEL: test_mul_by_13:
231 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
232 ; X86-NEXT: leal (%eax,%eax,2), %ecx
233 ; X86-NEXT: leal (%eax,%ecx,4), %eax
234 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
237 ; X64-LABEL: test_mul_by_13:
239 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
240 ; X64-NEXT: leal (%rdi,%rdi,2), %eax
241 ; X64-NEXT: leal (%rdi,%rax,4), %eax
242 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
244 %mul = mul nsw i16 %x, 13
248 define i16 @test_mul_by_14(i16 %x) {
249 ; X86-LABEL: test_mul_by_14:
251 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
252 ; X86-NEXT: movl %ecx, %eax
253 ; X86-NEXT: shll $4, %eax
254 ; X86-NEXT: subl %ecx, %eax
255 ; X86-NEXT: subl %ecx, %eax
256 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
259 ; X64-LABEL: test_mul_by_14:
261 ; X64-NEXT: movl %edi, %eax
262 ; X64-NEXT: shll $4, %eax
263 ; X64-NEXT: subl %edi, %eax
264 ; X64-NEXT: subl %edi, %eax
265 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
267 %mul = mul nsw i16 %x, 14
271 define i16 @test_mul_by_15(i16 %x) {
272 ; X86-LABEL: test_mul_by_15:
274 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
275 ; X86-NEXT: leal (%eax,%eax,4), %eax
276 ; X86-NEXT: leal (%eax,%eax,2), %eax
277 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
280 ; X64-LABEL: test_mul_by_15:
282 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
283 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
284 ; X64-NEXT: leal (%rax,%rax,2), %eax
285 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
287 %mul = mul nsw i16 %x, 15
291 define i16 @test_mul_by_16(i16 %x) {
292 ; X86-LABEL: test_mul_by_16:
294 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
295 ; X86-NEXT: shll $4, %eax
296 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
299 ; X64-LABEL: test_mul_by_16:
301 ; X64-NEXT: movl %edi, %eax
302 ; X64-NEXT: shll $4, %eax
303 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
305 %mul = mul nsw i16 %x, 16
309 define i16 @test_mul_by_17(i16 %x) {
310 ; X86-LABEL: test_mul_by_17:
312 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
313 ; X86-NEXT: movl %ecx, %eax
314 ; X86-NEXT: shll $4, %eax
315 ; X86-NEXT: addl %ecx, %eax
316 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
319 ; X64-LABEL: test_mul_by_17:
321 ; X64-NEXT: movl %edi, %eax
322 ; X64-NEXT: shll $4, %eax
323 ; X64-NEXT: addl %edi, %eax
324 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
326 %mul = mul nsw i16 %x, 17
330 define i16 @test_mul_by_18(i16 %x) {
331 ; X86-LABEL: test_mul_by_18:
333 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
334 ; X86-NEXT: addl %eax, %eax
335 ; X86-NEXT: leal (%eax,%eax,8), %eax
336 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
339 ; X64-LABEL: test_mul_by_18:
341 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
342 ; X64-NEXT: addl %edi, %edi
343 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
344 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
346 %mul = mul nsw i16 %x, 18
350 define i16 @test_mul_by_19(i16 %x) {
351 ; X86-LABEL: test_mul_by_19:
353 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
354 ; X86-NEXT: leal (%eax,%eax,8), %ecx
355 ; X86-NEXT: leal (%eax,%ecx,2), %eax
356 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
359 ; X64-LABEL: test_mul_by_19:
361 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
362 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
363 ; X64-NEXT: leal (%rdi,%rax,2), %eax
364 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
366 %mul = mul nsw i16 %x, 19
370 define i16 @test_mul_by_20(i16 %x) {
371 ; X86-LABEL: test_mul_by_20:
373 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
374 ; X86-NEXT: shll $2, %eax
375 ; X86-NEXT: leal (%eax,%eax,4), %eax
376 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
379 ; X64-LABEL: test_mul_by_20:
381 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
382 ; X64-NEXT: shll $2, %edi
383 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
384 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
386 %mul = mul nsw i16 %x, 20
390 define i16 @test_mul_by_21(i16 %x) {
391 ; X86-LABEL: test_mul_by_21:
393 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
394 ; X86-NEXT: leal (%eax,%eax,4), %ecx
395 ; X86-NEXT: leal (%eax,%ecx,4), %eax
396 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
399 ; X64-LABEL: test_mul_by_21:
401 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
402 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
403 ; X64-NEXT: leal (%rdi,%rax,4), %eax
404 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
406 %mul = mul nsw i16 %x, 21
410 define i16 @test_mul_by_22(i16 %x) {
411 ; X86-LABEL: test_mul_by_22:
413 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
414 ; X86-NEXT: leal (%ecx,%ecx,4), %eax
415 ; X86-NEXT: leal (%ecx,%eax,4), %eax
416 ; X86-NEXT: addl %ecx, %eax
417 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
420 ; X64-LABEL: test_mul_by_22:
422 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
423 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
424 ; X64-NEXT: leal (%rdi,%rax,4), %eax
425 ; X64-NEXT: addl %edi, %eax
426 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
428 %mul = mul nsw i16 %x, 22
432 define i16 @test_mul_by_23(i16 %x) {
433 ; X86-LABEL: test_mul_by_23:
435 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
436 ; X86-NEXT: leal (%ecx,%ecx,2), %eax
437 ; X86-NEXT: shll $3, %eax
438 ; X86-NEXT: subl %ecx, %eax
439 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
442 ; X64-LABEL: test_mul_by_23:
444 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
445 ; X64-NEXT: leal (%rdi,%rdi,2), %eax
446 ; X64-NEXT: shll $3, %eax
447 ; X64-NEXT: subl %edi, %eax
448 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
450 %mul = mul nsw i16 %x, 23
454 define i16 @test_mul_by_24(i16 %x) {
455 ; X86-LABEL: test_mul_by_24:
457 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
458 ; X86-NEXT: shll $3, %eax
459 ; X86-NEXT: leal (%eax,%eax,2), %eax
460 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
463 ; X64-LABEL: test_mul_by_24:
465 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
466 ; X64-NEXT: shll $3, %edi
467 ; X64-NEXT: leal (%rdi,%rdi,2), %eax
468 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
470 %mul = mul nsw i16 %x, 24
474 define i16 @test_mul_by_25(i16 %x) {
475 ; X86-LABEL: test_mul_by_25:
477 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
478 ; X86-NEXT: leal (%eax,%eax,4), %eax
479 ; X86-NEXT: leal (%eax,%eax,4), %eax
480 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
483 ; X64-LABEL: test_mul_by_25:
485 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
486 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
487 ; X64-NEXT: leal (%rax,%rax,4), %eax
488 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
490 %mul = mul nsw i16 %x, 25
494 define i16 @test_mul_by_26(i16 %x) {
495 ; X86-LABEL: test_mul_by_26:
497 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
498 ; X86-NEXT: leal (%ecx,%ecx,4), %eax
499 ; X86-NEXT: leal (%eax,%eax,4), %eax
500 ; X86-NEXT: addl %ecx, %eax
501 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
504 ; X64-LABEL: test_mul_by_26:
506 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
507 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
508 ; X64-NEXT: leal (%rax,%rax,4), %eax
509 ; X64-NEXT: addl %edi, %eax
510 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
512 %mul = mul nsw i16 %x, 26
516 define i16 @test_mul_by_27(i16 %x) {
517 ; X86-LABEL: test_mul_by_27:
519 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
520 ; X86-NEXT: leal (%eax,%eax,8), %eax
521 ; X86-NEXT: leal (%eax,%eax,2), %eax
522 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
525 ; X64-LABEL: test_mul_by_27:
527 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
528 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
529 ; X64-NEXT: leal (%rax,%rax,2), %eax
530 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
532 %mul = mul nsw i16 %x, 27
536 define i16 @test_mul_by_28(i16 %x) {
537 ; X86-LABEL: test_mul_by_28:
539 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
540 ; X86-NEXT: leal (%ecx,%ecx,8), %eax
541 ; X86-NEXT: leal (%eax,%eax,2), %eax
542 ; X86-NEXT: addl %ecx, %eax
543 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
546 ; X64-LABEL: test_mul_by_28:
548 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
549 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
550 ; X64-NEXT: leal (%rax,%rax,2), %eax
551 ; X64-NEXT: addl %edi, %eax
552 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
554 %mul = mul nsw i16 %x, 28
558 define i16 @test_mul_by_29(i16 %x) {
559 ; X86-LABEL: test_mul_by_29:
561 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
562 ; X86-NEXT: leal (%ecx,%ecx,8), %eax
563 ; X86-NEXT: leal (%eax,%eax,2), %eax
564 ; X86-NEXT: addl %ecx, %eax
565 ; X86-NEXT: addl %ecx, %eax
566 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
569 ; X64-LABEL: test_mul_by_29:
571 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
572 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
573 ; X64-NEXT: leal (%rax,%rax,2), %eax
574 ; X64-NEXT: addl %edi, %eax
575 ; X64-NEXT: addl %edi, %eax
576 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
578 %mul = mul nsw i16 %x, 29
582 define i16 @test_mul_by_30(i16 %x) {
583 ; X86-LABEL: test_mul_by_30:
585 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
586 ; X86-NEXT: movl %ecx, %eax
587 ; X86-NEXT: shll $5, %eax
588 ; X86-NEXT: subl %ecx, %eax
589 ; X86-NEXT: subl %ecx, %eax
590 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
593 ; X64-LABEL: test_mul_by_30:
595 ; X64-NEXT: movl %edi, %eax
596 ; X64-NEXT: shll $5, %eax
597 ; X64-NEXT: subl %edi, %eax
598 ; X64-NEXT: subl %edi, %eax
599 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
601 %mul = mul nsw i16 %x, 30
605 define i16 @test_mul_by_31(i16 %x) {
606 ; X86-LABEL: test_mul_by_31:
608 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
609 ; X86-NEXT: movl %ecx, %eax
610 ; X86-NEXT: shll $5, %eax
611 ; X86-NEXT: subl %ecx, %eax
612 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
615 ; X64-LABEL: test_mul_by_31:
617 ; X64-NEXT: movl %edi, %eax
618 ; X64-NEXT: shll $5, %eax
619 ; X64-NEXT: subl %edi, %eax
620 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
622 %mul = mul nsw i16 %x, 31
626 define i16 @test_mul_by_32(i16 %x) {
627 ; X86-LABEL: test_mul_by_32:
629 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
630 ; X86-NEXT: shll $5, %eax
631 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
634 ; X64-LABEL: test_mul_by_32:
636 ; X64-NEXT: movl %edi, %eax
637 ; X64-NEXT: shll $5, %eax
638 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
640 %mul = mul nsw i16 %x, 32
644 define i16 @test_mul_by_37(i16 %x) {
645 ; X86-LABEL: test_mul_by_37:
647 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
648 ; X86-NEXT: leal (%eax,%eax,8), %ecx
649 ; X86-NEXT: leal (%eax,%ecx,4), %eax
650 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
653 ; X64-LABEL: test_mul_by_37:
655 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
656 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
657 ; X64-NEXT: leal (%rdi,%rax,4), %eax
658 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
660 %mul = mul nsw i16 %x, 37
664 define i16 @test_mul_by_41(i16 %x) {
665 ; X86-LABEL: test_mul_by_41:
667 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
668 ; X86-NEXT: leal (%eax,%eax,4), %ecx
669 ; X86-NEXT: leal (%eax,%ecx,8), %eax
670 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
673 ; X64-LABEL: test_mul_by_41:
675 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
676 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
677 ; X64-NEXT: leal (%rdi,%rax,8), %eax
678 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
680 %mul = mul nsw i16 %x, 41
684 define i16 @test_mul_by_62(i16 %x) {
685 ; X86-LABEL: test_mul_by_62:
687 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
688 ; X86-NEXT: movl %ecx, %eax
689 ; X86-NEXT: shll $6, %eax
690 ; X86-NEXT: subl %ecx, %eax
691 ; X86-NEXT: subl %ecx, %eax
692 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
695 ; X64-LABEL: test_mul_by_62:
697 ; X64-NEXT: movl %edi, %eax
698 ; X64-NEXT: shll $6, %eax
699 ; X64-NEXT: subl %edi, %eax
700 ; X64-NEXT: subl %edi, %eax
701 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
703 %mul = mul nsw i16 %x, 62
707 define i16 @test_mul_by_66(i16 %x) {
708 ; X86-LABEL: test_mul_by_66:
710 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
711 ; X86-NEXT: movl %eax, %ecx
712 ; X86-NEXT: shll $6, %ecx
713 ; X86-NEXT: leal (%ecx,%eax,2), %eax
714 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
717 ; X64-LABEL: test_mul_by_66:
719 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
720 ; X64-NEXT: movl %edi, %eax
721 ; X64-NEXT: shll $6, %eax
722 ; X64-NEXT: leal (%rax,%rdi,2), %eax
723 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
725 %mul = mul nsw i16 %x, 66
729 define i16 @test_mul_by_73(i16 %x) {
730 ; X86-LABEL: test_mul_by_73:
732 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
733 ; X86-NEXT: leal (%eax,%eax,8), %ecx
734 ; X86-NEXT: leal (%eax,%ecx,8), %eax
735 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
738 ; X64-LABEL: test_mul_by_73:
740 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
741 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
742 ; X64-NEXT: leal (%rdi,%rax,8), %eax
743 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
745 %mul = mul nsw i16 %x, 73
749 define i16 @test_mul_by_520(i16 %x) {
750 ; X86-LABEL: test_mul_by_520:
752 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
753 ; X86-NEXT: movl %eax, %ecx
754 ; X86-NEXT: shll $9, %ecx
755 ; X86-NEXT: leal (%ecx,%eax,8), %eax
756 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
759 ; X64-LABEL: test_mul_by_520:
761 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
762 ; X64-NEXT: movl %edi, %eax
763 ; X64-NEXT: shll $9, %eax
764 ; X64-NEXT: leal (%rax,%rdi,8), %eax
765 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
767 %mul = mul nsw i16 %x, 520
771 define i16 @test_mul_by_neg10(i16 %x) {
772 ; X86-LABEL: test_mul_by_neg10:
774 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
775 ; X86-NEXT: addl %eax, %eax
776 ; X86-NEXT: leal (%eax,%eax,4), %eax
777 ; X86-NEXT: negl %eax
778 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
781 ; X64-LABEL: test_mul_by_neg10:
783 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
784 ; X64-NEXT: addl %edi, %edi
785 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
786 ; X64-NEXT: negl %eax
787 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
789 %mul = mul nsw i16 %x, -10
793 define i16 @test_mul_by_neg36(i16 %x) {
794 ; X86-LABEL: test_mul_by_neg36:
796 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
797 ; X86-NEXT: shll $2, %eax
798 ; X86-NEXT: leal (%eax,%eax,8), %eax
799 ; X86-NEXT: negl %eax
800 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
803 ; X64-LABEL: test_mul_by_neg36:
805 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
806 ; X64-NEXT: shll $2, %edi
807 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
808 ; X64-NEXT: negl %eax
809 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
811 %mul = mul nsw i16 %x, -36
816 define i16 @test_mul_spec(i16 %x) nounwind {
817 ; X86-LABEL: test_mul_spec:
819 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
820 ; X86-NEXT: leal 42(%eax,%eax,8), %ecx
821 ; X86-NEXT: leal 2(%eax,%eax,4), %eax
822 ; X86-NEXT: imull %ecx, %eax
823 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
826 ; X64-LABEL: test_mul_spec:
828 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
829 ; X64-NEXT: leal 42(%rdi,%rdi,8), %ecx
830 ; X64-NEXT: leal 2(%rdi,%rdi,4), %eax
831 ; X64-NEXT: imull %ecx, %eax
832 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
834 %mul = mul nsw i16 %x, 9
835 %add = add nsw i16 %mul, 42
836 %mul2 = mul nsw i16 %x, 5
837 %add2 = add nsw i16 %mul2, 2
838 %mul3 = mul nsw i16 %add, %add2