1 // Copyright (c) Facebook, Inc. and its affiliates.
2 // All rights reserved.
3 //
4 // Copyright 2019 Google LLC
5 //
6 // This source code is licensed under the BSD-style license found in the
7 // LICENSE file in the root directory of this source tree.
8
9 #include <gtest/gtest.h>
10
11 #include <xnnpack/lut.h>
12 #include "lut-microkernel-tester.h"
13
14
TEST(X8_LUT__SCALAR,n_eq_1)15 TEST(X8_LUT__SCALAR, n_eq_1) {
16 LUTMicrokernelTester()
17 .n(1)
18 .Test(xnn_x8_lut_ukernel__scalar);
19 }
20
TEST(X8_LUT__SCALAR,small_n)21 TEST(X8_LUT__SCALAR, small_n) {
22 for (size_t n = 2; n <= 16; n++) {
23 LUTMicrokernelTester()
24 .n(n)
25 .Test(xnn_x8_lut_ukernel__scalar);
26 }
27 }
28
TEST(X8_LUT__SCALAR,large_n)29 TEST(X8_LUT__SCALAR, large_n) {
30 for (size_t n = 16; n <= 128; n+=2) {
31 LUTMicrokernelTester()
32 .n(n)
33 .Test(xnn_x8_lut_ukernel__scalar);
34 }
35 }
36
TEST(X8_LUT__SCALAR,n_eq_1_inplace)37 TEST(X8_LUT__SCALAR, n_eq_1_inplace) {
38 LUTMicrokernelTester()
39 .n(1)
40 .inplace(true)
41 .Test(xnn_x8_lut_ukernel__scalar);
42 }
43
TEST(X8_LUT__SCALAR,small_n_inplace)44 TEST(X8_LUT__SCALAR, small_n_inplace) {
45 for (size_t n = 2; n <= 16; n++) {
46 LUTMicrokernelTester()
47 .n(n)
48 .inplace(true)
49 .Test(xnn_x8_lut_ukernel__scalar);
50 }
51 }
52
TEST(X8_LUT__SCALAR,large_n_inplace)53 TEST(X8_LUT__SCALAR, large_n_inplace) {
54 for (size_t n = 16; n <= 128; n+=2) {
55 LUTMicrokernelTester()
56 .n(n)
57 .inplace(true)
58 .Test(xnn_x8_lut_ukernel__scalar);
59 }
60 }
61