Debian Codegraph @

src/x32-packx/gen/x32-packx-4x-neon-st4-u4.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/x32-packx/neon.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2019 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
11 #include <assert.h>
12
13 #include <arm_neon.h>
14
15 #include "xnnpack/packx.h"
16
17
18 void xnn_x32_packx_ukernel_4x__neon_st4_x4(
19 size_t m,
20 size_t k,
21 const uint32_t* x,
22 size_t x_stride,
23 uint32_t* restrict y)
24 {
25 assert(m != 0);
26 assert(m <= 4);
27 assert(k != 0);
28 assert(x != NULL);
29 assert(y != NULL);
30
31 const uint32_t* x0 = x;
32 const uint32_t* x1 = (const uint32_t*) ((uintptr_t) x0 + x_stride);
33 if XNN_UNPREDICTABLE(m < 2) {
34 x1 = x0;
35 }
36 const uint32_t* x2 = (const uint32_t*) ((uintptr_t) x1 + x_stride);
37 if XNN_UNPREDICTABLE(m <= 2) {
38 x2 = x1;
39 }
40 const uint32_t* x3 = (const uint32_t*) ((uintptr_t) x2 + x_stride);
41 if XNN_UNPREDICTABLE(m != 4) {
42 x3 = x2;
43 }
44
45 for (; k >= 4; k -= 4) {
46 uint32x4x4_t vx0123x0123;
47 vx0123x0123.val[0] = vld1q_u32(x0); x0 += 4;
48 vx0123x0123.val[1] = vld1q_u32(x1); x1 += 4;
49 vx0123x0123.val[2] = vld1q_u32(x2); x2 += 4;
50 vx0123x0123.val[3] = vld1q_u32(x3); x3 += 4;
51 vst4q_u32(y, vx0123x0123); y += 16;
52 }
53
54 if XNN_UNLIKELY(k != 0) {
55 uint32x4_t vt0123 = vdupq_n_u32(0);
56 do {
57 vt0123 = vld1q_lane_u32(x0, vt0123, 0); x0 += 1;
58 vt0123 = vld1q_lane_u32(x1, vt0123, 1); x1 += 1;
59 vt0123 = vld1q_lane_u32(x2, vt0123, 2); x2 += 1;
60 vt0123 = vld1q_lane_u32(x3, vt0123, 3); x3 += 1;
61 vst1q_u32(y, vt0123); y += 4;
62 } while (--k != 0);
63 }
64 }