1 // Auto-generated file. Do not edit!
2 // Template: src/x32-transposec/scalar.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2021 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 <xnnpack/common.h>
14 #include <xnnpack/math.h>
15 #include <xnnpack/transpose.h>
16
xnn_x32_transposec_ukernel__1x4_scalar_float(const uint32_t * input,uint32_t * output,size_t input_stride,size_t output_stride,size_t block_width,size_t block_height)17 void xnn_x32_transposec_ukernel__1x4_scalar_float(
18 const uint32_t *input,
19 uint32_t * output,
20 size_t input_stride,
21 size_t output_stride,
22 size_t block_width,
23 size_t block_height) XNN_OOB_READS
24 {
25 assert(output_stride >= block_height * sizeof(float));
26 assert(input_stride >= block_width * sizeof(float));
27
28 const size_t tile_height = 1;
29 const size_t tile_width = 4;
30 const size_t tile_wbytes = tile_width * sizeof(float);
31 const size_t input_reset = tile_wbytes - block_height * input_stride;
32 const size_t output_reset = tile_width * output_stride - block_height * sizeof(float);
33 const size_t input_offset = tile_height * input_stride;
34
35 const float* i0 = (const float*) input;
36
37 float* o0 = (float*) output;
38 float* o1 = (float*) ((uintptr_t) o0 + output_stride);
39 float* o2 = (float*) ((uintptr_t) o1 + output_stride);
40 float* o3 = (float*) ((uintptr_t) o2 + output_stride);
41
42 do {
43 if XNN_UNPREDICTABLE(block_width < 2) {
44 o1 = o0;
45 }
46 if XNN_UNPREDICTABLE(block_width <= 2) {
47 o2 = o0;
48 }
49 if XNN_UNPREDICTABLE(block_width < 4) {
50 o3 = o0;
51 }
52 size_t bh = block_height;
53 for (; bh >= 1; bh -= 1) {
54 *o3++ = i0[3];
55 *o2++ = i0[2];
56 *o1++ = i0[1];
57 *o0++ = i0[0];
58 i0 = (const float*) ((uintptr_t) i0 + input_offset);
59 }
60
61 i0 = (const float*) ((uintptr_t) i0 + input_reset);
62 o0 = (float*) ((uintptr_t) o0 + output_reset);
63 o1 = (float*) ((uintptr_t) o1 + output_reset);
64 o2 = (float*) ((uintptr_t) o2 + output_reset);
65 o3 = (float*) ((uintptr_t) o3 + output_reset);
66 block_width = doz(block_width, tile_width);
67 } while (block_width != 0);
68 }
69