| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#include <assert.h> |
| 11 |
#include <math.h> |
| 12 |
|
| 13 |
#include "xnnpack/common.h" |
| 14 |
#include "xnnpack/vunary.h" |
| 15 |
|
| 16 |
|
| 17 |
void xnn_f32_vsqrt_ukernel__scalar_sqrt_u2( |
| 18 |
size_t batch, |
| 19 |
const float* input, |
| 20 |
float* output, |
| 21 |
const struct xnn_f32_default_params params[restrict XNN_MIN_ELEMENTS(1)]) |
| 22 |
{ |
| 23 |
assert(batch != 0); |
| 24 |
assert(batch % sizeof(float) == 0); |
| 25 |
assert(input != NULL); |
| 26 |
assert(output != NULL); |
| 27 |
|
| 28 |
for (; batch >= 2 * sizeof(float); batch -= 2 * sizeof(float)) { |
| 29 |
const float vx0 = input[0]; |
| 30 |
const float vx1 = input[1]; |
| 31 |
input += 2; |
| 32 |
|
| 33 |
const float vy0 = sqrtf(vx0); |
| 34 |
const float vy1 = sqrtf(vx1); |
| 35 |
|
| 36 |
output[0] = vy0; |
| 37 |
output[1] = vy1; |
| 38 |
output += 2; |
| 39 |
} |
| 40 |
if XNN_UNLIKELY(batch != 0) { |
| 41 |
const float vx = *input; |
| 42 |
const float vy = sqrtf(vx); |
| 43 |
*output = vy; |
| 44 |
} |
| 45 |
} |