Debian Codegraph @

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

raw symbols SCIP
1 // Auto-generated file. Do not edit!
2 // Template: src/f32-vsqrt/sse-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
12 #include <xmmintrin.h>
13
14 #include "xnnpack/common.h"
15 #include "xnnpack/vunary.h"
16
17
18 void xnn_f32_vsqrt_ukernel__sse_sqrt_u8(
19 size_t batch,
20 const float* input,
21 float* output,
22 const struct xnn_f32_default_params params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
23 {
24 assert(batch != 0);
25 assert(batch % sizeof(float) == 0);
26 assert(input != NULL);
27 assert(output != NULL);
28
29 for (; batch >= 8 * sizeof(float); batch -= 8 * sizeof(float)) {
30 const __m128 vx0123 = _mm_loadu_ps(input);
31 const __m128 vx4567 = _mm_loadu_ps(input + 4);
32 input += 8;
33
34 const __m128 vy0123 = _mm_sqrt_ps(vx0123);
35 const __m128 vy4567 = _mm_sqrt_ps(vx4567);
36
37 _mm_storeu_ps(output, vy0123);
38 _mm_storeu_ps(output + 4, vy4567);
39 output += 8;
40 }
41 for (; batch >= 4 * sizeof(float); batch -= 4 * sizeof(float)) {
42 const __m128 vx = _mm_loadu_ps(input);
43 input += 4;
44 const __m128 vy = _mm_sqrt_ps(vx);
45 _mm_storeu_ps(output, vy);
46 output += 4;
47 }
48 if XNN_UNLIKELY(batch != 0) {
49 const __m128 vx = _mm_loadu_ps(input);
50 __m128 vy = _mm_sqrt_ps(vx);
51 if (batch & (2 * sizeof(float))) {
52 _mm_storel_pi((__m64*) output, vy);
53 vy = _mm_movehl_ps(vy, vy);
54 output += 2;
55 }
56 if (batch & (1 * sizeof(float))) {
57 _mm_store_ss(output, vy);
58 }
59 }
60 }