• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_vmaxc_ukernel__wasm_x8(size_t n,const float * a,const float * b,float * y,const union xnn_f32_default_params params[restrict XNN_MIN_ELEMENTS (1)])17 void xnn_f32_vmaxc_ukernel__wasm_x8(
18     size_t n,
19     const float* a,
20     const float* b,
21     float* y,
22     const union xnn_f32_default_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 >= 8 * sizeof(float); n -= 8 * 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     const float va4 = a[4];
38     const float va5 = a[5];
39     const float va6 = a[6];
40     const float va7 = a[7];
41     a += 8;
42 
43     float vy0 = __builtin_wasm_max_f32(va0, vb);
44     float vy1 = __builtin_wasm_max_f32(va1, vb);
45     float vy2 = __builtin_wasm_max_f32(va2, vb);
46     float vy3 = __builtin_wasm_max_f32(va3, vb);
47     float vy4 = __builtin_wasm_max_f32(va4, vb);
48     float vy5 = __builtin_wasm_max_f32(va5, vb);
49     float vy6 = __builtin_wasm_max_f32(va6, vb);
50     float vy7 = __builtin_wasm_max_f32(va7, vb);
51 
52 
53 
54     y[0] = vy0;
55     y[1] = vy1;
56     y[2] = vy2;
57     y[3] = vy3;
58     y[4] = vy4;
59     y[5] = vy5;
60     y[6] = vy6;
61     y[7] = vy7;
62     y += 8;
63   }
64   if XNN_UNLIKELY(n != 0) {
65     do {
66       const float va = *a++;
67       float vy = __builtin_wasm_max_f32(va, vb);
68       *y++ = vy;
69       n -= sizeof(float);
70     } while (n != 0);
71   }
72 }
73