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 */ arm_vexp_f16(const float16_t * pSrc,float16_t * pDst,uint32_t blockSize)48ARM_DSP_ATTRIBUTE void arm_vexp_f16( 49 const float16_t * pSrc, 50 float16_t * pDst, 51 uint32_t blockSize) 52 { 53 uint32_t blkCnt; 54 55 #if defined(ARM_MATH_MVE_FLOAT16) && !defined(ARM_MATH_AUTOVECTORIZE) 56 57 f16x8_t src; 58 f16x8_t dst; 59 60 blkCnt = blockSize >> 3; 61 62 while (blkCnt > 0U) 63 { 64 src = vld1q(pSrc); 65 dst = vexpq_f16(src); 66 vst1q(pDst, dst); 67 68 pSrc += 8; 69 pDst += 8; 70 /* Decrement loop counter */ 71 blkCnt--; 72 } 73 74 blkCnt = blockSize & 7; 75 #else 76 blkCnt = blockSize; 77 #endif 78 79 while (blkCnt > 0U) 80 { 81 /* C = log(A) */ 82 83 /* Calculate log and store result in destination buffer. */ 84 *pDst++ = (_Float16)expf((float32_t)*pSrc++); 85 86 /* Decrement loop counter */ 87 blkCnt--; 88 } 89 } 90 91 #endif /* #if defined(ARM_FLOAT16_SUPPORTED) */ 92 93 /** 94 @} end of vexp group 95 */