| 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 |
|
| 16 |
void xnn_x8_lut_ukernel__scalar_u2( |
| 17 |
size_t batch, |
| 18 |
const uint8_t* input, |
| 19 |
uint8_t* output, |
| 20 |
const uint8_t table[restrict XNN_MIN_ELEMENTS(256)]) |
| 21 |
{ |
| 22 |
assert(batch != 0); |
| 23 |
assert(batch % sizeof(uint8_t) == 0); |
| 24 |
assert(input != NULL); |
| 25 |
assert(output != NULL); |
| 26 |
|
| 27 |
for (; batch >= 2 * sizeof(uint8_t); batch -= 2 * sizeof(uint8_t)) { |
| 28 |
const size_t vx0 = (size_t) input[0]; |
| 29 |
const size_t vx1 = (size_t) input[1]; |
| 30 |
input += 2; |
| 31 |
|
| 32 |
const uint32_t vt0 = (uint32_t) table[vx0]; |
| 33 |
const uint32_t vt1 = (uint32_t) table[vx1]; |
| 34 |
|
| 35 |
output[0] = (uint8_t) vt0; |
| 36 |
output[1] = (uint8_t) vt1; |
| 37 |
output += 2; |
| 38 |
} |
| 39 |
if XNN_UNLIKELY(batch != 0) { |
| 40 |
const size_t vx = (size_t) *input; |
| 41 |
const uint32_t vt = (uint32_t) table[vx]; |
| 42 |
*output = (uint8_t) vt; |
| 43 |
} |
| 44 |
} |