1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s --check-prefix=X64
3
4define i8 @test_mul_by_1(i8 %x) {
5; X64-LABEL: test_mul_by_1:
6; X64:       # %bb.0:
7; X64-NEXT:    movl %edi, %eax
8; X64-NEXT:    # kill: def $al killed $al killed $eax
9; X64-NEXT:    retq
10  %m = mul i8 %x, 1
11  ret i8 %m
12}
13
14define i8 @test_mul_by_2(i8 %x) {
15; X64-LABEL: test_mul_by_2:
16; X64:       # %bb.0:
17; X64-NEXT:    # kill: def $edi killed $edi def $rdi
18; X64-NEXT:    leal (%rdi,%rdi), %eax
19; X64-NEXT:    # kill: def $al killed $al killed $eax
20; X64-NEXT:    retq
21  %m = mul i8 %x, 2
22  ret i8 %m
23}
24
25define i8 @test_mul_by_3(i8 %x) {
26; X64-LABEL: test_mul_by_3:
27; X64:       # %bb.0:
28; X64-NEXT:    # kill: def $edi killed $edi def $rdi
29; X64-NEXT:    leal (%rdi,%rdi,2), %eax
30; X64-NEXT:    # kill: def $al killed $al killed $eax
31; X64-NEXT:    retq
32  %m = mul i8 %x, 3
33  ret i8 %m
34}
35
36define i8 @test_mul_by_4(i8 %x) {
37; X64-LABEL: test_mul_by_4:
38; X64:       # %bb.0:
39; X64-NEXT:    # kill: def $edi killed $edi def $rdi
40; X64-NEXT:    leal (,%rdi,4), %eax
41; X64-NEXT:    # kill: def $al killed $al killed $eax
42; X64-NEXT:    retq
43  %m = mul i8 %x, 4
44  ret i8 %m
45}
46
47define i8 @test_mul_by_5(i8 %x) {
48; X64-LABEL: test_mul_by_5:
49; X64:       # %bb.0:
50; X64-NEXT:    # kill: def $edi killed $edi def $rdi
51; X64-NEXT:    leal (%rdi,%rdi,4), %eax
52; X64-NEXT:    # kill: def $al killed $al killed $eax
53; X64-NEXT:    retq
54  %m = mul i8 %x, 5
55  ret i8 %m
56}
57
58define i8 @test_mul_by_6(i8 %x) {
59; X64-LABEL: test_mul_by_6:
60; X64:       # %bb.0:
61; X64-NEXT:    # kill: def $edi killed $edi def $rdi
62; X64-NEXT:    addl %edi, %edi
63; X64-NEXT:    leal (%rdi,%rdi,2), %eax
64; X64-NEXT:    # kill: def $al killed $al killed $eax
65; X64-NEXT:    retq
66  %m = mul i8 %x, 6
67  ret i8 %m
68}
69
70define i8 @test_mul_by_7(i8 %x) {
71; X64-LABEL: test_mul_by_7:
72; X64:       # %bb.0:
73; X64-NEXT:    # kill: def $edi killed $edi def $rdi
74; X64-NEXT:    leal (,%rdi,8), %eax
75; X64-NEXT:    subl %edi, %eax
76; X64-NEXT:    # kill: def $al killed $al killed $eax
77; X64-NEXT:    retq
78  %m = mul i8 %x, 7
79  ret i8 %m
80}
81
82define i8 @test_mul_by_8(i8 %x) {
83; X64-LABEL: test_mul_by_8:
84; X64:       # %bb.0:
85; X64-NEXT:    # kill: def $edi killed $edi def $rdi
86; X64-NEXT:    leal (,%rdi,8), %eax
87; X64-NEXT:    # kill: def $al killed $al killed $eax
88; X64-NEXT:    retq
89  %m = mul i8 %x, 8
90  ret i8 %m
91}
92
93define i8 @test_mul_by_9(i8 %x) {
94; X64-LABEL: test_mul_by_9:
95; X64:       # %bb.0:
96; X64-NEXT:    # kill: def $edi killed $edi def $rdi
97; X64-NEXT:    leal (%rdi,%rdi,8), %eax
98; X64-NEXT:    # kill: def $al killed $al killed $eax
99; X64-NEXT:    retq
100  %m = mul i8 %x, 9
101  ret i8 %m
102}
103
104define i8 @test_mul_by_10(i8 %x) {
105; X64-LABEL: test_mul_by_10:
106; X64:       # %bb.0:
107; X64-NEXT:    # kill: def $edi killed $edi def $rdi
108; X64-NEXT:    addl %edi, %edi
109; X64-NEXT:    leal (%rdi,%rdi,4), %eax
110; X64-NEXT:    # kill: def $al killed $al killed $eax
111; X64-NEXT:    retq
112  %m = mul i8 %x, 10
113  ret i8 %m
114}
115
116define i8 @test_mul_by_11(i8 %x) {
117; X64-LABEL: test_mul_by_11:
118; X64:       # %bb.0:
119; X64-NEXT:    # kill: def $edi killed $edi def $rdi
120; X64-NEXT:    leal (%rdi,%rdi,4), %eax
121; X64-NEXT:    leal (%rdi,%rax,2), %eax
122; X64-NEXT:    # kill: def $al killed $al killed $eax
123; X64-NEXT:    retq
124  %m = mul i8 %x, 11
125  ret i8 %m
126}
127
128define i8 @test_mul_by_12(i8 %x) {
129; X64-LABEL: test_mul_by_12:
130; X64:       # %bb.0:
131; X64-NEXT:    # kill: def $edi killed $edi def $rdi
132; X64-NEXT:    shll $2, %edi
133; X64-NEXT:    leal (%rdi,%rdi,2), %eax
134; X64-NEXT:    # kill: def $al killed $al killed $eax
135; X64-NEXT:    retq
136  %m = mul i8 %x, 12
137  ret i8 %m
138}
139
140define i8 @test_mul_by_13(i8 %x) {
141; X64-LABEL: test_mul_by_13:
142; X64:       # %bb.0:
143; X64-NEXT:    # kill: def $edi killed $edi def $rdi
144; X64-NEXT:    leal (%rdi,%rdi,2), %eax
145; X64-NEXT:    leal (%rdi,%rax,4), %eax
146; X64-NEXT:    # kill: def $al killed $al killed $eax
147; X64-NEXT:    retq
148  %m = mul i8 %x, 13
149  ret i8 %m
150}
151
152define i8 @test_mul_by_14(i8 %x) {
153; X64-LABEL: test_mul_by_14:
154; X64:       # %bb.0:
155; X64-NEXT:    movl %edi, %eax
156; X64-NEXT:    shll $4, %eax
157; X64-NEXT:    subl %edi, %eax
158; X64-NEXT:    subl %edi, %eax
159; X64-NEXT:    # kill: def $al killed $al killed $eax
160; X64-NEXT:    retq
161  %m = mul i8 %x, 14
162  ret i8 %m
163}
164
165define i8 @test_mul_by_15(i8 %x) {
166; X64-LABEL: test_mul_by_15:
167; X64:       # %bb.0:
168; X64-NEXT:    # kill: def $edi killed $edi def $rdi
169; X64-NEXT:    leal (%rdi,%rdi,4), %eax
170; X64-NEXT:    leal (%rax,%rax,2), %eax
171; X64-NEXT:    # kill: def $al killed $al killed $eax
172; X64-NEXT:    retq
173  %m = mul i8 %x, 15
174  ret i8 %m
175}
176
177define i8 @test_mul_by_16(i8 %x) {
178; X64-LABEL: test_mul_by_16:
179; X64:       # %bb.0:
180; X64-NEXT:    movl %edi, %eax
181; X64-NEXT:    shlb $4, %al
182; X64-NEXT:    # kill: def $al killed $al killed $eax
183; X64-NEXT:    retq
184  %m = mul i8 %x, 16
185  ret i8 %m
186}
187
188define i8 @test_mul_by_17(i8 %x) {
189; X64-LABEL: test_mul_by_17:
190; X64:       # %bb.0:
191; X64-NEXT:    # kill: def $edi killed $edi def $rdi
192; X64-NEXT:    movl %edi, %eax
193; X64-NEXT:    shll $4, %eax
194; X64-NEXT:    addl %edi, %eax
195; X64-NEXT:    # kill: def $al killed $al killed $eax
196; X64-NEXT:    retq
197  %m = mul i8 %x, 17
198  ret i8 %m
199}
200
201define i8 @test_mul_by_18(i8 %x) {
202; X64-LABEL: test_mul_by_18:
203; X64:       # %bb.0:
204; X64-NEXT:    # kill: def $edi killed $edi def $rdi
205; X64-NEXT:    addl %edi, %edi
206; X64-NEXT:    leal (%rdi,%rdi,8), %eax
207; X64-NEXT:    # kill: def $al killed $al killed $eax
208; X64-NEXT:    retq
209  %m = mul i8 %x, 18
210  ret i8 %m
211}
212
213define i8 @test_mul_by_19(i8 %x) {
214; X64-LABEL: test_mul_by_19:
215; X64:       # %bb.0:
216; X64-NEXT:    # kill: def $edi killed $edi def $rdi
217; X64-NEXT:    leal (%rdi,%rdi,8), %eax
218; X64-NEXT:    leal (%rdi,%rax,2), %eax
219; X64-NEXT:    # kill: def $al killed $al killed $eax
220; X64-NEXT:    retq
221  %m = mul i8 %x, 19
222  ret i8 %m
223}
224
225define i8 @test_mul_by_20(i8 %x) {
226; X64-LABEL: test_mul_by_20:
227; X64:       # %bb.0:
228; X64-NEXT:    # kill: def $edi killed $edi def $rdi
229; X64-NEXT:    shll $2, %edi
230; X64-NEXT:    leal (%rdi,%rdi,4), %eax
231; X64-NEXT:    # kill: def $al killed $al killed $eax
232; X64-NEXT:    retq
233  %m = mul i8 %x, 20
234  ret i8 %m
235}
236
237define i8 @test_mul_by_21(i8 %x) {
238; X64-LABEL: test_mul_by_21:
239; X64:       # %bb.0:
240; X64-NEXT:    # kill: def $edi killed $edi def $rdi
241; X64-NEXT:    leal (%rdi,%rdi,4), %eax
242; X64-NEXT:    leal (%rdi,%rax,4), %eax
243; X64-NEXT:    # kill: def $al killed $al killed $eax
244; X64-NEXT:    retq
245  %m = mul i8 %x, 21
246  ret i8 %m
247}
248
249define i8 @test_mul_by_22(i8 %x) {
250; X64-LABEL: test_mul_by_22:
251; X64:       # %bb.0:
252; X64-NEXT:    # kill: def $edi killed $edi def $rdi
253; X64-NEXT:    leal (%rdi,%rdi,4), %eax
254; X64-NEXT:    leal (%rdi,%rax,4), %eax
255; X64-NEXT:    addl %edi, %eax
256; X64-NEXT:    # kill: def $al killed $al killed $eax
257; X64-NEXT:    retq
258  %m = mul i8 %x, 22
259  ret i8 %m
260}
261
262define i8 @test_mul_by_23(i8 %x) {
263; X64-LABEL: test_mul_by_23:
264; X64:       # %bb.0:
265; X64-NEXT:    # kill: def $edi killed $edi def $rdi
266; X64-NEXT:    leal (%rdi,%rdi,2), %eax
267; X64-NEXT:    shll $3, %eax
268; X64-NEXT:    subl %edi, %eax
269; X64-NEXT:    # kill: def $al killed $al killed $eax
270; X64-NEXT:    retq
271  %m = mul i8 %x, 23
272  ret i8 %m
273}
274
275define i8 @test_mul_by_24(i8 %x) {
276; X64-LABEL: test_mul_by_24:
277; X64:       # %bb.0:
278; X64-NEXT:    # kill: def $edi killed $edi def $rdi
279; X64-NEXT:    shll $3, %edi
280; X64-NEXT:    leal (%rdi,%rdi,2), %eax
281; X64-NEXT:    # kill: def $al killed $al killed $eax
282; X64-NEXT:    retq
283  %m = mul i8 %x, 24
284  ret i8 %m
285}
286
287define i8 @test_mul_by_25(i8 %x) {
288; X64-LABEL: test_mul_by_25:
289; X64:       # %bb.0:
290; X64-NEXT:    # kill: def $edi killed $edi def $rdi
291; X64-NEXT:    leal (%rdi,%rdi,4), %eax
292; X64-NEXT:    leal (%rax,%rax,4), %eax
293; X64-NEXT:    # kill: def $al killed $al killed $eax
294; X64-NEXT:    retq
295  %m = mul i8 %x, 25
296  ret i8 %m
297}
298
299define i8 @test_mul_by_26(i8 %x) {
300; X64-LABEL: test_mul_by_26:
301; X64:       # %bb.0:
302; X64-NEXT:    # kill: def $edi killed $edi def $rdi
303; X64-NEXT:    leal (%rdi,%rdi,4), %eax
304; X64-NEXT:    leal (%rax,%rax,4), %eax
305; X64-NEXT:    addl %edi, %eax
306; X64-NEXT:    # kill: def $al killed $al killed $eax
307; X64-NEXT:    retq
308  %m = mul i8 %x, 26
309  ret i8 %m
310}
311
312define i8 @test_mul_by_27(i8 %x) {
313; X64-LABEL: test_mul_by_27:
314; X64:       # %bb.0:
315; X64-NEXT:    # kill: def $edi killed $edi def $rdi
316; X64-NEXT:    leal (%rdi,%rdi,8), %eax
317; X64-NEXT:    leal (%rax,%rax,2), %eax
318; X64-NEXT:    # kill: def $al killed $al killed $eax
319; X64-NEXT:    retq
320  %m = mul i8 %x, 27
321  ret i8 %m
322}
323
324define i8 @test_mul_by_28(i8 %x) {
325; X64-LABEL: test_mul_by_28:
326; X64:       # %bb.0:
327; X64-NEXT:    # kill: def $edi killed $edi def $rdi
328; X64-NEXT:    leal (%rdi,%rdi,8), %eax
329; X64-NEXT:    leal (%rax,%rax,2), %eax
330; X64-NEXT:    addl %edi, %eax
331; X64-NEXT:    # kill: def $al killed $al killed $eax
332; X64-NEXT:    retq
333  %m = mul i8 %x, 28
334  ret i8 %m
335}
336
337define i8 @test_mul_by_29(i8 %x) {
338; X64-LABEL: test_mul_by_29:
339; X64:       # %bb.0:
340; X64-NEXT:    # kill: def $edi killed $edi def $rdi
341; X64-NEXT:    leal (%rdi,%rdi,8), %eax
342; X64-NEXT:    leal (%rax,%rax,2), %eax
343; X64-NEXT:    addl %edi, %eax
344; X64-NEXT:    addl %edi, %eax
345; X64-NEXT:    # kill: def $al killed $al killed $eax
346; X64-NEXT:    retq
347  %m = mul i8 %x, 29
348  ret i8 %m
349}
350
351define i8 @test_mul_by_30(i8 %x) {
352; X64-LABEL: test_mul_by_30:
353; X64:       # %bb.0:
354; X64-NEXT:    movl %edi, %eax
355; X64-NEXT:    shll $5, %eax
356; X64-NEXT:    subl %edi, %eax
357; X64-NEXT:    subl %edi, %eax
358; X64-NEXT:    # kill: def $al killed $al killed $eax
359; X64-NEXT:    retq
360  %m = mul i8 %x, 30
361  ret i8 %m
362}
363
364define i8 @test_mul_by_31(i8 %x) {
365; X64-LABEL: test_mul_by_31:
366; X64:       # %bb.0:
367; X64-NEXT:    movl %edi, %eax
368; X64-NEXT:    shll $5, %eax
369; X64-NEXT:    subl %edi, %eax
370; X64-NEXT:    # kill: def $al killed $al killed $eax
371; X64-NEXT:    retq
372  %m = mul i8 %x, 31
373  ret i8 %m
374}
375
376define i8 @test_mul_by_32(i8 %x) {
377; X64-LABEL: test_mul_by_32:
378; X64:       # %bb.0:
379; X64-NEXT:    movl %edi, %eax
380; X64-NEXT:    shlb $5, %al
381; X64-NEXT:    # kill: def $al killed $al killed $eax
382; X64-NEXT:    retq
383  %m = mul i8 %x, 32
384  ret i8 %m
385}
386
387define i8 @test_mul_by_37(i8 %x) {
388; X64-LABEL: test_mul_by_37:
389; X64:       # %bb.0:
390; X64-NEXT:    # kill: def $edi killed $edi def $rdi
391; X64-NEXT:    leal (%rdi,%rdi,8), %eax
392; X64-NEXT:    leal (%rdi,%rax,4), %eax
393; X64-NEXT:    # kill: def $al killed $al killed $eax
394; X64-NEXT:    retq
395  %m = mul i8 %x, 37
396  ret i8 %m
397}
398
399define i8 @test_mul_by_41(i8 %x) {
400; X64-LABEL: test_mul_by_41:
401; X64:       # %bb.0:
402; X64-NEXT:    # kill: def $edi killed $edi def $rdi
403; X64-NEXT:    leal (%rdi,%rdi,4), %eax
404; X64-NEXT:    leal (%rdi,%rax,8), %eax
405; X64-NEXT:    # kill: def $al killed $al killed $eax
406; X64-NEXT:    retq
407  %m = mul i8 %x, 41
408  ret i8 %m
409}
410
411define i8 @test_mul_by_62(i8 %x) {
412; X64-LABEL: test_mul_by_62:
413; X64:       # %bb.0:
414; X64-NEXT:    movl %edi, %eax
415; X64-NEXT:    shll $6, %eax
416; X64-NEXT:    subl %edi, %eax
417; X64-NEXT:    subl %edi, %eax
418; X64-NEXT:    # kill: def $al killed $al killed $eax
419; X64-NEXT:    retq
420  %m = mul i8 %x, 62
421  ret i8 %m
422}
423
424define i8 @test_mul_by_66(i8 %x) {
425; X64-LABEL: test_mul_by_66:
426; X64:       # %bb.0:
427; X64-NEXT:    # kill: def $edi killed $edi def $rdi
428; X64-NEXT:    movl %edi, %eax
429; X64-NEXT:    shll $6, %eax
430; X64-NEXT:    leal (%rax,%rdi,2), %eax
431; X64-NEXT:    # kill: def $al killed $al killed $eax
432; X64-NEXT:    retq
433  %m = mul i8 %x, 66
434  ret i8 %m
435}
436
437define i8 @test_mul_by_73(i8 %x) {
438; X64-LABEL: test_mul_by_73:
439; X64:       # %bb.0:
440; X64-NEXT:    # kill: def $edi killed $edi def $rdi
441; X64-NEXT:    leal (%rdi,%rdi,8), %eax
442; X64-NEXT:    leal (%rdi,%rax,8), %eax
443; X64-NEXT:    # kill: def $al killed $al killed $eax
444; X64-NEXT:    retq
445  %m = mul i8 %x, 73
446  ret i8 %m
447}
448
449define i8 @test_mul_by_520(i8 %x) {
450; X64-LABEL: test_mul_by_520:
451; X64:       # %bb.0:
452; X64-NEXT:    # kill: def $edi killed $edi def $rdi
453; X64-NEXT:    leal (,%rdi,8), %eax
454; X64-NEXT:    # kill: def $al killed $al killed $eax
455; X64-NEXT:    retq
456  %m = mul i8 %x, 520
457  ret i8 %m
458}
459
460define i8 @test_mul_by_neg10(i8 %x) {
461; X64-LABEL: test_mul_by_neg10:
462; X64:       # %bb.0:
463; X64-NEXT:    # kill: def $edi killed $edi def $rdi
464; X64-NEXT:    addl %edi, %edi
465; X64-NEXT:    leal (%rdi,%rdi,4), %eax
466; X64-NEXT:    negl %eax
467; X64-NEXT:    # kill: def $al killed $al killed $eax
468; X64-NEXT:    retq
469  %m = mul i8 %x, -10
470  ret i8 %m
471}
472
473define i8 @test_mul_by_neg36(i8 %x) {
474; X64-LABEL: test_mul_by_neg36:
475; X64:       # %bb.0:
476; X64-NEXT:    # kill: def $edi killed $edi def $rdi
477; X64-NEXT:    shll $2, %edi
478; X64-NEXT:    leal (%rdi,%rdi,8), %eax
479; X64-NEXT:    negl %eax
480; X64-NEXT:    # kill: def $al killed $al killed $eax
481; X64-NEXT:    retq
482  %m = mul i8 %x, -36
483  ret i8 %m
484}
485
486