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: '', flags: [ ] }
39 # ALL-NEXT: - { id: 1, class: gr32, preferred-register: '', flags: [ ] }
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: '', flags: [ ] }
65 # ALL-NEXT: - { id: 1, class: gr32, preferred-register: '', flags: [ ] }
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: '', flags: [ ] }
91 # X32-NEXT: - { id: 1, class: gr8_abcd_l, preferred-register: '', flags: [ ] }
92 # X64-NEXT: - { id: 1, class: gr8, preferred-register: '', flags: [ ] }
93 # ALL-NEXT: - { id: 2, class: gr32, preferred-register: '', flags: [ ] }
95 - { id: 0, class: gpr, preferred-register: '' }
96 - { id: 1, class: gpr, preferred-register: '' }
97 - { id: 2, class: gpr, preferred-register: '' }
98 # ALL: %0:gr16 = COPY $ax
99 # X32-NEXT: %3:gr16_abcd = COPY %0
100 # X32-NEXT: %1:gr8_abcd_l = COPY %3.sub_8bit
101 # X64-NEXT: %1:gr8 = COPY %0.sub_8bit
102 # ALL-NEXT: %2:gr32 = MOVZX32rr8 %1
103 # ALL-NEXT: $eax = COPY %2
104 # ALL-NEXT: RET 0, implicit $eax
110 %1(s8) = G_TRUNC %0(s16)
111 %2(s32) = G_ZEXT %1(s8)
118 # ALL-LABEL: name: test_copy4
121 regBankSelected: true
123 # ALL-NEXT: - { id: 0, class: gr32, preferred-register: '', flags: [ ] }
124 # ALL-NEXT: - { id: 1, class: gr16, preferred-register: '', flags: [ ] }
125 # ALL-NEXT: - { id: 2, class: gr32, preferred-register: '', flags: [ ] }
127 - { id: 0, class: gpr, preferred-register: '' }
128 - { id: 1, class: gpr, preferred-register: '' }
129 - { id: 2, class: gpr, preferred-register: '' }
130 # ALL: %0:gr32 = COPY $eax
131 # ALL-NEXT: %1:gr16 = COPY %0.sub_16bit
132 # ALL-NEXT: %2:gr32 = MOVZX32rr16 %1
133 # ALL-NEXT: $eax = COPY %2
134 # ALL-NEXT: RET 0, implicit $eax
140 %1(s16) = G_TRUNC %0(s32)
141 %2(s32) = G_ZEXT %1(s16)
148 # ALL-LABEL: name: test_copy5
151 regBankSelected: true
153 # ALL-NEXT: - { id: 0, class: gr32[[ABCD:(_abcd)?]], preferred-register: '', flags: [ ] }
154 # X32-NEXT: - { id: 1, class: gr8_abcd_l, preferred-register: '', flags: [ ] }
155 # X64-NEXT: - { id: 1, class: gr8, preferred-register: '', flags: [ ] }
156 # ALL-NEXT: - { id: 2, class: gr32, preferred-register: '', flags: [ ] }
158 - { id: 0, class: gpr, preferred-register: '' }
159 - { id: 1, class: gpr, preferred-register: '' }
160 - { id: 2, class: gpr, preferred-register: '' }
161 # ALL: %0:gr32 = COPY $edx
162 # X32-NEXT: %3:gr32_abcd = COPY %0
163 # X32-NEXT: %1:gr8_abcd_l = COPY %3.sub_8bit
164 # X64-NEXT: %1:gr8 = COPY %0.sub_8bit
165 # ALL-NEXT: %2:gr32 = MOVZX32rr8 %1
166 # ALL-NEXT: $eax = COPY %2
167 # ALL-NEXT: RET 0, implicit $eax
173 %1(s8) = G_TRUNC %0(s32)
174 %2(s32) = G_ANYEXT %1(s8)
181 # ALL-LABEL: name: test_copy6
184 regBankSelected: true
186 # ALL-NEXT: - { id: 0, class: gr32, preferred-register: '', flags: [ ] }
187 # ALL-NEXT: - { id: 1, class: gr16, preferred-register: '', flags: [ ] }
188 # ALL-NEXT: - { id: 2, class: low32_addr_access_rbp, preferred-register: '', flags: [ ] }
189 # ALL-NEXT: - { id: 3, class: low32_addr_access_rbp, preferred-register: '', flags: [ ] }
191 - { id: 0, class: gpr, preferred-register: '' }
192 - { id: 1, class: gpr, preferred-register: '' }
193 - { id: 2, class: gpr, preferred-register: '' }
194 # ALL: %0:gr32 = COPY $edx
195 # ALL-NEXT: %1:gr16 = COPY %0.sub_16bit
196 # ALL-NEXT: %3:low32_addr_access_rbp = IMPLICIT_DEF
197 # ALL-NEXT: %2:low32_addr_access_rbp = INSERT_SUBREG %3, %1, %subreg.sub_16bit
198 # ALL-NEXT: $eax = COPY %2
199 # ALL-NEXT: RET 0, implicit $eax
205 %1(s16) = G_TRUNC %0(s32)
206 %2(s32) = G_ANYEXT %1(s16)