1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -o - %s | FileCheck %s
4 define <4 x i32> @smull(<4 x i16> %x, ptr %y) {
6 ; CHECK: // %bb.0: // %entry
7 ; CHECK-NEXT: fmov d1, d0
8 ; CHECK-NEXT: movi v0.2d, #0000000000000000
9 ; CHECK-NEXT: mov w8, #1 // =0x1
10 ; CHECK-NEXT: .LBB0_1: // %l1
11 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
12 ; CHECK-NEXT: ldr d2, [x0]
13 ; CHECK-NEXT: subs w8, w8, #1
14 ; CHECK-NEXT: smlal v0.4s, v2.4h, v1.h[3]
15 ; CHECK-NEXT: b.eq .LBB0_1
16 ; CHECK-NEXT: // %bb.2: // %l2
19 %a = shufflevector <4 x i16> %x, <4 x i16> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
23 %p = phi i32 [ 0, %entry ], [ %pa, %l1 ]
24 %q = phi <4 x i32> [ zeroinitializer, %entry ], [ %c, %l1 ]
25 %l = load <4 x i16>, ptr %y
26 %b = tail call <4 x i32> @llvm.aarch64.neon.smull.v4i32(<4 x i16> %l, <4 x i16> %a)
27 %c = add nsw <4 x i32> %q, %b
29 %c1 = icmp eq i32 %p, 0
30 br i1 %c1, label %l1, label %l2
36 define <4 x i32> @umull(<4 x i16> %x, ptr %y) {
38 ; CHECK: // %bb.0: // %entry
39 ; CHECK-NEXT: fmov d1, d0
40 ; CHECK-NEXT: movi v0.2d, #0000000000000000
41 ; CHECK-NEXT: mov w8, #1 // =0x1
42 ; CHECK-NEXT: .LBB1_1: // %l1
43 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
44 ; CHECK-NEXT: ldr d2, [x0]
45 ; CHECK-NEXT: subs w8, w8, #1
46 ; CHECK-NEXT: umlal v0.4s, v2.4h, v1.h[3]
47 ; CHECK-NEXT: b.eq .LBB1_1
48 ; CHECK-NEXT: // %bb.2: // %l2
51 %a = shufflevector <4 x i16> %x, <4 x i16> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
55 %p = phi i32 [ 0, %entry ], [ %pa, %l1 ]
56 %q = phi <4 x i32> [ zeroinitializer, %entry ], [ %c, %l1 ]
57 %l = load <4 x i16>, ptr %y
58 %b = tail call <4 x i32> @llvm.aarch64.neon.umull.v4i32(<4 x i16> %l, <4 x i16> %a)
59 %c = add nsw <4 x i32> %q, %b
61 %c1 = icmp eq i32 %p, 0
62 br i1 %c1, label %l1, label %l2
68 define <4 x i32> @sqadd(<4 x i32> %x, ptr %y) {
70 ; CHECK: // %bb.0: // %entry
71 ; CHECK-NEXT: mov v1.16b, v0.16b
72 ; CHECK-NEXT: movi v0.2d, #0000000000000000
73 ; CHECK-NEXT: mov w8, #1 // =0x1
74 ; CHECK-NEXT: .LBB2_1: // %l1
75 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
76 ; CHECK-NEXT: ldr q2, [x0]
77 ; CHECK-NEXT: subs w8, w8, #1
78 ; CHECK-NEXT: sqrdmulh v2.4s, v2.4s, v1.s[3]
79 ; CHECK-NEXT: sqadd v0.4s, v0.4s, v2.4s
80 ; CHECK-NEXT: b.eq .LBB2_1
81 ; CHECK-NEXT: // %bb.2: // %l2
84 %a = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
88 %p = phi i32 [ 0, %entry ], [ %pa, %l1 ]
89 %q = phi <4 x i32> [ zeroinitializer, %entry ], [ %c, %l1 ]
90 %l = load <4 x i32>, ptr %y
91 %b = tail call <4 x i32> @llvm.aarch64.neon.sqrdmulh.v4i32(<4 x i32> %l, <4 x i32> %a)
92 %c = tail call <4 x i32> @llvm.aarch64.neon.sqadd.v4i32(<4 x i32> %q, <4 x i32> %b)
94 %c1 = icmp eq i32 %p, 0
95 br i1 %c1, label %l1, label %l2
101 define <4 x i32> @sqsub(<4 x i32> %x, ptr %y) {
102 ; CHECK-LABEL: sqsub:
103 ; CHECK: // %bb.0: // %entry
104 ; CHECK-NEXT: mov v1.16b, v0.16b
105 ; CHECK-NEXT: movi v0.2d, #0000000000000000
106 ; CHECK-NEXT: mov w8, #1 // =0x1
107 ; CHECK-NEXT: .LBB3_1: // %l1
108 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
109 ; CHECK-NEXT: ldr q2, [x0]
110 ; CHECK-NEXT: subs w8, w8, #1
111 ; CHECK-NEXT: sqrdmulh v2.4s, v2.4s, v1.s[3]
112 ; CHECK-NEXT: sqsub v0.4s, v0.4s, v2.4s
113 ; CHECK-NEXT: b.eq .LBB3_1
114 ; CHECK-NEXT: // %bb.2: // %l2
117 %a = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
121 %p = phi i32 [ 0, %entry ], [ %pa, %l1 ]
122 %q = phi <4 x i32> [ zeroinitializer, %entry ], [ %c, %l1 ]
123 %l = load <4 x i32>, ptr %y
124 %b = tail call <4 x i32> @llvm.aarch64.neon.sqrdmulh.v4i32(<4 x i32> %l, <4 x i32> %a)
125 %c = tail call <4 x i32> @llvm.aarch64.neon.sqsub.v4i32(<4 x i32> %q, <4 x i32> %b)
127 %c1 = icmp eq i32 %p, 0
128 br i1 %c1, label %l1, label %l2
134 define <4 x i32> @sqdmulh(<4 x i32> %x, ptr %y) {
135 ; CHECK-LABEL: sqdmulh:
136 ; CHECK: // %bb.0: // %entry
137 ; CHECK-NEXT: mov v1.16b, v0.16b
138 ; CHECK-NEXT: movi v0.2d, #0000000000000000
139 ; CHECK-NEXT: mov w8, #1 // =0x1
140 ; CHECK-NEXT: .LBB4_1: // %l1
141 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
142 ; CHECK-NEXT: ldr q2, [x0]
143 ; CHECK-NEXT: subs w8, w8, #1
144 ; CHECK-NEXT: sqdmulh v2.4s, v2.4s, v1.s[3]
145 ; CHECK-NEXT: add v0.4s, v0.4s, v2.4s
146 ; CHECK-NEXT: b.eq .LBB4_1
147 ; CHECK-NEXT: // %bb.2: // %l2
150 %a = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
154 %p = phi i32 [ 0, %entry ], [ %pa, %l1 ]
155 %q = phi <4 x i32> [ zeroinitializer, %entry ], [ %c, %l1 ]
156 %l = load <4 x i32>, ptr %y
157 %b = tail call <4 x i32> @llvm.aarch64.neon.sqdmulh.v4i32(<4 x i32> %l, <4 x i32> %a)
158 %c = add nsw <4 x i32> %q, %b
160 %c1 = icmp eq i32 %p, 0
161 br i1 %c1, label %l1, label %l2
167 define <4 x i32> @sqdmull(<4 x i16> %x, ptr %y) {
168 ; CHECK-LABEL: sqdmull:
169 ; CHECK: // %bb.0: // %entry
170 ; CHECK-NEXT: fmov d1, d0
171 ; CHECK-NEXT: movi v0.2d, #0000000000000000
172 ; CHECK-NEXT: mov w8, #1 // =0x1
173 ; CHECK-NEXT: .LBB5_1: // %l1
174 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
175 ; CHECK-NEXT: ldr d2, [x0]
176 ; CHECK-NEXT: subs w8, w8, #1
177 ; CHECK-NEXT: sqdmull v2.4s, v2.4h, v1.h[3]
178 ; CHECK-NEXT: add v0.4s, v0.4s, v2.4s
179 ; CHECK-NEXT: b.eq .LBB5_1
180 ; CHECK-NEXT: // %bb.2: // %l2
183 %a = shufflevector <4 x i16> %x, <4 x i16> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
187 %p = phi i32 [ 0, %entry ], [ %pa, %l1 ]
188 %q = phi <4 x i32> [ zeroinitializer, %entry ], [ %c, %l1 ]
189 %l = load <4 x i16>, ptr %y
190 %b = tail call <4 x i32> @llvm.aarch64.neon.sqdmull.v4i32(<4 x i16> %l, <4 x i16> %a)
191 %c = add nsw <4 x i32> %q, %b
193 %c1 = icmp eq i32 %p, 0
194 br i1 %c1, label %l1, label %l2
200 define <4 x i32> @mlal(<4 x i32> %x, ptr %y) {
202 ; CHECK: // %bb.0: // %entry
203 ; CHECK-NEXT: mov v1.16b, v0.16b
204 ; CHECK-NEXT: movi v0.2d, #0000000000000000
205 ; CHECK-NEXT: mov w8, #1 // =0x1
206 ; CHECK-NEXT: dup v1.4s, v1.s[3]
207 ; CHECK-NEXT: .LBB6_1: // %l1
208 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
209 ; CHECK-NEXT: ldr q2, [x0]
210 ; CHECK-NEXT: subs w8, w8, #1
211 ; CHECK-NEXT: mla v0.4s, v2.4s, v1.4s
212 ; CHECK-NEXT: b.eq .LBB6_1
213 ; CHECK-NEXT: // %bb.2: // %l2
216 %a = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
220 %p = phi i32 [ 0, %entry ], [ %pa, %l1 ]
221 %q = phi <4 x i32> [ zeroinitializer, %entry ], [ %c, %l1 ]
222 %l = load <4 x i32>, ptr %y
223 %b = mul <4 x i32> %l, %a
224 %c = add <4 x i32> %q, %b
226 %c1 = icmp eq i32 %p, 0
227 br i1 %c1, label %l1, label %l2
233 define <4 x float> @fmul(<4 x float> %x, ptr %y) {
235 ; CHECK: // %bb.0: // %entry
236 ; CHECK-NEXT: mov v1.16b, v0.16b
237 ; CHECK-NEXT: movi v0.2d, #0000000000000000
238 ; CHECK-NEXT: mov w8, #1 // =0x1
239 ; CHECK-NEXT: .LBB7_1: // %l1
240 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
241 ; CHECK-NEXT: ldr q2, [x0]
242 ; CHECK-NEXT: subs w8, w8, #1
243 ; CHECK-NEXT: fmul v2.4s, v2.4s, v1.s[3]
244 ; CHECK-NEXT: fadd v0.4s, v2.4s, v0.4s
245 ; CHECK-NEXT: b.eq .LBB7_1
246 ; CHECK-NEXT: // %bb.2: // %l2
249 %a = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
253 %p = phi i32 [ 0, %entry ], [ %pa, %l1 ]
254 %q = phi <4 x float> [ zeroinitializer, %entry ], [ %c, %l1 ]
255 %l = load <4 x float>, ptr %y
256 %b = fmul <4 x float> %l, %a
257 %c = fadd <4 x float> %b, %q
259 %c1 = icmp eq i32 %p, 0
260 br i1 %c1, label %l1, label %l2
266 define <4 x float> @fmuladd(<4 x float> %x, ptr %y) {
267 ; CHECK-LABEL: fmuladd:
268 ; CHECK: // %bb.0: // %entry
269 ; CHECK-NEXT: mov v1.16b, v0.16b
270 ; CHECK-NEXT: movi v0.2d, #0000000000000000
271 ; CHECK-NEXT: mov w8, #1 // =0x1
272 ; CHECK-NEXT: dup v1.4s, v1.s[3]
273 ; CHECK-NEXT: .LBB8_1: // %l1
274 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
275 ; CHECK-NEXT: ldr q2, [x0]
276 ; CHECK-NEXT: subs w8, w8, #1
277 ; CHECK-NEXT: fmla v0.4s, v1.4s, v2.4s
278 ; CHECK-NEXT: b.eq .LBB8_1
279 ; CHECK-NEXT: // %bb.2: // %l2
282 %a = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
286 %p = phi i32 [ 0, %entry ], [ %pa, %l1 ]
287 %q = phi <4 x float> [ zeroinitializer, %entry ], [ %c, %l1 ]
288 %l = load <4 x float>, ptr %y
289 %b = fmul fast <4 x float> %l, %a
290 %c = fadd fast <4 x float> %b, %q
292 %c1 = icmp eq i32 %p, 0
293 br i1 %c1, label %l1, label %l2
299 define <4 x float> @fma(<4 x float> %x, ptr %y) {
301 ; CHECK: // %bb.0: // %entry
302 ; CHECK-NEXT: mov v1.16b, v0.16b
303 ; CHECK-NEXT: movi v0.2d, #0000000000000000
304 ; CHECK-NEXT: mov w8, #1 // =0x1
305 ; CHECK-NEXT: dup v1.4s, v1.s[3]
306 ; CHECK-NEXT: .LBB9_1: // %l1
307 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
308 ; CHECK-NEXT: mov v3.16b, v0.16b
309 ; CHECK-NEXT: mov v0.16b, v1.16b
310 ; CHECK-NEXT: ldr q2, [x0]
311 ; CHECK-NEXT: subs w8, w8, #1
312 ; CHECK-NEXT: fmla v0.4s, v3.4s, v2.4s
313 ; CHECK-NEXT: b.eq .LBB9_1
314 ; CHECK-NEXT: // %bb.2: // %l2
317 %a = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
321 %p = phi i32 [ 0, %entry ], [ %pa, %l1 ]
322 %q = phi <4 x float> [ zeroinitializer, %entry ], [ %c, %l1 ]
323 %l = load <4 x float>, ptr %y
324 %c = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %l, <4 x float> %q, <4 x float> %a)
326 %c1 = icmp eq i32 %p, 0
327 br i1 %c1, label %l1, label %l2
333 define <4 x i32> @smull_nonsplat(<4 x i16> %x, ptr %y) {
334 ; CHECK-LABEL: smull_nonsplat:
335 ; CHECK: // %bb.0: // %entry
336 ; CHECK-NEXT: fmov d1, d0
337 ; CHECK-NEXT: movi v0.2d, #0000000000000000
338 ; CHECK-NEXT: mov w8, #1 // =0x1
339 ; CHECK-NEXT: trn2 v2.4h, v1.4h, v1.4h
340 ; CHECK-NEXT: zip2 v1.4h, v2.4h, v1.4h
341 ; CHECK-NEXT: .LBB10_1: // %l1
342 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
343 ; CHECK-NEXT: ldr d2, [x0]
344 ; CHECK-NEXT: subs w8, w8, #1
345 ; CHECK-NEXT: smlal v0.4s, v2.4h, v1.4h
346 ; CHECK-NEXT: b.eq .LBB10_1
347 ; CHECK-NEXT: // %bb.2: // %l2
350 %a = shufflevector <4 x i16> %x, <4 x i16> undef, <4 x i32> <i32 3, i32 2, i32 3, i32 3>
354 %p = phi i32 [ 0, %entry ], [ %pa, %l1 ]
355 %q = phi <4 x i32> [ zeroinitializer, %entry ], [ %c, %l1 ]
356 %l = load <4 x i16>, ptr %y
357 %b = tail call <4 x i32> @llvm.aarch64.neon.smull.v4i32(<4 x i16> %l, <4 x i16> %a)
358 %c = add nsw <4 x i32> %q, %b
360 %c1 = icmp eq i32 %p, 0
361 br i1 %c1, label %l1, label %l2
367 define <4 x i32> @smull_splat_and_extract(<4 x i16> %x, <8 x i16> %l, ptr %y, i1 %co) {
368 ; CHECK-LABEL: smull_splat_and_extract:
369 ; CHECK: // %bb.0: // %entry
370 ; CHECK-NEXT: fmov d2, d0
371 ; CHECK-NEXT: smull v0.4s, v1.4h, v2.h[3]
372 ; CHECK-NEXT: tbz w1, #0, .LBB11_2
373 ; CHECK-NEXT: // %bb.1: // %l1
374 ; CHECK-NEXT: smlal2 v0.4s, v1.8h, v2.h[3]
375 ; CHECK-NEXT: .LBB11_2: // %l2
378 %a = shufflevector <4 x i16> %x, <4 x i16> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
379 %e1 = shufflevector <8 x i16> %l, <8 x i16> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
380 %e2 = shufflevector <8 x i16> %l, <8 x i16> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
381 %b = tail call <4 x i32> @llvm.aarch64.neon.smull.v4i32(<4 x i16> %e1, <4 x i16> %a)
382 br i1 %co, label %l1, label %l2
385 %b2 = tail call <4 x i32> @llvm.aarch64.neon.smull.v4i32(<4 x i16> %e2, <4 x i16> %a)
386 %c2 = add nsw <4 x i32> %b, %b2
390 %r = phi <4 x i32> [ %b, %entry ], [ %c2, %l1 ]
394 define <4 x i32> @umull_splat_and_extract(<4 x i16> %x, <8 x i16> %l, ptr %y, i1 %co) {
395 ; CHECK-LABEL: umull_splat_and_extract:
396 ; CHECK: // %bb.0: // %entry
397 ; CHECK-NEXT: fmov d2, d0
398 ; CHECK-NEXT: umull v0.4s, v1.4h, v2.h[3]
399 ; CHECK-NEXT: tbz w1, #0, .LBB12_2
400 ; CHECK-NEXT: // %bb.1: // %l1
401 ; CHECK-NEXT: umlal2 v0.4s, v1.8h, v2.h[3]
402 ; CHECK-NEXT: .LBB12_2: // %l2
405 %a = shufflevector <4 x i16> %x, <4 x i16> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
406 %e1 = shufflevector <8 x i16> %l, <8 x i16> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
407 %e2 = shufflevector <8 x i16> %l, <8 x i16> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
408 %b = tail call <4 x i32> @llvm.aarch64.neon.umull.v4i32(<4 x i16> %e1, <4 x i16> %a)
409 br i1 %co, label %l1, label %l2
412 %b2 = tail call <4 x i32> @llvm.aarch64.neon.umull.v4i32(<4 x i16> %e2, <4 x i16> %a)
413 %c2 = add nsw <4 x i32> %b, %b2
417 %r = phi <4 x i32> [ %b, %entry ], [ %c2, %l1 ]
422 declare <4 x i32> @llvm.aarch64.neon.smull.v4i32(<4 x i16>, <4 x i16>)
423 declare <4 x i32> @llvm.aarch64.neon.umull.v4i32(<4 x i16>, <4 x i16>)
424 declare <4 x i32> @llvm.aarch64.neon.sqadd.v4i32(<4 x i32>, <4 x i32>)
425 declare <4 x i32> @llvm.aarch64.neon.sqsub.v4i32(<4 x i32>, <4 x i32>)
426 declare <4 x i32> @llvm.aarch64.neon.sqrdmulh.v4i32(<4 x i32>, <4 x i32>)
427 declare <4 x i32> @llvm.aarch64.neon.sqdmull.v4i32(<4 x i16>, <4 x i16>)
428 declare <4 x i32> @llvm.aarch64.neon.sqdmulh.v4i32(<4 x i32>, <4 x i32>)
429 declare <4 x float> @llvm.fma.v4f32(<4 x float> %l, <4 x float> %a, <4 x float> %q)