llvm-project/llvm/test/CodeGen/X86/GlobalISel/select-copy.mir

204 lines
5.5 KiB
YAML

# RUN: llc -mtriple=i386-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=X32
# RUN: llc -mtriple=x86_64-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=X64
--- |
define void @test_copy() {
ret void
}
define void @test_copy2() {
ret void
}
define void @test_copy3() {
ret void
}
define void @test_copy4() {
ret void
}
define void @test_copy5() {
ret void
}
define void @test_copy6() {
ret void
}
...
---
name: test_copy
# ALL-LABEL: name: test_copy
alignment: 4
legalized: true
regBankSelected: true
# ALL: registers:
# ALL-NEXT: - { id: 0, class: gr8, preferred-register: '' }
# ALL-NEXT: - { id: 1, class: gr32, preferred-register: '' }
registers:
- { id: 0, class: gpr, preferred-register: '' }
- { id: 1, class: gpr, preferred-register: '' }
# ALL %0:gr8 = COPY $al
# ALL-NEXT %1:gr32 = MOVZX32rr8 %0
# ALL-NEXT $eax = COPY %1
# ALL-NEXT RET 0, implicit $eax
body: |
bb.1 (%ir-block.0):
liveins: $eax
%0(s8) = COPY $al
%1(s32) = G_ZEXT %0(s8)
$eax = COPY %1(s32)
RET 0, implicit $eax
...
---
name: test_copy2
# ALL-LABEL: name: test_copy2
alignment: 4
legalized: true
regBankSelected: true
# ALL: registers:
# ALL-NEXT: - { id: 0, class: gr8, preferred-register: '' }
# ALL-NEXT: - { id: 1, class: gr32, preferred-register: '' }
registers:
- { id: 0, class: gpr, preferred-register: '' }
- { id: 1, class: gpr, preferred-register: '' }
# ALL: %0:gr8 = COPY $al
# ALL-NEXT: %1:gr32 = MOVZX32rr8 %0
# ALL-NEXT: $eax = COPY %1
# ALL-NEXT: RET 0, implicit $eax
body: |
bb.1 (%ir-block.0):
liveins: $eax
%0(s8) = COPY $al
%1(s32) = G_ZEXT %0(s8)
$eax = COPY %1(s32)
RET 0, implicit $eax
...
---
name: test_copy3
# ALL-LABEL: name: test_copy3
alignment: 4
legalized: true
regBankSelected: true
# ALL: registers:
# ALL-NEXT: - { id: 0, class: gr16[[ABCD:(_abcd)?]], preferred-register: '' }
# ALL-NEXT: - { id: 1, class: gr8, preferred-register: '' }
# ALL-NEXT: - { id: 2, class: gr32, preferred-register: '' }
registers:
- { id: 0, class: gpr, preferred-register: '' }
- { id: 1, class: gpr, preferred-register: '' }
- { id: 2, class: gpr, preferred-register: '' }
# ALL %0:gr16 = COPY $ax
# ALL-NEXT %1:gr8 = COPY %0.sub_8bit
# ALL-NEXT %2:gr32 = MOVZX32rr8 %1
# ALL-NEXT $eax = COPY %2
# ALL-NEXT RET 0, implicit $eax
body: |
bb.1 (%ir-block.0):
liveins: $eax
%0(s16) = COPY $ax
%1(s8) = G_TRUNC %0(s16)
%2(s32) = G_ZEXT %1(s8)
$eax = COPY %2(s32)
RET 0, implicit $eax
...
---
name: test_copy4
# ALL-LABEL: name: test_copy4
alignment: 4
legalized: true
regBankSelected: true
# ALL: registers:
# ALL-NEXT: - { id: 0, class: gr32, preferred-register: '' }
# ALL-NEXT: - { id: 1, class: gr16, preferred-register: '' }
# ALL-NEXT: - { id: 2, class: gr32, preferred-register: '' }
registers:
- { id: 0, class: gpr, preferred-register: '' }
- { id: 1, class: gpr, preferred-register: '' }
- { id: 2, class: gpr, preferred-register: '' }
# ALL %0:gr32 = COPY $eax
# ALL-NEXT %1:gr16 = COPY %0.sub_16bit
# ALL-NEXT %2:gr32 = MOVZX32rr16 %1
# ALL-NEXT $eax = COPY %2
# ALL-NEXT RET 0, implicit $eax
body: |
bb.1 (%ir-block.0):
liveins: $eax
%0(s32) = COPY $eax
%1(s16) = G_TRUNC %0(s32)
%2(s32) = G_ZEXT %1(s16)
$eax = COPY %2(s32)
RET 0, implicit $eax
...
---
name: test_copy5
# ALL-LABEL: name: test_copy5
alignment: 4
legalized: true
regBankSelected: true
# ALL: registers:
# ALL-NEXT: - { id: 0, class: gr32[[ABCD:(_abcd)?]], preferred-register: '' }
# ALL-NEXT: - { id: 1, class: gr8, preferred-register: '' }
# ALL-NEXT: - { id: 2, class: gr32, preferred-register: '' }
registers:
- { id: 0, class: gpr, preferred-register: '' }
- { id: 1, class: gpr, preferred-register: '' }
- { id: 2, class: gpr, preferred-register: '' }
# ALL %0:gr32[[ABCD]] = COPY $edx
# ALL-NEXT %1:gr8 = COPY %0.sub_8bit
# ALL-NEXT %2:gr32 = MOVZX32rr8 %1
# ALL-NEXT $eax = COPY %2
# ALL-NEXT RET 0, implicit $eax
body: |
bb.1 (%ir-block.0):
liveins: $eax,$edx
%0(s32) = COPY $edx
%1(s8) = G_TRUNC %0(s32)
%2(s32) = G_ANYEXT %1(s8)
$eax = COPY %2(s32)
RET 0, implicit $eax
...
---
name: test_copy6
# ALL-LABEL: name: test_copy6
alignment: 4
legalized: true
regBankSelected: true
# ALL: registers:
# ALL-NEXT: - { id: 0, class: gr32, preferred-register: '' }
# ALL-NEXT: - { id: 1, class: gr16, preferred-register: '' }
# ALL-NEXT: - { id: 2, class: gr32, preferred-register: '' }
registers:
- { id: 0, class: gpr, preferred-register: '' }
- { id: 1, class: gpr, preferred-register: '' }
- { id: 2, class: gpr, preferred-register: '' }
# ALL %0:gr32 = COPY $edx
# ALL-NEXT %1:gr16 = COPY %0.sub_16bit
# ALL-NEXT %2:gr32 = SUBREG_TO_REG 0, %1, %subreg.sub_16bit
# ALL-NEXT $eax = COPY %2
# ALL-NEXT RET 0, implicit $eax
body: |
bb.1 (%ir-block.0):
liveins: $eax,$edx
%0(s32) = COPY $edx
%1(s16) = G_TRUNC %0(s32)
%2(s32) = G_ANYEXT %1(s16)
$eax = COPY %2(s32)
RET 0, implicit $eax
...