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 -mcpu=haswell | FileCheck %s --check-prefixes=X64,X64-HSW
4 ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=btver2 | FileCheck %s --check-prefixes=X64,X64-JAG
5 ; RUN: llc < %s -mtriple=i686-unknown -mul-constant-optimization=false | FileCheck %s --check-prefix=X86-NOOPT
6 ; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -mcpu=haswell | FileCheck %s --check-prefixes=X64-NOOPT,HSW-NOOPT
7 ; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -mcpu=btver2 | FileCheck %s --check-prefixes=X64-NOOPT,JAG-NOOPT
8 ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=slm | FileCheck %s --check-prefixes=X64,X64-SLM
9 ; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -mcpu=slm | FileCheck %s --check-prefixes=X64-NOOPT,SLM-NOOPT
11 define i32 @test_mul_by_1(i32 %x) {
12 ; X86-LABEL: test_mul_by_1:
14 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
17 ; X64-LABEL: test_mul_by_1:
19 ; X64-NEXT: movl %edi, %eax
22 ; X86-NOOPT-LABEL: test_mul_by_1:
24 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
25 ; X86-NOOPT-NEXT: retl
27 ; X64-NOOPT-LABEL: test_mul_by_1:
29 ; X64-NOOPT-NEXT: movl %edi, %eax
30 ; X64-NOOPT-NEXT: retq
31 %mul = mul nsw i32 %x, 1
35 define i32 @test_mul_by_2(i32 %x) {
36 ; X86-LABEL: test_mul_by_2:
38 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
39 ; X86-NEXT: addl %eax, %eax
42 ; X64-LABEL: test_mul_by_2:
44 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
45 ; X64-NEXT: leal (%rdi,%rdi), %eax
48 ; X86-NOOPT-LABEL: test_mul_by_2:
50 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
51 ; X86-NOOPT-NEXT: addl %eax, %eax
52 ; X86-NOOPT-NEXT: retl
54 ; X64-NOOPT-LABEL: test_mul_by_2:
56 ; X64-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi
57 ; X64-NOOPT-NEXT: leal (%rdi,%rdi), %eax
58 ; X64-NOOPT-NEXT: retq
59 %mul = mul nsw i32 %x, 2
63 define i32 @test_mul_by_3(i32 %x) {
64 ; X86-LABEL: test_mul_by_3:
66 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
67 ; X86-NEXT: leal (%eax,%eax,2), %eax
70 ; X64-LABEL: test_mul_by_3:
72 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
73 ; X64-NEXT: leal (%rdi,%rdi,2), %eax
76 ; X86-NOOPT-LABEL: test_mul_by_3:
78 ; X86-NOOPT-NEXT: imull $3, {{[0-9]+}}(%esp), %eax
79 ; X86-NOOPT-NEXT: retl
81 ; X64-NOOPT-LABEL: test_mul_by_3:
83 ; X64-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi
84 ; X64-NOOPT-NEXT: leal (%rdi,%rdi,2), %eax
85 ; X64-NOOPT-NEXT: retq
86 %mul = mul nsw i32 %x, 3
90 define i32 @test_mul_by_4(i32 %x) {
91 ; X86-LABEL: test_mul_by_4:
93 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
94 ; X86-NEXT: shll $2, %eax
97 ; X64-LABEL: test_mul_by_4:
99 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
100 ; X64-NEXT: leal (,%rdi,4), %eax
103 ; X86-NOOPT-LABEL: test_mul_by_4:
104 ; X86-NOOPT: # %bb.0:
105 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
106 ; X86-NOOPT-NEXT: shll $2, %eax
107 ; X86-NOOPT-NEXT: retl
109 ; X64-NOOPT-LABEL: test_mul_by_4:
110 ; X64-NOOPT: # %bb.0:
111 ; X64-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi
112 ; X64-NOOPT-NEXT: leal (,%rdi,4), %eax
113 ; X64-NOOPT-NEXT: retq
114 %mul = mul nsw i32 %x, 4
118 define i32 @test_mul_by_5(i32 %x) {
119 ; X86-LABEL: test_mul_by_5:
121 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
122 ; X86-NEXT: leal (%eax,%eax,4), %eax
125 ; X64-LABEL: test_mul_by_5:
127 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
128 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
131 ; X86-NOOPT-LABEL: test_mul_by_5:
132 ; X86-NOOPT: # %bb.0:
133 ; X86-NOOPT-NEXT: imull $5, {{[0-9]+}}(%esp), %eax
134 ; X86-NOOPT-NEXT: retl
136 ; X64-NOOPT-LABEL: test_mul_by_5:
137 ; X64-NOOPT: # %bb.0:
138 ; X64-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi
139 ; X64-NOOPT-NEXT: leal (%rdi,%rdi,4), %eax
140 ; X64-NOOPT-NEXT: retq
141 %mul = mul nsw i32 %x, 5
145 define i32 @test_mul_by_6(i32 %x) {
146 ; X86-LABEL: test_mul_by_6:
148 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
149 ; X86-NEXT: addl %eax, %eax
150 ; X86-NEXT: leal (%eax,%eax,2), %eax
153 ; X64-LABEL: test_mul_by_6:
155 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
156 ; X64-NEXT: addl %edi, %edi
157 ; X64-NEXT: leal (%rdi,%rdi,2), %eax
160 ; X86-NOOPT-LABEL: test_mul_by_6:
161 ; X86-NOOPT: # %bb.0:
162 ; X86-NOOPT-NEXT: imull $6, {{[0-9]+}}(%esp), %eax
163 ; X86-NOOPT-NEXT: retl
165 ; X64-NOOPT-LABEL: test_mul_by_6:
166 ; X64-NOOPT: # %bb.0:
167 ; X64-NOOPT-NEXT: imull $6, %edi, %eax
168 ; X64-NOOPT-NEXT: retq
169 %mul = mul nsw i32 %x, 6
173 define i32 @test_mul_by_7(i32 %x) {
174 ; X86-LABEL: test_mul_by_7:
176 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
177 ; X86-NEXT: leal (,%ecx,8), %eax
178 ; X86-NEXT: subl %ecx, %eax
181 ; X64-LABEL: test_mul_by_7:
183 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
184 ; X64-NEXT: leal (,%rdi,8), %eax
185 ; X64-NEXT: subl %edi, %eax
188 ; X86-NOOPT-LABEL: test_mul_by_7:
189 ; X86-NOOPT: # %bb.0:
190 ; X86-NOOPT-NEXT: imull $7, {{[0-9]+}}(%esp), %eax
191 ; X86-NOOPT-NEXT: retl
193 ; X64-NOOPT-LABEL: test_mul_by_7:
194 ; X64-NOOPT: # %bb.0:
195 ; X64-NOOPT-NEXT: imull $7, %edi, %eax
196 ; X64-NOOPT-NEXT: retq
197 %mul = mul nsw i32 %x, 7
201 define i32 @test_mul_by_8(i32 %x) {
202 ; X86-LABEL: test_mul_by_8:
204 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
205 ; X86-NEXT: shll $3, %eax
208 ; X64-LABEL: test_mul_by_8:
210 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
211 ; X64-NEXT: leal (,%rdi,8), %eax
214 ; X86-NOOPT-LABEL: test_mul_by_8:
215 ; X86-NOOPT: # %bb.0:
216 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
217 ; X86-NOOPT-NEXT: shll $3, %eax
218 ; X86-NOOPT-NEXT: retl
220 ; X64-NOOPT-LABEL: test_mul_by_8:
221 ; X64-NOOPT: # %bb.0:
222 ; X64-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi
223 ; X64-NOOPT-NEXT: leal (,%rdi,8), %eax
224 ; X64-NOOPT-NEXT: retq
225 %mul = mul nsw i32 %x, 8
229 define i32 @test_mul_by_9(i32 %x) {
230 ; X86-LABEL: test_mul_by_9:
232 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
233 ; X86-NEXT: leal (%eax,%eax,8), %eax
236 ; X64-LABEL: test_mul_by_9:
238 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
239 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
242 ; X86-NOOPT-LABEL: test_mul_by_9:
243 ; X86-NOOPT: # %bb.0:
244 ; X86-NOOPT-NEXT: imull $9, {{[0-9]+}}(%esp), %eax
245 ; X86-NOOPT-NEXT: retl
247 ; X64-NOOPT-LABEL: test_mul_by_9:
248 ; X64-NOOPT: # %bb.0:
249 ; X64-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi
250 ; X64-NOOPT-NEXT: leal (%rdi,%rdi,8), %eax
251 ; X64-NOOPT-NEXT: retq
252 %mul = mul nsw i32 %x, 9
256 define i32 @test_mul_by_10(i32 %x) {
257 ; X86-LABEL: test_mul_by_10:
259 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
260 ; X86-NEXT: addl %eax, %eax
261 ; X86-NEXT: leal (%eax,%eax,4), %eax
264 ; X64-LABEL: test_mul_by_10:
266 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
267 ; X64-NEXT: addl %edi, %edi
268 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
271 ; X86-NOOPT-LABEL: test_mul_by_10:
272 ; X86-NOOPT: # %bb.0:
273 ; X86-NOOPT-NEXT: imull $10, {{[0-9]+}}(%esp), %eax
274 ; X86-NOOPT-NEXT: retl
276 ; X64-NOOPT-LABEL: test_mul_by_10:
277 ; X64-NOOPT: # %bb.0:
278 ; X64-NOOPT-NEXT: imull $10, %edi, %eax
279 ; X64-NOOPT-NEXT: retq
280 %mul = mul nsw i32 %x, 10
284 define i32 @test_mul_by_11(i32 %x) {
285 ; X86-LABEL: test_mul_by_11:
287 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
288 ; X86-NEXT: leal (%eax,%eax,4), %ecx
289 ; X86-NEXT: leal (%eax,%ecx,2), %eax
292 ; X64-HSW-LABEL: test_mul_by_11:
294 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
295 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax
296 ; X64-HSW-NEXT: leal (%rdi,%rax,2), %eax
299 ; X64-JAG-LABEL: test_mul_by_11:
301 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
302 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax
303 ; X64-JAG-NEXT: leal (%rdi,%rax,2), %eax
306 ; X86-NOOPT-LABEL: test_mul_by_11:
307 ; X86-NOOPT: # %bb.0:
308 ; X86-NOOPT-NEXT: imull $11, {{[0-9]+}}(%esp), %eax
309 ; X86-NOOPT-NEXT: retl
311 ; X64-NOOPT-LABEL: test_mul_by_11:
312 ; X64-NOOPT: # %bb.0:
313 ; X64-NOOPT-NEXT: imull $11, %edi, %eax
314 ; X64-NOOPT-NEXT: retq
316 ; X64-SLM-LABEL: test_mul_by_11:
318 ; X64-SLM-NEXT: imull $11, %edi, %eax
320 %mul = mul nsw i32 %x, 11
324 define i32 @test_mul_by_12(i32 %x) {
325 ; X86-LABEL: test_mul_by_12:
327 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
328 ; X86-NEXT: shll $2, %eax
329 ; X86-NEXT: leal (%eax,%eax,2), %eax
332 ; X64-LABEL: test_mul_by_12:
334 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
335 ; X64-NEXT: shll $2, %edi
336 ; X64-NEXT: leal (%rdi,%rdi,2), %eax
339 ; X86-NOOPT-LABEL: test_mul_by_12:
340 ; X86-NOOPT: # %bb.0:
341 ; X86-NOOPT-NEXT: imull $12, {{[0-9]+}}(%esp), %eax
342 ; X86-NOOPT-NEXT: retl
344 ; X64-NOOPT-LABEL: test_mul_by_12:
345 ; X64-NOOPT: # %bb.0:
346 ; X64-NOOPT-NEXT: imull $12, %edi, %eax
347 ; X64-NOOPT-NEXT: retq
348 %mul = mul nsw i32 %x, 12
352 define i32 @test_mul_by_13(i32 %x) {
353 ; X86-LABEL: test_mul_by_13:
355 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
356 ; X86-NEXT: leal (%eax,%eax,2), %ecx
357 ; X86-NEXT: leal (%eax,%ecx,4), %eax
360 ; X64-HSW-LABEL: test_mul_by_13:
362 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
363 ; X64-HSW-NEXT: leal (%rdi,%rdi,2), %eax
364 ; X64-HSW-NEXT: leal (%rdi,%rax,4), %eax
367 ; X64-JAG-LABEL: test_mul_by_13:
369 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
370 ; X64-JAG-NEXT: leal (%rdi,%rdi,2), %eax
371 ; X64-JAG-NEXT: leal (%rdi,%rax,4), %eax
374 ; X86-NOOPT-LABEL: test_mul_by_13:
375 ; X86-NOOPT: # %bb.0:
376 ; X86-NOOPT-NEXT: imull $13, {{[0-9]+}}(%esp), %eax
377 ; X86-NOOPT-NEXT: retl
379 ; X64-NOOPT-LABEL: test_mul_by_13:
380 ; X64-NOOPT: # %bb.0:
381 ; X64-NOOPT-NEXT: imull $13, %edi, %eax
382 ; X64-NOOPT-NEXT: retq
384 ; X64-SLM-LABEL: test_mul_by_13:
386 ; X64-SLM-NEXT: imull $13, %edi, %eax
388 %mul = mul nsw i32 %x, 13
392 define i32 @test_mul_by_14(i32 %x) {
393 ; X86-LABEL: test_mul_by_14:
395 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
396 ; X86-NEXT: movl %ecx, %eax
397 ; X86-NEXT: shll $4, %eax
398 ; X86-NEXT: subl %ecx, %eax
399 ; X86-NEXT: subl %ecx, %eax
402 ; X64-LABEL: test_mul_by_14:
404 ; X64-NEXT: movl %edi, %eax
405 ; X64-NEXT: shll $4, %eax
406 ; X64-NEXT: subl %edi, %eax
407 ; X64-NEXT: subl %edi, %eax
410 ; X86-NOOPT-LABEL: test_mul_by_14:
411 ; X86-NOOPT: # %bb.0:
412 ; X86-NOOPT-NEXT: imull $14, {{[0-9]+}}(%esp), %eax
413 ; X86-NOOPT-NEXT: retl
415 ; X64-NOOPT-LABEL: test_mul_by_14:
416 ; X64-NOOPT: # %bb.0:
417 ; X64-NOOPT-NEXT: imull $14, %edi, %eax
418 ; X64-NOOPT-NEXT: retq
419 %mul = mul nsw i32 %x, 14
423 define i32 @test_mul_by_15(i32 %x) {
424 ; X86-LABEL: test_mul_by_15:
426 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
427 ; X86-NEXT: leal (%eax,%eax,4), %eax
428 ; X86-NEXT: leal (%eax,%eax,2), %eax
431 ; X64-LABEL: test_mul_by_15:
433 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
434 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
435 ; X64-NEXT: leal (%rax,%rax,2), %eax
438 ; X86-NOOPT-LABEL: test_mul_by_15:
439 ; X86-NOOPT: # %bb.0:
440 ; X86-NOOPT-NEXT: imull $15, {{[0-9]+}}(%esp), %eax
441 ; X86-NOOPT-NEXT: retl
443 ; X64-NOOPT-LABEL: test_mul_by_15:
444 ; X64-NOOPT: # %bb.0:
445 ; X64-NOOPT-NEXT: imull $15, %edi, %eax
446 ; X64-NOOPT-NEXT: retq
447 %mul = mul nsw i32 %x, 15
451 define i32 @test_mul_by_16(i32 %x) {
452 ; X86-LABEL: test_mul_by_16:
454 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
455 ; X86-NEXT: shll $4, %eax
458 ; X64-LABEL: test_mul_by_16:
460 ; X64-NEXT: movl %edi, %eax
461 ; X64-NEXT: shll $4, %eax
464 ; X86-NOOPT-LABEL: test_mul_by_16:
465 ; X86-NOOPT: # %bb.0:
466 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
467 ; X86-NOOPT-NEXT: shll $4, %eax
468 ; X86-NOOPT-NEXT: retl
470 ; X64-NOOPT-LABEL: test_mul_by_16:
471 ; X64-NOOPT: # %bb.0:
472 ; X64-NOOPT-NEXT: movl %edi, %eax
473 ; X64-NOOPT-NEXT: shll $4, %eax
474 ; X64-NOOPT-NEXT: retq
475 %mul = mul nsw i32 %x, 16
479 define i32 @test_mul_by_17(i32 %x) {
480 ; X86-LABEL: test_mul_by_17:
482 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
483 ; X86-NEXT: movl %ecx, %eax
484 ; X86-NEXT: shll $4, %eax
485 ; X86-NEXT: addl %ecx, %eax
488 ; X64-LABEL: test_mul_by_17:
490 ; X64-NEXT: movl %edi, %eax
491 ; X64-NEXT: shll $4, %eax
492 ; X64-NEXT: addl %edi, %eax
495 ; X86-NOOPT-LABEL: test_mul_by_17:
496 ; X86-NOOPT: # %bb.0:
497 ; X86-NOOPT-NEXT: imull $17, {{[0-9]+}}(%esp), %eax
498 ; X86-NOOPT-NEXT: retl
500 ; X64-NOOPT-LABEL: test_mul_by_17:
501 ; X64-NOOPT: # %bb.0:
502 ; X64-NOOPT-NEXT: imull $17, %edi, %eax
503 ; X64-NOOPT-NEXT: retq
504 %mul = mul nsw i32 %x, 17
508 define i32 @test_mul_by_18(i32 %x) {
509 ; X86-LABEL: test_mul_by_18:
511 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
512 ; X86-NEXT: addl %eax, %eax
513 ; X86-NEXT: leal (%eax,%eax,8), %eax
516 ; X64-LABEL: test_mul_by_18:
518 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
519 ; X64-NEXT: addl %edi, %edi
520 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
523 ; X86-NOOPT-LABEL: test_mul_by_18:
524 ; X86-NOOPT: # %bb.0:
525 ; X86-NOOPT-NEXT: imull $18, {{[0-9]+}}(%esp), %eax
526 ; X86-NOOPT-NEXT: retl
528 ; X64-NOOPT-LABEL: test_mul_by_18:
529 ; X64-NOOPT: # %bb.0:
530 ; X64-NOOPT-NEXT: imull $18, %edi, %eax
531 ; X64-NOOPT-NEXT: retq
532 %mul = mul nsw i32 %x, 18
536 define i32 @test_mul_by_19(i32 %x) {
537 ; X86-LABEL: test_mul_by_19:
539 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
540 ; X86-NEXT: leal (%eax,%eax,8), %ecx
541 ; X86-NEXT: leal (%eax,%ecx,2), %eax
544 ; X64-HSW-LABEL: test_mul_by_19:
546 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
547 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax
548 ; X64-HSW-NEXT: leal (%rdi,%rax,2), %eax
551 ; X64-JAG-LABEL: test_mul_by_19:
553 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
554 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax
555 ; X64-JAG-NEXT: leal (%rdi,%rax,2), %eax
558 ; X86-NOOPT-LABEL: test_mul_by_19:
559 ; X86-NOOPT: # %bb.0:
560 ; X86-NOOPT-NEXT: imull $19, {{[0-9]+}}(%esp), %eax
561 ; X86-NOOPT-NEXT: retl
563 ; X64-NOOPT-LABEL: test_mul_by_19:
564 ; X64-NOOPT: # %bb.0:
565 ; X64-NOOPT-NEXT: imull $19, %edi, %eax
566 ; X64-NOOPT-NEXT: retq
568 ; X64-SLM-LABEL: test_mul_by_19:
570 ; X64-SLM-NEXT: imull $19, %edi, %eax
572 %mul = mul nsw i32 %x, 19
576 define i32 @test_mul_by_20(i32 %x) {
577 ; X86-LABEL: test_mul_by_20:
579 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
580 ; X86-NEXT: shll $2, %eax
581 ; X86-NEXT: leal (%eax,%eax,4), %eax
584 ; X64-LABEL: test_mul_by_20:
586 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
587 ; X64-NEXT: shll $2, %edi
588 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
591 ; X86-NOOPT-LABEL: test_mul_by_20:
592 ; X86-NOOPT: # %bb.0:
593 ; X86-NOOPT-NEXT: imull $20, {{[0-9]+}}(%esp), %eax
594 ; X86-NOOPT-NEXT: retl
596 ; X64-NOOPT-LABEL: test_mul_by_20:
597 ; X64-NOOPT: # %bb.0:
598 ; X64-NOOPT-NEXT: imull $20, %edi, %eax
599 ; X64-NOOPT-NEXT: retq
600 %mul = mul nsw i32 %x, 20
604 define i32 @test_mul_by_21(i32 %x) {
605 ; X86-LABEL: test_mul_by_21:
607 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
608 ; X86-NEXT: leal (%eax,%eax,4), %ecx
609 ; X86-NEXT: leal (%eax,%ecx,4), %eax
612 ; X64-HSW-LABEL: test_mul_by_21:
614 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
615 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax
616 ; X64-HSW-NEXT: leal (%rdi,%rax,4), %eax
619 ; X64-JAG-LABEL: test_mul_by_21:
621 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
622 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax
623 ; X64-JAG-NEXT: leal (%rdi,%rax,4), %eax
626 ; X86-NOOPT-LABEL: test_mul_by_21:
627 ; X86-NOOPT: # %bb.0:
628 ; X86-NOOPT-NEXT: imull $21, {{[0-9]+}}(%esp), %eax
629 ; X86-NOOPT-NEXT: retl
631 ; X64-NOOPT-LABEL: test_mul_by_21:
632 ; X64-NOOPT: # %bb.0:
633 ; X64-NOOPT-NEXT: imull $21, %edi, %eax
634 ; X64-NOOPT-NEXT: retq
636 ; X64-SLM-LABEL: test_mul_by_21:
638 ; X64-SLM-NEXT: imull $21, %edi, %eax
640 %mul = mul nsw i32 %x, 21
644 define i32 @test_mul_by_22(i32 %x) {
645 ; X86-LABEL: test_mul_by_22:
647 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
648 ; X86-NEXT: leal (%ecx,%ecx,4), %eax
649 ; X86-NEXT: leal (%ecx,%eax,4), %eax
650 ; X86-NEXT: addl %ecx, %eax
653 ; X64-HSW-LABEL: test_mul_by_22:
655 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
656 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax
657 ; X64-HSW-NEXT: leal (%rdi,%rax,4), %eax
658 ; X64-HSW-NEXT: addl %edi, %eax
661 ; X64-JAG-LABEL: test_mul_by_22:
663 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
664 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax
665 ; X64-JAG-NEXT: leal (%rdi,%rax,4), %eax
666 ; X64-JAG-NEXT: addl %edi, %eax
669 ; X86-NOOPT-LABEL: test_mul_by_22:
670 ; X86-NOOPT: # %bb.0:
671 ; X86-NOOPT-NEXT: imull $22, {{[0-9]+}}(%esp), %eax
672 ; X86-NOOPT-NEXT: retl
674 ; X64-NOOPT-LABEL: test_mul_by_22:
675 ; X64-NOOPT: # %bb.0:
676 ; X64-NOOPT-NEXT: imull $22, %edi, %eax
677 ; X64-NOOPT-NEXT: retq
679 ; X64-SLM-LABEL: test_mul_by_22:
681 ; X64-SLM-NEXT: imull $22, %edi, %eax
683 %mul = mul nsw i32 %x, 22
687 define i32 @test_mul_by_23(i32 %x) {
688 ; X86-LABEL: test_mul_by_23:
690 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
691 ; X86-NEXT: leal (%ecx,%ecx,2), %eax
692 ; X86-NEXT: shll $3, %eax
693 ; X86-NEXT: subl %ecx, %eax
696 ; X64-HSW-LABEL: test_mul_by_23:
698 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
699 ; X64-HSW-NEXT: leal (%rdi,%rdi,2), %eax
700 ; X64-HSW-NEXT: shll $3, %eax
701 ; X64-HSW-NEXT: subl %edi, %eax
704 ; X64-JAG-LABEL: test_mul_by_23:
706 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
707 ; X64-JAG-NEXT: leal (%rdi,%rdi,2), %eax
708 ; X64-JAG-NEXT: shll $3, %eax
709 ; X64-JAG-NEXT: subl %edi, %eax
712 ; X86-NOOPT-LABEL: test_mul_by_23:
713 ; X86-NOOPT: # %bb.0:
714 ; X86-NOOPT-NEXT: imull $23, {{[0-9]+}}(%esp), %eax
715 ; X86-NOOPT-NEXT: retl
717 ; X64-NOOPT-LABEL: test_mul_by_23:
718 ; X64-NOOPT: # %bb.0:
719 ; X64-NOOPT-NEXT: imull $23, %edi, %eax
720 ; X64-NOOPT-NEXT: retq
722 ; X64-SLM-LABEL: test_mul_by_23:
724 ; X64-SLM-NEXT: imull $23, %edi, %eax
726 %mul = mul nsw i32 %x, 23
730 define i32 @test_mul_by_24(i32 %x) {
731 ; X86-LABEL: test_mul_by_24:
733 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
734 ; X86-NEXT: shll $3, %eax
735 ; X86-NEXT: leal (%eax,%eax,2), %eax
738 ; X64-LABEL: test_mul_by_24:
740 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
741 ; X64-NEXT: shll $3, %edi
742 ; X64-NEXT: leal (%rdi,%rdi,2), %eax
745 ; X86-NOOPT-LABEL: test_mul_by_24:
746 ; X86-NOOPT: # %bb.0:
747 ; X86-NOOPT-NEXT: imull $24, {{[0-9]+}}(%esp), %eax
748 ; X86-NOOPT-NEXT: retl
750 ; X64-NOOPT-LABEL: test_mul_by_24:
751 ; X64-NOOPT: # %bb.0:
752 ; X64-NOOPT-NEXT: imull $24, %edi, %eax
753 ; X64-NOOPT-NEXT: retq
754 %mul = mul nsw i32 %x, 24
758 define i32 @test_mul_by_25(i32 %x) {
759 ; X86-LABEL: test_mul_by_25:
761 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
762 ; X86-NEXT: leal (%eax,%eax,4), %eax
763 ; X86-NEXT: leal (%eax,%eax,4), %eax
766 ; X64-LABEL: test_mul_by_25:
768 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
769 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
770 ; X64-NEXT: leal (%rax,%rax,4), %eax
773 ; X86-NOOPT-LABEL: test_mul_by_25:
774 ; X86-NOOPT: # %bb.0:
775 ; X86-NOOPT-NEXT: imull $25, {{[0-9]+}}(%esp), %eax
776 ; X86-NOOPT-NEXT: retl
778 ; X64-NOOPT-LABEL: test_mul_by_25:
779 ; X64-NOOPT: # %bb.0:
780 ; X64-NOOPT-NEXT: imull $25, %edi, %eax
781 ; X64-NOOPT-NEXT: retq
782 %mul = mul nsw i32 %x, 25
786 define i32 @test_mul_by_26(i32 %x) {
787 ; X86-LABEL: test_mul_by_26:
789 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
790 ; X86-NEXT: leal (%ecx,%ecx,4), %eax
791 ; X86-NEXT: leal (%eax,%eax,4), %eax
792 ; X86-NEXT: addl %ecx, %eax
795 ; X64-HSW-LABEL: test_mul_by_26:
797 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
798 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax
799 ; X64-HSW-NEXT: leal (%rax,%rax,4), %eax
800 ; X64-HSW-NEXT: addl %edi, %eax
803 ; X64-JAG-LABEL: test_mul_by_26:
805 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
806 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax
807 ; X64-JAG-NEXT: leal (%rax,%rax,4), %eax
808 ; X64-JAG-NEXT: addl %edi, %eax
811 ; X86-NOOPT-LABEL: test_mul_by_26:
812 ; X86-NOOPT: # %bb.0:
813 ; X86-NOOPT-NEXT: imull $26, {{[0-9]+}}(%esp), %eax
814 ; X86-NOOPT-NEXT: retl
816 ; X64-NOOPT-LABEL: test_mul_by_26:
817 ; X64-NOOPT: # %bb.0:
818 ; X64-NOOPT-NEXT: imull $26, %edi, %eax
819 ; X64-NOOPT-NEXT: retq
821 ; X64-SLM-LABEL: test_mul_by_26:
823 ; X64-SLM-NEXT: imull $26, %edi, %eax
825 %mul = mul nsw i32 %x, 26
829 define i32 @test_mul_by_27(i32 %x) {
830 ; X86-LABEL: test_mul_by_27:
832 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
833 ; X86-NEXT: leal (%eax,%eax,8), %eax
834 ; X86-NEXT: leal (%eax,%eax,2), %eax
837 ; X64-LABEL: test_mul_by_27:
839 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
840 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
841 ; X64-NEXT: leal (%rax,%rax,2), %eax
844 ; X86-NOOPT-LABEL: test_mul_by_27:
845 ; X86-NOOPT: # %bb.0:
846 ; X86-NOOPT-NEXT: imull $27, {{[0-9]+}}(%esp), %eax
847 ; X86-NOOPT-NEXT: retl
849 ; X64-NOOPT-LABEL: test_mul_by_27:
850 ; X64-NOOPT: # %bb.0:
851 ; X64-NOOPT-NEXT: imull $27, %edi, %eax
852 ; X64-NOOPT-NEXT: retq
853 %mul = mul nsw i32 %x, 27
857 define i32 @test_mul_by_28(i32 %x) {
858 ; X86-LABEL: test_mul_by_28:
860 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
861 ; X86-NEXT: leal (%ecx,%ecx,8), %eax
862 ; X86-NEXT: leal (%eax,%eax,2), %eax
863 ; X86-NEXT: addl %ecx, %eax
866 ; X64-HSW-LABEL: test_mul_by_28:
868 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
869 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax
870 ; X64-HSW-NEXT: leal (%rax,%rax,2), %eax
871 ; X64-HSW-NEXT: addl %edi, %eax
874 ; X64-JAG-LABEL: test_mul_by_28:
876 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
877 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax
878 ; X64-JAG-NEXT: leal (%rax,%rax,2), %eax
879 ; X64-JAG-NEXT: addl %edi, %eax
882 ; X86-NOOPT-LABEL: test_mul_by_28:
883 ; X86-NOOPT: # %bb.0:
884 ; X86-NOOPT-NEXT: imull $28, {{[0-9]+}}(%esp), %eax
885 ; X86-NOOPT-NEXT: retl
887 ; X64-NOOPT-LABEL: test_mul_by_28:
888 ; X64-NOOPT: # %bb.0:
889 ; X64-NOOPT-NEXT: imull $28, %edi, %eax
890 ; X64-NOOPT-NEXT: retq
892 ; X64-SLM-LABEL: test_mul_by_28:
894 ; X64-SLM-NEXT: imull $28, %edi, %eax
896 %mul = mul nsw i32 %x, 28
900 define i32 @test_mul_by_29(i32 %x) {
901 ; X86-LABEL: test_mul_by_29:
903 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
904 ; X86-NEXT: leal (%ecx,%ecx,8), %eax
905 ; X86-NEXT: leal (%eax,%eax,2), %eax
906 ; X86-NEXT: addl %ecx, %eax
907 ; X86-NEXT: addl %ecx, %eax
910 ; X64-HSW-LABEL: test_mul_by_29:
912 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
913 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax
914 ; X64-HSW-NEXT: leal (%rax,%rax,2), %eax
915 ; X64-HSW-NEXT: addl %edi, %eax
916 ; X64-HSW-NEXT: addl %edi, %eax
919 ; X64-JAG-LABEL: test_mul_by_29:
921 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
922 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax
923 ; X64-JAG-NEXT: leal (%rax,%rax,2), %eax
924 ; X64-JAG-NEXT: addl %edi, %eax
925 ; X64-JAG-NEXT: addl %edi, %eax
928 ; X86-NOOPT-LABEL: test_mul_by_29:
929 ; X86-NOOPT: # %bb.0:
930 ; X86-NOOPT-NEXT: imull $29, {{[0-9]+}}(%esp), %eax
931 ; X86-NOOPT-NEXT: retl
933 ; X64-NOOPT-LABEL: test_mul_by_29:
934 ; X64-NOOPT: # %bb.0:
935 ; X64-NOOPT-NEXT: imull $29, %edi, %eax
936 ; X64-NOOPT-NEXT: retq
938 ; X64-SLM-LABEL: test_mul_by_29:
940 ; X64-SLM-NEXT: imull $29, %edi, %eax
942 %mul = mul nsw i32 %x, 29
946 define i32 @test_mul_by_30(i32 %x) {
947 ; X86-LABEL: test_mul_by_30:
949 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
950 ; X86-NEXT: movl %ecx, %eax
951 ; X86-NEXT: shll $5, %eax
952 ; X86-NEXT: subl %ecx, %eax
953 ; X86-NEXT: subl %ecx, %eax
956 ; X64-LABEL: test_mul_by_30:
958 ; X64-NEXT: movl %edi, %eax
959 ; X64-NEXT: shll $5, %eax
960 ; X64-NEXT: subl %edi, %eax
961 ; X64-NEXT: subl %edi, %eax
964 ; X86-NOOPT-LABEL: test_mul_by_30:
965 ; X86-NOOPT: # %bb.0:
966 ; X86-NOOPT-NEXT: imull $30, {{[0-9]+}}(%esp), %eax
967 ; X86-NOOPT-NEXT: retl
969 ; X64-NOOPT-LABEL: test_mul_by_30:
970 ; X64-NOOPT: # %bb.0:
971 ; X64-NOOPT-NEXT: imull $30, %edi, %eax
972 ; X64-NOOPT-NEXT: retq
973 %mul = mul nsw i32 %x, 30
977 define i32 @test_mul_by_31(i32 %x) {
978 ; X86-LABEL: test_mul_by_31:
980 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
981 ; X86-NEXT: movl %ecx, %eax
982 ; X86-NEXT: shll $5, %eax
983 ; X86-NEXT: subl %ecx, %eax
986 ; X64-LABEL: test_mul_by_31:
988 ; X64-NEXT: movl %edi, %eax
989 ; X64-NEXT: shll $5, %eax
990 ; X64-NEXT: subl %edi, %eax
993 ; X86-NOOPT-LABEL: test_mul_by_31:
994 ; X86-NOOPT: # %bb.0:
995 ; X86-NOOPT-NEXT: imull $31, {{[0-9]+}}(%esp), %eax
996 ; X86-NOOPT-NEXT: retl
998 ; X64-NOOPT-LABEL: test_mul_by_31:
999 ; X64-NOOPT: # %bb.0:
1000 ; X64-NOOPT-NEXT: imull $31, %edi, %eax
1001 ; X64-NOOPT-NEXT: retq
1002 %mul = mul nsw i32 %x, 31
1006 define i32 @test_mul_by_32(i32 %x) {
1007 ; X86-LABEL: test_mul_by_32:
1009 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1010 ; X86-NEXT: shll $5, %eax
1013 ; X64-LABEL: test_mul_by_32:
1015 ; X64-NEXT: movl %edi, %eax
1016 ; X64-NEXT: shll $5, %eax
1019 ; X86-NOOPT-LABEL: test_mul_by_32:
1020 ; X86-NOOPT: # %bb.0:
1021 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
1022 ; X86-NOOPT-NEXT: shll $5, %eax
1023 ; X86-NOOPT-NEXT: retl
1025 ; X64-NOOPT-LABEL: test_mul_by_32:
1026 ; X64-NOOPT: # %bb.0:
1027 ; X64-NOOPT-NEXT: movl %edi, %eax
1028 ; X64-NOOPT-NEXT: shll $5, %eax
1029 ; X64-NOOPT-NEXT: retq
1030 %mul = mul nsw i32 %x, 32
1034 define i32 @test_mul_by_37(i32 %x) {
1035 ; X86-LABEL: test_mul_by_37:
1037 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1038 ; X86-NEXT: leal (%eax,%eax,8), %ecx
1039 ; X86-NEXT: leal (%eax,%ecx,4), %eax
1042 ; X64-HSW-LABEL: test_mul_by_37:
1044 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
1045 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax
1046 ; X64-HSW-NEXT: leal (%rdi,%rax,4), %eax
1047 ; X64-HSW-NEXT: retq
1049 ; X64-JAG-LABEL: test_mul_by_37:
1051 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
1052 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax
1053 ; X64-JAG-NEXT: leal (%rdi,%rax,4), %eax
1054 ; X64-JAG-NEXT: retq
1056 ; X86-NOOPT-LABEL: test_mul_by_37:
1057 ; X86-NOOPT: # %bb.0:
1058 ; X86-NOOPT-NEXT: imull $37, {{[0-9]+}}(%esp), %eax
1059 ; X86-NOOPT-NEXT: retl
1061 ; X64-NOOPT-LABEL: test_mul_by_37:
1062 ; X64-NOOPT: # %bb.0:
1063 ; X64-NOOPT-NEXT: imull $37, %edi, %eax
1064 ; X64-NOOPT-NEXT: retq
1066 ; X64-SLM-LABEL: test_mul_by_37:
1068 ; X64-SLM-NEXT: imull $37, %edi, %eax
1069 ; X64-SLM-NEXT: retq
1070 %mul = mul nsw i32 %x, 37
1074 define i32 @test_mul_by_41(i32 %x) {
1075 ; X86-LABEL: test_mul_by_41:
1077 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1078 ; X86-NEXT: leal (%eax,%eax,4), %ecx
1079 ; X86-NEXT: leal (%eax,%ecx,8), %eax
1082 ; X64-HSW-LABEL: test_mul_by_41:
1084 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
1085 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax
1086 ; X64-HSW-NEXT: leal (%rdi,%rax,8), %eax
1087 ; X64-HSW-NEXT: retq
1089 ; X64-JAG-LABEL: test_mul_by_41:
1091 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
1092 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax
1093 ; X64-JAG-NEXT: leal (%rdi,%rax,8), %eax
1094 ; X64-JAG-NEXT: retq
1096 ; X86-NOOPT-LABEL: test_mul_by_41:
1097 ; X86-NOOPT: # %bb.0:
1098 ; X86-NOOPT-NEXT: imull $41, {{[0-9]+}}(%esp), %eax
1099 ; X86-NOOPT-NEXT: retl
1101 ; X64-NOOPT-LABEL: test_mul_by_41:
1102 ; X64-NOOPT: # %bb.0:
1103 ; X64-NOOPT-NEXT: imull $41, %edi, %eax
1104 ; X64-NOOPT-NEXT: retq
1106 ; X64-SLM-LABEL: test_mul_by_41:
1108 ; X64-SLM-NEXT: imull $41, %edi, %eax
1109 ; X64-SLM-NEXT: retq
1110 %mul = mul nsw i32 %x, 41
1114 define i32 @test_mul_by_62(i32 %x) {
1115 ; X86-LABEL: test_mul_by_62:
1117 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1118 ; X86-NEXT: movl %ecx, %eax
1119 ; X86-NEXT: shll $6, %eax
1120 ; X86-NEXT: subl %ecx, %eax
1121 ; X86-NEXT: subl %ecx, %eax
1124 ; X64-LABEL: test_mul_by_62:
1126 ; X64-NEXT: movl %edi, %eax
1127 ; X64-NEXT: shll $6, %eax
1128 ; X64-NEXT: subl %edi, %eax
1129 ; X64-NEXT: subl %edi, %eax
1132 ; X86-NOOPT-LABEL: test_mul_by_62:
1133 ; X86-NOOPT: # %bb.0:
1134 ; X86-NOOPT-NEXT: imull $62, {{[0-9]+}}(%esp), %eax
1135 ; X86-NOOPT-NEXT: retl
1137 ; X64-NOOPT-LABEL: test_mul_by_62:
1138 ; X64-NOOPT: # %bb.0:
1139 ; X64-NOOPT-NEXT: imull $62, %edi, %eax
1140 ; X64-NOOPT-NEXT: retq
1141 %mul = mul nsw i32 %x, 62
1145 define i32 @test_mul_by_66(i32 %x) {
1146 ; X86-LABEL: test_mul_by_66:
1148 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1149 ; X86-NEXT: movl %eax, %ecx
1150 ; X86-NEXT: shll $6, %ecx
1151 ; X86-NEXT: leal (%ecx,%eax,2), %eax
1154 ; X64-HSW-LABEL: test_mul_by_66:
1156 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
1157 ; X64-HSW-NEXT: movl %edi, %eax
1158 ; X64-HSW-NEXT: shll $6, %eax
1159 ; X64-HSW-NEXT: leal (%rax,%rdi,2), %eax
1160 ; X64-HSW-NEXT: retq
1162 ; X64-JAG-LABEL: test_mul_by_66:
1164 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
1165 ; X64-JAG-NEXT: movl %edi, %eax
1166 ; X64-JAG-NEXT: shll $6, %eax
1167 ; X64-JAG-NEXT: leal (%rax,%rdi,2), %eax
1168 ; X64-JAG-NEXT: retq
1170 ; X86-NOOPT-LABEL: test_mul_by_66:
1171 ; X86-NOOPT: # %bb.0:
1172 ; X86-NOOPT-NEXT: imull $66, {{[0-9]+}}(%esp), %eax
1173 ; X86-NOOPT-NEXT: retl
1175 ; X64-NOOPT-LABEL: test_mul_by_66:
1176 ; X64-NOOPT: # %bb.0:
1177 ; X64-NOOPT-NEXT: imull $66, %edi, %eax
1178 ; X64-NOOPT-NEXT: retq
1180 ; X64-SLM-LABEL: test_mul_by_66:
1182 ; X64-SLM-NEXT: movl %edi, %eax
1183 ; X64-SLM-NEXT: shll $6, %eax
1184 ; X64-SLM-NEXT: addl %edi, %eax
1185 ; X64-SLM-NEXT: addl %edi, %eax
1186 ; X64-SLM-NEXT: retq
1187 %mul = mul nsw i32 %x, 66
1191 define i32 @test_mul_by_73(i32 %x) {
1192 ; X86-LABEL: test_mul_by_73:
1194 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1195 ; X86-NEXT: leal (%eax,%eax,8), %ecx
1196 ; X86-NEXT: leal (%eax,%ecx,8), %eax
1199 ; X64-HSW-LABEL: test_mul_by_73:
1201 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
1202 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax
1203 ; X64-HSW-NEXT: leal (%rdi,%rax,8), %eax
1204 ; X64-HSW-NEXT: retq
1206 ; X64-JAG-LABEL: test_mul_by_73:
1208 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
1209 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax
1210 ; X64-JAG-NEXT: leal (%rdi,%rax,8), %eax
1211 ; X64-JAG-NEXT: retq
1213 ; X86-NOOPT-LABEL: test_mul_by_73:
1214 ; X86-NOOPT: # %bb.0:
1215 ; X86-NOOPT-NEXT: imull $73, {{[0-9]+}}(%esp), %eax
1216 ; X86-NOOPT-NEXT: retl
1218 ; X64-NOOPT-LABEL: test_mul_by_73:
1219 ; X64-NOOPT: # %bb.0:
1220 ; X64-NOOPT-NEXT: imull $73, %edi, %eax
1221 ; X64-NOOPT-NEXT: retq
1223 ; X64-SLM-LABEL: test_mul_by_73:
1225 ; X64-SLM-NEXT: imull $73, %edi, %eax
1226 ; X64-SLM-NEXT: retq
1227 %mul = mul nsw i32 %x, 73
1231 define i32 @test_mul_by_520(i32 %x) {
1232 ; X86-LABEL: test_mul_by_520:
1234 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1235 ; X86-NEXT: movl %eax, %ecx
1236 ; X86-NEXT: shll $9, %ecx
1237 ; X86-NEXT: leal (%ecx,%eax,8), %eax
1240 ; X64-HSW-LABEL: test_mul_by_520:
1242 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
1243 ; X64-HSW-NEXT: movl %edi, %eax
1244 ; X64-HSW-NEXT: shll $9, %eax
1245 ; X64-HSW-NEXT: leal (%rax,%rdi,8), %eax
1246 ; X64-HSW-NEXT: retq
1248 ; X64-JAG-LABEL: test_mul_by_520:
1250 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
1251 ; X64-JAG-NEXT: movl %edi, %eax
1252 ; X64-JAG-NEXT: shll $9, %eax
1253 ; X64-JAG-NEXT: leal (%rax,%rdi,8), %eax
1254 ; X64-JAG-NEXT: retq
1256 ; X86-NOOPT-LABEL: test_mul_by_520:
1257 ; X86-NOOPT: # %bb.0:
1258 ; X86-NOOPT-NEXT: imull $520, {{[0-9]+}}(%esp), %eax # imm = 0x208
1259 ; X86-NOOPT-NEXT: retl
1261 ; X64-NOOPT-LABEL: test_mul_by_520:
1262 ; X64-NOOPT: # %bb.0:
1263 ; X64-NOOPT-NEXT: imull $520, %edi, %eax # imm = 0x208
1264 ; X64-NOOPT-NEXT: retq
1266 ; X64-SLM-LABEL: test_mul_by_520:
1268 ; X64-SLM-NEXT: imull $520, %edi, %eax # imm = 0x208
1269 ; X64-SLM-NEXT: retq
1270 %mul = mul nsw i32 %x, 520
1274 define i32 @test_mul_by_neg10(i32 %x) {
1275 ; X86-LABEL: test_mul_by_neg10:
1277 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1278 ; X86-NEXT: addl %eax, %eax
1279 ; X86-NEXT: leal (%eax,%eax,4), %eax
1280 ; X86-NEXT: negl %eax
1283 ; X64-LABEL: test_mul_by_neg10:
1285 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
1286 ; X64-NEXT: addl %edi, %edi
1287 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
1288 ; X64-NEXT: negl %eax
1291 ; X86-NOOPT-LABEL: test_mul_by_neg10:
1292 ; X86-NOOPT: # %bb.0:
1293 ; X86-NOOPT-NEXT: imull $-10, {{[0-9]+}}(%esp), %eax
1294 ; X86-NOOPT-NEXT: retl
1296 ; X64-NOOPT-LABEL: test_mul_by_neg10:
1297 ; X64-NOOPT: # %bb.0:
1298 ; X64-NOOPT-NEXT: imull $-10, %edi, %eax
1299 ; X64-NOOPT-NEXT: retq
1300 %mul = mul nsw i32 %x, -10
1304 define i32 @test_mul_by_neg36(i32 %x) {
1305 ; X86-LABEL: test_mul_by_neg36:
1307 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1308 ; X86-NEXT: shll $2, %eax
1309 ; X86-NEXT: leal (%eax,%eax,8), %eax
1310 ; X86-NEXT: negl %eax
1313 ; X64-LABEL: test_mul_by_neg36:
1315 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
1316 ; X64-NEXT: shll $2, %edi
1317 ; X64-NEXT: leal (%rdi,%rdi,8), %eax
1318 ; X64-NEXT: negl %eax
1321 ; X86-NOOPT-LABEL: test_mul_by_neg36:
1322 ; X86-NOOPT: # %bb.0:
1323 ; X86-NOOPT-NEXT: imull $-36, {{[0-9]+}}(%esp), %eax
1324 ; X86-NOOPT-NEXT: retl
1326 ; X64-NOOPT-LABEL: test_mul_by_neg36:
1327 ; X64-NOOPT: # %bb.0:
1328 ; X64-NOOPT-NEXT: imull $-36, %edi, %eax
1329 ; X64-NOOPT-NEXT: retq
1330 %mul = mul nsw i32 %x, -36
1335 define i32 @test_mul_spec(i32 %x) nounwind {
1336 ; X86-LABEL: test_mul_spec:
1338 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1339 ; X86-NEXT: leal 42(%eax,%eax,8), %ecx
1340 ; X86-NEXT: leal 2(%eax,%eax,4), %eax
1341 ; X86-NEXT: imull %ecx, %eax
1344 ; X64-HSW-LABEL: test_mul_spec:
1346 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
1347 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %ecx
1348 ; X64-HSW-NEXT: addl $42, %ecx
1349 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax
1350 ; X64-HSW-NEXT: addl $2, %eax
1351 ; X64-HSW-NEXT: imull %ecx, %eax
1352 ; X64-HSW-NEXT: retq
1354 ; X64-JAG-LABEL: test_mul_spec:
1356 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
1357 ; X64-JAG-NEXT: leal 42(%rdi,%rdi,8), %ecx
1358 ; X64-JAG-NEXT: leal 2(%rdi,%rdi,4), %eax
1359 ; X64-JAG-NEXT: imull %ecx, %eax
1360 ; X64-JAG-NEXT: retq
1362 ; X86-NOOPT-LABEL: test_mul_spec:
1363 ; X86-NOOPT: # %bb.0:
1364 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
1365 ; X86-NOOPT-NEXT: leal 42(%eax,%eax,8), %ecx
1366 ; X86-NOOPT-NEXT: leal 2(%eax,%eax,4), %eax
1367 ; X86-NOOPT-NEXT: imull %ecx, %eax
1368 ; X86-NOOPT-NEXT: retl
1370 ; HSW-NOOPT-LABEL: test_mul_spec:
1371 ; HSW-NOOPT: # %bb.0:
1372 ; HSW-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi
1373 ; HSW-NOOPT-NEXT: leal (%rdi,%rdi,8), %ecx
1374 ; HSW-NOOPT-NEXT: addl $42, %ecx
1375 ; HSW-NOOPT-NEXT: leal (%rdi,%rdi,4), %eax
1376 ; HSW-NOOPT-NEXT: addl $2, %eax
1377 ; HSW-NOOPT-NEXT: imull %ecx, %eax
1378 ; HSW-NOOPT-NEXT: retq
1380 ; JAG-NOOPT-LABEL: test_mul_spec:
1381 ; JAG-NOOPT: # %bb.0:
1382 ; JAG-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi
1383 ; JAG-NOOPT-NEXT: leal 42(%rdi,%rdi,8), %ecx
1384 ; JAG-NOOPT-NEXT: leal 2(%rdi,%rdi,4), %eax
1385 ; JAG-NOOPT-NEXT: imull %ecx, %eax
1386 ; JAG-NOOPT-NEXT: retq
1388 ; X64-SLM-LABEL: test_mul_spec:
1390 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi
1391 ; X64-SLM-NEXT: leal 42(%rdi,%rdi,8), %ecx
1392 ; X64-SLM-NEXT: leal 2(%rdi,%rdi,4), %eax
1393 ; X64-SLM-NEXT: imull %ecx, %eax
1394 ; X64-SLM-NEXT: retq
1396 ; SLM-NOOPT-LABEL: test_mul_spec:
1397 ; SLM-NOOPT: # %bb.0:
1398 ; SLM-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi
1399 ; SLM-NOOPT-NEXT: leal 42(%rdi,%rdi,8), %ecx
1400 ; SLM-NOOPT-NEXT: leal 2(%rdi,%rdi,4), %eax
1401 ; SLM-NOOPT-NEXT: imull %ecx, %eax
1402 ; SLM-NOOPT-NEXT: retq
1403 %mul = mul nsw i32 %x, 9
1404 %add = add nsw i32 %mul, 42
1405 %mul2 = mul nsw i32 %x, 5
1406 %add2 = add nsw i32 %mul2, 2
1407 %mul3 = mul nsw i32 %add, %add2
1411 ; This makes sure we are able to fold the negate generated by the mul expansion
1412 ; into the next instruction.
1413 ; FIXME: We make this work.
1414 define i32 @mul_neg_fold(i32 %a, i32 %b) {
1415 ; X86-LABEL: mul_neg_fold:
1417 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1418 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1419 ; X86-NEXT: leal (%ecx,%ecx,8), %ecx
1420 ; X86-NEXT: subl %ecx, %eax
1423 ; X64-HSW-LABEL: mul_neg_fold:
1425 ; X64-HSW-NEXT: movl %esi, %eax
1426 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi
1427 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %ecx
1428 ; X64-HSW-NEXT: subl %ecx, %eax
1429 ; X64-HSW-NEXT: retq
1431 ; X64-JAG-LABEL: mul_neg_fold:
1433 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi
1434 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %ecx
1435 ; X64-JAG-NEXT: movl %esi, %eax
1436 ; X64-JAG-NEXT: subl %ecx, %eax
1437 ; X64-JAG-NEXT: retq
1439 ; X86-NOOPT-LABEL: mul_neg_fold:
1440 ; X86-NOOPT: # %bb.0:
1441 ; X86-NOOPT-NEXT: imull $-9, {{[0-9]+}}(%esp), %eax
1442 ; X86-NOOPT-NEXT: addl {{[0-9]+}}(%esp), %eax
1443 ; X86-NOOPT-NEXT: retl
1445 ; X64-NOOPT-LABEL: mul_neg_fold:
1446 ; X64-NOOPT: # %bb.0:
1447 ; X64-NOOPT-NEXT: imull $-9, %edi, %eax
1448 ; X64-NOOPT-NEXT: addl %esi, %eax
1449 ; X64-NOOPT-NEXT: retq
1451 ; X64-SLM-LABEL: mul_neg_fold:
1453 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi
1454 ; X64-SLM-NEXT: movl %esi, %eax
1455 ; X64-SLM-NEXT: leal (%rdi,%rdi,8), %ecx
1456 ; X64-SLM-NEXT: subl %ecx, %eax
1457 ; X64-SLM-NEXT: retq