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: [[MOVZX32rr8_:%[0-9]+]]:gr32 = MOVZX32rr8 [[COPY1]]
140 ; ALL: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[MOVZX32rr8_]], %subreg.sub_32bit
141 ; ALL: $rax = COPY [[SUBREG_TO_REG]]
142 ; ALL: RET 0, implicit $rax
144 %1(s8) = G_TRUNC %0(s64)
145 %2(s64) = G_ANYEXT %1(s8)
150 name: anyext_s64_from_s16
153 regBankSelected: true
155 - { id: 0, class: gpr }
156 - { id: 1, class: gpr }
157 - { id: 2, class: gpr }
162 ; ALL-LABEL: name: anyext_s64_from_s16
163 ; ALL: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
164 ; ALL: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
165 ; ALL: [[MOVZX32rr16_:%[0-9]+]]:gr32 = MOVZX32rr16 [[COPY1]]
166 ; ALL: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[MOVZX32rr16_]], %subreg.sub_32bit
167 ; ALL: $rax = COPY [[SUBREG_TO_REG]]
168 ; ALL: RET 0, implicit $rax
170 %1(s16) = G_TRUNC %0(s64)
171 %2(s64) = G_ANYEXT %1(s16)
176 name: anyext_s64_from_s32
179 regBankSelected: true
181 - { id: 0, class: gpr }
182 - { id: 1, class: gpr }
183 - { id: 2, class: gpr }
188 ; ALL-LABEL: name: anyext_s64_from_s32
189 ; ALL: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
190 ; ALL: [[COPY1:%[0-9]+]]:gr32 = COPY [[COPY]].sub_32bit
191 ; ALL: [[DEF:%[0-9]+]]:gr64 = IMPLICIT_DEF
192 ; ALL: [[INSERT_SUBREG:%[0-9]+]]:gr64 = INSERT_SUBREG [[DEF]], [[COPY1]], %subreg.sub_32bit
193 ; ALL: $rax = COPY [[INSERT_SUBREG]]
194 ; ALL: RET 0, implicit $rax
196 %1(s32) = G_TRUNC %0(s64)
197 %2(s64) = G_ANYEXT %1(s32)