1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple aarch64 -o - | FileCheck %s
4 define <16 x i8> @rshrn_v16i16_1(<16 x i16> %a) {
5 ; CHECK-LABEL: rshrn_v16i16_1:
6 ; CHECK: // %bb.0: // %entry
7 ; CHECK-NEXT: rshrn v0.8b, v0.8h, #1
8 ; CHECK-NEXT: rshrn2 v0.16b, v1.8h, #1
11 %b = add <16 x i16> %a, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
12 %s = lshr <16 x i16> %b, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
13 %m = trunc <16 x i16> %s to <16 x i8>
17 define <16 x i8> @rshrn_v16i16_2(<16 x i16> %a) {
18 ; CHECK-LABEL: rshrn_v16i16_2:
19 ; CHECK: // %bb.0: // %entry
20 ; CHECK-NEXT: rshrn v0.8b, v0.8h, #2
21 ; CHECK-NEXT: rshrn2 v0.16b, v1.8h, #2
24 %b = add <16 x i16> %a, <i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2>
25 %s = lshr <16 x i16> %b, <i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2>
26 %m = trunc <16 x i16> %s to <16 x i8>
30 define <16 x i8> @rshrn_v16i16_3(<16 x i16> %a) {
31 ; CHECK-LABEL: rshrn_v16i16_3:
32 ; CHECK: // %bb.0: // %entry
33 ; CHECK-NEXT: rshrn v0.8b, v0.8h, #3
34 ; CHECK-NEXT: rshrn2 v0.16b, v1.8h, #3
37 %b = add <16 x i16> %a, <i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4>
38 %s = lshr <16 x i16> %b, <i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3>
39 %m = trunc <16 x i16> %s to <16 x i8>
43 define <16 x i8> @rshrn_v16i16_4(<16 x i16> %a) {
44 ; CHECK-LABEL: rshrn_v16i16_4:
45 ; CHECK: // %bb.0: // %entry
46 ; CHECK-NEXT: rshrn v0.8b, v0.8h, #4
47 ; CHECK-NEXT: rshrn2 v0.16b, v1.8h, #4
50 %b = add <16 x i16> %a, <i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8>
51 %s = lshr <16 x i16> %b, <i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4>
52 %m = trunc <16 x i16> %s to <16 x i8>
56 define <16 x i8> @rshrn_v16i16_5(<16 x i16> %a) {
57 ; CHECK-LABEL: rshrn_v16i16_5:
58 ; CHECK: // %bb.0: // %entry
59 ; CHECK-NEXT: rshrn v0.8b, v0.8h, #5
60 ; CHECK-NEXT: rshrn2 v0.16b, v1.8h, #5
63 %b = add <16 x i16> %a, <i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16>
64 %s = lshr <16 x i16> %b, <i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5>
65 %m = trunc <16 x i16> %s to <16 x i8>
69 define <16 x i8> @rshrn_v16i16_6(<16 x i16> %a) {
70 ; CHECK-LABEL: rshrn_v16i16_6:
71 ; CHECK: // %bb.0: // %entry
72 ; CHECK-NEXT: rshrn v0.8b, v0.8h, #6
73 ; CHECK-NEXT: rshrn2 v0.16b, v1.8h, #6
76 %b = add <16 x i16> %a, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32>
77 %s = lshr <16 x i16> %b, <i16 6, i16 6, i16 6, i16 6, i16 6, i16 6, i16 6, i16 6, i16 6, i16 6, i16 6, i16 6, i16 6, i16 6, i16 6, i16 6>
78 %m = trunc <16 x i16> %s to <16 x i8>
82 define <16 x i8> @rshrn_v16i16_7(<16 x i16> %a) {
83 ; CHECK-LABEL: rshrn_v16i16_7:
84 ; CHECK: // %bb.0: // %entry
85 ; CHECK-NEXT: rshrn v0.8b, v0.8h, #7
86 ; CHECK-NEXT: rshrn2 v0.16b, v1.8h, #7
89 %b = add <16 x i16> %a, <i16 64, i16 64, i16 64, i16 64, i16 64, i16 64, i16 64, i16 64, i16 64, i16 64, i16 64, i16 64, i16 64, i16 64, i16 64, i16 64>
90 %s = lshr <16 x i16> %b, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
91 %m = trunc <16 x i16> %s to <16 x i8>
95 define <16 x i8> @rshrn_v16i16_8(<16 x i16> %a) {
96 ; CHECK-LABEL: rshrn_v16i16_8:
97 ; CHECK: // %bb.0: // %entry
98 ; CHECK-NEXT: movi v2.2d, #0000000000000000
99 ; CHECK-NEXT: raddhn v0.8b, v0.8h, v2.8h
100 ; CHECK-NEXT: raddhn2 v0.16b, v1.8h, v2.8h
103 %b = add <16 x i16> %a, <i16 128, i16 128, i16 128, i16 128, i16 128, i16 128, i16 128, i16 128, i16 128, i16 128, i16 128, i16 128, i16 128, i16 128, i16 128, i16 128>
104 %s = lshr <16 x i16> %b, <i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8>
105 %m = trunc <16 x i16> %s to <16 x i8>
109 define <16 x i8> @rshrn_v16i16_9(<16 x i16> %a) {
110 ; CHECK-LABEL: rshrn_v16i16_9:
111 ; CHECK: // %bb.0: // %entry
112 ; CHECK-NEXT: movi v2.8h, #1, lsl #8
113 ; CHECK-NEXT: add v0.8h, v0.8h, v2.8h
114 ; CHECK-NEXT: add v1.8h, v1.8h, v2.8h
115 ; CHECK-NEXT: ushr v1.8h, v1.8h, #9
116 ; CHECK-NEXT: ushr v0.8h, v0.8h, #9
117 ; CHECK-NEXT: uzp1 v0.16b, v0.16b, v1.16b
120 %b = add <16 x i16> %a, <i16 256, i16 256, i16 256, i16 256, i16 256, i16 256, i16 256, i16 256, i16 256, i16 256, i16 256, i16 256, i16 256, i16 256, i16 256, i16 256>
121 %s = lshr <16 x i16> %b, <i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9>
122 %m = trunc <16 x i16> %s to <16 x i8>
126 define <8 x i16> @rshrn_v8i32_1(<8 x i32> %a) {
127 ; CHECK-LABEL: rshrn_v8i32_1:
128 ; CHECK: // %bb.0: // %entry
129 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #1
130 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #1
133 %b = add <8 x i32> %a, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
134 %s = lshr <8 x i32> %b, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
135 %m = trunc <8 x i32> %s to <8 x i16>
139 define <8 x i16> @rshrn_v8i32_2(<8 x i32> %a) {
140 ; CHECK-LABEL: rshrn_v8i32_2:
141 ; CHECK: // %bb.0: // %entry
142 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #2
143 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #2
146 %b = add <8 x i32> %a, <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
147 %s = lshr <8 x i32> %b, <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
148 %m = trunc <8 x i32> %s to <8 x i16>
152 define <8 x i16> @rshrn_v8i32_3(<8 x i32> %a) {
153 ; CHECK-LABEL: rshrn_v8i32_3:
154 ; CHECK: // %bb.0: // %entry
155 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #3
156 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #3
159 %b = add <8 x i32> %a, <i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4>
160 %s = lshr <8 x i32> %b, <i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3>
161 %m = trunc <8 x i32> %s to <8 x i16>
165 define <8 x i16> @rshrn_v8i32_4(<8 x i32> %a) {
166 ; CHECK-LABEL: rshrn_v8i32_4:
167 ; CHECK: // %bb.0: // %entry
168 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #4
169 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #4
172 %b = add <8 x i32> %a, <i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8>
173 %s = lshr <8 x i32> %b, <i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4>
174 %m = trunc <8 x i32> %s to <8 x i16>
178 define <8 x i16> @rshrn_v8i32_5(<8 x i32> %a) {
179 ; CHECK-LABEL: rshrn_v8i32_5:
180 ; CHECK: // %bb.0: // %entry
181 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #5
182 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #5
185 %b = add <8 x i32> %a, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
186 %s = lshr <8 x i32> %b, <i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5>
187 %m = trunc <8 x i32> %s to <8 x i16>
191 define <8 x i16> @rshrn_v8i32_6(<8 x i32> %a) {
192 ; CHECK-LABEL: rshrn_v8i32_6:
193 ; CHECK: // %bb.0: // %entry
194 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #6
195 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #6
198 %b = add <8 x i32> %a, <i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32>
199 %s = lshr <8 x i32> %b, <i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6>
200 %m = trunc <8 x i32> %s to <8 x i16>
204 define <8 x i16> @rshrn_v8i32_7(<8 x i32> %a) {
205 ; CHECK-LABEL: rshrn_v8i32_7:
206 ; CHECK: // %bb.0: // %entry
207 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #7
208 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #7
211 %b = add <8 x i32> %a, <i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64>
212 %s = lshr <8 x i32> %b, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
213 %m = trunc <8 x i32> %s to <8 x i16>
217 define <8 x i16> @rshrn_v8i32_8(<8 x i32> %a) {
218 ; CHECK-LABEL: rshrn_v8i32_8:
219 ; CHECK: // %bb.0: // %entry
220 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #8
221 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #8
224 %b = add <8 x i32> %a, <i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128>
225 %s = lshr <8 x i32> %b, <i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8>
226 %m = trunc <8 x i32> %s to <8 x i16>
230 define <8 x i16> @rshrn_v8i32_9(<8 x i32> %a) {
231 ; CHECK-LABEL: rshrn_v8i32_9:
232 ; CHECK: // %bb.0: // %entry
233 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #9
234 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #9
237 %b = add <8 x i32> %a, <i32 256, i32 256, i32 256, i32 256, i32 256, i32 256, i32 256, i32 256>
238 %s = lshr <8 x i32> %b, <i32 9, i32 9, i32 9, i32 9, i32 9, i32 9, i32 9, i32 9>
239 %m = trunc <8 x i32> %s to <8 x i16>
243 define <8 x i16> @rshrn_v8i32_10(<8 x i32> %a) {
244 ; CHECK-LABEL: rshrn_v8i32_10:
245 ; CHECK: // %bb.0: // %entry
246 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #10
247 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #10
250 %b = add <8 x i32> %a, <i32 512, i32 512, i32 512, i32 512, i32 512, i32 512, i32 512, i32 512>
251 %s = lshr <8 x i32> %b, <i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10>
252 %m = trunc <8 x i32> %s to <8 x i16>
256 define <8 x i16> @rshrn_v8i32_11(<8 x i32> %a) {
257 ; CHECK-LABEL: rshrn_v8i32_11:
258 ; CHECK: // %bb.0: // %entry
259 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #11
260 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #11
263 %b = add <8 x i32> %a, <i32 1024, i32 1024, i32 1024, i32 1024, i32 1024, i32 1024, i32 1024, i32 1024>
264 %s = lshr <8 x i32> %b, <i32 11, i32 11, i32 11, i32 11, i32 11, i32 11, i32 11, i32 11>
265 %m = trunc <8 x i32> %s to <8 x i16>
269 define <8 x i16> @rshrn_v8i32_12(<8 x i32> %a) {
270 ; CHECK-LABEL: rshrn_v8i32_12:
271 ; CHECK: // %bb.0: // %entry
272 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #12
273 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #12
276 %b = add <8 x i32> %a, <i32 2048, i32 2048, i32 2048, i32 2048, i32 2048, i32 2048, i32 2048, i32 2048>
277 %s = lshr <8 x i32> %b, <i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12>
278 %m = trunc <8 x i32> %s to <8 x i16>
282 define <8 x i16> @rshrn_v8i32_13(<8 x i32> %a) {
283 ; CHECK-LABEL: rshrn_v8i32_13:
284 ; CHECK: // %bb.0: // %entry
285 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #13
286 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #13
289 %b = add <8 x i32> %a, <i32 4096, i32 4096, i32 4096, i32 4096, i32 4096, i32 4096, i32 4096, i32 4096>
290 %s = lshr <8 x i32> %b, <i32 13, i32 13, i32 13, i32 13, i32 13, i32 13, i32 13, i32 13>
291 %m = trunc <8 x i32> %s to <8 x i16>
295 define <8 x i16> @rshrn_v8i32_14(<8 x i32> %a) {
296 ; CHECK-LABEL: rshrn_v8i32_14:
297 ; CHECK: // %bb.0: // %entry
298 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #14
299 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #14
302 %b = add <8 x i32> %a, <i32 8192, i32 8192, i32 8192, i32 8192, i32 8192, i32 8192, i32 8192, i32 8192>
303 %s = lshr <8 x i32> %b, <i32 14, i32 14, i32 14, i32 14, i32 14, i32 14, i32 14, i32 14>
304 %m = trunc <8 x i32> %s to <8 x i16>
308 define <8 x i16> @rshrn_v8i32_15(<8 x i32> %a) {
309 ; CHECK-LABEL: rshrn_v8i32_15:
310 ; CHECK: // %bb.0: // %entry
311 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #15
312 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #15
315 %b = add <8 x i32> %a, <i32 16384, i32 16384, i32 16384, i32 16384, i32 16384, i32 16384, i32 16384, i32 16384>
316 %s = lshr <8 x i32> %b, <i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15>
317 %m = trunc <8 x i32> %s to <8 x i16>
321 define <8 x i16> @rshrn_v8i32_16(<8 x i32> %a) {
322 ; CHECK-LABEL: rshrn_v8i32_16:
323 ; CHECK: // %bb.0: // %entry
324 ; CHECK-NEXT: movi v2.2d, #0000000000000000
325 ; CHECK-NEXT: raddhn v0.4h, v0.4s, v2.4s
326 ; CHECK-NEXT: raddhn2 v0.8h, v1.4s, v2.4s
329 %b = add <8 x i32> %a, <i32 32768, i32 32768, i32 32768, i32 32768, i32 32768, i32 32768, i32 32768, i32 32768>
330 %s = lshr <8 x i32> %b, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
331 %m = trunc <8 x i32> %s to <8 x i16>
335 define <8 x i16> @rshrn_v8i32_17(<8 x i32> %a) {
336 ; CHECK-LABEL: rshrn_v8i32_17:
337 ; CHECK: // %bb.0: // %entry
338 ; CHECK-NEXT: movi v2.4s, #1, lsl #16
339 ; CHECK-NEXT: add v0.4s, v0.4s, v2.4s
340 ; CHECK-NEXT: add v1.4s, v1.4s, v2.4s
341 ; CHECK-NEXT: ushr v1.4s, v1.4s, #17
342 ; CHECK-NEXT: ushr v0.4s, v0.4s, #17
343 ; CHECK-NEXT: uzp1 v0.8h, v0.8h, v1.8h
346 %b = add <8 x i32> %a, <i32 65536, i32 65536, i32 65536, i32 65536, i32 65536, i32 65536, i32 65536, i32 65536>
347 %s = lshr <8 x i32> %b, <i32 17, i32 17, i32 17, i32 17, i32 17, i32 17, i32 17, i32 17>
348 %m = trunc <8 x i32> %s to <8 x i16>
352 define <4 x i32> @rshrn_v4i64_1(<4 x i64> %a) {
353 ; CHECK-LABEL: rshrn_v4i64_1:
354 ; CHECK: // %bb.0: // %entry
355 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #1
356 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #1
359 %b = add <4 x i64> %a, <i64 1, i64 1, i64 1, i64 1>
360 %s = lshr <4 x i64> %b, <i64 1, i64 1, i64 1, i64 1>
361 %m = trunc <4 x i64> %s to <4 x i32>
365 define <4 x i32> @rshrn_v4i64_2(<4 x i64> %a) {
366 ; CHECK-LABEL: rshrn_v4i64_2:
367 ; CHECK: // %bb.0: // %entry
368 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #2
369 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #2
372 %b = add <4 x i64> %a, <i64 2, i64 2, i64 2, i64 2>
373 %s = lshr <4 x i64> %b, <i64 2, i64 2, i64 2, i64 2>
374 %m = trunc <4 x i64> %s to <4 x i32>
378 define <4 x i32> @rshrn_v4i64_3(<4 x i64> %a) {
379 ; CHECK-LABEL: rshrn_v4i64_3:
380 ; CHECK: // %bb.0: // %entry
381 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #3
382 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #3
385 %b = add <4 x i64> %a, <i64 4, i64 4, i64 4, i64 4>
386 %s = lshr <4 x i64> %b, <i64 3, i64 3, i64 3, i64 3>
387 %m = trunc <4 x i64> %s to <4 x i32>
391 define <4 x i32> @rshrn_v4i64_4(<4 x i64> %a) {
392 ; CHECK-LABEL: rshrn_v4i64_4:
393 ; CHECK: // %bb.0: // %entry
394 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #4
395 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #4
398 %b = add <4 x i64> %a, <i64 8, i64 8, i64 8, i64 8>
399 %s = lshr <4 x i64> %b, <i64 4, i64 4, i64 4, i64 4>
400 %m = trunc <4 x i64> %s to <4 x i32>
404 define <4 x i32> @rshrn_v4i64_5(<4 x i64> %a) {
405 ; CHECK-LABEL: rshrn_v4i64_5:
406 ; CHECK: // %bb.0: // %entry
407 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #5
408 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #5
411 %b = add <4 x i64> %a, <i64 16, i64 16, i64 16, i64 16>
412 %s = lshr <4 x i64> %b, <i64 5, i64 5, i64 5, i64 5>
413 %m = trunc <4 x i64> %s to <4 x i32>
417 define <4 x i32> @rshrn_v4i64_6(<4 x i64> %a) {
418 ; CHECK-LABEL: rshrn_v4i64_6:
419 ; CHECK: // %bb.0: // %entry
420 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #6
421 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #6
424 %b = add <4 x i64> %a, <i64 32, i64 32, i64 32, i64 32>
425 %s = lshr <4 x i64> %b, <i64 6, i64 6, i64 6, i64 6>
426 %m = trunc <4 x i64> %s to <4 x i32>
430 define <4 x i32> @rshrn_v4i64_7(<4 x i64> %a) {
431 ; CHECK-LABEL: rshrn_v4i64_7:
432 ; CHECK: // %bb.0: // %entry
433 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #7
434 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #7
437 %b = add <4 x i64> %a, <i64 64, i64 64, i64 64, i64 64>
438 %s = lshr <4 x i64> %b, <i64 7, i64 7, i64 7, i64 7>
439 %m = trunc <4 x i64> %s to <4 x i32>
443 define <4 x i32> @rshrn_v4i64_8(<4 x i64> %a) {
444 ; CHECK-LABEL: rshrn_v4i64_8:
445 ; CHECK: // %bb.0: // %entry
446 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #8
447 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #8
450 %b = add <4 x i64> %a, <i64 128, i64 128, i64 128, i64 128>
451 %s = lshr <4 x i64> %b, <i64 8, i64 8, i64 8, i64 8>
452 %m = trunc <4 x i64> %s to <4 x i32>
456 define <4 x i32> @rshrn_v4i64_9(<4 x i64> %a) {
457 ; CHECK-LABEL: rshrn_v4i64_9:
458 ; CHECK: // %bb.0: // %entry
459 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #9
460 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #9
463 %b = add <4 x i64> %a, <i64 256, i64 256, i64 256, i64 256>
464 %s = lshr <4 x i64> %b, <i64 9, i64 9, i64 9, i64 9>
465 %m = trunc <4 x i64> %s to <4 x i32>
469 define <4 x i32> @rshrn_v4i64_10(<4 x i64> %a) {
470 ; CHECK-LABEL: rshrn_v4i64_10:
471 ; CHECK: // %bb.0: // %entry
472 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #10
473 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #10
476 %b = add <4 x i64> %a, <i64 512, i64 512, i64 512, i64 512>
477 %s = lshr <4 x i64> %b, <i64 10, i64 10, i64 10, i64 10>
478 %m = trunc <4 x i64> %s to <4 x i32>
482 define <4 x i32> @rshrn_v4i64_11(<4 x i64> %a) {
483 ; CHECK-LABEL: rshrn_v4i64_11:
484 ; CHECK: // %bb.0: // %entry
485 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #11
486 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #11
489 %b = add <4 x i64> %a, <i64 1024, i64 1024, i64 1024, i64 1024>
490 %s = lshr <4 x i64> %b, <i64 11, i64 11, i64 11, i64 11>
491 %m = trunc <4 x i64> %s to <4 x i32>
495 define <4 x i32> @rshrn_v4i64_12(<4 x i64> %a) {
496 ; CHECK-LABEL: rshrn_v4i64_12:
497 ; CHECK: // %bb.0: // %entry
498 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #12
499 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #12
502 %b = add <4 x i64> %a, <i64 2048, i64 2048, i64 2048, i64 2048>
503 %s = lshr <4 x i64> %b, <i64 12, i64 12, i64 12, i64 12>
504 %m = trunc <4 x i64> %s to <4 x i32>
508 define <4 x i32> @rshrn_v4i64_13(<4 x i64> %a) {
509 ; CHECK-LABEL: rshrn_v4i64_13:
510 ; CHECK: // %bb.0: // %entry
511 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #13
512 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #13
515 %b = add <4 x i64> %a, <i64 4096, i64 4096, i64 4096, i64 4096>
516 %s = lshr <4 x i64> %b, <i64 13, i64 13, i64 13, i64 13>
517 %m = trunc <4 x i64> %s to <4 x i32>
521 define <4 x i32> @rshrn_v4i64_14(<4 x i64> %a) {
522 ; CHECK-LABEL: rshrn_v4i64_14:
523 ; CHECK: // %bb.0: // %entry
524 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #14
525 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #14
528 %b = add <4 x i64> %a, <i64 8192, i64 8192, i64 8192, i64 8192>
529 %s = lshr <4 x i64> %b, <i64 14, i64 14, i64 14, i64 14>
530 %m = trunc <4 x i64> %s to <4 x i32>
534 define <4 x i32> @rshrn_v4i64_15(<4 x i64> %a) {
535 ; CHECK-LABEL: rshrn_v4i64_15:
536 ; CHECK: // %bb.0: // %entry
537 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #15
538 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #15
541 %b = add <4 x i64> %a, <i64 16384, i64 16384, i64 16384, i64 16384>
542 %s = lshr <4 x i64> %b, <i64 15, i64 15, i64 15, i64 15>
543 %m = trunc <4 x i64> %s to <4 x i32>
547 define <4 x i32> @rshrn_v4i64_16(<4 x i64> %a) {
548 ; CHECK-LABEL: rshrn_v4i64_16:
549 ; CHECK: // %bb.0: // %entry
550 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #16
551 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #16
554 %b = add <4 x i64> %a, <i64 32768, i64 32768, i64 32768, i64 32768>
555 %s = lshr <4 x i64> %b, <i64 16, i64 16, i64 16, i64 16>
556 %m = trunc <4 x i64> %s to <4 x i32>
560 define <4 x i32> @rshrn_v4i64_17(<4 x i64> %a) {
561 ; CHECK-LABEL: rshrn_v4i64_17:
562 ; CHECK: // %bb.0: // %entry
563 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #17
564 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #17
567 %b = add <4 x i64> %a, <i64 65536, i64 65536, i64 65536, i64 65536>
568 %s = lshr <4 x i64> %b, <i64 17, i64 17, i64 17, i64 17>
569 %m = trunc <4 x i64> %s to <4 x i32>
573 define <4 x i32> @rshrn_v4i64_18(<4 x i64> %a) {
574 ; CHECK-LABEL: rshrn_v4i64_18:
575 ; CHECK: // %bb.0: // %entry
576 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #18
577 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #18
580 %b = add <4 x i64> %a, <i64 131072, i64 131072, i64 131072, i64 131072>
581 %s = lshr <4 x i64> %b, <i64 18, i64 18, i64 18, i64 18>
582 %m = trunc <4 x i64> %s to <4 x i32>
586 define <4 x i32> @rshrn_v4i64_19(<4 x i64> %a) {
587 ; CHECK-LABEL: rshrn_v4i64_19:
588 ; CHECK: // %bb.0: // %entry
589 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #19
590 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #19
593 %b = add <4 x i64> %a, <i64 262144, i64 262144, i64 262144, i64 262144>
594 %s = lshr <4 x i64> %b, <i64 19, i64 19, i64 19, i64 19>
595 %m = trunc <4 x i64> %s to <4 x i32>
599 define <4 x i32> @rshrn_v4i64_20(<4 x i64> %a) {
600 ; CHECK-LABEL: rshrn_v4i64_20:
601 ; CHECK: // %bb.0: // %entry
602 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #20
603 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #20
606 %b = add <4 x i64> %a, <i64 524288, i64 524288, i64 524288, i64 524288>
607 %s = lshr <4 x i64> %b, <i64 20, i64 20, i64 20, i64 20>
608 %m = trunc <4 x i64> %s to <4 x i32>
612 define <4 x i32> @rshrn_v4i64_21(<4 x i64> %a) {
613 ; CHECK-LABEL: rshrn_v4i64_21:
614 ; CHECK: // %bb.0: // %entry
615 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #21
616 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #21
619 %b = add <4 x i64> %a, <i64 1048576, i64 1048576, i64 1048576, i64 1048576>
620 %s = lshr <4 x i64> %b, <i64 21, i64 21, i64 21, i64 21>
621 %m = trunc <4 x i64> %s to <4 x i32>
625 define <4 x i32> @rshrn_v4i64_22(<4 x i64> %a) {
626 ; CHECK-LABEL: rshrn_v4i64_22:
627 ; CHECK: // %bb.0: // %entry
628 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #22
629 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #22
632 %b = add <4 x i64> %a, <i64 2097152, i64 2097152, i64 2097152, i64 2097152>
633 %s = lshr <4 x i64> %b, <i64 22, i64 22, i64 22, i64 22>
634 %m = trunc <4 x i64> %s to <4 x i32>
638 define <4 x i32> @rshrn_v4i64_23(<4 x i64> %a) {
639 ; CHECK-LABEL: rshrn_v4i64_23:
640 ; CHECK: // %bb.0: // %entry
641 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #23
642 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #23
645 %b = add <4 x i64> %a, <i64 4194304, i64 4194304, i64 4194304, i64 4194304>
646 %s = lshr <4 x i64> %b, <i64 23, i64 23, i64 23, i64 23>
647 %m = trunc <4 x i64> %s to <4 x i32>
651 define <4 x i32> @rshrn_v4i64_24(<4 x i64> %a) {
652 ; CHECK-LABEL: rshrn_v4i64_24:
653 ; CHECK: // %bb.0: // %entry
654 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #24
655 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #24
658 %b = add <4 x i64> %a, <i64 8388608, i64 8388608, i64 8388608, i64 8388608>
659 %s = lshr <4 x i64> %b, <i64 24, i64 24, i64 24, i64 24>
660 %m = trunc <4 x i64> %s to <4 x i32>
664 define <4 x i32> @rshrn_v4i64_25(<4 x i64> %a) {
665 ; CHECK-LABEL: rshrn_v4i64_25:
666 ; CHECK: // %bb.0: // %entry
667 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #25
668 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #25
671 %b = add <4 x i64> %a, <i64 16777216, i64 16777216, i64 16777216, i64 16777216>
672 %s = lshr <4 x i64> %b, <i64 25, i64 25, i64 25, i64 25>
673 %m = trunc <4 x i64> %s to <4 x i32>
677 define <4 x i32> @rshrn_v4i64_26(<4 x i64> %a) {
678 ; CHECK-LABEL: rshrn_v4i64_26:
679 ; CHECK: // %bb.0: // %entry
680 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #26
681 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #26
684 %b = add <4 x i64> %a, <i64 33554432, i64 33554432, i64 33554432, i64 33554432>
685 %s = lshr <4 x i64> %b, <i64 26, i64 26, i64 26, i64 26>
686 %m = trunc <4 x i64> %s to <4 x i32>
690 define <4 x i32> @rshrn_v4i64_27(<4 x i64> %a) {
691 ; CHECK-LABEL: rshrn_v4i64_27:
692 ; CHECK: // %bb.0: // %entry
693 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #27
694 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #27
697 %b = add <4 x i64> %a, <i64 67108864, i64 67108864, i64 67108864, i64 67108864>
698 %s = lshr <4 x i64> %b, <i64 27, i64 27, i64 27, i64 27>
699 %m = trunc <4 x i64> %s to <4 x i32>
703 define <4 x i32> @rshrn_v4i64_28(<4 x i64> %a) {
704 ; CHECK-LABEL: rshrn_v4i64_28:
705 ; CHECK: // %bb.0: // %entry
706 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #28
707 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #28
710 %b = add <4 x i64> %a, <i64 134217728, i64 134217728, i64 134217728, i64 134217728>
711 %s = lshr <4 x i64> %b, <i64 28, i64 28, i64 28, i64 28>
712 %m = trunc <4 x i64> %s to <4 x i32>
716 define <4 x i32> @rshrn_v4i64_29(<4 x i64> %a) {
717 ; CHECK-LABEL: rshrn_v4i64_29:
718 ; CHECK: // %bb.0: // %entry
719 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #29
720 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #29
723 %b = add <4 x i64> %a, <i64 268435456, i64 268435456, i64 268435456, i64 268435456>
724 %s = lshr <4 x i64> %b, <i64 29, i64 29, i64 29, i64 29>
725 %m = trunc <4 x i64> %s to <4 x i32>
729 define <4 x i32> @rshrn_v4i64_30(<4 x i64> %a) {
730 ; CHECK-LABEL: rshrn_v4i64_30:
731 ; CHECK: // %bb.0: // %entry
732 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #30
733 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #30
736 %b = add <4 x i64> %a, <i64 536870912, i64 536870912, i64 536870912, i64 536870912>
737 %s = lshr <4 x i64> %b, <i64 30, i64 30, i64 30, i64 30>
738 %m = trunc <4 x i64> %s to <4 x i32>
742 define <4 x i32> @rshrn_v4i64_31(<4 x i64> %a) {
743 ; CHECK-LABEL: rshrn_v4i64_31:
744 ; CHECK: // %bb.0: // %entry
745 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #31
746 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #31
749 %b = add <4 x i64> %a, <i64 1073741824, i64 1073741824, i64 1073741824, i64 1073741824>
750 %s = lshr <4 x i64> %b, <i64 31, i64 31, i64 31, i64 31>
751 %m = trunc <4 x i64> %s to <4 x i32>
755 define <4 x i32> @rshrn_v4i64_32(<4 x i64> %a) {
756 ; CHECK-LABEL: rshrn_v4i64_32:
757 ; CHECK: // %bb.0: // %entry
758 ; CHECK-NEXT: movi v2.2d, #0000000000000000
759 ; CHECK-NEXT: raddhn v0.2s, v0.2d, v2.2d
760 ; CHECK-NEXT: raddhn2 v0.4s, v1.2d, v2.2d
763 %b = add <4 x i64> %a, <i64 2147483648, i64 2147483648, i64 2147483648, i64 2147483648>
764 %s = lshr <4 x i64> %b, <i64 32, i64 32, i64 32, i64 32>
765 %m = trunc <4 x i64> %s to <4 x i32>
769 define <4 x i32> @rshrn_v4i64_33(<4 x i64> %a) {
770 ; CHECK-LABEL: rshrn_v4i64_33:
771 ; CHECK: // %bb.0: // %entry
772 ; CHECK-NEXT: mov x8, #4294967296 // =0x100000000
773 ; CHECK-NEXT: dup v2.2d, x8
774 ; CHECK-NEXT: add v0.2d, v0.2d, v2.2d
775 ; CHECK-NEXT: add v1.2d, v1.2d, v2.2d
776 ; CHECK-NEXT: ushr v1.2d, v1.2d, #33
777 ; CHECK-NEXT: ushr v0.2d, v0.2d, #33
778 ; CHECK-NEXT: uzp1 v0.4s, v0.4s, v1.4s
781 %b = add <4 x i64> %a, <i64 4294967296, i64 4294967296, i64 4294967296, i64 4294967296>
782 %s = lshr <4 x i64> %b, <i64 33, i64 33, i64 33, i64 33>
783 %m = trunc <4 x i64> %s to <4 x i32>
787 define <8 x i8> @rshrn_v8i16_5(<8 x i16> %a) {
788 ; CHECK-LABEL: rshrn_v8i16_5:
789 ; CHECK: // %bb.0: // %entry
790 ; CHECK-NEXT: rshrn v0.8b, v0.8h, #5
793 %b = add <8 x i16> %a, <i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16>
794 %s = lshr <8 x i16> %b, <i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5>
795 %m = trunc <8 x i16> %s to <8 x i8>
799 define <4 x i16> @rshrn_v4i32_4(<4 x i32> %a) {
800 ; CHECK-LABEL: rshrn_v4i32_4:
801 ; CHECK: // %bb.0: // %entry
802 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #4
805 %b = add <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
806 %s = lshr <4 x i32> %b, <i32 4, i32 4, i32 4, i32 4>
807 %m = trunc <4 x i32> %s to <4 x i16>
811 define <2 x i32> @rshrn_v2i64_5(<2 x i64> %a) {
812 ; CHECK-LABEL: rshrn_v2i64_5:
813 ; CHECK: // %bb.0: // %entry
814 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #5
817 %b = add <2 x i64> %a, <i64 16, i64 16>
818 %s = lshr <2 x i64> %b, <i64 5, i64 5>
819 %m = trunc <2 x i64> %s to <2 x i32>
823 define void @rshrn_v8i32i8_5(<8 x i32> %a, ptr %p) {
824 ; CHECK-LABEL: rshrn_v8i32i8_5:
825 ; CHECK: // %bb.0: // %entry
826 ; CHECK-NEXT: uzp1 v0.8h, v0.8h, v1.8h
827 ; CHECK-NEXT: rshrn v0.8b, v0.8h, #5
828 ; CHECK-NEXT: str d0, [x0]
831 %b = add <8 x i32> %a, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
832 %s = lshr <8 x i32> %b, <i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5>
833 %m = trunc <8 x i32> %s to <8 x i8>
834 store <8 x i8> %m, ptr %p
838 define void @rshrn_v4i64i16_4(<4 x i64> %a, ptr %p) {
839 ; CHECK-LABEL: rshrn_v4i64i16_4:
840 ; CHECK: // %bb.0: // %entry
841 ; CHECK-NEXT: uzp1 v0.4s, v0.4s, v1.4s
842 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #4
843 ; CHECK-NEXT: str d0, [x0]
846 %b = add <4 x i64> %a, <i64 8, i64 8, i64 8, i64 8>
847 %s = lshr <4 x i64> %b, <i64 4, i64 4, i64 4, i64 4>
848 %m = trunc <4 x i64> %s to <4 x i16>
849 store <4 x i16> %m, ptr %p
853 define void @rshrn_v4i16_5(<4 x i16> %a, ptr %p) {
854 ; CHECK-LABEL: rshrn_v4i16_5:
855 ; CHECK: // %bb.0: // %entry
856 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
857 ; CHECK-NEXT: rshrn v0.8b, v0.8h, #5
858 ; CHECK-NEXT: str s0, [x0]
861 %b = add <4 x i16> %a, <i16 16, i16 16, i16 16, i16 16>
862 %s = lshr <4 x i16> %b, <i16 5, i16 5, i16 5, i16 5>
863 %m = trunc <4 x i16> %s to <4 x i8>
864 store <4 x i8> %m, ptr %p
868 define void @rshrn_v2i32_4(<2 x i32> %a, ptr %p) {
869 ; CHECK-LABEL: rshrn_v2i32_4:
870 ; CHECK: // %bb.0: // %entry
871 ; CHECK-NEXT: movi v1.2s, #8
872 ; CHECK-NEXT: add v0.2s, v0.2s, v1.2s
873 ; CHECK-NEXT: ushr v0.2s, v0.2s, #4
874 ; CHECK-NEXT: mov w8, v0.s[1]
875 ; CHECK-NEXT: fmov w9, s0
876 ; CHECK-NEXT: strh w9, [x0]
877 ; CHECK-NEXT: strh w8, [x0, #2]
880 %b = add <2 x i32> %a, <i32 8, i32 8>
881 %s = lshr <2 x i32> %b, <i32 4, i32 4>
882 %m = trunc <2 x i32> %s to <2 x i16>
883 store <2 x i16> %m, ptr %p
887 define void @rshrn_v1i64_5(<1 x i64> %a, ptr %p) {
888 ; CHECK-LABEL: rshrn_v1i64_5:
889 ; CHECK: // %bb.0: // %entry
890 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
891 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #5
892 ; CHECK-NEXT: str s0, [x0]
895 %b = add <1 x i64> %a, <i64 16>
896 %s = lshr <1 x i64> %b, <i64 5>
897 %m = trunc <1 x i64> %s to <1 x i32>
898 store <1 x i32> %m, ptr %p