xref: /aosp_15_r20/external/XNNPACK/src/x8-zip/x4-scalar.c (revision 4bdc94577ba0e567308109d787f7fec7b531ce36)
1 // Copyright 2019 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 #include <assert.h>
7 
8 #include <xnnpack/zip.h>
9 
10 
xnn_x8_zip_x4_ukernel__scalar(size_t n,const uint8_t * input,uint8_t * output)11 void xnn_x8_zip_x4_ukernel__scalar(
12     size_t n,
13     const uint8_t* input,
14     uint8_t* output)
15 {
16   assert(n != 0);
17 
18   const uint8_t* x = input;
19   const uint8_t* y = (const uint8_t*) ((uintptr_t) x + n);
20   const uint8_t* z = (const uint8_t*) ((uintptr_t) y + n);
21   const uint8_t* w = (const uint8_t*) ((uintptr_t) z + n);
22   uint8_t* o = output;
23 
24   do {
25     const uint8_t vx = *x++;
26     const uint8_t vy = *y++;
27     const uint8_t vz = *z++;
28     const uint8_t vw = *w++;
29     o[0] = vx;
30     o[1] = vy;
31     o[2] = vz;
32     o[3] = vw;
33     o += 4;
34 
35     n -= sizeof(uint8_t);
36   } while (n != 0);
37 }
38