1 // Copyright 2020 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/f16-clamp.yaml 8 // Generator: tools/generate-clamp-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/clamp.h> 17 #include "clamp-microkernel-tester.h" 18 19 20 #if XNN_ARCH_ARM64 TEST(F16_CLAMP__NEONFP16ARITH_X8,batch_eq_8)21 TEST(F16_CLAMP__NEONFP16ARITH_X8, batch_eq_8) { 22 TEST_REQUIRES_ARM_NEON_FP16_ARITH; 23 ClampMicrokernelTester() 24 .batch_size(8) 25 .Test(xnn_f16_clamp_ukernel__neonfp16arith_x8); 26 } 27 TEST(F16_CLAMP__NEONFP16ARITH_X8,batch_div_8)28 TEST(F16_CLAMP__NEONFP16ARITH_X8, batch_div_8) { 29 TEST_REQUIRES_ARM_NEON_FP16_ARITH; 30 for (size_t batch_size = 16; batch_size < 80; batch_size += 8) { 31 ClampMicrokernelTester() 32 .batch_size(batch_size) 33 .Test(xnn_f16_clamp_ukernel__neonfp16arith_x8); 34 } 35 } 36 TEST(F16_CLAMP__NEONFP16ARITH_X8,batch_lt_8)37 TEST(F16_CLAMP__NEONFP16ARITH_X8, batch_lt_8) { 38 TEST_REQUIRES_ARM_NEON_FP16_ARITH; 39 for (size_t batch_size = 1; batch_size < 8; batch_size++) { 40 ClampMicrokernelTester() 41 .batch_size(batch_size) 42 .Test(xnn_f16_clamp_ukernel__neonfp16arith_x8); 43 } 44 } 45 TEST(F16_CLAMP__NEONFP16ARITH_X8,batch_gt_8)46 TEST(F16_CLAMP__NEONFP16ARITH_X8, batch_gt_8) { 47 TEST_REQUIRES_ARM_NEON_FP16_ARITH; 48 for (size_t batch_size = 9; batch_size < 16; batch_size++) { 49 ClampMicrokernelTester() 50 .batch_size(batch_size) 51 .Test(xnn_f16_clamp_ukernel__neonfp16arith_x8); 52 } 53 } 54 TEST(F16_CLAMP__NEONFP16ARITH_X8,inplace)55 TEST(F16_CLAMP__NEONFP16ARITH_X8, inplace) { 56 TEST_REQUIRES_ARM_NEON_FP16_ARITH; 57 for (size_t batch_size = 1; batch_size <= 40; batch_size += 7) { 58 ClampMicrokernelTester() 59 .batch_size(batch_size) 60 .inplace(true) 61 .Test(xnn_f16_clamp_ukernel__neonfp16arith_x8); 62 } 63 } 64 TEST(F16_CLAMP__NEONFP16ARITH_X8,qmin)65 TEST(F16_CLAMP__NEONFP16ARITH_X8, qmin) { 66 TEST_REQUIRES_ARM_NEON_FP16_ARITH; 67 for (size_t batch_size = 1; batch_size <= 40; batch_size += 7) { 68 for (uint8_t qmin = 1; qmin < 255; qmin++) { 69 ClampMicrokernelTester() 70 .batch_size(batch_size) 71 .qmin(qmin) 72 .qmax(255) 73 .Test(xnn_f16_clamp_ukernel__neonfp16arith_x8); 74 } 75 } 76 } 77 TEST(F16_CLAMP__NEONFP16ARITH_X8,qmax)78 TEST(F16_CLAMP__NEONFP16ARITH_X8, qmax) { 79 TEST_REQUIRES_ARM_NEON_FP16_ARITH; 80 for (size_t batch_size = 1; batch_size <= 40; batch_size += 7) { 81 for (uint8_t qmax = 1; qmax < 255; qmax++) { 82 ClampMicrokernelTester() 83 .batch_size(batch_size) 84 .qmin(0) 85 .qmax(qmax) 86 .Test(xnn_f16_clamp_ukernel__neonfp16arith_x8); 87 } 88 } 89 } 90 #endif // XNN_ARCH_ARM64 91 92 93 #if XNN_ARCH_ARM64 TEST(F16_CLAMP__NEONFP16ARITH_X16,batch_eq_16)94 TEST(F16_CLAMP__NEONFP16ARITH_X16, batch_eq_16) { 95 TEST_REQUIRES_ARM_NEON_FP16_ARITH; 96 ClampMicrokernelTester() 97 .batch_size(16) 98 .Test(xnn_f16_clamp_ukernel__neonfp16arith_x16); 99 } 100 TEST(F16_CLAMP__NEONFP16ARITH_X16,batch_div_16)101 TEST(F16_CLAMP__NEONFP16ARITH_X16, batch_div_16) { 102 TEST_REQUIRES_ARM_NEON_FP16_ARITH; 103 for (size_t batch_size = 32; batch_size < 160; batch_size += 16) { 104 ClampMicrokernelTester() 105 .batch_size(batch_size) 106 .Test(xnn_f16_clamp_ukernel__neonfp16arith_x16); 107 } 108 } 109 TEST(F16_CLAMP__NEONFP16ARITH_X16,batch_lt_16)110 TEST(F16_CLAMP__NEONFP16ARITH_X16, batch_lt_16) { 111 TEST_REQUIRES_ARM_NEON_FP16_ARITH; 112 for (size_t batch_size = 1; batch_size < 16; batch_size++) { 113 ClampMicrokernelTester() 114 .batch_size(batch_size) 115 .Test(xnn_f16_clamp_ukernel__neonfp16arith_x16); 116 } 117 } 118 TEST(F16_CLAMP__NEONFP16ARITH_X16,batch_gt_16)119 TEST(F16_CLAMP__NEONFP16ARITH_X16, batch_gt_16) { 120 TEST_REQUIRES_ARM_NEON_FP16_ARITH; 121 for (size_t batch_size = 17; batch_size < 32; batch_size++) { 122 ClampMicrokernelTester() 123 .batch_size(batch_size) 124 .Test(xnn_f16_clamp_ukernel__neonfp16arith_x16); 125 } 126 } 127 TEST(F16_CLAMP__NEONFP16ARITH_X16,inplace)128 TEST(F16_CLAMP__NEONFP16ARITH_X16, inplace) { 129 TEST_REQUIRES_ARM_NEON_FP16_ARITH; 130 for (size_t batch_size = 1; batch_size <= 80; batch_size += 15) { 131 ClampMicrokernelTester() 132 .batch_size(batch_size) 133 .inplace(true) 134 .Test(xnn_f16_clamp_ukernel__neonfp16arith_x16); 135 } 136 } 137 TEST(F16_CLAMP__NEONFP16ARITH_X16,qmin)138 TEST(F16_CLAMP__NEONFP16ARITH_X16, qmin) { 139 TEST_REQUIRES_ARM_NEON_FP16_ARITH; 140 for (size_t batch_size = 1; batch_size <= 80; batch_size += 15) { 141 for (uint8_t qmin = 1; qmin < 255; qmin++) { 142 ClampMicrokernelTester() 143 .batch_size(batch_size) 144 .qmin(qmin) 145 .qmax(255) 146 .Test(xnn_f16_clamp_ukernel__neonfp16arith_x16); 147 } 148 } 149 } 150 TEST(F16_CLAMP__NEONFP16ARITH_X16,qmax)151 TEST(F16_CLAMP__NEONFP16ARITH_X16, qmax) { 152 TEST_REQUIRES_ARM_NEON_FP16_ARITH; 153 for (size_t batch_size = 1; batch_size <= 80; batch_size += 15) { 154 for (uint8_t qmax = 1; qmax < 255; qmax++) { 155 ClampMicrokernelTester() 156 .batch_size(batch_size) 157 .qmin(0) 158 .qmax(qmax) 159 .Test(xnn_f16_clamp_ukernel__neonfp16arith_x16); 160 } 161 } 162 } 163 #endif // XNN_ARCH_ARM64 164