• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  * @file     arm_math_types_f16.h
3  * @brief    Public header file for f16 function of the CMSIS DSP Library
4  * @version  V1.9.0
5  * @date     23 April 2021
6  * Target Processor: Cortex-M and Cortex-A cores
7  ******************************************************************************/
8 /*
9  * Copyright (c) 2010-2021 Arm Limited or its affiliates. All rights reserved.
10  *
11  * SPDX-License-Identifier: Apache-2.0
12  *
13  * Licensed under the Apache License, Version 2.0 (the License); you may
14  * not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  * www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
21  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  */
25 
26 #ifndef _ARM_MATH_TYPES_F16_H
27 #define _ARM_MATH_TYPES_F16_H
28 
29 #include "arm_math_types.h"
30 
31 #ifdef   __cplusplus
32 extern "C"
33 {
34 #endif
35 
36 #if !defined( __CC_ARM )
37 
38 /**
39  * @brief 16-bit floating-point type definition.
40  * This is already defined in arm_mve.h
41  *
42  * This is not fully supported on ARM AC5.
43  */
44 
45 /*
46 
47 Check if the type __fp16 is available.
48 If it is not available, f16 version of the kernels
49 won't be built.
50 
51 */
52 #if !(__ARM_FEATURE_MVE & 2)
53   #if !defined(DISABLEFLOAT16)
54     #if defined(__ARM_FP16_FORMAT_IEEE) || defined(__ARM_FP16_FORMAT_ALTERNATIVE)
55       typedef __fp16 float16_t;
56       #define ARM_FLOAT16_SUPPORTED
57     #endif
58   #endif
59 #else
60   /* When Vector float16, this flag is always defined and can't be disabled */
61   #define ARM_FLOAT16_SUPPORTED
62 #endif
63 
64 #if defined(ARM_MATH_NEON) || (defined(ARM_MATH_MVEF)  && !defined(ARM_MATH_AUTOVECTORIZE)) /* floating point vector*/
65 
66 #if defined(ARM_MATH_MVE_FLOAT16) || defined(ARM_MATH_NEON_FLOAT16)
67 
68   /**
69    * @brief 16-bit floating-point 128-bit vector data type
70    */
71   typedef __ALIGNED(2) float16x8_t f16x8_t;
72 
73   /**
74    * @brief 16-bit floating-point 128-bit vector pair data type
75    */
76   typedef float16x8x2_t f16x8x2_t;
77 
78   /**
79    * @brief 16-bit floating-point 128-bit vector quadruplet data type
80    */
81   typedef float16x8x4_t f16x8x4_t;
82 
83   /**
84    * @brief 16-bit ubiquitous 128-bit vector data type
85    */
86   typedef union _any16x8_t
87   {
88       float16x8_t     f;
89       int16x8_t       i;
90   } any16x8_t;
91 #endif
92 
93 #endif
94 
95 #if defined(ARM_MATH_NEON)
96 
97 
98 #if defined(ARM_MATH_NEON_FLOAT16)
99   /**
100    * @brief 16-bit float 64-bit vector data type.
101    */
102   typedef  __ALIGNED(2) float16x4_t f16x4_t;
103 
104   /**
105    * @brief 16-bit floating-point 128-bit vector triplet data type
106    */
107   typedef float16x8x3_t f16x8x3_t;
108 
109   /**
110    * @brief 16-bit floating-point 64-bit vector pair data type
111    */
112   typedef float16x4x2_t f16x4x2_t;
113 
114   /**
115    * @brief 16-bit floating-point 64-bit vector triplet data type
116    */
117   typedef float16x4x3_t f16x4x3_t;
118 
119   /**
120    * @brief 16-bit floating-point 64-bit vector quadruplet data type
121    */
122   typedef float16x4x4_t f16x4x4_t;
123 
124   /**
125    * @brief 16-bit ubiquitous 64-bit vector data type
126    */
127   typedef union _any16x4_t
128   {
129       float16x4_t     f;
130       int16x4_t       i;
131   } any16x4_t;
132 #endif
133 
134 #endif
135 
136 
137 
138 #if defined(ARM_FLOAT16_SUPPORTED)
139 #define F16_MAX   ((float16_t)__FLT16_MAX__)
140 #define F16_MIN   (-(float16_t)__FLT16_MAX__)
141 
142 #define F16_ABSMAX   ((float16_t)__FLT16_MAX__)
143 #define F16_ABSMIN   ((float16_t)0.0f16)
144 
145 #define F16INFINITY ((float16_t)__builtin_inf())
146 
147 #endif /* ARM_FLOAT16_SUPPORTED*/
148 #endif /* !defined( __CC_ARM ) */
149 
150 #ifdef   __cplusplus
151 }
152 #endif
153 
154 #endif /* _ARM_MATH_F16_H */
155 
156 
157