Debian Codegraph @

src/f32-vbinary/gen/f32-vminc-avx512f-u16.c

raw symbols SCIP
1 // Auto-generated file. Do not edit!
2 // Template: src/f32-vbinary/vopc-avx512f.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2019 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
11 #include <assert.h>
12
13 #include <immintrin.h>
14
15 #include "xnnpack/common.h"
16 #include "xnnpack/intrinsics-polyfill.h"
17 #include "xnnpack/vbinary.h"
18
19
20 void xnn_f32_vminc_ukernel__avx512f_u16(
21 size_t batch,
22 const float* input_a,
23 const float* input_b,
24 float* output,
25 const struct xnn_f32_default_params params[restrict XNN_MIN_ELEMENTS(1)])
26 {
27 assert(batch != 0);
28 assert(batch % sizeof(float) == 0);
29 assert(input_a != NULL);
30 assert(input_b != NULL);
31 assert(output != NULL);
32
33 const __m512 vb = _mm512_set1_ps(*input_b);
34
35 for (; batch >= 16 * sizeof(float); batch -= 16 * sizeof(float)) {
36 const __m512 va0 = _mm512_loadu_ps(input_a);
37 input_a += 16;
38
39 __m512 vacc0 = _mm512_min_ps(va0, vb);
40
41
42 _mm512_storeu_ps(output, vacc0);
43 output += 16;
44 }
45 if XNN_UNLIKELY(batch != 0) {
46 assert(batch >= 1 * sizeof(float));
47 assert(batch <= 15 * sizeof(float));
48 // Prepare mask for valid 32-bit elements (depends on batch).
49 batch >>= XNN_LOG2_SIZEOF_FLOAT;
50 const __mmask16 vmask = _cvtu32_mask16((uint32_t) ((UINT32_C(1) << batch) - UINT32_C(1)));
51
52 __m512 va = _mm512_maskz_loadu_ps(vmask, input_a);
53 __m512 vacc = _mm512_min_ps(va, vb);
54
55 _mm512_mask_storeu_ps(output, vmask, vacc);
56 }
57 }