| 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_8x__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 <= 8); |
| 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 |
const uint32_t* x4 = (const uint32_t*) ((uintptr_t) x3 + x_stride); |
| 45 |
if XNN_UNPREDICTABLE(m <= 4) { |
| 46 |
x4 = x3; |
| 47 |
} |
| 48 |
const uint32_t* x5 = (const uint32_t*) ((uintptr_t) x4 + x_stride); |
| 49 |
if XNN_UNPREDICTABLE(m < 6) { |
| 50 |
x5 = x4; |
| 51 |
} |
| 52 |
const uint32_t* x6 = (const uint32_t*) ((uintptr_t) x5 + x_stride); |
| 53 |
if XNN_UNPREDICTABLE(m <= 6) { |
| 54 |
x6 = x5; |
| 55 |
} |
| 56 |
const uint32_t* x7 = (const uint32_t*) ((uintptr_t) x6 + x_stride); |
| 57 |
if XNN_UNPREDICTABLE(m != 8) { |
| 58 |
x7 = x6; |
| 59 |
} |
| 60 |
|
| 61 |
for (; k >= 4; k -= 4) { |
| 62 |
const uint32x4_t vx0123x0 = vld1q_u32(x0); x0 += 4; |
| 63 |
const uint32x4_t vx0123x1 = vld1q_u32(x1); x1 += 4; |
| 64 |
const uint32x4_t vx0123x2 = vld1q_u32(x2); x2 += 4; |
| 65 |
const uint32x4_t vx0123x3 = vld1q_u32(x3); x3 += 4; |
| 66 |
const uint32x4_t vx0123x4 = vld1q_u32(x4); x4 += 4; |
| 67 |
const uint32x4_t vx0123x5 = vld1q_u32(x5); x5 += 4; |
| 68 |
const uint32x4_t vx0123x6 = vld1q_u32(x6); x6 += 4; |
| 69 |
const uint32x4_t vx0123x7 = vld1q_u32(x7); x7 += 4; |
| 70 |
const uint32x4x2_t vz0123x0 = vzipq_u32(vx0123x0, vx0123x4); |
| 71 |
const uint32x4x2_t vz0123x1 = vzipq_u32(vx0123x1, vx0123x5); |
| 72 |
const uint32x4x2_t vz0123x2 = vzipq_u32(vx0123x2, vx0123x6); |
| 73 |
const uint32x4x2_t vz0123x3 = vzipq_u32(vx0123x3, vx0123x7); |
| 74 |
|
| 75 |
const uint32x4x4_t vy0123x0 = { vz0123x0.val[0], vz0123x1.val[0], vz0123x2.val[0], vz0123x3.val[0] }; |
| 76 |
const uint32x4x4_t vy0123x1 = { vz0123x0.val[1], vz0123x1.val[1], vz0123x2.val[1], vz0123x3.val[1] }; |
| 77 |
vst4q_u32(y, vy0123x0); y += 16; |
| 78 |
vst4q_u32(y, vy0123x1); y += 16; |
| 79 |
} |
| 80 |
|
| 81 |
if XNN_UNLIKELY(k != 0) { |
| 82 |
uint32x4_t vt0123 = vdupq_n_u32(0); |
| 83 |
uint32x4_t vt4567 = vdupq_n_u32(0); |
| 84 |
do { |
| 85 |
vt0123 = vld1q_lane_u32(x0, vt0123, 0); x0 += 1; |
| 86 |
vt0123 = vld1q_lane_u32(x1, vt0123, 1); x1 += 1; |
| 87 |
vt0123 = vld1q_lane_u32(x2, vt0123, 2); x2 += 1; |
| 88 |
vt0123 = vld1q_lane_u32(x3, vt0123, 3); x3 += 1; |
| 89 |
vt4567 = vld1q_lane_u32(x4, vt4567, 0); x4 += 1; |
| 90 |
vt4567 = vld1q_lane_u32(x5, vt4567, 1); x5 += 1; |
| 91 |
vt4567 = vld1q_lane_u32(x6, vt4567, 2); x6 += 1; |
| 92 |
vt4567 = vld1q_lane_u32(x7, vt4567, 3); x7 += 1; |
| 93 |
vst1q_u32(y, vt0123); y += 4; |
| 94 |
vst1q_u32(y, vt4567); y += 4; |
| 95 |
} while (--k != 0); |
| 96 |
} |
| 97 |
} |