Debian Codegraph @

src/f32-rminmax/gen/f32-rmax-wasmsimd-minmax-u8-acc2.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/f32-rminmax/wasmsimd.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2023 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/reduce.h"
16
17
18 void xnn_f32_rmax_ukernel__wasmsimd_minmax_u8_acc2(
19 size_t batch,
20 const float* input,
21 float* output,
22 const struct xnn_f32_default_params params[restrict XNN_MIN_ELEMENTS(1)])
23 {
24 assert(batch != 0);
25 assert(batch % sizeof(float) == 0);
26 assert(input != NULL);
27 assert(output != NULL);
28
29 v128_t vmax0 = wasm_v128_load32_splat(input);
30 v128_t vmax1 = vmax0;
31 for (; batch >= 8 * sizeof(float); batch -= 8 * sizeof(float)) {
32 const v128_t vt0 = wasm_v128_load(input);
33 const v128_t vt1 = wasm_v128_load(input + 4);
34 input += 8;
35
36 vmax0 = wasm_f32x4_max(vmax0, vt0);
37 vmax1 = wasm_f32x4_max(vmax1, vt1);
38 }
39 vmax0 = wasm_f32x4_max(vmax0, vmax1);
40 for (; batch >= 4 * sizeof(float); batch -= 4 * sizeof(float)) {
41 const v128_t vt = wasm_v128_load(input);
42 input += 4;
43
44 vmax0 = wasm_f32x4_max(vmax0, vt);
45 }
46 vmax0 = wasm_f32x4_max(vmax0, wasm_v64x2_shuffle(vmax0, vmax0, 1, 1));
47 if XNN_UNLIKELY(batch & (2 * sizeof(float))) {
48 const v128_t vt = wasm_v128_load64_zero(input);
49 input += 2;
50 vmax0 = wasm_f32x4_max(vmax0, vt);
51 }
52 vmax0 = wasm_f32x4_max(vmax0, wasm_v32x4_shuffle(vmax0, vmax0, 1, 1, 1, 1));
53 if XNN_UNLIKELY(batch & (1 * sizeof(float))) {
54 const v128_t vt = wasm_v128_load32_zero(input);
55 vmax0 = wasm_f32x4_max(vmax0, vt);
56 }
57 wasm_v128_store32_lane(output, vmax0, 0);
58 }