blob: 55ccc626cad9c927207580607f05827572fe8e21 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// Auto-generated file. Do not edit!
// Template: src/s16-vlshift/scalar.c.in
// Generator: tools/xngen
//
// Copyright 2022 Google LLC
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <xnnpack/math.h>
#include <xnnpack/vlshift.h>
void xnn_s16_vlshift_ukernel__scalar_x3(
size_t batch,
const int16_t* input,
int16_t* output,
uint32_t shift)
{
assert(batch != 0);
assert(input != NULL);
assert(output != NULL);
assert(shift < 16);
for (; batch >= 3; batch -= 3) {
const uint16_t vi0 = (uint16_t) input[0];
const uint16_t vi1 = (uint16_t) input[1];
const uint16_t vi2 = (uint16_t) input[2];
input += 3;
const uint16_t vout0 = vi0 << shift;
const uint16_t vout1 = vi1 << shift;
const uint16_t vout2 = vi2 << shift;
output[0] = (int16_t) vout0;
output[1] = (int16_t) vout1;
output[2] = (int16_t) vout2;
output += 3;
}
if XNN_UNLIKELY(batch != 0) {
do {
const uint16_t vi = (uint16_t) *input++;
const uint16_t vout = vi << shift;
*output++ = (int16_t) vout;
} while (--batch != 0);
}
}
|