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_x4(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_x4( 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 >= 4 * sizeof(float); n -= 4 * sizeof(float)) { 27 const float vx0 = x[0]; 28 const float vx1 = x[1]; 29 const float vx2 = x[2]; 30 const float vx3 = x[3]; 31 x += 4; 32 33 const float vy0 = sqrtf(vx0); 34 const float vy1 = sqrtf(vx1); 35 const float vy2 = sqrtf(vx2); 36 const float vy3 = sqrtf(vx3); 37 38 y[0] = vy0; 39 y[1] = vy1; 40 y[2] = vy2; 41 y[3] = vy3; 42 y += 4; 43 } 44 if XNN_UNLIKELY(n != 0) { 45 do { 46 const float vx = *x++; 47 const float vy = sqrtf(vx); 48 *y++ = vy; 49 n -= sizeof(float); 50 } while (n != 0); 51 } 52 } 53