• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=x86_64-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=ALL
3--- |
4
5  define i64 @test_shl_i64(i64 %arg1, i64 %arg2) {
6    %res = shl i64 %arg1, %arg2
7    ret i64 %res
8  }
9
10  define i64 @test_shl_i64_imm(i64 %arg1) {
11    %res = shl i64 %arg1, 5
12    ret i64 %res
13  }
14
15  define i64 @test_shl_i64_imm1(i64 %arg1) {
16    %res = shl i64 %arg1, 1
17    ret i64 %res
18  }
19
20  define i32 @test_shl_i32(i32 %arg1, i32 %arg2) {
21    %res = shl i32 %arg1, %arg2
22    ret i32 %res
23  }
24
25  define i32 @test_shl_i32_imm(i32 %arg1) {
26    %res = shl i32 %arg1, 5
27    ret i32 %res
28  }
29
30  define i32 @test_shl_i32_imm1(i32 %arg1) {
31    %res = shl i32 %arg1, 1
32    ret i32 %res
33  }
34
35  define i16 @test_shl_i16(i32 %arg1, i32 %arg2) {
36    %a = trunc i32 %arg1 to i16
37    %a2 = trunc i32 %arg2 to i16
38    %res = shl i16 %a, %a2
39    ret i16 %res
40  }
41
42  define i16 @test_shl_i16_imm(i32 %arg1) {
43    %a = trunc i32 %arg1 to i16
44    %res = shl i16 %a, 5
45    ret i16 %res
46  }
47
48  define i16 @test_shl_i16_imm1(i32 %arg1) {
49    %a = trunc i32 %arg1 to i16
50    %res = shl i16 %a, 1
51    ret i16 %res
52  }
53
54  define i8 @test_shl_i8(i32 %arg1, i32 %arg2) {
55    %a = trunc i32 %arg1 to i8
56    %a2 = trunc i32 %arg2 to i8
57    %res = shl i8 %a, %a2
58    ret i8 %res
59  }
60
61  define i8 @test_shl_i8_imm(i32 %arg1) {
62    %a = trunc i32 %arg1 to i8
63    %res = shl i8 %a, 5
64    ret i8 %res
65  }
66
67  define i8 @test_shl_i8_imm1(i32 %arg1) {
68    %a = trunc i32 %arg1 to i8
69    %res = shl i8 %a, 1
70    ret i8 %res
71  }
72
73...
74---
75name:            test_shl_i64
76alignment:       4
77legalized:       true
78regBankSelected: true
79tracksRegLiveness: true
80registers:
81  - { id: 0, class: gpr, preferred-register: '' }
82  - { id: 1, class: gpr, preferred-register: '' }
83  - { id: 2, class: gpr, preferred-register: '' }
84liveins:
85fixedStack:
86stack:
87constants:
88body:             |
89  bb.1 (%ir-block.0):
90    liveins: $rdi, $rsi
91
92    ; ALL-LABEL: name: test_shl_i64
93    ; ALL: liveins: $rdi, $rsi
94    ; ALL: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
95    ; ALL: [[COPY1:%[0-9]+]]:gr64 = COPY $rsi
96    ; ALL: $rcx = COPY [[COPY1]]
97    ; ALL: $cl = KILL killed $rcx
98    ; ALL: [[SHL64rCL:%[0-9]+]]:gr64 = SHL64rCL [[COPY]], implicit-def $eflags, implicit $cl
99    ; ALL: $rax = COPY [[SHL64rCL]]
100    ; ALL: RET 0, implicit $rax
101    %0(s64) = COPY $rdi
102    %1(s64) = COPY $rsi
103    %2(s64) = G_SHL %0, %1
104    $rax = COPY %2(s64)
105    RET 0, implicit $rax
106
107...
108---
109name:            test_shl_i64_imm
110alignment:       4
111legalized:       true
112regBankSelected: true
113tracksRegLiveness: true
114registers:
115  - { id: 0, class: gpr, preferred-register: '' }
116  - { id: 1, class: gpr, preferred-register: '' }
117  - { id: 2, class: gpr, preferred-register: '' }
118liveins:
119fixedStack:
120stack:
121constants:
122body:             |
123  bb.1 (%ir-block.0):
124    liveins: $rdi
125
126    ; ALL-LABEL: name: test_shl_i64_imm
127    ; ALL: liveins: $rdi
128    ; ALL: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
129    ; ALL: [[MOV64ri32_:%[0-9]+]]:gr64 = MOV64ri32 5
130    ; ALL: $rcx = COPY [[MOV64ri32_]]
131    ; ALL: $cl = KILL killed $rcx
132    ; ALL: [[SHL64rCL:%[0-9]+]]:gr64 = SHL64rCL [[COPY]], implicit-def $eflags, implicit $cl
133    ; ALL: $rax = COPY [[SHL64rCL]]
134    ; ALL: RET 0, implicit $rax
135    %0(s64) = COPY $rdi
136    %1(s64) = G_CONSTANT i64 5
137    %2(s64) = G_SHL %0, %1
138    $rax = COPY %2(s64)
139    RET 0, implicit $rax
140
141...
142---
143name:            test_shl_i64_imm1
144alignment:       4
145legalized:       true
146regBankSelected: true
147tracksRegLiveness: true
148registers:
149  - { id: 0, class: gpr, preferred-register: '' }
150  - { id: 1, class: gpr, preferred-register: '' }
151  - { id: 2, class: gpr, preferred-register: '' }
152liveins:
153fixedStack:
154stack:
155constants:
156body:             |
157  bb.1 (%ir-block.0):
158    liveins: $rdi
159
160    ; ALL-LABEL: name: test_shl_i64_imm1
161    ; ALL: liveins: $rdi
162    ; ALL: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
163    ; ALL: [[MOV64ri32_:%[0-9]+]]:gr64 = MOV64ri32 1
164    ; ALL: $rcx = COPY [[MOV64ri32_]]
165    ; ALL: $cl = KILL killed $rcx
166    ; ALL: [[SHL64rCL:%[0-9]+]]:gr64 = SHL64rCL [[COPY]], implicit-def $eflags, implicit $cl
167    ; ALL: $rax = COPY [[SHL64rCL]]
168    ; ALL: RET 0, implicit $rax
169    %0(s64) = COPY $rdi
170    %1(s64) = G_CONSTANT i64 1
171    %2(s64) = G_SHL %0, %1
172    $rax = COPY %2(s64)
173    RET 0, implicit $rax
174
175...
176---
177name:            test_shl_i32
178alignment:       4
179legalized:       true
180regBankSelected: true
181tracksRegLiveness: true
182registers:
183  - { id: 0, class: gpr, preferred-register: '' }
184  - { id: 1, class: gpr, preferred-register: '' }
185  - { id: 2, class: gpr, preferred-register: '' }
186liveins:
187fixedStack:
188stack:
189constants:
190body:             |
191  bb.1 (%ir-block.0):
192    liveins: $edi, $esi
193
194    ; ALL-LABEL: name: test_shl_i32
195    ; ALL: liveins: $edi, $esi
196    ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
197    ; ALL: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
198    ; ALL: $ecx = COPY [[COPY1]]
199    ; ALL: $cl = KILL killed $ecx
200    ; ALL: [[SHL32rCL:%[0-9]+]]:gr32 = SHL32rCL [[COPY]], implicit-def $eflags, implicit $cl
201    ; ALL: $eax = COPY [[SHL32rCL]]
202    ; ALL: RET 0, implicit $eax
203    %0(s32) = COPY $edi
204    %1(s32) = COPY $esi
205    %2(s32) = G_SHL %0, %1
206    $eax = COPY %2(s32)
207    RET 0, implicit $eax
208
209...
210---
211name:            test_shl_i32_imm
212alignment:       4
213legalized:       true
214regBankSelected: true
215tracksRegLiveness: true
216registers:
217  - { id: 0, class: gpr, preferred-register: '' }
218  - { id: 1, class: gpr, preferred-register: '' }
219  - { id: 2, class: gpr, preferred-register: '' }
220liveins:
221fixedStack:
222stack:
223constants:
224body:             |
225  bb.1 (%ir-block.0):
226    liveins: $edi
227
228    ; ALL-LABEL: name: test_shl_i32_imm
229    ; ALL: liveins: $edi
230    ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
231    ; ALL: [[MOV32ri:%[0-9]+]]:gr32 = MOV32ri 5
232    ; ALL: $ecx = COPY [[MOV32ri]]
233    ; ALL: $cl = KILL killed $ecx
234    ; ALL: [[SHL32rCL:%[0-9]+]]:gr32 = SHL32rCL [[COPY]], implicit-def $eflags, implicit $cl
235    ; ALL: $eax = COPY [[SHL32rCL]]
236    ; ALL: RET 0, implicit $eax
237    %0(s32) = COPY $edi
238    %1(s32) = G_CONSTANT i32 5
239    %2(s32) = G_SHL %0, %1
240    $eax = COPY %2(s32)
241    RET 0, implicit $eax
242
243...
244---
245name:            test_shl_i32_imm1
246alignment:       4
247legalized:       true
248regBankSelected: true
249tracksRegLiveness: true
250registers:
251  - { id: 0, class: gpr, preferred-register: '' }
252  - { id: 1, class: gpr, preferred-register: '' }
253  - { id: 2, class: gpr, preferred-register: '' }
254liveins:
255fixedStack:
256stack:
257constants:
258body:             |
259  bb.1 (%ir-block.0):
260    liveins: $edi
261
262    ; ALL-LABEL: name: test_shl_i32_imm1
263    ; ALL: liveins: $edi
264    ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
265    ; ALL: [[MOV32ri:%[0-9]+]]:gr32 = MOV32ri 1
266    ; ALL: $ecx = COPY [[MOV32ri]]
267    ; ALL: $cl = KILL killed $ecx
268    ; ALL: [[SHL32rCL:%[0-9]+]]:gr32 = SHL32rCL [[COPY]], implicit-def $eflags, implicit $cl
269    ; ALL: $eax = COPY [[SHL32rCL]]
270    ; ALL: RET 0, implicit $eax
271    %0(s32) = COPY $edi
272    %1(s32) = G_CONSTANT i32 1
273    %2(s32) = G_SHL %0, %1
274    $eax = COPY %2(s32)
275    RET 0, implicit $eax
276
277...
278---
279name:            test_shl_i16
280alignment:       4
281legalized:       true
282regBankSelected: true
283tracksRegLiveness: true
284registers:
285  - { id: 0, class: gpr, preferred-register: '' }
286  - { id: 1, class: gpr, preferred-register: '' }
287  - { id: 2, class: gpr, preferred-register: '' }
288  - { id: 3, class: gpr, preferred-register: '' }
289  - { id: 4, class: gpr, preferred-register: '' }
290liveins:
291fixedStack:
292stack:
293constants:
294body:             |
295  bb.1 (%ir-block.0):
296    liveins: $edi, $esi
297
298    ; ALL-LABEL: name: test_shl_i16
299    ; ALL: liveins: $edi, $esi
300    ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
301    ; ALL: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
302    ; ALL: [[COPY2:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
303    ; ALL: [[COPY3:%[0-9]+]]:gr16 = COPY [[COPY1]].sub_16bit
304    ; ALL: $cx = COPY [[COPY3]]
305    ; ALL: $cl = KILL killed $cx
306    ; ALL: [[SHL16rCL:%[0-9]+]]:gr16 = SHL16rCL [[COPY2]], implicit-def $eflags, implicit $cl
307    ; ALL: $ax = COPY [[SHL16rCL]]
308    ; ALL: RET 0, implicit $ax
309    %0(s32) = COPY $edi
310    %1(s32) = COPY $esi
311    %2(s16) = G_TRUNC %0(s32)
312    %3(s16) = G_TRUNC %1(s32)
313    %4(s16) = G_SHL %2, %3
314    $ax = COPY %4(s16)
315    RET 0, implicit $ax
316
317...
318---
319name:            test_shl_i16_imm
320alignment:       4
321legalized:       true
322regBankSelected: true
323tracksRegLiveness: true
324registers:
325  - { id: 0, class: gpr, preferred-register: '' }
326  - { id: 1, class: gpr, preferred-register: '' }
327  - { id: 2, class: gpr, preferred-register: '' }
328  - { id: 3, class: gpr, preferred-register: '' }
329liveins:
330fixedStack:
331stack:
332constants:
333body:             |
334  bb.1 (%ir-block.0):
335    liveins: $edi
336
337    ; ALL-LABEL: name: test_shl_i16_imm
338    ; ALL: liveins: $edi
339    ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
340    ; ALL: [[MOV16ri:%[0-9]+]]:gr16 = MOV16ri 5
341    ; ALL: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
342    ; ALL: $cx = COPY [[MOV16ri]]
343    ; ALL: $cl = KILL killed $cx
344    ; ALL: [[SHL16rCL:%[0-9]+]]:gr16 = SHL16rCL [[COPY1]], implicit-def $eflags, implicit $cl
345    ; ALL: $ax = COPY [[SHL16rCL]]
346    ; ALL: RET 0, implicit $ax
347    %0(s32) = COPY $edi
348    %2(s16) = G_CONSTANT i16 5
349    %1(s16) = G_TRUNC %0(s32)
350    %3(s16) = G_SHL %1, %2
351    $ax = COPY %3(s16)
352    RET 0, implicit $ax
353
354...
355---
356name:            test_shl_i16_imm1
357alignment:       4
358legalized:       true
359regBankSelected: true
360tracksRegLiveness: true
361registers:
362  - { id: 0, class: gpr, preferred-register: '' }
363  - { id: 1, class: gpr, preferred-register: '' }
364  - { id: 2, class: gpr, preferred-register: '' }
365  - { id: 3, class: gpr, preferred-register: '' }
366liveins:
367fixedStack:
368stack:
369constants:
370body:             |
371  bb.1 (%ir-block.0):
372    liveins: $edi
373
374    ; ALL-LABEL: name: test_shl_i16_imm1
375    ; ALL: liveins: $edi
376    ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
377    ; ALL: [[MOV16ri:%[0-9]+]]:gr16 = MOV16ri 1
378    ; ALL: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
379    ; ALL: $cx = COPY [[MOV16ri]]
380    ; ALL: $cl = KILL killed $cx
381    ; ALL: [[SHL16rCL:%[0-9]+]]:gr16 = SHL16rCL [[COPY1]], implicit-def $eflags, implicit $cl
382    ; ALL: $ax = COPY [[SHL16rCL]]
383    ; ALL: RET 0, implicit $ax
384    %0(s32) = COPY $edi
385    %2(s16) = G_CONSTANT i16 1
386    %1(s16) = G_TRUNC %0(s32)
387    %3(s16) = G_SHL %1, %2
388    $ax = COPY %3(s16)
389    RET 0, implicit $ax
390
391...
392---
393name:            test_shl_i8
394alignment:       4
395legalized:       true
396regBankSelected: true
397tracksRegLiveness: true
398registers:
399  - { id: 0, class: gpr, preferred-register: '' }
400  - { id: 1, class: gpr, preferred-register: '' }
401  - { id: 2, class: gpr, preferred-register: '' }
402  - { id: 3, class: gpr, preferred-register: '' }
403  - { id: 4, class: gpr, preferred-register: '' }
404liveins:
405fixedStack:
406stack:
407constants:
408body:             |
409  bb.1 (%ir-block.0):
410    liveins: $edi, $esi
411
412    ; ALL-LABEL: name: test_shl_i8
413    ; ALL: liveins: $edi, $esi
414    ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
415    ; ALL: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
416    ; ALL: [[COPY2:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
417    ; ALL: [[COPY3:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
418    ; ALL: $cl = COPY [[COPY3]]
419    ; ALL: [[SHL8rCL:%[0-9]+]]:gr8 = SHL8rCL [[COPY2]], implicit-def $eflags, implicit $cl
420    ; ALL: $al = COPY [[SHL8rCL]]
421    ; ALL: RET 0, implicit $al
422    %0(s32) = COPY $edi
423    %1(s32) = COPY $esi
424    %2(s8) = G_TRUNC %0(s32)
425    %3(s8) = G_TRUNC %1(s32)
426    %4(s8) = G_SHL %2, %3
427    $al = COPY %4(s8)
428    RET 0, implicit $al
429
430...
431---
432name:            test_shl_i8_imm
433alignment:       4
434legalized:       true
435regBankSelected: true
436tracksRegLiveness: true
437registers:
438  - { id: 0, class: gpr, preferred-register: '' }
439  - { id: 1, class: gpr, preferred-register: '' }
440  - { id: 2, class: gpr, preferred-register: '' }
441  - { id: 3, class: gpr, preferred-register: '' }
442liveins:
443fixedStack:
444stack:
445constants:
446body:             |
447  bb.1 (%ir-block.0):
448    liveins: $edi
449
450    ; ALL-LABEL: name: test_shl_i8_imm
451    ; ALL: liveins: $edi
452    ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
453    ; ALL: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
454    ; ALL: [[SHL8ri:%[0-9]+]]:gr8 = SHL8ri [[COPY1]], 5, implicit-def $eflags
455    ; ALL: $al = COPY [[SHL8ri]]
456    ; ALL: RET 0, implicit $al
457    %0(s32) = COPY $edi
458    %2(s8) = G_CONSTANT i8 5
459    %1(s8) = G_TRUNC %0(s32)
460    %3(s8) = G_SHL %1, %2
461    $al = COPY %3(s8)
462    RET 0, implicit $al
463
464...
465---
466name:            test_shl_i8_imm1
467alignment:       4
468legalized:       true
469regBankSelected: true
470tracksRegLiveness: true
471registers:
472  - { id: 0, class: gpr, preferred-register: '' }
473  - { id: 1, class: gpr, preferred-register: '' }
474  - { id: 2, class: gpr, preferred-register: '' }
475  - { id: 3, class: gpr, preferred-register: '' }
476liveins:
477fixedStack:
478stack:
479constants:
480body:             |
481  bb.1 (%ir-block.0):
482    liveins: $edi
483
484    ; ALL-LABEL: name: test_shl_i8_imm1
485    ; ALL: liveins: $edi
486    ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
487    ; ALL: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
488    ; ALL: [[ADD8rr:%[0-9]+]]:gr8 = ADD8rr [[COPY1]], [[COPY1]], implicit-def $eflags
489    ; ALL: $al = COPY [[ADD8rr]]
490    ; ALL: RET 0, implicit $al
491    %0(s32) = COPY $edi
492    %2(s8) = G_CONSTANT i8 1
493    %1(s8) = G_TRUNC %0(s32)
494    %3(s8) = G_SHL %1, %2
495    $al = COPY %3(s8)
496    RET 0, implicit $al
497
498...
499