1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s | FileCheck %s
4 target triple = "aarch64-unknown-linux-gnu"
8 define <vscale x 16 x i8> @usra_i8(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b) #0 {
9 ; CHECK-LABEL: usra_i8:
11 ; CHECK-NEXT: usra z0.b, z1.b, #1
13 %ins = insertelement <vscale x 16 x i8> poison, i8 1, i32 0
14 %splat = shufflevector <vscale x 16 x i8> %ins, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
15 %shift = lshr <vscale x 16 x i8> %b, %splat
16 %add = add <vscale x 16 x i8> %a, %shift
17 ret <vscale x 16 x i8> %add
20 define <vscale x 8 x i16> @usra_i16(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b) #0 {
21 ; CHECK-LABEL: usra_i16:
23 ; CHECK-NEXT: usra z0.h, z1.h, #2
25 %ins = insertelement <vscale x 8 x i16> poison, i16 2, i32 0
26 %splat = shufflevector <vscale x 8 x i16> %ins, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
27 %shift = lshr <vscale x 8 x i16> %b, %splat
28 %add = add <vscale x 8 x i16> %a, %shift
29 ret <vscale x 8 x i16> %add
32 define <vscale x 4 x i32> @usra_i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) #0 {
33 ; CHECK-LABEL: usra_i32:
35 ; CHECK-NEXT: usra z0.s, z1.s, #3
37 %ins = insertelement <vscale x 4 x i32> poison, i32 3, i32 0
38 %splat = shufflevector <vscale x 4 x i32> %ins, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
39 %shift = lshr <vscale x 4 x i32> %b, %splat
40 %add = add <vscale x 4 x i32> %a, %shift
41 ret <vscale x 4 x i32> %add
44 define <vscale x 2 x i64> @usra_i64(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b) #0 {
45 ; CHECK-LABEL: usra_i64:
47 ; CHECK-NEXT: usra z0.d, z1.d, #4
49 %ins = insertelement <vscale x 2 x i64> poison, i64 4, i32 0
50 %splat = shufflevector <vscale x 2 x i64> %ins, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
51 %shift = lshr <vscale x 2 x i64> %b, %splat
52 %add = add <vscale x 2 x i64> %a, %shift
53 ret <vscale x 2 x i64> %add
56 define <vscale x 16 x i8> @usra_intr_i8(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b) #0 {
57 ; CHECK-LABEL: usra_intr_i8:
59 ; CHECK-NEXT: usra z0.b, z1.b, #1
61 %pg = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 31)
62 %ins = insertelement <vscale x 16 x i8> poison, i8 1, i32 0
63 %splat = shufflevector <vscale x 16 x i8> %ins, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
64 %shift = call <vscale x 16 x i8> @llvm.aarch64.sve.lsr.u.nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %b, <vscale x 16 x i8> %splat)
65 %add = add <vscale x 16 x i8> %a, %shift
66 ret <vscale x 16 x i8> %add
69 define <vscale x 8 x i16> @usra_intr_i16(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b) #0 {
70 ; CHECK-LABEL: usra_intr_i16:
72 ; CHECK-NEXT: usra z0.h, z1.h, #2
74 %pg = call <vscale x 8 x i1> @llvm.aarch64.sve.ptrue.nxv8i1(i32 31)
75 %ins = insertelement <vscale x 8 x i16> poison, i16 2, i32 0
76 %splat = shufflevector <vscale x 8 x i16> %ins, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
77 %shift = call <vscale x 8 x i16> @llvm.aarch64.sve.lsr.u.nxv8i16(<vscale x 8 x i1> %pg, <vscale x 8 x i16> %b, <vscale x 8 x i16> %splat)
78 %add = add <vscale x 8 x i16> %a, %shift
79 ret <vscale x 8 x i16> %add
82 define <vscale x 4 x i32> @usra_intr_i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) #0 {
83 ; CHECK-LABEL: usra_intr_i32:
85 ; CHECK-NEXT: usra z0.s, z1.s, #3
87 %pg = call <vscale x 4 x i1> @llvm.aarch64.sve.ptrue.nxv4i1(i32 31)
88 %ins = insertelement <vscale x 4 x i32> poison, i32 3, i32 0
89 %splat = shufflevector <vscale x 4 x i32> %ins, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
90 %shift = call <vscale x 4 x i32> @llvm.aarch64.sve.lsr.u.nxv4i32(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %b, <vscale x 4 x i32> %splat)
91 %add = add <vscale x 4 x i32> %a, %shift
92 ret <vscale x 4 x i32> %add
95 define <vscale x 2 x i64> @usra_intr_i64(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b) #0 {
96 ; CHECK-LABEL: usra_intr_i64:
98 ; CHECK-NEXT: usra z0.d, z1.d, #4
100 %pg = call <vscale x 2 x i1> @llvm.aarch64.sve.ptrue.nxv2i1(i32 31)
101 %ins = insertelement <vscale x 2 x i64> poison, i64 4, i32 0
102 %splat = shufflevector <vscale x 2 x i64> %ins, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
103 %shift = call <vscale x 2 x i64> @llvm.aarch64.sve.lsr.u.nxv2i64(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %b, <vscale x 2 x i64> %splat)
104 %add = add <vscale x 2 x i64> %a, %shift
105 ret <vscale x 2 x i64> %add
108 define <vscale x 16 x i8> @usra_intr_u_i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %a, <vscale x 16 x i8> %b) #0 {
109 ; CHECK-LABEL: usra_intr_u_i8:
111 ; CHECK-NEXT: usra z0.b, z1.b, #1
113 %ins = insertelement <vscale x 16 x i8> poison, i8 1, i32 0
114 %splat = shufflevector <vscale x 16 x i8> %ins, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
115 %shift = call <vscale x 16 x i8> @llvm.aarch64.sve.lsr.u.nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %b, <vscale x 16 x i8> %splat)
116 %add = add <vscale x 16 x i8> %a, %shift
117 ret <vscale x 16 x i8> %add
120 define <vscale x 8 x i16> @usra_intr_u_i16(<vscale x 8 x i1> %pg, <vscale x 8 x i16> %a, <vscale x 8 x i16> %b) #0 {
121 ; CHECK-LABEL: usra_intr_u_i16:
123 ; CHECK-NEXT: usra z0.h, z1.h, #2
125 %ins = insertelement <vscale x 8 x i16> poison, i16 2, i32 0
126 %splat = shufflevector <vscale x 8 x i16> %ins, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
127 %shift = call <vscale x 8 x i16> @llvm.aarch64.sve.lsr.u.nxv8i16(<vscale x 8 x i1> %pg, <vscale x 8 x i16> %b, <vscale x 8 x i16> %splat)
128 %add = add <vscale x 8 x i16> %a, %shift
129 ret <vscale x 8 x i16> %add
132 define <vscale x 4 x i32> @usra_intr_u_i32(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %a, <vscale x 4 x i32> %b) #0 {
133 ; CHECK-LABEL: usra_intr_u_i32:
135 ; CHECK-NEXT: usra z0.s, z1.s, #3
137 %ins = insertelement <vscale x 4 x i32> poison, i32 3, i32 0
138 %splat = shufflevector <vscale x 4 x i32> %ins, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
139 %shift = call <vscale x 4 x i32> @llvm.aarch64.sve.lsr.u.nxv4i32(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %b, <vscale x 4 x i32> %splat)
140 %add = add <vscale x 4 x i32> %a, %shift
141 ret <vscale x 4 x i32> %add
144 define <vscale x 2 x i64> @usra_intr_u_i64(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %a, <vscale x 2 x i64> %b) #0 {
145 ; CHECK-LABEL: usra_intr_u_i64:
147 ; CHECK-NEXT: usra z0.d, z1.d, #4
149 %ins = insertelement <vscale x 2 x i64> poison, i64 4, i32 0
150 %splat = shufflevector <vscale x 2 x i64> %ins, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
151 %shift = call <vscale x 2 x i64> @llvm.aarch64.sve.lsr.u.nxv2i64(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %b, <vscale x 2 x i64> %splat)
152 %add = add <vscale x 2 x i64> %a, %shift
153 ret <vscale x 2 x i64> %add
158 define <vscale x 16 x i8> @ssra_i8(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b) #0 {
159 ; CHECK-LABEL: ssra_i8:
161 ; CHECK-NEXT: ssra z0.b, z1.b, #1
163 %ins = insertelement <vscale x 16 x i8> poison, i8 1, i32 0
164 %splat = shufflevector <vscale x 16 x i8> %ins, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
165 %shift = ashr <vscale x 16 x i8> %b, %splat
166 %add = add <vscale x 16 x i8> %a, %shift
167 ret <vscale x 16 x i8> %add
170 define <vscale x 8 x i16> @ssra_i16(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b) #0 {
171 ; CHECK-LABEL: ssra_i16:
173 ; CHECK-NEXT: ssra z0.h, z1.h, #2
175 %ins = insertelement <vscale x 8 x i16> poison, i16 2, i32 0
176 %splat = shufflevector <vscale x 8 x i16> %ins, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
177 %shift = ashr <vscale x 8 x i16> %b, %splat
178 %add = add <vscale x 8 x i16> %a, %shift
179 ret <vscale x 8 x i16> %add
182 define <vscale x 4 x i32> @ssra_i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) #0 {
183 ; CHECK-LABEL: ssra_i32:
185 ; CHECK-NEXT: ssra z0.s, z1.s, #3
187 %ins = insertelement <vscale x 4 x i32> poison, i32 3, i32 0
188 %splat = shufflevector <vscale x 4 x i32> %ins, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
189 %shift = ashr <vscale x 4 x i32> %b, %splat
190 %add = add <vscale x 4 x i32> %a, %shift
191 ret <vscale x 4 x i32> %add
194 define <vscale x 2 x i64> @ssra_i64(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b) #0 {
195 ; CHECK-LABEL: ssra_i64:
197 ; CHECK-NEXT: ssra z0.d, z1.d, #4
199 %ins = insertelement <vscale x 2 x i64> poison, i64 4, i32 0
200 %splat = shufflevector <vscale x 2 x i64> %ins, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
201 %shift = ashr <vscale x 2 x i64> %b, %splat
202 %add = add <vscale x 2 x i64> %a, %shift
203 ret <vscale x 2 x i64> %add
206 define <vscale x 16 x i8> @ssra_intr_i8(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b) #0 {
207 ; CHECK-LABEL: ssra_intr_i8:
209 ; CHECK-NEXT: ssra z0.b, z1.b, #1
211 %pg = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 31)
212 %ins = insertelement <vscale x 16 x i8> poison, i8 1, i32 0
213 %splat = shufflevector <vscale x 16 x i8> %ins, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
214 %shift = call <vscale x 16 x i8> @llvm.aarch64.sve.asr.u.nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %b, <vscale x 16 x i8> %splat)
215 %add = add <vscale x 16 x i8> %a, %shift
216 ret <vscale x 16 x i8> %add
219 define <vscale x 8 x i16> @ssra_intr_i16(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b) #0 {
220 ; CHECK-LABEL: ssra_intr_i16:
222 ; CHECK-NEXT: ssra z0.h, z1.h, #2
224 %pg = call <vscale x 8 x i1> @llvm.aarch64.sve.ptrue.nxv8i1(i32 31)
225 %ins = insertelement <vscale x 8 x i16> poison, i16 2, i32 0
226 %splat = shufflevector <vscale x 8 x i16> %ins, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
227 %shift = call <vscale x 8 x i16> @llvm.aarch64.sve.asr.u.nxv8i16(<vscale x 8 x i1> %pg, <vscale x 8 x i16> %b, <vscale x 8 x i16> %splat)
228 %add = add <vscale x 8 x i16> %a, %shift
229 ret <vscale x 8 x i16> %add
232 define <vscale x 4 x i32> @ssra_intr_i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) #0 {
233 ; CHECK-LABEL: ssra_intr_i32:
235 ; CHECK-NEXT: ssra z0.s, z1.s, #3
237 %pg = call <vscale x 4 x i1> @llvm.aarch64.sve.ptrue.nxv4i1(i32 31)
238 %ins = insertelement <vscale x 4 x i32> poison, i32 3, i32 0
239 %splat = shufflevector <vscale x 4 x i32> %ins, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
240 %shift = call <vscale x 4 x i32> @llvm.aarch64.sve.asr.u.nxv4i32(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %b, <vscale x 4 x i32> %splat)
241 %add = add <vscale x 4 x i32> %a, %shift
242 ret <vscale x 4 x i32> %add
245 define <vscale x 2 x i64> @ssra_intr_i64(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b) #0 {
246 ; CHECK-LABEL: ssra_intr_i64:
248 ; CHECK-NEXT: ssra z0.d, z1.d, #4
250 %pg = call <vscale x 2 x i1> @llvm.aarch64.sve.ptrue.nxv2i1(i32 31)
251 %ins = insertelement <vscale x 2 x i64> poison, i64 4, i32 0
252 %splat = shufflevector <vscale x 2 x i64> %ins, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
253 %shift = call <vscale x 2 x i64> @llvm.aarch64.sve.asr.u.nxv2i64(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %b, <vscale x 2 x i64> %splat)
254 %add = add <vscale x 2 x i64> %a, %shift
255 ret <vscale x 2 x i64> %add
258 define <vscale x 16 x i8> @ssra_intr_u_i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %a, <vscale x 16 x i8> %b) #0 {
259 ; CHECK-LABEL: ssra_intr_u_i8:
261 ; CHECK-NEXT: ssra z0.b, z1.b, #1
263 %ins = insertelement <vscale x 16 x i8> poison, i8 1, i32 0
264 %splat = shufflevector <vscale x 16 x i8> %ins, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
265 %shift = call <vscale x 16 x i8> @llvm.aarch64.sve.asr.u.nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %b, <vscale x 16 x i8> %splat)
266 %add = add <vscale x 16 x i8> %a, %shift
267 ret <vscale x 16 x i8> %add
270 define <vscale x 8 x i16> @ssra_intr_u_i16(<vscale x 8 x i1> %pg, <vscale x 8 x i16> %a, <vscale x 8 x i16> %b) #0 {
271 ; CHECK-LABEL: ssra_intr_u_i16:
273 ; CHECK-NEXT: ssra z0.h, z1.h, #2
275 %ins = insertelement <vscale x 8 x i16> poison, i16 2, i32 0
276 %splat = shufflevector <vscale x 8 x i16> %ins, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
277 %shift = call <vscale x 8 x i16> @llvm.aarch64.sve.asr.u.nxv8i16(<vscale x 8 x i1> %pg, <vscale x 8 x i16> %b, <vscale x 8 x i16> %splat)
278 %add = add <vscale x 8 x i16> %a, %shift
279 ret <vscale x 8 x i16> %add
282 define <vscale x 4 x i32> @ssra_intr_u_i32(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %a, <vscale x 4 x i32> %b) #0 {
283 ; CHECK-LABEL: ssra_intr_u_i32:
285 ; CHECK-NEXT: ssra z0.s, z1.s, #3
287 %ins = insertelement <vscale x 4 x i32> poison, i32 3, i32 0
288 %splat = shufflevector <vscale x 4 x i32> %ins, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
289 %shift = call <vscale x 4 x i32> @llvm.aarch64.sve.asr.u.nxv4i32(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %b, <vscale x 4 x i32> %splat)
290 %add = add <vscale x 4 x i32> %a, %shift
291 ret <vscale x 4 x i32> %add
294 define <vscale x 2 x i64> @ssra_intr_u_i64(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %a, <vscale x 2 x i64> %b) #0 {
295 ; CHECK-LABEL: ssra_intr_u_i64:
297 ; CHECK-NEXT: ssra z0.d, z1.d, #4
299 %ins = insertelement <vscale x 2 x i64> poison, i64 4, i32 0
300 %splat = shufflevector <vscale x 2 x i64> %ins, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
301 %shift = call <vscale x 2 x i64> @llvm.aarch64.sve.asr.u.nxv2i64(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %b, <vscale x 2 x i64> %splat)
302 %add = add <vscale x 2 x i64> %a, %shift
303 ret <vscale x 2 x i64> %add
306 declare <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 immarg)
307 declare <vscale x 8 x i1> @llvm.aarch64.sve.ptrue.nxv8i1(i32 immarg)
308 declare <vscale x 4 x i1> @llvm.aarch64.sve.ptrue.nxv4i1(i32 immarg)
309 declare <vscale x 2 x i1> @llvm.aarch64.sve.ptrue.nxv2i1(i32 immarg)
311 declare <vscale x 16 x i8> @llvm.aarch64.sve.lsr.u.nxv16i8(<vscale x 16 x i1>, <vscale x 16 x i8>, <vscale x 16 x i8>)
312 declare <vscale x 8 x i16> @llvm.aarch64.sve.lsr.u.nxv8i16(<vscale x 8 x i1>, <vscale x 8 x i16>, <vscale x 8 x i16>)
313 declare <vscale x 4 x i32> @llvm.aarch64.sve.lsr.u.nxv4i32(<vscale x 4 x i1>, <vscale x 4 x i32>, <vscale x 4 x i32>)
314 declare <vscale x 2 x i64> @llvm.aarch64.sve.lsr.u.nxv2i64(<vscale x 2 x i1>, <vscale x 2 x i64>, <vscale x 2 x i64>)
316 declare <vscale x 16 x i8> @llvm.aarch64.sve.asr.u.nxv16i8(<vscale x 16 x i1>, <vscale x 16 x i8>, <vscale x 16 x i8>)
317 declare <vscale x 8 x i16> @llvm.aarch64.sve.asr.u.nxv8i16(<vscale x 8 x i1>, <vscale x 8 x i16>, <vscale x 8 x i16>)
318 declare <vscale x 4 x i32> @llvm.aarch64.sve.asr.u.nxv4i32(<vscale x 4 x i1>, <vscale x 4 x i32>, <vscale x 4 x i32>)
319 declare <vscale x 2 x i64> @llvm.aarch64.sve.asr.u.nxv2i64(<vscale x 2 x i1>, <vscale x 2 x i64>, <vscale x 2 x i64>)
321 attributes #0 = { "target-features"="+sve,+sve2" }