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=i686-unknown -mul-constant-optimization=false | FileCheck %s --check-prefixes=X86-NOOPT
4 ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=haswell | FileCheck %s --check-prefixes=X64,X64-OPT,X64-HSW
5 ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=btver2 | FileCheck %s --check-prefixes=X64,X64-OPT,X64-JAG
6 ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=slm | FileCheck %s --check-prefixes=X64,X64-OPT,X64-SLM
7 ; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -mcpu=haswell | FileCheck %s --check-prefixes=X64,X64-NOOPT,X64-HSW-NOOPT
8 ; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -mcpu=btver2 | FileCheck %s --check-prefixes=X64,X64-NOOPT,X64-JAG-NOOPT
9 ; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -mcpu=slm | FileCheck %s --check-prefixes=X64,X64-NOOPT,X64-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 ; X86-NOOPT-LABEL: test_mul_by_1:
20 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
21 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
22 ; X86-NOOPT-NEXT: retl
24 ; X64-LABEL: test_mul_by_1:
26 ; X64-NEXT: movq %rdi, %rax
28 %mul = mul nsw i64 %x, 1
32 define i64 @test_mul_by_2(i64 %x) {
33 ; X86-LABEL: test_mul_by_2:
35 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
36 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
37 ; X86-NEXT: shldl $1, %eax, %edx
38 ; X86-NEXT: addl %eax, %eax
41 ; X86-NOOPT-LABEL: test_mul_by_2:
43 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
44 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
45 ; X86-NOOPT-NEXT: shldl $1, %eax, %edx
46 ; X86-NOOPT-NEXT: addl %eax, %eax
47 ; X86-NOOPT-NEXT: retl
49 ; X64-LABEL: test_mul_by_2:
51 ; X64-NEXT: leaq (%rdi,%rdi), %rax
53 %mul = mul nsw i64 %x, 2
57 define i64 @test_mul_by_3(i64 %x) {
58 ; X86-LABEL: test_mul_by_3:
60 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
61 ; X86-NEXT: leal (%eax,%eax,2), %ecx
62 ; X86-NEXT: movl $3, %eax
63 ; X86-NEXT: mull {{[0-9]+}}(%esp)
64 ; X86-NEXT: addl %ecx, %edx
67 ; X86-NOOPT-LABEL: test_mul_by_3:
69 ; X86-NOOPT-NEXT: movl $3, %eax
70 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
71 ; X86-NOOPT-NEXT: imull $3, {{[0-9]+}}(%esp), %ecx
72 ; X86-NOOPT-NEXT: addl %ecx, %edx
73 ; X86-NOOPT-NEXT: retl
75 ; X64-LABEL: test_mul_by_3:
77 ; X64-NEXT: leaq (%rdi,%rdi,2), %rax
79 %mul = mul nsw i64 %x, 3
83 define i64 @test_mul_by_4(i64 %x) {
84 ; X86-LABEL: test_mul_by_4:
86 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
87 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
88 ; X86-NEXT: shldl $2, %eax, %edx
89 ; X86-NEXT: shll $2, %eax
92 ; X86-NOOPT-LABEL: test_mul_by_4:
94 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
95 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
96 ; X86-NOOPT-NEXT: shldl $2, %eax, %edx
97 ; X86-NOOPT-NEXT: shll $2, %eax
98 ; X86-NOOPT-NEXT: retl
100 ; X64-LABEL: test_mul_by_4:
102 ; X64-NEXT: leaq (,%rdi,4), %rax
104 %mul = mul nsw i64 %x, 4
108 define i64 @test_mul_by_5(i64 %x) {
109 ; X86-LABEL: test_mul_by_5:
111 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
112 ; X86-NEXT: leal (%eax,%eax,4), %ecx
113 ; X86-NEXT: movl $5, %eax
114 ; X86-NEXT: mull {{[0-9]+}}(%esp)
115 ; X86-NEXT: addl %ecx, %edx
118 ; X86-NOOPT-LABEL: test_mul_by_5:
119 ; X86-NOOPT: # %bb.0:
120 ; X86-NOOPT-NEXT: movl $5, %eax
121 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
122 ; X86-NOOPT-NEXT: imull $5, {{[0-9]+}}(%esp), %ecx
123 ; X86-NOOPT-NEXT: addl %ecx, %edx
124 ; X86-NOOPT-NEXT: retl
126 ; X64-LABEL: test_mul_by_5:
128 ; X64-NEXT: leaq (%rdi,%rdi,4), %rax
130 %mul = mul nsw i64 %x, 5
134 define i64 @test_mul_by_6(i64 %x) {
135 ; X86-LABEL: test_mul_by_6:
137 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
138 ; X86-NEXT: leal (%eax,%eax,2), %ecx
139 ; X86-NEXT: movl $6, %eax
140 ; X86-NEXT: mull {{[0-9]+}}(%esp)
141 ; X86-NEXT: leal (%edx,%ecx,2), %edx
144 ; X86-NOOPT-LABEL: test_mul_by_6:
145 ; X86-NOOPT: # %bb.0:
146 ; X86-NOOPT-NEXT: movl $6, %eax
147 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
148 ; X86-NOOPT-NEXT: imull $6, {{[0-9]+}}(%esp), %ecx
149 ; X86-NOOPT-NEXT: addl %ecx, %edx
150 ; X86-NOOPT-NEXT: retl
152 ; X64-OPT-LABEL: test_mul_by_6:
154 ; X64-OPT-NEXT: addq %rdi, %rdi
155 ; X64-OPT-NEXT: leaq (%rdi,%rdi,2), %rax
158 ; X64-NOOPT-LABEL: test_mul_by_6:
159 ; X64-NOOPT: # %bb.0:
160 ; X64-NOOPT-NEXT: imulq $6, %rdi, %rax
161 ; X64-NOOPT-NEXT: retq
162 %mul = mul nsw i64 %x, 6
166 define i64 @test_mul_by_7(i64 %x) {
167 ; X86-LABEL: test_mul_by_7:
169 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
170 ; X86-NEXT: leal (,%eax,8), %ecx
171 ; X86-NEXT: subl %eax, %ecx
172 ; X86-NEXT: movl $7, %eax
173 ; X86-NEXT: mull {{[0-9]+}}(%esp)
174 ; X86-NEXT: addl %ecx, %edx
177 ; X86-NOOPT-LABEL: test_mul_by_7:
178 ; X86-NOOPT: # %bb.0:
179 ; X86-NOOPT-NEXT: movl $7, %eax
180 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
181 ; X86-NOOPT-NEXT: imull $7, {{[0-9]+}}(%esp), %ecx
182 ; X86-NOOPT-NEXT: addl %ecx, %edx
183 ; X86-NOOPT-NEXT: retl
185 ; X64-OPT-LABEL: test_mul_by_7:
187 ; X64-OPT-NEXT: leaq (,%rdi,8), %rax
188 ; X64-OPT-NEXT: subq %rdi, %rax
191 ; X64-NOOPT-LABEL: test_mul_by_7:
192 ; X64-NOOPT: # %bb.0:
193 ; X64-NOOPT-NEXT: imulq $7, %rdi, %rax
194 ; X64-NOOPT-NEXT: retq
195 %mul = mul nsw i64 %x, 7
199 define i64 @test_mul_by_8(i64 %x) {
200 ; X86-LABEL: test_mul_by_8:
202 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
203 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
204 ; X86-NEXT: shldl $3, %eax, %edx
205 ; X86-NEXT: shll $3, %eax
208 ; X86-NOOPT-LABEL: test_mul_by_8:
209 ; X86-NOOPT: # %bb.0:
210 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
211 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
212 ; X86-NOOPT-NEXT: shldl $3, %eax, %edx
213 ; X86-NOOPT-NEXT: shll $3, %eax
214 ; X86-NOOPT-NEXT: retl
216 ; X64-LABEL: test_mul_by_8:
218 ; X64-NEXT: leaq (,%rdi,8), %rax
220 %mul = mul nsw i64 %x, 8
224 define i64 @test_mul_by_9(i64 %x) {
225 ; X86-LABEL: test_mul_by_9:
227 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
228 ; X86-NEXT: leal (%eax,%eax,8), %ecx
229 ; X86-NEXT: movl $9, %eax
230 ; X86-NEXT: mull {{[0-9]+}}(%esp)
231 ; X86-NEXT: addl %ecx, %edx
234 ; X86-NOOPT-LABEL: test_mul_by_9:
235 ; X86-NOOPT: # %bb.0:
236 ; X86-NOOPT-NEXT: movl $9, %eax
237 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
238 ; X86-NOOPT-NEXT: imull $9, {{[0-9]+}}(%esp), %ecx
239 ; X86-NOOPT-NEXT: addl %ecx, %edx
240 ; X86-NOOPT-NEXT: retl
242 ; X64-LABEL: test_mul_by_9:
244 ; X64-NEXT: leaq (%rdi,%rdi,8), %rax
246 %mul = mul nsw i64 %x, 9
250 define i64 @test_mul_by_10(i64 %x) {
251 ; X86-LABEL: test_mul_by_10:
253 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
254 ; X86-NEXT: leal (%eax,%eax,4), %ecx
255 ; X86-NEXT: movl $10, %eax
256 ; X86-NEXT: mull {{[0-9]+}}(%esp)
257 ; X86-NEXT: leal (%edx,%ecx,2), %edx
260 ; X86-NOOPT-LABEL: test_mul_by_10:
261 ; X86-NOOPT: # %bb.0:
262 ; X86-NOOPT-NEXT: movl $10, %eax
263 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
264 ; X86-NOOPT-NEXT: imull $10, {{[0-9]+}}(%esp), %ecx
265 ; X86-NOOPT-NEXT: addl %ecx, %edx
266 ; X86-NOOPT-NEXT: retl
268 ; X64-OPT-LABEL: test_mul_by_10:
270 ; X64-OPT-NEXT: addq %rdi, %rdi
271 ; X64-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
274 ; X64-NOOPT-LABEL: test_mul_by_10:
275 ; X64-NOOPT: # %bb.0:
276 ; X64-NOOPT-NEXT: imulq $10, %rdi, %rax
277 ; X64-NOOPT-NEXT: retq
278 %mul = mul nsw i64 %x, 10
282 define i64 @test_mul_by_11(i64 %x) {
283 ; X86-LABEL: test_mul_by_11:
285 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
286 ; X86-NEXT: leal (%eax,%eax,4), %ecx
287 ; X86-NEXT: leal (%eax,%ecx,2), %ecx
288 ; X86-NEXT: movl $11, %eax
289 ; X86-NEXT: mull {{[0-9]+}}(%esp)
290 ; X86-NEXT: addl %ecx, %edx
293 ; X86-NOOPT-LABEL: test_mul_by_11:
294 ; X86-NOOPT: # %bb.0:
295 ; X86-NOOPT-NEXT: movl $11, %eax
296 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
297 ; X86-NOOPT-NEXT: imull $11, {{[0-9]+}}(%esp), %ecx
298 ; X86-NOOPT-NEXT: addl %ecx, %edx
299 ; X86-NOOPT-NEXT: retl
301 ; X64-HSW-LABEL: test_mul_by_11:
303 ; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax
304 ; X64-HSW-NEXT: leaq (%rdi,%rax,2), %rax
307 ; X64-JAG-LABEL: test_mul_by_11:
309 ; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax
310 ; X64-JAG-NEXT: leaq (%rdi,%rax,2), %rax
313 ; X64-SLM-LABEL: test_mul_by_11:
315 ; X64-SLM-NEXT: imulq $11, %rdi, %rax
318 ; X64-NOOPT-LABEL: test_mul_by_11:
319 ; X64-NOOPT: # %bb.0:
320 ; X64-NOOPT-NEXT: imulq $11, %rdi, %rax
321 ; X64-NOOPT-NEXT: retq
322 %mul = mul nsw i64 %x, 11
326 define i64 @test_mul_by_12(i64 %x) {
327 ; X86-LABEL: test_mul_by_12:
329 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
330 ; X86-NEXT: leal (%eax,%eax,2), %ecx
331 ; X86-NEXT: movl $12, %eax
332 ; X86-NEXT: mull {{[0-9]+}}(%esp)
333 ; X86-NEXT: leal (%edx,%ecx,4), %edx
336 ; X86-NOOPT-LABEL: test_mul_by_12:
337 ; X86-NOOPT: # %bb.0:
338 ; X86-NOOPT-NEXT: movl $12, %eax
339 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
340 ; X86-NOOPT-NEXT: imull $12, {{[0-9]+}}(%esp), %ecx
341 ; X86-NOOPT-NEXT: addl %ecx, %edx
342 ; X86-NOOPT-NEXT: retl
344 ; X64-OPT-LABEL: test_mul_by_12:
346 ; X64-OPT-NEXT: shlq $2, %rdi
347 ; X64-OPT-NEXT: leaq (%rdi,%rdi,2), %rax
350 ; X64-NOOPT-LABEL: test_mul_by_12:
351 ; X64-NOOPT: # %bb.0:
352 ; X64-NOOPT-NEXT: imulq $12, %rdi, %rax
353 ; X64-NOOPT-NEXT: retq
354 %mul = mul nsw i64 %x, 12
358 define i64 @test_mul_by_13(i64 %x) {
359 ; X86-LABEL: test_mul_by_13:
361 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
362 ; X86-NEXT: leal (%eax,%eax,2), %ecx
363 ; X86-NEXT: leal (%eax,%ecx,4), %ecx
364 ; X86-NEXT: movl $13, %eax
365 ; X86-NEXT: mull {{[0-9]+}}(%esp)
366 ; X86-NEXT: addl %ecx, %edx
369 ; X86-NOOPT-LABEL: test_mul_by_13:
370 ; X86-NOOPT: # %bb.0:
371 ; X86-NOOPT-NEXT: movl $13, %eax
372 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
373 ; X86-NOOPT-NEXT: imull $13, {{[0-9]+}}(%esp), %ecx
374 ; X86-NOOPT-NEXT: addl %ecx, %edx
375 ; X86-NOOPT-NEXT: retl
377 ; X64-HSW-LABEL: test_mul_by_13:
379 ; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax
380 ; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax
383 ; X64-JAG-LABEL: test_mul_by_13:
385 ; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax
386 ; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax
389 ; X64-SLM-LABEL: test_mul_by_13:
391 ; X64-SLM-NEXT: imulq $13, %rdi, %rax
394 ; X64-NOOPT-LABEL: test_mul_by_13:
395 ; X64-NOOPT: # %bb.0:
396 ; X64-NOOPT-NEXT: imulq $13, %rdi, %rax
397 ; X64-NOOPT-NEXT: retq
398 %mul = mul nsw i64 %x, 13
402 define i64 @test_mul_by_14(i64 %x) {
403 ; X86-LABEL: test_mul_by_14:
405 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
406 ; X86-NEXT: leal (%ecx,%ecx), %eax
407 ; X86-NEXT: shll $4, %ecx
408 ; X86-NEXT: subl %eax, %ecx
409 ; X86-NEXT: movl $14, %eax
410 ; X86-NEXT: mull {{[0-9]+}}(%esp)
411 ; X86-NEXT: addl %ecx, %edx
414 ; X86-NOOPT-LABEL: test_mul_by_14:
415 ; X86-NOOPT: # %bb.0:
416 ; X86-NOOPT-NEXT: movl $14, %eax
417 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
418 ; X86-NOOPT-NEXT: imull $14, {{[0-9]+}}(%esp), %ecx
419 ; X86-NOOPT-NEXT: addl %ecx, %edx
420 ; X86-NOOPT-NEXT: retl
422 ; X64-OPT-LABEL: test_mul_by_14:
424 ; X64-OPT-NEXT: movq %rdi, %rax
425 ; X64-OPT-NEXT: shlq $4, %rax
426 ; X64-OPT-NEXT: subq %rdi, %rax
427 ; X64-OPT-NEXT: subq %rdi, %rax
430 ; X64-NOOPT-LABEL: test_mul_by_14:
431 ; X64-NOOPT: # %bb.0:
432 ; X64-NOOPT-NEXT: imulq $14, %rdi, %rax
433 ; X64-NOOPT-NEXT: retq
434 %mul = mul nsw i64 %x, 14
438 define i64 @test_mul_by_15(i64 %x) {
439 ; X86-LABEL: test_mul_by_15:
441 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
442 ; X86-NEXT: movl $15, %eax
443 ; X86-NEXT: mull {{[0-9]+}}(%esp)
444 ; X86-NEXT: leal (%ecx,%ecx,4), %ecx
445 ; X86-NEXT: leal (%ecx,%ecx,2), %ecx
446 ; X86-NEXT: addl %ecx, %edx
449 ; X86-NOOPT-LABEL: test_mul_by_15:
450 ; X86-NOOPT: # %bb.0:
451 ; X86-NOOPT-NEXT: movl $15, %eax
452 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
453 ; X86-NOOPT-NEXT: imull $15, {{[0-9]+}}(%esp), %ecx
454 ; X86-NOOPT-NEXT: addl %ecx, %edx
455 ; X86-NOOPT-NEXT: retl
457 ; X64-OPT-LABEL: test_mul_by_15:
459 ; X64-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
460 ; X64-OPT-NEXT: leaq (%rax,%rax,2), %rax
463 ; X64-NOOPT-LABEL: test_mul_by_15:
464 ; X64-NOOPT: # %bb.0:
465 ; X64-NOOPT-NEXT: imulq $15, %rdi, %rax
466 ; X64-NOOPT-NEXT: retq
467 %mul = mul nsw i64 %x, 15
471 define i64 @test_mul_by_16(i64 %x) {
472 ; X86-LABEL: test_mul_by_16:
474 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
475 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
476 ; X86-NEXT: shldl $4, %eax, %edx
477 ; X86-NEXT: shll $4, %eax
480 ; X86-NOOPT-LABEL: test_mul_by_16:
481 ; X86-NOOPT: # %bb.0:
482 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
483 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
484 ; X86-NOOPT-NEXT: shldl $4, %eax, %edx
485 ; X86-NOOPT-NEXT: shll $4, %eax
486 ; X86-NOOPT-NEXT: retl
488 ; X64-LABEL: test_mul_by_16:
490 ; X64-NEXT: movq %rdi, %rax
491 ; X64-NEXT: shlq $4, %rax
493 %mul = mul nsw i64 %x, 16
497 define i64 @test_mul_by_17(i64 %x) {
498 ; X86-LABEL: test_mul_by_17:
500 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
501 ; X86-NEXT: movl %eax, %ecx
502 ; X86-NEXT: shll $4, %ecx
503 ; X86-NEXT: addl %eax, %ecx
504 ; X86-NEXT: movl $17, %eax
505 ; X86-NEXT: mull {{[0-9]+}}(%esp)
506 ; X86-NEXT: addl %ecx, %edx
509 ; X86-NOOPT-LABEL: test_mul_by_17:
510 ; X86-NOOPT: # %bb.0:
511 ; X86-NOOPT-NEXT: movl $17, %eax
512 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
513 ; X86-NOOPT-NEXT: imull $17, {{[0-9]+}}(%esp), %ecx
514 ; X86-NOOPT-NEXT: addl %ecx, %edx
515 ; X86-NOOPT-NEXT: retl
517 ; X64-OPT-LABEL: test_mul_by_17:
519 ; X64-OPT-NEXT: movq %rdi, %rax
520 ; X64-OPT-NEXT: shlq $4, %rax
521 ; X64-OPT-NEXT: addq %rdi, %rax
524 ; X64-NOOPT-LABEL: test_mul_by_17:
525 ; X64-NOOPT: # %bb.0:
526 ; X64-NOOPT-NEXT: imulq $17, %rdi, %rax
527 ; X64-NOOPT-NEXT: retq
528 %mul = mul nsw i64 %x, 17
532 define i64 @test_mul_by_18(i64 %x) {
533 ; X86-LABEL: test_mul_by_18:
535 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
536 ; X86-NEXT: leal (%eax,%eax,8), %ecx
537 ; X86-NEXT: movl $18, %eax
538 ; X86-NEXT: mull {{[0-9]+}}(%esp)
539 ; X86-NEXT: leal (%edx,%ecx,2), %edx
542 ; X86-NOOPT-LABEL: test_mul_by_18:
543 ; X86-NOOPT: # %bb.0:
544 ; X86-NOOPT-NEXT: movl $18, %eax
545 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
546 ; X86-NOOPT-NEXT: imull $18, {{[0-9]+}}(%esp), %ecx
547 ; X86-NOOPT-NEXT: addl %ecx, %edx
548 ; X86-NOOPT-NEXT: retl
550 ; X64-OPT-LABEL: test_mul_by_18:
552 ; X64-OPT-NEXT: addq %rdi, %rdi
553 ; X64-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
556 ; X64-NOOPT-LABEL: test_mul_by_18:
557 ; X64-NOOPT: # %bb.0:
558 ; X64-NOOPT-NEXT: imulq $18, %rdi, %rax
559 ; X64-NOOPT-NEXT: retq
560 %mul = mul nsw i64 %x, 18
564 define i64 @test_mul_by_19(i64 %x) {
565 ; X86-LABEL: test_mul_by_19:
567 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
568 ; X86-NEXT: leal (%eax,%eax,8), %ecx
569 ; X86-NEXT: leal (%eax,%ecx,2), %ecx
570 ; X86-NEXT: movl $19, %eax
571 ; X86-NEXT: mull {{[0-9]+}}(%esp)
572 ; X86-NEXT: addl %ecx, %edx
575 ; X86-NOOPT-LABEL: test_mul_by_19:
576 ; X86-NOOPT: # %bb.0:
577 ; X86-NOOPT-NEXT: movl $19, %eax
578 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
579 ; X86-NOOPT-NEXT: imull $19, {{[0-9]+}}(%esp), %ecx
580 ; X86-NOOPT-NEXT: addl %ecx, %edx
581 ; X86-NOOPT-NEXT: retl
583 ; X64-HSW-LABEL: test_mul_by_19:
585 ; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax
586 ; X64-HSW-NEXT: leaq (%rdi,%rax,2), %rax
589 ; X64-JAG-LABEL: test_mul_by_19:
591 ; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax
592 ; X64-JAG-NEXT: leaq (%rdi,%rax,2), %rax
595 ; X64-SLM-LABEL: test_mul_by_19:
597 ; X64-SLM-NEXT: imulq $19, %rdi, %rax
600 ; X64-NOOPT-LABEL: test_mul_by_19:
601 ; X64-NOOPT: # %bb.0:
602 ; X64-NOOPT-NEXT: imulq $19, %rdi, %rax
603 ; X64-NOOPT-NEXT: retq
604 %mul = mul nsw i64 %x, 19
608 define i64 @test_mul_by_20(i64 %x) {
609 ; X86-LABEL: test_mul_by_20:
611 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
612 ; X86-NEXT: leal (%eax,%eax,4), %ecx
613 ; X86-NEXT: movl $20, %eax
614 ; X86-NEXT: mull {{[0-9]+}}(%esp)
615 ; X86-NEXT: leal (%edx,%ecx,4), %edx
618 ; X86-NOOPT-LABEL: test_mul_by_20:
619 ; X86-NOOPT: # %bb.0:
620 ; X86-NOOPT-NEXT: movl $20, %eax
621 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
622 ; X86-NOOPT-NEXT: imull $20, {{[0-9]+}}(%esp), %ecx
623 ; X86-NOOPT-NEXT: addl %ecx, %edx
624 ; X86-NOOPT-NEXT: retl
626 ; X64-OPT-LABEL: test_mul_by_20:
628 ; X64-OPT-NEXT: shlq $2, %rdi
629 ; X64-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
632 ; X64-NOOPT-LABEL: test_mul_by_20:
633 ; X64-NOOPT: # %bb.0:
634 ; X64-NOOPT-NEXT: imulq $20, %rdi, %rax
635 ; X64-NOOPT-NEXT: retq
636 %mul = mul nsw i64 %x, 20
640 define i64 @test_mul_by_21(i64 %x) {
641 ; X86-LABEL: test_mul_by_21:
643 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
644 ; X86-NEXT: leal (%eax,%eax,4), %ecx
645 ; X86-NEXT: leal (%eax,%ecx,4), %ecx
646 ; X86-NEXT: movl $21, %eax
647 ; X86-NEXT: mull {{[0-9]+}}(%esp)
648 ; X86-NEXT: addl %ecx, %edx
651 ; X86-NOOPT-LABEL: test_mul_by_21:
652 ; X86-NOOPT: # %bb.0:
653 ; X86-NOOPT-NEXT: movl $21, %eax
654 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
655 ; X86-NOOPT-NEXT: imull $21, {{[0-9]+}}(%esp), %ecx
656 ; X86-NOOPT-NEXT: addl %ecx, %edx
657 ; X86-NOOPT-NEXT: retl
659 ; X64-HSW-LABEL: test_mul_by_21:
661 ; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax
662 ; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax
665 ; X64-JAG-LABEL: test_mul_by_21:
667 ; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax
668 ; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax
671 ; X64-SLM-LABEL: test_mul_by_21:
673 ; X64-SLM-NEXT: imulq $21, %rdi, %rax
676 ; X64-NOOPT-LABEL: test_mul_by_21:
677 ; X64-NOOPT: # %bb.0:
678 ; X64-NOOPT-NEXT: imulq $21, %rdi, %rax
679 ; X64-NOOPT-NEXT: retq
680 %mul = mul nsw i64 %x, 21
684 define i64 @test_mul_by_22(i64 %x) {
685 ; X86-LABEL: test_mul_by_22:
687 ; X86-NEXT: pushl %esi
688 ; X86-NEXT: .cfi_def_cfa_offset 8
689 ; X86-NEXT: .cfi_offset %esi, -8
690 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
691 ; X86-NEXT: leal (%ecx,%ecx,4), %eax
692 ; X86-NEXT: leal (%ecx,%eax,4), %esi
693 ; X86-NEXT: movl $22, %eax
694 ; X86-NEXT: mull {{[0-9]+}}(%esp)
695 ; X86-NEXT: addl %ecx, %edx
696 ; X86-NEXT: addl %esi, %edx
697 ; X86-NEXT: popl %esi
698 ; X86-NEXT: .cfi_def_cfa_offset 4
701 ; X86-NOOPT-LABEL: test_mul_by_22:
702 ; X86-NOOPT: # %bb.0:
703 ; X86-NOOPT-NEXT: movl $22, %eax
704 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
705 ; X86-NOOPT-NEXT: imull $22, {{[0-9]+}}(%esp), %ecx
706 ; X86-NOOPT-NEXT: addl %ecx, %edx
707 ; X86-NOOPT-NEXT: retl
709 ; X64-HSW-LABEL: test_mul_by_22:
711 ; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax
712 ; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax
713 ; X64-HSW-NEXT: addq %rdi, %rax
716 ; X64-JAG-LABEL: test_mul_by_22:
718 ; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax
719 ; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax
720 ; X64-JAG-NEXT: addq %rdi, %rax
723 ; X64-SLM-LABEL: test_mul_by_22:
725 ; X64-SLM-NEXT: imulq $22, %rdi, %rax
728 ; X64-NOOPT-LABEL: test_mul_by_22:
729 ; X64-NOOPT: # %bb.0:
730 ; X64-NOOPT-NEXT: imulq $22, %rdi, %rax
731 ; X64-NOOPT-NEXT: retq
732 %mul = mul nsw i64 %x, 22
736 define i64 @test_mul_by_23(i64 %x) {
737 ; X86-LABEL: test_mul_by_23:
739 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
740 ; X86-NEXT: leal (%eax,%eax,2), %ecx
741 ; X86-NEXT: shll $3, %ecx
742 ; X86-NEXT: subl %eax, %ecx
743 ; X86-NEXT: movl $23, %eax
744 ; X86-NEXT: mull {{[0-9]+}}(%esp)
745 ; X86-NEXT: addl %ecx, %edx
748 ; X86-NOOPT-LABEL: test_mul_by_23:
749 ; X86-NOOPT: # %bb.0:
750 ; X86-NOOPT-NEXT: movl $23, %eax
751 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
752 ; X86-NOOPT-NEXT: imull $23, {{[0-9]+}}(%esp), %ecx
753 ; X86-NOOPT-NEXT: addl %ecx, %edx
754 ; X86-NOOPT-NEXT: retl
756 ; X64-HSW-LABEL: test_mul_by_23:
758 ; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax
759 ; X64-HSW-NEXT: shlq $3, %rax
760 ; X64-HSW-NEXT: subq %rdi, %rax
763 ; X64-JAG-LABEL: test_mul_by_23:
765 ; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax
766 ; X64-JAG-NEXT: shlq $3, %rax
767 ; X64-JAG-NEXT: subq %rdi, %rax
770 ; X64-SLM-LABEL: test_mul_by_23:
772 ; X64-SLM-NEXT: imulq $23, %rdi, %rax
775 ; X64-NOOPT-LABEL: test_mul_by_23:
776 ; X64-NOOPT: # %bb.0:
777 ; X64-NOOPT-NEXT: imulq $23, %rdi, %rax
778 ; X64-NOOPT-NEXT: retq
779 %mul = mul nsw i64 %x, 23
783 define i64 @test_mul_by_24(i64 %x) {
784 ; X86-LABEL: test_mul_by_24:
786 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
787 ; X86-NEXT: leal (%eax,%eax,2), %ecx
788 ; X86-NEXT: movl $24, %eax
789 ; X86-NEXT: mull {{[0-9]+}}(%esp)
790 ; X86-NEXT: leal (%edx,%ecx,8), %edx
793 ; X86-NOOPT-LABEL: test_mul_by_24:
794 ; X86-NOOPT: # %bb.0:
795 ; X86-NOOPT-NEXT: movl $24, %eax
796 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
797 ; X86-NOOPT-NEXT: imull $24, {{[0-9]+}}(%esp), %ecx
798 ; X86-NOOPT-NEXT: addl %ecx, %edx
799 ; X86-NOOPT-NEXT: retl
801 ; X64-OPT-LABEL: test_mul_by_24:
803 ; X64-OPT-NEXT: shlq $3, %rdi
804 ; X64-OPT-NEXT: leaq (%rdi,%rdi,2), %rax
807 ; X64-NOOPT-LABEL: test_mul_by_24:
808 ; X64-NOOPT: # %bb.0:
809 ; X64-NOOPT-NEXT: imulq $24, %rdi, %rax
810 ; X64-NOOPT-NEXT: retq
811 %mul = mul nsw i64 %x, 24
815 define i64 @test_mul_by_25(i64 %x) {
816 ; X86-LABEL: test_mul_by_25:
818 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
819 ; X86-NEXT: movl $25, %eax
820 ; X86-NEXT: mull {{[0-9]+}}(%esp)
821 ; X86-NEXT: leal (%ecx,%ecx,4), %ecx
822 ; X86-NEXT: leal (%ecx,%ecx,4), %ecx
823 ; X86-NEXT: addl %ecx, %edx
826 ; X86-NOOPT-LABEL: test_mul_by_25:
827 ; X86-NOOPT: # %bb.0:
828 ; X86-NOOPT-NEXT: movl $25, %eax
829 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
830 ; X86-NOOPT-NEXT: imull $25, {{[0-9]+}}(%esp), %ecx
831 ; X86-NOOPT-NEXT: addl %ecx, %edx
832 ; X86-NOOPT-NEXT: retl
834 ; X64-OPT-LABEL: test_mul_by_25:
836 ; X64-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
837 ; X64-OPT-NEXT: leaq (%rax,%rax,4), %rax
840 ; X64-NOOPT-LABEL: test_mul_by_25:
841 ; X64-NOOPT: # %bb.0:
842 ; X64-NOOPT-NEXT: imulq $25, %rdi, %rax
843 ; X64-NOOPT-NEXT: retq
844 %mul = mul nsw i64 %x, 25
848 define i64 @test_mul_by_26(i64 %x) {
849 ; X86-LABEL: test_mul_by_26:
851 ; X86-NEXT: pushl %esi
852 ; X86-NEXT: .cfi_def_cfa_offset 8
853 ; X86-NEXT: .cfi_offset %esi, -8
854 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
855 ; X86-NEXT: leal (%ecx,%ecx,4), %eax
856 ; X86-NEXT: leal (%eax,%eax,4), %esi
857 ; X86-NEXT: movl $26, %eax
858 ; X86-NEXT: mull {{[0-9]+}}(%esp)
859 ; X86-NEXT: addl %ecx, %edx
860 ; X86-NEXT: addl %esi, %edx
861 ; X86-NEXT: popl %esi
862 ; X86-NEXT: .cfi_def_cfa_offset 4
865 ; X86-NOOPT-LABEL: test_mul_by_26:
866 ; X86-NOOPT: # %bb.0:
867 ; X86-NOOPT-NEXT: movl $26, %eax
868 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
869 ; X86-NOOPT-NEXT: imull $26, {{[0-9]+}}(%esp), %ecx
870 ; X86-NOOPT-NEXT: addl %ecx, %edx
871 ; X86-NOOPT-NEXT: retl
873 ; X64-HSW-LABEL: test_mul_by_26:
875 ; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax
876 ; X64-HSW-NEXT: leaq (%rax,%rax,4), %rax
877 ; X64-HSW-NEXT: addq %rdi, %rax
880 ; X64-JAG-LABEL: test_mul_by_26:
882 ; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax
883 ; X64-JAG-NEXT: leaq (%rax,%rax,4), %rax
884 ; X64-JAG-NEXT: addq %rdi, %rax
887 ; X64-SLM-LABEL: test_mul_by_26:
889 ; X64-SLM-NEXT: imulq $26, %rdi, %rax
892 ; X64-NOOPT-LABEL: test_mul_by_26:
893 ; X64-NOOPT: # %bb.0:
894 ; X64-NOOPT-NEXT: imulq $26, %rdi, %rax
895 ; X64-NOOPT-NEXT: retq
896 %mul = mul nsw i64 %x, 26
900 define i64 @test_mul_by_27(i64 %x) {
901 ; X86-LABEL: test_mul_by_27:
903 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
904 ; X86-NEXT: movl $27, %eax
905 ; X86-NEXT: mull {{[0-9]+}}(%esp)
906 ; X86-NEXT: leal (%ecx,%ecx,8), %ecx
907 ; X86-NEXT: leal (%ecx,%ecx,2), %ecx
908 ; X86-NEXT: addl %ecx, %edx
911 ; X86-NOOPT-LABEL: test_mul_by_27:
912 ; X86-NOOPT: # %bb.0:
913 ; X86-NOOPT-NEXT: movl $27, %eax
914 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
915 ; X86-NOOPT-NEXT: imull $27, {{[0-9]+}}(%esp), %ecx
916 ; X86-NOOPT-NEXT: addl %ecx, %edx
917 ; X86-NOOPT-NEXT: retl
919 ; X64-OPT-LABEL: test_mul_by_27:
921 ; X64-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
922 ; X64-OPT-NEXT: leaq (%rax,%rax,2), %rax
925 ; X64-NOOPT-LABEL: test_mul_by_27:
926 ; X64-NOOPT: # %bb.0:
927 ; X64-NOOPT-NEXT: imulq $27, %rdi, %rax
928 ; X64-NOOPT-NEXT: retq
929 %mul = mul nsw i64 %x, 27
933 define i64 @test_mul_by_28(i64 %x) {
934 ; X86-LABEL: test_mul_by_28:
936 ; X86-NEXT: pushl %esi
937 ; X86-NEXT: .cfi_def_cfa_offset 8
938 ; X86-NEXT: .cfi_offset %esi, -8
939 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
940 ; X86-NEXT: leal (%ecx,%ecx,8), %eax
941 ; X86-NEXT: leal (%eax,%eax,2), %esi
942 ; X86-NEXT: movl $28, %eax
943 ; X86-NEXT: mull {{[0-9]+}}(%esp)
944 ; X86-NEXT: addl %ecx, %edx
945 ; X86-NEXT: addl %esi, %edx
946 ; X86-NEXT: popl %esi
947 ; X86-NEXT: .cfi_def_cfa_offset 4
950 ; X86-NOOPT-LABEL: test_mul_by_28:
951 ; X86-NOOPT: # %bb.0:
952 ; X86-NOOPT-NEXT: movl $28, %eax
953 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
954 ; X86-NOOPT-NEXT: imull $28, {{[0-9]+}}(%esp), %ecx
955 ; X86-NOOPT-NEXT: addl %ecx, %edx
956 ; X86-NOOPT-NEXT: retl
958 ; X64-HSW-LABEL: test_mul_by_28:
960 ; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax
961 ; X64-HSW-NEXT: leaq (%rax,%rax,2), %rax
962 ; X64-HSW-NEXT: addq %rdi, %rax
965 ; X64-JAG-LABEL: test_mul_by_28:
967 ; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax
968 ; X64-JAG-NEXT: leaq (%rax,%rax,2), %rax
969 ; X64-JAG-NEXT: addq %rdi, %rax
972 ; X64-SLM-LABEL: test_mul_by_28:
974 ; X64-SLM-NEXT: imulq $28, %rdi, %rax
977 ; X64-NOOPT-LABEL: test_mul_by_28:
978 ; X64-NOOPT: # %bb.0:
979 ; X64-NOOPT-NEXT: imulq $28, %rdi, %rax
980 ; X64-NOOPT-NEXT: retq
981 %mul = mul nsw i64 %x, 28
985 define i64 @test_mul_by_29(i64 %x) {
986 ; X86-LABEL: test_mul_by_29:
988 ; X86-NEXT: pushl %esi
989 ; X86-NEXT: .cfi_def_cfa_offset 8
990 ; X86-NEXT: .cfi_offset %esi, -8
991 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
992 ; X86-NEXT: leal (%ecx,%ecx,8), %eax
993 ; X86-NEXT: leal (%eax,%eax,2), %esi
994 ; X86-NEXT: addl %ecx, %ecx
995 ; X86-NEXT: movl $29, %eax
996 ; X86-NEXT: mull {{[0-9]+}}(%esp)
997 ; X86-NEXT: addl %ecx, %edx
998 ; X86-NEXT: addl %esi, %edx
999 ; X86-NEXT: popl %esi
1000 ; X86-NEXT: .cfi_def_cfa_offset 4
1003 ; X86-NOOPT-LABEL: test_mul_by_29:
1004 ; X86-NOOPT: # %bb.0:
1005 ; X86-NOOPT-NEXT: movl $29, %eax
1006 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1007 ; X86-NOOPT-NEXT: imull $29, {{[0-9]+}}(%esp), %ecx
1008 ; X86-NOOPT-NEXT: addl %ecx, %edx
1009 ; X86-NOOPT-NEXT: retl
1011 ; X64-HSW-LABEL: test_mul_by_29:
1013 ; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax
1014 ; X64-HSW-NEXT: leaq (%rax,%rax,2), %rax
1015 ; X64-HSW-NEXT: addq %rdi, %rax
1016 ; X64-HSW-NEXT: addq %rdi, %rax
1017 ; X64-HSW-NEXT: retq
1019 ; X64-JAG-LABEL: test_mul_by_29:
1021 ; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax
1022 ; X64-JAG-NEXT: leaq (%rax,%rax,2), %rax
1023 ; X64-JAG-NEXT: addq %rdi, %rax
1024 ; X64-JAG-NEXT: addq %rdi, %rax
1025 ; X64-JAG-NEXT: retq
1027 ; X64-SLM-LABEL: test_mul_by_29:
1029 ; X64-SLM-NEXT: imulq $29, %rdi, %rax
1030 ; X64-SLM-NEXT: retq
1032 ; X64-NOOPT-LABEL: test_mul_by_29:
1033 ; X64-NOOPT: # %bb.0:
1034 ; X64-NOOPT-NEXT: imulq $29, %rdi, %rax
1035 ; X64-NOOPT-NEXT: retq
1036 %mul = mul nsw i64 %x, 29
1040 define i64 @test_mul_by_30(i64 %x) {
1041 ; X86-LABEL: test_mul_by_30:
1043 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1044 ; X86-NEXT: leal (%ecx,%ecx), %eax
1045 ; X86-NEXT: shll $5, %ecx
1046 ; X86-NEXT: subl %eax, %ecx
1047 ; X86-NEXT: movl $30, %eax
1048 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1049 ; X86-NEXT: addl %ecx, %edx
1052 ; X86-NOOPT-LABEL: test_mul_by_30:
1053 ; X86-NOOPT: # %bb.0:
1054 ; X86-NOOPT-NEXT: movl $30, %eax
1055 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1056 ; X86-NOOPT-NEXT: imull $30, {{[0-9]+}}(%esp), %ecx
1057 ; X86-NOOPT-NEXT: addl %ecx, %edx
1058 ; X86-NOOPT-NEXT: retl
1060 ; X64-OPT-LABEL: test_mul_by_30:
1062 ; X64-OPT-NEXT: movq %rdi, %rax
1063 ; X64-OPT-NEXT: shlq $5, %rax
1064 ; X64-OPT-NEXT: subq %rdi, %rax
1065 ; X64-OPT-NEXT: subq %rdi, %rax
1066 ; X64-OPT-NEXT: retq
1068 ; X64-NOOPT-LABEL: test_mul_by_30:
1069 ; X64-NOOPT: # %bb.0:
1070 ; X64-NOOPT-NEXT: imulq $30, %rdi, %rax
1071 ; X64-NOOPT-NEXT: retq
1072 %mul = mul nsw i64 %x, 30
1076 define i64 @test_mul_by_31(i64 %x) {
1077 ; X86-LABEL: test_mul_by_31:
1079 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1080 ; X86-NEXT: movl %eax, %ecx
1081 ; X86-NEXT: shll $5, %ecx
1082 ; X86-NEXT: subl %eax, %ecx
1083 ; X86-NEXT: movl $31, %eax
1084 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1085 ; X86-NEXT: addl %ecx, %edx
1088 ; X86-NOOPT-LABEL: test_mul_by_31:
1089 ; X86-NOOPT: # %bb.0:
1090 ; X86-NOOPT-NEXT: movl $31, %eax
1091 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1092 ; X86-NOOPT-NEXT: imull $31, {{[0-9]+}}(%esp), %ecx
1093 ; X86-NOOPT-NEXT: addl %ecx, %edx
1094 ; X86-NOOPT-NEXT: retl
1096 ; X64-OPT-LABEL: test_mul_by_31:
1098 ; X64-OPT-NEXT: movq %rdi, %rax
1099 ; X64-OPT-NEXT: shlq $5, %rax
1100 ; X64-OPT-NEXT: subq %rdi, %rax
1101 ; X64-OPT-NEXT: retq
1103 ; X64-NOOPT-LABEL: test_mul_by_31:
1104 ; X64-NOOPT: # %bb.0:
1105 ; X64-NOOPT-NEXT: imulq $31, %rdi, %rax
1106 ; X64-NOOPT-NEXT: retq
1107 %mul = mul nsw i64 %x, 31
1111 define i64 @test_mul_by_32(i64 %x) {
1112 ; X86-LABEL: test_mul_by_32:
1114 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1115 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
1116 ; X86-NEXT: shldl $5, %eax, %edx
1117 ; X86-NEXT: shll $5, %eax
1120 ; X86-NOOPT-LABEL: test_mul_by_32:
1121 ; X86-NOOPT: # %bb.0:
1122 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
1123 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
1124 ; X86-NOOPT-NEXT: shldl $5, %eax, %edx
1125 ; X86-NOOPT-NEXT: shll $5, %eax
1126 ; X86-NOOPT-NEXT: retl
1128 ; X64-LABEL: test_mul_by_32:
1130 ; X64-NEXT: movq %rdi, %rax
1131 ; X64-NEXT: shlq $5, %rax
1133 %mul = mul nsw i64 %x, 32
1137 define i64 @test_mul_by_37(i64 %x) {
1138 ; X86-LABEL: test_mul_by_37:
1140 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1141 ; X86-NEXT: leal (%eax,%eax,8), %ecx
1142 ; X86-NEXT: leal (%eax,%ecx,4), %ecx
1143 ; X86-NEXT: movl $37, %eax
1144 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1145 ; X86-NEXT: addl %ecx, %edx
1148 ; X86-NOOPT-LABEL: test_mul_by_37:
1149 ; X86-NOOPT: # %bb.0:
1150 ; X86-NOOPT-NEXT: movl $37, %eax
1151 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1152 ; X86-NOOPT-NEXT: imull $37, {{[0-9]+}}(%esp), %ecx
1153 ; X86-NOOPT-NEXT: addl %ecx, %edx
1154 ; X86-NOOPT-NEXT: retl
1156 ; X64-HSW-LABEL: test_mul_by_37:
1158 ; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax
1159 ; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax
1160 ; X64-HSW-NEXT: retq
1162 ; X64-JAG-LABEL: test_mul_by_37:
1164 ; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax
1165 ; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax
1166 ; X64-JAG-NEXT: retq
1168 ; X64-SLM-LABEL: test_mul_by_37:
1170 ; X64-SLM-NEXT: imulq $37, %rdi, %rax
1171 ; X64-SLM-NEXT: retq
1173 ; X64-NOOPT-LABEL: test_mul_by_37:
1174 ; X64-NOOPT: # %bb.0:
1175 ; X64-NOOPT-NEXT: imulq $37, %rdi, %rax
1176 ; X64-NOOPT-NEXT: retq
1177 %mul = mul nsw i64 %x, 37
1181 define i64 @test_mul_by_41(i64 %x) {
1182 ; X86-LABEL: test_mul_by_41:
1184 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1185 ; X86-NEXT: leal (%eax,%eax,4), %ecx
1186 ; X86-NEXT: leal (%eax,%ecx,8), %ecx
1187 ; X86-NEXT: movl $41, %eax
1188 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1189 ; X86-NEXT: addl %ecx, %edx
1192 ; X86-NOOPT-LABEL: test_mul_by_41:
1193 ; X86-NOOPT: # %bb.0:
1194 ; X86-NOOPT-NEXT: movl $41, %eax
1195 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1196 ; X86-NOOPT-NEXT: imull $41, {{[0-9]+}}(%esp), %ecx
1197 ; X86-NOOPT-NEXT: addl %ecx, %edx
1198 ; X86-NOOPT-NEXT: retl
1200 ; X64-HSW-LABEL: test_mul_by_41:
1202 ; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax
1203 ; X64-HSW-NEXT: leaq (%rdi,%rax,8), %rax
1204 ; X64-HSW-NEXT: retq
1206 ; X64-JAG-LABEL: test_mul_by_41:
1208 ; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax
1209 ; X64-JAG-NEXT: leaq (%rdi,%rax,8), %rax
1210 ; X64-JAG-NEXT: retq
1212 ; X64-SLM-LABEL: test_mul_by_41:
1214 ; X64-SLM-NEXT: imulq $41, %rdi, %rax
1215 ; X64-SLM-NEXT: retq
1217 ; X64-NOOPT-LABEL: test_mul_by_41:
1218 ; X64-NOOPT: # %bb.0:
1219 ; X64-NOOPT-NEXT: imulq $41, %rdi, %rax
1220 ; X64-NOOPT-NEXT: retq
1221 %mul = mul nsw i64 %x, 41
1225 define i64 @test_mul_by_62(i64 %x) {
1226 ; X86-LABEL: test_mul_by_62:
1228 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1229 ; X86-NEXT: leal (%ecx,%ecx), %eax
1230 ; X86-NEXT: shll $6, %ecx
1231 ; X86-NEXT: subl %eax, %ecx
1232 ; X86-NEXT: movl $62, %eax
1233 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1234 ; X86-NEXT: addl %ecx, %edx
1237 ; X86-NOOPT-LABEL: test_mul_by_62:
1238 ; X86-NOOPT: # %bb.0:
1239 ; X86-NOOPT-NEXT: movl $62, %eax
1240 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1241 ; X86-NOOPT-NEXT: imull $62, {{[0-9]+}}(%esp), %ecx
1242 ; X86-NOOPT-NEXT: addl %ecx, %edx
1243 ; X86-NOOPT-NEXT: retl
1245 ; X64-OPT-LABEL: test_mul_by_62:
1247 ; X64-OPT-NEXT: movq %rdi, %rax
1248 ; X64-OPT-NEXT: shlq $6, %rax
1249 ; X64-OPT-NEXT: subq %rdi, %rax
1250 ; X64-OPT-NEXT: subq %rdi, %rax
1251 ; X64-OPT-NEXT: retq
1253 ; X64-NOOPT-LABEL: test_mul_by_62:
1254 ; X64-NOOPT: # %bb.0:
1255 ; X64-NOOPT-NEXT: imulq $62, %rdi, %rax
1256 ; X64-NOOPT-NEXT: retq
1257 %mul = mul nsw i64 %x, 62
1261 define i64 @test_mul_by_66(i64 %x) {
1262 ; X86-LABEL: test_mul_by_66:
1264 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1265 ; X86-NEXT: movl %eax, %ecx
1266 ; X86-NEXT: shll $6, %ecx
1267 ; X86-NEXT: leal (%ecx,%eax,2), %ecx
1268 ; X86-NEXT: movl $66, %eax
1269 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1270 ; X86-NEXT: addl %ecx, %edx
1273 ; X86-NOOPT-LABEL: test_mul_by_66:
1274 ; X86-NOOPT: # %bb.0:
1275 ; X86-NOOPT-NEXT: movl $66, %eax
1276 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1277 ; X86-NOOPT-NEXT: imull $66, {{[0-9]+}}(%esp), %ecx
1278 ; X86-NOOPT-NEXT: addl %ecx, %edx
1279 ; X86-NOOPT-NEXT: retl
1281 ; X64-HSW-LABEL: test_mul_by_66:
1283 ; X64-HSW-NEXT: movq %rdi, %rax
1284 ; X64-HSW-NEXT: shlq $6, %rax
1285 ; X64-HSW-NEXT: leaq (%rax,%rdi,2), %rax
1286 ; X64-HSW-NEXT: retq
1288 ; X64-JAG-LABEL: test_mul_by_66:
1290 ; X64-JAG-NEXT: movq %rdi, %rax
1291 ; X64-JAG-NEXT: shlq $6, %rax
1292 ; X64-JAG-NEXT: leaq (%rax,%rdi,2), %rax
1293 ; X64-JAG-NEXT: retq
1295 ; X64-SLM-LABEL: test_mul_by_66:
1297 ; X64-SLM-NEXT: leaq (%rdi,%rdi), %rax
1298 ; X64-SLM-NEXT: shlq $6, %rdi
1299 ; X64-SLM-NEXT: addq %rdi, %rax
1300 ; X64-SLM-NEXT: retq
1302 ; X64-NOOPT-LABEL: test_mul_by_66:
1303 ; X64-NOOPT: # %bb.0:
1304 ; X64-NOOPT-NEXT: imulq $66, %rdi, %rax
1305 ; X64-NOOPT-NEXT: retq
1306 %mul = mul nsw i64 %x, 66
1310 define i64 @test_mul_by_73(i64 %x) {
1311 ; X86-LABEL: test_mul_by_73:
1313 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1314 ; X86-NEXT: leal (%eax,%eax,8), %ecx
1315 ; X86-NEXT: leal (%eax,%ecx,8), %ecx
1316 ; X86-NEXT: movl $73, %eax
1317 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1318 ; X86-NEXT: addl %ecx, %edx
1321 ; X86-NOOPT-LABEL: test_mul_by_73:
1322 ; X86-NOOPT: # %bb.0:
1323 ; X86-NOOPT-NEXT: movl $73, %eax
1324 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1325 ; X86-NOOPT-NEXT: imull $73, {{[0-9]+}}(%esp), %ecx
1326 ; X86-NOOPT-NEXT: addl %ecx, %edx
1327 ; X86-NOOPT-NEXT: retl
1329 ; X64-HSW-LABEL: test_mul_by_73:
1331 ; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax
1332 ; X64-HSW-NEXT: leaq (%rdi,%rax,8), %rax
1333 ; X64-HSW-NEXT: retq
1335 ; X64-JAG-LABEL: test_mul_by_73:
1337 ; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax
1338 ; X64-JAG-NEXT: leaq (%rdi,%rax,8), %rax
1339 ; X64-JAG-NEXT: retq
1341 ; X64-SLM-LABEL: test_mul_by_73:
1343 ; X64-SLM-NEXT: imulq $73, %rdi, %rax
1344 ; X64-SLM-NEXT: retq
1346 ; X64-NOOPT-LABEL: test_mul_by_73:
1347 ; X64-NOOPT: # %bb.0:
1348 ; X64-NOOPT-NEXT: imulq $73, %rdi, %rax
1349 ; X64-NOOPT-NEXT: retq
1350 %mul = mul nsw i64 %x, 73
1354 define i64 @test_mul_by_520(i64 %x) {
1355 ; X86-LABEL: test_mul_by_520:
1357 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1358 ; X86-NEXT: movl %eax, %ecx
1359 ; X86-NEXT: shll $9, %ecx
1360 ; X86-NEXT: leal (%ecx,%eax,8), %ecx
1361 ; X86-NEXT: movl $520, %eax # imm = 0x208
1362 ; X86-NEXT: mull {{[0-9]+}}(%esp)
1363 ; X86-NEXT: addl %ecx, %edx
1366 ; X86-NOOPT-LABEL: test_mul_by_520:
1367 ; X86-NOOPT: # %bb.0:
1368 ; X86-NOOPT-NEXT: movl $520, %eax # imm = 0x208
1369 ; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
1370 ; X86-NOOPT-NEXT: imull $520, {{[0-9]+}}(%esp), %ecx # imm = 0x208
1371 ; X86-NOOPT-NEXT: addl %ecx, %edx
1372 ; X86-NOOPT-NEXT: retl
1374 ; X64-HSW-LABEL: test_mul_by_520:
1376 ; X64-HSW-NEXT: movq %rdi, %rax
1377 ; X64-HSW-NEXT: shlq $9, %rax
1378 ; X64-HSW-NEXT: leaq (%rax,%rdi,8), %rax
1379 ; X64-HSW-NEXT: retq
1381 ; X64-JAG-LABEL: test_mul_by_520:
1383 ; X64-JAG-NEXT: movq %rdi, %rax
1384 ; X64-JAG-NEXT: shlq $9, %rax
1385 ; X64-JAG-NEXT: leaq (%rax,%rdi,8), %rax
1386 ; X64-JAG-NEXT: retq
1388 ; X64-SLM-LABEL: test_mul_by_520:
1390 ; X64-SLM-NEXT: imulq $520, %rdi, %rax # imm = 0x208
1391 ; X64-SLM-NEXT: retq
1393 ; X64-NOOPT-LABEL: test_mul_by_520:
1394 ; X64-NOOPT: # %bb.0:
1395 ; X64-NOOPT-NEXT: imulq $520, %rdi, %rax # imm = 0x208
1396 ; X64-NOOPT-NEXT: retq
1397 %mul = mul nsw i64 %x, 520
1401 define i64 @test_mul_by_neg10(i64 %x) {
1402 ; X86-LABEL: test_mul_by_neg10:
1404 ; X86-NEXT: pushl %esi
1405 ; X86-NEXT: .cfi_def_cfa_offset 8
1406 ; X86-NEXT: .cfi_offset %esi, -8
1407 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1408 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
1409 ; X86-NEXT: movl $-10, %edx
1410 ; X86-NEXT: movl %ecx, %eax
1411 ; X86-NEXT: mull %edx
1412 ; X86-NEXT: subl %ecx, %edx
1413 ; X86-NEXT: addl %esi, %esi
1414 ; X86-NEXT: leal (%esi,%esi,4), %ecx
1415 ; X86-NEXT: subl %ecx, %edx
1416 ; X86-NEXT: popl %esi
1417 ; X86-NEXT: .cfi_def_cfa_offset 4
1420 ; X86-NOOPT-LABEL: test_mul_by_neg10:
1421 ; X86-NOOPT: # %bb.0:
1422 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %ecx
1423 ; X86-NOOPT-NEXT: movl $-10, %edx
1424 ; X86-NOOPT-NEXT: movl %ecx, %eax
1425 ; X86-NOOPT-NEXT: mull %edx
1426 ; X86-NOOPT-NEXT: subl %ecx, %edx
1427 ; X86-NOOPT-NEXT: imull $-10, {{[0-9]+}}(%esp), %ecx
1428 ; X86-NOOPT-NEXT: addl %ecx, %edx
1429 ; X86-NOOPT-NEXT: retl
1431 ; X64-OPT-LABEL: test_mul_by_neg10:
1433 ; X64-OPT-NEXT: addq %rdi, %rdi
1434 ; X64-OPT-NEXT: leaq (%rdi,%rdi,4), %rax
1435 ; X64-OPT-NEXT: negq %rax
1436 ; X64-OPT-NEXT: retq
1438 ; X64-NOOPT-LABEL: test_mul_by_neg10:
1439 ; X64-NOOPT: # %bb.0:
1440 ; X64-NOOPT-NEXT: imulq $-10, %rdi, %rax
1441 ; X64-NOOPT-NEXT: retq
1442 %mul = mul nsw i64 %x, -10
1446 define i64 @test_mul_by_neg36(i64 %x) {
1447 ; X86-LABEL: test_mul_by_neg36:
1449 ; X86-NEXT: pushl %esi
1450 ; X86-NEXT: .cfi_def_cfa_offset 8
1451 ; X86-NEXT: .cfi_offset %esi, -8
1452 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1453 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
1454 ; X86-NEXT: movl $-36, %edx
1455 ; X86-NEXT: movl %ecx, %eax
1456 ; X86-NEXT: mull %edx
1457 ; X86-NEXT: subl %ecx, %edx
1458 ; X86-NEXT: shll $2, %esi
1459 ; X86-NEXT: leal (%esi,%esi,8), %ecx
1460 ; X86-NEXT: subl %ecx, %edx
1461 ; X86-NEXT: popl %esi
1462 ; X86-NEXT: .cfi_def_cfa_offset 4
1465 ; X86-NOOPT-LABEL: test_mul_by_neg36:
1466 ; X86-NOOPT: # %bb.0:
1467 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %ecx
1468 ; X86-NOOPT-NEXT: movl $-36, %edx
1469 ; X86-NOOPT-NEXT: movl %ecx, %eax
1470 ; X86-NOOPT-NEXT: mull %edx
1471 ; X86-NOOPT-NEXT: subl %ecx, %edx
1472 ; X86-NOOPT-NEXT: imull $-36, {{[0-9]+}}(%esp), %ecx
1473 ; X86-NOOPT-NEXT: addl %ecx, %edx
1474 ; X86-NOOPT-NEXT: retl
1476 ; X64-OPT-LABEL: test_mul_by_neg36:
1478 ; X64-OPT-NEXT: shlq $2, %rdi
1479 ; X64-OPT-NEXT: leaq (%rdi,%rdi,8), %rax
1480 ; X64-OPT-NEXT: negq %rax
1481 ; X64-OPT-NEXT: retq
1483 ; X64-NOOPT-LABEL: test_mul_by_neg36:
1484 ; X64-NOOPT: # %bb.0:
1485 ; X64-NOOPT-NEXT: imulq $-36, %rdi, %rax
1486 ; X64-NOOPT-NEXT: retq
1487 %mul = mul nsw i64 %x, -36
1492 define i64 @test_mul_spec(i64 %x) nounwind {
1493 ; X86-LABEL: test_mul_spec:
1495 ; X86-NEXT: pushl %ebp
1496 ; X86-NEXT: pushl %ebx
1497 ; X86-NEXT: pushl %edi
1498 ; X86-NEXT: pushl %esi
1499 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
1500 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebp
1501 ; X86-NEXT: movl $9, %ecx
1502 ; X86-NEXT: movl %edi, %eax
1503 ; X86-NEXT: mull %ecx
1504 ; X86-NEXT: movl %eax, %esi
1505 ; X86-NEXT: movl %edx, %ecx
1506 ; X86-NEXT: leal (%ebp,%ebp,8), %eax
1507 ; X86-NEXT: addl $42, %esi
1508 ; X86-NEXT: adcl %eax, %ecx
1509 ; X86-NEXT: movl $5, %edx
1510 ; X86-NEXT: movl %edi, %eax
1511 ; X86-NEXT: mull %edx
1512 ; X86-NEXT: movl %eax, %edi
1513 ; X86-NEXT: movl %edx, %ebx
1514 ; X86-NEXT: leal (%ebp,%ebp,4), %eax
1515 ; X86-NEXT: addl $2, %edi
1516 ; X86-NEXT: adcl %eax, %ebx
1517 ; X86-NEXT: movl %esi, %eax
1518 ; X86-NEXT: mull %edi
1519 ; X86-NEXT: imull %esi, %ebx
1520 ; X86-NEXT: addl %ebx, %edx
1521 ; X86-NEXT: imull %ecx, %edi
1522 ; X86-NEXT: addl %edi, %edx
1523 ; X86-NEXT: popl %esi
1524 ; X86-NEXT: popl %edi
1525 ; X86-NEXT: popl %ebx
1526 ; X86-NEXT: popl %ebp
1529 ; X86-NOOPT-LABEL: test_mul_spec:
1530 ; X86-NOOPT: # %bb.0:
1531 ; X86-NOOPT-NEXT: pushl %ebp
1532 ; X86-NOOPT-NEXT: pushl %ebx
1533 ; X86-NOOPT-NEXT: pushl %edi
1534 ; X86-NOOPT-NEXT: pushl %esi
1535 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edi
1536 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %ebp
1537 ; X86-NOOPT-NEXT: movl $9, %ecx
1538 ; X86-NOOPT-NEXT: movl %edi, %eax
1539 ; X86-NOOPT-NEXT: mull %ecx
1540 ; X86-NOOPT-NEXT: movl %eax, %esi
1541 ; X86-NOOPT-NEXT: movl %edx, %ecx
1542 ; X86-NOOPT-NEXT: leal (%ebp,%ebp,8), %eax
1543 ; X86-NOOPT-NEXT: addl $42, %esi
1544 ; X86-NOOPT-NEXT: adcl %eax, %ecx
1545 ; X86-NOOPT-NEXT: movl $5, %edx
1546 ; X86-NOOPT-NEXT: movl %edi, %eax
1547 ; X86-NOOPT-NEXT: mull %edx
1548 ; X86-NOOPT-NEXT: movl %eax, %edi
1549 ; X86-NOOPT-NEXT: movl %edx, %ebx
1550 ; X86-NOOPT-NEXT: leal (%ebp,%ebp,4), %eax
1551 ; X86-NOOPT-NEXT: addl $2, %edi
1552 ; X86-NOOPT-NEXT: adcl %eax, %ebx
1553 ; X86-NOOPT-NEXT: movl %esi, %eax
1554 ; X86-NOOPT-NEXT: mull %edi
1555 ; X86-NOOPT-NEXT: imull %esi, %ebx
1556 ; X86-NOOPT-NEXT: addl %ebx, %edx
1557 ; X86-NOOPT-NEXT: imull %ecx, %edi
1558 ; X86-NOOPT-NEXT: addl %edi, %edx
1559 ; X86-NOOPT-NEXT: popl %esi
1560 ; X86-NOOPT-NEXT: popl %edi
1561 ; X86-NOOPT-NEXT: popl %ebx
1562 ; X86-NOOPT-NEXT: popl %ebp
1563 ; X86-NOOPT-NEXT: retl
1565 ; X64-HSW-LABEL: test_mul_spec:
1567 ; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rcx
1568 ; X64-HSW-NEXT: addq $42, %rcx
1569 ; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax
1570 ; X64-HSW-NEXT: addq $2, %rax
1571 ; X64-HSW-NEXT: imulq %rcx, %rax
1572 ; X64-HSW-NEXT: retq
1574 ; X64-JAG-LABEL: test_mul_spec:
1576 ; X64-JAG-NEXT: leaq 42(%rdi,%rdi,8), %rcx
1577 ; X64-JAG-NEXT: leaq 2(%rdi,%rdi,4), %rax
1578 ; X64-JAG-NEXT: imulq %rcx, %rax
1579 ; X64-JAG-NEXT: retq
1581 ; X64-SLM-LABEL: test_mul_spec:
1583 ; X64-SLM-NEXT: leaq 42(%rdi,%rdi,8), %rcx
1584 ; X64-SLM-NEXT: leaq 2(%rdi,%rdi,4), %rax
1585 ; X64-SLM-NEXT: imulq %rcx, %rax
1586 ; X64-SLM-NEXT: retq
1588 ; X64-HSW-NOOPT-LABEL: test_mul_spec:
1589 ; X64-HSW-NOOPT: # %bb.0:
1590 ; X64-HSW-NOOPT-NEXT: leaq (%rdi,%rdi,8), %rcx
1591 ; X64-HSW-NOOPT-NEXT: addq $42, %rcx
1592 ; X64-HSW-NOOPT-NEXT: leaq (%rdi,%rdi,4), %rax
1593 ; X64-HSW-NOOPT-NEXT: addq $2, %rax
1594 ; X64-HSW-NOOPT-NEXT: imulq %rcx, %rax
1595 ; X64-HSW-NOOPT-NEXT: retq
1597 ; X64-JAG-NOOPT-LABEL: test_mul_spec:
1598 ; X64-JAG-NOOPT: # %bb.0:
1599 ; X64-JAG-NOOPT-NEXT: leaq 42(%rdi,%rdi,8), %rcx
1600 ; X64-JAG-NOOPT-NEXT: leaq 2(%rdi,%rdi,4), %rax
1601 ; X64-JAG-NOOPT-NEXT: imulq %rcx, %rax
1602 ; X64-JAG-NOOPT-NEXT: retq
1604 ; X64-SLM-NOOPT-LABEL: test_mul_spec:
1605 ; X64-SLM-NOOPT: # %bb.0:
1606 ; X64-SLM-NOOPT-NEXT: leaq 42(%rdi,%rdi,8), %rcx
1607 ; X64-SLM-NOOPT-NEXT: leaq 2(%rdi,%rdi,4), %rax
1608 ; X64-SLM-NOOPT-NEXT: imulq %rcx, %rax
1609 ; X64-SLM-NOOPT-NEXT: retq
1610 %mul = mul nsw i64 %x, 9
1611 %add = add nsw i64 %mul, 42
1612 %mul2 = mul nsw i64 %x, 5
1613 %add2 = add nsw i64 %mul2, 2
1614 %mul3 = mul nsw i64 %add, %add2
1618 define i64 @PR111325(i64 %a0, i1 %a1) {
1619 ; X86-LABEL: PR111325:
1620 ; X86: # %bb.0: # %entry
1621 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
1622 ; X86-NEXT: andb $1, %cl
1623 ; X86-NEXT: xorl %eax, %eax
1624 ; X86-NEXT: xorl %edx, %edx
1625 ; X86-NEXT: subl {{[0-9]+}}(%esp), %edx
1626 ; X86-NEXT: cmpb $1, %cl
1627 ; X86-NEXT: sbbl %eax, %eax
1628 ; X86-NEXT: orl %edx, %eax
1629 ; X86-NEXT: xorl %edx, %edx
1632 ; X86-NOOPT-LABEL: PR111325:
1633 ; X86-NOOPT: # %bb.0: # %entry
1634 ; X86-NOOPT-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
1635 ; X86-NOOPT-NEXT: andb $1, %cl
1636 ; X86-NOOPT-NEXT: xorl %eax, %eax
1637 ; X86-NOOPT-NEXT: xorl %edx, %edx
1638 ; X86-NOOPT-NEXT: subl {{[0-9]+}}(%esp), %edx
1639 ; X86-NOOPT-NEXT: cmpb $1, %cl
1640 ; X86-NOOPT-NEXT: sbbl %eax, %eax
1641 ; X86-NOOPT-NEXT: orl %edx, %eax
1642 ; X86-NOOPT-NEXT: xorl %edx, %edx
1643 ; X86-NOOPT-NEXT: retl
1645 ; X64-LABEL: PR111325:
1646 ; X64: # %bb.0: # %entry
1647 ; X64-NEXT: negl %edi
1648 ; X64-NEXT: testb $1, %sil
1649 ; X64-NEXT: movl $4294967295, %eax # imm = 0xFFFFFFFF
1650 ; X64-NEXT: cmovneq %rdi, %rax
1653 %mul = mul i64 %a0, 4294967295
1654 %mask = and i64 %mul, 4294967295
1655 %sel = select i1 %a1, i64 %mask, i64 4294967295