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
6 define void @test_copy() {
10 define void @test_copy2() {
14 define void @test_copy3() {
18 define void @test_copy4() {
22 define void @test_copy5() {
26 define void @test_copy6() {
33 # ALL-LABEL: name: test_copy
38 # ALL-NEXT: - { id: 0, class: gr8, preferred-register: '' }
39 # ALL-NEXT: - { id: 1, class: gr32, preferred-register: '' }
41 - { id: 0, class: gpr, preferred-register: '' }
42 - { id: 1, class: gpr, preferred-register: '' }
43 # ALL %0:gr8 = COPY $al
44 # ALL-NEXT %1:gr32 = MOVZX32rr8 %0
45 # ALL-NEXT $eax = COPY %1
46 # ALL-NEXT RET 0, implicit $eax
52 %1(s32) = G_ZEXT %0(s8)
59 # ALL-LABEL: name: test_copy2
64 # ALL-NEXT: - { id: 0, class: gr8, preferred-register: '' }
65 # ALL-NEXT: - { id: 1, class: gr32, preferred-register: '' }
67 - { id: 0, class: gpr, preferred-register: '' }
68 - { id: 1, class: gpr, preferred-register: '' }
69 # ALL: %0:gr8 = COPY $al
70 # ALL-NEXT: %1:gr32 = MOVZX32rr8 %0
71 # ALL-NEXT: $eax = COPY %1
72 # ALL-NEXT: RET 0, implicit $eax
78 %1(s32) = G_ZEXT %0(s8)
85 # ALL-LABEL: name: test_copy3
90 # ALL-NEXT: - { id: 0, class: gr16[[ABCD:(_abcd)?]], preferred-register: '' }
91 # ALL-NEXT: - { id: 1, class: gr8, preferred-register: '' }
92 # ALL-NEXT: - { id: 2, class: gr32, preferred-register: '' }
94 - { id: 0, class: gpr, preferred-register: '' }
95 - { id: 1, class: gpr, preferred-register: '' }
96 - { id: 2, class: gpr, preferred-register: '' }
97 # ALL %0:gr16 = COPY $ax
98 # ALL-NEXT %1:gr8 = COPY %0.sub_8bit
99 # ALL-NEXT %2:gr32 = MOVZX32rr8 %1
100 # ALL-NEXT $eax = COPY %2
101 # ALL-NEXT RET 0, implicit $eax
107 %1(s8) = G_TRUNC %0(s16)
108 %2(s32) = G_ZEXT %1(s8)
115 # ALL-LABEL: name: test_copy4
118 regBankSelected: true
120 # ALL-NEXT: - { id: 0, class: gr32, preferred-register: '' }
121 # ALL-NEXT: - { id: 1, class: gr16, preferred-register: '' }
122 # ALL-NEXT: - { id: 2, class: gr32, preferred-register: '' }
124 - { id: 0, class: gpr, preferred-register: '' }
125 - { id: 1, class: gpr, preferred-register: '' }
126 - { id: 2, class: gpr, preferred-register: '' }
127 # ALL %0:gr32 = COPY $eax
128 # ALL-NEXT %1:gr16 = COPY %0.sub_16bit
129 # ALL-NEXT %2:gr32 = MOVZX32rr16 %1
130 # ALL-NEXT $eax = COPY %2
131 # ALL-NEXT RET 0, implicit $eax
137 %1(s16) = G_TRUNC %0(s32)
138 %2(s32) = G_ZEXT %1(s16)
145 # ALL-LABEL: name: test_copy5
148 regBankSelected: true
150 # ALL-NEXT: - { id: 0, class: gr32[[ABCD:(_abcd)?]], preferred-register: '' }
151 # ALL-NEXT: - { id: 1, class: gr8, preferred-register: '' }
152 # ALL-NEXT: - { id: 2, class: gr32, preferred-register: '' }
154 - { id: 0, class: gpr, preferred-register: '' }
155 - { id: 1, class: gpr, preferred-register: '' }
156 - { id: 2, class: gpr, preferred-register: '' }
157 # ALL %0:gr32[[ABCD]] = COPY $edx
158 # ALL-NEXT %1:gr8 = COPY %0.sub_8bit
159 # ALL-NEXT %2:gr32 = MOVZX32rr8 %1
160 # ALL-NEXT $eax = COPY %2
161 # ALL-NEXT RET 0, implicit $eax
167 %1(s8) = G_TRUNC %0(s32)
168 %2(s32) = G_ANYEXT %1(s8)
175 # ALL-LABEL: name: test_copy6
178 regBankSelected: true
180 # ALL-NEXT: - { id: 0, class: gr32, preferred-register: '' }
181 # ALL-NEXT: - { id: 1, class: gr16, preferred-register: '' }
182 # ALL-NEXT: - { id: 2, class: gr32, preferred-register: '' }
184 - { id: 0, class: gpr, preferred-register: '' }
185 - { id: 1, class: gpr, preferred-register: '' }
186 - { id: 2, class: gpr, preferred-register: '' }
187 # ALL %0:gr32 = COPY $edx
188 # ALL-NEXT %1:gr16 = COPY %0.sub_16bit
189 # ALL-NEXT %2:gr32 = SUBREG_TO_REG 0, %1, %subreg.sub_16bit
190 # ALL-NEXT $eax = COPY %2
191 # ALL-NEXT RET 0, implicit $eax
197 %1(s16) = G_TRUNC %0(s32)
198 %2(s32) = G_ANYEXT %1(s16)