Debian Codegraph @

src/f32-vbinary/gen/f32-vminc-wasmsimd-arm-u16.c

raw symbols SCIP
1 // Auto-generated file. Do not edit!
2 // Template: src/f32-vbinary/vopc-wasmsimd.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2020 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
12 #include <wasm_simd128.h>
13
14 #include "xnnpack/common.h"
15 #include "xnnpack/vbinary.h"
16
17
18 void xnn_f32_vminc_ukernel__wasmsimd_arm_u16(
19 size_t batch,
20 const float* input_a,
21 const float* input_b,
22 float* output,
23 const struct xnn_f32_default_params params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
24 {
25 assert(batch != 0);
26 assert(batch % sizeof(float) == 0);
27 assert(input_a != NULL);
28 assert(input_b != NULL);
29 assert(output != NULL);
30
31 const v128_t vb = wasm_v128_load32_splat(input_b);
32
33 for (; batch >= 16 * sizeof(float); batch -= 16 * sizeof(float)) {
34 const v128_t va0 = wasm_v128_load(input_a);
35 const v128_t va1 = wasm_v128_load(input_a + 4);
36 const v128_t va2 = wasm_v128_load(input_a + 8);
37 const v128_t va3 = wasm_v128_load(input_a + 12);
38 input_a += 16;
39
40 v128_t vy0 = wasm_f32x4_min(va0, vb);
41 v128_t vy1 = wasm_f32x4_min(va1, vb);
42 v128_t vy2 = wasm_f32x4_min(va2, vb);
43 v128_t vy3 = wasm_f32x4_min(va3, vb);
44
45
46 wasm_v128_store(output, vy0);
47 wasm_v128_store(output + 4, vy1);
48 wasm_v128_store(output + 8, vy2);
49 wasm_v128_store(output + 12, vy3);
50 output += 16;
51 }
52 for (; batch >= 4 * sizeof(float); batch -= 4 * sizeof(float)) {
53 const v128_t va = wasm_v128_load(input_a);
54 input_a += 4;
55
56 v128_t vy = wasm_f32x4_min(va, vb);
57
58 wasm_v128_store(output, vy);
59 output += 4;
60 }
61 if XNN_UNLIKELY(batch != 0) {
62 const v128_t va = wasm_v128_load(input_a);
63
64 v128_t vy = wasm_f32x4_min(va, vb);
65
66 if (batch & (2 * sizeof(float))) {
67 wasm_v128_store64_lane(output, vy, 0);
68 vy = wasm_v64x2_shuffle(vy, vy, 1, 1);
69 output += 2;
70 }
71 if (batch & (1 * sizeof(float))) {
72 wasm_v128_store32_lane(output, vy, 0);
73 }
74 }
75 }