xref: /aosp_15_r20/external/XNNPACK/src/s16-vlshift/gen/scalar-x1.c (revision 4bdc94577ba0e567308109d787f7fec7b531ce36)
1 // Auto-generated file. Do not edit!
2 //   Template: src/s16-vlshift/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 #include <assert.h>
11 #include <stddef.h>
12 #include <stdint.h>
13 
14 #include <xnnpack/math.h>
15 #include <xnnpack/vlshift.h>
16 
17 
xnn_s16_vlshift_ukernel__scalar_x1(size_t batch,const int16_t * input,int16_t * output,uint32_t shift)18 void xnn_s16_vlshift_ukernel__scalar_x1(
19     size_t batch,
20     const int16_t* input,
21     int16_t* output,
22     uint32_t shift)
23 {
24   assert(batch != 0);
25   assert(input != NULL);
26   assert(output != NULL);
27   assert(shift < 16);
28 
29  if XNN_UNLIKELY(batch != 0) {
30    do {
31      const uint16_t vi = (uint16_t) *input++;
32 
33      const uint16_t vout = vi << shift;
34 
35      *output++ = (int16_t) vout;
36    } while (--batch != 0);
37  }
38 }
39