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
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: [[DEF:%[0-9]+]]:gr64 = IMPLICIT_DEF
42 ; ALL: [[INSERT_SUBREG:%[0-9]+]]:gr64 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.sub_8bit
43 ; ALL: [[AND64ri32_:%[0-9]+]]:gr64 = AND64ri32 [[INSERT_SUBREG]], 1, implicit-def $eflags
44 ; ALL: $rax = COPY [[AND64ri32_]]
45 ; ALL: RET 0, implicit $rax
47 %1(s1) = G_TRUNC %0(s8)
48 %2(s64) = G_ZEXT %1(s1)
59 - { id: 0, class: gpr }
60 - { id: 1, class: gpr }
65 ; ALL-LABEL: name: test_sext_i8
66 ; ALL: [[COPY:%[0-9]+]]:gr8 = COPY $dil
67 ; ALL: [[MOVSX64rr8_:%[0-9]+]]:gr64 = MOVSX64rr8 [[COPY]]
68 ; ALL: $rax = COPY [[MOVSX64rr8_]]
69 ; ALL: RET 0, implicit $rax
71 %1(s64) = G_SEXT %0(s8)
82 - { id: 0, class: gpr }
83 - { id: 1, class: gpr }
88 ; ALL-LABEL: name: test_sext_i16
89 ; ALL: [[COPY:%[0-9]+]]:gr16 = COPY $di
90 ; ALL: [[MOVSX64rr16_:%[0-9]+]]:gr64 = MOVSX64rr16 [[COPY]]
91 ; ALL: $rax = COPY [[MOVSX64rr16_]]
92 ; ALL: RET 0, implicit $rax
94 %1(s64) = G_SEXT %0(s16)
100 name: anyext_s64_from_s1
103 regBankSelected: true
105 - { id: 0, class: gpr }
106 - { id: 1, class: gpr }
107 - { id: 2, class: gpr }
112 ; ALL-LABEL: name: anyext_s64_from_s1
113 ; ALL: [[COPY:%[0-9]+]]:gr64_with_sub_8bit = COPY $rdi
114 ; ALL: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
115 ; ALL: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[COPY1]], %subreg.sub_8bit
116 ; ALL: $rax = COPY [[SUBREG_TO_REG]]
117 ; ALL: RET 0, implicit $rax
119 %1(s1) = G_TRUNC %0(s64)
120 %2(s64) = G_ANYEXT %1(s1)
125 name: anyext_s64_from_s8
128 regBankSelected: true
130 - { id: 0, class: gpr }
131 - { id: 1, class: gpr }
132 - { id: 2, class: gpr }
137 ; ALL-LABEL: name: anyext_s64_from_s8
138 ; ALL: [[COPY:%[0-9]+]]:gr64_with_sub_8bit = COPY $rdi
139 ; ALL: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
140 ; ALL: [[MOVZX32rr8_:%[0-9]+]]:gr32 = MOVZX32rr8 [[COPY1]]
141 ; ALL: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[MOVZX32rr8_]], %subreg.sub_32bit
142 ; ALL: $rax = COPY [[SUBREG_TO_REG]]
143 ; ALL: RET 0, implicit $rax
145 %1(s8) = G_TRUNC %0(s64)
146 %2(s64) = G_ANYEXT %1(s8)
151 name: anyext_s64_from_s16
154 regBankSelected: true
156 - { id: 0, class: gpr }
157 - { id: 1, class: gpr }
158 - { id: 2, class: gpr }
163 ; ALL-LABEL: name: anyext_s64_from_s16
164 ; ALL: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
165 ; ALL: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
166 ; ALL: [[MOVZX32rr16_:%[0-9]+]]:gr32 = MOVZX32rr16 [[COPY1]]
167 ; ALL: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[MOVZX32rr16_]], %subreg.sub_32bit
168 ; ALL: $rax = COPY [[SUBREG_TO_REG]]
169 ; ALL: RET 0, implicit $rax
171 %1(s16) = G_TRUNC %0(s64)
172 %2(s64) = G_ANYEXT %1(s16)
177 name: anyext_s64_from_s32
180 regBankSelected: true
182 - { id: 0, class: gpr }
183 - { id: 1, class: gpr }
184 - { id: 2, class: gpr }
189 ; ALL-LABEL: name: anyext_s64_from_s32
190 ; ALL: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
191 ; ALL: [[COPY1:%[0-9]+]]:gr32 = COPY [[COPY]].sub_32bit
192 ; ALL: [[DEF:%[0-9]+]]:gr64 = IMPLICIT_DEF
193 ; ALL: [[INSERT_SUBREG:%[0-9]+]]:gr64 = INSERT_SUBREG [[DEF]], [[COPY1]], %subreg.sub_32bit
194 ; ALL: $rax = COPY [[INSERT_SUBREG]]
195 ; ALL: RET 0, implicit $rax
197 %1(s32) = G_TRUNC %0(s64)
198 %2(s64) = G_ANYEXT %1(s32)