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: # kill: def $edi killed $edi def $rdi
322 ; X64-NEXT: movl %edi, %eax
323 ; X64-NEXT: shll $4, %eax
324 ; X64-NEXT: addl %edi, %eax
325 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
327 %mul = mul nsw i16 %x, 17
331 define i16 @test_mul_by_18(i16 %x) {
332 ; X86-LABEL: test_mul_by_18:
334 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
335 ; X86-NEXT: addl %eax, %eax
336 ; X86-NEXT: leal (%eax,%eax,8), %eax
337 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
340 ; X64-LABEL: test_mul_by_18:
342 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
343 ; X64-NEXT: addl %edi, %edi
344 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
345 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
347 %mul = mul nsw i16 %x, 18
351 define i16 @test_mul_by_19(i16 %x) {
352 ; X86-LABEL: test_mul_by_19:
354 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
355 ; X86-NEXT: leal (%eax,%eax,8), %ecx
356 ; X86-NEXT: leal (%eax,%ecx,2), %eax
357 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
360 ; X64-LABEL: test_mul_by_19:
362 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
363 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
364 ; X64-NEXT: leal (%rdi,%rax,2), %eax
365 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
367 %mul = mul nsw i16 %x, 19
371 define i16 @test_mul_by_20(i16 %x) {
372 ; X86-LABEL: test_mul_by_20:
374 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
375 ; X86-NEXT: shll $2, %eax
376 ; X86-NEXT: leal (%eax,%eax,4), %eax
377 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
380 ; X64-LABEL: test_mul_by_20:
382 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
383 ; X64-NEXT: shll $2, %edi
384 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
385 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
387 %mul = mul nsw i16 %x, 20
391 define i16 @test_mul_by_21(i16 %x) {
392 ; X86-LABEL: test_mul_by_21:
394 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
395 ; X86-NEXT: leal (%eax,%eax,4), %ecx
396 ; X86-NEXT: leal (%eax,%ecx,4), %eax
397 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
400 ; X64-LABEL: test_mul_by_21:
402 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
403 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
404 ; X64-NEXT: leal (%rdi,%rax,4), %eax
405 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
407 %mul = mul nsw i16 %x, 21
411 define i16 @test_mul_by_22(i16 %x) {
412 ; X86-LABEL: test_mul_by_22:
414 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
415 ; X86-NEXT: leal (%ecx,%ecx,4), %eax
416 ; X86-NEXT: leal (%ecx,%eax,4), %eax
417 ; X86-NEXT: addl %ecx, %eax
418 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
421 ; X64-LABEL: test_mul_by_22:
423 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
424 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
425 ; X64-NEXT: leal (%rdi,%rax,4), %eax
426 ; X64-NEXT: addl %edi, %eax
427 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
429 %mul = mul nsw i16 %x, 22
433 define i16 @test_mul_by_23(i16 %x) {
434 ; X86-LABEL: test_mul_by_23:
436 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
437 ; X86-NEXT: leal (%ecx,%ecx,2), %eax
438 ; X86-NEXT: shll $3, %eax
439 ; X86-NEXT: subl %ecx, %eax
440 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
443 ; X64-LABEL: test_mul_by_23:
445 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
446 ; X64-NEXT: leal (%rdi,%rdi,2), %eax
447 ; X64-NEXT: shll $3, %eax
448 ; X64-NEXT: subl %edi, %eax
449 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
451 %mul = mul nsw i16 %x, 23
455 define i16 @test_mul_by_24(i16 %x) {
456 ; X86-LABEL: test_mul_by_24:
458 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
459 ; X86-NEXT: shll $3, %eax
460 ; X86-NEXT: leal (%eax,%eax,2), %eax
461 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
464 ; X64-LABEL: test_mul_by_24:
466 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
467 ; X64-NEXT: shll $3, %edi
468 ; X64-NEXT: leal (%rdi,%rdi,2), %eax
469 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
471 %mul = mul nsw i16 %x, 24
475 define i16 @test_mul_by_25(i16 %x) {
476 ; X86-LABEL: test_mul_by_25:
478 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
479 ; X86-NEXT: leal (%eax,%eax,4), %eax
480 ; X86-NEXT: leal (%eax,%eax,4), %eax
481 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
484 ; X64-LABEL: test_mul_by_25:
486 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
487 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
488 ; X64-NEXT: leal (%rax,%rax,4), %eax
489 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
491 %mul = mul nsw i16 %x, 25
495 define i16 @test_mul_by_26(i16 %x) {
496 ; X86-LABEL: test_mul_by_26:
498 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
499 ; X86-NEXT: leal (%ecx,%ecx,4), %eax
500 ; X86-NEXT: leal (%eax,%eax,4), %eax
501 ; X86-NEXT: addl %ecx, %eax
502 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
505 ; X64-LABEL: test_mul_by_26:
507 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
508 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
509 ; X64-NEXT: leal (%rax,%rax,4), %eax
510 ; X64-NEXT: addl %edi, %eax
511 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
513 %mul = mul nsw i16 %x, 26
517 define i16 @test_mul_by_27(i16 %x) {
518 ; X86-LABEL: test_mul_by_27:
520 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
521 ; X86-NEXT: leal (%eax,%eax,8), %eax
522 ; X86-NEXT: leal (%eax,%eax,2), %eax
523 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
526 ; X64-LABEL: test_mul_by_27:
528 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
529 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
530 ; X64-NEXT: leal (%rax,%rax,2), %eax
531 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
533 %mul = mul nsw i16 %x, 27
537 define i16 @test_mul_by_28(i16 %x) {
538 ; X86-LABEL: test_mul_by_28:
540 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
541 ; X86-NEXT: leal (%ecx,%ecx,8), %eax
542 ; X86-NEXT: leal (%eax,%eax,2), %eax
543 ; X86-NEXT: addl %ecx, %eax
544 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
547 ; X64-LABEL: test_mul_by_28:
549 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
550 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
551 ; X64-NEXT: leal (%rax,%rax,2), %eax
552 ; X64-NEXT: addl %edi, %eax
553 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
555 %mul = mul nsw i16 %x, 28
559 define i16 @test_mul_by_29(i16 %x) {
560 ; X86-LABEL: test_mul_by_29:
562 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
563 ; X86-NEXT: leal (%ecx,%ecx,8), %eax
564 ; X86-NEXT: leal (%eax,%eax,2), %eax
565 ; X86-NEXT: addl %ecx, %eax
566 ; X86-NEXT: addl %ecx, %eax
567 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
570 ; X64-LABEL: test_mul_by_29:
572 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
573 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
574 ; X64-NEXT: leal (%rax,%rax,2), %eax
575 ; X64-NEXT: addl %edi, %eax
576 ; X64-NEXT: addl %edi, %eax
577 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
579 %mul = mul nsw i16 %x, 29
583 define i16 @test_mul_by_30(i16 %x) {
584 ; X86-LABEL: test_mul_by_30:
586 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
587 ; X86-NEXT: movl %ecx, %eax
588 ; X86-NEXT: shll $5, %eax
589 ; X86-NEXT: subl %ecx, %eax
590 ; X86-NEXT: subl %ecx, %eax
591 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
594 ; X64-LABEL: test_mul_by_30:
596 ; X64-NEXT: movl %edi, %eax
597 ; X64-NEXT: shll $5, %eax
598 ; X64-NEXT: subl %edi, %eax
599 ; X64-NEXT: subl %edi, %eax
600 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
602 %mul = mul nsw i16 %x, 30
606 define i16 @test_mul_by_31(i16 %x) {
607 ; X86-LABEL: test_mul_by_31:
609 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
610 ; X86-NEXT: movl %ecx, %eax
611 ; X86-NEXT: shll $5, %eax
612 ; X86-NEXT: subl %ecx, %eax
613 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
616 ; X64-LABEL: test_mul_by_31:
618 ; X64-NEXT: movl %edi, %eax
619 ; X64-NEXT: shll $5, %eax
620 ; X64-NEXT: subl %edi, %eax
621 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
623 %mul = mul nsw i16 %x, 31
627 define i16 @test_mul_by_32(i16 %x) {
628 ; X86-LABEL: test_mul_by_32:
630 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
631 ; X86-NEXT: shll $5, %eax
632 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
635 ; X64-LABEL: test_mul_by_32:
637 ; X64-NEXT: movl %edi, %eax
638 ; X64-NEXT: shll $5, %eax
639 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
641 %mul = mul nsw i16 %x, 32
645 define i16 @test_mul_by_37(i16 %x) {
646 ; X86-LABEL: test_mul_by_37:
648 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
649 ; X86-NEXT: leal (%eax,%eax,8), %ecx
650 ; X86-NEXT: leal (%eax,%ecx,4), %eax
651 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
654 ; X64-LABEL: test_mul_by_37:
656 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
657 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
658 ; X64-NEXT: leal (%rdi,%rax,4), %eax
659 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
661 %mul = mul nsw i16 %x, 37
665 define i16 @test_mul_by_41(i16 %x) {
666 ; X86-LABEL: test_mul_by_41:
668 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
669 ; X86-NEXT: leal (%eax,%eax,4), %ecx
670 ; X86-NEXT: leal (%eax,%ecx,8), %eax
671 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
674 ; X64-LABEL: test_mul_by_41:
676 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
677 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
678 ; X64-NEXT: leal (%rdi,%rax,8), %eax
679 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
681 %mul = mul nsw i16 %x, 41
685 define i16 @test_mul_by_62(i16 %x) {
686 ; X86-LABEL: test_mul_by_62:
688 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
689 ; X86-NEXT: movl %ecx, %eax
690 ; X86-NEXT: shll $6, %eax
691 ; X86-NEXT: subl %ecx, %eax
692 ; X86-NEXT: subl %ecx, %eax
693 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
696 ; X64-LABEL: test_mul_by_62:
698 ; X64-NEXT: movl %edi, %eax
699 ; X64-NEXT: shll $6, %eax
700 ; X64-NEXT: subl %edi, %eax
701 ; X64-NEXT: subl %edi, %eax
702 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
704 %mul = mul nsw i16 %x, 62
708 define i16 @test_mul_by_66(i16 %x) {
709 ; X86-LABEL: test_mul_by_66:
711 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
712 ; X86-NEXT: movl %eax, %ecx
713 ; X86-NEXT: shll $6, %ecx
714 ; X86-NEXT: leal (%ecx,%eax,2), %eax
715 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
718 ; X64-LABEL: test_mul_by_66:
720 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
721 ; X64-NEXT: movl %edi, %eax
722 ; X64-NEXT: shll $6, %eax
723 ; X64-NEXT: leal (%rax,%rdi,2), %eax
724 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
726 %mul = mul nsw i16 %x, 66
730 define i16 @test_mul_by_73(i16 %x) {
731 ; X86-LABEL: test_mul_by_73:
733 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
734 ; X86-NEXT: leal (%eax,%eax,8), %ecx
735 ; X86-NEXT: leal (%eax,%ecx,8), %eax
736 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
739 ; X64-LABEL: test_mul_by_73:
741 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
742 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
743 ; X64-NEXT: leal (%rdi,%rax,8), %eax
744 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
746 %mul = mul nsw i16 %x, 73
750 define i16 @test_mul_by_520(i16 %x) {
751 ; X86-LABEL: test_mul_by_520:
753 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
754 ; X86-NEXT: movl %eax, %ecx
755 ; X86-NEXT: shll $9, %ecx
756 ; X86-NEXT: leal (%ecx,%eax,8), %eax
757 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
760 ; X64-LABEL: test_mul_by_520:
762 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
763 ; X64-NEXT: movl %edi, %eax
764 ; X64-NEXT: shll $9, %eax
765 ; X64-NEXT: leal (%rax,%rdi,8), %eax
766 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
768 %mul = mul nsw i16 %x, 520
772 define i16 @test_mul_by_neg10(i16 %x) {
773 ; X86-LABEL: test_mul_by_neg10:
775 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
776 ; X86-NEXT: addl %eax, %eax
777 ; X86-NEXT: leal (%eax,%eax,4), %eax
778 ; X86-NEXT: negl %eax
779 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
782 ; X64-LABEL: test_mul_by_neg10:
784 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
785 ; X64-NEXT: addl %edi, %edi
786 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
787 ; X64-NEXT: negl %eax
788 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
790 %mul = mul nsw i16 %x, -10
794 define i16 @test_mul_by_neg36(i16 %x) {
795 ; X86-LABEL: test_mul_by_neg36:
797 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
798 ; X86-NEXT: shll $2, %eax
799 ; X86-NEXT: leal (%eax,%eax,8), %eax
800 ; X86-NEXT: negl %eax
801 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
804 ; X64-LABEL: test_mul_by_neg36:
806 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
807 ; X64-NEXT: shll $2, %edi
808 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
809 ; X64-NEXT: negl %eax
810 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
812 %mul = mul nsw i16 %x, -36
817 define i16 @test_mul_spec(i16 %x) nounwind {
818 ; X86-LABEL: test_mul_spec:
820 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
821 ; X86-NEXT: leal 42(%eax,%eax,8), %ecx
822 ; X86-NEXT: leal 2(%eax,%eax,4), %eax
823 ; X86-NEXT: imull %ecx, %eax
824 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
827 ; X64-LABEL: test_mul_spec:
829 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
830 ; X64-NEXT: leal 42(%rdi,%rdi,8), %ecx
831 ; X64-NEXT: leal 2(%rdi,%rdi,4), %eax
832 ; X64-NEXT: imull %ecx, %eax
833 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
835 %mul = mul nsw i16 %x, 9
836 %add = add nsw i16 %mul, 42
837 %mul2 = mul nsw i16 %x, 5
838 %add2 = add nsw i16 %mul2, 2
839 %mul3 = mul nsw i16 %add, %add2