xref: /llvm-project/llvm/test/CodeGen/X86/mul-constant-i8.ll (revision 4196ca3278f78c6e19246e54ab0ecb364e37d66a)
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:    leal (%rax,%rax), %ecx
157; X64-NEXT:    shll $4, %eax
158; X64-NEXT:    subl %ecx, %eax
159; X64-NEXT:    # kill: def $al killed $al killed $rax
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:    movl %edi, %eax
192; X64-NEXT:    shll $4, %eax
193; X64-NEXT:    addl %edi, %eax
194; X64-NEXT:    # kill: def $al killed $al killed $eax
195; X64-NEXT:    retq
196  %m = mul i8 %x, 17
197  ret i8 %m
198}
199
200define i8 @test_mul_by_18(i8 %x) {
201; X64-LABEL: test_mul_by_18:
202; X64:       # %bb.0:
203; X64-NEXT:    # kill: def $edi killed $edi def $rdi
204; X64-NEXT:    addl %edi, %edi
205; X64-NEXT:    leal (%rdi,%rdi,8), %eax
206; X64-NEXT:    # kill: def $al killed $al killed $eax
207; X64-NEXT:    retq
208  %m = mul i8 %x, 18
209  ret i8 %m
210}
211
212define i8 @test_mul_by_19(i8 %x) {
213; X64-LABEL: test_mul_by_19:
214; X64:       # %bb.0:
215; X64-NEXT:    # kill: def $edi killed $edi def $rdi
216; X64-NEXT:    leal (%rdi,%rdi,8), %eax
217; X64-NEXT:    leal (%rdi,%rax,2), %eax
218; X64-NEXT:    # kill: def $al killed $al killed $eax
219; X64-NEXT:    retq
220  %m = mul i8 %x, 19
221  ret i8 %m
222}
223
224define i8 @test_mul_by_20(i8 %x) {
225; X64-LABEL: test_mul_by_20:
226; X64:       # %bb.0:
227; X64-NEXT:    # kill: def $edi killed $edi def $rdi
228; X64-NEXT:    shll $2, %edi
229; X64-NEXT:    leal (%rdi,%rdi,4), %eax
230; X64-NEXT:    # kill: def $al killed $al killed $eax
231; X64-NEXT:    retq
232  %m = mul i8 %x, 20
233  ret i8 %m
234}
235
236define i8 @test_mul_by_21(i8 %x) {
237; X64-LABEL: test_mul_by_21:
238; X64:       # %bb.0:
239; X64-NEXT:    # kill: def $edi killed $edi def $rdi
240; X64-NEXT:    leal (%rdi,%rdi,4), %eax
241; X64-NEXT:    leal (%rdi,%rax,4), %eax
242; X64-NEXT:    # kill: def $al killed $al killed $eax
243; X64-NEXT:    retq
244  %m = mul i8 %x, 21
245  ret i8 %m
246}
247
248define i8 @test_mul_by_22(i8 %x) {
249; X64-LABEL: test_mul_by_22:
250; X64:       # %bb.0:
251; X64-NEXT:    # kill: def $edi killed $edi def $rdi
252; X64-NEXT:    leal (%rdi,%rdi,4), %eax
253; X64-NEXT:    leal (%rdi,%rax,4), %eax
254; X64-NEXT:    addl %edi, %eax
255; X64-NEXT:    # kill: def $al killed $al killed $eax
256; X64-NEXT:    retq
257  %m = mul i8 %x, 22
258  ret i8 %m
259}
260
261define i8 @test_mul_by_23(i8 %x) {
262; X64-LABEL: test_mul_by_23:
263; X64:       # %bb.0:
264; X64-NEXT:    # kill: def $edi killed $edi def $rdi
265; X64-NEXT:    leal (%rdi,%rdi,2), %eax
266; X64-NEXT:    shll $3, %eax
267; X64-NEXT:    subl %edi, %eax
268; X64-NEXT:    # kill: def $al killed $al killed $eax
269; X64-NEXT:    retq
270  %m = mul i8 %x, 23
271  ret i8 %m
272}
273
274define i8 @test_mul_by_24(i8 %x) {
275; X64-LABEL: test_mul_by_24:
276; X64:       # %bb.0:
277; X64-NEXT:    # kill: def $edi killed $edi def $rdi
278; X64-NEXT:    shll $3, %edi
279; X64-NEXT:    leal (%rdi,%rdi,2), %eax
280; X64-NEXT:    # kill: def $al killed $al killed $eax
281; X64-NEXT:    retq
282  %m = mul i8 %x, 24
283  ret i8 %m
284}
285
286define i8 @test_mul_by_25(i8 %x) {
287; X64-LABEL: test_mul_by_25:
288; X64:       # %bb.0:
289; X64-NEXT:    # kill: def $edi killed $edi def $rdi
290; X64-NEXT:    leal (%rdi,%rdi,4), %eax
291; X64-NEXT:    leal (%rax,%rax,4), %eax
292; X64-NEXT:    # kill: def $al killed $al killed $eax
293; X64-NEXT:    retq
294  %m = mul i8 %x, 25
295  ret i8 %m
296}
297
298define i8 @test_mul_by_26(i8 %x) {
299; X64-LABEL: test_mul_by_26:
300; X64:       # %bb.0:
301; X64-NEXT:    # kill: def $edi killed $edi def $rdi
302; X64-NEXT:    leal (%rdi,%rdi,4), %eax
303; X64-NEXT:    leal (%rax,%rax,4), %eax
304; X64-NEXT:    addl %edi, %eax
305; X64-NEXT:    # kill: def $al killed $al killed $eax
306; X64-NEXT:    retq
307  %m = mul i8 %x, 26
308  ret i8 %m
309}
310
311define i8 @test_mul_by_27(i8 %x) {
312; X64-LABEL: test_mul_by_27:
313; X64:       # %bb.0:
314; X64-NEXT:    # kill: def $edi killed $edi def $rdi
315; X64-NEXT:    leal (%rdi,%rdi,8), %eax
316; X64-NEXT:    leal (%rax,%rax,2), %eax
317; X64-NEXT:    # kill: def $al killed $al killed $eax
318; X64-NEXT:    retq
319  %m = mul i8 %x, 27
320  ret i8 %m
321}
322
323define i8 @test_mul_by_28(i8 %x) {
324; X64-LABEL: test_mul_by_28:
325; X64:       # %bb.0:
326; X64-NEXT:    # kill: def $edi killed $edi def $rdi
327; X64-NEXT:    leal (%rdi,%rdi,8), %eax
328; X64-NEXT:    leal (%rax,%rax,2), %eax
329; X64-NEXT:    addl %edi, %eax
330; X64-NEXT:    # kill: def $al killed $al killed $eax
331; X64-NEXT:    retq
332  %m = mul i8 %x, 28
333  ret i8 %m
334}
335
336define i8 @test_mul_by_29(i8 %x) {
337; X64-LABEL: test_mul_by_29:
338; X64:       # %bb.0:
339; X64-NEXT:    # kill: def $edi killed $edi def $rdi
340; X64-NEXT:    leal (%rdi,%rdi,8), %eax
341; X64-NEXT:    leal (%rax,%rax,2), %eax
342; X64-NEXT:    addl %edi, %eax
343; X64-NEXT:    addl %edi, %eax
344; X64-NEXT:    # kill: def $al killed $al killed $eax
345; X64-NEXT:    retq
346  %m = mul i8 %x, 29
347  ret i8 %m
348}
349
350define i8 @test_mul_by_30(i8 %x) {
351; X64-LABEL: test_mul_by_30:
352; X64:       # %bb.0:
353; X64-NEXT:    movl %edi, %eax
354; X64-NEXT:    leal (%rax,%rax), %ecx
355; X64-NEXT:    shll $5, %eax
356; X64-NEXT:    subl %ecx, %eax
357; X64-NEXT:    # kill: def $al killed $al killed $rax
358; X64-NEXT:    retq
359  %m = mul i8 %x, 30
360  ret i8 %m
361}
362
363define i8 @test_mul_by_31(i8 %x) {
364; X64-LABEL: test_mul_by_31:
365; X64:       # %bb.0:
366; X64-NEXT:    movl %edi, %eax
367; X64-NEXT:    shll $5, %eax
368; X64-NEXT:    subl %edi, %eax
369; X64-NEXT:    # kill: def $al killed $al killed $eax
370; X64-NEXT:    retq
371  %m = mul i8 %x, 31
372  ret i8 %m
373}
374
375define i8 @test_mul_by_32(i8 %x) {
376; X64-LABEL: test_mul_by_32:
377; X64:       # %bb.0:
378; X64-NEXT:    movl %edi, %eax
379; X64-NEXT:    shlb $5, %al
380; X64-NEXT:    # kill: def $al killed $al killed $eax
381; X64-NEXT:    retq
382  %m = mul i8 %x, 32
383  ret i8 %m
384}
385
386define i8 @test_mul_by_37(i8 %x) {
387; X64-LABEL: test_mul_by_37:
388; X64:       # %bb.0:
389; X64-NEXT:    # kill: def $edi killed $edi def $rdi
390; X64-NEXT:    leal (%rdi,%rdi,8), %eax
391; X64-NEXT:    leal (%rdi,%rax,4), %eax
392; X64-NEXT:    # kill: def $al killed $al killed $eax
393; X64-NEXT:    retq
394  %m = mul i8 %x, 37
395  ret i8 %m
396}
397
398define i8 @test_mul_by_41(i8 %x) {
399; X64-LABEL: test_mul_by_41:
400; X64:       # %bb.0:
401; X64-NEXT:    # kill: def $edi killed $edi def $rdi
402; X64-NEXT:    leal (%rdi,%rdi,4), %eax
403; X64-NEXT:    leal (%rdi,%rax,8), %eax
404; X64-NEXT:    # kill: def $al killed $al killed $eax
405; X64-NEXT:    retq
406  %m = mul i8 %x, 41
407  ret i8 %m
408}
409
410define i8 @test_mul_by_62(i8 %x) {
411; X64-LABEL: test_mul_by_62:
412; X64:       # %bb.0:
413; X64-NEXT:    movl %edi, %eax
414; X64-NEXT:    leal (%rax,%rax), %ecx
415; X64-NEXT:    shll $6, %eax
416; X64-NEXT:    subl %ecx, %eax
417; X64-NEXT:    # kill: def $al killed $al killed $rax
418; X64-NEXT:    retq
419  %m = mul i8 %x, 62
420  ret i8 %m
421}
422
423define i8 @test_mul_by_66(i8 %x) {
424; X64-LABEL: test_mul_by_66:
425; X64:       # %bb.0:
426; X64-NEXT:    # kill: def $edi killed $edi def $rdi
427; X64-NEXT:    movl %edi, %eax
428; X64-NEXT:    shll $6, %eax
429; X64-NEXT:    leal (%rax,%rdi,2), %eax
430; X64-NEXT:    # kill: def $al killed $al killed $eax
431; X64-NEXT:    retq
432  %m = mul i8 %x, 66
433  ret i8 %m
434}
435
436define i8 @test_mul_by_73(i8 %x) {
437; X64-LABEL: test_mul_by_73:
438; X64:       # %bb.0:
439; X64-NEXT:    # kill: def $edi killed $edi def $rdi
440; X64-NEXT:    leal (%rdi,%rdi,8), %eax
441; X64-NEXT:    leal (%rdi,%rax,8), %eax
442; X64-NEXT:    # kill: def $al killed $al killed $eax
443; X64-NEXT:    retq
444  %m = mul i8 %x, 73
445  ret i8 %m
446}
447
448define i8 @test_mul_by_520(i8 %x) {
449; X64-LABEL: test_mul_by_520:
450; X64:       # %bb.0:
451; X64-NEXT:    # kill: def $edi killed $edi def $rdi
452; X64-NEXT:    leal (,%rdi,8), %eax
453; X64-NEXT:    # kill: def $al killed $al killed $eax
454; X64-NEXT:    retq
455  %m = mul i8 %x, 520
456  ret i8 %m
457}
458
459define i8 @test_mul_by_neg10(i8 %x) {
460; X64-LABEL: test_mul_by_neg10:
461; X64:       # %bb.0:
462; X64-NEXT:    # kill: def $edi killed $edi def $rdi
463; X64-NEXT:    addl %edi, %edi
464; X64-NEXT:    leal (%rdi,%rdi,4), %eax
465; X64-NEXT:    negl %eax
466; X64-NEXT:    # kill: def $al killed $al killed $eax
467; X64-NEXT:    retq
468  %m = mul i8 %x, -10
469  ret i8 %m
470}
471
472define i8 @test_mul_by_neg36(i8 %x) {
473; X64-LABEL: test_mul_by_neg36:
474; X64:       # %bb.0:
475; X64-NEXT:    # kill: def $edi killed $edi def $rdi
476; X64-NEXT:    shll $2, %edi
477; X64-NEXT:    leal (%rdi,%rdi,8), %eax
478; X64-NEXT:    negl %eax
479; X64-NEXT:    # kill: def $al killed $al killed $eax
480; X64-NEXT:    retq
481  %m = mul i8 %x, -36
482  ret i8 %m
483}
484
485