1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s --check-prefixes=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=haswell | FileCheck %s --check-prefixes=X64-OPT,X64-HSW
4 ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=btver2 | FileCheck %s --check-prefixes=X64-OPT,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-OPT,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 i64 @test_mul_by_1(i64 %x) nounwind {
12 ; X86-LABEL: test_mul_by_1:
14 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
15 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
18 ; X64-OPT-LABEL: test_mul_by_1:
20 ; X64-OPT-NEXT: movq %rdi, %rax
23 ; X86-NOOPT-LABEL: test_mul_by_1:
25 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
26 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
27 ; X86-NOOPT-NEXT: retl
29 ; X64-NOOPT-LABEL: test_mul_by_1:
31 ; X64-NOOPT-NEXT: movq %rdi, %rax
32 ; X64-NOOPT-NEXT: retq
33 ; X86-OPT-LABEL: test_mul_by_1:
35 ; X86-OPT-NEXT: movq %rdi, %rax
37 %mul = mul nsw i64 %x, 1
41 define i64 @test_mul_by_2(i64 %x) {
42 ; X86-LABEL: test_mul_by_2:
44 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
45 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
46 ; X86-NEXT: shldl $1, %eax, %edx
47 ; X86-NEXT: addl %eax, %eax
50 ; X64-OPT-LABEL: test_mul_by_2:
52 ; X64-OPT-NEXT: leaq (%rdi,%rdi), %rax
55 ; X86-NOOPT-LABEL: test_mul_by_2:
57 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
58 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
59 ; X86-NOOPT-NEXT: shldl $1, %eax, %edx
60 ; X86-NOOPT-NEXT: addl %eax, %eax
61 ; X86-NOOPT-NEXT: retl
63 ; X64-NOOPT-LABEL: test_mul_by_2:
65 ; X64-NOOPT-NEXT: leaq (%rdi,%rdi), %rax
66 ; X64-NOOPT-NEXT: retq
67 ; X86-OPT-LABEL: test_mul_by_2:
69 ; X86-OPT-NEXT: leaq (%rdi,%rdi), %rax
71 %mul = mul nsw i64 %x, 2
75 define i64 @test_mul_by_3(i64 %x) {
76 ; X86-LABEL: test_mul_by_3:
78 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
79 ; X86-NEXT: leal (%eax,%eax,2), %ecx
80 ; X86-NEXT: movl $3, %eax
81 ; X86-NEXT: mull {{[0-9]+}}(%esp)
82 ; X86-NEXT: addl %ecx, %edx
85 ; X64-OPT-LABEL: test_mul_by_3:
87 ; X64-OPT-NEXT: leaq (%rdi,%rdi,2), %rax
90 ; X86-NOOPT-LABEL: test_mul_by_3:
92 ; X86-NOOPT-NEXT: movl $3, %eax
93 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
94 ; X86-NOOPT-NEXT: imull $3, {{[0-9]+}}(%esp), %ecx
95 ; X86-NOOPT-NEXT: addl %ecx, %edx
96 ; X86-NOOPT-NEXT: retl
98 ; X64-NOOPT-LABEL: test_mul_by_3:
100 ; X64-NOOPT-NEXT: leaq (%rdi,%rdi,2), %rax
101 ; X64-NOOPT-NEXT: retq
102 ; X86-OPT-LABEL: test_mul_by_3:
104 ; X86-OPT-NEXT: leaq (%rdi,%rdi,2), %rax
106 %mul = mul nsw i64 %x, 3
110 define i64 @test_mul_by_4(i64 %x) {
111 ; X86-LABEL: test_mul_by_4:
113 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
114 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
115 ; X86-NEXT: shldl $2, %eax, %edx
116 ; X86-NEXT: shll $2, %eax
119 ; X64-OPT-LABEL: test_mul_by_4:
121 ; X64-OPT-NEXT: leaq (,%rdi,4), %rax
124 ; X86-NOOPT-LABEL: test_mul_by_4:
125 ; X86-NOOPT: # %bb.0:
126 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
127 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
128 ; X86-NOOPT-NEXT: shldl $2, %eax, %edx
129 ; X86-NOOPT-NEXT: shll $2, %eax
130 ; X86-NOOPT-NEXT: retl
132 ; X64-NOOPT-LABEL: test_mul_by_4:
133 ; X64-NOOPT: # %bb.0:
134 ; X64-NOOPT-NEXT: leaq (,%rdi,4), %rax
135 ; X64-NOOPT-NEXT: retq
136 ; X86-OPT-LABEL: test_mul_by_4:
138 ; X86-OPT-NEXT: leaq (,%rdi,4), %rax
140 %mul = mul nsw i64 %x, 4
144 define i64 @test_mul_by_5(i64 %x) {
145 ; X86-LABEL: test_mul_by_5:
147 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
148 ; X86-NEXT: leal (%eax,%eax,4), %ecx
149 ; X86-NEXT: movl $5, %eax
150 ; X86-NEXT: mull {{[0-9]+}}(%esp)
151 ; X86-NEXT: addl %ecx, %edx
154 ; X64-OPT-LABEL: test_mul_by_5:
156 ; X64-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
159 ; X86-NOOPT-LABEL: test_mul_by_5:
160 ; X86-NOOPT: # %bb.0:
161 ; X86-NOOPT-NEXT: movl $5, %eax
162 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
163 ; X86-NOOPT-NEXT: imull $5, {{[0-9]+}}(%esp), %ecx
164 ; X86-NOOPT-NEXT: addl %ecx, %edx
165 ; X86-NOOPT-NEXT: retl
167 ; X64-NOOPT-LABEL: test_mul_by_5:
168 ; X64-NOOPT: # %bb.0:
169 ; X64-NOOPT-NEXT: leaq (%rdi,%rdi,4), %rax
170 ; X64-NOOPT-NEXT: retq
171 ; X86-OPT-LABEL: test_mul_by_5:
173 ; X86-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
175 %mul = mul nsw i64 %x, 5
179 define i64 @test_mul_by_6(i64 %x) {
180 ; X86-LABEL: test_mul_by_6:
182 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
183 ; X86-NEXT: leal (%eax,%eax,2), %ecx
184 ; X86-NEXT: movl $6, %eax
185 ; X86-NEXT: mull {{[0-9]+}}(%esp)
186 ; X86-NEXT: leal (%edx,%ecx,2), %edx
189 ; X64-OPT-LABEL: test_mul_by_6:
191 ; X64-OPT-NEXT: addq %rdi, %rdi
192 ; X64-OPT-NEXT: leaq (%rdi,%rdi,2), %rax
195 ; X86-NOOPT-LABEL: test_mul_by_6:
196 ; X86-NOOPT: # %bb.0:
197 ; X86-NOOPT-NEXT: movl $6, %eax
198 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
199 ; X86-NOOPT-NEXT: imull $6, {{[0-9]+}}(%esp), %ecx
200 ; X86-NOOPT-NEXT: addl %ecx, %edx
201 ; X86-NOOPT-NEXT: retl
203 ; X64-NOOPT-LABEL: test_mul_by_6:
204 ; X64-NOOPT: # %bb.0:
205 ; X64-NOOPT-NEXT: imulq $6, %rdi, %rax
206 ; X64-NOOPT-NEXT: retq
207 ; X86-OPT-LABEL: test_mul_by_6:
209 ; X86-OPT-NEXT: addq %rdi, %rdi
210 ; X86-OPT-NEXT: leaq (%rdi,%rdi,2), %rax
212 %mul = mul nsw i64 %x, 6
216 define i64 @test_mul_by_7(i64 %x) {
217 ; X86-LABEL: test_mul_by_7:
219 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
220 ; X86-NEXT: leal (,%eax,8), %ecx
221 ; X86-NEXT: subl %eax, %ecx
222 ; X86-NEXT: movl $7, %eax
223 ; X86-NEXT: mull {{[0-9]+}}(%esp)
224 ; X86-NEXT: addl %ecx, %edx
227 ; X64-OPT-LABEL: test_mul_by_7:
229 ; X64-OPT-NEXT: leaq (,%rdi,8), %rax
230 ; X64-OPT-NEXT: subq %rdi, %rax
233 ; X86-NOOPT-LABEL: test_mul_by_7:
234 ; X86-NOOPT: # %bb.0:
235 ; X86-NOOPT-NEXT: movl $7, %eax
236 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
237 ; X86-NOOPT-NEXT: imull $7, {{[0-9]+}}(%esp), %ecx
238 ; X86-NOOPT-NEXT: addl %ecx, %edx
239 ; X86-NOOPT-NEXT: retl
241 ; X64-NOOPT-LABEL: test_mul_by_7:
242 ; X64-NOOPT: # %bb.0:
243 ; X64-NOOPT-NEXT: imulq $7, %rdi, %rax
244 ; X64-NOOPT-NEXT: retq
245 ; X86-OPT-LABEL: test_mul_by_7:
247 ; X86-OPT-NEXT: leaq (,%rdi,8), %rax
248 ; X86-OPT-NEXT: subq %rdi, %rax
250 %mul = mul nsw i64 %x, 7
254 define i64 @test_mul_by_8(i64 %x) {
255 ; X86-LABEL: test_mul_by_8:
257 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
258 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
259 ; X86-NEXT: shldl $3, %eax, %edx
260 ; X86-NEXT: shll $3, %eax
263 ; X64-OPT-LABEL: test_mul_by_8:
265 ; X64-OPT-NEXT: leaq (,%rdi,8), %rax
268 ; X86-NOOPT-LABEL: test_mul_by_8:
269 ; X86-NOOPT: # %bb.0:
270 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
271 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
272 ; X86-NOOPT-NEXT: shldl $3, %eax, %edx
273 ; X86-NOOPT-NEXT: shll $3, %eax
274 ; X86-NOOPT-NEXT: retl
276 ; X64-NOOPT-LABEL: test_mul_by_8:
277 ; X64-NOOPT: # %bb.0:
278 ; X64-NOOPT-NEXT: leaq (,%rdi,8), %rax
279 ; X64-NOOPT-NEXT: retq
280 ; X86-OPT-LABEL: test_mul_by_8:
282 ; X86-OPT-NEXT: leaq (,%rdi,8), %rax
284 %mul = mul nsw i64 %x, 8
288 define i64 @test_mul_by_9(i64 %x) {
289 ; X86-LABEL: test_mul_by_9:
291 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
292 ; X86-NEXT: leal (%eax,%eax,8), %ecx
293 ; X86-NEXT: movl $9, %eax
294 ; X86-NEXT: mull {{[0-9]+}}(%esp)
295 ; X86-NEXT: addl %ecx, %edx
298 ; X64-OPT-LABEL: test_mul_by_9:
300 ; X64-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
303 ; X86-NOOPT-LABEL: test_mul_by_9:
304 ; X86-NOOPT: # %bb.0:
305 ; X86-NOOPT-NEXT: movl $9, %eax
306 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
307 ; X86-NOOPT-NEXT: imull $9, {{[0-9]+}}(%esp), %ecx
308 ; X86-NOOPT-NEXT: addl %ecx, %edx
309 ; X86-NOOPT-NEXT: retl
311 ; X64-NOOPT-LABEL: test_mul_by_9:
312 ; X64-NOOPT: # %bb.0:
313 ; X64-NOOPT-NEXT: leaq (%rdi,%rdi,8), %rax
314 ; X64-NOOPT-NEXT: retq
315 ; X86-OPT-LABEL: test_mul_by_9:
317 ; X86-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
319 %mul = mul nsw i64 %x, 9
323 define i64 @test_mul_by_10(i64 %x) {
324 ; X86-LABEL: test_mul_by_10:
326 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
327 ; X86-NEXT: leal (%eax,%eax,4), %ecx
328 ; X86-NEXT: movl $10, %eax
329 ; X86-NEXT: mull {{[0-9]+}}(%esp)
330 ; X86-NEXT: leal (%edx,%ecx,2), %edx
333 ; X64-OPT-LABEL: test_mul_by_10:
335 ; X64-OPT-NEXT: addq %rdi, %rdi
336 ; X64-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
339 ; X86-NOOPT-LABEL: test_mul_by_10:
340 ; X86-NOOPT: # %bb.0:
341 ; X86-NOOPT-NEXT: movl $10, %eax
342 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
343 ; X86-NOOPT-NEXT: imull $10, {{[0-9]+}}(%esp), %ecx
344 ; X86-NOOPT-NEXT: addl %ecx, %edx
345 ; X86-NOOPT-NEXT: retl
347 ; X64-NOOPT-LABEL: test_mul_by_10:
348 ; X64-NOOPT: # %bb.0:
349 ; X64-NOOPT-NEXT: imulq $10, %rdi, %rax
350 ; X64-NOOPT-NEXT: retq
351 ; X86-OPT-LABEL: test_mul_by_10:
353 ; X86-OPT-NEXT: addq %rdi, %rdi
354 ; X86-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
356 %mul = mul nsw i64 %x, 10
360 define i64 @test_mul_by_11(i64 %x) {
361 ; X86-LABEL: test_mul_by_11:
363 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
364 ; X86-NEXT: leal (%eax,%eax,4), %ecx
365 ; X86-NEXT: leal (%eax,%ecx,2), %ecx
366 ; X86-NEXT: movl $11, %eax
367 ; X86-NEXT: mull {{[0-9]+}}(%esp)
368 ; X86-NEXT: addl %ecx, %edx
371 ; X64-HSW-LABEL: test_mul_by_11:
373 ; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax
374 ; X64-HSW-NEXT: leaq (%rdi,%rax,2), %rax
377 ; X64-JAG-LABEL: test_mul_by_11:
379 ; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax
380 ; X64-JAG-NEXT: leaq (%rdi,%rax,2), %rax
383 ; X86-NOOPT-LABEL: test_mul_by_11:
384 ; X86-NOOPT: # %bb.0:
385 ; X86-NOOPT-NEXT: movl $11, %eax
386 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
387 ; X86-NOOPT-NEXT: imull $11, {{[0-9]+}}(%esp), %ecx
388 ; X86-NOOPT-NEXT: addl %ecx, %edx
389 ; X86-NOOPT-NEXT: retl
391 ; X64-NOOPT-LABEL: test_mul_by_11:
392 ; X64-NOOPT: # %bb.0:
393 ; X64-NOOPT-NEXT: imulq $11, %rdi, %rax
394 ; X64-NOOPT-NEXT: retq
396 ; X64-SLM-LABEL: test_mul_by_11:
398 ; X64-SLM-NEXT: imulq $11, %rdi, %rax
400 ; X86-OPT-LABEL: test_mul_by_11:
402 ; X86-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
403 ; X86-OPT-NEXT: leaq (%rdi,%rax,2), %rax
405 %mul = mul nsw i64 %x, 11
409 define i64 @test_mul_by_12(i64 %x) {
410 ; X86-LABEL: test_mul_by_12:
412 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
413 ; X86-NEXT: leal (%eax,%eax,2), %ecx
414 ; X86-NEXT: movl $12, %eax
415 ; X86-NEXT: mull {{[0-9]+}}(%esp)
416 ; X86-NEXT: leal (%edx,%ecx,4), %edx
419 ; X64-OPT-LABEL: test_mul_by_12:
421 ; X64-OPT-NEXT: shlq $2, %rdi
422 ; X64-OPT-NEXT: leaq (%rdi,%rdi,2), %rax
425 ; X86-NOOPT-LABEL: test_mul_by_12:
426 ; X86-NOOPT: # %bb.0:
427 ; X86-NOOPT-NEXT: movl $12, %eax
428 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
429 ; X86-NOOPT-NEXT: imull $12, {{[0-9]+}}(%esp), %ecx
430 ; X86-NOOPT-NEXT: addl %ecx, %edx
431 ; X86-NOOPT-NEXT: retl
433 ; X64-NOOPT-LABEL: test_mul_by_12:
434 ; X64-NOOPT: # %bb.0:
435 ; X64-NOOPT-NEXT: imulq $12, %rdi, %rax
436 ; X64-NOOPT-NEXT: retq
437 ; X86-OPT-LABEL: test_mul_by_12:
439 ; X86-OPT-NEXT: shlq $2, %rdi
440 ; X86-OPT-NEXT: leaq (%rdi,%rdi,2), %rax
442 %mul = mul nsw i64 %x, 12
446 define i64 @test_mul_by_13(i64 %x) {
447 ; X86-LABEL: test_mul_by_13:
449 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
450 ; X86-NEXT: leal (%eax,%eax,2), %ecx
451 ; X86-NEXT: leal (%eax,%ecx,4), %ecx
452 ; X86-NEXT: movl $13, %eax
453 ; X86-NEXT: mull {{[0-9]+}}(%esp)
454 ; X86-NEXT: addl %ecx, %edx
457 ; X64-HSW-LABEL: test_mul_by_13:
459 ; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax
460 ; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax
463 ; X64-JAG-LABEL: test_mul_by_13:
465 ; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax
466 ; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax
469 ; X86-NOOPT-LABEL: test_mul_by_13:
470 ; X86-NOOPT: # %bb.0:
471 ; X86-NOOPT-NEXT: movl $13, %eax
472 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
473 ; X86-NOOPT-NEXT: imull $13, {{[0-9]+}}(%esp), %ecx
474 ; X86-NOOPT-NEXT: addl %ecx, %edx
475 ; X86-NOOPT-NEXT: retl
477 ; X64-NOOPT-LABEL: test_mul_by_13:
478 ; X64-NOOPT: # %bb.0:
479 ; X64-NOOPT-NEXT: imulq $13, %rdi, %rax
480 ; X64-NOOPT-NEXT: retq
482 ; X64-SLM-LABEL: test_mul_by_13:
484 ; X64-SLM-NEXT: imulq $13, %rdi, %rax
486 ; X86-OPT-LABEL: test_mul_by_13:
488 ; X86-OPT-NEXT: leaq (%rdi,%rdi,2), %rax
489 ; X86-OPT-NEXT: leaq (%rdi,%rax,4), %rax
491 %mul = mul nsw i64 %x, 13
495 define i64 @test_mul_by_14(i64 %x) {
496 ; X86-LABEL: test_mul_by_14:
498 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
499 ; X86-NEXT: movl %eax, %ecx
500 ; X86-NEXT: shll $4, %ecx
501 ; X86-NEXT: subl %eax, %ecx
502 ; X86-NEXT: subl %eax, %ecx
503 ; X86-NEXT: movl $14, %eax
504 ; X86-NEXT: mull {{[0-9]+}}(%esp)
505 ; X86-NEXT: addl %ecx, %edx
508 ; X64-OPT-LABEL: test_mul_by_14:
510 ; X64-OPT-NEXT: movq %rdi, %rax
511 ; X64-OPT-NEXT: shlq $4, %rax
512 ; X64-OPT-NEXT: subq %rdi, %rax
513 ; X64-OPT-NEXT: subq %rdi, %rax
516 ; X86-NOOPT-LABEL: test_mul_by_14:
517 ; X86-NOOPT: # %bb.0:
518 ; X86-NOOPT-NEXT: movl $14, %eax
519 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
520 ; X86-NOOPT-NEXT: imull $14, {{[0-9]+}}(%esp), %ecx
521 ; X86-NOOPT-NEXT: addl %ecx, %edx
522 ; X86-NOOPT-NEXT: retl
524 ; X64-NOOPT-LABEL: test_mul_by_14:
525 ; X64-NOOPT: # %bb.0:
526 ; X64-NOOPT-NEXT: imulq $14, %rdi, %rax
527 ; X64-NOOPT-NEXT: retq
528 ; X86-OPT-LABEL: test_mul_by_14:
530 ; X86-OPT-NEXT: movq %rdi, %rax
531 ; X86-OPT-NEXT: shlq $4, %rax
532 ; X86-OPT-NEXT: subq %rdi, %rax
533 ; X86-OPT-NEXT: subq %rdi, %rax
535 %mul = mul nsw i64 %x, 14
539 define i64 @test_mul_by_15(i64 %x) {
540 ; X86-LABEL: test_mul_by_15:
542 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
543 ; X86-NEXT: movl $15, %eax
544 ; X86-NEXT: mull {{[0-9]+}}(%esp)
545 ; X86-NEXT: leal (%ecx,%ecx,4), %ecx
546 ; X86-NEXT: leal (%ecx,%ecx,2), %ecx
547 ; X86-NEXT: addl %ecx, %edx
550 ; X64-OPT-LABEL: test_mul_by_15:
552 ; X64-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
553 ; X64-OPT-NEXT: leaq (%rax,%rax,2), %rax
556 ; X86-NOOPT-LABEL: test_mul_by_15:
557 ; X86-NOOPT: # %bb.0:
558 ; X86-NOOPT-NEXT: movl $15, %eax
559 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
560 ; X86-NOOPT-NEXT: imull $15, {{[0-9]+}}(%esp), %ecx
561 ; X86-NOOPT-NEXT: addl %ecx, %edx
562 ; X86-NOOPT-NEXT: retl
564 ; X64-NOOPT-LABEL: test_mul_by_15:
565 ; X64-NOOPT: # %bb.0:
566 ; X64-NOOPT-NEXT: imulq $15, %rdi, %rax
567 ; X64-NOOPT-NEXT: retq
568 ; X86-OPT-LABEL: test_mul_by_15:
570 ; X86-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
571 ; X86-OPT-NEXT: leaq (%rax,%rax,2), %rax
573 %mul = mul nsw i64 %x, 15
577 define i64 @test_mul_by_16(i64 %x) {
578 ; X86-LABEL: test_mul_by_16:
580 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
581 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
582 ; X86-NEXT: shldl $4, %eax, %edx
583 ; X86-NEXT: shll $4, %eax
586 ; X64-OPT-LABEL: test_mul_by_16:
588 ; X64-OPT-NEXT: movq %rdi, %rax
589 ; X64-OPT-NEXT: shlq $4, %rax
592 ; X86-NOOPT-LABEL: test_mul_by_16:
593 ; X86-NOOPT: # %bb.0:
594 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
595 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
596 ; X86-NOOPT-NEXT: shldl $4, %eax, %edx
597 ; X86-NOOPT-NEXT: shll $4, %eax
598 ; X86-NOOPT-NEXT: retl
600 ; X64-NOOPT-LABEL: test_mul_by_16:
601 ; X64-NOOPT: # %bb.0:
602 ; X64-NOOPT-NEXT: movq %rdi, %rax
603 ; X64-NOOPT-NEXT: shlq $4, %rax
604 ; X64-NOOPT-NEXT: retq
605 ; X86-OPT-LABEL: test_mul_by_16:
607 ; X86-OPT-NEXT: movq %rdi, %rax
608 ; X86-OPT-NEXT: shlq $4, %rax
610 %mul = mul nsw i64 %x, 16
614 define i64 @test_mul_by_17(i64 %x) {
615 ; X86-LABEL: test_mul_by_17:
617 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
618 ; X86-NEXT: movl %eax, %ecx
619 ; X86-NEXT: shll $4, %ecx
620 ; X86-NEXT: addl %eax, %ecx
621 ; X86-NEXT: movl $17, %eax
622 ; X86-NEXT: mull {{[0-9]+}}(%esp)
623 ; X86-NEXT: addl %ecx, %edx
626 ; X64-HSW-LABEL: test_mul_by_17:
628 ; X64-HSW-NEXT: movq %rdi, %rax
629 ; X64-HSW-NEXT: shlq $4, %rax
630 ; X64-HSW-NEXT: leaq (%rax,%rdi), %rax
633 ; X64-JAG-LABEL: test_mul_by_17:
635 ; X64-JAG-NEXT: movq %rdi, %rax
636 ; X64-JAG-NEXT: shlq $4, %rax
637 ; X64-JAG-NEXT: leaq (%rax,%rdi), %rax
640 ; X86-NOOPT-LABEL: test_mul_by_17:
641 ; X86-NOOPT: # %bb.0:
642 ; X86-NOOPT-NEXT: movl $17, %eax
643 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
644 ; X86-NOOPT-NEXT: imull $17, {{[0-9]+}}(%esp), %ecx
645 ; X86-NOOPT-NEXT: addl %ecx, %edx
646 ; X86-NOOPT-NEXT: retl
648 ; X64-NOOPT-LABEL: test_mul_by_17:
649 ; X64-NOOPT: # %bb.0:
650 ; X64-NOOPT-NEXT: imulq $17, %rdi, %rax
651 ; X64-NOOPT-NEXT: retq
653 ; X64-SLM-LABEL: test_mul_by_17:
655 ; X64-SLM-NEXT: movq %rdi, %rax
656 ; X64-SLM-NEXT: shlq $4, %rax
657 ; X64-SLM-NEXT: addq %rdi, %rax
659 ; X86-OPT-LABEL: test_mul_by_17:
661 ; X86-OPT-NEXT: movq %rdi, %rax
662 ; X86-OPT-NEXT: shlq $4, %rax
663 ; X86-OPT-NEXT: leaq (%rax,%rdi), %rax
665 %mul = mul nsw i64 %x, 17
669 define i64 @test_mul_by_18(i64 %x) {
670 ; X86-LABEL: test_mul_by_18:
672 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
673 ; X86-NEXT: leal (%eax,%eax,8), %ecx
674 ; X86-NEXT: movl $18, %eax
675 ; X86-NEXT: mull {{[0-9]+}}(%esp)
676 ; X86-NEXT: leal (%edx,%ecx,2), %edx
679 ; X64-OPT-LABEL: test_mul_by_18:
681 ; X64-OPT-NEXT: addq %rdi, %rdi
682 ; X64-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
685 ; X86-NOOPT-LABEL: test_mul_by_18:
686 ; X86-NOOPT: # %bb.0:
687 ; X86-NOOPT-NEXT: movl $18, %eax
688 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
689 ; X86-NOOPT-NEXT: imull $18, {{[0-9]+}}(%esp), %ecx
690 ; X86-NOOPT-NEXT: addl %ecx, %edx
691 ; X86-NOOPT-NEXT: retl
693 ; X64-NOOPT-LABEL: test_mul_by_18:
694 ; X64-NOOPT: # %bb.0:
695 ; X64-NOOPT-NEXT: imulq $18, %rdi, %rax
696 ; X64-NOOPT-NEXT: retq
697 ; X86-OPT-LABEL: test_mul_by_18:
699 ; X86-OPT-NEXT: addq %rdi, %rdi
700 ; X86-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
702 %mul = mul nsw i64 %x, 18
706 define i64 @test_mul_by_19(i64 %x) {
707 ; X86-LABEL: test_mul_by_19:
709 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
710 ; X86-NEXT: leal (%eax,%eax,8), %ecx
711 ; X86-NEXT: leal (%eax,%ecx,2), %ecx
712 ; X86-NEXT: movl $19, %eax
713 ; X86-NEXT: mull {{[0-9]+}}(%esp)
714 ; X86-NEXT: addl %ecx, %edx
717 ; X64-HSW-LABEL: test_mul_by_19:
719 ; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax
720 ; X64-HSW-NEXT: leaq (%rdi,%rax,2), %rax
723 ; X64-JAG-LABEL: test_mul_by_19:
725 ; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax
726 ; X64-JAG-NEXT: leaq (%rdi,%rax,2), %rax
729 ; X86-NOOPT-LABEL: test_mul_by_19:
730 ; X86-NOOPT: # %bb.0:
731 ; X86-NOOPT-NEXT: movl $19, %eax
732 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
733 ; X86-NOOPT-NEXT: imull $19, {{[0-9]+}}(%esp), %ecx
734 ; X86-NOOPT-NEXT: addl %ecx, %edx
735 ; X86-NOOPT-NEXT: retl
737 ; X64-NOOPT-LABEL: test_mul_by_19:
738 ; X64-NOOPT: # %bb.0:
739 ; X64-NOOPT-NEXT: imulq $19, %rdi, %rax
740 ; X64-NOOPT-NEXT: retq
742 ; X64-SLM-LABEL: test_mul_by_19:
744 ; X64-SLM-NEXT: imulq $19, %rdi, %rax
746 ; X86-OPT-LABEL: test_mul_by_19:
748 ; X86-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
749 ; X86-OPT-NEXT: leaq (%rdi,%rax,2), %rax
751 %mul = mul nsw i64 %x, 19
755 define i64 @test_mul_by_20(i64 %x) {
756 ; X86-LABEL: test_mul_by_20:
758 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
759 ; X86-NEXT: leal (%eax,%eax,4), %ecx
760 ; X86-NEXT: movl $20, %eax
761 ; X86-NEXT: mull {{[0-9]+}}(%esp)
762 ; X86-NEXT: leal (%edx,%ecx,4), %edx
765 ; X64-OPT-LABEL: test_mul_by_20:
767 ; X64-OPT-NEXT: shlq $2, %rdi
768 ; X64-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
771 ; X86-NOOPT-LABEL: test_mul_by_20:
772 ; X86-NOOPT: # %bb.0:
773 ; X86-NOOPT-NEXT: movl $20, %eax
774 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
775 ; X86-NOOPT-NEXT: imull $20, {{[0-9]+}}(%esp), %ecx
776 ; X86-NOOPT-NEXT: addl %ecx, %edx
777 ; X86-NOOPT-NEXT: retl
779 ; X64-NOOPT-LABEL: test_mul_by_20:
780 ; X64-NOOPT: # %bb.0:
781 ; X64-NOOPT-NEXT: imulq $20, %rdi, %rax
782 ; X64-NOOPT-NEXT: retq
783 ; X86-OPT-LABEL: test_mul_by_20:
785 ; X86-OPT-NEXT: shlq $2, %rdi
786 ; X86-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
788 %mul = mul nsw i64 %x, 20
792 define i64 @test_mul_by_21(i64 %x) {
793 ; X86-LABEL: test_mul_by_21:
795 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
796 ; X86-NEXT: leal (%eax,%eax,4), %ecx
797 ; X86-NEXT: leal (%eax,%ecx,4), %ecx
798 ; X86-NEXT: movl $21, %eax
799 ; X86-NEXT: mull {{[0-9]+}}(%esp)
800 ; X86-NEXT: addl %ecx, %edx
803 ; X64-HSW-LABEL: test_mul_by_21:
805 ; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax
806 ; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax
809 ; X64-JAG-LABEL: test_mul_by_21:
811 ; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax
812 ; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax
815 ; X86-NOOPT-LABEL: test_mul_by_21:
816 ; X86-NOOPT: # %bb.0:
817 ; X86-NOOPT-NEXT: movl $21, %eax
818 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
819 ; X86-NOOPT-NEXT: imull $21, {{[0-9]+}}(%esp), %ecx
820 ; X86-NOOPT-NEXT: addl %ecx, %edx
821 ; X86-NOOPT-NEXT: retl
823 ; X64-NOOPT-LABEL: test_mul_by_21:
824 ; X64-NOOPT: # %bb.0:
825 ; X64-NOOPT-NEXT: imulq $21, %rdi, %rax
826 ; X64-NOOPT-NEXT: retq
828 ; X64-SLM-LABEL: test_mul_by_21:
830 ; X64-SLM-NEXT: imulq $21, %rdi, %rax
832 ; X86-OPT-LABEL: test_mul_by_21:
834 ; X86-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
835 ; X86-OPT-NEXT: leaq (%rdi,%rax,4), %rax
837 %mul = mul nsw i64 %x, 21
841 define i64 @test_mul_by_22(i64 %x) {
842 ; X86-LABEL: test_mul_by_22:
844 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
845 ; X86-NEXT: leal (%eax,%eax,4), %ecx
846 ; X86-NEXT: leal (%eax,%ecx,4), %ecx
847 ; X86-NEXT: addl %eax, %ecx
848 ; X86-NEXT: movl $22, %eax
849 ; X86-NEXT: mull {{[0-9]+}}(%esp)
850 ; X86-NEXT: addl %ecx, %edx
853 ; X64-HSW-LABEL: test_mul_by_22:
855 ; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax
856 ; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax
857 ; X64-HSW-NEXT: addq %rdi, %rax
860 ; X64-JAG-LABEL: test_mul_by_22:
862 ; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax
863 ; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax
864 ; X64-JAG-NEXT: addq %rdi, %rax
867 ; X86-NOOPT-LABEL: test_mul_by_22:
868 ; X86-NOOPT: # %bb.0:
869 ; X86-NOOPT-NEXT: movl $22, %eax
870 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
871 ; X86-NOOPT-NEXT: imull $22, {{[0-9]+}}(%esp), %ecx
872 ; X86-NOOPT-NEXT: addl %ecx, %edx
873 ; X86-NOOPT-NEXT: retl
875 ; X64-NOOPT-LABEL: test_mul_by_22:
876 ; X64-NOOPT: # %bb.0:
877 ; X64-NOOPT-NEXT: imulq $22, %rdi, %rax
878 ; X64-NOOPT-NEXT: retq
880 ; X64-SLM-LABEL: test_mul_by_22:
882 ; X64-SLM-NEXT: imulq $22, %rdi, %rax
884 ; X86-OPT-LABEL: test_mul_by_22:
886 ; X86-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
887 ; X86-OPT-NEXT: leaq (%rdi,%rax,4), %rax
888 ; X86-OPT-NEXT: addq %rdi, %rax
890 %mul = mul nsw i64 %x, 22
894 define i64 @test_mul_by_23(i64 %x) {
895 ; X86-LABEL: test_mul_by_23:
897 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
898 ; X86-NEXT: leal (%eax,%eax,2), %ecx
899 ; X86-NEXT: shll $3, %ecx
900 ; X86-NEXT: subl %eax, %ecx
901 ; X86-NEXT: movl $23, %eax
902 ; X86-NEXT: mull {{[0-9]+}}(%esp)
903 ; X86-NEXT: addl %ecx, %edx
906 ; X64-HSW-LABEL: test_mul_by_23:
908 ; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax
909 ; X64-HSW-NEXT: shlq $3, %rax
910 ; X64-HSW-NEXT: subq %rdi, %rax
913 ; X64-JAG-LABEL: test_mul_by_23:
915 ; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax
916 ; X64-JAG-NEXT: shlq $3, %rax
917 ; X64-JAG-NEXT: subq %rdi, %rax
920 ; X86-NOOPT-LABEL: test_mul_by_23:
921 ; X86-NOOPT: # %bb.0:
922 ; X86-NOOPT-NEXT: movl $23, %eax
923 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
924 ; X86-NOOPT-NEXT: imull $23, {{[0-9]+}}(%esp), %ecx
925 ; X86-NOOPT-NEXT: addl %ecx, %edx
926 ; X86-NOOPT-NEXT: retl
928 ; X64-NOOPT-LABEL: test_mul_by_23:
929 ; X64-NOOPT: # %bb.0:
930 ; X64-NOOPT-NEXT: imulq $23, %rdi, %rax
931 ; X64-NOOPT-NEXT: retq
933 ; X64-SLM-LABEL: test_mul_by_23:
935 ; X64-SLM-NEXT: imulq $23, %rdi, %rax
937 ; X86-OPT-LABEL: test_mul_by_23:
939 ; X86-OPT-NEXT: leaq (%rdi,%rdi,2), %rax
940 ; X86-OPT-NEXT: shlq $3, %rax
941 ; X86-OPT-NEXT: subq %rdi, %rax
943 %mul = mul nsw i64 %x, 23
947 define i64 @test_mul_by_24(i64 %x) {
948 ; X86-LABEL: test_mul_by_24:
950 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
951 ; X86-NEXT: leal (%eax,%eax,2), %ecx
952 ; X86-NEXT: movl $24, %eax
953 ; X86-NEXT: mull {{[0-9]+}}(%esp)
954 ; X86-NEXT: leal (%edx,%ecx,8), %edx
957 ; X64-OPT-LABEL: test_mul_by_24:
959 ; X64-OPT-NEXT: shlq $3, %rdi
960 ; X64-OPT-NEXT: leaq (%rdi,%rdi,2), %rax
963 ; X86-NOOPT-LABEL: test_mul_by_24:
964 ; X86-NOOPT: # %bb.0:
965 ; X86-NOOPT-NEXT: movl $24, %eax
966 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
967 ; X86-NOOPT-NEXT: imull $24, {{[0-9]+}}(%esp), %ecx
968 ; X86-NOOPT-NEXT: addl %ecx, %edx
969 ; X86-NOOPT-NEXT: retl
971 ; X64-NOOPT-LABEL: test_mul_by_24:
972 ; X64-NOOPT: # %bb.0:
973 ; X64-NOOPT-NEXT: imulq $24, %rdi, %rax
974 ; X64-NOOPT-NEXT: retq
975 ; X86-OPT-LABEL: test_mul_by_24:
977 ; X86-OPT-NEXT: shlq $3, %rdi
978 ; X86-OPT-NEXT: leaq (%rdi,%rdi,2), %rax
980 %mul = mul nsw i64 %x, 24
984 define i64 @test_mul_by_25(i64 %x) {
985 ; X86-LABEL: test_mul_by_25:
987 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
988 ; X86-NEXT: movl $25, %eax
989 ; X86-NEXT: mull {{[0-9]+}}(%esp)
990 ; X86-NEXT: leal (%ecx,%ecx,4), %ecx
991 ; X86-NEXT: leal (%ecx,%ecx,4), %ecx
992 ; X86-NEXT: addl %ecx, %edx
995 ; X64-OPT-LABEL: test_mul_by_25:
997 ; X64-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
998 ; X64-OPT-NEXT: leaq (%rax,%rax,4), %rax
1001 ; X86-NOOPT-LABEL: test_mul_by_25:
1002 ; X86-NOOPT: # %bb.0:
1003 ; X86-NOOPT-NEXT: movl $25, %eax
1004 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1005 ; X86-NOOPT-NEXT: imull $25, {{[0-9]+}}(%esp), %ecx
1006 ; X86-NOOPT-NEXT: addl %ecx, %edx
1007 ; X86-NOOPT-NEXT: retl
1009 ; X64-NOOPT-LABEL: test_mul_by_25:
1010 ; X64-NOOPT: # %bb.0:
1011 ; X64-NOOPT-NEXT: imulq $25, %rdi, %rax
1012 ; X64-NOOPT-NEXT: retq
1013 ; X86-OPT-LABEL: test_mul_by_25:
1015 ; X86-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
1016 ; X86-OPT-NEXT: leaq (%rax,%rax,4), %rax
1017 ; X86-OPT-NEXT: retq
1018 %mul = mul nsw i64 %x, 25
1022 define i64 @test_mul_by_26(i64 %x) {
1023 ; X86-LABEL: test_mul_by_26:
1025 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1026 ; X86-NEXT: leal (%eax,%eax,4), %ecx
1027 ; X86-NEXT: leal (%ecx,%ecx,4), %ecx
1028 ; X86-NEXT: addl %eax, %ecx
1029 ; X86-NEXT: movl $26, %eax
1030 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1031 ; X86-NEXT: addl %ecx, %edx
1034 ; X64-HSW-LABEL: test_mul_by_26:
1036 ; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax
1037 ; X64-HSW-NEXT: leaq (%rax,%rax,4), %rax
1038 ; X64-HSW-NEXT: addq %rdi, %rax
1039 ; X64-HSW-NEXT: retq
1041 ; X64-JAG-LABEL: test_mul_by_26:
1043 ; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax
1044 ; X64-JAG-NEXT: leaq (%rax,%rax,4), %rax
1045 ; X64-JAG-NEXT: addq %rdi, %rax
1046 ; X64-JAG-NEXT: retq
1048 ; X86-NOOPT-LABEL: test_mul_by_26:
1049 ; X86-NOOPT: # %bb.0:
1050 ; X86-NOOPT-NEXT: movl $26, %eax
1051 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1052 ; X86-NOOPT-NEXT: imull $26, {{[0-9]+}}(%esp), %ecx
1053 ; X86-NOOPT-NEXT: addl %ecx, %edx
1054 ; X86-NOOPT-NEXT: retl
1056 ; X64-NOOPT-LABEL: test_mul_by_26:
1057 ; X64-NOOPT: # %bb.0:
1058 ; X64-NOOPT-NEXT: imulq $26, %rdi, %rax
1059 ; X64-NOOPT-NEXT: retq
1061 ; X64-SLM-LABEL: test_mul_by_26:
1063 ; X64-SLM-NEXT: imulq $26, %rdi, %rax
1064 ; X64-SLM-NEXT: retq
1065 ; X86-OPT-LABEL: test_mul_by_26:
1067 ; X86-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
1068 ; X86-OPT-NEXT: leaq (%rax,%rax,4), %rax
1069 ; X86-OPT-NEXT: addq %rdi, %rax
1070 ; X86-OPT-NEXT: retq
1071 %mul = mul nsw i64 %x, 26
1075 define i64 @test_mul_by_27(i64 %x) {
1076 ; X86-LABEL: test_mul_by_27:
1078 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1079 ; X86-NEXT: movl $27, %eax
1080 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1081 ; X86-NEXT: leal (%ecx,%ecx,8), %ecx
1082 ; X86-NEXT: leal (%ecx,%ecx,2), %ecx
1083 ; X86-NEXT: addl %ecx, %edx
1086 ; X64-OPT-LABEL: test_mul_by_27:
1088 ; X64-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
1089 ; X64-OPT-NEXT: leaq (%rax,%rax,2), %rax
1090 ; X64-OPT-NEXT: retq
1092 ; X86-NOOPT-LABEL: test_mul_by_27:
1093 ; X86-NOOPT: # %bb.0:
1094 ; X86-NOOPT-NEXT: movl $27, %eax
1095 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1096 ; X86-NOOPT-NEXT: imull $27, {{[0-9]+}}(%esp), %ecx
1097 ; X86-NOOPT-NEXT: addl %ecx, %edx
1098 ; X86-NOOPT-NEXT: retl
1100 ; X64-NOOPT-LABEL: test_mul_by_27:
1101 ; X64-NOOPT: # %bb.0:
1102 ; X64-NOOPT-NEXT: imulq $27, %rdi, %rax
1103 ; X64-NOOPT-NEXT: retq
1104 ; X86-OPT-LABEL: test_mul_by_27:
1106 ; X86-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
1107 ; X86-OPT-NEXT: leaq (%rax,%rax,2), %rax
1108 ; X86-OPT-NEXT: retq
1109 %mul = mul nsw i64 %x, 27
1113 define i64 @test_mul_by_28(i64 %x) {
1114 ; X86-LABEL: test_mul_by_28:
1116 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1117 ; X86-NEXT: leal (%eax,%eax,8), %ecx
1118 ; X86-NEXT: leal (%ecx,%ecx,2), %ecx
1119 ; X86-NEXT: addl %eax, %ecx
1120 ; X86-NEXT: movl $28, %eax
1121 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1122 ; X86-NEXT: addl %ecx, %edx
1125 ; X64-HSW-LABEL: test_mul_by_28:
1127 ; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax
1128 ; X64-HSW-NEXT: leaq (%rax,%rax,2), %rax
1129 ; X64-HSW-NEXT: addq %rdi, %rax
1130 ; X64-HSW-NEXT: retq
1132 ; X64-JAG-LABEL: test_mul_by_28:
1134 ; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax
1135 ; X64-JAG-NEXT: leaq (%rax,%rax,2), %rax
1136 ; X64-JAG-NEXT: addq %rdi, %rax
1137 ; X64-JAG-NEXT: retq
1139 ; X86-NOOPT-LABEL: test_mul_by_28:
1140 ; X86-NOOPT: # %bb.0:
1141 ; X86-NOOPT-NEXT: movl $28, %eax
1142 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1143 ; X86-NOOPT-NEXT: imull $28, {{[0-9]+}}(%esp), %ecx
1144 ; X86-NOOPT-NEXT: addl %ecx, %edx
1145 ; X86-NOOPT-NEXT: retl
1147 ; X64-NOOPT-LABEL: test_mul_by_28:
1148 ; X64-NOOPT: # %bb.0:
1149 ; X64-NOOPT-NEXT: imulq $28, %rdi, %rax
1150 ; X64-NOOPT-NEXT: retq
1152 ; X64-SLM-LABEL: test_mul_by_28:
1154 ; X64-SLM-NEXT: imulq $28, %rdi, %rax
1155 ; X64-SLM-NEXT: retq
1156 ; X86-OPT-LABEL: test_mul_by_28:
1158 ; X86-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
1159 ; X86-OPT-NEXT: leaq (%rax,%rax,2), %rax
1160 ; X86-OPT-NEXT: addq %rdi, %rax
1161 ; X86-OPT-NEXT: retq
1162 %mul = mul nsw i64 %x, 28
1166 define i64 @test_mul_by_29(i64 %x) {
1167 ; X86-LABEL: test_mul_by_29:
1169 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1170 ; X86-NEXT: leal (%eax,%eax,8), %ecx
1171 ; X86-NEXT: leal (%ecx,%ecx,2), %ecx
1172 ; X86-NEXT: addl %eax, %ecx
1173 ; X86-NEXT: addl %eax, %ecx
1174 ; X86-NEXT: movl $29, %eax
1175 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1176 ; X86-NEXT: addl %ecx, %edx
1179 ; X64-HSW-LABEL: test_mul_by_29:
1181 ; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax
1182 ; X64-HSW-NEXT: leaq (%rax,%rax,2), %rax
1183 ; X64-HSW-NEXT: addq %rdi, %rax
1184 ; X64-HSW-NEXT: addq %rdi, %rax
1185 ; X64-HSW-NEXT: retq
1187 ; X64-JAG-LABEL: test_mul_by_29:
1189 ; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax
1190 ; X64-JAG-NEXT: leaq (%rax,%rax,2), %rax
1191 ; X64-JAG-NEXT: addq %rdi, %rax
1192 ; X64-JAG-NEXT: addq %rdi, %rax
1193 ; X64-JAG-NEXT: retq
1195 ; X86-NOOPT-LABEL: test_mul_by_29:
1196 ; X86-NOOPT: # %bb.0:
1197 ; X86-NOOPT-NEXT: movl $29, %eax
1198 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1199 ; X86-NOOPT-NEXT: imull $29, {{[0-9]+}}(%esp), %ecx
1200 ; X86-NOOPT-NEXT: addl %ecx, %edx
1201 ; X86-NOOPT-NEXT: retl
1203 ; X64-NOOPT-LABEL: test_mul_by_29:
1204 ; X64-NOOPT: # %bb.0:
1205 ; X64-NOOPT-NEXT: imulq $29, %rdi, %rax
1206 ; X64-NOOPT-NEXT: retq
1208 ; X64-SLM-LABEL: test_mul_by_29:
1210 ; X64-SLM-NEXT: imulq $29, %rdi, %rax
1211 ; X64-SLM-NEXT: retq
1212 ; X86-OPT-LABEL: test_mul_by_29:
1214 ; X86-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
1215 ; X86-OPT-NEXT: leaq (%rax,%rax,2), %rax
1216 ; X86-OPT-NEXT: addq %rdi, %rax
1217 ; X86-OPT-NEXT: addq %rdi, %rax
1218 ; X86-OPT-NEXT: retq
1219 %mul = mul nsw i64 %x, 29
1223 define i64 @test_mul_by_30(i64 %x) {
1224 ; X86-LABEL: test_mul_by_30:
1226 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1227 ; X86-NEXT: movl %eax, %ecx
1228 ; X86-NEXT: shll $5, %ecx
1229 ; X86-NEXT: subl %eax, %ecx
1230 ; X86-NEXT: subl %eax, %ecx
1231 ; X86-NEXT: movl $30, %eax
1232 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1233 ; X86-NEXT: addl %ecx, %edx
1236 ; X64-OPT-LABEL: test_mul_by_30:
1238 ; X64-OPT-NEXT: movq %rdi, %rax
1239 ; X64-OPT-NEXT: shlq $5, %rax
1240 ; X64-OPT-NEXT: subq %rdi, %rax
1241 ; X64-OPT-NEXT: subq %rdi, %rax
1242 ; X64-OPT-NEXT: retq
1244 ; X86-NOOPT-LABEL: test_mul_by_30:
1245 ; X86-NOOPT: # %bb.0:
1246 ; X86-NOOPT-NEXT: movl $30, %eax
1247 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1248 ; X86-NOOPT-NEXT: imull $30, {{[0-9]+}}(%esp), %ecx
1249 ; X86-NOOPT-NEXT: addl %ecx, %edx
1250 ; X86-NOOPT-NEXT: retl
1252 ; X64-NOOPT-LABEL: test_mul_by_30:
1253 ; X64-NOOPT: # %bb.0:
1254 ; X64-NOOPT-NEXT: imulq $30, %rdi, %rax
1255 ; X64-NOOPT-NEXT: retq
1256 ; X86-OPT-LABEL: test_mul_by_30:
1258 ; X86-OPT-NEXT: movq %rdi, %rax
1259 ; X86-OPT-NEXT: shlq $5, %rax
1260 ; X86-OPT-NEXT: subq %rdi, %rax
1261 ; X86-OPT-NEXT: subq %rdi, %rax
1262 ; X86-OPT-NEXT: retq
1263 %mul = mul nsw i64 %x, 30
1267 define i64 @test_mul_by_31(i64 %x) {
1268 ; X86-LABEL: test_mul_by_31:
1270 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1271 ; X86-NEXT: movl %eax, %ecx
1272 ; X86-NEXT: shll $5, %ecx
1273 ; X86-NEXT: subl %eax, %ecx
1274 ; X86-NEXT: movl $31, %eax
1275 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1276 ; X86-NEXT: addl %ecx, %edx
1279 ; X64-OPT-LABEL: test_mul_by_31:
1281 ; X64-OPT-NEXT: movq %rdi, %rax
1282 ; X64-OPT-NEXT: shlq $5, %rax
1283 ; X64-OPT-NEXT: subq %rdi, %rax
1284 ; X64-OPT-NEXT: retq
1286 ; X86-NOOPT-LABEL: test_mul_by_31:
1287 ; X86-NOOPT: # %bb.0:
1288 ; X86-NOOPT-NEXT: movl $31, %eax
1289 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1290 ; X86-NOOPT-NEXT: imull $31, {{[0-9]+}}(%esp), %ecx
1291 ; X86-NOOPT-NEXT: addl %ecx, %edx
1292 ; X86-NOOPT-NEXT: retl
1294 ; X64-NOOPT-LABEL: test_mul_by_31:
1295 ; X64-NOOPT: # %bb.0:
1296 ; X64-NOOPT-NEXT: imulq $31, %rdi, %rax
1297 ; X64-NOOPT-NEXT: retq
1298 ; X86-OPT-LABEL: test_mul_by_31:
1300 ; X86-OPT-NEXT: movq %rdi, %rax
1301 ; X86-OPT-NEXT: shlq $5, %rax
1302 ; X86-OPT-NEXT: subq %rdi, %rax
1303 ; X86-OPT-NEXT: retq
1304 %mul = mul nsw i64 %x, 31
1308 define i64 @test_mul_by_32(i64 %x) {
1309 ; X86-LABEL: test_mul_by_32:
1311 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1312 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
1313 ; X86-NEXT: shldl $5, %eax, %edx
1314 ; X86-NEXT: shll $5, %eax
1317 ; X64-OPT-LABEL: test_mul_by_32:
1319 ; X64-OPT-NEXT: movq %rdi, %rax
1320 ; X64-OPT-NEXT: shlq $5, %rax
1321 ; X64-OPT-NEXT: retq
1323 ; X86-NOOPT-LABEL: test_mul_by_32:
1324 ; X86-NOOPT: # %bb.0:
1325 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
1326 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
1327 ; X86-NOOPT-NEXT: shldl $5, %eax, %edx
1328 ; X86-NOOPT-NEXT: shll $5, %eax
1329 ; X86-NOOPT-NEXT: retl
1331 ; X64-NOOPT-LABEL: test_mul_by_32:
1332 ; X64-NOOPT: # %bb.0:
1333 ; X64-NOOPT-NEXT: movq %rdi, %rax
1334 ; X64-NOOPT-NEXT: shlq $5, %rax
1335 ; X64-NOOPT-NEXT: retq
1336 ; X86-OPT-LABEL: test_mul_by_32:
1338 ; X86-OPT-NEXT: movq %rdi, %rax
1339 ; X86-OPT-NEXT: shlq $5, %rax
1340 ; X86-OPT-NEXT: retq
1341 %mul = mul nsw i64 %x, 32
1345 define i64 @test_mul_by_37(i64 %x) {
1346 ; X86-LABEL: test_mul_by_37:
1348 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1349 ; X86-NEXT: leal (%eax,%eax,8), %ecx
1350 ; X86-NEXT: leal (%eax,%ecx,4), %ecx
1351 ; X86-NEXT: movl $37, %eax
1352 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1353 ; X86-NEXT: addl %ecx, %edx
1356 ; X64-HSW-LABEL: test_mul_by_37:
1358 ; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax
1359 ; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax
1360 ; X64-HSW-NEXT: retq
1362 ; X64-JAG-LABEL: test_mul_by_37:
1364 ; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax
1365 ; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax
1366 ; X64-JAG-NEXT: retq
1368 ; X86-NOOPT-LABEL: test_mul_by_37:
1369 ; X86-NOOPT: # %bb.0:
1370 ; X86-NOOPT-NEXT: movl $37, %eax
1371 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1372 ; X86-NOOPT-NEXT: imull $37, {{[0-9]+}}(%esp), %ecx
1373 ; X86-NOOPT-NEXT: addl %ecx, %edx
1374 ; X86-NOOPT-NEXT: retl
1376 ; X64-NOOPT-LABEL: test_mul_by_37:
1377 ; X64-NOOPT: # %bb.0:
1378 ; X64-NOOPT-NEXT: imulq $37, %rdi, %rax
1379 ; X64-NOOPT-NEXT: retq
1381 ; X64-SLM-LABEL: test_mul_by_37:
1383 ; X64-SLM-NEXT: imulq $37, %rdi, %rax
1384 ; X64-SLM-NEXT: retq
1385 ; X86-OPT-LABEL: test_mul_by_37:
1387 ; X86-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
1388 ; X86-OPT-NEXT: leaq (%rdi,%rax,4), %rax
1389 ; X86-OPT-NEXT: retq
1390 %mul = mul nsw i64 %x, 37
1394 define i64 @test_mul_by_41(i64 %x) {
1395 ; X86-LABEL: test_mul_by_41:
1397 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1398 ; X86-NEXT: leal (%eax,%eax,4), %ecx
1399 ; X86-NEXT: leal (%eax,%ecx,8), %ecx
1400 ; X86-NEXT: movl $41, %eax
1401 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1402 ; X86-NEXT: addl %ecx, %edx
1405 ; X64-HSW-LABEL: test_mul_by_41:
1407 ; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax
1408 ; X64-HSW-NEXT: leaq (%rdi,%rax,8), %rax
1409 ; X64-HSW-NEXT: retq
1411 ; X64-JAG-LABEL: test_mul_by_41:
1413 ; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax
1414 ; X64-JAG-NEXT: leaq (%rdi,%rax,8), %rax
1415 ; X64-JAG-NEXT: retq
1417 ; X86-NOOPT-LABEL: test_mul_by_41:
1418 ; X86-NOOPT: # %bb.0:
1419 ; X86-NOOPT-NEXT: movl $41, %eax
1420 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1421 ; X86-NOOPT-NEXT: imull $41, {{[0-9]+}}(%esp), %ecx
1422 ; X86-NOOPT-NEXT: addl %ecx, %edx
1423 ; X86-NOOPT-NEXT: retl
1425 ; X64-NOOPT-LABEL: test_mul_by_41:
1426 ; X64-NOOPT: # %bb.0:
1427 ; X64-NOOPT-NEXT: imulq $41, %rdi, %rax
1428 ; X64-NOOPT-NEXT: retq
1430 ; X64-SLM-LABEL: test_mul_by_41:
1432 ; X64-SLM-NEXT: imulq $41, %rdi, %rax
1433 ; X64-SLM-NEXT: retq
1434 ; X86-OPT-LABEL: test_mul_by_41:
1436 ; X86-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
1437 ; X86-OPT-NEXT: leaq (%rdi,%rax,8), %rax
1438 ; X86-OPT-NEXT: retq
1439 %mul = mul nsw i64 %x, 41
1443 define i64 @test_mul_by_62(i64 %x) {
1444 ; X86-LABEL: test_mul_by_62:
1446 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1447 ; X86-NEXT: movl %eax, %ecx
1448 ; X86-NEXT: shll $6, %ecx
1449 ; X86-NEXT: subl %eax, %ecx
1450 ; X86-NEXT: subl %eax, %ecx
1451 ; X86-NEXT: movl $62, %eax
1452 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1453 ; X86-NEXT: addl %ecx, %edx
1456 ; X64-OPT-LABEL: test_mul_by_62:
1458 ; X64-OPT-NEXT: movq %rdi, %rax
1459 ; X64-OPT-NEXT: shlq $6, %rax
1460 ; X64-OPT-NEXT: subq %rdi, %rax
1461 ; X64-OPT-NEXT: subq %rdi, %rax
1462 ; X64-OPT-NEXT: retq
1464 ; X86-NOOPT-LABEL: test_mul_by_62:
1465 ; X86-NOOPT: # %bb.0:
1466 ; X86-NOOPT-NEXT: movl $62, %eax
1467 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1468 ; X86-NOOPT-NEXT: imull $62, {{[0-9]+}}(%esp), %ecx
1469 ; X86-NOOPT-NEXT: addl %ecx, %edx
1470 ; X86-NOOPT-NEXT: retl
1472 ; X64-NOOPT-LABEL: test_mul_by_62:
1473 ; X64-NOOPT: # %bb.0:
1474 ; X64-NOOPT-NEXT: imulq $62, %rdi, %rax
1475 ; X64-NOOPT-NEXT: retq
1476 ; X86-OPT-LABEL: test_mul_by_62:
1478 ; X86-OPT-NEXT: movq %rdi, %rax
1479 ; X86-OPT-NEXT: shlq $6, %rax
1480 ; X86-OPT-NEXT: subq %rdi, %rax
1481 ; X86-OPT-NEXT: subq %rdi, %rax
1482 ; X86-OPT-NEXT: retq
1483 %mul = mul nsw i64 %x, 62
1487 define i64 @test_mul_by_66(i64 %x) {
1488 ; X86-LABEL: test_mul_by_66:
1490 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1491 ; X86-NEXT: movl %eax, %ecx
1492 ; X86-NEXT: shll $6, %ecx
1493 ; X86-NEXT: leal (%ecx,%eax,2), %ecx
1494 ; X86-NEXT: movl $66, %eax
1495 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1496 ; X86-NEXT: addl %ecx, %edx
1499 ; X64-HSW-LABEL: test_mul_by_66:
1501 ; X64-HSW-NEXT: movq %rdi, %rax
1502 ; X64-HSW-NEXT: shlq $6, %rax
1503 ; X64-HSW-NEXT: leaq (%rax,%rdi,2), %rax
1504 ; X64-HSW-NEXT: retq
1506 ; X64-JAG-LABEL: test_mul_by_66:
1508 ; X64-JAG-NEXT: movq %rdi, %rax
1509 ; X64-JAG-NEXT: shlq $6, %rax
1510 ; X64-JAG-NEXT: leaq (%rax,%rdi,2), %rax
1511 ; X64-JAG-NEXT: retq
1513 ; X86-NOOPT-LABEL: test_mul_by_66:
1514 ; X86-NOOPT: # %bb.0:
1515 ; X86-NOOPT-NEXT: movl $66, %eax
1516 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1517 ; X86-NOOPT-NEXT: imull $66, {{[0-9]+}}(%esp), %ecx
1518 ; X86-NOOPT-NEXT: addl %ecx, %edx
1519 ; X86-NOOPT-NEXT: retl
1521 ; X64-NOOPT-LABEL: test_mul_by_66:
1522 ; X64-NOOPT: # %bb.0:
1523 ; X64-NOOPT-NEXT: imulq $66, %rdi, %rax
1524 ; X64-NOOPT-NEXT: retq
1526 ; X64-SLM-LABEL: test_mul_by_66:
1528 ; X64-SLM-NEXT: movq %rdi, %rax
1529 ; X64-SLM-NEXT: shlq $6, %rax
1530 ; X64-SLM-NEXT: addq %rdi, %rax
1531 ; X64-SLM-NEXT: addq %rdi, %rax
1532 ; X64-SLM-NEXT: retq
1533 ; X86-OPT-LABEL: test_mul_by_66:
1535 ; X86-OPT-NEXT: movq %rdi, %rax
1536 ; X86-OPT-NEXT: shlq $6, %rax
1537 ; X86-OPT-NEXT: leaq (%rax,%rdi,2), %rax
1538 ; X86-OPT-NEXT: retq
1539 %mul = mul nsw i64 %x, 66
1543 define i64 @test_mul_by_73(i64 %x) {
1544 ; X86-LABEL: test_mul_by_73:
1546 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1547 ; X86-NEXT: leal (%eax,%eax,8), %ecx
1548 ; X86-NEXT: leal (%eax,%ecx,8), %ecx
1549 ; X86-NEXT: movl $73, %eax
1550 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1551 ; X86-NEXT: addl %ecx, %edx
1554 ; X64-HSW-LABEL: test_mul_by_73:
1556 ; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax
1557 ; X64-HSW-NEXT: leaq (%rdi,%rax,8), %rax
1558 ; X64-HSW-NEXT: retq
1560 ; X64-JAG-LABEL: test_mul_by_73:
1562 ; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax
1563 ; X64-JAG-NEXT: leaq (%rdi,%rax,8), %rax
1564 ; X64-JAG-NEXT: retq
1566 ; X86-NOOPT-LABEL: test_mul_by_73:
1567 ; X86-NOOPT: # %bb.0:
1568 ; X86-NOOPT-NEXT: movl $73, %eax
1569 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1570 ; X86-NOOPT-NEXT: imull $73, {{[0-9]+}}(%esp), %ecx
1571 ; X86-NOOPT-NEXT: addl %ecx, %edx
1572 ; X86-NOOPT-NEXT: retl
1574 ; X64-NOOPT-LABEL: test_mul_by_73:
1575 ; X64-NOOPT: # %bb.0:
1576 ; X64-NOOPT-NEXT: imulq $73, %rdi, %rax
1577 ; X64-NOOPT-NEXT: retq
1579 ; X64-SLM-LABEL: test_mul_by_73:
1581 ; X64-SLM-NEXT: imulq $73, %rdi, %rax
1582 ; X64-SLM-NEXT: retq
1583 ; X86-OPT-LABEL: test_mul_by_73:
1585 ; X86-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
1586 ; X86-OPT-NEXT: leaq (%rdi,%rax,8), %rax
1587 ; X86-OPT-NEXT: retq
1588 %mul = mul nsw i64 %x, 73
1592 define i64 @test_mul_by_520(i64 %x) {
1593 ; X86-LABEL: test_mul_by_520:
1595 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1596 ; X86-NEXT: movl %eax, %ecx
1597 ; X86-NEXT: shll $9, %ecx
1598 ; X86-NEXT: leal (%ecx,%eax,8), %ecx
1599 ; X86-NEXT: movl $520, %eax # imm = 0x208
1600 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1601 ; X86-NEXT: addl %ecx, %edx
1604 ; X64-HSW-LABEL: test_mul_by_520:
1606 ; X64-HSW-NEXT: movq %rdi, %rax
1607 ; X64-HSW-NEXT: shlq $9, %rax
1608 ; X64-HSW-NEXT: leaq (%rax,%rdi,8), %rax
1609 ; X64-HSW-NEXT: retq
1611 ; X64-JAG-LABEL: test_mul_by_520:
1613 ; X64-JAG-NEXT: movq %rdi, %rax
1614 ; X64-JAG-NEXT: shlq $9, %rax
1615 ; X64-JAG-NEXT: leaq (%rax,%rdi,8), %rax
1616 ; X64-JAG-NEXT: retq
1618 ; X86-NOOPT-LABEL: test_mul_by_520:
1619 ; X86-NOOPT: # %bb.0:
1620 ; X86-NOOPT-NEXT: movl $520, %eax # imm = 0x208
1621 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1622 ; X86-NOOPT-NEXT: imull $520, {{[0-9]+}}(%esp), %ecx # imm = 0x208
1623 ; X86-NOOPT-NEXT: addl %ecx, %edx
1624 ; X86-NOOPT-NEXT: retl
1626 ; X64-NOOPT-LABEL: test_mul_by_520:
1627 ; X64-NOOPT: # %bb.0:
1628 ; X64-NOOPT-NEXT: imulq $520, %rdi, %rax # imm = 0x208
1629 ; X64-NOOPT-NEXT: retq
1631 ; X64-SLM-LABEL: test_mul_by_520:
1633 ; X64-SLM-NEXT: imulq $520, %rdi, %rax # imm = 0x208
1634 ; X64-SLM-NEXT: retq
1635 ; X86-OPT-LABEL: test_mul_by_520:
1637 ; X86-OPT-NEXT: movq %rdi, %rax
1638 ; X86-OPT-NEXT: shlq $9, %rax
1639 ; X86-OPT-NEXT: leaq (%rax,%rdi,8), %rax
1640 ; X86-OPT-NEXT: retq
1641 %mul = mul nsw i64 %x, 520
1645 define i64 @test_mul_by_neg10(i64 %x) {
1646 ; X86-LABEL: test_mul_by_neg10:
1648 ; X86-NEXT: pushl %esi
1649 ; X86-NEXT: .cfi_def_cfa_offset 8
1650 ; X86-NEXT: .cfi_offset %esi, -8
1651 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1652 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
1653 ; X86-NEXT: movl $-10, %edx
1654 ; X86-NEXT: movl %ecx, %eax
1655 ; X86-NEXT: mull %edx
1656 ; X86-NEXT: subl %ecx, %edx
1657 ; X86-NEXT: addl %esi, %esi
1658 ; X86-NEXT: leal (%esi,%esi,4), %ecx
1659 ; X86-NEXT: subl %ecx, %edx
1660 ; X86-NEXT: popl %esi
1661 ; X86-NEXT: .cfi_def_cfa_offset 4
1664 ; X64-OPT-LABEL: test_mul_by_neg10:
1666 ; X64-OPT-NEXT: addq %rdi, %rdi
1667 ; X64-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
1668 ; X64-OPT-NEXT: negq %rax
1669 ; X64-OPT-NEXT: retq
1671 ; X86-NOOPT-LABEL: test_mul_by_neg10:
1672 ; X86-NOOPT: # %bb.0:
1673 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %ecx
1674 ; X86-NOOPT-NEXT: movl $-10, %edx
1675 ; X86-NOOPT-NEXT: movl %ecx, %eax
1676 ; X86-NOOPT-NEXT: mull %edx
1677 ; X86-NOOPT-NEXT: subl %ecx, %edx
1678 ; X86-NOOPT-NEXT: imull $-10, {{[0-9]+}}(%esp), %ecx
1679 ; X86-NOOPT-NEXT: addl %ecx, %edx
1680 ; X86-NOOPT-NEXT: retl
1682 ; X64-NOOPT-LABEL: test_mul_by_neg10:
1683 ; X64-NOOPT: # %bb.0:
1684 ; X64-NOOPT-NEXT: imulq $-10, %rdi, %rax
1685 ; X64-NOOPT-NEXT: retq
1686 ; X86-OPT-LABEL: test_mul_by_neg10:
1688 ; X86-OPT-NEXT: addq %rdi, %rdi
1689 ; X86-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
1690 ; X86-OPT-NEXT: negq %rax
1691 ; X86-OPT-NEXT: retq
1692 %mul = mul nsw i64 %x, -10
1696 define i64 @test_mul_by_neg36(i64 %x) {
1697 ; X86-LABEL: test_mul_by_neg36:
1699 ; X86-NEXT: pushl %esi
1700 ; X86-NEXT: .cfi_def_cfa_offset 8
1701 ; X86-NEXT: .cfi_offset %esi, -8
1702 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1703 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
1704 ; X86-NEXT: movl $-36, %edx
1705 ; X86-NEXT: movl %ecx, %eax
1706 ; X86-NEXT: mull %edx
1707 ; X86-NEXT: subl %ecx, %edx
1708 ; X86-NEXT: shll $2, %esi
1709 ; X86-NEXT: leal (%esi,%esi,8), %ecx
1710 ; X86-NEXT: subl %ecx, %edx
1711 ; X86-NEXT: popl %esi
1712 ; X86-NEXT: .cfi_def_cfa_offset 4
1715 ; X64-OPT-LABEL: test_mul_by_neg36:
1717 ; X64-OPT-NEXT: shlq $2, %rdi
1718 ; X64-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
1719 ; X64-OPT-NEXT: negq %rax
1720 ; X64-OPT-NEXT: retq
1722 ; X86-NOOPT-LABEL: test_mul_by_neg36:
1723 ; X86-NOOPT: # %bb.0:
1724 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %ecx
1725 ; X86-NOOPT-NEXT: movl $-36, %edx
1726 ; X86-NOOPT-NEXT: movl %ecx, %eax
1727 ; X86-NOOPT-NEXT: mull %edx
1728 ; X86-NOOPT-NEXT: subl %ecx, %edx
1729 ; X86-NOOPT-NEXT: imull $-36, {{[0-9]+}}(%esp), %ecx
1730 ; X86-NOOPT-NEXT: addl %ecx, %edx
1731 ; X86-NOOPT-NEXT: retl
1733 ; X64-NOOPT-LABEL: test_mul_by_neg36:
1734 ; X64-NOOPT: # %bb.0:
1735 ; X64-NOOPT-NEXT: imulq $-36, %rdi, %rax
1736 ; X64-NOOPT-NEXT: retq
1737 ; X86-OPT-LABEL: test_mul_by_neg36:
1739 ; X86-OPT-NEXT: shlq $2, %rdi
1740 ; X86-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
1741 ; X86-OPT-NEXT: negq %rax
1742 ; X86-OPT-NEXT: retq
1743 %mul = mul nsw i64 %x, -36
1748 define i64 @test_mul_spec(i64 %x) nounwind {
1749 ; X86-LABEL: test_mul_spec:
1751 ; X86-NEXT: pushl %ebx
1752 ; X86-NEXT: pushl %edi
1753 ; X86-NEXT: pushl %esi
1754 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1755 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
1756 ; X86-NEXT: movl $9, %edx
1757 ; X86-NEXT: movl %ecx, %eax
1758 ; X86-NEXT: mull %edx
1759 ; X86-NEXT: movl %eax, %esi
1760 ; X86-NEXT: leal (%edi,%edi,8), %ebx
1761 ; X86-NEXT: addl $42, %esi
1762 ; X86-NEXT: adcl %edx, %ebx
1763 ; X86-NEXT: movl $5, %edx
1764 ; X86-NEXT: movl %ecx, %eax
1765 ; X86-NEXT: mull %edx
1766 ; X86-NEXT: movl %eax, %ecx
1767 ; X86-NEXT: leal (%edi,%edi,4), %edi
1768 ; X86-NEXT: addl $2, %ecx
1769 ; X86-NEXT: adcl %edx, %edi
1770 ; X86-NEXT: movl %esi, %eax
1771 ; X86-NEXT: mull %ecx
1772 ; X86-NEXT: imull %esi, %edi
1773 ; X86-NEXT: addl %edi, %edx
1774 ; X86-NEXT: imull %ebx, %ecx
1775 ; X86-NEXT: addl %ecx, %edx
1776 ; X86-NEXT: popl %esi
1777 ; X86-NEXT: popl %edi
1778 ; X86-NEXT: popl %ebx
1781 ; X64-HSW-LABEL: test_mul_spec:
1783 ; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rcx
1784 ; X64-HSW-NEXT: addq $42, %rcx
1785 ; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax
1786 ; X64-HSW-NEXT: addq $2, %rax
1787 ; X64-HSW-NEXT: imulq %rcx, %rax
1788 ; X64-HSW-NEXT: retq
1790 ; X64-JAG-LABEL: test_mul_spec:
1792 ; X64-JAG-NEXT: leaq 42(%rdi,%rdi,8), %rcx
1793 ; X64-JAG-NEXT: leaq 2(%rdi,%rdi,4), %rax
1794 ; X64-JAG-NEXT: imulq %rcx, %rax
1795 ; X64-JAG-NEXT: retq
1797 ; X86-NOOPT-LABEL: test_mul_spec:
1798 ; X86-NOOPT: # %bb.0:
1799 ; X86-NOOPT-NEXT: pushl %ebx
1800 ; X86-NOOPT-NEXT: pushl %edi
1801 ; X86-NOOPT-NEXT: pushl %esi
1802 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %ecx
1803 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edi
1804 ; X86-NOOPT-NEXT: movl $9, %edx
1805 ; X86-NOOPT-NEXT: movl %ecx, %eax
1806 ; X86-NOOPT-NEXT: mull %edx
1807 ; X86-NOOPT-NEXT: movl %eax, %esi
1808 ; X86-NOOPT-NEXT: leal (%edi,%edi,8), %ebx
1809 ; X86-NOOPT-NEXT: addl $42, %esi
1810 ; X86-NOOPT-NEXT: adcl %edx, %ebx
1811 ; X86-NOOPT-NEXT: movl $5, %edx
1812 ; X86-NOOPT-NEXT: movl %ecx, %eax
1813 ; X86-NOOPT-NEXT: mull %edx
1814 ; X86-NOOPT-NEXT: movl %eax, %ecx
1815 ; X86-NOOPT-NEXT: leal (%edi,%edi,4), %edi
1816 ; X86-NOOPT-NEXT: addl $2, %ecx
1817 ; X86-NOOPT-NEXT: adcl %edx, %edi
1818 ; X86-NOOPT-NEXT: movl %esi, %eax
1819 ; X86-NOOPT-NEXT: mull %ecx
1820 ; X86-NOOPT-NEXT: imull %esi, %edi
1821 ; X86-NOOPT-NEXT: addl %edi, %edx
1822 ; X86-NOOPT-NEXT: imull %ebx, %ecx
1823 ; X86-NOOPT-NEXT: addl %ecx, %edx
1824 ; X86-NOOPT-NEXT: popl %esi
1825 ; X86-NOOPT-NEXT: popl %edi
1826 ; X86-NOOPT-NEXT: popl %ebx
1827 ; X86-NOOPT-NEXT: retl
1829 ; HSW-NOOPT-LABEL: test_mul_spec:
1830 ; HSW-NOOPT: # %bb.0:
1831 ; HSW-NOOPT-NEXT: leaq (%rdi,%rdi,8), %rcx
1832 ; HSW-NOOPT-NEXT: addq $42, %rcx
1833 ; HSW-NOOPT-NEXT: leaq (%rdi,%rdi,4), %rax
1834 ; HSW-NOOPT-NEXT: addq $2, %rax
1835 ; HSW-NOOPT-NEXT: imulq %rcx, %rax
1836 ; HSW-NOOPT-NEXT: retq
1838 ; JAG-NOOPT-LABEL: test_mul_spec:
1839 ; JAG-NOOPT: # %bb.0:
1840 ; JAG-NOOPT-NEXT: leaq 42(%rdi,%rdi,8), %rcx
1841 ; JAG-NOOPT-NEXT: leaq 2(%rdi,%rdi,4), %rax
1842 ; JAG-NOOPT-NEXT: imulq %rcx, %rax
1843 ; JAG-NOOPT-NEXT: retq
1845 ; X64-SLM-LABEL: test_mul_spec:
1847 ; X64-SLM-NEXT: leaq 42(%rdi,%rdi,8), %rcx
1848 ; X64-SLM-NEXT: leaq 2(%rdi,%rdi,4), %rax
1849 ; X64-SLM-NEXT: imulq %rcx, %rax
1850 ; X64-SLM-NEXT: retq
1852 ; SLM-NOOPT-LABEL: test_mul_spec:
1853 ; SLM-NOOPT: # %bb.0:
1854 ; SLM-NOOPT-NEXT: leaq 42(%rdi,%rdi,8), %rcx
1855 ; SLM-NOOPT-NEXT: leaq 2(%rdi,%rdi,4), %rax
1856 ; SLM-NOOPT-NEXT: imulq %rcx, %rax
1857 ; SLM-NOOPT-NEXT: retq
1858 ; X86-OPT-LABEL: test_mul_spec:
1860 ; X86-OPT-NEXT: leaq 42(%rdi,%rdi,8), %rcx
1861 ; X86-OPT-NEXT: leaq 2(%rdi,%rdi,4), %rax
1862 ; X86-OPT-NEXT: imulq %rcx, %rax
1863 ; X86-OPT-NEXT: retq
1864 %mul = mul nsw i64 %x, 9
1865 %add = add nsw i64 %mul, 42
1866 %mul2 = mul nsw i64 %x, 5
1867 %add2 = add nsw i64 %mul2, 2
1868 %mul3 = mul nsw i64 %add, %add2