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 
arm_vexp_f16(const float16_t * pSrc,float16_t * pDst,uint32_t blockSize)38 void arm_vexp_f16(
39   const float16_t * pSrc,
40         float16_t * pDst,
41         uint32_t blockSize)
42 {
43    uint32_t blkCnt;
44 
45 #if defined(ARM_MATH_MVE_FLOAT16) && !defined(ARM_MATH_AUTOVECTORIZE)
46 
47    f16x8_t src;
48    f16x8_t dst;
49 
50    blkCnt = blockSize >> 3;
51 
52    while (blkCnt > 0U)
53    {
54       src = vld1q(pSrc);
55       dst = vexpq_f16(src);
56       vst1q(pDst, dst);
57 
58       pSrc += 8;
59       pDst += 8;
60       /* Decrement loop counter */
61       blkCnt--;
62    }
63 
64    blkCnt = blockSize & 7;
65 #else
66    blkCnt = blockSize;
67 #endif
68 
69    while (blkCnt > 0U)
70    {
71       /* C = log(A) */
72 
73       /* Calculate log and store result in destination buffer. */
74       *pDst++ = expf(*pSrc++);
75 
76       /* Decrement loop counter */
77       blkCnt--;
78    }
79 }
80 
81 #endif /* #if defined(ARM_FLOAT16_SUPPORTED) */
82 
83