1 // Auto-generated file. Do not edit!
2 //   Template: src/f32-vlrelu/scalar.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 <xnnpack/common.h>
13 #include <xnnpack/vunary.h>
14 
15 
xnn_f32_vlrelu_ukernel__scalar_x1(size_t n,const float * x,float * y,const union xnn_f32_lrelu_params params[restrict XNN_MIN_ELEMENTS (1)])16 void xnn_f32_vlrelu_ukernel__scalar_x1(
17     size_t n,
18     const float* x,
19     float* y,
20     const union xnn_f32_lrelu_params params[restrict XNN_MIN_ELEMENTS(1)])
21 {
22   assert(n != 0);
23   assert(n % sizeof(float) == 0);
24 
25   const float vslope = params->scalar.slope;
26 
27   do {
28     const float vx = *x++;
29     float vacc = vx * vslope;
30     vacc = XNN_UNPREDICTABLE(vx < 0.0f) ? vacc : vx;
31     *y++ = vacc;
32     n -= sizeof(float);
33   } while (n != 0);
34 }
35