1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple aarch64-- -run-pass=legalizer %s -o - | FileCheck %s
9 ; CHECK-LABEL: name: test_unmerge
10 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
11 ; CHECK: $w0 = COPY [[COPY]](s32)
13 %1:_(<4 x s32>) = G_BUILD_VECTOR %0(s32), %0(s32), %0(s32), %0(s32)
14 %2:_(s32), %3:_(s32), %4:_(s32), %5:_(s32) = G_UNMERGE_VALUES %1(<4 x s32>)
19 name: test_legal_const_ext
23 ; CHECK-LABEL: name: test_legal_const_ext
24 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
25 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
26 ; CHECK: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[C]]
27 ; CHECK: $w0 = COPY [[ADD]](s32)
29 %1:_(s1) = G_TRUNC %0(s32)
30 %2:_(s1) = G_CONSTANT i1 2
31 %3:_(s1) = G_ADD %1(s1), %2(s1)
32 %4:_(s32) = G_ANYEXT %3(s1)
36 # Check that the artifact combiner can get rid of the big
37 # vector type (4 x s64) by combining the G_UNMERGE_VALUES
38 # with the G_CONCAT_VECTORS and turning that into bitcast.
40 name: concat_vectors_unmerge_to_bitcast
41 tracksRegLiveness: true
46 ; CHECK-LABEL: name: concat_vectors_unmerge_to_bitcast
47 ; CHECK: liveins: $q0, $q1
48 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $q0
49 ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s64>) = COPY $q1
50 ; CHECK: [[BITCAST:%[0-9]+]]:_(s128) = G_BITCAST [[COPY]](<2 x s64>)
51 ; CHECK: [[BITCAST1:%[0-9]+]]:_(s128) = G_BITCAST [[COPY1]](<2 x s64>)
52 ; CHECK: $q0 = COPY [[BITCAST]](s128)
53 ; CHECK: $q1 = COPY [[BITCAST1]](s128)
54 %0:_(<2 x s64>) = COPY $q0
55 %1:_(<2 x s64>) = COPY $q1
56 %2:_(<4 x s64>) = G_CONCAT_VECTORS %0(<2 x s64>), %1(<2 x s64>)
57 %3:_(s128), %4:_(s128) = G_UNMERGE_VALUES %2(<4 x s64>)
62 # Check that the artifact combiner can get rid of the big
63 # vector type (4 x s64) by combining the G_UNMERGE_VALUES
64 # with the G_CONCAT_VECTORS and turning that into smaller
65 # 2x64-bit G_UNMERGE_VALUES.
67 name: concat_vectors_unmerge_to_unmerge
68 tracksRegLiveness: true
73 ; CHECK-LABEL: name: concat_vectors_unmerge_to_unmerge
74 ; CHECK: liveins: $q0, $q1
75 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $q0
76 ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s64>) = COPY $q1
77 ; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>)
78 ; CHECK: [[UV2:%[0-9]+]]:_(s64), [[UV3:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY1]](<2 x s64>)
79 ; CHECK: $x0 = COPY [[UV]](s64)
80 ; CHECK: $x1 = COPY [[UV1]](s64)
81 ; CHECK: $x2 = COPY [[UV2]](s64)
82 ; CHECK: $x3 = COPY [[UV3]](s64)
83 %0:_(<2 x s64>) = COPY $q0
84 %1:_(<2 x s64>) = COPY $q1
85 %2:_(<4 x s64>) = G_CONCAT_VECTORS %0(<2 x s64>), %1(<2 x s64>)
86 %3:_(s64), %4:_(s64), %5:_(s64), %6:_(s64) = G_UNMERGE_VALUES %2(<4 x s64>)
93 name: unmerge_merge_combine
94 tracksRegLiveness: true
98 ; CHECK-LABEL: name: unmerge_merge_combine
100 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
101 ; CHECK: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[COPY]](p0) :: (load (s64))
102 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
103 ; CHECK: [[LOAD1:%[0-9]+]]:_(s128) = G_LOAD [[COPY]](p0) :: (load (s128))
104 ; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[LOAD1]](s128)
105 ; CHECK: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[LOAD]], [[UV]]
106 ; CHECK: [[MUL1:%[0-9]+]]:_(s64) = G_MUL [[C]], [[UV]]
107 ; CHECK: [[MUL2:%[0-9]+]]:_(s64) = G_MUL [[LOAD]], [[UV1]]
108 ; CHECK: [[UMULH:%[0-9]+]]:_(s64) = G_UMULH [[LOAD]], [[UV]]
109 ; CHECK: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[MUL1]], [[MUL2]]
110 ; CHECK: [[ADD1:%[0-9]+]]:_(s64) = G_ADD [[ADD]], [[UMULH]]
111 ; CHECK: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[MUL]](s64), [[ADD1]](s64)
112 ; CHECK: $q0 = COPY [[MV]](s128)
113 ; CHECK: RET_ReallyLR
115 %1:_(s128) = G_ZEXTLOAD %0:_(p0) :: (load (s64))
116 %2:_(s128) = G_LOAD %0:_(p0) :: (load (s128))
117 %3:_(s128) = G_MUL %1:_, %2:_