1 // Auto-generated file. Do not edit! 2 // Template: src/f32-vrnd/scalar-libm.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 #include <math.h> 12 13 #include <xnnpack/common.h> 14 #include <xnnpack/math.h> 15 #include <xnnpack/vunary.h> 16 17 xnn_f32_vrndz_ukernel__scalar_libm_x2(size_t n,const float * x,float * y,const union xnn_f32_rnd_params params[restrict XNN_MIN_ELEMENTS (1)])18void xnn_f32_vrndz_ukernel__scalar_libm_x2( 19 size_t n, 20 const float* x, 21 float* y, 22 const union xnn_f32_rnd_params params[restrict XNN_MIN_ELEMENTS(1)]) 23 { 24 assert(n != 0); 25 assert(n % sizeof(float) == 0); 26 27 for (; n >= 2 * sizeof(float); n -= 2 * sizeof(float)) { 28 const float vx0 = x[0]; 29 const float vx1 = x[1]; 30 x += 2; 31 32 const float vy0 = truncf(vx0); 33 const float vy1 = truncf(vx1); 34 35 y[0] = vy0; 36 y[1] = vy1; 37 y += 2; 38 } 39 if XNN_UNLIKELY(n != 0) { 40 const float vx = *x; 41 const float vy = truncf(vx); 42 *y = vy; 43 } 44 } 45