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