llvm-project/llvm/test/CodeGen/AArch64/GlobalISel/combine-unmerge.mir

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

184 lines
6.8 KiB
Plaintext
Raw Normal View History

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -o - -mtriple=aarch64-unknown-unknown -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s | FileCheck %s
# Simple unmerge(merge) case with two operands.
# The sources of the merge can be used in place of
# the destinations of the unmerge.
---
name: test_combine_unmerge_merge
body: |
bb.1:
; CHECK-LABEL: name: test_combine_unmerge_merge
; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: [[DEF1:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: $w0 = COPY [[DEF]](s32)
; CHECK: $w1 = COPY [[DEF1]](s32)
%0:_(s32) = G_IMPLICIT_DEF
%1:_(s32) = G_IMPLICIT_DEF
%2:_(s64) = G_MERGE_VALUES %0(s32), %1(s32)
%3:_(s32), %4:_(s32) = G_UNMERGE_VALUES %2(s64)
$w0 = COPY %3(s32)
$w1 = COPY %4(s32)
...
# Simple unmerge(merge) case with three operands.
# The sources of the merge can be used in place of
# the destinations of the unmerge.
---
name: test_combine_unmerge_merge_3ops
body: |
bb.1:
; CHECK-LABEL: name: test_combine_unmerge_merge_3ops
; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: [[DEF1:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: [[DEF2:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: $w0 = COPY [[DEF]](s32)
; CHECK: $w1 = COPY [[DEF1]](s32)
; CHECK: $w2 = COPY [[DEF2]](s32)
%0:_(s32) = G_IMPLICIT_DEF
%1:_(s32) = G_IMPLICIT_DEF
%5:_(s32) = G_IMPLICIT_DEF
%2:_(s96) = G_MERGE_VALUES %0(s32), %1(s32), %5(s32)
%3:_(s32), %4:_(s32), %6:_(s32) = G_UNMERGE_VALUES %2(s96)
$w0 = COPY %3(s32)
$w1 = COPY %4(s32)
$w2 = COPY %6(s32)
...
# Simple unmerge(buildvector) case with two operands.
# The sources of the buildvector can be used in place of
# the destinations of the unmerge.
---
name: test_combine_unmerge_build_vector
body: |
bb.1:
; CHECK-LABEL: name: test_combine_unmerge_build_vector
; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: [[DEF1:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: $w0 = COPY [[DEF]](s32)
; CHECK: $w1 = COPY [[DEF1]](s32)
%0:_(s32) = G_IMPLICIT_DEF
%1:_(s32) = G_IMPLICIT_DEF
%2:_(<2 x s32>) = G_BUILD_VECTOR %0(s32), %1(s32)
%3:_(s32), %4:_(s32) = G_UNMERGE_VALUES %2(<2 x s32>)
$w0 = COPY %3(s32)
$w1 = COPY %4(s32)
...
# Simple unmerge(buildvector) case with three operands.
# The sources of the buildvector can be used in place of
# the destinations of the unmerge.
---
name: test_combine_unmerge_buildvector_3ops
body: |
bb.1:
; CHECK-LABEL: name: test_combine_unmerge_buildvector_3ops
; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: [[DEF1:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: [[DEF2:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: $w0 = COPY [[DEF]](s32)
; CHECK: $w1 = COPY [[DEF1]](s32)
; CHECK: $w2 = COPY [[DEF2]](s32)
%0:_(s32) = G_IMPLICIT_DEF
%1:_(s32) = G_IMPLICIT_DEF
%5:_(s32) = G_IMPLICIT_DEF
%2:_(<3 x s32>) = G_BUILD_VECTOR %0(s32), %1(s32), %5(s32)
%3:_(s32), %4:_(s32), %6:_(s32) = G_UNMERGE_VALUES %2(<3 x s32>)
$w0 = COPY %3(s32)
$w1 = COPY %4(s32)
$w2 = COPY %6(s32)
...
# Simple unmerge(concatvectors) case.
# The sources of the concatvectors can be used in place of
# the destinations of the unmerge.
---
name: test_combine_unmerge_concat_vectors
body: |
bb.1:
; CHECK-LABEL: name: test_combine_unmerge_concat_vectors
; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $w0
; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s16>) = COPY $w1
; CHECK: $w0 = COPY [[COPY]](<2 x s16>)
; CHECK: $w1 = COPY [[COPY1]](<2 x s16>)
%0:_(<2 x s16>) = COPY $w0
%1:_(<2 x s16>) = COPY $w1
%2:_(<4 x s16>) = G_CONCAT_VECTORS %0(<2 x s16>), %1(<2 x s16>)
%3:_(<2 x s16>), %4:_(<2 x s16>) = G_UNMERGE_VALUES %2(<4 x s16>)
$w0 = COPY %3(<2 x s16>)
$w1 = COPY %4(<2 x s16>)
...
# Unmerge(merge) case with two operands and a bitcast in the middle.
# The sources of the merge can be used in place of
# the destinations of the unmerge.
---
name: test_combine_unmerge_bitcast_merge
body: |
bb.1:
; CHECK-LABEL: name: test_combine_unmerge_bitcast_merge
; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: [[DEF1:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: $w0 = COPY [[DEF]](s32)
; CHECK: $w1 = COPY [[DEF1]](s32)
%0:_(s32) = G_IMPLICIT_DEF
%1:_(s32) = G_IMPLICIT_DEF
%2:_(s64) = G_MERGE_VALUES %0(s32), %1(s32)
%5:_(<2 x s32>) = G_BITCAST %2(s64)
%3:_(s32), %4:_(s32) = G_UNMERGE_VALUES %5(<2 x s32>)
$w0 = COPY %3(s32)
$w1 = COPY %4(s32)
...
# Unmerge(merge) with incompatible types: unmerge destTy != merge inputTy.
# The sources of the merge cannot be used in place of
# the destinations of the unmerge, since the types don't match.
---
name: test_combine_unmerge_merge_incompatible_types
body: |
bb.1:
; CHECK-LABEL: name: test_combine_unmerge_merge_incompatible_types
; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: [[DEF1:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[DEF]](s32), [[DEF1]](s32)
; CHECK: [[UV:%[0-9]+]]:_(s16), [[UV1:%[0-9]+]]:_(s16), [[UV2:%[0-9]+]]:_(s16), [[UV3:%[0-9]+]]:_(s16) = G_UNMERGE_VALUES [[MV]](s64)
; CHECK: $h0 = COPY [[UV]](s16)
; CHECK: $h1 = COPY [[UV1]](s16)
; CHECK: $h2 = COPY [[UV2]](s16)
; CHECK: $h3 = COPY [[UV3]](s16)
%0:_(s32) = G_IMPLICIT_DEF
%1:_(s32) = G_IMPLICIT_DEF
%2:_(s64) = G_MERGE_VALUES %0(s32), %1(s32)
%3:_(s16), %4:_(s16), %5:_(s16), %6:_(s16) = G_UNMERGE_VALUES %2(s64)
$h0 = COPY %3(s16)
$h1 = COPY %4(s16)
$h2 = COPY %5(s16)
$h3 = COPY %6(s16)
...
# Unmerge(concatvectors) with incompatible types: unmerge destTy != merge inputTy
# but destTy.size() == inputTy.size().
# The sources of the concatvectors can be used in place of
# the destinations of the unmerge with a bitcast since the sizes
# match.
---
name: test_combine_unmerge_merge_incompatible_types_but_same_size
body: |
bb.1:
; CHECK-LABEL: name: test_combine_unmerge_merge_incompatible_types_but_same_size
; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $w0
; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s16>) = COPY $w1
; CHECK: [[BITCAST:%[0-9]+]]:_(s32) = G_BITCAST [[COPY]](<2 x s16>)
; CHECK: [[BITCAST1:%[0-9]+]]:_(s32) = G_BITCAST [[COPY1]](<2 x s16>)
; CHECK: $w0 = COPY [[BITCAST]](s32)
; CHECK: $w1 = COPY [[BITCAST1]](s32)
%0:_(<2 x s16>) = COPY $w0
%1:_(<2 x s16>) = COPY $w1
%2:_(<4 x s16>) = G_CONCAT_VECTORS %0(<2 x s16>), %1(<2 x s16>)
%5:_(s64) = G_BITCAST %2(<4 x s16>)
%3:_(s32), %4:_(s32) = G_UNMERGE_VALUES %5(s64)
$w0 = COPY %3(s32)
$w1 = COPY %4(s32)
...