Debian Codegraph @

src/qu8-rsum/gen/qu8-rsum-scalar-u4.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/qu8-rsum/scalar.c.in
3 // Generator: tools/xngen
4 //
5 // This source code is licensed under the BSD-style license found in the
6 // LICENSE file in the root directory of this source tree.
7
8 #include <assert.h>
9
10 #include "xnnpack/common.h"
11 #include "xnnpack/math.h"
12 #include "xnnpack/reduce.h"
13
14
15 void xnn_qu8_rsum_ukernel__scalar_u4(
16 size_t batch,
17 const uint8_t* restrict input,
18 uint32_t* restrict output,
19 const struct xnn_qs8_rsum_params params[restrict XNN_MIN_ELEMENTS(1)])
20 {
21 assert(batch != 0);
22 assert(input != NULL);
23 assert(output != NULL);
24 assert(params != NULL);
25
26 uint32_t vacc0 = 0;
27 for (; batch >= 4; batch -= 4) {
28 const uint32_t vt0 = (uint32_t) input[0];
29 const uint32_t vt1 = (uint32_t) input[1];
30 const uint32_t vt2 = (uint32_t) input[2];
31 const uint32_t vt3 = (uint32_t) input[3];
32 input += 4;
33
34 vacc0 += vt0;
35 vacc0 += vt1;
36 vacc0 += vt2;
37 vacc0 += vt3;
38 }
39
40 if XNN_UNLIKELY(batch != 0) {
41 do {
42 const uint32_t vt = (uint32_t) *input++;
43 vacc0 += vt;
44 batch -= sizeof(uint8_t);
45 } while (batch != 0);
46 }
47
48 *output += vacc0;
49 }