xref: /aosp_15_r20/external/XNNPACK/src/x32-zip/x3-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_x32_zip_x3_ukernel__scalar(size_t n,const uint32_t * input,uint32_t * output)11 void xnn_x32_zip_x3_ukernel__scalar(
12     size_t n,
13     const uint32_t* input,
14     uint32_t* output)
15 {
16   assert(n != 0);
17   assert(n % 4 == 0);
18 
19   const uint32_t* x = input;
20   const uint32_t* y = (const uint32_t*) ((uintptr_t) x + n);
21   const uint32_t* z = (const uint32_t*) ((uintptr_t) y + n);
22   uint32_t* o = output;
23 
24   do {
25     const uint32_t vx = *x++;
26     const uint32_t vy = *y++;
27     const uint32_t vz = *z++;
28     o[0] = vx;
29     o[1] = vy;
30     o[2] = vz;
31     o += 3;
32 
33     n -= 4;
34   } while (n != 0);
35 }
36