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), %eax
252 ; X86-NEXT: leal (%eax,%eax), %ecx
253 ; X86-NEXT: shll $4, %eax
254 ; X86-NEXT: subl %ecx, %eax
255 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
258 ; X64-LABEL: test_mul_by_14:
260 ; X64-NEXT: movl %edi, %eax
261 ; X64-NEXT: leal (%rax,%rax), %ecx
262 ; X64-NEXT: shll $4, %eax
263 ; X64-NEXT: subl %ecx, %eax
264 ; X64-NEXT: # kill: def $ax killed $ax killed $rax
266 %mul = mul nsw i16 %x, 14
270 define i16 @test_mul_by_15(i16 %x) {
271 ; X86-LABEL: test_mul_by_15:
273 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
274 ; X86-NEXT: leal (%eax,%eax,4), %eax
275 ; X86-NEXT: leal (%eax,%eax,2), %eax
276 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
279 ; X64-LABEL: test_mul_by_15:
281 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
282 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
283 ; X64-NEXT: leal (%rax,%rax,2), %eax
284 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
286 %mul = mul nsw i16 %x, 15
290 define i16 @test_mul_by_16(i16 %x) {
291 ; X86-LABEL: test_mul_by_16:
293 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
294 ; X86-NEXT: shll $4, %eax
295 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
298 ; X64-LABEL: test_mul_by_16:
300 ; X64-NEXT: movl %edi, %eax
301 ; X64-NEXT: shll $4, %eax
302 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
304 %mul = mul nsw i16 %x, 16
308 define i16 @test_mul_by_17(i16 %x) {
309 ; X86-LABEL: test_mul_by_17:
311 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
312 ; X86-NEXT: movl %ecx, %eax
313 ; X86-NEXT: shll $4, %eax
314 ; X86-NEXT: addl %ecx, %eax
315 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
318 ; X64-LABEL: test_mul_by_17:
320 ; X64-NEXT: movl %edi, %eax
321 ; X64-NEXT: shll $4, %eax
322 ; X64-NEXT: addl %edi, %eax
323 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
325 %mul = mul nsw i16 %x, 17
329 define i16 @test_mul_by_18(i16 %x) {
330 ; X86-LABEL: test_mul_by_18:
332 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
333 ; X86-NEXT: addl %eax, %eax
334 ; X86-NEXT: leal (%eax,%eax,8), %eax
335 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
338 ; X64-LABEL: test_mul_by_18:
340 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
341 ; X64-NEXT: addl %edi, %edi
342 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
343 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
345 %mul = mul nsw i16 %x, 18
349 define i16 @test_mul_by_19(i16 %x) {
350 ; X86-LABEL: test_mul_by_19:
352 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
353 ; X86-NEXT: leal (%eax,%eax,8), %ecx
354 ; X86-NEXT: leal (%eax,%ecx,2), %eax
355 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
358 ; X64-LABEL: test_mul_by_19:
360 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
361 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
362 ; X64-NEXT: leal (%rdi,%rax,2), %eax
363 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
365 %mul = mul nsw i16 %x, 19
369 define i16 @test_mul_by_20(i16 %x) {
370 ; X86-LABEL: test_mul_by_20:
372 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
373 ; X86-NEXT: shll $2, %eax
374 ; X86-NEXT: leal (%eax,%eax,4), %eax
375 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
378 ; X64-LABEL: test_mul_by_20:
380 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
381 ; X64-NEXT: shll $2, %edi
382 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
383 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
385 %mul = mul nsw i16 %x, 20
389 define i16 @test_mul_by_21(i16 %x) {
390 ; X86-LABEL: test_mul_by_21:
392 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
393 ; X86-NEXT: leal (%eax,%eax,4), %ecx
394 ; X86-NEXT: leal (%eax,%ecx,4), %eax
395 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
398 ; X64-LABEL: test_mul_by_21:
400 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
401 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
402 ; X64-NEXT: leal (%rdi,%rax,4), %eax
403 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
405 %mul = mul nsw i16 %x, 21
409 define i16 @test_mul_by_22(i16 %x) {
410 ; X86-LABEL: test_mul_by_22:
412 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
413 ; X86-NEXT: leal (%ecx,%ecx,4), %eax
414 ; X86-NEXT: leal (%ecx,%eax,4), %eax
415 ; X86-NEXT: addl %ecx, %eax
416 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
419 ; X64-LABEL: test_mul_by_22:
421 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
422 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
423 ; X64-NEXT: leal (%rdi,%rax,4), %eax
424 ; X64-NEXT: addl %edi, %eax
425 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
427 %mul = mul nsw i16 %x, 22
431 define i16 @test_mul_by_23(i16 %x) {
432 ; X86-LABEL: test_mul_by_23:
434 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
435 ; X86-NEXT: leal (%ecx,%ecx,2), %eax
436 ; X86-NEXT: shll $3, %eax
437 ; X86-NEXT: subl %ecx, %eax
438 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
441 ; X64-LABEL: test_mul_by_23:
443 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
444 ; X64-NEXT: leal (%rdi,%rdi,2), %eax
445 ; X64-NEXT: shll $3, %eax
446 ; X64-NEXT: subl %edi, %eax
447 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
449 %mul = mul nsw i16 %x, 23
453 define i16 @test_mul_by_24(i16 %x) {
454 ; X86-LABEL: test_mul_by_24:
456 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
457 ; X86-NEXT: shll $3, %eax
458 ; X86-NEXT: leal (%eax,%eax,2), %eax
459 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
462 ; X64-LABEL: test_mul_by_24:
464 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
465 ; X64-NEXT: shll $3, %edi
466 ; X64-NEXT: leal (%rdi,%rdi,2), %eax
467 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
469 %mul = mul nsw i16 %x, 24
473 define i16 @test_mul_by_25(i16 %x) {
474 ; X86-LABEL: test_mul_by_25:
476 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
477 ; X86-NEXT: leal (%eax,%eax,4), %eax
478 ; X86-NEXT: leal (%eax,%eax,4), %eax
479 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
482 ; X64-LABEL: test_mul_by_25:
484 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
485 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
486 ; X64-NEXT: leal (%rax,%rax,4), %eax
487 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
489 %mul = mul nsw i16 %x, 25
493 define i16 @test_mul_by_26(i16 %x) {
494 ; X86-LABEL: test_mul_by_26:
496 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
497 ; X86-NEXT: leal (%ecx,%ecx,4), %eax
498 ; X86-NEXT: leal (%eax,%eax,4), %eax
499 ; X86-NEXT: addl %ecx, %eax
500 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
503 ; X64-LABEL: test_mul_by_26:
505 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
506 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
507 ; X64-NEXT: leal (%rax,%rax,4), %eax
508 ; X64-NEXT: addl %edi, %eax
509 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
511 %mul = mul nsw i16 %x, 26
515 define i16 @test_mul_by_27(i16 %x) {
516 ; X86-LABEL: test_mul_by_27:
518 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
519 ; X86-NEXT: leal (%eax,%eax,8), %eax
520 ; X86-NEXT: leal (%eax,%eax,2), %eax
521 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
524 ; X64-LABEL: test_mul_by_27:
526 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
527 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
528 ; X64-NEXT: leal (%rax,%rax,2), %eax
529 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
531 %mul = mul nsw i16 %x, 27
535 define i16 @test_mul_by_28(i16 %x) {
536 ; X86-LABEL: test_mul_by_28:
538 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
539 ; X86-NEXT: leal (%ecx,%ecx,8), %eax
540 ; X86-NEXT: leal (%eax,%eax,2), %eax
541 ; X86-NEXT: addl %ecx, %eax
542 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
545 ; X64-LABEL: test_mul_by_28:
547 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
548 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
549 ; X64-NEXT: leal (%rax,%rax,2), %eax
550 ; X64-NEXT: addl %edi, %eax
551 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
553 %mul = mul nsw i16 %x, 28
557 define i16 @test_mul_by_29(i16 %x) {
558 ; X86-LABEL: test_mul_by_29:
560 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
561 ; X86-NEXT: leal (%eax,%eax,8), %ecx
562 ; X86-NEXT: leal (%ecx,%ecx,2), %ecx
563 ; X86-NEXT: addl %eax, %eax
564 ; X86-NEXT: addl %ecx, %eax
565 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
568 ; X64-LABEL: test_mul_by_29:
570 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
571 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
572 ; X64-NEXT: leal (%rax,%rax,2), %eax
573 ; X64-NEXT: addl %edi, %eax
574 ; X64-NEXT: addl %edi, %eax
575 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
577 %mul = mul nsw i16 %x, 29
581 define i16 @test_mul_by_30(i16 %x) {
582 ; X86-LABEL: test_mul_by_30:
584 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
585 ; X86-NEXT: leal (%eax,%eax), %ecx
586 ; X86-NEXT: shll $5, %eax
587 ; X86-NEXT: subl %ecx, %eax
588 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
591 ; X64-LABEL: test_mul_by_30:
593 ; X64-NEXT: movl %edi, %eax
594 ; X64-NEXT: leal (%rax,%rax), %ecx
595 ; X64-NEXT: shll $5, %eax
596 ; X64-NEXT: subl %ecx, %eax
597 ; X64-NEXT: # kill: def $ax killed $ax killed $rax
599 %mul = mul nsw i16 %x, 30
603 define i16 @test_mul_by_31(i16 %x) {
604 ; X86-LABEL: test_mul_by_31:
606 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
607 ; X86-NEXT: movl %ecx, %eax
608 ; X86-NEXT: shll $5, %eax
609 ; X86-NEXT: subl %ecx, %eax
610 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
613 ; X64-LABEL: test_mul_by_31:
615 ; X64-NEXT: movl %edi, %eax
616 ; X64-NEXT: shll $5, %eax
617 ; X64-NEXT: subl %edi, %eax
618 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
620 %mul = mul nsw i16 %x, 31
624 define i16 @test_mul_by_32(i16 %x) {
625 ; X86-LABEL: test_mul_by_32:
627 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
628 ; X86-NEXT: shll $5, %eax
629 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
632 ; X64-LABEL: test_mul_by_32:
634 ; X64-NEXT: movl %edi, %eax
635 ; X64-NEXT: shll $5, %eax
636 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
638 %mul = mul nsw i16 %x, 32
642 define i16 @test_mul_by_37(i16 %x) {
643 ; X86-LABEL: test_mul_by_37:
645 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
646 ; X86-NEXT: leal (%eax,%eax,8), %ecx
647 ; X86-NEXT: leal (%eax,%ecx,4), %eax
648 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
651 ; X64-LABEL: test_mul_by_37:
653 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
654 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
655 ; X64-NEXT: leal (%rdi,%rax,4), %eax
656 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
658 %mul = mul nsw i16 %x, 37
662 define i16 @test_mul_by_41(i16 %x) {
663 ; X86-LABEL: test_mul_by_41:
665 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
666 ; X86-NEXT: leal (%eax,%eax,4), %ecx
667 ; X86-NEXT: leal (%eax,%ecx,8), %eax
668 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
671 ; X64-LABEL: test_mul_by_41:
673 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
674 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
675 ; X64-NEXT: leal (%rdi,%rax,8), %eax
676 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
678 %mul = mul nsw i16 %x, 41
682 define i16 @test_mul_by_62(i16 %x) {
683 ; X86-LABEL: test_mul_by_62:
685 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
686 ; X86-NEXT: leal (%eax,%eax), %ecx
687 ; X86-NEXT: shll $6, %eax
688 ; X86-NEXT: subl %ecx, %eax
689 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
692 ; X64-LABEL: test_mul_by_62:
694 ; X64-NEXT: movl %edi, %eax
695 ; X64-NEXT: leal (%rax,%rax), %ecx
696 ; X64-NEXT: shll $6, %eax
697 ; X64-NEXT: subl %ecx, %eax
698 ; X64-NEXT: # kill: def $ax killed $ax killed $rax
700 %mul = mul nsw i16 %x, 62
704 define i16 @test_mul_by_66(i16 %x) {
705 ; X86-LABEL: test_mul_by_66:
707 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
708 ; X86-NEXT: movl %eax, %ecx
709 ; X86-NEXT: shll $6, %ecx
710 ; X86-NEXT: leal (%ecx,%eax,2), %eax
711 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
714 ; X64-LABEL: test_mul_by_66:
716 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
717 ; X64-NEXT: movl %edi, %eax
718 ; X64-NEXT: shll $6, %eax
719 ; X64-NEXT: leal (%rax,%rdi,2), %eax
720 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
722 %mul = mul nsw i16 %x, 66
726 define i16 @test_mul_by_73(i16 %x) {
727 ; X86-LABEL: test_mul_by_73:
729 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
730 ; X86-NEXT: leal (%eax,%eax,8), %ecx
731 ; X86-NEXT: leal (%eax,%ecx,8), %eax
732 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
735 ; X64-LABEL: test_mul_by_73:
737 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
738 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
739 ; X64-NEXT: leal (%rdi,%rax,8), %eax
740 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
742 %mul = mul nsw i16 %x, 73
746 define i16 @test_mul_by_520(i16 %x) {
747 ; X86-LABEL: test_mul_by_520:
749 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
750 ; X86-NEXT: movl %eax, %ecx
751 ; X86-NEXT: shll $9, %ecx
752 ; X86-NEXT: leal (%ecx,%eax,8), %eax
753 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
756 ; X64-LABEL: test_mul_by_520:
758 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
759 ; X64-NEXT: movl %edi, %eax
760 ; X64-NEXT: shll $9, %eax
761 ; X64-NEXT: leal (%rax,%rdi,8), %eax
762 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
764 %mul = mul nsw i16 %x, 520
768 define i16 @test_mul_by_neg10(i16 %x) {
769 ; X86-LABEL: test_mul_by_neg10:
771 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
772 ; X86-NEXT: addl %eax, %eax
773 ; X86-NEXT: leal (%eax,%eax,4), %eax
774 ; X86-NEXT: negl %eax
775 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
778 ; X64-LABEL: test_mul_by_neg10:
780 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
781 ; X64-NEXT: addl %edi, %edi
782 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
783 ; X64-NEXT: negl %eax
784 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
786 %mul = mul nsw i16 %x, -10
790 define i16 @test_mul_by_neg36(i16 %x) {
791 ; X86-LABEL: test_mul_by_neg36:
793 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
794 ; X86-NEXT: shll $2, %eax
795 ; X86-NEXT: leal (%eax,%eax,8), %eax
796 ; X86-NEXT: negl %eax
797 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
800 ; X64-LABEL: test_mul_by_neg36:
802 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
803 ; X64-NEXT: shll $2, %edi
804 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
805 ; X64-NEXT: negl %eax
806 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
808 %mul = mul nsw i16 %x, -36
813 define i16 @test_mul_spec(i16 %x) nounwind {
814 ; X86-LABEL: test_mul_spec:
816 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
817 ; X86-NEXT: leal 42(%eax,%eax,8), %ecx
818 ; X86-NEXT: leal 2(%eax,%eax,4), %eax
819 ; X86-NEXT: imull %ecx, %eax
820 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
823 ; X64-LABEL: test_mul_spec:
825 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
826 ; X64-NEXT: leal 42(%rdi,%rdi,8), %ecx
827 ; X64-NEXT: leal 2(%rdi,%rdi,4), %eax
828 ; X64-NEXT: imull %ecx, %eax
829 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
831 %mul = mul nsw i16 %x, 9
832 %add = add nsw i16 %mul, 42
833 %mul2 = mul nsw i16 %x, 5
834 %add2 = add nsw i16 %mul2, 2
835 %mul3 = mul nsw i16 %add, %add2