1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=x86_64-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=X64
5 define i64 @test_zext_i1(i8 %a) {
6 %val = trunc i8 %a to i1
7 %r = zext i1 %val to i64
11 define i64 @test_sext_i8(i8 %val) {
12 %r = sext i8 %val to i64
16 define i64 @test_sext_i16(i16 %val) {
17 %r = sext i16 %val to i64
21 define void @anyext_s64_from_s1() { ret void }
22 define void @anyext_s64_from_s8() { ret void }
23 define void @anyext_s64_from_s16() { ret void }
24 define void @anyext_s64_from_s32() { ret void }
32 - { id: 0, class: gpr }
33 - { id: 1, class: gpr }
34 - { id: 2, class: gpr }
39 ; ALL-LABEL: name: test_zext_i1
40 ; ALL: [[COPY:%[0-9]+]]:gr8 = COPY $dil
41 ; ALL: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[COPY]], %subreg.sub_8bit
42 ; ALL: [[AND64ri8_:%[0-9]+]]:gr64 = AND64ri8 [[SUBREG_TO_REG]], 1, implicit-def $eflags
43 ; ALL: $rax = COPY [[AND64ri8_]]
44 ; ALL: RET 0, implicit $rax
46 %1(s1) = G_TRUNC %0(s8)
47 %2(s64) = G_ZEXT %1(s1)
58 - { id: 0, class: gpr }
59 - { id: 1, class: gpr }
64 ; ALL-LABEL: name: test_sext_i8
65 ; ALL: [[COPY:%[0-9]+]]:gr8 = COPY $dil
66 ; ALL: [[MOVSX64rr8_:%[0-9]+]]:gr64 = MOVSX64rr8 [[COPY]]
67 ; ALL: $rax = COPY [[MOVSX64rr8_]]
68 ; ALL: RET 0, implicit $rax
70 %1(s64) = G_SEXT %0(s8)
81 - { id: 0, class: gpr }
82 - { id: 1, class: gpr }
87 ; ALL-LABEL: name: test_sext_i16
88 ; ALL: [[COPY:%[0-9]+]]:gr16 = COPY $di
89 ; ALL: [[MOVSX64rr16_:%[0-9]+]]:gr64 = MOVSX64rr16 [[COPY]]
90 ; ALL: $rax = COPY [[MOVSX64rr16_]]
91 ; ALL: RET 0, implicit $rax
93 %1(s64) = G_SEXT %0(s16)
99 name: anyext_s64_from_s1
102 regBankSelected: true
104 - { id: 0, class: gpr }
105 - { id: 1, class: gpr }
106 - { id: 2, class: gpr }
111 ; ALL-LABEL: name: anyext_s64_from_s1
112 ; ALL: [[COPY:%[0-9]+]]:gr64_with_sub_8bit = COPY $rdi
113 ; ALL: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
114 ; ALL: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[COPY1]], %subreg.sub_8bit
115 ; ALL: $rax = COPY [[SUBREG_TO_REG]]
116 ; ALL: RET 0, implicit $rax
118 %1(s1) = G_TRUNC %0(s64)
119 %2(s64) = G_ANYEXT %1(s1)
124 name: anyext_s64_from_s8
127 regBankSelected: true
129 - { id: 0, class: gpr }
130 - { id: 1, class: gpr }
131 - { id: 2, class: gpr }
136 ; ALL-LABEL: name: anyext_s64_from_s8
137 ; ALL: [[COPY:%[0-9]+]]:gr64_with_sub_8bit = COPY $rdi
138 ; ALL: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
139 ; ALL: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[COPY1]], %subreg.sub_8bit
140 ; ALL: $rax = COPY [[SUBREG_TO_REG]]
141 ; ALL: RET 0, implicit $rax
143 %1(s8) = G_TRUNC %0(s64)
144 %2(s64) = G_ANYEXT %1(s8)
149 name: anyext_s64_from_s16
152 regBankSelected: true
154 - { id: 0, class: gpr }
155 - { id: 1, class: gpr }
156 - { id: 2, class: gpr }
161 ; ALL-LABEL: name: anyext_s64_from_s16
162 ; ALL: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
163 ; ALL: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
164 ; ALL: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[COPY1]], %subreg.sub_16bit
165 ; ALL: $rax = COPY [[SUBREG_TO_REG]]
166 ; ALL: RET 0, implicit $rax
168 %1(s16) = G_TRUNC %0(s64)
169 %2(s64) = G_ANYEXT %1(s16)
174 name: anyext_s64_from_s32
177 regBankSelected: true
179 - { id: 0, class: gpr }
180 - { id: 1, class: gpr }
181 - { id: 2, class: gpr }
186 ; ALL-LABEL: name: anyext_s64_from_s32
187 ; ALL: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
188 ; ALL: [[COPY1:%[0-9]+]]:gr32 = COPY [[COPY]].sub_32bit
189 ; ALL: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[COPY1]], %subreg.sub_32bit
190 ; ALL: $rax = COPY [[SUBREG_TO_REG]]
191 ; ALL: RET 0, implicit $rax
193 %1(s32) = G_TRUNC %0(s64)
194 %2(s64) = G_ANYEXT %1(s32)