Debian Codegraph @

src/f32-vsqrt/gen/f32-vsqrt-wasmsimd-sqrt-u16.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_u16(
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 >= 16 * sizeof(float); batch -= 16 * sizeof(float)) {
31 const v128_t vx0123 = wasm_v128_load(input);
32 const v128_t vx4567 = wasm_v128_load(input + 4);
33 const v128_t vx89AB = wasm_v128_load(input + 8);
34 const v128_t vxCDEF = wasm_v128_load(input + 12);
35 input += 16;
36
37 const v128_t vy0123 = wasm_f32x4_sqrt(vx0123);
38 const v128_t vy4567 = wasm_f32x4_sqrt(vx4567);
39 const v128_t vy89AB = wasm_f32x4_sqrt(vx89AB);
40 const v128_t vyCDEF = wasm_f32x4_sqrt(vxCDEF);
41
42 wasm_v128_store(output, vy0123);
43 wasm_v128_store(output + 4, vy4567);
44 wasm_v128_store(output + 8, vy89AB);
45 wasm_v128_store(output + 12, vyCDEF);
46 output += 16;
47 }
48 for (; batch >= 4 * sizeof(float); batch -= 4 * sizeof(float)) {
49 const v128_t vx = wasm_v128_load(input);
50 input += 4;
51 const v128_t vy = wasm_f32x4_sqrt(vx);
52 wasm_v128_store(output, vy);
53 output += 4;
54 }
55 if XNN_UNLIKELY(batch != 0) {
56 const v128_t vx = wasm_v128_load(input);
57 v128_t vy = wasm_f32x4_sqrt(vx);
58 if (batch & (2 * sizeof(float))) {
59 wasm_v128_store64_lane(output, vy, 0);
60 vy = wasm_v64x2_shuffle(vy, vy, 1, 1);
61 output += 2;
62 }
63 if (batch & (1 * sizeof(float))) {
64 wasm_v128_store32_lane(output, vy, 0);
65 }
66 }
67 }