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.vector.reduce.and.v1i1(<1 x i1> %a)
5 declare i8 @llvm.vector.reduce.and.v1i8(<1 x i8> %a)
6 declare i16 @llvm.vector.reduce.and.v1i16(<1 x i16> %a)
7 declare i24 @llvm.vector.reduce.and.v1i24(<1 x i24> %a)
8 declare i32 @llvm.vector.reduce.and.v1i32(<1 x i32> %a)
9 declare i64 @llvm.vector.reduce.and.v1i64(<1 x i64> %a)
10 declare i128 @llvm.vector.reduce.and.v1i128(<1 x i128> %a)
12 declare i8 @llvm.vector.reduce.and.v3i8(<3 x i8> %a)
13 declare i8 @llvm.vector.reduce.and.v9i8(<9 x i8> %a)
14 declare i32 @llvm.vector.reduce.and.v3i32(<3 x i32> %a)
15 declare i1 @llvm.vector.reduce.and.v4i1(<4 x i1> %a)
16 declare i24 @llvm.vector.reduce.and.v4i24(<4 x i24> %a)
17 declare i128 @llvm.vector.reduce.and.v2i128(<2 x i128> %a)
18 declare i32 @llvm.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.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.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.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.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.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.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.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: movi d0, #0xff00ff00ff00ff
89 ; CHECK-NEXT: mov v0.h[0], w0
90 ; CHECK-NEXT: mov v0.h[1], w1
91 ; CHECK-NEXT: mov v0.h[2], w2
92 ; CHECK-NEXT: fmov x8, d0
93 ; CHECK-NEXT: and x8, x8, x8, lsr #32
94 ; CHECK-NEXT: lsr x9, x8, #16
95 ; CHECK-NEXT: and w0, w8, w9
97 %b = call i8 @llvm.vector.reduce.and.v3i8(<3 x i8> %a)
101 define i8 @test_v9i8(<9 x i8> %a) nounwind {
102 ; CHECK-LABEL: test_v9i8:
104 ; CHECK-NEXT: mov v1.16b, v0.16b
105 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
106 ; CHECK-NEXT: mov v1.b[9], w8
107 ; CHECK-NEXT: mov v1.b[10], w8
108 ; CHECK-NEXT: mov v1.b[11], w8
109 ; CHECK-NEXT: mov v1.b[12], w8
110 ; CHECK-NEXT: mov v1.b[13], w8
111 ; CHECK-NEXT: mov v1.b[14], w8
112 ; CHECK-NEXT: mov v1.b[15], w8
113 ; CHECK-NEXT: ext v1.16b, v1.16b, v1.16b, #8
114 ; CHECK-NEXT: and v0.8b, v0.8b, v1.8b
115 ; CHECK-NEXT: fmov x8, d0
116 ; CHECK-NEXT: and x8, x8, x8, lsr #32
117 ; CHECK-NEXT: and x8, x8, x8, lsr #16
118 ; CHECK-NEXT: lsr x9, x8, #8
119 ; CHECK-NEXT: and w0, w8, w9
121 %b = call i8 @llvm.vector.reduce.and.v9i8(<9 x i8> %a)
125 define i32 @test_v3i32(<3 x i32> %a) nounwind {
126 ; CHECK-LABEL: test_v3i32:
128 ; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8
129 ; CHECK-NEXT: fmov x8, d0
130 ; CHECK-NEXT: lsr x8, x8, #32
131 ; CHECK-NEXT: and v1.8b, v0.8b, v1.8b
132 ; CHECK-NEXT: fmov x9, d1
133 ; CHECK-NEXT: and w0, w9, w8
135 %b = call i32 @llvm.vector.reduce.and.v3i32(<3 x i32> %a)
139 define i1 @test_v4i1(<4 x i1> %a) nounwind {
140 ; CHECK-LABEL: test_v4i1:
142 ; CHECK-NEXT: mvn v0.8b, v0.8b
143 ; CHECK-NEXT: shl v0.4h, v0.4h, #15
144 ; CHECK-NEXT: cmlt v0.4h, v0.4h, #0
145 ; CHECK-NEXT: fcmp d0, #0.0
146 ; CHECK-NEXT: cset w0, eq
148 %b = call i1 @llvm.vector.reduce.and.v4i1(<4 x i1> %a)
152 define i24 @test_v4i24(<4 x i24> %a) nounwind {
153 ; CHECK-LABEL: test_v4i24:
155 ; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8
156 ; CHECK-NEXT: and v0.8b, v0.8b, v1.8b
157 ; CHECK-NEXT: fmov x8, d0
158 ; CHECK-NEXT: lsr x9, x8, #32
159 ; CHECK-NEXT: and w0, w8, w9
161 %b = call i24 @llvm.vector.reduce.and.v4i24(<4 x i24> %a)
165 define i128 @test_v2i128(<2 x i128> %a) nounwind {
166 ; CHECK-LABEL: test_v2i128:
168 ; CHECK-NEXT: and x1, x1, x3
169 ; CHECK-NEXT: and x0, x0, x2
171 %b = call i128 @llvm.vector.reduce.and.v2i128(<2 x i128> %a)
175 define i32 @test_v16i32(<16 x i32> %a) nounwind {
176 ; CHECK-LABEL: test_v16i32:
178 ; CHECK-NEXT: and v1.16b, v1.16b, v3.16b
179 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
180 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
181 ; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8
182 ; CHECK-NEXT: and v0.8b, v0.8b, v1.8b
183 ; CHECK-NEXT: fmov x8, d0
184 ; CHECK-NEXT: lsr x9, x8, #32
185 ; CHECK-NEXT: and w0, w8, w9
187 %b = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> %a)