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 6 define void @test_copy() { 7 ret void 8 } 9 10 define void @test_copy2() { 11 ret void 12 } 13 14 define void @test_copy3() { 15 ret void 16 } 17 18 define void @test_copy4() { 19 ret void 20 } 21 22 define void @test_copy5() { 23 ret void 24 } 25 26 define void @test_copy6() { 27 ret void 28 } 29 30... 31--- 32name: test_copy 33# ALL-LABEL: name: test_copy 34alignment: 16 35legalized: true 36regBankSelected: true 37# ALL: registers: 38# ALL-NEXT: - { id: 0, class: gr8, preferred-register: '' } 39# ALL-NEXT: - { id: 1, class: gr32, preferred-register: '' } 40registers: 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 47body: | 48 bb.1 (%ir-block.0): 49 liveins: $eax 50 51 %0(s8) = COPY $al 52 %1(s32) = G_ZEXT %0(s8) 53 $eax = COPY %1(s32) 54 RET 0, implicit $eax 55 56... 57--- 58name: test_copy2 59# ALL-LABEL: name: test_copy2 60alignment: 16 61legalized: true 62regBankSelected: true 63# ALL: registers: 64# ALL-NEXT: - { id: 0, class: gr8, preferred-register: '' } 65# ALL-NEXT: - { id: 1, class: gr32, preferred-register: '' } 66registers: 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 73body: | 74 bb.1 (%ir-block.0): 75 liveins: $eax 76 77 %0(s8) = COPY $al 78 %1(s32) = G_ZEXT %0(s8) 79 $eax = COPY %1(s32) 80 RET 0, implicit $eax 81 82... 83--- 84name: test_copy3 85# ALL-LABEL: name: test_copy3 86alignment: 16 87legalized: true 88regBankSelected: true 89# ALL: registers: 90# ALL-NEXT: - { id: 0, class: gr16[[ABCD:(_abcd)?]], preferred-register: '' } 91# X32-NEXT: - { id: 1, class: gr8_abcd_l, preferred-register: '' } 92# X64-NEXT: - { id: 1, class: gr8, preferred-register: '' } 93# ALL-NEXT: - { id: 2, class: gr32, preferred-register: '' } 94registers: 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 105body: | 106 bb.1 (%ir-block.0): 107 liveins: $eax 108 109 %0(s16) = COPY $ax 110 %1(s8) = G_TRUNC %0(s16) 111 %2(s32) = G_ZEXT %1(s8) 112 $eax = COPY %2(s32) 113 RET 0, implicit $eax 114 115... 116--- 117name: test_copy4 118# ALL-LABEL: name: test_copy4 119alignment: 16 120legalized: true 121regBankSelected: true 122# ALL: registers: 123# ALL-NEXT: - { id: 0, class: gr32, preferred-register: '' } 124# ALL-NEXT: - { id: 1, class: gr16, preferred-register: '' } 125# ALL-NEXT: - { id: 2, class: gr32, preferred-register: '' } 126registers: 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 135body: | 136 bb.1 (%ir-block.0): 137 liveins: $eax 138 139 %0(s32) = COPY $eax 140 %1(s16) = G_TRUNC %0(s32) 141 %2(s32) = G_ZEXT %1(s16) 142 $eax = COPY %2(s32) 143 RET 0, implicit $eax 144 145... 146--- 147name: test_copy5 148# ALL-LABEL: name: test_copy5 149alignment: 16 150legalized: true 151regBankSelected: true 152# ALL: registers: 153# ALL-NEXT: - { id: 0, class: gr32[[ABCD:(_abcd)?]], preferred-register: '' } 154# X32-NEXT: - { id: 1, class: gr8_abcd_l, preferred-register: '' } 155# X64-NEXT: - { id: 1, class: gr8, preferred-register: '' } 156# ALL-NEXT: - { id: 2, class: gr32, preferred-register: '' } 157registers: 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 168body: | 169 bb.1 (%ir-block.0): 170 liveins: $eax,$edx 171 172 %0(s32) = COPY $edx 173 %1(s8) = G_TRUNC %0(s32) 174 %2(s32) = G_ANYEXT %1(s8) 175 $eax = COPY %2(s32) 176 RET 0, implicit $eax 177 178... 179--- 180name: test_copy6 181# ALL-LABEL: name: test_copy6 182alignment: 16 183legalized: true 184regBankSelected: true 185# ALL: registers: 186# ALL-NEXT: - { id: 0, class: gr32, preferred-register: '' } 187# ALL-NEXT: - { id: 1, class: gr16, preferred-register: '' } 188# ALL-NEXT: - { id: 2, class: low32_addr_access_rbp, preferred-register: '' } 189# ALL-NEXT: - { id: 3, class: low32_addr_access_rbp, preferred-register: '' } 190registers: 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 200body: | 201 bb.1 (%ir-block.0): 202 liveins: $eax,$edx 203 204 %0(s32) = COPY $edx 205 %1(s16) = G_TRUNC %0(s32) 206 %2(s32) = G_ANYEXT %1(s16) 207 $eax = COPY %2(s32) 208 RET 0, implicit $eax 209 210... 211