1 // Auto-generated file. Do not edit!
2 // Template: src/x24-transposec/scalar.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2022 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_x24_transposec_ukernel__1x2_scalar(const void * input,void * output,size_t input_stride,size_t output_stride,size_t block_width,size_t block_height)17 void xnn_x24_transposec_ukernel__1x2_scalar(
18 const void *input,
19 void * output,
20 size_t input_stride,
21 size_t output_stride,
22 size_t block_width,
23 size_t block_height)
24 {
25 assert(output_stride >= block_height * 3);
26 assert(input_stride >= block_width * 3);
27
28 const size_t input_reset = 6 - block_height * input_stride;
29 const size_t output_reset = 2 * output_stride - block_height * 3;
30 const size_t input_offset = 1 * input_stride;
31
32 const uint8_t* i0 = (const uint8_t*) input;
33
34 uint8_t* o0 = (uint8_t*) output;
35 uint8_t* o1 = (uint8_t*) ((uintptr_t) o0 + output_stride);
36
37 do {
38 if XNN_UNPREDICTABLE(block_width < 2) {
39 o1 = o0;
40 }
41 size_t bh = block_height;
42 for (; bh >= 1; bh -= 1) {
43 o1[0] = i0[3];
44 o1[1] = i0[4];
45 o1[2] = i0[5];
46 o1 += 3;
47 o0[0] = i0[0];
48 o0[1] = i0[1];
49 o0[2] = i0[2];
50 o0 += 3;
51 i0 = (const uint8_t*) ((uintptr_t) i0 + input_offset);
52 }
53
54 i0 = (const uint8_t*) ((uintptr_t) i0 + input_reset);
55 o0 = (uint8_t*) ((uintptr_t) o0 + output_reset);
56 o1 = (uint8_t*) ((uintptr_t) o1 + output_reset);
57 block_width = doz(block_width, 2);
58 } while (block_width != 0);
59 }
60