• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Auto-generated file. Do not edit!
2 //   Template: src/f32-vunary/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/math.h>
14 #include <xnnpack/vunary.h>
15 
16 
xnn_f32_vneg_ukernel__scalar_x4(size_t n,const float * x,float * y,const union xnn_f32_neg_params params[restrict XNN_MIN_ELEMENTS (1)])17 void xnn_f32_vneg_ukernel__scalar_x4(
18     size_t n,
19     const float* x,
20     float* y,
21     const union xnn_f32_neg_params params[restrict XNN_MIN_ELEMENTS(1)])
22 {
23   assert(n != 0);
24   assert(n % sizeof(float) == 0);
25   assert(x != NULL);
26   assert(y != NULL);
27 
28   for (; n >= 4 * sizeof(float); n -= 4 * sizeof(float)) {
29     const float vx0 = x[0];
30     const float vx1 = x[1];
31     const float vx2 = x[2];
32     const float vx3 = x[3];
33     x += 4;
34 
35     const float vy0 = -vx0;
36     const float vy1 = -vx1;
37     const float vy2 = -vx2;
38     const float vy3 = -vx3;
39 
40     y[0] = vy0;
41     y[1] = vy1;
42     y[2] = vy2;
43     y[3] = vy3;
44     y += 4;
45   }
46   if XNN_UNLIKELY(n != 0) {
47     do {
48       const float vx = *x++;
49       const float vy = -vx;
50       *y++ = vy;
51       n -= sizeof(float);
52     } while (n != 0);
53   }
54 }
55