1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-unknown-unknown -verify-machineinstrs -run-pass=legalizer %s -o - | FileCheck %s
6 tracksRegLiveness: true
10 ; CHECK-LABEL: name: v8s8_legal
12 ; CHECK: %copy:_(<8 x s8>) = COPY $d0
13 ; CHECK: %ctpop:_(<8 x s8>) = G_CTPOP %copy(<8 x s8>)
14 ; CHECK: $d0 = COPY %ctpop(<8 x s8>)
15 ; CHECK: RET_ReallyLR implicit $d0
16 %copy:_(<8 x s8>) = COPY $d0
17 %ctpop:_(<8 x s8>) = G_CTPOP %copy(<8 x s8>)
18 $d0 = COPY %ctpop(<8 x s8>)
19 RET_ReallyLR implicit $d0
24 tracksRegLiveness: true
28 ; CHECK-LABEL: name: v16s8_legal
30 ; CHECK: %copy:_(<16 x s8>) = COPY $q0
31 ; CHECK: %ctpop:_(<16 x s8>) = G_CTPOP %copy(<16 x s8>)
32 ; CHECK: $q0 = COPY %ctpop(<16 x s8>)
33 ; CHECK: RET_ReallyLR implicit $q0
34 %copy:_(<16 x s8>) = COPY $q0
35 %ctpop:_(<16 x s8>) = G_CTPOP %copy(<16 x s8>)
36 $q0 = COPY %ctpop(<16 x s8>)
37 RET_ReallyLR implicit $q0
42 tracksRegLiveness: true
46 ; CHECK-LABEL: name: s32_lower
48 ; CHECK: %copy:_(s32) = COPY $w0
49 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT %copy(s32)
50 ; CHECK: [[BITCAST:%[0-9]+]]:_(<8 x s8>) = G_BITCAST [[ZEXT]](s64)
51 ; CHECK: [[CTPOP:%[0-9]+]]:_(<8 x s8>) = G_CTPOP [[BITCAST]](<8 x s8>)
52 ; CHECK: %ctpop:_(s32) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlv), [[CTPOP]](<8 x s8>)
53 ; CHECK: $w0 = COPY %ctpop(s32)
54 ; CHECK: RET_ReallyLR implicit $w0
55 %copy:_(s32) = COPY $w0
56 %ctpop:_(s32) = G_CTPOP %copy(s32)
57 $w0 = COPY %ctpop(s32)
58 RET_ReallyLR implicit $w0
63 tracksRegLiveness: true
67 ; CHECK-LABEL: name: s64_lower
69 ; CHECK: %copy:_(s64) = COPY $x0
70 ; CHECK: [[BITCAST:%[0-9]+]]:_(<8 x s8>) = G_BITCAST %copy(s64)
71 ; CHECK: [[CTPOP:%[0-9]+]]:_(<8 x s8>) = G_CTPOP [[BITCAST]](<8 x s8>)
72 ; CHECK: [[INT:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlv), [[CTPOP]](<8 x s8>)
73 ; CHECK: %ctpop:_(s64) = G_ZEXT [[INT]](s32)
74 ; CHECK: $x0 = COPY %ctpop(s64)
75 ; CHECK: RET_ReallyLR implicit $x0
76 %copy:_(s64) = COPY $x0
77 %ctpop:_(s64) = G_CTPOP %copy(s64)
78 $x0 = COPY %ctpop(s64)
79 RET_ReallyLR implicit $x0
84 tracksRegLiveness: true
88 ; CHECK-LABEL: name: s128_lower
90 ; CHECK: %copy:_(s128) = COPY $q0
91 ; CHECK: [[BITCAST:%[0-9]+]]:_(<16 x s8>) = G_BITCAST %copy(s128)
92 ; CHECK: [[CTPOP:%[0-9]+]]:_(<16 x s8>) = G_CTPOP [[BITCAST]](<16 x s8>)
93 ; CHECK: [[INT:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlv), [[CTPOP]](<16 x s8>)
94 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
95 ; CHECK: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[INT]](s32), [[C]](s32)
96 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
97 ; CHECK: %ctpop:_(s128) = G_MERGE_VALUES [[MV]](s64), [[C1]](s64)
98 ; CHECK: $q0 = COPY %ctpop(s128)
99 ; CHECK: RET_ReallyLR implicit $q0
100 %copy:_(s128) = COPY $q0
101 %ctpop:_(s128) = G_CTPOP %copy(s128)
102 $q0 = COPY %ctpop(s128)
103 RET_ReallyLR implicit $q0
108 tracksRegLiveness: true
113 ; CHECK-LABEL: name: widen_s16
114 ; CHECK: liveins: $w0
115 ; CHECK: %copy:_(s32) = COPY $w0
116 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535
117 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT %copy(s32)
118 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
119 ; CHECK: [[BITCAST:%[0-9]+]]:_(<8 x s8>) = G_BITCAST [[AND]](s64)
120 ; CHECK: [[CTPOP:%[0-9]+]]:_(<8 x s8>) = G_CTPOP [[BITCAST]](<8 x s8>)
121 ; CHECK: [[INT:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlv), [[CTPOP]](<8 x s8>)
122 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY [[INT]](s32)
123 ; CHECK: %ext:_(s32) = COPY [[COPY]](s32)
124 ; CHECK: $w0 = COPY %ext(s32)
125 ; CHECK: RET_ReallyLR implicit $w0
126 %copy:_(s32) = COPY $w0
127 %trunc:_(s16) = G_TRUNC %copy(s32)
128 %ctpop:_(s16) = G_CTPOP %trunc(s16)
129 %ext:_(s32) = G_ANYEXT %ctpop(s16)
131 RET_ReallyLR implicit $w0
136 tracksRegLiveness: true
141 ; CHECK-LABEL: name: widen_s8
142 ; CHECK: liveins: $w0
143 ; CHECK: %copy:_(s32) = COPY $w0
144 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
145 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT %copy(s32)
146 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
147 ; CHECK: [[BITCAST:%[0-9]+]]:_(<8 x s8>) = G_BITCAST [[AND]](s64)
148 ; CHECK: [[CTPOP:%[0-9]+]]:_(<8 x s8>) = G_CTPOP [[BITCAST]](<8 x s8>)
149 ; CHECK: [[INT:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlv), [[CTPOP]](<8 x s8>)
150 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY [[INT]](s32)
151 ; CHECK: %ext:_(s32) = COPY [[COPY]](s32)
152 ; CHECK: $w0 = COPY %ext(s32)
153 ; CHECK: RET_ReallyLR implicit $w0
154 %copy:_(s32) = COPY $w0
155 %trunc:_(s8) = G_TRUNC %copy(s32)
156 %ctpop:_(s8) = G_CTPOP %trunc(s8)
157 %ext:_(s32) = G_ANYEXT %ctpop(s8)
159 RET_ReallyLR implicit $w0
164 tracksRegLiveness: true
169 ; CHECK-LABEL: name: widen_s3
170 ; CHECK: liveins: $w0
171 ; CHECK: %copy:_(s32) = COPY $w0
172 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 7
173 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT %copy(s32)
174 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
175 ; CHECK: [[BITCAST:%[0-9]+]]:_(<8 x s8>) = G_BITCAST [[AND]](s64)
176 ; CHECK: [[CTPOP:%[0-9]+]]:_(<8 x s8>) = G_CTPOP [[BITCAST]](<8 x s8>)
177 ; CHECK: [[INT:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlv), [[CTPOP]](<8 x s8>)
178 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY [[INT]](s32)
179 ; CHECK: %ext:_(s32) = COPY [[COPY]](s32)
180 ; CHECK: $w0 = COPY %ext(s32)
181 ; CHECK: RET_ReallyLR implicit $w0
182 %copy:_(s32) = COPY $w0
183 %trunc:_(s3) = G_TRUNC %copy(s32)
184 %ctpop:_(s3) = G_CTPOP %trunc(s3)
185 %ext:_(s32) = G_ANYEXT %ctpop(s3)
187 RET_ReallyLR implicit $w0
191 name: different_sizes
192 tracksRegLiveness: true
196 ; CHECK-LABEL: name: different_sizes
197 ; CHECK: liveins: $w0
198 ; CHECK: %copy:_(s32) = COPY $w0
199 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
200 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT %copy(s32)
201 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
202 ; CHECK: [[BITCAST:%[0-9]+]]:_(<8 x s8>) = G_BITCAST [[AND]](s64)
203 ; CHECK: [[CTPOP:%[0-9]+]]:_(<8 x s8>) = G_CTPOP [[BITCAST]](<8 x s8>)
204 ; CHECK: [[INT:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlv), [[CTPOP]](<8 x s8>)
205 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY [[INT]](s32)
206 ; CHECK: %ext:_(s32) = COPY [[COPY]](s32)
207 ; CHECK: $w0 = COPY %ext(s32)
208 ; CHECK: RET_ReallyLR implicit $w0
209 %copy:_(s32) = COPY $w0
210 %trunc:_(s8) = G_TRUNC %copy(s32)
211 %ctpop:_(s16) = G_CTPOP %trunc(s8)
212 %ext:_(s32) = G_ANYEXT %ctpop(s16)
214 RET_ReallyLR implicit $w0
219 tracksRegLiveness: true
224 ; CHECK-LABEL: name: custom_8x16
225 ; CHECK: liveins: $q0
226 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
227 ; CHECK: [[BITCAST:%[0-9]+]]:_(<16 x s8>) = G_BITCAST [[COPY]](<8 x s16>)
228 ; CHECK: [[CTPOP:%[0-9]+]]:_(<16 x s8>) = G_CTPOP [[BITCAST]](<16 x s8>)
229 ; CHECK: [[INT:%[0-9]+]]:_(<8 x s16>) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlp), [[CTPOP]](<16 x s8>)
230 ; CHECK: $q0 = COPY [[INT]](<8 x s16>)
231 ; CHECK: RET_ReallyLR implicit $q0
232 %0:_(<8 x s16>) = COPY $q0
233 %1:_(<8 x s16>) = G_CTPOP %0(<8 x s16>)
234 $q0 = COPY %1(<8 x s16>)
235 RET_ReallyLR implicit $q0
240 tracksRegLiveness: true
245 ; CHECK-LABEL: name: custom_4x32
246 ; CHECK: liveins: $q0
247 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
248 ; CHECK: [[BITCAST:%[0-9]+]]:_(<16 x s8>) = G_BITCAST [[COPY]](<4 x s32>)
249 ; CHECK: [[CTPOP:%[0-9]+]]:_(<16 x s8>) = G_CTPOP [[BITCAST]](<16 x s8>)
250 ; CHECK: [[INT:%[0-9]+]]:_(<8 x s16>) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlp), [[CTPOP]](<16 x s8>)
251 ; CHECK: [[INT1:%[0-9]+]]:_(<4 x s32>) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlp), [[INT]](<8 x s16>)
252 ; CHECK: $q0 = COPY [[INT1]](<4 x s32>)
253 ; CHECK: RET_ReallyLR implicit $q0
254 %0:_(<4 x s32>) = COPY $q0
255 %1:_(<4 x s32>) = G_CTPOP %0(<4 x s32>)
256 $q0 = COPY %1(<4 x s32>)
257 RET_ReallyLR implicit $q0
262 tracksRegLiveness: true
267 ; CHECK-LABEL: name: custom_2x64
268 ; CHECK: liveins: $q0
269 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $q0
270 ; CHECK: [[BITCAST:%[0-9]+]]:_(<16 x s8>) = G_BITCAST [[COPY]](<2 x s64>)
271 ; CHECK: [[CTPOP:%[0-9]+]]:_(<16 x s8>) = G_CTPOP [[BITCAST]](<16 x s8>)
272 ; CHECK: [[INT:%[0-9]+]]:_(<8 x s16>) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlp), [[CTPOP]](<16 x s8>)
273 ; CHECK: [[INT1:%[0-9]+]]:_(<4 x s32>) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlp), [[INT]](<8 x s16>)
274 ; CHECK: [[INT2:%[0-9]+]]:_(<2 x s64>) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlp), [[INT1]](<4 x s32>)
275 ; CHECK: $q0 = COPY [[INT2]](<2 x s64>)
276 ; CHECK: RET_ReallyLR implicit $q0
277 %0:_(<2 x s64>) = COPY $q0
278 %1:_(<2 x s64>) = G_CTPOP %0(<2 x s64>)
279 $q0 = COPY %1(<2 x s64>)
280 RET_ReallyLR implicit $q0
285 tracksRegLiveness: true
290 ; CHECK-LABEL: name: custom_4x16
291 ; CHECK: liveins: $d0
292 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
293 ; CHECK: [[BITCAST:%[0-9]+]]:_(<8 x s8>) = G_BITCAST [[COPY]](<4 x s16>)
294 ; CHECK: [[CTPOP:%[0-9]+]]:_(<8 x s8>) = G_CTPOP [[BITCAST]](<8 x s8>)
295 ; CHECK: [[INT:%[0-9]+]]:_(<4 x s16>) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlp), [[CTPOP]](<8 x s8>)
296 ; CHECK: $d0 = COPY [[INT]](<4 x s16>)
297 ; CHECK: RET_ReallyLR implicit $d0
298 %0:_(<4 x s16>) = COPY $d0
299 %1:_(<4 x s16>) = G_CTPOP %0(<4 x s16>)
300 $d0 = COPY %1(<4 x s16>)
301 RET_ReallyLR implicit $d0
306 tracksRegLiveness: true
311 ; CHECK-LABEL: name: custom_2x32
312 ; CHECK: liveins: $d0
313 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
314 ; CHECK: [[BITCAST:%[0-9]+]]:_(<8 x s8>) = G_BITCAST [[COPY]](<2 x s32>)
315 ; CHECK: [[CTPOP:%[0-9]+]]:_(<8 x s8>) = G_CTPOP [[BITCAST]](<8 x s8>)
316 ; CHECK: [[INT:%[0-9]+]]:_(<4 x s16>) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlp), [[CTPOP]](<8 x s8>)
317 ; CHECK: [[INT1:%[0-9]+]]:_(<2 x s32>) = G_INTRINSIC intrinsic(@llvm.aarch64.neon.uaddlp), [[INT]](<4 x s16>)
318 ; CHECK: $d0 = COPY [[INT1]](<2 x s32>)
319 ; CHECK: RET_ReallyLR implicit $d0
320 %0:_(<2 x s32>) = COPY $d0
321 %1:_(<2 x s32>) = G_CTPOP %0(<2 x s32>)
322 $d0 = COPY %1(<2 x s32>)
323 RET_ReallyLR implicit $d0