1 // Auto-generated file. Do not edit! 2 // Template: src/f32-vbinary/vop-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 17 void xnn_f32_vmul_relu_ukernel__wasm_x2( 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 for (; n >= 2 * sizeof(float); n -= 2 * sizeof(float)) { 32 const float va0 = a[0]; 33 const float va1 = a[1]; 34 a += 2; 35 36 const float vb0 = b[0]; 37 const float vb1 = b[1]; 38 b += 2; 39 40 float vy0 = va0 * vb0; 41 float vy1 = va1 * vb1; 42 43 44 vy0 = __builtin_wasm_max_f32(vy0, 0.0f); 45 vy1 = __builtin_wasm_max_f32(vy1, 0.0f); 46 47 y[0] = vy0; 48 y[1] = vy1; 49 y += 2; 50 } 51 if XNN_UNLIKELY(n != 0) { 52 const float va = *a; 53 const float vb = *b; 54 float vy = va * vb; 55 vy = __builtin_wasm_max_f32(vy, 0.0f); 56 *y = vy; 57 } 58 } 59