1 /* ---------------------------------------------------------------------- 2 * Project: CMSIS DSP Library 3 * Title: arm_vlog_f16.c 4 * Description: Fast vectorized log 5 * 6 * $Date: 23 April 2021 7 * $Revision: V1.9.0 8 * 9 * Target Processor: Cortex-M and Cortex-A cores 10 * -------------------------------------------------------------------- */ 11 /* 12 * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 * 14 * SPDX-License-Identifier: Apache-2.0 15 * 16 * Licensed under the Apache License, Version 2.0 (the License); you may 17 * not use this file except in compliance with the License. 18 * You may obtain a copy of the License at 19 * 20 * www.apache.org/licenses/LICENSE-2.0 21 * 22 * Unless required by applicable law or agreed to in writing, software 23 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 * See the License for the specific language governing permissions and 26 * limitations under the License. 27 */ 28 29 #include "dsp/fast_math_functions_f16.h" 30 31 #if defined(ARM_FLOAT16_SUPPORTED) 32 33 #include "arm_common_tables.h" 34 35 #include "arm_vec_math_f16.h" 36 37 /** 38 @addtogroup vexp 39 @{ 40 */ 41 42 /** 43 @brief Floating-point vector of exp values. 44 @param[in] pSrc points to the input vector 45 @param[out] pDst points to the output vector 46 @param[in] blockSize number of samples in each vector 47 @return none 48 */ arm_vexp_f16(const float16_t * pSrc,float16_t * pDst,uint32_t blockSize)49void arm_vexp_f16( 50 const float16_t * pSrc, 51 float16_t * pDst, 52 uint32_t blockSize) 53 { 54 uint32_t blkCnt; 55 56 #if defined(ARM_MATH_MVE_FLOAT16) && !defined(ARM_MATH_AUTOVECTORIZE) 57 58 f16x8_t src; 59 f16x8_t dst; 60 61 blkCnt = blockSize >> 3; 62 63 while (blkCnt > 0U) 64 { 65 src = vld1q(pSrc); 66 dst = vexpq_f16(src); 67 vst1q(pDst, dst); 68 69 pSrc += 8; 70 pDst += 8; 71 /* Decrement loop counter */ 72 blkCnt--; 73 } 74 75 blkCnt = blockSize & 7; 76 #else 77 blkCnt = blockSize; 78 #endif 79 80 while (blkCnt > 0U) 81 { 82 /* C = log(A) */ 83 84 /* Calculate log and store result in destination buffer. */ 85 *pDst++ = (_Float16)expf((float32_t)*pSrc++); 86 87 /* Decrement loop counter */ 88 blkCnt--; 89 } 90 } 91 92 #endif /* #if defined(ARM_FLOAT16_SUPPORTED) */ 93 94 /** 95 @} end of vexp group 96 */