Debian Codegraph @

src/f32-vbinary/gen/f32-vrpreluc-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_vrpreluc_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 const __m512 vzero = _mm512_setzero_ps();
35 const __mmask16 vsign = _mm512_cmp_ps_mask(vb, vzero, _CMP_LT_OQ);
36
37 for (; batch >= 16 * sizeof(float); batch -= 16 * sizeof(float)) {
38 const __m512 va0 = _mm512_loadu_ps(input_a);
39 input_a += 16;
40
41 __m512 vacc0 = _mm512_mask_mul_ps(vb, vsign, va0, vb);
42
43 _mm512_storeu_ps(output, vacc0);
44 output += 16;
45 }
46 if XNN_UNLIKELY(batch != 0) {
47 assert(batch >= 1 * sizeof(float));
48 assert(batch <= 15 * sizeof(float));
49 // Prepare mask for valid 32-bit elements (depends on batch).
50 batch >>= XNN_LOG2_SIZEOF_FLOAT;
51 const __mmask16 vmask = _cvtu32_mask16((uint32_t) ((UINT32_C(1) << batch) - UINT32_C(1)));
52
53 __m512 va = _mm512_maskz_loadu_ps(vmask, input_a);
54 __m512 vacc = _mm512_mask_mul_ps(vb, vsign, va, vb);
55
56 _mm512_mask_storeu_ps(output, vmask, vacc);
57 }
58 }