1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64 -O0 -run-pass=legalizer -global-isel-abort=1 %s -o - | FileCheck %s
4 name: combine_unmerge_from_unmerge_of_concat_tree
6 tracksRegLiveness: true
9 liveins: $x0, $x1, $x2, $d0, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $x0
10 ; CHECK-LABEL: name: combine_unmerge_from_unmerge_of_concat_tree
11 ; CHECK: liveins: $x0, $x1, $x2, $d0, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $x0
12 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
13 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
14 ; CHECK: [[COPY2:%[0-9]+]]:_(p0) = COPY $x2
15 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY $d0
16 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY $d1
17 ; CHECK: [[COPY5:%[0-9]+]]:_(s64) = COPY $d2
18 ; CHECK: [[COPY6:%[0-9]+]]:_(s64) = COPY $d3
19 ; CHECK: [[COPY7:%[0-9]+]]:_(s64) = COPY $d4
20 ; CHECK: [[COPY8:%[0-9]+]]:_(s64) = COPY $d5
21 ; CHECK: %v2s64_val:_(<2 x s64>) = G_BUILD_VECTOR [[COPY5]](s64), [[COPY6]](s64)
22 ; CHECK: %v2s64_val2:_(<2 x s64>) = G_BUILD_VECTOR [[COPY6]](s64), [[COPY8]](s64)
23 ; CHECK: [[DEF:%[0-9]+]]:_(<2 x s64>) = G_IMPLICIT_DEF
24 ; CHECK: G_STORE %v2s64_val(<2 x s64>), [[COPY2]](p0) :: (store (<2 x s64>))
25 ; CHECK: G_STORE %v2s64_val2(<2 x s64>), [[COPY2]](p0) :: (store (<2 x s64>))
26 ; CHECK: G_STORE %v2s64_val2(<2 x s64>), [[COPY2]](p0) :: (store (<2 x s64>))
37 %v2s64_val = G_BUILD_VECTOR %5:_(s64), %6:_(s64)
38 %v2s64_val2 = G_BUILD_VECTOR %6:_(s64), %8:_(s64)
39 %v4s64_val1:_(<4 x s64>) = G_CONCAT_VECTORS %v2s64_val:_(<2 x s64>), %v2s64_val2:_(<2 x s64>)
40 %v4s64_val2:_(<4 x s64>) = G_CONCAT_VECTORS %v2s64_val2:_(<2 x s64>), %v2s64_val:_(<2 x s64>)
41 %v8s64_undef:_(<8 x s64>) = G_IMPLICIT_DEF
42 %concat1:_(<8 x s64>) = G_CONCAT_VECTORS %v4s64_val1:_(<4 x s64>), %v4s64_val2:_(<4 x s64>)
43 %bigconcat:_(<24 x s64>) = G_CONCAT_VECTORS %concat1:_(<8 x s64>), %v8s64_undef:_(<8 x s64>), %v8s64_undef:_(<8 x s64>)
45 %unmerge1:_(<6 x s64>), %deaddef1:_(<6 x s64>), %deaddef2:_(<6 x s64>), %deaddef3:_(<6 x s64>) = G_UNMERGE_VALUES %bigconcat:_(<24 x s64>)
46 %val1:_(<2 x s64>), %val2:_(<2 x s64>), %val3:_(<2 x s64>) = G_UNMERGE_VALUES %unmerge1:_(<6 x s64>)
48 G_STORE %val1:_(<2 x s64>), %2:_(p0) :: (store (<2 x s64>))
49 G_STORE %val2:_(<2 x s64>), %2:_(p0) :: (store (<2 x s64>))
50 G_STORE %val3:_(<2 x s64>), %2:_(p0) :: (store (<2 x s64>))
56 name: combine_unmerge_from_unmerge_of_concat_tree_high_bits
58 tracksRegLiveness: true
61 liveins: $x0, $x1, $x2, $d0, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $x0
62 ; CHECK-LABEL: name: combine_unmerge_from_unmerge_of_concat_tree_high_bits
63 ; CHECK: liveins: $x0, $x1, $x2, $d0, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $x0
64 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
65 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
66 ; CHECK: [[COPY2:%[0-9]+]]:_(p0) = COPY $x2
67 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY $d0
68 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY $d1
69 ; CHECK: [[COPY5:%[0-9]+]]:_(s64) = COPY $d2
70 ; CHECK: [[COPY6:%[0-9]+]]:_(s64) = COPY $d3
71 ; CHECK: [[COPY7:%[0-9]+]]:_(s64) = COPY $d4
72 ; CHECK: [[COPY8:%[0-9]+]]:_(s64) = COPY $d5
73 ; CHECK: %v2s64_val:_(<2 x s64>) = G_BUILD_VECTOR [[COPY5]](s64), [[COPY6]](s64)
74 ; CHECK: %v2s64_val2:_(<2 x s64>) = G_BUILD_VECTOR [[COPY6]](s64), [[COPY8]](s64)
75 ; CHECK: [[DEF:%[0-9]+]]:_(<2 x s64>) = G_IMPLICIT_DEF
76 ; CHECK: G_STORE %v2s64_val2(<2 x s64>), [[COPY2]](p0) :: (store (<2 x s64>))
77 ; CHECK: G_STORE %v2s64_val2(<2 x s64>), [[COPY2]](p0) :: (store (<2 x s64>))
78 ; CHECK: G_STORE %v2s64_val(<2 x s64>), [[COPY2]](p0) :: (store (<2 x s64>))
89 %v2s64_val = G_BUILD_VECTOR %5:_(s64), %6:_(s64)
90 %v2s64_val2 = G_BUILD_VECTOR %6:_(s64), %8:_(s64)
91 %v4s64_val1:_(<4 x s64>) = G_CONCAT_VECTORS %v2s64_val:_(<2 x s64>), %v2s64_val2:_(<2 x s64>)
92 %v4s64_val2:_(<4 x s64>) = G_CONCAT_VECTORS %v2s64_val2:_(<2 x s64>), %v2s64_val:_(<2 x s64>)
93 %v8s64_undef:_(<8 x s64>) = G_IMPLICIT_DEF
94 %concat1:_(<8 x s64>) = G_CONCAT_VECTORS %v4s64_val1:_(<4 x s64>), %v4s64_val2:_(<4 x s64>)
95 %bigconcat:_(<24 x s64>) = G_CONCAT_VECTORS %v8s64_undef:_(<8 x s64>), %v8s64_undef:_(<8 x s64>), %concat1:_(<8 x s64>)
97 %deaddef1:_(<6 x s64>), %deaddef2:_(<6 x s64>), %deaddef3:_(<6 x s64>), %unmerge1:_(<6 x s64>) = G_UNMERGE_VALUES %bigconcat:_(<24 x s64>)
98 %val1:_(<2 x s64>), %val2:_(<2 x s64>), %val3:_(<2 x s64>) = G_UNMERGE_VALUES %unmerge1:_(<6 x s64>)
100 G_STORE %val1:_(<2 x s64>), %2:_(p0) :: (store (<2 x s64>))
101 G_STORE %val2:_(<2 x s64>), %2:_(p0) :: (store (<2 x s64>))
102 G_STORE %val3:_(<2 x s64>), %2:_(p0) :: (store (<2 x s64>))
107 name: combine_unmerge_from_insert_into_low
109 tracksRegLiveness: true
112 liveins: $x0, $x1, $x2, $d0, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $x0
113 ; CHECK-LABEL: name: combine_unmerge_from_insert_into_low
114 ; CHECK: liveins: $x0, $x1, $x2, $d0, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $x0
115 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
116 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
117 ; CHECK: [[COPY2:%[0-9]+]]:_(p0) = COPY $x2
118 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY $d0
119 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY $d1
120 ; CHECK: [[COPY5:%[0-9]+]]:_(s64) = COPY $d2
121 ; CHECK: [[COPY6:%[0-9]+]]:_(s64) = COPY $d3
122 ; CHECK: [[COPY7:%[0-9]+]]:_(s64) = COPY $d4
123 ; CHECK: [[COPY8:%[0-9]+]]:_(s64) = COPY $d5
124 ; CHECK: %v2s64_val:_(<2 x s64>) = G_BUILD_VECTOR [[COPY5]](s64), [[COPY6]](s64)
125 ; CHECK: %v2s64_val2:_(<2 x s64>) = G_BUILD_VECTOR [[COPY6]](s64), [[COPY8]](s64)
126 ; CHECK: [[DEF:%[0-9]+]]:_(<2 x s64>) = G_IMPLICIT_DEF
127 ; CHECK: G_STORE %v2s64_val(<2 x s64>), [[COPY2]](p0) :: (store (<2 x s64>))
128 ; CHECK: G_STORE %v2s64_val2(<2 x s64>), [[COPY2]](p0) :: (store (<2 x s64>))
129 ; CHECK: RET_ReallyLR
139 %v2s64_val = G_BUILD_VECTOR %5:_(s64), %6:_(s64)
140 %v2s64_val2 = G_BUILD_VECTOR %6:_(s64), %8:_(s64)
141 %v4s64_val1:_(<4 x s64>) = G_CONCAT_VECTORS %v2s64_val:_(<2 x s64>), %v2s64_val2:_(<2 x s64>)
142 %v8s64_undef:_(<8 x s64>) = G_IMPLICIT_DEF
143 %insert:_(<8 x s64>) = G_INSERT %v8s64_undef:_(<8 x s64>), %v4s64_val1:_(<4 x s64>), 0
144 %val1:_(<2 x s64>), %val2:_(<2 x s64>), %val3:_(<2 x s64>), %val4:_(<2 x s64>) = G_UNMERGE_VALUES %insert:_(<8 x s64>)
146 ; val1 should be <%5, %6>
147 G_STORE %val1:_(<2 x s64>), %2:_(p0) :: (store (<2 x s64>))
148 ; val2 should be <%6, %8>
149 G_STORE %val2:_(<2 x s64>), %2:_(p0) :: (store (<2 x s64>))
154 name: combine_unmerge_from_insert_into_high
156 tracksRegLiveness: true
159 liveins: $x0, $x1, $x2, $d0, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $x0
160 ; CHECK-LABEL: name: combine_unmerge_from_insert_into_high
161 ; CHECK: liveins: $x0, $x1, $x2, $d0, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $x0
162 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
163 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
164 ; CHECK: [[COPY2:%[0-9]+]]:_(p0) = COPY $x2
165 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY $d0
166 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY $d1
167 ; CHECK: [[COPY5:%[0-9]+]]:_(s64) = COPY $d2
168 ; CHECK: [[COPY6:%[0-9]+]]:_(s64) = COPY $d3
169 ; CHECK: [[COPY7:%[0-9]+]]:_(s64) = COPY $d4
170 ; CHECK: [[COPY8:%[0-9]+]]:_(s64) = COPY $d5
171 ; CHECK: %v2s64_val:_(<2 x s64>) = G_BUILD_VECTOR [[COPY5]](s64), [[COPY6]](s64)
172 ; CHECK: %v2s64_val2:_(<2 x s64>) = G_BUILD_VECTOR [[COPY6]](s64), [[COPY8]](s64)
173 ; CHECK: [[DEF:%[0-9]+]]:_(<2 x s64>) = G_IMPLICIT_DEF
174 ; CHECK: G_STORE %v2s64_val(<2 x s64>), [[COPY2]](p0) :: (store (<2 x s64>))
175 ; CHECK: G_STORE %v2s64_val2(<2 x s64>), [[COPY2]](p0) :: (store (<2 x s64>))
176 ; CHECK: RET_ReallyLR
186 %v2s64_val = G_BUILD_VECTOR %5:_(s64), %6:_(s64)
187 %v2s64_val2 = G_BUILD_VECTOR %6:_(s64), %8:_(s64)
188 %v4s64_val1:_(<4 x s64>) = G_CONCAT_VECTORS %v2s64_val:_(<2 x s64>), %v2s64_val2:_(<2 x s64>)
189 %v8s64_undef:_(<8 x s64>) = G_IMPLICIT_DEF
190 %insert:_(<8 x s64>) = G_INSERT %v8s64_undef:_(<8 x s64>), %v4s64_val1:_(<4 x s64>), 256
191 %val1:_(<2 x s64>), %val2:_(<2 x s64>), %val3:_(<2 x s64>), %val4:_(<2 x s64>) = G_UNMERGE_VALUES %insert:_(<8 x s64>)
193 ; val3 should be <%5, %6>
194 G_STORE %val3:_(<2 x s64>), %2:_(p0) :: (store (<2 x s64>))
195 ; val4 should be <%6, %8>
196 G_STORE %val4:_(<2 x s64>), %2:_(p0) :: (store (<2 x s64>))
201 name: combine_unmerge_from_insert_look_into_container
203 tracksRegLiveness: true
206 liveins: $x0, $x1, $x2, $d0, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $x0
207 ; CHECK-LABEL: name: combine_unmerge_from_insert_look_into_container
208 ; CHECK: liveins: $x0, $x1, $x2, $d0, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $x0
209 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
210 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
211 ; CHECK: [[COPY2:%[0-9]+]]:_(p0) = COPY $x2
212 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY $d0
213 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY $d1
214 ; CHECK: [[COPY5:%[0-9]+]]:_(s64) = COPY $d2
215 ; CHECK: [[COPY6:%[0-9]+]]:_(s64) = COPY $d3
216 ; CHECK: [[COPY7:%[0-9]+]]:_(s64) = COPY $d4
217 ; CHECK: [[COPY8:%[0-9]+]]:_(s64) = COPY $d5
218 ; CHECK: %v2s64_val:_(<2 x s64>) = G_BUILD_VECTOR [[COPY5]](s64), [[COPY6]](s64)
219 ; CHECK: %v2s64_val2:_(<2 x s64>) = G_BUILD_VECTOR [[COPY6]](s64), [[COPY8]](s64)
220 ; CHECK: [[DEF:%[0-9]+]]:_(<2 x s64>) = G_IMPLICIT_DEF
221 ; CHECK: G_STORE %v2s64_val(<2 x s64>), [[COPY2]](p0) :: (store (<2 x s64>))
222 ; CHECK: G_STORE %v2s64_val2(<2 x s64>), [[COPY2]](p0) :: (store (<2 x s64>))
223 ; CHECK: RET_ReallyLR
233 %v2s64_val = G_BUILD_VECTOR %5:_(s64), %6:_(s64)
234 %v2s64_val2 = G_BUILD_VECTOR %6:_(s64), %8:_(s64)
235 %v4s64_undef:_(<4 x s64>) = G_IMPLICIT_DEF
236 %v4s64_val1:_(<4 x s64>) = G_CONCAT_VECTORS %v2s64_val:_(<2 x s64>), %v2s64_val2:_(<2 x s64>)
237 %v8s64_val1:_(<8 x s64>) = G_CONCAT_VECTORS %v4s64_undef:_(<4 x s64>), %v4s64_val1:_(<4 x s64>)
238 %insert:_(<8 x s64>) = G_INSERT %v8s64_val1:_(<8 x s64>), %v4s64_undef:_(<4 x s64>), 0
239 ; The values we're interested in are in bits 256-512 of the insert container.
240 %val1:_(<2 x s64>), %val2:_(<2 x s64>), %val3:_(<2 x s64>), %val4:_(<2 x s64>) = G_UNMERGE_VALUES %insert:_(<8 x s64>)
242 ; val3 should be <%5, %6>
243 G_STORE %val3:_(<2 x s64>), %2:_(p0) :: (store (<2 x s64>))
244 ; val4 should be <%6, %8>
245 G_STORE %val4:_(<2 x s64>), %2:_(p0) :: (store (<2 x s64>))