Marat Dukhan | c9852ba | 2020-05-13 17:21:29 -0700 | [diff] [blame] | 1 | // Copyright 2020 Google LLC |
| 2 | // |
| 3 | // This source code is licensed under the BSD-style license found in the |
| 4 | // LICENSE file in the root directory of this source tree. |
| 5 | |
| 6 | #include <assert.h> |
| 7 | #include <stddef.h> |
| 8 | |
| 9 | #include <arm_neon.h> |
| 10 | |
| 11 | #include <xnnpack/math-stubs.h> |
| 12 | |
| 13 | |
| 14 | void xnn_math_f32_roundd__neonv8( |
| 15 | size_t n, |
| 16 | const float* input, |
| 17 | float* output) |
| 18 | { |
| 19 | assert(n % (4 * sizeof(float)) == 0); |
| 20 | |
| 21 | for (; n != 0; n -= 4 * sizeof(float)) { |
| 22 | const float32x4_t vx = vld1q_f32(input); input += 4; |
| 23 | |
| 24 | const float32x4_t vy = vrndmq_f32(vx); |
| 25 | |
| 26 | vst1q_f32(output, vy); output += 4; |
| 27 | } |
| 28 | } |