1 // Copyright 2021 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 #include <stdint.h> 9 10 #include <arm_neon.h> 11 12 #include <xnnpack/math-stubs.h> 13 14 xnn_math_f16_f32_cvt__neonfp16(size_t n,const void * input,float * output)15void xnn_math_f16_f32_cvt__neonfp16( 16 size_t n, 17 const void* input, 18 float* output) 19 { 20 assert(n % (4 * sizeof(float)) == 0); 21 22 const uint16_t* i = (const uint16_t*) input; 23 for (; n != 0; n -= 4 * sizeof(float)) { 24 const float16x4_t vx = vreinterpret_f16_u16(vld1_u16(i)); i += 4; 25 const float32x4_t vy = vcvt_f32_f16(vx); 26 vst1q_f32(output, vy); output += 4; 27 } 28 } 29