616 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -o - -mtriple=aarch64-unknown-unknown -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s | FileCheck %s3 4# Simple unmerge(merge) case with two operands.5# The sources of the merge can be used in place of6# the destinations of the unmerge.7---8name: test_combine_unmerge_merge9body: |10 bb.1:11 ; CHECK-LABEL: name: test_combine_unmerge_merge12 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF13 ; CHECK-NEXT: $w0 = COPY [[DEF]](s32)14 ; CHECK-NEXT: $w1 = COPY [[DEF]](s32)15 %0:_(s32) = G_IMPLICIT_DEF16 %1:_(s32) = G_IMPLICIT_DEF17 %2:_(s64) = G_MERGE_VALUES %0(s32), %1(s32)18 %3:_(s32), %4:_(s32) = G_UNMERGE_VALUES %2(s64)19 $w0 = COPY %3(s32)20 $w1 = COPY %4(s32)21...22 23# Simple unmerge(merge) case with three operands.24# The sources of the merge can be used in place of25# the destinations of the unmerge.26---27name: test_combine_unmerge_merge_3ops28body: |29 bb.1:30 ; CHECK-LABEL: name: test_combine_unmerge_merge_3ops31 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF32 ; CHECK-NEXT: [[DEF1:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF33 ; CHECK-NEXT: [[DEF2:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF34 ; CHECK-NEXT: $w0 = COPY [[DEF]](s32)35 ; CHECK-NEXT: $w1 = COPY [[DEF1]](s32)36 ; CHECK-NEXT: $w2 = COPY [[DEF2]](s32)37 %0:_(s32) = G_IMPLICIT_DEF38 %1:_(s32) = G_IMPLICIT_DEF39 %5:_(s32) = G_IMPLICIT_DEF40 %2:_(s96) = G_MERGE_VALUES %0(s32), %1(s32), %5(s32)41 %3:_(s32), %4:_(s32), %6:_(s32) = G_UNMERGE_VALUES %2(s96)42 $w0 = COPY %3(s32)43 $w1 = COPY %4(s32)44 $w2 = COPY %6(s32)45...46 47# Simple unmerge(buildvector) case with two operands.48# The sources of the buildvector can be used in place of49# the destinations of the unmerge.50---51name: test_combine_unmerge_build_vector52body: |53 bb.1:54 ; CHECK-LABEL: name: test_combine_unmerge_build_vector55 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF56 ; CHECK-NEXT: $w0 = COPY [[DEF]](s32)57 ; CHECK-NEXT: $w1 = COPY [[DEF]](s32)58 %0:_(s32) = G_IMPLICIT_DEF59 %1:_(s32) = G_IMPLICIT_DEF60 %2:_(<2 x s32>) = G_BUILD_VECTOR %0(s32), %1(s32)61 %3:_(s32), %4:_(s32) = G_UNMERGE_VALUES %2(<2 x s32>)62 $w0 = COPY %3(s32)63 $w1 = COPY %4(s32)64...65 66# Simple unmerge(buildvector) case with three operands.67# The sources of the buildvector can be used in place of68# the destinations of the unmerge.69---70name: test_combine_unmerge_buildvector_3ops71body: |72 bb.1:73 ; CHECK-LABEL: name: test_combine_unmerge_buildvector_3ops74 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF75 ; CHECK-NEXT: $w0 = COPY [[DEF]](s32)76 ; CHECK-NEXT: $w1 = COPY [[DEF]](s32)77 ; CHECK-NEXT: $w2 = COPY [[DEF]](s32)78 %0:_(s32) = G_IMPLICIT_DEF79 %1:_(s32) = G_IMPLICIT_DEF80 %5:_(s32) = G_IMPLICIT_DEF81 %2:_(<3 x s32>) = G_BUILD_VECTOR %0(s32), %1(s32), %5(s32)82 %3:_(s32), %4:_(s32), %6:_(s32) = G_UNMERGE_VALUES %2(<3 x s32>)83 $w0 = COPY %3(s32)84 $w1 = COPY %4(s32)85 $w2 = COPY %6(s32)86...87 88# Simple unmerge(concatvectors) case.89# The sources of the concatvectors can be used in place of90# the destinations of the unmerge.91---92name: test_combine_unmerge_concat_vectors93body: |94 bb.1:95 ; CHECK-LABEL: name: test_combine_unmerge_concat_vectors96 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $w097 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s16>) = COPY $w198 ; CHECK-NEXT: $w0 = COPY [[COPY]](<2 x s16>)99 ; CHECK-NEXT: $w1 = COPY [[COPY1]](<2 x s16>)100 %0:_(<2 x s16>) = COPY $w0101 %1:_(<2 x s16>) = COPY $w1102 %2:_(<4 x s16>) = G_CONCAT_VECTORS %0(<2 x s16>), %1(<2 x s16>)103 %3:_(<2 x s16>), %4:_(<2 x s16>) = G_UNMERGE_VALUES %2(<4 x s16>)104 $w0 = COPY %3(<2 x s16>)105 $w1 = COPY %4(<2 x s16>)106...107 108# Unmerge(merge) case with two operands and a bitcast in the middle.109# The sources of the merge can be used in place of110# the destinations of the unmerge.111---112name: test_combine_unmerge_bitcast_merge113body: |114 bb.1:115 ; CHECK-LABEL: name: test_combine_unmerge_bitcast_merge116 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF117 ; CHECK-NEXT: $w0 = COPY [[DEF]](s32)118 ; CHECK-NEXT: $w1 = COPY [[DEF]](s32)119 %0:_(s32) = G_IMPLICIT_DEF120 %1:_(s32) = G_IMPLICIT_DEF121 %2:_(s64) = G_MERGE_VALUES %0(s32), %1(s32)122 %5:_(<2 x s32>) = G_BITCAST %2(s64)123 %3:_(s32), %4:_(s32) = G_UNMERGE_VALUES %5(<2 x s32>)124 $w0 = COPY %3(s32)125 $w1 = COPY %4(s32)126...127 128# Unmerge(merge) with incompatible types: unmerge destTy != merge inputTy.129# The sources of the merge cannot be used in place of130# the destinations of the unmerge, since the types don't match.131---132name: test_combine_unmerge_merge_incompatible_types133body: |134 bb.1:135 ; CHECK-LABEL: name: test_combine_unmerge_merge_incompatible_types136 ; CHECK: [[DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF137 ; CHECK-NEXT: $h0 = COPY [[DEF]](s16)138 ; CHECK-NEXT: $h1 = COPY [[DEF]](s16)139 ; CHECK-NEXT: $h2 = COPY [[DEF]](s16)140 ; CHECK-NEXT: $h3 = COPY [[DEF]](s16)141 %0:_(s32) = G_IMPLICIT_DEF142 %1:_(s32) = G_IMPLICIT_DEF143 %2:_(s64) = G_MERGE_VALUES %0(s32), %1(s32)144 %3:_(s16), %4:_(s16), %5:_(s16), %6:_(s16) = G_UNMERGE_VALUES %2(s64)145 $h0 = COPY %3(s16)146 $h1 = COPY %4(s16)147 $h2 = COPY %5(s16)148 $h3 = COPY %6(s16)149...150 151# Unmerge(concatvectors) with incompatible types: unmerge destTy != merge inputTy152# but destTy.size() == inputTy.size().153# The sources of the concatvectors can be used in place of154# the destinations of the unmerge with a bitcast since the sizes155# match.156---157name: test_combine_unmerge_merge_incompatible_types_but_same_size158body: |159 bb.1:160 ; CHECK-LABEL: name: test_combine_unmerge_merge_incompatible_types_but_same_size161 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $w0162 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s16>) = COPY $w1163 ; CHECK-NEXT: [[BITCAST:%[0-9]+]]:_(s32) = G_BITCAST [[COPY]](<2 x s16>)164 ; CHECK-NEXT: [[BITCAST1:%[0-9]+]]:_(s32) = G_BITCAST [[COPY1]](<2 x s16>)165 ; CHECK-NEXT: $w0 = COPY [[BITCAST]](s32)166 ; CHECK-NEXT: $w1 = COPY [[BITCAST1]](s32)167 %0:_(<2 x s16>) = COPY $w0168 %1:_(<2 x s16>) = COPY $w1169 %2:_(<4 x s16>) = G_CONCAT_VECTORS %0(<2 x s16>), %1(<2 x s16>)170 %5:_(s64) = G_BITCAST %2(<4 x s16>)171 %3:_(s32), %4:_(s32) = G_UNMERGE_VALUES %5(s64)172 $w0 = COPY %3(s32)173 $w1 = COPY %4(s32)174...175 176# Unmerge a constant into a bunch of smaller constant.177# Constant is 0x0102030405060708090a0b0c0d0e0f10 and we break it down into178# bytes:179# cst1 0x10180# cst2 0x0f181# cst3 0x0e182# ...183---184name: test_combine_unmerge_cst185body: |186 bb.1:187 ; CHECK-LABEL: name: test_combine_unmerge_cst188 ; CHECK: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 16189 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s8) = G_CONSTANT i8 15190 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s8) = G_CONSTANT i8 14191 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s8) = G_CONSTANT i8 13192 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s8) = G_CONSTANT i8 12193 ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s8) = G_CONSTANT i8 11194 ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s8) = G_CONSTANT i8 10195 ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s8) = G_CONSTANT i8 9196 ; CHECK-NEXT: [[C8:%[0-9]+]]:_(s8) = G_CONSTANT i8 8197 ; CHECK-NEXT: [[C9:%[0-9]+]]:_(s8) = G_CONSTANT i8 7198 ; CHECK-NEXT: [[C10:%[0-9]+]]:_(s8) = G_CONSTANT i8 6199 ; CHECK-NEXT: [[C11:%[0-9]+]]:_(s8) = G_CONSTANT i8 5200 ; CHECK-NEXT: [[C12:%[0-9]+]]:_(s8) = G_CONSTANT i8 4201 ; CHECK-NEXT: [[C13:%[0-9]+]]:_(s8) = G_CONSTANT i8 3202 ; CHECK-NEXT: [[C14:%[0-9]+]]:_(s8) = G_CONSTANT i8 2203 ; CHECK-NEXT: [[C15:%[0-9]+]]:_(s8) = G_CONSTANT i8 1204 ; CHECK-NEXT: $b0 = COPY [[C]](s8)205 ; CHECK-NEXT: $b1 = COPY [[C1]](s8)206 ; CHECK-NEXT: $b2 = COPY [[C2]](s8)207 ; CHECK-NEXT: $b3 = COPY [[C3]](s8)208 ; CHECK-NEXT: $b4 = COPY [[C4]](s8)209 ; CHECK-NEXT: $b5 = COPY [[C5]](s8)210 ; CHECK-NEXT: $b6 = COPY [[C6]](s8)211 ; CHECK-NEXT: $b7 = COPY [[C7]](s8)212 ; CHECK-NEXT: $b8 = COPY [[C8]](s8)213 ; CHECK-NEXT: $b9 = COPY [[C9]](s8)214 ; CHECK-NEXT: $b10 = COPY [[C10]](s8)215 ; CHECK-NEXT: $b11 = COPY [[C11]](s8)216 ; CHECK-NEXT: $b12 = COPY [[C12]](s8)217 ; CHECK-NEXT: $b13 = COPY [[C13]](s8)218 ; CHECK-NEXT: $b14 = COPY [[C14]](s8)219 ; CHECK-NEXT: $b15 = COPY [[C15]](s8)220 %0:_(s128) = G_CONSTANT i128 1339673755198158349044581307228491536221 %1:_(s8),%2:_(s8),%3:_(s8),%4:_(s8),%5:_(s8),%6:_(s8),%7:_(s8),%8:_(s8),%9:_(s8),%10:_(s8),%11:_(s8),%12:_(s8),%13:_(s8),%14:_(s8),%15:_(s8),%16:_(s8) = G_UNMERGE_VALUES %0(s128)222 $b0 = COPY %1(s8)223 $b1 = COPY %2(s8)224 $b2 = COPY %3(s8)225 $b3 = COPY %4(s8)226 $b4 = COPY %5(s8)227 $b5 = COPY %6(s8)228 $b6 = COPY %7(s8)229 $b7 = COPY %8(s8)230 $b8 = COPY %9(s8)231 $b9 = COPY %10(s8)232 $b10 = COPY %11(s8)233 $b11 = COPY %12(s8)234 $b12 = COPY %13(s8)235 $b13 = COPY %14(s8)236 $b14 = COPY %15(s8)237 $b15 = COPY %16(s8)238...239 240# Unmerge a constant on a non-power of 2 type into a bunch of smaller constant.241# Constant is a 3 | 2 | 1 in chunks of 13-bit.242---243name: test_combine_unmerge_cst_36bit244body: |245 bb.1:246 ; CHECK-LABEL: name: test_combine_unmerge_cst_36bit247 ; CHECK: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 1248 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s16) = G_CONSTANT i16 2249 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s16) = G_CONSTANT i16 3250 ; CHECK-NEXT: $h0 = COPY [[C]](s16)251 ; CHECK-NEXT: $h1 = COPY [[C1]](s16)252 ; CHECK-NEXT: $h2 = COPY [[C2]](s16)253 %0:_(s39) = G_CONSTANT i39 201342977254 %1:_(s13),%2:_(s13),%3:_(s13) = G_UNMERGE_VALUES %0(s39)255 %4:_(s16) = G_ZEXT %1(s13)256 %5:_(s16) = G_ZEXT %2(s13)257 %6:_(s16) = G_ZEXT %3(s13)258 $h0 = COPY %4(s16)259 $h1 = COPY %5(s16)260 $h2 = COPY %6(s16)261...262 263# Unmerge floating point constant.264---265name: test_combine_unmerge_fpcst266body: |267 bb.1:268 ; CHECK-LABEL: name: test_combine_unmerge_fpcst269 ; CHECK: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 1270 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s16) = G_CONSTANT i16 2271 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s16) = G_CONSTANT i16 3272 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s16) = G_CONSTANT i16 4273 ; CHECK-NEXT: $h0 = COPY [[C]](s16)274 ; CHECK-NEXT: $h1 = COPY [[C1]](s16)275 ; CHECK-NEXT: $h2 = COPY [[C2]](s16)276 ; CHECK-NEXT: $h3 = COPY [[C3]](s16)277 %0:_(s64) = G_FCONSTANT double 0x0004000300020001278 %1:_(s16),%2:_(s16),%3:_(s16),%4:_(s16) = G_UNMERGE_VALUES %0(s64)279 $h0 = COPY %1(s16)280 $h1 = COPY %2(s16)281 $h2 = COPY %3(s16)282 $h3 = COPY %4(s16)283...284 285# Transform unmerge into trunc when only the first definition is live.286---287name: test_combine_unmerge_dead_to_trunc288body: |289 bb.1:290 ; CHECK-LABEL: name: test_combine_unmerge_dead_to_trunc291 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0292 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s64)293 ; CHECK-NEXT: $h0 = COPY [[TRUNC]](s16)294 %0:_(s64) = COPY $x0295 %1:_(s16),%2:_(s16),%3:_(s16),%4:_(s16) = G_UNMERGE_VALUES %0(s64)296 $h0 = COPY %1(s16)297...298 299# Don't transform unmerge into trunc when middle lanes are live.300---301name: test_dont_combine_unmerge_dead_to_trunc302body: |303 bb.1:304 ; CHECK-LABEL: name: test_dont_combine_unmerge_dead_to_trunc305 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0306 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s16), [[UV1:%[0-9]+]]:_(s16), [[UV2:%[0-9]+]]:_(s16), [[UV3:%[0-9]+]]:_(s16) = G_UNMERGE_VALUES [[COPY]](s64)307 ; CHECK-NEXT: $h0 = COPY [[UV2]](s16)308 %0:_(s64) = COPY $x0309 %1:_(s16),%2:_(s16),%3:_(s16),%4:_(s16) = G_UNMERGE_VALUES %0(s64)310 $h0 = COPY %3(s16)311...312 313# Transform unmerge into trunc when only the first definition is live, even314# if the input and output types are vectors.315---316name: test_combine_unmerge_dead_to_trunc_vec_in_n_out317body: |318 bb.1:319 ; CHECK-LABEL: name: test_combine_unmerge_dead_to_trunc_vec_in_n_out320 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $x0321 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(<2 x s16>), [[UV1:%[0-9]+]]:_(<2 x s16>) = G_UNMERGE_VALUES [[COPY]](<4 x s16>)322 ; CHECK-NEXT: $w0 = COPY [[UV]](<2 x s16>)323 %0:_(<4 x s16>) = COPY $x0324 %1:_(<2 x s16>),%2:_(<2 x s16>) = G_UNMERGE_VALUES %0(<4 x s16>)325 $w0 = COPY %1(<2 x s16>)326...327 328# Transform unmerge into trunc when only the first definition is live, even329# if the input type is vector.330---331name: test_combine_unmerge_dead_to_trunc_vec_in332body: |333 bb.1:334 ; CHECK-LABEL: name: test_combine_unmerge_dead_to_trunc_vec_in335 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $x0336 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s16), [[UV1:%[0-9]+]]:_(s16), [[UV2:%[0-9]+]]:_(s16), [[UV3:%[0-9]+]]:_(s16) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)337 ; CHECK-NEXT: $h0 = COPY [[UV]](s16)338 %0:_(<2 x s32>) = COPY $x0339 %1:_(s16),%2:_(s16),%3:_(s16),%4:_(s16) = G_UNMERGE_VALUES %0(<2 x s32>)340 $h0 = COPY %1(s16)341...342 343# Transform unmerge(zext) into zext.344# In that test, the source of the zext is same size as the first definition345# of the unmerge. Therefore a we can just reuse the input of the zext for346# this definition.347---348name: test_combine_unmerge_zext_to_zext_same_size349body: |350 bb.1:351 ; CHECK-LABEL: name: test_combine_unmerge_zext_to_zext_same_size352 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0353 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0354 ; CHECK-NEXT: $w0 = COPY [[COPY]](s32)355 ; CHECK-NEXT: $w1 = COPY [[C]](s32)356 %0:_(s32) = COPY $w0357 %3:_(s64) = G_ZEXT %0(s32)358 %1:_(s32),%2:_(s32) = G_UNMERGE_VALUES %3(s64)359 $w0 = COPY %1(s32)360 $w1 = COPY %2(s32)361...362 363# Transform unmerge(zext) into zext.364# In that test, the source of the zext is smaller than the first definition365# of the unmerge. Therefore a G_ZEXT is required.366---367name: test_combine_unmerge_zext_to_zext368body: |369 bb.1:370 ; CHECK-LABEL: name: test_combine_unmerge_zext_to_zext371 ; CHECK: [[COPY:%[0-9]+]]:_(s8) = COPY $b0372 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s16) = G_ZEXT [[COPY]](s8)373 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 0374 ; CHECK-NEXT: $h0 = COPY [[ZEXT]](s16)375 ; CHECK-NEXT: $h1 = COPY [[C]](s16)376 ; CHECK-NEXT: $h2 = COPY [[C]](s16)377 ; CHECK-NEXT: $h3 = COPY [[C]](s16)378 %0:_(s8) = COPY $b0379 %3:_(s64) = G_ZEXT %0(s8)380 %1:_(s16),%2:_(s16),%4:_(s16),%5:_(s16) = G_UNMERGE_VALUES %3(s64)381 $h0 = COPY %1(s16)382 $h1 = COPY %2(s16)383 $h2 = COPY %4(s16)384 $h3 = COPY %5(s16)385...386 387# Check that we don't apply the unmerge(zext) to zext transformation388# when the first destination of the unmerge is smaller than the source389# of the zext.390---391name: test_dont_combine_unmerge_zext_to_zext_src_bigger392body: |393 bb.1:394 ; CHECK-LABEL: name: test_dont_combine_unmerge_zext_to_zext_src_bigger395 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0396 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s32)397 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s16), [[UV1:%[0-9]+]]:_(s16), [[UV2:%[0-9]+]]:_(s16), [[UV3:%[0-9]+]]:_(s16) = G_UNMERGE_VALUES [[ZEXT]](s64)398 ; CHECK-NEXT: $h0 = COPY [[UV]](s16)399 ; CHECK-NEXT: $h1 = COPY [[UV1]](s16)400 ; CHECK-NEXT: $h2 = COPY [[UV2]](s16)401 ; CHECK-NEXT: $h3 = COPY [[UV3]](s16)402 %0:_(s32) = COPY $w0403 %3:_(s64) = G_ZEXT %0(s32)404 %1:_(s16),%2:_(s16),%4:_(s16),%5:_(s16) = G_UNMERGE_VALUES %3(s64)405 $h0 = COPY %1(s16)406 $h1 = COPY %2(s16)407 $h2 = COPY %4(s16)408 $h3 = COPY %5(s16)409...410 411# Check that we don't apply the unmerge(zext) to zext transformation412# when the input zext deals with a vector type.413---414name: test_dont_combine_unmerge_zext_to_zext_src_vector415body: |416 bb.1:417 ; CHECK-LABEL: name: test_dont_combine_unmerge_zext_to_zext_src_vector418 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $w0419 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(<2 x s32>) = G_ZEXT [[COPY]](<2 x s16>)420 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[ZEXT]](<2 x s32>)421 ; CHECK-NEXT: $w0 = COPY [[UV]](s32)422 ; CHECK-NEXT: $w1 = COPY [[UV1]](s32)423 %0:_(<2 x s16>) = COPY $w0424 %3:_(<2 x s32>) = G_ZEXT %0(<2 x s16>)425 %1:_(s32),%2:_(s32) = G_UNMERGE_VALUES %3(<2 x s32>)426 $w0 = COPY %1(s32)427 $w1 = COPY %2(s32)428...429 430# Check that we unmerge the build vector on the anyext431---432name: test_anyext_buildvector433body: |434 bb.1:435 ; CHECK-LABEL: name: test_anyext_buildvector436 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0437 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w0438 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $w0439 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $w0440 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)441 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY1]](s32)442 ; CHECK-NEXT: %un1:_(<2 x s64>) = G_BUILD_VECTOR [[ANYEXT]](s64), [[ANYEXT1]](s64)443 ; CHECK-NEXT: [[ANYEXT2:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY2]](s32)444 ; CHECK-NEXT: [[ANYEXT3:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY3]](s32)445 ; CHECK-NEXT: %un2:_(<2 x s64>) = G_BUILD_VECTOR [[ANYEXT2]](s64), [[ANYEXT3]](s64)446 ; CHECK-NEXT: $q0 = COPY %un1(<2 x s64>)447 ; CHECK-NEXT: $q1 = COPY %un2(<2 x s64>)448 %0:_(s32) = COPY $w0449 %1:_(s32) = COPY $w0450 %2:_(s32) = COPY $w0451 %3:_(s32) = COPY $w0452 %bv:_(<4 x s32>) = G_BUILD_VECTOR %0(s32), %1(s32), %2(s32), %3(s32)453 %any:_(<4 x s64>) = G_ANYEXT %bv(<4 x s32>)454 %un1:_(<2 x s64>), %un2:_(<2 x s64>) = G_UNMERGE_VALUES %any(<4 x s64>)455 $q0 = COPY %un1(<2 x s64>)456 $q1 = COPY %un2(<2 x s64>)457...458 459# Check that we unmerge the build vector on the anyext and undef460---461name: test_anyext_buildvector_undef462body: |463 bb.1:464 ; CHECK-LABEL: name: test_anyext_buildvector_undef465 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0466 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w0467 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)468 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY1]](s32)469 ; CHECK-NEXT: %un1:_(<2 x s64>) = G_BUILD_VECTOR [[ANYEXT]](s64), [[ANYEXT1]](s64)470 ; CHECK-NEXT: %un2:_(<2 x s64>) = G_IMPLICIT_DEF471 ; CHECK-NEXT: $q0 = COPY %un1(<2 x s64>)472 ; CHECK-NEXT: $q1 = COPY %un2(<2 x s64>)473 %0:_(s32) = COPY $w0474 %1:_(s32) = COPY $w0475 %2:_(s32) = G_IMPLICIT_DEF476 %3:_(s32) = G_IMPLICIT_DEF477 %bv:_(<4 x s32>) = G_BUILD_VECTOR %0(s32), %1(s32), %2(s32), %3(s32)478 %any:_(<4 x s64>) = G_ANYEXT %bv(<4 x s32>)479 %un1:_(<2 x s64>), %un2:_(<2 x s64>) = G_UNMERGE_VALUES %any(<4 x s64>)480 $q0 = COPY %un1(<2 x s64>)481 $q1 = COPY %un2(<2 x s64>)482...483 484# Check that we don't unmerge the build vector on the anyext, multi-use485---486name: test_anyext_buildvector_multi487body: |488 bb.1:489 ; CHECK-LABEL: name: test_anyext_buildvector_multi490 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0491 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w0492 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF493 ; CHECK-NEXT: [[DEF1:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF494 ; CHECK-NEXT: %bv:_(<4 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY1]](s32), [[DEF]](s32), [[DEF1]](s32)495 ; CHECK-NEXT: %any:_(<4 x s64>) = G_ANYEXT %bv(<4 x s32>)496 ; CHECK-NEXT: %un1:_(<2 x s64>), %un2:_(<2 x s64>) = G_UNMERGE_VALUES %any(<4 x s64>)497 ; CHECK-NEXT: $q0 = COPY %un1(<2 x s64>)498 ; CHECK-NEXT: $q1 = COPY %un2(<2 x s64>)499 ; CHECK-NEXT: $q2 = COPY %bv(<4 x s32>)500 %0:_(s32) = COPY $w0501 %1:_(s32) = COPY $w0502 %2:_(s32) = G_IMPLICIT_DEF503 %3:_(s32) = G_IMPLICIT_DEF504 %bv:_(<4 x s32>) = G_BUILD_VECTOR %0(s32), %1(s32), %2(s32), %3(s32)505 %any:_(<4 x s64>) = G_ANYEXT %bv(<4 x s32>)506 %un1:_(<2 x s64>), %un2:_(<2 x s64>) = G_UNMERGE_VALUES %any(<4 x s64>)507 $q0 = COPY %un1(<2 x s64>)508 $q1 = COPY %un2(<2 x s64>)509 $q2 = COPY %bv(<4 x s32>)510...511 512# Check that we don't unmerge the build vector on the anyext into scalar513---514name: test_anyext_buildvector_scalar515body: |516 bb.1:517 ; CHECK-LABEL: name: test_anyext_buildvector_scalar518 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0519 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w0520 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $w0521 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $w0522 ; CHECK-NEXT: %bv:_(<4 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY1]](s32), [[COPY2]](s32), [[COPY3]](s32)523 ; CHECK-NEXT: %any:_(<4 x s64>) = G_ANYEXT %bv(<4 x s32>)524 ; CHECK-NEXT: %un1:_(s128), %un2:_(s128) = G_UNMERGE_VALUES %any(<4 x s64>)525 ; CHECK-NEXT: $q0 = COPY %un1(s128)526 ; CHECK-NEXT: $q1 = COPY %un2(s128)527 %0:_(s32) = COPY $w0528 %1:_(s32) = COPY $w0529 %2:_(s32) = COPY $w0530 %3:_(s32) = COPY $w0531 %bv:_(<4 x s32>) = G_BUILD_VECTOR %0(s32), %1(s32), %2(s32), %3(s32)532 %any:_(<4 x s64>) = G_ANYEXT %bv(<4 x s32>)533 %un1:_(s128), %un2:_(s128) = G_UNMERGE_VALUES %any(<4 x s64>)534 $q0 = COPY %un1(s128)535 $q1 = COPY %un2(s128)536...537 538# Check that we anyext the merge539---540name: test_merge_undef541body: |542 bb.1:543 ; CHECK-LABEL: name: test_merge_undef544 ; CHECK: %opaque:_(s64) = COPY $x0545 ; CHECK-NEXT: %me:_(s128) = G_ANYEXT %opaque(s64)546 ; CHECK-NEXT: $q0 = COPY %me(s128)547 %opaque:_(s64) = COPY $x0548 %def:_(s64) = G_IMPLICIT_DEF549 %me:_(s128) = G_MERGE_VALUES %opaque(s64), %def550 $q0 = COPY %me(s128)551...552 553# Check that we don't anyext the merge, multi-use554---555name: test_merge_undef_multi_use556body: |557 bb.1:558 ; CHECK-LABEL: name: test_merge_undef_multi_use559 ; CHECK: %opaque:_(s64) = COPY $x0560 ; CHECK-NEXT: %def:_(s64) = G_IMPLICIT_DEF561 ; CHECK-NEXT: %me:_(s128) = G_ANYEXT %opaque(s64)562 ; CHECK-NEXT: $q0 = COPY %me(s128)563 ; CHECK-NEXT: $x0 = COPY %def(s64)564 %opaque:_(s64) = COPY $x0565 %def:_(s64) = G_IMPLICIT_DEF566 %me:_(s128) = G_MERGE_VALUES %opaque(s64), %def567 $q0 = COPY %me(s128)568 $x0 = COPY %def(s64)569...570# Check that we zext the merge571---572name: test_merge_zero573body: |574 bb.1:575 ; CHECK-LABEL: name: test_merge_zero576 ; CHECK: %opaque:_(s64) = COPY $x0577 ; CHECK-NEXT: %me:_(s128) = G_ZEXT %opaque(s64)578 ; CHECK-NEXT: $q0 = COPY %me(s128)579 %opaque:_(s64) = COPY $x0580 %def:_(s64) = G_CONSTANT i64 0581 %me:_(s128) = G_MERGE_VALUES %opaque(s64), %def582 $q0 = COPY %me(s128)583...584# Check that we still zext the merge, multi-use585---586name: test_merge_zero_multi_use587body: |588 bb.1:589 ; CHECK-LABEL: name: test_merge_zero_multi_use590 ; CHECK: %opaque:_(s64) = COPY $x0591 ; CHECK-NEXT: %def:_(s64) = G_CONSTANT i64 0592 ; CHECK-NEXT: %me:_(s128) = G_ZEXT %opaque(s64)593 ; CHECK-NEXT: $q0 = COPY %me(s128)594 ; CHECK-NEXT: $x0 = COPY %def(s64)595 %opaque:_(s64) = COPY $x0596 %def:_(s64) = G_CONSTANT i64 0597 %me:_(s128) = G_MERGE_VALUES %opaque(s64), %def598 $q0 = COPY %me(s128)599 $x0 = COPY %def(s64)600...601# Check that we don't zext the merge with one602---603name: test_merge_one604body: |605 bb.1:606 ; CHECK-LABEL: name: test_merge_one607 ; CHECK: %opaque:_(s64) = COPY $x0608 ; CHECK-NEXT: %def:_(s64) = G_CONSTANT i64 1609 ; CHECK-NEXT: %me:_(s128) = G_MERGE_VALUES %opaque(s64), %def(s64)610 ; CHECK-NEXT: $q0 = COPY %me(s128)611 %opaque:_(s64) = COPY $x0612 %def:_(s64) = G_CONSTANT i64 1613 %me:_(s128) = G_MERGE_VALUES %opaque(s64), %def614 $q0 = COPY %me(s128)615...616