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