xref: /aosp_15_r20/external/XNNPACK/test/s16-rmaxabs.cc (revision 4bdc94577ba0e567308109d787f7fec7b531ce36)
1 // Copyright 2022 Google LLC
2 //
3 // This source code is licensed under the BSD-style license found in the
4 // LICENSE file in the root directory of this source tree.
5 //
6 // Auto-generated file. Do not edit!
7 //   Specification: test/s16-rmaxabs.yaml
8 //   Generator: tools/generate-rmaxabs-test.py
9 
10 
11 #include <gtest/gtest.h>
12 
13 #include <xnnpack/common.h>
14 #include <xnnpack/isa-checks.h>
15 
16 #include <xnnpack/rmaxabs.h>
17 #include "rmaxabs-microkernel-tester.h"
18 
19 
20 #if XNN_ARCH_ARM || XNN_ARCH_ARM64
TEST(S16_RMAXABS__NEON_X8,batch_eq_8)21   TEST(S16_RMAXABS__NEON_X8, batch_eq_8) {
22     TEST_REQUIRES_ARM_NEON;
23     RMaxAbsMicrokernelTester()
24       .batch(8)
25       .Test(xnn_s16_rmaxabs_ukernel__neon_x8);
26   }
27 
TEST(S16_RMAXABS__NEON_X8,batch_div_8)28   TEST(S16_RMAXABS__NEON_X8, batch_div_8) {
29     TEST_REQUIRES_ARM_NEON;
30     for (size_t batch = 16; batch < 80; batch += 8) {
31       RMaxAbsMicrokernelTester()
32         .batch(batch)
33         .Test(xnn_s16_rmaxabs_ukernel__neon_x8);
34     }
35   }
36 
TEST(S16_RMAXABS__NEON_X8,batch_lt_8)37   TEST(S16_RMAXABS__NEON_X8, batch_lt_8) {
38     TEST_REQUIRES_ARM_NEON;
39     for (size_t batch = 1; batch < 8; batch++) {
40       RMaxAbsMicrokernelTester()
41         .batch(batch)
42         .Test(xnn_s16_rmaxabs_ukernel__neon_x8);
43     }
44   }
45 
TEST(S16_RMAXABS__NEON_X8,batch_gt_8)46   TEST(S16_RMAXABS__NEON_X8, batch_gt_8) {
47     TEST_REQUIRES_ARM_NEON;
48     for (size_t batch = 9; batch < 16; batch++) {
49       RMaxAbsMicrokernelTester()
50         .batch(batch)
51         .Test(xnn_s16_rmaxabs_ukernel__neon_x8);
52     }
53   }
54 #endif  // XNN_ARCH_ARM || XNN_ARCH_ARM64
55 
56 
57 #if XNN_ARCH_ARM || XNN_ARCH_ARM64
TEST(S16_RMAXABS__NEON_X16,batch_eq_16)58   TEST(S16_RMAXABS__NEON_X16, batch_eq_16) {
59     TEST_REQUIRES_ARM_NEON;
60     RMaxAbsMicrokernelTester()
61       .batch(16)
62       .Test(xnn_s16_rmaxabs_ukernel__neon_x16);
63   }
64 
TEST(S16_RMAXABS__NEON_X16,batch_div_16)65   TEST(S16_RMAXABS__NEON_X16, batch_div_16) {
66     TEST_REQUIRES_ARM_NEON;
67     for (size_t batch = 32; batch < 160; batch += 16) {
68       RMaxAbsMicrokernelTester()
69         .batch(batch)
70         .Test(xnn_s16_rmaxabs_ukernel__neon_x16);
71     }
72   }
73 
TEST(S16_RMAXABS__NEON_X16,batch_lt_16)74   TEST(S16_RMAXABS__NEON_X16, batch_lt_16) {
75     TEST_REQUIRES_ARM_NEON;
76     for (size_t batch = 1; batch < 16; batch++) {
77       RMaxAbsMicrokernelTester()
78         .batch(batch)
79         .Test(xnn_s16_rmaxabs_ukernel__neon_x16);
80     }
81   }
82 
TEST(S16_RMAXABS__NEON_X16,batch_gt_16)83   TEST(S16_RMAXABS__NEON_X16, batch_gt_16) {
84     TEST_REQUIRES_ARM_NEON;
85     for (size_t batch = 17; batch < 32; batch++) {
86       RMaxAbsMicrokernelTester()
87         .batch(batch)
88         .Test(xnn_s16_rmaxabs_ukernel__neon_x16);
89     }
90   }
91 #endif  // XNN_ARCH_ARM || XNN_ARCH_ARM64
92 
93 
94 #if XNN_ARCH_ARM || XNN_ARCH_ARM64
TEST(S16_RMAXABS__NEON_X24,batch_eq_24)95   TEST(S16_RMAXABS__NEON_X24, batch_eq_24) {
96     TEST_REQUIRES_ARM_NEON;
97     RMaxAbsMicrokernelTester()
98       .batch(24)
99       .Test(xnn_s16_rmaxabs_ukernel__neon_x24);
100   }
101 
TEST(S16_RMAXABS__NEON_X24,batch_div_24)102   TEST(S16_RMAXABS__NEON_X24, batch_div_24) {
103     TEST_REQUIRES_ARM_NEON;
104     for (size_t batch = 48; batch < 240; batch += 24) {
105       RMaxAbsMicrokernelTester()
106         .batch(batch)
107         .Test(xnn_s16_rmaxabs_ukernel__neon_x24);
108     }
109   }
110 
TEST(S16_RMAXABS__NEON_X24,batch_lt_24)111   TEST(S16_RMAXABS__NEON_X24, batch_lt_24) {
112     TEST_REQUIRES_ARM_NEON;
113     for (size_t batch = 1; batch < 24; batch++) {
114       RMaxAbsMicrokernelTester()
115         .batch(batch)
116         .Test(xnn_s16_rmaxabs_ukernel__neon_x24);
117     }
118   }
119 
TEST(S16_RMAXABS__NEON_X24,batch_gt_24)120   TEST(S16_RMAXABS__NEON_X24, batch_gt_24) {
121     TEST_REQUIRES_ARM_NEON;
122     for (size_t batch = 25; batch < 48; batch++) {
123       RMaxAbsMicrokernelTester()
124         .batch(batch)
125         .Test(xnn_s16_rmaxabs_ukernel__neon_x24);
126     }
127   }
128 #endif  // XNN_ARCH_ARM || XNN_ARCH_ARM64
129 
130 
131 #if XNN_ARCH_ARM || XNN_ARCH_ARM64
TEST(S16_RMAXABS__NEON_X32,batch_eq_32)132   TEST(S16_RMAXABS__NEON_X32, batch_eq_32) {
133     TEST_REQUIRES_ARM_NEON;
134     RMaxAbsMicrokernelTester()
135       .batch(32)
136       .Test(xnn_s16_rmaxabs_ukernel__neon_x32);
137   }
138 
TEST(S16_RMAXABS__NEON_X32,batch_div_32)139   TEST(S16_RMAXABS__NEON_X32, batch_div_32) {
140     TEST_REQUIRES_ARM_NEON;
141     for (size_t batch = 64; batch < 320; batch += 32) {
142       RMaxAbsMicrokernelTester()
143         .batch(batch)
144         .Test(xnn_s16_rmaxabs_ukernel__neon_x32);
145     }
146   }
147 
TEST(S16_RMAXABS__NEON_X32,batch_lt_32)148   TEST(S16_RMAXABS__NEON_X32, batch_lt_32) {
149     TEST_REQUIRES_ARM_NEON;
150     for (size_t batch = 1; batch < 32; batch++) {
151       RMaxAbsMicrokernelTester()
152         .batch(batch)
153         .Test(xnn_s16_rmaxabs_ukernel__neon_x32);
154     }
155   }
156 
TEST(S16_RMAXABS__NEON_X32,batch_gt_32)157   TEST(S16_RMAXABS__NEON_X32, batch_gt_32) {
158     TEST_REQUIRES_ARM_NEON;
159     for (size_t batch = 33; batch < 64; batch++) {
160       RMaxAbsMicrokernelTester()
161         .batch(batch)
162         .Test(xnn_s16_rmaxabs_ukernel__neon_x32);
163     }
164   }
165 #endif  // XNN_ARCH_ARM || XNN_ARCH_ARM64
166 
167 
TEST(S16_RMAXABS__SCALAR_X1,batch_eq_1)168 TEST(S16_RMAXABS__SCALAR_X1, batch_eq_1) {
169   RMaxAbsMicrokernelTester()
170     .batch(1)
171     .Test(xnn_s16_rmaxabs_ukernel__scalar_x1);
172 }
173 
TEST(S16_RMAXABS__SCALAR_X1,batch_gt_1)174 TEST(S16_RMAXABS__SCALAR_X1, batch_gt_1) {
175   for (size_t batch = 2; batch < 10; batch++) {
176     RMaxAbsMicrokernelTester()
177       .batch(batch)
178       .Test(xnn_s16_rmaxabs_ukernel__scalar_x1);
179   }
180 }
181 
182 
TEST(S16_RMAXABS__SCALAR_X2,batch_eq_2)183 TEST(S16_RMAXABS__SCALAR_X2, batch_eq_2) {
184   RMaxAbsMicrokernelTester()
185     .batch(2)
186     .Test(xnn_s16_rmaxabs_ukernel__scalar_x2);
187 }
188 
TEST(S16_RMAXABS__SCALAR_X2,batch_div_2)189 TEST(S16_RMAXABS__SCALAR_X2, batch_div_2) {
190   for (size_t batch = 4; batch < 20; batch += 2) {
191     RMaxAbsMicrokernelTester()
192       .batch(batch)
193       .Test(xnn_s16_rmaxabs_ukernel__scalar_x2);
194   }
195 }
196 
TEST(S16_RMAXABS__SCALAR_X2,batch_lt_2)197 TEST(S16_RMAXABS__SCALAR_X2, batch_lt_2) {
198   for (size_t batch = 1; batch < 2; batch++) {
199     RMaxAbsMicrokernelTester()
200       .batch(batch)
201       .Test(xnn_s16_rmaxabs_ukernel__scalar_x2);
202   }
203 }
204 
TEST(S16_RMAXABS__SCALAR_X2,batch_gt_2)205 TEST(S16_RMAXABS__SCALAR_X2, batch_gt_2) {
206   for (size_t batch = 3; batch < 4; batch++) {
207     RMaxAbsMicrokernelTester()
208       .batch(batch)
209       .Test(xnn_s16_rmaxabs_ukernel__scalar_x2);
210   }
211 }
212 
213 
TEST(S16_RMAXABS__SCALAR_X3,batch_eq_3)214 TEST(S16_RMAXABS__SCALAR_X3, batch_eq_3) {
215   RMaxAbsMicrokernelTester()
216     .batch(3)
217     .Test(xnn_s16_rmaxabs_ukernel__scalar_x3);
218 }
219 
TEST(S16_RMAXABS__SCALAR_X3,batch_div_3)220 TEST(S16_RMAXABS__SCALAR_X3, batch_div_3) {
221   for (size_t batch = 6; batch < 30; batch += 3) {
222     RMaxAbsMicrokernelTester()
223       .batch(batch)
224       .Test(xnn_s16_rmaxabs_ukernel__scalar_x3);
225   }
226 }
227 
TEST(S16_RMAXABS__SCALAR_X3,batch_lt_3)228 TEST(S16_RMAXABS__SCALAR_X3, batch_lt_3) {
229   for (size_t batch = 1; batch < 3; batch++) {
230     RMaxAbsMicrokernelTester()
231       .batch(batch)
232       .Test(xnn_s16_rmaxabs_ukernel__scalar_x3);
233   }
234 }
235 
TEST(S16_RMAXABS__SCALAR_X3,batch_gt_3)236 TEST(S16_RMAXABS__SCALAR_X3, batch_gt_3) {
237   for (size_t batch = 4; batch < 6; batch++) {
238     RMaxAbsMicrokernelTester()
239       .batch(batch)
240       .Test(xnn_s16_rmaxabs_ukernel__scalar_x3);
241   }
242 }
243 
244 
TEST(S16_RMAXABS__SCALAR_X4,batch_eq_4)245 TEST(S16_RMAXABS__SCALAR_X4, batch_eq_4) {
246   RMaxAbsMicrokernelTester()
247     .batch(4)
248     .Test(xnn_s16_rmaxabs_ukernel__scalar_x4);
249 }
250 
TEST(S16_RMAXABS__SCALAR_X4,batch_div_4)251 TEST(S16_RMAXABS__SCALAR_X4, batch_div_4) {
252   for (size_t batch = 8; batch < 40; batch += 4) {
253     RMaxAbsMicrokernelTester()
254       .batch(batch)
255       .Test(xnn_s16_rmaxabs_ukernel__scalar_x4);
256   }
257 }
258 
TEST(S16_RMAXABS__SCALAR_X4,batch_lt_4)259 TEST(S16_RMAXABS__SCALAR_X4, batch_lt_4) {
260   for (size_t batch = 1; batch < 4; batch++) {
261     RMaxAbsMicrokernelTester()
262       .batch(batch)
263       .Test(xnn_s16_rmaxabs_ukernel__scalar_x4);
264   }
265 }
266 
TEST(S16_RMAXABS__SCALAR_X4,batch_gt_4)267 TEST(S16_RMAXABS__SCALAR_X4, batch_gt_4) {
268   for (size_t batch = 5; batch < 8; batch++) {
269     RMaxAbsMicrokernelTester()
270       .batch(batch)
271       .Test(xnn_s16_rmaxabs_ukernel__scalar_x4);
272   }
273 }
274