1 // Auto-generated file. Do not edit! 2 // Template: src/x8-lut/scalar.c.in 3 // Generator: tools/xngen 4 // 5 // Copyright 2021 Google LLC 6 // 7 // This source code is licensed under the BSD-style license found in the 8 // LICENSE file in the root directory of this source tree. 9 10 #include <assert.h> 11 12 #include <xnnpack/lut.h> 13 #include <xnnpack/common.h> 14 15 xnn_x8_lut_ukernel__scalar_x4(size_t n,const uint8_t * x,uint8_t * y,const uint8_t t[restrict XNN_MIN_ELEMENTS (256)])16void xnn_x8_lut_ukernel__scalar_x4( 17 size_t n, 18 const uint8_t* x, 19 uint8_t* y, 20 const uint8_t t[restrict XNN_MIN_ELEMENTS(256)]) 21 { 22 assert(n != 0); 23 assert(x != NULL); 24 assert(y != NULL); 25 26 for (; n >= 4 * sizeof(uint8_t); n -= 4 * sizeof(uint8_t)) { 27 const size_t vx0 = (size_t) x[0]; 28 const size_t vx1 = (size_t) x[1]; 29 const size_t vx2 = (size_t) x[2]; 30 const size_t vx3 = (size_t) x[3]; 31 x += 4; 32 33 const uint32_t vt0 = (uint32_t) t[vx0]; 34 const uint32_t vt1 = (uint32_t) t[vx1]; 35 const uint32_t vt2 = (uint32_t) t[vx2]; 36 const uint32_t vt3 = (uint32_t) t[vx3]; 37 38 y[0] = (uint8_t) vt0; 39 y[1] = (uint8_t) vt1; 40 y[2] = (uint8_t) vt2; 41 y[3] = (uint8_t) vt3; 42 y += 4; 43 } 44 if XNN_UNLIKELY(n != 0) { 45 do { 46 const size_t vx = (size_t) *x++; 47 const uint32_t vt = (uint32_t) t[vx]; 48 *y++ = (uint8_t) vt; 49 n -= sizeof(uint8_t); 50 } while (n != 0); 51 } 52 } 53