Debian Codegraph @

src/f32-vsqrt/gen/f32-vsqrt-wasmsimd-sqrt-u8.c

raw symbols SCIP
1 // Auto-generated file. Do not edit!
2 // Template: src/f32-vsqrt/wasmsimd-sqrt.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 #include <math.h>
12
13 #include <wasm_simd128.h>
14
15 #include "xnnpack/common.h"
16 #include "xnnpack/vunary.h"
17
18
19 void xnn_f32_vsqrt_ukernel__wasmsimd_sqrt_u8(
20 size_t batch,
21 const float* input,
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 != NULL);
28 assert(output != NULL);
29
30 for (; batch >= 8 * sizeof(float); batch -= 8 * sizeof(float)) {
31 const v128_t vx0123 = wasm_v128_load(input);
32 const v128_t vx4567 = wasm_v128_load(input + 4);
33 input += 8;
34
35 const v128_t vy0123 = wasm_f32x4_sqrt(vx0123);
36 const v128_t vy4567 = wasm_f32x4_sqrt(vx4567);
37
38 wasm_v128_store(output, vy0123);
39 wasm_v128_store(output + 4, vy4567);
40 output += 8;
41 }
42 for (; batch >= 4 * sizeof(float); batch -= 4 * sizeof(float)) {
43 const v128_t vx = wasm_v128_load(input);
44 input += 4;
45 const v128_t vy = wasm_f32x4_sqrt(vx);
46 wasm_v128_store(output, vy);
47 output += 4;
48 }
49 if XNN_UNLIKELY(batch != 0) {
50 const v128_t vx = wasm_v128_load(input);
51 v128_t vy = wasm_f32x4_sqrt(vx);
52 if (batch & (2 * sizeof(float))) {
53 wasm_v128_store64_lane(output, vy, 0);
54 vy = wasm_v64x2_shuffle(vy, vy, 1, 1);
55 output += 2;
56 }
57 if (batch & (1 * sizeof(float))) {
58 wasm_v128_store32_lane(output, vy, 0);
59 }
60 }
61 }