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 v1.8h, v1.8h, v2.8h
114 ; CHECK-NEXT: add v0.8h, v0.8h, v2.8h
115 ; CHECK-NEXT: uzp2 v0.16b, v0.16b, v1.16b
116 ; CHECK-NEXT: ushr v0.16b, v0.16b, #1
119 %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>
120 %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>
121 %m = trunc <16 x i16> %s to <16 x i8>
125 define <8 x i16> @rshrn_v8i32_1(<8 x i32> %a) {
126 ; CHECK-LABEL: rshrn_v8i32_1:
127 ; CHECK: // %bb.0: // %entry
128 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #1
129 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #1
132 %b = add <8 x i32> %a, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
133 %s = lshr <8 x i32> %b, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
134 %m = trunc <8 x i32> %s to <8 x i16>
138 define <8 x i16> @rshrn_v8i32_2(<8 x i32> %a) {
139 ; CHECK-LABEL: rshrn_v8i32_2:
140 ; CHECK: // %bb.0: // %entry
141 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #2
142 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #2
145 %b = add <8 x i32> %a, <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
146 %s = lshr <8 x i32> %b, <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
147 %m = trunc <8 x i32> %s to <8 x i16>
151 define <8 x i16> @rshrn_v8i32_3(<8 x i32> %a) {
152 ; CHECK-LABEL: rshrn_v8i32_3:
153 ; CHECK: // %bb.0: // %entry
154 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #3
155 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #3
158 %b = add <8 x i32> %a, <i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4>
159 %s = lshr <8 x i32> %b, <i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3>
160 %m = trunc <8 x i32> %s to <8 x i16>
164 define <8 x i16> @rshrn_v8i32_4(<8 x i32> %a) {
165 ; CHECK-LABEL: rshrn_v8i32_4:
166 ; CHECK: // %bb.0: // %entry
167 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #4
168 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #4
171 %b = add <8 x i32> %a, <i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8>
172 %s = lshr <8 x i32> %b, <i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4>
173 %m = trunc <8 x i32> %s to <8 x i16>
177 define <8 x i16> @rshrn_v8i32_5(<8 x i32> %a) {
178 ; CHECK-LABEL: rshrn_v8i32_5:
179 ; CHECK: // %bb.0: // %entry
180 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #5
181 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #5
184 %b = add <8 x i32> %a, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
185 %s = lshr <8 x i32> %b, <i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5>
186 %m = trunc <8 x i32> %s to <8 x i16>
190 define <8 x i16> @rshrn_v8i32_6(<8 x i32> %a) {
191 ; CHECK-LABEL: rshrn_v8i32_6:
192 ; CHECK: // %bb.0: // %entry
193 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #6
194 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #6
197 %b = add <8 x i32> %a, <i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32>
198 %s = lshr <8 x i32> %b, <i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6>
199 %m = trunc <8 x i32> %s to <8 x i16>
203 define <8 x i16> @rshrn_v8i32_7(<8 x i32> %a) {
204 ; CHECK-LABEL: rshrn_v8i32_7:
205 ; CHECK: // %bb.0: // %entry
206 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #7
207 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #7
210 %b = add <8 x i32> %a, <i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64>
211 %s = lshr <8 x i32> %b, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
212 %m = trunc <8 x i32> %s to <8 x i16>
216 define <8 x i16> @rshrn_v8i32_8(<8 x i32> %a) {
217 ; CHECK-LABEL: rshrn_v8i32_8:
218 ; CHECK: // %bb.0: // %entry
219 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #8
220 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #8
223 %b = add <8 x i32> %a, <i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128>
224 %s = lshr <8 x i32> %b, <i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8>
225 %m = trunc <8 x i32> %s to <8 x i16>
229 define <8 x i16> @rshrn_v8i32_9(<8 x i32> %a) {
230 ; CHECK-LABEL: rshrn_v8i32_9:
231 ; CHECK: // %bb.0: // %entry
232 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #9
233 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #9
236 %b = add <8 x i32> %a, <i32 256, i32 256, i32 256, i32 256, i32 256, i32 256, i32 256, i32 256>
237 %s = lshr <8 x i32> %b, <i32 9, i32 9, i32 9, i32 9, i32 9, i32 9, i32 9, i32 9>
238 %m = trunc <8 x i32> %s to <8 x i16>
242 define <8 x i16> @rshrn_v8i32_10(<8 x i32> %a) {
243 ; CHECK-LABEL: rshrn_v8i32_10:
244 ; CHECK: // %bb.0: // %entry
245 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #10
246 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #10
249 %b = add <8 x i32> %a, <i32 512, i32 512, i32 512, i32 512, i32 512, i32 512, i32 512, i32 512>
250 %s = lshr <8 x i32> %b, <i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10>
251 %m = trunc <8 x i32> %s to <8 x i16>
255 define <8 x i16> @rshrn_v8i32_11(<8 x i32> %a) {
256 ; CHECK-LABEL: rshrn_v8i32_11:
257 ; CHECK: // %bb.0: // %entry
258 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #11
259 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #11
262 %b = add <8 x i32> %a, <i32 1024, i32 1024, i32 1024, i32 1024, i32 1024, i32 1024, i32 1024, i32 1024>
263 %s = lshr <8 x i32> %b, <i32 11, i32 11, i32 11, i32 11, i32 11, i32 11, i32 11, i32 11>
264 %m = trunc <8 x i32> %s to <8 x i16>
268 define <8 x i16> @rshrn_v8i32_12(<8 x i32> %a) {
269 ; CHECK-LABEL: rshrn_v8i32_12:
270 ; CHECK: // %bb.0: // %entry
271 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #12
272 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #12
275 %b = add <8 x i32> %a, <i32 2048, i32 2048, i32 2048, i32 2048, i32 2048, i32 2048, i32 2048, i32 2048>
276 %s = lshr <8 x i32> %b, <i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12>
277 %m = trunc <8 x i32> %s to <8 x i16>
281 define <8 x i16> @rshrn_v8i32_13(<8 x i32> %a) {
282 ; CHECK-LABEL: rshrn_v8i32_13:
283 ; CHECK: // %bb.0: // %entry
284 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #13
285 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #13
288 %b = add <8 x i32> %a, <i32 4096, i32 4096, i32 4096, i32 4096, i32 4096, i32 4096, i32 4096, i32 4096>
289 %s = lshr <8 x i32> %b, <i32 13, i32 13, i32 13, i32 13, i32 13, i32 13, i32 13, i32 13>
290 %m = trunc <8 x i32> %s to <8 x i16>
294 define <8 x i16> @rshrn_v8i32_14(<8 x i32> %a) {
295 ; CHECK-LABEL: rshrn_v8i32_14:
296 ; CHECK: // %bb.0: // %entry
297 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #14
298 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #14
301 %b = add <8 x i32> %a, <i32 8192, i32 8192, i32 8192, i32 8192, i32 8192, i32 8192, i32 8192, i32 8192>
302 %s = lshr <8 x i32> %b, <i32 14, i32 14, i32 14, i32 14, i32 14, i32 14, i32 14, i32 14>
303 %m = trunc <8 x i32> %s to <8 x i16>
307 define <8 x i16> @rshrn_v8i32_15(<8 x i32> %a) {
308 ; CHECK-LABEL: rshrn_v8i32_15:
309 ; CHECK: // %bb.0: // %entry
310 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #15
311 ; CHECK-NEXT: rshrn2 v0.8h, v1.4s, #15
314 %b = add <8 x i32> %a, <i32 16384, i32 16384, i32 16384, i32 16384, i32 16384, i32 16384, i32 16384, i32 16384>
315 %s = lshr <8 x i32> %b, <i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15>
316 %m = trunc <8 x i32> %s to <8 x i16>
320 define <8 x i16> @rshrn_v8i32_16(<8 x i32> %a) {
321 ; CHECK-LABEL: rshrn_v8i32_16:
322 ; CHECK: // %bb.0: // %entry
323 ; CHECK-NEXT: movi v2.2d, #0000000000000000
324 ; CHECK-NEXT: raddhn v0.4h, v0.4s, v2.4s
325 ; CHECK-NEXT: raddhn2 v0.8h, v1.4s, v2.4s
328 %b = add <8 x i32> %a, <i32 32768, i32 32768, i32 32768, i32 32768, i32 32768, i32 32768, i32 32768, i32 32768>
329 %s = lshr <8 x i32> %b, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
330 %m = trunc <8 x i32> %s to <8 x i16>
334 define <8 x i16> @rshrn_v8i32_17(<8 x i32> %a) {
335 ; CHECK-LABEL: rshrn_v8i32_17:
336 ; CHECK: // %bb.0: // %entry
337 ; CHECK-NEXT: movi v2.4s, #1, lsl #16
338 ; CHECK-NEXT: add v1.4s, v1.4s, v2.4s
339 ; CHECK-NEXT: add v0.4s, v0.4s, v2.4s
340 ; CHECK-NEXT: uzp2 v0.8h, v0.8h, v1.8h
341 ; CHECK-NEXT: ushr v0.8h, v0.8h, #1
344 %b = add <8 x i32> %a, <i32 65536, i32 65536, i32 65536, i32 65536, i32 65536, i32 65536, i32 65536, i32 65536>
345 %s = lshr <8 x i32> %b, <i32 17, i32 17, i32 17, i32 17, i32 17, i32 17, i32 17, i32 17>
346 %m = trunc <8 x i32> %s to <8 x i16>
350 define <4 x i32> @rshrn_v4i64_1(<4 x i64> %a) {
351 ; CHECK-LABEL: rshrn_v4i64_1:
352 ; CHECK: // %bb.0: // %entry
353 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #1
354 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #1
357 %b = add <4 x i64> %a, <i64 1, i64 1, i64 1, i64 1>
358 %s = lshr <4 x i64> %b, <i64 1, i64 1, i64 1, i64 1>
359 %m = trunc <4 x i64> %s to <4 x i32>
363 define <4 x i32> @rshrn_v4i64_2(<4 x i64> %a) {
364 ; CHECK-LABEL: rshrn_v4i64_2:
365 ; CHECK: // %bb.0: // %entry
366 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #2
367 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #2
370 %b = add <4 x i64> %a, <i64 2, i64 2, i64 2, i64 2>
371 %s = lshr <4 x i64> %b, <i64 2, i64 2, i64 2, i64 2>
372 %m = trunc <4 x i64> %s to <4 x i32>
376 define <4 x i32> @rshrn_v4i64_3(<4 x i64> %a) {
377 ; CHECK-LABEL: rshrn_v4i64_3:
378 ; CHECK: // %bb.0: // %entry
379 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #3
380 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #3
383 %b = add <4 x i64> %a, <i64 4, i64 4, i64 4, i64 4>
384 %s = lshr <4 x i64> %b, <i64 3, i64 3, i64 3, i64 3>
385 %m = trunc <4 x i64> %s to <4 x i32>
389 define <4 x i32> @rshrn_v4i64_4(<4 x i64> %a) {
390 ; CHECK-LABEL: rshrn_v4i64_4:
391 ; CHECK: // %bb.0: // %entry
392 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #4
393 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #4
396 %b = add <4 x i64> %a, <i64 8, i64 8, i64 8, i64 8>
397 %s = lshr <4 x i64> %b, <i64 4, i64 4, i64 4, i64 4>
398 %m = trunc <4 x i64> %s to <4 x i32>
402 define <4 x i32> @rshrn_v4i64_5(<4 x i64> %a) {
403 ; CHECK-LABEL: rshrn_v4i64_5:
404 ; CHECK: // %bb.0: // %entry
405 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #5
406 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #5
409 %b = add <4 x i64> %a, <i64 16, i64 16, i64 16, i64 16>
410 %s = lshr <4 x i64> %b, <i64 5, i64 5, i64 5, i64 5>
411 %m = trunc <4 x i64> %s to <4 x i32>
415 define <4 x i32> @rshrn_v4i64_6(<4 x i64> %a) {
416 ; CHECK-LABEL: rshrn_v4i64_6:
417 ; CHECK: // %bb.0: // %entry
418 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #6
419 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #6
422 %b = add <4 x i64> %a, <i64 32, i64 32, i64 32, i64 32>
423 %s = lshr <4 x i64> %b, <i64 6, i64 6, i64 6, i64 6>
424 %m = trunc <4 x i64> %s to <4 x i32>
428 define <4 x i32> @rshrn_v4i64_7(<4 x i64> %a) {
429 ; CHECK-LABEL: rshrn_v4i64_7:
430 ; CHECK: // %bb.0: // %entry
431 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #7
432 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #7
435 %b = add <4 x i64> %a, <i64 64, i64 64, i64 64, i64 64>
436 %s = lshr <4 x i64> %b, <i64 7, i64 7, i64 7, i64 7>
437 %m = trunc <4 x i64> %s to <4 x i32>
441 define <4 x i32> @rshrn_v4i64_8(<4 x i64> %a) {
442 ; CHECK-LABEL: rshrn_v4i64_8:
443 ; CHECK: // %bb.0: // %entry
444 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #8
445 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #8
448 %b = add <4 x i64> %a, <i64 128, i64 128, i64 128, i64 128>
449 %s = lshr <4 x i64> %b, <i64 8, i64 8, i64 8, i64 8>
450 %m = trunc <4 x i64> %s to <4 x i32>
454 define <4 x i32> @rshrn_v4i64_9(<4 x i64> %a) {
455 ; CHECK-LABEL: rshrn_v4i64_9:
456 ; CHECK: // %bb.0: // %entry
457 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #9
458 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #9
461 %b = add <4 x i64> %a, <i64 256, i64 256, i64 256, i64 256>
462 %s = lshr <4 x i64> %b, <i64 9, i64 9, i64 9, i64 9>
463 %m = trunc <4 x i64> %s to <4 x i32>
467 define <4 x i32> @rshrn_v4i64_10(<4 x i64> %a) {
468 ; CHECK-LABEL: rshrn_v4i64_10:
469 ; CHECK: // %bb.0: // %entry
470 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #10
471 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #10
474 %b = add <4 x i64> %a, <i64 512, i64 512, i64 512, i64 512>
475 %s = lshr <4 x i64> %b, <i64 10, i64 10, i64 10, i64 10>
476 %m = trunc <4 x i64> %s to <4 x i32>
480 define <4 x i32> @rshrn_v4i64_11(<4 x i64> %a) {
481 ; CHECK-LABEL: rshrn_v4i64_11:
482 ; CHECK: // %bb.0: // %entry
483 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #11
484 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #11
487 %b = add <4 x i64> %a, <i64 1024, i64 1024, i64 1024, i64 1024>
488 %s = lshr <4 x i64> %b, <i64 11, i64 11, i64 11, i64 11>
489 %m = trunc <4 x i64> %s to <4 x i32>
493 define <4 x i32> @rshrn_v4i64_12(<4 x i64> %a) {
494 ; CHECK-LABEL: rshrn_v4i64_12:
495 ; CHECK: // %bb.0: // %entry
496 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #12
497 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #12
500 %b = add <4 x i64> %a, <i64 2048, i64 2048, i64 2048, i64 2048>
501 %s = lshr <4 x i64> %b, <i64 12, i64 12, i64 12, i64 12>
502 %m = trunc <4 x i64> %s to <4 x i32>
506 define <4 x i32> @rshrn_v4i64_13(<4 x i64> %a) {
507 ; CHECK-LABEL: rshrn_v4i64_13:
508 ; CHECK: // %bb.0: // %entry
509 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #13
510 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #13
513 %b = add <4 x i64> %a, <i64 4096, i64 4096, i64 4096, i64 4096>
514 %s = lshr <4 x i64> %b, <i64 13, i64 13, i64 13, i64 13>
515 %m = trunc <4 x i64> %s to <4 x i32>
519 define <4 x i32> @rshrn_v4i64_14(<4 x i64> %a) {
520 ; CHECK-LABEL: rshrn_v4i64_14:
521 ; CHECK: // %bb.0: // %entry
522 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #14
523 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #14
526 %b = add <4 x i64> %a, <i64 8192, i64 8192, i64 8192, i64 8192>
527 %s = lshr <4 x i64> %b, <i64 14, i64 14, i64 14, i64 14>
528 %m = trunc <4 x i64> %s to <4 x i32>
532 define <4 x i32> @rshrn_v4i64_15(<4 x i64> %a) {
533 ; CHECK-LABEL: rshrn_v4i64_15:
534 ; CHECK: // %bb.0: // %entry
535 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #15
536 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #15
539 %b = add <4 x i64> %a, <i64 16384, i64 16384, i64 16384, i64 16384>
540 %s = lshr <4 x i64> %b, <i64 15, i64 15, i64 15, i64 15>
541 %m = trunc <4 x i64> %s to <4 x i32>
545 define <4 x i32> @rshrn_v4i64_16(<4 x i64> %a) {
546 ; CHECK-LABEL: rshrn_v4i64_16:
547 ; CHECK: // %bb.0: // %entry
548 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #16
549 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #16
552 %b = add <4 x i64> %a, <i64 32768, i64 32768, i64 32768, i64 32768>
553 %s = lshr <4 x i64> %b, <i64 16, i64 16, i64 16, i64 16>
554 %m = trunc <4 x i64> %s to <4 x i32>
558 define <4 x i32> @rshrn_v4i64_17(<4 x i64> %a) {
559 ; CHECK-LABEL: rshrn_v4i64_17:
560 ; CHECK: // %bb.0: // %entry
561 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #17
562 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #17
565 %b = add <4 x i64> %a, <i64 65536, i64 65536, i64 65536, i64 65536>
566 %s = lshr <4 x i64> %b, <i64 17, i64 17, i64 17, i64 17>
567 %m = trunc <4 x i64> %s to <4 x i32>
571 define <4 x i32> @rshrn_v4i64_18(<4 x i64> %a) {
572 ; CHECK-LABEL: rshrn_v4i64_18:
573 ; CHECK: // %bb.0: // %entry
574 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #18
575 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #18
578 %b = add <4 x i64> %a, <i64 131072, i64 131072, i64 131072, i64 131072>
579 %s = lshr <4 x i64> %b, <i64 18, i64 18, i64 18, i64 18>
580 %m = trunc <4 x i64> %s to <4 x i32>
584 define <4 x i32> @rshrn_v4i64_19(<4 x i64> %a) {
585 ; CHECK-LABEL: rshrn_v4i64_19:
586 ; CHECK: // %bb.0: // %entry
587 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #19
588 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #19
591 %b = add <4 x i64> %a, <i64 262144, i64 262144, i64 262144, i64 262144>
592 %s = lshr <4 x i64> %b, <i64 19, i64 19, i64 19, i64 19>
593 %m = trunc <4 x i64> %s to <4 x i32>
597 define <4 x i32> @rshrn_v4i64_20(<4 x i64> %a) {
598 ; CHECK-LABEL: rshrn_v4i64_20:
599 ; CHECK: // %bb.0: // %entry
600 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #20
601 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #20
604 %b = add <4 x i64> %a, <i64 524288, i64 524288, i64 524288, i64 524288>
605 %s = lshr <4 x i64> %b, <i64 20, i64 20, i64 20, i64 20>
606 %m = trunc <4 x i64> %s to <4 x i32>
610 define <4 x i32> @rshrn_v4i64_21(<4 x i64> %a) {
611 ; CHECK-LABEL: rshrn_v4i64_21:
612 ; CHECK: // %bb.0: // %entry
613 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #21
614 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #21
617 %b = add <4 x i64> %a, <i64 1048576, i64 1048576, i64 1048576, i64 1048576>
618 %s = lshr <4 x i64> %b, <i64 21, i64 21, i64 21, i64 21>
619 %m = trunc <4 x i64> %s to <4 x i32>
623 define <4 x i32> @rshrn_v4i64_22(<4 x i64> %a) {
624 ; CHECK-LABEL: rshrn_v4i64_22:
625 ; CHECK: // %bb.0: // %entry
626 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #22
627 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #22
630 %b = add <4 x i64> %a, <i64 2097152, i64 2097152, i64 2097152, i64 2097152>
631 %s = lshr <4 x i64> %b, <i64 22, i64 22, i64 22, i64 22>
632 %m = trunc <4 x i64> %s to <4 x i32>
636 define <4 x i32> @rshrn_v4i64_23(<4 x i64> %a) {
637 ; CHECK-LABEL: rshrn_v4i64_23:
638 ; CHECK: // %bb.0: // %entry
639 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #23
640 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #23
643 %b = add <4 x i64> %a, <i64 4194304, i64 4194304, i64 4194304, i64 4194304>
644 %s = lshr <4 x i64> %b, <i64 23, i64 23, i64 23, i64 23>
645 %m = trunc <4 x i64> %s to <4 x i32>
649 define <4 x i32> @rshrn_v4i64_24(<4 x i64> %a) {
650 ; CHECK-LABEL: rshrn_v4i64_24:
651 ; CHECK: // %bb.0: // %entry
652 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #24
653 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #24
656 %b = add <4 x i64> %a, <i64 8388608, i64 8388608, i64 8388608, i64 8388608>
657 %s = lshr <4 x i64> %b, <i64 24, i64 24, i64 24, i64 24>
658 %m = trunc <4 x i64> %s to <4 x i32>
662 define <4 x i32> @rshrn_v4i64_25(<4 x i64> %a) {
663 ; CHECK-LABEL: rshrn_v4i64_25:
664 ; CHECK: // %bb.0: // %entry
665 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #25
666 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #25
669 %b = add <4 x i64> %a, <i64 16777216, i64 16777216, i64 16777216, i64 16777216>
670 %s = lshr <4 x i64> %b, <i64 25, i64 25, i64 25, i64 25>
671 %m = trunc <4 x i64> %s to <4 x i32>
675 define <4 x i32> @rshrn_v4i64_26(<4 x i64> %a) {
676 ; CHECK-LABEL: rshrn_v4i64_26:
677 ; CHECK: // %bb.0: // %entry
678 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #26
679 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #26
682 %b = add <4 x i64> %a, <i64 33554432, i64 33554432, i64 33554432, i64 33554432>
683 %s = lshr <4 x i64> %b, <i64 26, i64 26, i64 26, i64 26>
684 %m = trunc <4 x i64> %s to <4 x i32>
688 define <4 x i32> @rshrn_v4i64_27(<4 x i64> %a) {
689 ; CHECK-LABEL: rshrn_v4i64_27:
690 ; CHECK: // %bb.0: // %entry
691 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #27
692 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #27
695 %b = add <4 x i64> %a, <i64 67108864, i64 67108864, i64 67108864, i64 67108864>
696 %s = lshr <4 x i64> %b, <i64 27, i64 27, i64 27, i64 27>
697 %m = trunc <4 x i64> %s to <4 x i32>
701 define <4 x i32> @rshrn_v4i64_28(<4 x i64> %a) {
702 ; CHECK-LABEL: rshrn_v4i64_28:
703 ; CHECK: // %bb.0: // %entry
704 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #28
705 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #28
708 %b = add <4 x i64> %a, <i64 134217728, i64 134217728, i64 134217728, i64 134217728>
709 %s = lshr <4 x i64> %b, <i64 28, i64 28, i64 28, i64 28>
710 %m = trunc <4 x i64> %s to <4 x i32>
714 define <4 x i32> @rshrn_v4i64_29(<4 x i64> %a) {
715 ; CHECK-LABEL: rshrn_v4i64_29:
716 ; CHECK: // %bb.0: // %entry
717 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #29
718 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #29
721 %b = add <4 x i64> %a, <i64 268435456, i64 268435456, i64 268435456, i64 268435456>
722 %s = lshr <4 x i64> %b, <i64 29, i64 29, i64 29, i64 29>
723 %m = trunc <4 x i64> %s to <4 x i32>
727 define <4 x i32> @rshrn_v4i64_30(<4 x i64> %a) {
728 ; CHECK-LABEL: rshrn_v4i64_30:
729 ; CHECK: // %bb.0: // %entry
730 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #30
731 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #30
734 %b = add <4 x i64> %a, <i64 536870912, i64 536870912, i64 536870912, i64 536870912>
735 %s = lshr <4 x i64> %b, <i64 30, i64 30, i64 30, i64 30>
736 %m = trunc <4 x i64> %s to <4 x i32>
740 define <4 x i32> @rshrn_v4i64_31(<4 x i64> %a) {
741 ; CHECK-LABEL: rshrn_v4i64_31:
742 ; CHECK: // %bb.0: // %entry
743 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #31
744 ; CHECK-NEXT: rshrn2 v0.4s, v1.2d, #31
747 %b = add <4 x i64> %a, <i64 1073741824, i64 1073741824, i64 1073741824, i64 1073741824>
748 %s = lshr <4 x i64> %b, <i64 31, i64 31, i64 31, i64 31>
749 %m = trunc <4 x i64> %s to <4 x i32>
753 define <4 x i32> @rshrn_v4i64_32(<4 x i64> %a) {
754 ; CHECK-LABEL: rshrn_v4i64_32:
755 ; CHECK: // %bb.0: // %entry
756 ; CHECK-NEXT: movi v2.2d, #0000000000000000
757 ; CHECK-NEXT: raddhn v0.2s, v0.2d, v2.2d
758 ; CHECK-NEXT: raddhn2 v0.4s, v1.2d, v2.2d
761 %b = add <4 x i64> %a, <i64 2147483648, i64 2147483648, i64 2147483648, i64 2147483648>
762 %s = lshr <4 x i64> %b, <i64 32, i64 32, i64 32, i64 32>
763 %m = trunc <4 x i64> %s to <4 x i32>
767 define <4 x i32> @rshrn_v4i64_33(<4 x i64> %a) {
768 ; CHECK-LABEL: rshrn_v4i64_33:
769 ; CHECK: // %bb.0: // %entry
770 ; CHECK-NEXT: mov x8, #4294967296 // =0x100000000
771 ; CHECK-NEXT: dup v2.2d, x8
772 ; CHECK-NEXT: add v1.2d, v1.2d, v2.2d
773 ; CHECK-NEXT: add v0.2d, v0.2d, v2.2d
774 ; CHECK-NEXT: uzp2 v0.4s, v0.4s, v1.4s
775 ; CHECK-NEXT: ushr v0.4s, v0.4s, #1
778 %b = add <4 x i64> %a, <i64 4294967296, i64 4294967296, i64 4294967296, i64 4294967296>
779 %s = lshr <4 x i64> %b, <i64 33, i64 33, i64 33, i64 33>
780 %m = trunc <4 x i64> %s to <4 x i32>
784 define <8 x i8> @rshrn_v8i16_5(<8 x i16> %a) {
785 ; CHECK-LABEL: rshrn_v8i16_5:
786 ; CHECK: // %bb.0: // %entry
787 ; CHECK-NEXT: rshrn v0.8b, v0.8h, #5
790 %b = add <8 x i16> %a, <i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16>
791 %s = lshr <8 x i16> %b, <i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5>
792 %m = trunc <8 x i16> %s to <8 x i8>
796 define <4 x i16> @rshrn_v4i32_4(<4 x i32> %a) {
797 ; CHECK-LABEL: rshrn_v4i32_4:
798 ; CHECK: // %bb.0: // %entry
799 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #4
802 %b = add <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
803 %s = lshr <4 x i32> %b, <i32 4, i32 4, i32 4, i32 4>
804 %m = trunc <4 x i32> %s to <4 x i16>
808 define <2 x i32> @rshrn_v2i64_5(<2 x i64> %a) {
809 ; CHECK-LABEL: rshrn_v2i64_5:
810 ; CHECK: // %bb.0: // %entry
811 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #5
814 %b = add <2 x i64> %a, <i64 16, i64 16>
815 %s = lshr <2 x i64> %b, <i64 5, i64 5>
816 %m = trunc <2 x i64> %s to <2 x i32>
820 define void @rshrn_v8i32i8_5(<8 x i32> %a, ptr %p) {
821 ; CHECK-LABEL: rshrn_v8i32i8_5:
822 ; CHECK: // %bb.0: // %entry
823 ; CHECK-NEXT: uzp1 v0.8h, v0.8h, v1.8h
824 ; CHECK-NEXT: rshrn v0.8b, v0.8h, #5
825 ; CHECK-NEXT: str d0, [x0]
828 %b = add <8 x i32> %a, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
829 %s = lshr <8 x i32> %b, <i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5>
830 %m = trunc <8 x i32> %s to <8 x i8>
831 store <8 x i8> %m, ptr %p
835 define void @rshrn_v4i64i16_4(<4 x i64> %a, ptr %p) {
836 ; CHECK-LABEL: rshrn_v4i64i16_4:
837 ; CHECK: // %bb.0: // %entry
838 ; CHECK-NEXT: uzp1 v0.4s, v0.4s, v1.4s
839 ; CHECK-NEXT: rshrn v0.4h, v0.4s, #4
840 ; CHECK-NEXT: str d0, [x0]
843 %b = add <4 x i64> %a, <i64 8, i64 8, i64 8, i64 8>
844 %s = lshr <4 x i64> %b, <i64 4, i64 4, i64 4, i64 4>
845 %m = trunc <4 x i64> %s to <4 x i16>
846 store <4 x i16> %m, ptr %p
850 define void @rshrn_v4i16_5(<4 x i16> %a, ptr %p) {
851 ; CHECK-LABEL: rshrn_v4i16_5:
852 ; CHECK: // %bb.0: // %entry
853 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
854 ; CHECK-NEXT: rshrn v0.8b, v0.8h, #5
855 ; CHECK-NEXT: str s0, [x0]
858 %b = add <4 x i16> %a, <i16 16, i16 16, i16 16, i16 16>
859 %s = lshr <4 x i16> %b, <i16 5, i16 5, i16 5, i16 5>
860 %m = trunc <4 x i16> %s to <4 x i8>
861 store <4 x i8> %m, ptr %p
865 define void @rshrn_v2i32_4(<2 x i32> %a, ptr %p) {
866 ; CHECK-LABEL: rshrn_v2i32_4:
867 ; CHECK: // %bb.0: // %entry
868 ; CHECK-NEXT: movi v1.2s, #8
869 ; CHECK-NEXT: add v0.2s, v0.2s, v1.2s
870 ; CHECK-NEXT: ushr v0.2s, v0.2s, #4
871 ; CHECK-NEXT: mov w8, v0.s[1]
872 ; CHECK-NEXT: fmov w9, s0
873 ; CHECK-NEXT: strh w9, [x0]
874 ; CHECK-NEXT: strh w8, [x0, #2]
877 %b = add <2 x i32> %a, <i32 8, i32 8>
878 %s = lshr <2 x i32> %b, <i32 4, i32 4>
879 %m = trunc <2 x i32> %s to <2 x i16>
880 store <2 x i16> %m, ptr %p
884 define void @rshrn_v1i64_5(<1 x i64> %a, ptr %p) {
885 ; CHECK-LABEL: rshrn_v1i64_5:
886 ; CHECK: // %bb.0: // %entry
887 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
888 ; CHECK-NEXT: rshrn v0.2s, v0.2d, #5
889 ; CHECK-NEXT: str s0, [x0]
892 %b = add <1 x i64> %a, <i64 16>
893 %s = lshr <1 x i64> %b, <i64 5>
894 %m = trunc <1 x i64> %s to <1 x i32>
895 store <1 x i32> %m, ptr %p