Dataloger
TARGET_NUCLEO_F072RB/core_cmSimd.h@0:666850d06c9f, 2015-08-20 (annotated)
- Committer:
- jhon309
- Date:
- Thu Aug 20 00:37:14 2015 +0000
- Revision:
- 0:666850d06c9f
ok
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jhon309 | 0:666850d06c9f | 1 | /**************************************************************************//** |
jhon309 | 0:666850d06c9f | 2 | * @file core_cmSimd.h |
jhon309 | 0:666850d06c9f | 3 | * @brief CMSIS Cortex-M SIMD Header File |
jhon309 | 0:666850d06c9f | 4 | * @version V4.10 |
jhon309 | 0:666850d06c9f | 5 | * @date 18. March 2015 |
jhon309 | 0:666850d06c9f | 6 | * |
jhon309 | 0:666850d06c9f | 7 | * @note |
jhon309 | 0:666850d06c9f | 8 | * |
jhon309 | 0:666850d06c9f | 9 | ******************************************************************************/ |
jhon309 | 0:666850d06c9f | 10 | /* Copyright (c) 2009 - 2014 ARM LIMITED |
jhon309 | 0:666850d06c9f | 11 | |
jhon309 | 0:666850d06c9f | 12 | All rights reserved. |
jhon309 | 0:666850d06c9f | 13 | Redistribution and use in source and binary forms, with or without |
jhon309 | 0:666850d06c9f | 14 | modification, are permitted provided that the following conditions are met: |
jhon309 | 0:666850d06c9f | 15 | - Redistributions of source code must retain the above copyright |
jhon309 | 0:666850d06c9f | 16 | notice, this list of conditions and the following disclaimer. |
jhon309 | 0:666850d06c9f | 17 | - Redistributions in binary form must reproduce the above copyright |
jhon309 | 0:666850d06c9f | 18 | notice, this list of conditions and the following disclaimer in the |
jhon309 | 0:666850d06c9f | 19 | documentation and/or other materials provided with the distribution. |
jhon309 | 0:666850d06c9f | 20 | - Neither the name of ARM nor the names of its contributors may be used |
jhon309 | 0:666850d06c9f | 21 | to endorse or promote products derived from this software without |
jhon309 | 0:666850d06c9f | 22 | specific prior written permission. |
jhon309 | 0:666850d06c9f | 23 | * |
jhon309 | 0:666850d06c9f | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
jhon309 | 0:666850d06c9f | 25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
jhon309 | 0:666850d06c9f | 26 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
jhon309 | 0:666850d06c9f | 27 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE |
jhon309 | 0:666850d06c9f | 28 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
jhon309 | 0:666850d06c9f | 29 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
jhon309 | 0:666850d06c9f | 30 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
jhon309 | 0:666850d06c9f | 31 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
jhon309 | 0:666850d06c9f | 32 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
jhon309 | 0:666850d06c9f | 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
jhon309 | 0:666850d06c9f | 34 | POSSIBILITY OF SUCH DAMAGE. |
jhon309 | 0:666850d06c9f | 35 | ---------------------------------------------------------------------------*/ |
jhon309 | 0:666850d06c9f | 36 | |
jhon309 | 0:666850d06c9f | 37 | |
jhon309 | 0:666850d06c9f | 38 | #if defined ( __ICCARM__ ) |
jhon309 | 0:666850d06c9f | 39 | #pragma system_include /* treat file as system include file for MISRA check */ |
jhon309 | 0:666850d06c9f | 40 | #endif |
jhon309 | 0:666850d06c9f | 41 | |
jhon309 | 0:666850d06c9f | 42 | #ifndef __CORE_CMSIMD_H |
jhon309 | 0:666850d06c9f | 43 | #define __CORE_CMSIMD_H |
jhon309 | 0:666850d06c9f | 44 | |
jhon309 | 0:666850d06c9f | 45 | #ifdef __cplusplus |
jhon309 | 0:666850d06c9f | 46 | extern "C" { |
jhon309 | 0:666850d06c9f | 47 | #endif |
jhon309 | 0:666850d06c9f | 48 | |
jhon309 | 0:666850d06c9f | 49 | |
jhon309 | 0:666850d06c9f | 50 | /******************************************************************************* |
jhon309 | 0:666850d06c9f | 51 | * Hardware Abstraction Layer |
jhon309 | 0:666850d06c9f | 52 | ******************************************************************************/ |
jhon309 | 0:666850d06c9f | 53 | |
jhon309 | 0:666850d06c9f | 54 | |
jhon309 | 0:666850d06c9f | 55 | /* ################### Compiler specific Intrinsics ########################### */ |
jhon309 | 0:666850d06c9f | 56 | /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics |
jhon309 | 0:666850d06c9f | 57 | Access to dedicated SIMD instructions |
jhon309 | 0:666850d06c9f | 58 | @{ |
jhon309 | 0:666850d06c9f | 59 | */ |
jhon309 | 0:666850d06c9f | 60 | |
jhon309 | 0:666850d06c9f | 61 | #if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/ |
jhon309 | 0:666850d06c9f | 62 | /* ARM armcc specific functions */ |
jhon309 | 0:666850d06c9f | 63 | #define __SADD8 __sadd8 |
jhon309 | 0:666850d06c9f | 64 | #define __QADD8 __qadd8 |
jhon309 | 0:666850d06c9f | 65 | #define __SHADD8 __shadd8 |
jhon309 | 0:666850d06c9f | 66 | #define __UADD8 __uadd8 |
jhon309 | 0:666850d06c9f | 67 | #define __UQADD8 __uqadd8 |
jhon309 | 0:666850d06c9f | 68 | #define __UHADD8 __uhadd8 |
jhon309 | 0:666850d06c9f | 69 | #define __SSUB8 __ssub8 |
jhon309 | 0:666850d06c9f | 70 | #define __QSUB8 __qsub8 |
jhon309 | 0:666850d06c9f | 71 | #define __SHSUB8 __shsub8 |
jhon309 | 0:666850d06c9f | 72 | #define __USUB8 __usub8 |
jhon309 | 0:666850d06c9f | 73 | #define __UQSUB8 __uqsub8 |
jhon309 | 0:666850d06c9f | 74 | #define __UHSUB8 __uhsub8 |
jhon309 | 0:666850d06c9f | 75 | #define __SADD16 __sadd16 |
jhon309 | 0:666850d06c9f | 76 | #define __QADD16 __qadd16 |
jhon309 | 0:666850d06c9f | 77 | #define __SHADD16 __shadd16 |
jhon309 | 0:666850d06c9f | 78 | #define __UADD16 __uadd16 |
jhon309 | 0:666850d06c9f | 79 | #define __UQADD16 __uqadd16 |
jhon309 | 0:666850d06c9f | 80 | #define __UHADD16 __uhadd16 |
jhon309 | 0:666850d06c9f | 81 | #define __SSUB16 __ssub16 |
jhon309 | 0:666850d06c9f | 82 | #define __QSUB16 __qsub16 |
jhon309 | 0:666850d06c9f | 83 | #define __SHSUB16 __shsub16 |
jhon309 | 0:666850d06c9f | 84 | #define __USUB16 __usub16 |
jhon309 | 0:666850d06c9f | 85 | #define __UQSUB16 __uqsub16 |
jhon309 | 0:666850d06c9f | 86 | #define __UHSUB16 __uhsub16 |
jhon309 | 0:666850d06c9f | 87 | #define __SASX __sasx |
jhon309 | 0:666850d06c9f | 88 | #define __QASX __qasx |
jhon309 | 0:666850d06c9f | 89 | #define __SHASX __shasx |
jhon309 | 0:666850d06c9f | 90 | #define __UASX __uasx |
jhon309 | 0:666850d06c9f | 91 | #define __UQASX __uqasx |
jhon309 | 0:666850d06c9f | 92 | #define __UHASX __uhasx |
jhon309 | 0:666850d06c9f | 93 | #define __SSAX __ssax |
jhon309 | 0:666850d06c9f | 94 | #define __QSAX __qsax |
jhon309 | 0:666850d06c9f | 95 | #define __SHSAX __shsax |
jhon309 | 0:666850d06c9f | 96 | #define __USAX __usax |
jhon309 | 0:666850d06c9f | 97 | #define __UQSAX __uqsax |
jhon309 | 0:666850d06c9f | 98 | #define __UHSAX __uhsax |
jhon309 | 0:666850d06c9f | 99 | #define __USAD8 __usad8 |
jhon309 | 0:666850d06c9f | 100 | #define __USADA8 __usada8 |
jhon309 | 0:666850d06c9f | 101 | #define __SSAT16 __ssat16 |
jhon309 | 0:666850d06c9f | 102 | #define __USAT16 __usat16 |
jhon309 | 0:666850d06c9f | 103 | #define __UXTB16 __uxtb16 |
jhon309 | 0:666850d06c9f | 104 | #define __UXTAB16 __uxtab16 |
jhon309 | 0:666850d06c9f | 105 | #define __SXTB16 __sxtb16 |
jhon309 | 0:666850d06c9f | 106 | #define __SXTAB16 __sxtab16 |
jhon309 | 0:666850d06c9f | 107 | #define __SMUAD __smuad |
jhon309 | 0:666850d06c9f | 108 | #define __SMUADX __smuadx |
jhon309 | 0:666850d06c9f | 109 | #define __SMLAD __smlad |
jhon309 | 0:666850d06c9f | 110 | #define __SMLADX __smladx |
jhon309 | 0:666850d06c9f | 111 | #define __SMLALD __smlald |
jhon309 | 0:666850d06c9f | 112 | #define __SMLALDX __smlaldx |
jhon309 | 0:666850d06c9f | 113 | #define __SMUSD __smusd |
jhon309 | 0:666850d06c9f | 114 | #define __SMUSDX __smusdx |
jhon309 | 0:666850d06c9f | 115 | #define __SMLSD __smlsd |
jhon309 | 0:666850d06c9f | 116 | #define __SMLSDX __smlsdx |
jhon309 | 0:666850d06c9f | 117 | #define __SMLSLD __smlsld |
jhon309 | 0:666850d06c9f | 118 | #define __SMLSLDX __smlsldx |
jhon309 | 0:666850d06c9f | 119 | #define __SEL __sel |
jhon309 | 0:666850d06c9f | 120 | #define __QADD __qadd |
jhon309 | 0:666850d06c9f | 121 | #define __QSUB __qsub |
jhon309 | 0:666850d06c9f | 122 | |
jhon309 | 0:666850d06c9f | 123 | #define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \ |
jhon309 | 0:666850d06c9f | 124 | ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) ) |
jhon309 | 0:666850d06c9f | 125 | |
jhon309 | 0:666850d06c9f | 126 | #define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \ |
jhon309 | 0:666850d06c9f | 127 | ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) ) |
jhon309 | 0:666850d06c9f | 128 | |
jhon309 | 0:666850d06c9f | 129 | #define __SMMLA(ARG1,ARG2,ARG3) ( (int32_t)((((int64_t)(ARG1) * (ARG2)) + \ |
jhon309 | 0:666850d06c9f | 130 | ((int64_t)(ARG3) << 32) ) >> 32)) |
jhon309 | 0:666850d06c9f | 131 | |
jhon309 | 0:666850d06c9f | 132 | |
jhon309 | 0:666850d06c9f | 133 | #elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/ |
jhon309 | 0:666850d06c9f | 134 | /* GNU gcc specific functions */ |
jhon309 | 0:666850d06c9f | 135 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SADD8(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 136 | { |
jhon309 | 0:666850d06c9f | 137 | uint32_t result; |
jhon309 | 0:666850d06c9f | 138 | |
jhon309 | 0:666850d06c9f | 139 | __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 140 | return(result); |
jhon309 | 0:666850d06c9f | 141 | } |
jhon309 | 0:666850d06c9f | 142 | |
jhon309 | 0:666850d06c9f | 143 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QADD8(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 144 | { |
jhon309 | 0:666850d06c9f | 145 | uint32_t result; |
jhon309 | 0:666850d06c9f | 146 | |
jhon309 | 0:666850d06c9f | 147 | __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 148 | return(result); |
jhon309 | 0:666850d06c9f | 149 | } |
jhon309 | 0:666850d06c9f | 150 | |
jhon309 | 0:666850d06c9f | 151 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 152 | { |
jhon309 | 0:666850d06c9f | 153 | uint32_t result; |
jhon309 | 0:666850d06c9f | 154 | |
jhon309 | 0:666850d06c9f | 155 | __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 156 | return(result); |
jhon309 | 0:666850d06c9f | 157 | } |
jhon309 | 0:666850d06c9f | 158 | |
jhon309 | 0:666850d06c9f | 159 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UADD8(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 160 | { |
jhon309 | 0:666850d06c9f | 161 | uint32_t result; |
jhon309 | 0:666850d06c9f | 162 | |
jhon309 | 0:666850d06c9f | 163 | __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 164 | return(result); |
jhon309 | 0:666850d06c9f | 165 | } |
jhon309 | 0:666850d06c9f | 166 | |
jhon309 | 0:666850d06c9f | 167 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 168 | { |
jhon309 | 0:666850d06c9f | 169 | uint32_t result; |
jhon309 | 0:666850d06c9f | 170 | |
jhon309 | 0:666850d06c9f | 171 | __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 172 | return(result); |
jhon309 | 0:666850d06c9f | 173 | } |
jhon309 | 0:666850d06c9f | 174 | |
jhon309 | 0:666850d06c9f | 175 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 176 | { |
jhon309 | 0:666850d06c9f | 177 | uint32_t result; |
jhon309 | 0:666850d06c9f | 178 | |
jhon309 | 0:666850d06c9f | 179 | __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 180 | return(result); |
jhon309 | 0:666850d06c9f | 181 | } |
jhon309 | 0:666850d06c9f | 182 | |
jhon309 | 0:666850d06c9f | 183 | |
jhon309 | 0:666850d06c9f | 184 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 185 | { |
jhon309 | 0:666850d06c9f | 186 | uint32_t result; |
jhon309 | 0:666850d06c9f | 187 | |
jhon309 | 0:666850d06c9f | 188 | __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 189 | return(result); |
jhon309 | 0:666850d06c9f | 190 | } |
jhon309 | 0:666850d06c9f | 191 | |
jhon309 | 0:666850d06c9f | 192 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 193 | { |
jhon309 | 0:666850d06c9f | 194 | uint32_t result; |
jhon309 | 0:666850d06c9f | 195 | |
jhon309 | 0:666850d06c9f | 196 | __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 197 | return(result); |
jhon309 | 0:666850d06c9f | 198 | } |
jhon309 | 0:666850d06c9f | 199 | |
jhon309 | 0:666850d06c9f | 200 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 201 | { |
jhon309 | 0:666850d06c9f | 202 | uint32_t result; |
jhon309 | 0:666850d06c9f | 203 | |
jhon309 | 0:666850d06c9f | 204 | __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 205 | return(result); |
jhon309 | 0:666850d06c9f | 206 | } |
jhon309 | 0:666850d06c9f | 207 | |
jhon309 | 0:666850d06c9f | 208 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USUB8(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 209 | { |
jhon309 | 0:666850d06c9f | 210 | uint32_t result; |
jhon309 | 0:666850d06c9f | 211 | |
jhon309 | 0:666850d06c9f | 212 | __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 213 | return(result); |
jhon309 | 0:666850d06c9f | 214 | } |
jhon309 | 0:666850d06c9f | 215 | |
jhon309 | 0:666850d06c9f | 216 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 217 | { |
jhon309 | 0:666850d06c9f | 218 | uint32_t result; |
jhon309 | 0:666850d06c9f | 219 | |
jhon309 | 0:666850d06c9f | 220 | __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 221 | return(result); |
jhon309 | 0:666850d06c9f | 222 | } |
jhon309 | 0:666850d06c9f | 223 | |
jhon309 | 0:666850d06c9f | 224 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 225 | { |
jhon309 | 0:666850d06c9f | 226 | uint32_t result; |
jhon309 | 0:666850d06c9f | 227 | |
jhon309 | 0:666850d06c9f | 228 | __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 229 | return(result); |
jhon309 | 0:666850d06c9f | 230 | } |
jhon309 | 0:666850d06c9f | 231 | |
jhon309 | 0:666850d06c9f | 232 | |
jhon309 | 0:666850d06c9f | 233 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SADD16(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 234 | { |
jhon309 | 0:666850d06c9f | 235 | uint32_t result; |
jhon309 | 0:666850d06c9f | 236 | |
jhon309 | 0:666850d06c9f | 237 | __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 238 | return(result); |
jhon309 | 0:666850d06c9f | 239 | } |
jhon309 | 0:666850d06c9f | 240 | |
jhon309 | 0:666850d06c9f | 241 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QADD16(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 242 | { |
jhon309 | 0:666850d06c9f | 243 | uint32_t result; |
jhon309 | 0:666850d06c9f | 244 | |
jhon309 | 0:666850d06c9f | 245 | __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 246 | return(result); |
jhon309 | 0:666850d06c9f | 247 | } |
jhon309 | 0:666850d06c9f | 248 | |
jhon309 | 0:666850d06c9f | 249 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 250 | { |
jhon309 | 0:666850d06c9f | 251 | uint32_t result; |
jhon309 | 0:666850d06c9f | 252 | |
jhon309 | 0:666850d06c9f | 253 | __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 254 | return(result); |
jhon309 | 0:666850d06c9f | 255 | } |
jhon309 | 0:666850d06c9f | 256 | |
jhon309 | 0:666850d06c9f | 257 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UADD16(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 258 | { |
jhon309 | 0:666850d06c9f | 259 | uint32_t result; |
jhon309 | 0:666850d06c9f | 260 | |
jhon309 | 0:666850d06c9f | 261 | __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 262 | return(result); |
jhon309 | 0:666850d06c9f | 263 | } |
jhon309 | 0:666850d06c9f | 264 | |
jhon309 | 0:666850d06c9f | 265 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 266 | { |
jhon309 | 0:666850d06c9f | 267 | uint32_t result; |
jhon309 | 0:666850d06c9f | 268 | |
jhon309 | 0:666850d06c9f | 269 | __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 270 | return(result); |
jhon309 | 0:666850d06c9f | 271 | } |
jhon309 | 0:666850d06c9f | 272 | |
jhon309 | 0:666850d06c9f | 273 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 274 | { |
jhon309 | 0:666850d06c9f | 275 | uint32_t result; |
jhon309 | 0:666850d06c9f | 276 | |
jhon309 | 0:666850d06c9f | 277 | __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 278 | return(result); |
jhon309 | 0:666850d06c9f | 279 | } |
jhon309 | 0:666850d06c9f | 280 | |
jhon309 | 0:666850d06c9f | 281 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 282 | { |
jhon309 | 0:666850d06c9f | 283 | uint32_t result; |
jhon309 | 0:666850d06c9f | 284 | |
jhon309 | 0:666850d06c9f | 285 | __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 286 | return(result); |
jhon309 | 0:666850d06c9f | 287 | } |
jhon309 | 0:666850d06c9f | 288 | |
jhon309 | 0:666850d06c9f | 289 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 290 | { |
jhon309 | 0:666850d06c9f | 291 | uint32_t result; |
jhon309 | 0:666850d06c9f | 292 | |
jhon309 | 0:666850d06c9f | 293 | __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 294 | return(result); |
jhon309 | 0:666850d06c9f | 295 | } |
jhon309 | 0:666850d06c9f | 296 | |
jhon309 | 0:666850d06c9f | 297 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 298 | { |
jhon309 | 0:666850d06c9f | 299 | uint32_t result; |
jhon309 | 0:666850d06c9f | 300 | |
jhon309 | 0:666850d06c9f | 301 | __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 302 | return(result); |
jhon309 | 0:666850d06c9f | 303 | } |
jhon309 | 0:666850d06c9f | 304 | |
jhon309 | 0:666850d06c9f | 305 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USUB16(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 306 | { |
jhon309 | 0:666850d06c9f | 307 | uint32_t result; |
jhon309 | 0:666850d06c9f | 308 | |
jhon309 | 0:666850d06c9f | 309 | __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 310 | return(result); |
jhon309 | 0:666850d06c9f | 311 | } |
jhon309 | 0:666850d06c9f | 312 | |
jhon309 | 0:666850d06c9f | 313 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 314 | { |
jhon309 | 0:666850d06c9f | 315 | uint32_t result; |
jhon309 | 0:666850d06c9f | 316 | |
jhon309 | 0:666850d06c9f | 317 | __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 318 | return(result); |
jhon309 | 0:666850d06c9f | 319 | } |
jhon309 | 0:666850d06c9f | 320 | |
jhon309 | 0:666850d06c9f | 321 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 322 | { |
jhon309 | 0:666850d06c9f | 323 | uint32_t result; |
jhon309 | 0:666850d06c9f | 324 | |
jhon309 | 0:666850d06c9f | 325 | __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 326 | return(result); |
jhon309 | 0:666850d06c9f | 327 | } |
jhon309 | 0:666850d06c9f | 328 | |
jhon309 | 0:666850d06c9f | 329 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SASX(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 330 | { |
jhon309 | 0:666850d06c9f | 331 | uint32_t result; |
jhon309 | 0:666850d06c9f | 332 | |
jhon309 | 0:666850d06c9f | 333 | __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 334 | return(result); |
jhon309 | 0:666850d06c9f | 335 | } |
jhon309 | 0:666850d06c9f | 336 | |
jhon309 | 0:666850d06c9f | 337 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QASX(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 338 | { |
jhon309 | 0:666850d06c9f | 339 | uint32_t result; |
jhon309 | 0:666850d06c9f | 340 | |
jhon309 | 0:666850d06c9f | 341 | __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 342 | return(result); |
jhon309 | 0:666850d06c9f | 343 | } |
jhon309 | 0:666850d06c9f | 344 | |
jhon309 | 0:666850d06c9f | 345 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHASX(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 346 | { |
jhon309 | 0:666850d06c9f | 347 | uint32_t result; |
jhon309 | 0:666850d06c9f | 348 | |
jhon309 | 0:666850d06c9f | 349 | __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 350 | return(result); |
jhon309 | 0:666850d06c9f | 351 | } |
jhon309 | 0:666850d06c9f | 352 | |
jhon309 | 0:666850d06c9f | 353 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UASX(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 354 | { |
jhon309 | 0:666850d06c9f | 355 | uint32_t result; |
jhon309 | 0:666850d06c9f | 356 | |
jhon309 | 0:666850d06c9f | 357 | __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 358 | return(result); |
jhon309 | 0:666850d06c9f | 359 | } |
jhon309 | 0:666850d06c9f | 360 | |
jhon309 | 0:666850d06c9f | 361 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQASX(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 362 | { |
jhon309 | 0:666850d06c9f | 363 | uint32_t result; |
jhon309 | 0:666850d06c9f | 364 | |
jhon309 | 0:666850d06c9f | 365 | __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 366 | return(result); |
jhon309 | 0:666850d06c9f | 367 | } |
jhon309 | 0:666850d06c9f | 368 | |
jhon309 | 0:666850d06c9f | 369 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHASX(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 370 | { |
jhon309 | 0:666850d06c9f | 371 | uint32_t result; |
jhon309 | 0:666850d06c9f | 372 | |
jhon309 | 0:666850d06c9f | 373 | __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 374 | return(result); |
jhon309 | 0:666850d06c9f | 375 | } |
jhon309 | 0:666850d06c9f | 376 | |
jhon309 | 0:666850d06c9f | 377 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SSAX(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 378 | { |
jhon309 | 0:666850d06c9f | 379 | uint32_t result; |
jhon309 | 0:666850d06c9f | 380 | |
jhon309 | 0:666850d06c9f | 381 | __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 382 | return(result); |
jhon309 | 0:666850d06c9f | 383 | } |
jhon309 | 0:666850d06c9f | 384 | |
jhon309 | 0:666850d06c9f | 385 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSAX(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 386 | { |
jhon309 | 0:666850d06c9f | 387 | uint32_t result; |
jhon309 | 0:666850d06c9f | 388 | |
jhon309 | 0:666850d06c9f | 389 | __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 390 | return(result); |
jhon309 | 0:666850d06c9f | 391 | } |
jhon309 | 0:666850d06c9f | 392 | |
jhon309 | 0:666850d06c9f | 393 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 394 | { |
jhon309 | 0:666850d06c9f | 395 | uint32_t result; |
jhon309 | 0:666850d06c9f | 396 | |
jhon309 | 0:666850d06c9f | 397 | __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 398 | return(result); |
jhon309 | 0:666850d06c9f | 399 | } |
jhon309 | 0:666850d06c9f | 400 | |
jhon309 | 0:666850d06c9f | 401 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USAX(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 402 | { |
jhon309 | 0:666850d06c9f | 403 | uint32_t result; |
jhon309 | 0:666850d06c9f | 404 | |
jhon309 | 0:666850d06c9f | 405 | __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 406 | return(result); |
jhon309 | 0:666850d06c9f | 407 | } |
jhon309 | 0:666850d06c9f | 408 | |
jhon309 | 0:666850d06c9f | 409 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 410 | { |
jhon309 | 0:666850d06c9f | 411 | uint32_t result; |
jhon309 | 0:666850d06c9f | 412 | |
jhon309 | 0:666850d06c9f | 413 | __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 414 | return(result); |
jhon309 | 0:666850d06c9f | 415 | } |
jhon309 | 0:666850d06c9f | 416 | |
jhon309 | 0:666850d06c9f | 417 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 418 | { |
jhon309 | 0:666850d06c9f | 419 | uint32_t result; |
jhon309 | 0:666850d06c9f | 420 | |
jhon309 | 0:666850d06c9f | 421 | __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 422 | return(result); |
jhon309 | 0:666850d06c9f | 423 | } |
jhon309 | 0:666850d06c9f | 424 | |
jhon309 | 0:666850d06c9f | 425 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USAD8(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 426 | { |
jhon309 | 0:666850d06c9f | 427 | uint32_t result; |
jhon309 | 0:666850d06c9f | 428 | |
jhon309 | 0:666850d06c9f | 429 | __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 430 | return(result); |
jhon309 | 0:666850d06c9f | 431 | } |
jhon309 | 0:666850d06c9f | 432 | |
jhon309 | 0:666850d06c9f | 433 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3) |
jhon309 | 0:666850d06c9f | 434 | { |
jhon309 | 0:666850d06c9f | 435 | uint32_t result; |
jhon309 | 0:666850d06c9f | 436 | |
jhon309 | 0:666850d06c9f | 437 | __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); |
jhon309 | 0:666850d06c9f | 438 | return(result); |
jhon309 | 0:666850d06c9f | 439 | } |
jhon309 | 0:666850d06c9f | 440 | |
jhon309 | 0:666850d06c9f | 441 | #define __SSAT16(ARG1,ARG2) \ |
jhon309 | 0:666850d06c9f | 442 | ({ \ |
jhon309 | 0:666850d06c9f | 443 | uint32_t __RES, __ARG1 = (ARG1); \ |
jhon309 | 0:666850d06c9f | 444 | __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ |
jhon309 | 0:666850d06c9f | 445 | __RES; \ |
jhon309 | 0:666850d06c9f | 446 | }) |
jhon309 | 0:666850d06c9f | 447 | |
jhon309 | 0:666850d06c9f | 448 | #define __USAT16(ARG1,ARG2) \ |
jhon309 | 0:666850d06c9f | 449 | ({ \ |
jhon309 | 0:666850d06c9f | 450 | uint32_t __RES, __ARG1 = (ARG1); \ |
jhon309 | 0:666850d06c9f | 451 | __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ |
jhon309 | 0:666850d06c9f | 452 | __RES; \ |
jhon309 | 0:666850d06c9f | 453 | }) |
jhon309 | 0:666850d06c9f | 454 | |
jhon309 | 0:666850d06c9f | 455 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UXTB16(uint32_t op1) |
jhon309 | 0:666850d06c9f | 456 | { |
jhon309 | 0:666850d06c9f | 457 | uint32_t result; |
jhon309 | 0:666850d06c9f | 458 | |
jhon309 | 0:666850d06c9f | 459 | __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1)); |
jhon309 | 0:666850d06c9f | 460 | return(result); |
jhon309 | 0:666850d06c9f | 461 | } |
jhon309 | 0:666850d06c9f | 462 | |
jhon309 | 0:666850d06c9f | 463 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 464 | { |
jhon309 | 0:666850d06c9f | 465 | uint32_t result; |
jhon309 | 0:666850d06c9f | 466 | |
jhon309 | 0:666850d06c9f | 467 | __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 468 | return(result); |
jhon309 | 0:666850d06c9f | 469 | } |
jhon309 | 0:666850d06c9f | 470 | |
jhon309 | 0:666850d06c9f | 471 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SXTB16(uint32_t op1) |
jhon309 | 0:666850d06c9f | 472 | { |
jhon309 | 0:666850d06c9f | 473 | uint32_t result; |
jhon309 | 0:666850d06c9f | 474 | |
jhon309 | 0:666850d06c9f | 475 | __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1)); |
jhon309 | 0:666850d06c9f | 476 | return(result); |
jhon309 | 0:666850d06c9f | 477 | } |
jhon309 | 0:666850d06c9f | 478 | |
jhon309 | 0:666850d06c9f | 479 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 480 | { |
jhon309 | 0:666850d06c9f | 481 | uint32_t result; |
jhon309 | 0:666850d06c9f | 482 | |
jhon309 | 0:666850d06c9f | 483 | __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 484 | return(result); |
jhon309 | 0:666850d06c9f | 485 | } |
jhon309 | 0:666850d06c9f | 486 | |
jhon309 | 0:666850d06c9f | 487 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 488 | { |
jhon309 | 0:666850d06c9f | 489 | uint32_t result; |
jhon309 | 0:666850d06c9f | 490 | |
jhon309 | 0:666850d06c9f | 491 | __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 492 | return(result); |
jhon309 | 0:666850d06c9f | 493 | } |
jhon309 | 0:666850d06c9f | 494 | |
jhon309 | 0:666850d06c9f | 495 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 496 | { |
jhon309 | 0:666850d06c9f | 497 | uint32_t result; |
jhon309 | 0:666850d06c9f | 498 | |
jhon309 | 0:666850d06c9f | 499 | __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 500 | return(result); |
jhon309 | 0:666850d06c9f | 501 | } |
jhon309 | 0:666850d06c9f | 502 | |
jhon309 | 0:666850d06c9f | 503 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3) |
jhon309 | 0:666850d06c9f | 504 | { |
jhon309 | 0:666850d06c9f | 505 | uint32_t result; |
jhon309 | 0:666850d06c9f | 506 | |
jhon309 | 0:666850d06c9f | 507 | __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); |
jhon309 | 0:666850d06c9f | 508 | return(result); |
jhon309 | 0:666850d06c9f | 509 | } |
jhon309 | 0:666850d06c9f | 510 | |
jhon309 | 0:666850d06c9f | 511 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3) |
jhon309 | 0:666850d06c9f | 512 | { |
jhon309 | 0:666850d06c9f | 513 | uint32_t result; |
jhon309 | 0:666850d06c9f | 514 | |
jhon309 | 0:666850d06c9f | 515 | __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); |
jhon309 | 0:666850d06c9f | 516 | return(result); |
jhon309 | 0:666850d06c9f | 517 | } |
jhon309 | 0:666850d06c9f | 518 | |
jhon309 | 0:666850d06c9f | 519 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc) |
jhon309 | 0:666850d06c9f | 520 | { |
jhon309 | 0:666850d06c9f | 521 | union llreg_u{ |
jhon309 | 0:666850d06c9f | 522 | uint32_t w32[2]; |
jhon309 | 0:666850d06c9f | 523 | uint64_t w64; |
jhon309 | 0:666850d06c9f | 524 | } llr; |
jhon309 | 0:666850d06c9f | 525 | llr.w64 = acc; |
jhon309 | 0:666850d06c9f | 526 | |
jhon309 | 0:666850d06c9f | 527 | #ifndef __ARMEB__ // Little endian |
jhon309 | 0:666850d06c9f | 528 | __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); |
jhon309 | 0:666850d06c9f | 529 | #else // Big endian |
jhon309 | 0:666850d06c9f | 530 | __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); |
jhon309 | 0:666850d06c9f | 531 | #endif |
jhon309 | 0:666850d06c9f | 532 | |
jhon309 | 0:666850d06c9f | 533 | return(llr.w64); |
jhon309 | 0:666850d06c9f | 534 | } |
jhon309 | 0:666850d06c9f | 535 | |
jhon309 | 0:666850d06c9f | 536 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc) |
jhon309 | 0:666850d06c9f | 537 | { |
jhon309 | 0:666850d06c9f | 538 | union llreg_u{ |
jhon309 | 0:666850d06c9f | 539 | uint32_t w32[2]; |
jhon309 | 0:666850d06c9f | 540 | uint64_t w64; |
jhon309 | 0:666850d06c9f | 541 | } llr; |
jhon309 | 0:666850d06c9f | 542 | llr.w64 = acc; |
jhon309 | 0:666850d06c9f | 543 | |
jhon309 | 0:666850d06c9f | 544 | #ifndef __ARMEB__ // Little endian |
jhon309 | 0:666850d06c9f | 545 | __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); |
jhon309 | 0:666850d06c9f | 546 | #else // Big endian |
jhon309 | 0:666850d06c9f | 547 | __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); |
jhon309 | 0:666850d06c9f | 548 | #endif |
jhon309 | 0:666850d06c9f | 549 | |
jhon309 | 0:666850d06c9f | 550 | return(llr.w64); |
jhon309 | 0:666850d06c9f | 551 | } |
jhon309 | 0:666850d06c9f | 552 | |
jhon309 | 0:666850d06c9f | 553 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 554 | { |
jhon309 | 0:666850d06c9f | 555 | uint32_t result; |
jhon309 | 0:666850d06c9f | 556 | |
jhon309 | 0:666850d06c9f | 557 | __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 558 | return(result); |
jhon309 | 0:666850d06c9f | 559 | } |
jhon309 | 0:666850d06c9f | 560 | |
jhon309 | 0:666850d06c9f | 561 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 562 | { |
jhon309 | 0:666850d06c9f | 563 | uint32_t result; |
jhon309 | 0:666850d06c9f | 564 | |
jhon309 | 0:666850d06c9f | 565 | __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 566 | return(result); |
jhon309 | 0:666850d06c9f | 567 | } |
jhon309 | 0:666850d06c9f | 568 | |
jhon309 | 0:666850d06c9f | 569 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3) |
jhon309 | 0:666850d06c9f | 570 | { |
jhon309 | 0:666850d06c9f | 571 | uint32_t result; |
jhon309 | 0:666850d06c9f | 572 | |
jhon309 | 0:666850d06c9f | 573 | __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); |
jhon309 | 0:666850d06c9f | 574 | return(result); |
jhon309 | 0:666850d06c9f | 575 | } |
jhon309 | 0:666850d06c9f | 576 | |
jhon309 | 0:666850d06c9f | 577 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3) |
jhon309 | 0:666850d06c9f | 578 | { |
jhon309 | 0:666850d06c9f | 579 | uint32_t result; |
jhon309 | 0:666850d06c9f | 580 | |
jhon309 | 0:666850d06c9f | 581 | __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); |
jhon309 | 0:666850d06c9f | 582 | return(result); |
jhon309 | 0:666850d06c9f | 583 | } |
jhon309 | 0:666850d06c9f | 584 | |
jhon309 | 0:666850d06c9f | 585 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc) |
jhon309 | 0:666850d06c9f | 586 | { |
jhon309 | 0:666850d06c9f | 587 | union llreg_u{ |
jhon309 | 0:666850d06c9f | 588 | uint32_t w32[2]; |
jhon309 | 0:666850d06c9f | 589 | uint64_t w64; |
jhon309 | 0:666850d06c9f | 590 | } llr; |
jhon309 | 0:666850d06c9f | 591 | llr.w64 = acc; |
jhon309 | 0:666850d06c9f | 592 | |
jhon309 | 0:666850d06c9f | 593 | #ifndef __ARMEB__ // Little endian |
jhon309 | 0:666850d06c9f | 594 | __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); |
jhon309 | 0:666850d06c9f | 595 | #else // Big endian |
jhon309 | 0:666850d06c9f | 596 | __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); |
jhon309 | 0:666850d06c9f | 597 | #endif |
jhon309 | 0:666850d06c9f | 598 | |
jhon309 | 0:666850d06c9f | 599 | return(llr.w64); |
jhon309 | 0:666850d06c9f | 600 | } |
jhon309 | 0:666850d06c9f | 601 | |
jhon309 | 0:666850d06c9f | 602 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc) |
jhon309 | 0:666850d06c9f | 603 | { |
jhon309 | 0:666850d06c9f | 604 | union llreg_u{ |
jhon309 | 0:666850d06c9f | 605 | uint32_t w32[2]; |
jhon309 | 0:666850d06c9f | 606 | uint64_t w64; |
jhon309 | 0:666850d06c9f | 607 | } llr; |
jhon309 | 0:666850d06c9f | 608 | llr.w64 = acc; |
jhon309 | 0:666850d06c9f | 609 | |
jhon309 | 0:666850d06c9f | 610 | #ifndef __ARMEB__ // Little endian |
jhon309 | 0:666850d06c9f | 611 | __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); |
jhon309 | 0:666850d06c9f | 612 | #else // Big endian |
jhon309 | 0:666850d06c9f | 613 | __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); |
jhon309 | 0:666850d06c9f | 614 | #endif |
jhon309 | 0:666850d06c9f | 615 | |
jhon309 | 0:666850d06c9f | 616 | return(llr.w64); |
jhon309 | 0:666850d06c9f | 617 | } |
jhon309 | 0:666850d06c9f | 618 | |
jhon309 | 0:666850d06c9f | 619 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SEL (uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 620 | { |
jhon309 | 0:666850d06c9f | 621 | uint32_t result; |
jhon309 | 0:666850d06c9f | 622 | |
jhon309 | 0:666850d06c9f | 623 | __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 624 | return(result); |
jhon309 | 0:666850d06c9f | 625 | } |
jhon309 | 0:666850d06c9f | 626 | |
jhon309 | 0:666850d06c9f | 627 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QADD(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 628 | { |
jhon309 | 0:666850d06c9f | 629 | uint32_t result; |
jhon309 | 0:666850d06c9f | 630 | |
jhon309 | 0:666850d06c9f | 631 | __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 632 | return(result); |
jhon309 | 0:666850d06c9f | 633 | } |
jhon309 | 0:666850d06c9f | 634 | |
jhon309 | 0:666850d06c9f | 635 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSUB(uint32_t op1, uint32_t op2) |
jhon309 | 0:666850d06c9f | 636 | { |
jhon309 | 0:666850d06c9f | 637 | uint32_t result; |
jhon309 | 0:666850d06c9f | 638 | |
jhon309 | 0:666850d06c9f | 639 | __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); |
jhon309 | 0:666850d06c9f | 640 | return(result); |
jhon309 | 0:666850d06c9f | 641 | } |
jhon309 | 0:666850d06c9f | 642 | |
jhon309 | 0:666850d06c9f | 643 | #define __PKHBT(ARG1,ARG2,ARG3) \ |
jhon309 | 0:666850d06c9f | 644 | ({ \ |
jhon309 | 0:666850d06c9f | 645 | uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ |
jhon309 | 0:666850d06c9f | 646 | __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ |
jhon309 | 0:666850d06c9f | 647 | __RES; \ |
jhon309 | 0:666850d06c9f | 648 | }) |
jhon309 | 0:666850d06c9f | 649 | |
jhon309 | 0:666850d06c9f | 650 | #define __PKHTB(ARG1,ARG2,ARG3) \ |
jhon309 | 0:666850d06c9f | 651 | ({ \ |
jhon309 | 0:666850d06c9f | 652 | uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ |
jhon309 | 0:666850d06c9f | 653 | if (ARG3 == 0) \ |
jhon309 | 0:666850d06c9f | 654 | __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \ |
jhon309 | 0:666850d06c9f | 655 | else \ |
jhon309 | 0:666850d06c9f | 656 | __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ |
jhon309 | 0:666850d06c9f | 657 | __RES; \ |
jhon309 | 0:666850d06c9f | 658 | }) |
jhon309 | 0:666850d06c9f | 659 | |
jhon309 | 0:666850d06c9f | 660 | __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3) |
jhon309 | 0:666850d06c9f | 661 | { |
jhon309 | 0:666850d06c9f | 662 | int32_t result; |
jhon309 | 0:666850d06c9f | 663 | |
jhon309 | 0:666850d06c9f | 664 | __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) ); |
jhon309 | 0:666850d06c9f | 665 | return(result); |
jhon309 | 0:666850d06c9f | 666 | } |
jhon309 | 0:666850d06c9f | 667 | |
jhon309 | 0:666850d06c9f | 668 | |
jhon309 | 0:666850d06c9f | 669 | #elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/ |
jhon309 | 0:666850d06c9f | 670 | /* IAR iccarm specific functions */ |
jhon309 | 0:666850d06c9f | 671 | #include <cmsis_iar.h> |
jhon309 | 0:666850d06c9f | 672 | |
jhon309 | 0:666850d06c9f | 673 | |
jhon309 | 0:666850d06c9f | 674 | #elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/ |
jhon309 | 0:666850d06c9f | 675 | /* TI CCS specific functions */ |
jhon309 | 0:666850d06c9f | 676 | #include <cmsis_ccs.h> |
jhon309 | 0:666850d06c9f | 677 | |
jhon309 | 0:666850d06c9f | 678 | |
jhon309 | 0:666850d06c9f | 679 | #elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/ |
jhon309 | 0:666850d06c9f | 680 | /* TASKING carm specific functions */ |
jhon309 | 0:666850d06c9f | 681 | /* not yet supported */ |
jhon309 | 0:666850d06c9f | 682 | |
jhon309 | 0:666850d06c9f | 683 | |
jhon309 | 0:666850d06c9f | 684 | #elif defined ( __CSMC__ ) /*------------------ COSMIC Compiler -------------------*/ |
jhon309 | 0:666850d06c9f | 685 | /* Cosmic specific functions */ |
jhon309 | 0:666850d06c9f | 686 | #include <cmsis_csm.h> |
jhon309 | 0:666850d06c9f | 687 | |
jhon309 | 0:666850d06c9f | 688 | #endif |
jhon309 | 0:666850d06c9f | 689 | |
jhon309 | 0:666850d06c9f | 690 | /*@} end of group CMSIS_SIMD_intrinsics */ |
jhon309 | 0:666850d06c9f | 691 | |
jhon309 | 0:666850d06c9f | 692 | |
jhon309 | 0:666850d06c9f | 693 | #ifdef __cplusplus |
jhon309 | 0:666850d06c9f | 694 | } |
jhon309 | 0:666850d06c9f | 695 | #endif |
jhon309 | 0:666850d06c9f | 696 | |
jhon309 | 0:666850d06c9f | 697 | #endif /* __CORE_CMSIMD_H */ |