1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple aarch64-none-linux-gnu < %s | FileCheck %s
4 declare <4 x i16> @llvm.aarch64.neon.uaddlp.v4i16.v8i8(<8 x i8>) nounwind readnone
5 declare <8 x i16> @llvm.aarch64.neon.uaddlp.v8i16.v16i8(<16 x i8>) nounwind readnone
6 declare <4 x i32> @llvm.aarch64.neon.uaddlp.v4i32.v8i16(<8 x i16>) nounwind readnone
7 declare <2 x i64> @llvm.aarch64.neon.uaddlp.v2i64.v4i32(<4 x i32>) nounwind readnone
8 declare <2 x i32> @llvm.aarch64.neon.uaddlp.v2i32.v4i16(<4 x i16>) nounwind readnone
10 declare <4 x i16> @llvm.aarch64.neon.saddlp.v4i16.v8i8(<8 x i8>) nounwind readnone
11 declare <8 x i16> @llvm.aarch64.neon.saddlp.v8i16.v16i8(<16 x i8>) nounwind readnone
12 declare <4 x i32> @llvm.aarch64.neon.saddlp.v4i32.v8i16(<8 x i16>) nounwind readnone
13 declare <2 x i64> @llvm.aarch64.neon.saddlp.v2i64.v4i32(<4 x i32>) nounwind readnone
14 declare <2 x i32> @llvm.aarch64.neon.saddlp.v2i32.v4i16(<4 x i16>) nounwind readnone
16 declare i16 @llvm.vector.reduce.add.v4i16(<4 x i16>) nounwind readnone
17 declare i16 @llvm.vector.reduce.add.v8i16(<8 x i16>) nounwind readnone
18 declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) nounwind readnone
19 declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) nounwind readnone
20 declare i32 @llvm.vector.reduce.add.v2i32(<2 x i32>) nounwind readnone
22 define i16 @uaddlv4h_from_v8i8(ptr %A) nounwind {
23 ; CHECK-LABEL: uaddlv4h_from_v8i8:
25 ; CHECK-NEXT: ldr d0, [x0]
26 ; CHECK-NEXT: uaddlv h0, v0.8b
27 ; CHECK-NEXT: fmov w0, s0
29 %tmp1 = load <8 x i8>, ptr %A
30 %tmp3 = call <4 x i16> @llvm.aarch64.neon.uaddlp.v4i16.v8i8(<8 x i8> %tmp1)
31 %tmp5 = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> %tmp3)
35 define i16 @uaddlv16b_from_v16i8(ptr %A) nounwind {
36 ; CHECK-LABEL: uaddlv16b_from_v16i8:
38 ; CHECK-NEXT: ldr q0, [x0]
39 ; CHECK-NEXT: uaddlv h0, v0.16b
40 ; CHECK-NEXT: fmov w0, s0
42 %tmp1 = load <16 x i8>, ptr %A
43 %tmp3 = call <8 x i16> @llvm.aarch64.neon.uaddlp.v8i16.v16i8(<16 x i8> %tmp1)
44 %tmp5 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %tmp3)
48 define i32 @uaddlv8h_from_v8i16(ptr %A) nounwind {
49 ; CHECK-LABEL: uaddlv8h_from_v8i16:
51 ; CHECK-NEXT: ldr q0, [x0]
52 ; CHECK-NEXT: uaddlv s0, v0.8h
53 ; CHECK-NEXT: fmov w0, s0
55 %tmp1 = load <8 x i16>, ptr %A
56 %tmp3 = call <4 x i32> @llvm.aarch64.neon.uaddlp.v4i32.v8i16(<8 x i16> %tmp1)
57 %tmp5 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %tmp3)
61 define i64 @uaddlv4s_from_v4i32(ptr %A) nounwind {
62 ; CHECK-LABEL: uaddlv4s_from_v4i32:
64 ; CHECK-NEXT: ldr q0, [x0]
65 ; CHECK-NEXT: uaddlv d0, v0.4s
66 ; CHECK-NEXT: fmov x0, d0
68 %tmp1 = load <4 x i32>, ptr %A
69 %tmp3 = call <2 x i64> @llvm.aarch64.neon.uaddlp.v2i64.v4i32(<4 x i32> %tmp1)
70 %tmp5 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %tmp3)
74 define i32 @uaddlv4h_from_v4i16(ptr %A) nounwind {
75 ; CHECK-LABEL: uaddlv4h_from_v4i16:
77 ; CHECK-NEXT: ldr d0, [x0]
78 ; CHECK-NEXT: uaddlv s0, v0.4h
79 ; CHECK-NEXT: fmov w0, s0
81 %tmp1 = load <4 x i16>, ptr %A
82 %tmp3 = call <2 x i32> @llvm.aarch64.neon.uaddlp.v2i32.v4i16(<4 x i16> %tmp1)
83 %tmp5 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %tmp3)
89 define i16 @saddlv4h_from_v8i8(ptr %A) nounwind {
90 ; CHECK-LABEL: saddlv4h_from_v8i8:
92 ; CHECK-NEXT: ldr d0, [x0]
93 ; CHECK-NEXT: saddlv h0, v0.8b
94 ; CHECK-NEXT: fmov w0, s0
96 %tmp1 = load <8 x i8>, ptr %A
97 %tmp3 = call <4 x i16> @llvm.aarch64.neon.saddlp.v4i16.v8i8(<8 x i8> %tmp1)
98 %tmp5 = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> %tmp3)
102 define i16 @saddlv16b_from_v16i8(ptr %A) nounwind {
103 ; CHECK-LABEL: saddlv16b_from_v16i8:
105 ; CHECK-NEXT: ldr q0, [x0]
106 ; CHECK-NEXT: saddlv h0, v0.16b
107 ; CHECK-NEXT: fmov w0, s0
109 %tmp1 = load <16 x i8>, ptr %A
110 %tmp3 = call <8 x i16> @llvm.aarch64.neon.saddlp.v8i16.v16i8(<16 x i8> %tmp1)
111 %tmp5 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %tmp3)
115 define i32 @saddlv8h_from_v8i16(ptr %A) nounwind {
116 ; CHECK-LABEL: saddlv8h_from_v8i16:
118 ; CHECK-NEXT: ldr q0, [x0]
119 ; CHECK-NEXT: saddlv s0, v0.8h
120 ; CHECK-NEXT: fmov w0, s0
122 %tmp1 = load <8 x i16>, ptr %A
123 %tmp3 = call <4 x i32> @llvm.aarch64.neon.saddlp.v4i32.v8i16(<8 x i16> %tmp1)
124 %tmp5 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %tmp3)
128 define i64 @saddlv4s_from_v4i32(ptr %A) nounwind {
129 ; CHECK-LABEL: saddlv4s_from_v4i32:
131 ; CHECK-NEXT: ldr q0, [x0]
132 ; CHECK-NEXT: saddlv d0, v0.4s
133 ; CHECK-NEXT: fmov x0, d0
135 %tmp1 = load <4 x i32>, ptr %A
136 %tmp3 = call <2 x i64> @llvm.aarch64.neon.saddlp.v2i64.v4i32(<4 x i32> %tmp1)
137 %tmp5 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %tmp3)
141 define i32 @saddlv4h_from_v4i16(ptr %A) nounwind {
142 ; CHECK-LABEL: saddlv4h_from_v4i16:
144 ; CHECK-NEXT: ldr d0, [x0]
145 ; CHECK-NEXT: saddlv s0, v0.4h
146 ; CHECK-NEXT: fmov w0, s0
148 %tmp1 = load <4 x i16>, ptr %A
149 %tmp3 = call <2 x i32> @llvm.aarch64.neon.saddlp.v2i32.v4i16(<4 x i16> %tmp1)
150 %tmp5 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %tmp3)
154 declare i32 @llvm.aarch64.neon.uaddlv.i32.v8i8(<8 x i8>) nounwind readnone
156 define i32 @uaddlv_known_bits_v8i8(<8 x i8> %a) {
157 ; CHECK-LABEL: uaddlv_known_bits_v8i8:
159 ; CHECK-NEXT: uaddlv h0, v0.8b
160 ; CHECK-NEXT: fmov w0, s0
162 %tmp1 = tail call i32 @llvm.aarch64.neon.uaddlv.i32.v8i8(<8 x i8> %a)
163 %tmp2 = and i32 %tmp1, 65535
167 declare i32 @llvm.aarch64.neon.uaddlv.i32.v16i8(<16 x i8>) nounwind readnone
169 define i32 @uaddlv_known_bits_v16i8(<16 x i8> %a) {
170 ; CHECK-LABEL: uaddlv_known_bits_v16i8:
171 ; CHECK: // %bb.0: // %entry
172 ; CHECK-NEXT: uaddlv h0, v0.16b
173 ; CHECK-NEXT: fmov w0, s0
176 %vaddlv.i = tail call i32 @llvm.aarch64.neon.uaddlv.i32.v16i8(<16 x i8> %a)
177 %0 = and i32 %vaddlv.i, 65535
181 define dso_local <8 x i8> @uaddlv_v8i8_dup(<8 x i8> %a) {
182 ; CHECK-LABEL: uaddlv_v8i8_dup:
183 ; CHECK: // %bb.0: // %entry
184 ; CHECK-NEXT: uaddlv h0, v0.8b
185 ; CHECK-NEXT: dup v0.8h, v0.h[0]
186 ; CHECK-NEXT: rshrn v0.8b, v0.8h, #3
189 %vaddlv.i = tail call i32 @llvm.aarch64.neon.uaddlv.i32.v8i8(<8 x i8> %a)
190 %0 = trunc i32 %vaddlv.i to i16
191 %vecinit.i = insertelement <8 x i16> undef, i16 %0, i64 0
192 %vecinit7.i = shufflevector <8 x i16> %vecinit.i, <8 x i16> poison, <8 x i32> zeroinitializer
193 %vrshrn_n2 = tail call <8 x i8> @llvm.aarch64.neon.rshrn.v8i8(<8 x i16> %vecinit7.i, i32 3)
194 ret <8 x i8> %vrshrn_n2
197 declare <8 x i8> @llvm.aarch64.neon.rshrn.v8i8(<8 x i16>, i32)
199 declare i64 @llvm.aarch64.neon.urshl.i64(i64, i64)
201 define <8 x i8> @uaddlv_v8i8_urshr(<8 x i8> %a) {
202 ; CHECK-LABEL: uaddlv_v8i8_urshr:
203 ; CHECK: // %bb.0: // %entry
204 ; CHECK-NEXT: uaddlv h0, v0.8b
205 ; CHECK-NEXT: urshr d0, d0, #3
206 ; CHECK-NEXT: dup v0.8b, v0.b[0]
209 %vaddlv.i = tail call i32 @llvm.aarch64.neon.uaddlv.i32.v8i8(<8 x i8> %a)
210 %0 = and i32 %vaddlv.i, 65535
211 %conv = zext i32 %0 to i64
212 %vrshr_n = tail call i64 @llvm.aarch64.neon.urshl.i64(i64 %conv, i64 -3)
213 %conv1 = trunc i64 %vrshr_n to i8
214 %vecinit.i = insertelement <8 x i8> undef, i8 %conv1, i64 0
215 %vecinit7.i = shufflevector <8 x i8> %vecinit.i, <8 x i8> poison, <8 x i32> zeroinitializer
216 ret <8 x i8> %vecinit7.i