1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-none-linux-gnu -mattr=+neon | FileCheck %s --check-prefix=CHECK
4 declare i1 @llvm.experimental.vector.reduce.and.v1i1(<1 x i1> %a)
5 declare i8 @llvm.experimental.vector.reduce.and.v1i8(<1 x i8> %a)
6 declare i16 @llvm.experimental.vector.reduce.and.v1i16(<1 x i16> %a)
7 declare i24 @llvm.experimental.vector.reduce.and.v1i24(<1 x i24> %a)
8 declare i32 @llvm.experimental.vector.reduce.and.v1i32(<1 x i32> %a)
9 declare i64 @llvm.experimental.vector.reduce.and.v1i64(<1 x i64> %a)
10 declare i128 @llvm.experimental.vector.reduce.and.v1i128(<1 x i128> %a)
12 declare i8 @llvm.experimental.vector.reduce.and.v3i8(<3 x i8> %a)
13 declare i8 @llvm.experimental.vector.reduce.and.v9i8(<9 x i8> %a)
14 declare i32 @llvm.experimental.vector.reduce.and.v3i32(<3 x i32> %a)
15 declare i1 @llvm.experimental.vector.reduce.and.v4i1(<4 x i1> %a)
16 declare i24 @llvm.experimental.vector.reduce.and.v4i24(<4 x i24> %a)
17 declare i128 @llvm.experimental.vector.reduce.and.v2i128(<2 x i128> %a)
18 declare i32 @llvm.experimental.vector.reduce.and.v16i32(<16 x i32> %a)
20 define i1 @test_v1i1(<1 x i1> %a) nounwind {
21 ; CHECK-LABEL: test_v1i1:
23 ; CHECK-NEXT: and w0, w0, #0x1
25 %b = call i1 @llvm.experimental.vector.reduce.and.v1i1(<1 x i1> %a)
29 define i8 @test_v1i8(<1 x i8> %a) nounwind {
30 ; CHECK-LABEL: test_v1i8:
32 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
33 ; CHECK-NEXT: umov w0, v0.b[0]
35 %b = call i8 @llvm.experimental.vector.reduce.and.v1i8(<1 x i8> %a)
39 define i16 @test_v1i16(<1 x i16> %a) nounwind {
40 ; CHECK-LABEL: test_v1i16:
42 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
43 ; CHECK-NEXT: umov w0, v0.h[0]
45 %b = call i16 @llvm.experimental.vector.reduce.and.v1i16(<1 x i16> %a)
49 define i24 @test_v1i24(<1 x i24> %a) nounwind {
50 ; CHECK-LABEL: test_v1i24:
53 %b = call i24 @llvm.experimental.vector.reduce.and.v1i24(<1 x i24> %a)
57 define i32 @test_v1i32(<1 x i32> %a) nounwind {
58 ; CHECK-LABEL: test_v1i32:
60 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
61 ; CHECK-NEXT: fmov w0, s0
63 %b = call i32 @llvm.experimental.vector.reduce.and.v1i32(<1 x i32> %a)
67 define i64 @test_v1i64(<1 x i64> %a) nounwind {
68 ; CHECK-LABEL: test_v1i64:
70 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
71 ; CHECK-NEXT: fmov x0, d0
73 %b = call i64 @llvm.experimental.vector.reduce.and.v1i64(<1 x i64> %a)
77 define i128 @test_v1i128(<1 x i128> %a) nounwind {
78 ; CHECK-LABEL: test_v1i128:
81 %b = call i128 @llvm.experimental.vector.reduce.and.v1i128(<1 x i128> %a)
85 define i8 @test_v3i8(<3 x i8> %a) nounwind {
86 ; CHECK-LABEL: test_v3i8:
88 ; CHECK-NEXT: and w8, w0, w1
89 ; CHECK-NEXT: and w8, w8, w2
90 ; CHECK-NEXT: and w0, w8, #0xff
92 %b = call i8 @llvm.experimental.vector.reduce.and.v3i8(<3 x i8> %a)
96 define i8 @test_v9i8(<9 x i8> %a) nounwind {
97 ; CHECK-LABEL: test_v9i8:
99 ; CHECK-NEXT: mov w8, #-1
100 ; CHECK-NEXT: mov v0.b[9], w8
101 ; CHECK-NEXT: mov v0.b[10], w8
102 ; CHECK-NEXT: mov v0.b[11], w8
103 ; CHECK-NEXT: mov v0.b[12], w8
104 ; CHECK-NEXT: mov v0.b[13], w8
105 ; CHECK-NEXT: mov v0.b[14], w8
106 ; CHECK-NEXT: mov v0.b[15], w8
107 ; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8
108 ; CHECK-NEXT: and v0.8b, v0.8b, v1.8b
109 ; CHECK-NEXT: umov w8, v0.b[1]
110 ; CHECK-NEXT: umov w9, v0.b[0]
111 ; CHECK-NEXT: and w8, w9, w8
112 ; CHECK-NEXT: umov w9, v0.b[2]
113 ; CHECK-NEXT: and w8, w8, w9
114 ; CHECK-NEXT: umov w9, v0.b[3]
115 ; CHECK-NEXT: and w8, w8, w9
116 ; CHECK-NEXT: umov w9, v0.b[4]
117 ; CHECK-NEXT: and w8, w8, w9
118 ; CHECK-NEXT: umov w9, v0.b[5]
119 ; CHECK-NEXT: and w8, w8, w9
120 ; CHECK-NEXT: umov w9, v0.b[6]
121 ; CHECK-NEXT: and w8, w8, w9
122 ; CHECK-NEXT: umov w9, v0.b[7]
123 ; CHECK-NEXT: and w0, w8, w9
125 %b = call i8 @llvm.experimental.vector.reduce.and.v9i8(<9 x i8> %a)
129 define i32 @test_v3i32(<3 x i32> %a) nounwind {
130 ; CHECK-LABEL: test_v3i32:
132 ; CHECK-NEXT: mov w8, #-1
133 ; CHECK-NEXT: mov v0.s[3], w8
134 ; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8
135 ; CHECK-NEXT: and v0.8b, v0.8b, v1.8b
136 ; CHECK-NEXT: mov w8, v0.s[1]
137 ; CHECK-NEXT: fmov w9, s0
138 ; CHECK-NEXT: and w0, w9, w8
140 %b = call i32 @llvm.experimental.vector.reduce.and.v3i32(<3 x i32> %a)
144 define i1 @test_v4i1(<4 x i1> %a) nounwind {
145 ; CHECK-LABEL: test_v4i1:
147 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
148 ; CHECK-NEXT: umov w10, v0.h[1]
149 ; CHECK-NEXT: umov w11, v0.h[0]
150 ; CHECK-NEXT: umov w9, v0.h[2]
151 ; CHECK-NEXT: and w10, w11, w10
152 ; CHECK-NEXT: umov w8, v0.h[3]
153 ; CHECK-NEXT: and w9, w10, w9
154 ; CHECK-NEXT: and w8, w9, w8
155 ; CHECK-NEXT: and w0, w8, #0x1
157 %b = call i1 @llvm.experimental.vector.reduce.and.v4i1(<4 x i1> %a)
161 define i24 @test_v4i24(<4 x i24> %a) nounwind {
162 ; CHECK-LABEL: test_v4i24:
164 ; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8
165 ; CHECK-NEXT: and v0.8b, v0.8b, v1.8b
166 ; CHECK-NEXT: mov w8, v0.s[1]
167 ; CHECK-NEXT: fmov w9, s0
168 ; CHECK-NEXT: and w0, w9, w8
170 %b = call i24 @llvm.experimental.vector.reduce.and.v4i24(<4 x i24> %a)
174 define i128 @test_v2i128(<2 x i128> %a) nounwind {
175 ; CHECK-LABEL: test_v2i128:
177 ; CHECK-NEXT: and x0, x0, x2
178 ; CHECK-NEXT: and x1, x1, x3
180 %b = call i128 @llvm.experimental.vector.reduce.and.v2i128(<2 x i128> %a)
184 define i32 @test_v16i32(<16 x i32> %a) nounwind {
185 ; CHECK-LABEL: test_v16i32:
187 ; CHECK-NEXT: and v1.16b, v1.16b, v3.16b
188 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
189 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
190 ; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8
191 ; CHECK-NEXT: and v0.8b, v0.8b, v1.8b
192 ; CHECK-NEXT: mov w8, v0.s[1]
193 ; CHECK-NEXT: fmov w9, s0
194 ; CHECK-NEXT: and w0, w9, w8
196 %b = call i32 @llvm.experimental.vector.reduce.and.v16i32(<16 x i32> %a)