1 // Auto-generated file. Do not edit!
2 // Template: src/f32-vbinary/vopc-scalar.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 #include <assert.h>
11
12 #include <xnnpack/common.h>
13 #include <xnnpack/math.h>
14 #include <xnnpack/vbinary.h>
15
16
xnn_f32_vrdivc_relu_ukernel__scalar_x4(size_t n,const float * a,const float * b,float * y,const union xnn_f32_relu_params params[restrict XNN_MIN_ELEMENTS (1)])17 void xnn_f32_vrdivc_relu_ukernel__scalar_x4(
18 size_t n,
19 const float* a,
20 const float* b,
21 float* y,
22 const union xnn_f32_relu_params params[restrict XNN_MIN_ELEMENTS(1)])
23 {
24 assert(n != 0);
25 assert(n % sizeof(float) == 0);
26 assert(a != NULL);
27 assert(b != NULL);
28 assert(y != NULL);
29
30
31 const float vb = *b;
32 for (; n >= 4 * sizeof(float); n -= 4 * sizeof(float)) {
33 const float va0 = a[0];
34 const float va1 = a[1];
35 const float va2 = a[2];
36 const float va3 = a[3];
37 a += 4;
38
39 float vy0 = vb / va0;
40 float vy1 = vb / va1;
41 float vy2 = vb / va2;
42 float vy3 = vb / va3;
43
44
45 vy0 = math_max_f32(vy0, 0.0f);
46 vy1 = math_max_f32(vy1, 0.0f);
47 vy2 = math_max_f32(vy2, 0.0f);
48 vy3 = math_max_f32(vy3, 0.0f);
49
50 y[0] = vy0;
51 y[1] = vy1;
52 y[2] = vy2;
53 y[3] = vy3;
54 y += 4;
55 }
56 if XNN_UNLIKELY(n != 0) {
57 do {
58 const float va = *a++;
59 float vy = vb / va;
60 vy = math_max_f32(vy, 0.0f);
61 *y++ = vy;
62 n -= sizeof(float);
63 } while (n != 0);
64 }
65 }
66