| 1 |
/* ARM Non-NEON ACLE intrinsics include file. |
| 2 |
|
| 3 |
Copyright (C) 2013-2025 Free Software Foundation, Inc. |
| 4 |
Contributed by ARM Ltd. |
| 5 |
|
| 6 |
This file is part of GCC. |
| 7 |
|
| 8 |
GCC is free software; you can redistribute it and/or modify it |
| 9 |
under the terms of the GNU General Public License as published |
| 10 |
by the Free Software Foundation; either version 3, or (at your |
| 11 |
option) any later version. |
| 12 |
|
| 13 |
GCC is distributed in the hope that it will be useful, but WITHOUT |
| 14 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 15 |
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 16 |
License for more details. |
| 17 |
|
| 18 |
Under Section 7 of GPL version 3, you are granted additional |
| 19 |
permissions described in the GCC Runtime Library Exception, version |
| 20 |
3.1, as published by the Free Software Foundation. |
| 21 |
|
| 22 |
You should have received a copy of the GNU General Public License and |
| 23 |
a copy of the GCC Runtime Library Exception along with this program; |
| 24 |
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 25 |
<http://www.gnu.org/licenses/>. */ |
| 26 |
|
| 27 |
#ifndef _GCC_ARM_ACLE_H |
| 28 |
#define _GCC_ARM_ACLE_H |
| 29 |
|
| 30 |
#include <stdint.h> |
| 31 |
|
| 32 |
#ifdef __cplusplus |
| 33 |
extern "C" { |
| 34 |
#endif |
| 35 |
|
| 36 |
#define _GCC_ARM_ACLE_ROR_FN(NAME, TYPE) \ |
| 37 |
__extension__ extern __inline TYPE \ |
| 38 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) \ |
| 39 |
NAME (TYPE __value, uint32_t __rotate) \ |
| 40 |
{ \ |
| 41 |
int __size = (int) sizeof (TYPE) * __CHAR_BIT__; \ |
| 42 |
__rotate = __rotate % __size; \ |
| 43 |
return __value >> __rotate | __value << ((__size - __rotate) % __size); \ |
| 44 |
} |
| 45 |
|
| 46 |
_GCC_ARM_ACLE_ROR_FN (__ror, uint32_t) |
| 47 |
_GCC_ARM_ACLE_ROR_FN (__rorl, unsigned long) |
| 48 |
_GCC_ARM_ACLE_ROR_FN (__rorll, uint64_t) |
| 49 |
|
| 50 |
#undef _GCC_ARM_ACLE_ROR_FN |
| 51 |
|
| 52 |
#define _GCC_ARM_ACLE_DATA_FN(NAME, ITYPE, RTYPE) \ |
| 53 |
__extension__ extern __inline RTYPE \ |
| 54 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) \ |
| 55 |
__##NAME (ITYPE __value) |
| 56 |
|
| 57 |
#define _GCC_ARM_ACLE_DATA_ALIAS(NAME, BUILTIN, ITYPE, RTYPE) \ |
| 58 |
_GCC_ARM_ACLE_DATA_FN(NAME, ITYPE, RTYPE) \ |
| 59 |
{ \ |
| 60 |
return __builtin_##BUILTIN (__value); \ |
| 61 |
} |
| 62 |
|
| 63 |
_GCC_ARM_ACLE_DATA_ALIAS (clz, clz, uint32_t, unsigned int) |
| 64 |
_GCC_ARM_ACLE_DATA_ALIAS (clzl, clzl, unsigned long, unsigned int) |
| 65 |
_GCC_ARM_ACLE_DATA_ALIAS (clzll, clzll, uint64_t, unsigned int) |
| 66 |
_GCC_ARM_ACLE_DATA_ALIAS (cls, clrsb, uint32_t, unsigned int) |
| 67 |
_GCC_ARM_ACLE_DATA_ALIAS (clsl, clrsbl, unsigned long, unsigned int) |
| 68 |
_GCC_ARM_ACLE_DATA_ALIAS (clsll, clrsbll, uint64_t, unsigned int) |
| 69 |
_GCC_ARM_ACLE_DATA_ALIAS (revsh, bswap16, int16_t, int16_t) |
| 70 |
_GCC_ARM_ACLE_DATA_ALIAS (rev, bswap32, uint32_t, uint32_t) |
| 71 |
_GCC_ARM_ACLE_DATA_ALIAS (revl, bswap32, unsigned long, unsigned long) |
| 72 |
_GCC_ARM_ACLE_DATA_ALIAS (revll, bswap64, uint64_t, uint64_t) |
| 73 |
#if __ARM_ARCH >= 6 |
| 74 |
_GCC_ARM_ACLE_DATA_ALIAS (rev16, arm_rev16si2, uint32_t, uint32_t) |
| 75 |
_GCC_ARM_ACLE_DATA_ALIAS (rev16l, arm_rev16si2, unsigned long, unsigned long) |
| 76 |
#else |
| 77 |
_GCC_ARM_ACLE_DATA_FN(rev16, uint32_t, uint32_t) { |
| 78 |
return ((__value & 0xff00ff) << 8 | (__value & 0xff00ff00) >> 8); |
| 79 |
} |
| 80 |
_GCC_ARM_ACLE_DATA_FN(rev16l, unsigned long, unsigned long) { |
| 81 |
return ((__value & 0xff00ff) << 8 | (__value & 0xff00ff00) >> 8); |
| 82 |
} |
| 83 |
#endif |
| 84 |
_GCC_ARM_ACLE_DATA_FN(rev16ll, uint64_t, uint64_t) { |
| 85 |
return __rev16l(__value) | (uint64_t)__rev16l(__value >> 32) << 32; |
| 86 |
} |
| 87 |
|
| 88 |
#if __ARM_ARCH_6T2__ || __ARM_ARCH >= 7 |
| 89 |
_GCC_ARM_ACLE_DATA_ALIAS (rbit, arm_rbit, uint32_t, uint32_t) |
| 90 |
_GCC_ARM_ACLE_DATA_ALIAS (rbitl, arm_rbit, unsigned long, unsigned int) |
| 91 |
_GCC_ARM_ACLE_DATA_FN(rbitll, uint64_t, uint64_t) { |
| 92 |
return ((uint64_t)__rbit(__value) << 32) | __rbit(__value >> 32); |
| 93 |
} |
| 94 |
#endif |
| 95 |
|
| 96 |
#undef _GCC_ARM_ACLE_DATA_ALIAS |
| 97 |
#undef _GCC_ARM_ACLE_DATA_FN |
| 98 |
|
| 99 |
#if (!__thumb__ || __thumb2__) && __ARM_ARCH >= 4 |
| 100 |
__extension__ static __inline void __attribute__ ((__always_inline__)) |
| 101 |
__arm_cdp (const unsigned int __coproc, const unsigned int __opc1, |
| 102 |
const unsigned int __CRd, const unsigned int __CRn, |
| 103 |
const unsigned int __CRm, const unsigned int __opc2) |
| 104 |
{ |
| 105 |
__builtin_arm_cdp (__coproc, __opc1, __CRd, __CRn, __CRm, __opc2); |
| 106 |
} |
| 107 |
|
| 108 |
__extension__ static __inline void __attribute__ ((__always_inline__)) |
| 109 |
__arm_ldc (const unsigned int __coproc, const unsigned int __CRd, |
| 110 |
const void * __p) |
| 111 |
{ |
| 112 |
__builtin_arm_ldc (__coproc, __CRd, __p); |
| 113 |
} |
| 114 |
|
| 115 |
__extension__ static __inline void __attribute__ ((__always_inline__)) |
| 116 |
__arm_ldcl (const unsigned int __coproc, const unsigned int __CRd, |
| 117 |
const void * __p) |
| 118 |
{ |
| 119 |
__builtin_arm_ldcl (__coproc, __CRd, __p); |
| 120 |
} |
| 121 |
|
| 122 |
__extension__ static __inline void __attribute__ ((__always_inline__)) |
| 123 |
__arm_stc (const unsigned int __coproc, const unsigned int __CRd, |
| 124 |
void * __p) |
| 125 |
{ |
| 126 |
__builtin_arm_stc (__coproc, __CRd, __p); |
| 127 |
} |
| 128 |
|
| 129 |
__extension__ static __inline void __attribute__ ((__always_inline__)) |
| 130 |
__arm_stcl (const unsigned int __coproc, const unsigned int __CRd, |
| 131 |
void * __p) |
| 132 |
{ |
| 133 |
__builtin_arm_stcl (__coproc, __CRd, __p); |
| 134 |
} |
| 135 |
|
| 136 |
__extension__ static __inline void __attribute__ ((__always_inline__)) |
| 137 |
__arm_mcr (const unsigned int __coproc, const unsigned int __opc1, |
| 138 |
uint32_t __value, const unsigned int __CRn, const unsigned int __CRm, |
| 139 |
const unsigned int __opc2) |
| 140 |
{ |
| 141 |
__builtin_arm_mcr (__coproc, __opc1, __value, __CRn, __CRm, __opc2); |
| 142 |
} |
| 143 |
|
| 144 |
__extension__ static __inline uint32_t __attribute__ ((__always_inline__)) |
| 145 |
__arm_mrc (const unsigned int __coproc, const unsigned int __opc1, |
| 146 |
const unsigned int __CRn, const unsigned int __CRm, |
| 147 |
const unsigned int __opc2) |
| 148 |
{ |
| 149 |
return __builtin_arm_mrc (__coproc, __opc1, __CRn, __CRm, __opc2); |
| 150 |
} |
| 151 |
#if __ARM_ARCH >= 5 |
| 152 |
__extension__ static __inline void __attribute__ ((__always_inline__)) |
| 153 |
__arm_cdp2 (const unsigned int __coproc, const unsigned int __opc1, |
| 154 |
const unsigned int __CRd, const unsigned int __CRn, |
| 155 |
const unsigned int __CRm, const unsigned int __opc2) |
| 156 |
{ |
| 157 |
__builtin_arm_cdp2 (__coproc, __opc1, __CRd, __CRn, __CRm, __opc2); |
| 158 |
} |
| 159 |
|
| 160 |
__extension__ static __inline void __attribute__ ((__always_inline__)) |
| 161 |
__arm_ldc2 (const unsigned int __coproc, const unsigned int __CRd, |
| 162 |
const void * __p) |
| 163 |
{ |
| 164 |
__builtin_arm_ldc2 (__coproc, __CRd, __p); |
| 165 |
} |
| 166 |
|
| 167 |
__extension__ static __inline void __attribute__ ((__always_inline__)) |
| 168 |
__arm_ldc2l (const unsigned int __coproc, const unsigned int __CRd, |
| 169 |
const void * __p) |
| 170 |
{ |
| 171 |
__builtin_arm_ldc2l (__coproc, __CRd, __p); |
| 172 |
} |
| 173 |
|
| 174 |
__extension__ static __inline void __attribute__ ((__always_inline__)) |
| 175 |
__arm_stc2 (const unsigned int __coproc, const unsigned int __CRd, |
| 176 |
void * __p) |
| 177 |
{ |
| 178 |
__builtin_arm_stc2 (__coproc, __CRd, __p); |
| 179 |
} |
| 180 |
|
| 181 |
__extension__ static __inline void __attribute__ ((__always_inline__)) |
| 182 |
__arm_stc2l (const unsigned int __coproc, const unsigned int __CRd, |
| 183 |
void * __p) |
| 184 |
{ |
| 185 |
__builtin_arm_stc2l (__coproc, __CRd, __p); |
| 186 |
} |
| 187 |
|
| 188 |
__extension__ static __inline void __attribute__ ((__always_inline__)) |
| 189 |
__arm_mcr2 (const unsigned int __coproc, const unsigned int __opc1, |
| 190 |
uint32_t __value, const unsigned int __CRn, |
| 191 |
const unsigned int __CRm, const unsigned int __opc2) |
| 192 |
{ |
| 193 |
__builtin_arm_mcr2 (__coproc, __opc1, __value, __CRn, __CRm, __opc2); |
| 194 |
} |
| 195 |
|
| 196 |
__extension__ static __inline uint32_t __attribute__ ((__always_inline__)) |
| 197 |
__arm_mrc2 (const unsigned int __coproc, const unsigned int __opc1, |
| 198 |
const unsigned int __CRn, const unsigned int __CRm, |
| 199 |
const unsigned int __opc2) |
| 200 |
{ |
| 201 |
return __builtin_arm_mrc2 (__coproc, __opc1, __CRn, __CRm, __opc2); |
| 202 |
} |
| 203 |
|
| 204 |
#if __ARM_ARCH >= 6 || defined (__ARM_ARCH_5TE__) |
| 205 |
|
| 206 |
__extension__ static __inline void __attribute__ ((__always_inline__)) |
| 207 |
__arm_mcrr (const unsigned int __coproc, const unsigned int __opc1, |
| 208 |
uint64_t __value, const unsigned int __CRm) |
| 209 |
{ |
| 210 |
__builtin_arm_mcrr (__coproc, __opc1, __value, __CRm); |
| 211 |
} |
| 212 |
|
| 213 |
__extension__ static __inline uint64_t __attribute__ ((__always_inline__)) |
| 214 |
__arm_mrrc (const unsigned int __coproc, const unsigned int __opc1, |
| 215 |
const unsigned int __CRm) |
| 216 |
{ |
| 217 |
return __builtin_arm_mrrc (__coproc, __opc1, __CRm); |
| 218 |
} |
| 219 |
|
| 220 |
#if __ARM_ARCH >= 6 |
| 221 |
|
| 222 |
__extension__ static __inline void __attribute__ ((__always_inline__)) |
| 223 |
__arm_mcrr2 (const unsigned int __coproc, const unsigned int __opc1, |
| 224 |
uint64_t __value, const unsigned int __CRm) |
| 225 |
{ |
| 226 |
__builtin_arm_mcrr2 (__coproc, __opc1, __value, __CRm); |
| 227 |
} |
| 228 |
|
| 229 |
__extension__ static __inline uint64_t __attribute__ ((__always_inline__)) |
| 230 |
__arm_mrrc2 (const unsigned int __coproc, const unsigned int __opc1, |
| 231 |
const unsigned int __CRm) |
| 232 |
{ |
| 233 |
return __builtin_arm_mrrc2 (__coproc, __opc1, __CRm); |
| 234 |
} |
| 235 |
#endif /* __ARM_ARCH >= 6. */ |
| 236 |
#endif /* __ARM_ARCH >= 6 || defined (__ARM_ARCH_5TE__). */ |
| 237 |
#endif /* __ARM_ARCH >= 5. */ |
| 238 |
#endif /* (!__thumb__ || __thumb2__) && __ARM_ARCH >= 4. */ |
| 239 |
|
| 240 |
#ifdef __ARM_FEATURE_SIMD32 |
| 241 |
typedef int32_t int16x2_t; |
| 242 |
typedef uint32_t uint16x2_t; |
| 243 |
typedef int32_t int8x4_t; |
| 244 |
typedef uint32_t uint8x4_t; |
| 245 |
|
| 246 |
__extension__ extern __inline int16x2_t |
| 247 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 248 |
__sxtab16 (int16x2_t __a, int8x4_t __b) |
| 249 |
{ |
| 250 |
return __builtin_arm_sxtab16 (__a, __b); |
| 251 |
} |
| 252 |
|
| 253 |
__extension__ extern __inline int16x2_t |
| 254 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 255 |
__sxtb16 (int8x4_t __a) |
| 256 |
{ |
| 257 |
return __builtin_arm_sxtb16 (__a); |
| 258 |
} |
| 259 |
|
| 260 |
__extension__ extern __inline uint16x2_t |
| 261 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 262 |
__uxtab16 (uint16x2_t __a, uint8x4_t __b) |
| 263 |
{ |
| 264 |
return __builtin_arm_uxtab16 (__a, __b); |
| 265 |
} |
| 266 |
|
| 267 |
__extension__ extern __inline uint16x2_t |
| 268 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 269 |
__uxtb16 (uint8x4_t __a) |
| 270 |
{ |
| 271 |
return __builtin_arm_uxtb16 (__a); |
| 272 |
} |
| 273 |
|
| 274 |
__extension__ extern __inline int8x4_t |
| 275 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 276 |
__qadd8 (int8x4_t __a, int8x4_t __b) |
| 277 |
{ |
| 278 |
return __builtin_arm_qadd8 (__a, __b); |
| 279 |
} |
| 280 |
|
| 281 |
__extension__ extern __inline int8x4_t |
| 282 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 283 |
__qsub8 (int8x4_t __a, int8x4_t __b) |
| 284 |
{ |
| 285 |
return __builtin_arm_qsub8 (__a, __b); |
| 286 |
} |
| 287 |
|
| 288 |
__extension__ extern __inline int8x4_t |
| 289 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 290 |
__shadd8 (int8x4_t __a, int8x4_t __b) |
| 291 |
{ |
| 292 |
return __builtin_arm_shadd8 (__a, __b); |
| 293 |
} |
| 294 |
|
| 295 |
__extension__ extern __inline int8x4_t |
| 296 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 297 |
__shsub8 (int8x4_t __a, int8x4_t __b) |
| 298 |
{ |
| 299 |
return __builtin_arm_shsub8 (__a, __b); |
| 300 |
} |
| 301 |
|
| 302 |
__extension__ extern __inline uint8x4_t |
| 303 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 304 |
__uhadd8 (uint8x4_t __a, uint8x4_t __b) |
| 305 |
{ |
| 306 |
return __builtin_arm_uhadd8 (__a, __b); |
| 307 |
} |
| 308 |
|
| 309 |
__extension__ extern __inline uint8x4_t |
| 310 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 311 |
__uhsub8 (uint8x4_t __a, uint8x4_t __b) |
| 312 |
{ |
| 313 |
return __builtin_arm_uhsub8 (__a, __b); |
| 314 |
} |
| 315 |
|
| 316 |
__extension__ extern __inline uint8x4_t |
| 317 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 318 |
__uqadd8 (uint8x4_t __a, uint8x4_t __b) |
| 319 |
{ |
| 320 |
return __builtin_arm_uqadd8 (__a, __b); |
| 321 |
} |
| 322 |
|
| 323 |
__extension__ extern __inline uint8x4_t |
| 324 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 325 |
__uqsub8 (uint8x4_t __a, uint8x4_t __b) |
| 326 |
{ |
| 327 |
return __builtin_arm_uqsub8 (__a, __b); |
| 328 |
} |
| 329 |
|
| 330 |
__extension__ extern __inline int16x2_t |
| 331 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 332 |
__qadd16 (int16x2_t __a, int16x2_t __b) |
| 333 |
{ |
| 334 |
return __builtin_arm_qadd16 (__a, __b); |
| 335 |
} |
| 336 |
|
| 337 |
__extension__ extern __inline int16x2_t |
| 338 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 339 |
__qasx (int16x2_t __a, int16x2_t __b) |
| 340 |
{ |
| 341 |
return __builtin_arm_qasx (__a, __b); |
| 342 |
} |
| 343 |
|
| 344 |
__extension__ extern __inline int16x2_t |
| 345 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 346 |
__qsax (int16x2_t __a, int16x2_t __b) |
| 347 |
{ |
| 348 |
return __builtin_arm_qsax (__a, __b); |
| 349 |
} |
| 350 |
|
| 351 |
__extension__ extern __inline int16x2_t |
| 352 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 353 |
__qsub16 (int16x2_t __a, int16x2_t __b) |
| 354 |
{ |
| 355 |
return __builtin_arm_qsub16 (__a, __b); |
| 356 |
} |
| 357 |
|
| 358 |
__extension__ extern __inline int16x2_t |
| 359 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 360 |
__shadd16 (int16x2_t __a, int16x2_t __b) |
| 361 |
{ |
| 362 |
return __builtin_arm_shadd16 (__a, __b); |
| 363 |
} |
| 364 |
|
| 365 |
__extension__ extern __inline int16x2_t |
| 366 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 367 |
__shasx (int16x2_t __a, int16x2_t __b) |
| 368 |
{ |
| 369 |
return __builtin_arm_shasx (__a, __b); |
| 370 |
} |
| 371 |
|
| 372 |
__extension__ extern __inline int16x2_t |
| 373 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 374 |
__shsax (int16x2_t __a, int16x2_t __b) |
| 375 |
{ |
| 376 |
return __builtin_arm_shsax (__a, __b); |
| 377 |
} |
| 378 |
|
| 379 |
__extension__ extern __inline int16x2_t |
| 380 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 381 |
__shsub16 (int16x2_t __a, int16x2_t __b) |
| 382 |
{ |
| 383 |
return __builtin_arm_shsub16 (__a, __b); |
| 384 |
} |
| 385 |
|
| 386 |
__extension__ extern __inline uint16x2_t |
| 387 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 388 |
__uhadd16 (uint16x2_t __a, uint16x2_t __b) |
| 389 |
{ |
| 390 |
return __builtin_arm_uhadd16 (__a, __b); |
| 391 |
} |
| 392 |
|
| 393 |
__extension__ extern __inline uint16x2_t |
| 394 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 395 |
__uhasx (uint16x2_t __a, uint16x2_t __b) |
| 396 |
{ |
| 397 |
return __builtin_arm_uhasx (__a, __b); |
| 398 |
} |
| 399 |
|
| 400 |
__extension__ extern __inline uint16x2_t |
| 401 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 402 |
__uhsax (uint16x2_t __a, uint16x2_t __b) |
| 403 |
{ |
| 404 |
return __builtin_arm_uhsax (__a, __b); |
| 405 |
} |
| 406 |
|
| 407 |
__extension__ extern __inline uint16x2_t |
| 408 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 409 |
__uhsub16 (uint16x2_t __a, uint16x2_t __b) |
| 410 |
{ |
| 411 |
return __builtin_arm_uhsub16 (__a, __b); |
| 412 |
} |
| 413 |
|
| 414 |
__extension__ extern __inline uint16x2_t |
| 415 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 416 |
__uqadd16 (uint16x2_t __a, uint16x2_t __b) |
| 417 |
{ |
| 418 |
return __builtin_arm_uqadd16 (__a, __b); |
| 419 |
} |
| 420 |
|
| 421 |
__extension__ extern __inline uint16x2_t |
| 422 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 423 |
__uqasx (uint16x2_t __a, uint16x2_t __b) |
| 424 |
{ |
| 425 |
return __builtin_arm_uqasx (__a, __b); |
| 426 |
} |
| 427 |
|
| 428 |
__extension__ extern __inline uint16x2_t |
| 429 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 430 |
__uqsax (uint16x2_t __a, uint16x2_t __b) |
| 431 |
{ |
| 432 |
return __builtin_arm_uqsax (__a, __b); |
| 433 |
} |
| 434 |
|
| 435 |
__extension__ extern __inline uint16x2_t |
| 436 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 437 |
__uqsub16 (uint16x2_t __a, uint16x2_t __b) |
| 438 |
{ |
| 439 |
return __builtin_arm_uqsub16 (__a, __b); |
| 440 |
} |
| 441 |
|
| 442 |
__extension__ extern __inline int32_t |
| 443 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 444 |
__smusd (int16x2_t __a, int16x2_t __b) |
| 445 |
{ |
| 446 |
return __builtin_arm_smusd (__a, __b); |
| 447 |
} |
| 448 |
|
| 449 |
__extension__ extern __inline int32_t |
| 450 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 451 |
__smusdx (int16x2_t __a, int16x2_t __b) |
| 452 |
{ |
| 453 |
return __builtin_arm_smusdx (__a, __b); |
| 454 |
} |
| 455 |
|
| 456 |
__extension__ extern __inline uint32_t |
| 457 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 458 |
__usad8 (uint8x4_t __a, uint8x4_t __b) |
| 459 |
{ |
| 460 |
return __builtin_arm_usad8 (__a, __b); |
| 461 |
} |
| 462 |
|
| 463 |
__extension__ extern __inline uint32_t |
| 464 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 465 |
__usada8 (uint8x4_t __a, uint8x4_t __b, uint32_t __c) |
| 466 |
{ |
| 467 |
return __builtin_arm_usada8 (__a, __b, __c); |
| 468 |
} |
| 469 |
|
| 470 |
__extension__ extern __inline int64_t |
| 471 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 472 |
__smlald (int16x2_t __a, int16x2_t __b, int64_t __c) |
| 473 |
{ |
| 474 |
return __builtin_arm_smlald (__a, __b, __c); |
| 475 |
} |
| 476 |
|
| 477 |
__extension__ extern __inline int64_t |
| 478 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 479 |
__smlaldx (int16x2_t __a, int16x2_t __b, int64_t __c) |
| 480 |
{ |
| 481 |
return __builtin_arm_smlaldx (__a, __b, __c); |
| 482 |
} |
| 483 |
|
| 484 |
__extension__ extern __inline int64_t |
| 485 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 486 |
__smlsld (int16x2_t __a, int16x2_t __b, int64_t __c) |
| 487 |
{ |
| 488 |
return __builtin_arm_smlsld (__a, __b, __c); |
| 489 |
} |
| 490 |
|
| 491 |
__extension__ extern __inline int64_t |
| 492 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 493 |
__smlsldx (int16x2_t __a, int16x2_t __b, int64_t __c) |
| 494 |
{ |
| 495 |
return __builtin_arm_smlsldx (__a, __b, __c); |
| 496 |
} |
| 497 |
|
| 498 |
__extension__ extern __inline uint8x4_t |
| 499 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 500 |
__sel (uint8x4_t __a, uint8x4_t __b) |
| 501 |
{ |
| 502 |
return __builtin_arm_sel (__a, __b); |
| 503 |
} |
| 504 |
|
| 505 |
__extension__ extern __inline int8x4_t |
| 506 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 507 |
__sadd8 (int8x4_t __a, int8x4_t __b) |
| 508 |
{ |
| 509 |
return __builtin_arm_sadd8 (__a, __b); |
| 510 |
} |
| 511 |
|
| 512 |
__extension__ extern __inline int8x4_t |
| 513 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 514 |
__ssub8 (int8x4_t __a, int8x4_t __b) |
| 515 |
{ |
| 516 |
return __builtin_arm_ssub8 (__a, __b); |
| 517 |
} |
| 518 |
|
| 519 |
__extension__ extern __inline uint8x4_t |
| 520 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 521 |
__uadd8 (uint8x4_t __a, uint8x4_t __b) |
| 522 |
{ |
| 523 |
return __builtin_arm_uadd8 (__a, __b); |
| 524 |
} |
| 525 |
|
| 526 |
__extension__ extern __inline uint8x4_t |
| 527 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 528 |
__usub8 (uint8x4_t __a, uint8x4_t __b) |
| 529 |
{ |
| 530 |
return __builtin_arm_usub8 (__a, __b); |
| 531 |
} |
| 532 |
|
| 533 |
__extension__ extern __inline int16x2_t |
| 534 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 535 |
__sadd16 (int16x2_t __a, int16x2_t __b) |
| 536 |
{ |
| 537 |
return __builtin_arm_sadd16 (__a, __b); |
| 538 |
} |
| 539 |
|
| 540 |
__extension__ extern __inline int16x2_t |
| 541 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 542 |
__sasx (int16x2_t __a, int16x2_t __b) |
| 543 |
{ |
| 544 |
return __builtin_arm_sasx (__a, __b); |
| 545 |
} |
| 546 |
|
| 547 |
__extension__ extern __inline int16x2_t |
| 548 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 549 |
__ssax (int16x2_t __a, int16x2_t __b) |
| 550 |
{ |
| 551 |
return __builtin_arm_ssax (__a, __b); |
| 552 |
} |
| 553 |
|
| 554 |
__extension__ extern __inline int16x2_t |
| 555 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 556 |
__ssub16 (int16x2_t __a, int16x2_t __b) |
| 557 |
{ |
| 558 |
return __builtin_arm_ssub16 (__a, __b); |
| 559 |
} |
| 560 |
|
| 561 |
__extension__ extern __inline uint16x2_t |
| 562 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 563 |
__uadd16 (uint16x2_t __a, uint16x2_t __b) |
| 564 |
{ |
| 565 |
return __builtin_arm_uadd16 (__a, __b); |
| 566 |
} |
| 567 |
|
| 568 |
__extension__ extern __inline uint16x2_t |
| 569 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 570 |
__uasx (uint16x2_t __a, uint16x2_t __b) |
| 571 |
{ |
| 572 |
return __builtin_arm_uasx (__a, __b); |
| 573 |
} |
| 574 |
|
| 575 |
__extension__ extern __inline uint16x2_t |
| 576 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 577 |
__usax (uint16x2_t __a, uint16x2_t __b) |
| 578 |
{ |
| 579 |
return __builtin_arm_usax (__a, __b); |
| 580 |
} |
| 581 |
|
| 582 |
__extension__ extern __inline uint16x2_t |
| 583 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 584 |
__usub16 (uint16x2_t __a, uint16x2_t __b) |
| 585 |
{ |
| 586 |
return __builtin_arm_usub16 (__a, __b); |
| 587 |
} |
| 588 |
|
| 589 |
__extension__ extern __inline int32_t |
| 590 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 591 |
__smlad (int16x2_t __a, int16x2_t __b, int32_t __c) |
| 592 |
{ |
| 593 |
return __builtin_arm_smlad (__a, __b, __c); |
| 594 |
} |
| 595 |
|
| 596 |
__extension__ extern __inline int32_t |
| 597 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 598 |
__smladx (int16x2_t __a, int16x2_t __b, int32_t __c) |
| 599 |
{ |
| 600 |
return __builtin_arm_smladx (__a, __b, __c); |
| 601 |
} |
| 602 |
|
| 603 |
__extension__ extern __inline int32_t |
| 604 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 605 |
__smlsd (int16x2_t __a, int16x2_t __b, int32_t __c) |
| 606 |
{ |
| 607 |
return __builtin_arm_smlsd (__a, __b, __c); |
| 608 |
} |
| 609 |
|
| 610 |
__extension__ extern __inline int32_t |
| 611 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 612 |
__smlsdx (int16x2_t __a, int16x2_t __b, int32_t __c) |
| 613 |
{ |
| 614 |
return __builtin_arm_smlsdx (__a, __b, __c); |
| 615 |
} |
| 616 |
|
| 617 |
__extension__ extern __inline int32_t |
| 618 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 619 |
__smuad (int16x2_t __a, int16x2_t __b) |
| 620 |
{ |
| 621 |
return __builtin_arm_smuad (__a, __b); |
| 622 |
} |
| 623 |
|
| 624 |
__extension__ extern __inline int32_t |
| 625 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 626 |
__smuadx (int16x2_t __a, int16x2_t __b) |
| 627 |
{ |
| 628 |
return __builtin_arm_smuadx (__a, __b); |
| 629 |
} |
| 630 |
|
| 631 |
#define __ssat16(__a, __sat) \ |
| 632 |
__extension__ \ |
| 633 |
({ \ |
| 634 |
int16x2_t __arg = (__a); \ |
| 635 |
__builtin_sat_imm_check (__sat, 1, 16); \ |
| 636 |
int16x2_t __res = __builtin_arm_ssat16 (__arg, __sat); \ |
| 637 |
__res; \ |
| 638 |
}) |
| 639 |
|
| 640 |
#define __usat16(__a, __sat) \ |
| 641 |
__extension__ \ |
| 642 |
({ \ |
| 643 |
int16x2_t __arg = (__a); \ |
| 644 |
__builtin_sat_imm_check (__sat, 0, 15); \ |
| 645 |
int16x2_t __res = __builtin_arm_usat16 (__arg, __sat); \ |
| 646 |
__res; \ |
| 647 |
}) |
| 648 |
|
| 649 |
#endif |
| 650 |
|
| 651 |
#ifdef __ARM_FEATURE_SAT |
| 652 |
|
| 653 |
#define __ssat(__a, __sat) \ |
| 654 |
__extension__ \ |
| 655 |
({ \ |
| 656 |
int32_t __arg = (__a); \ |
| 657 |
__builtin_sat_imm_check (__sat, 1, 32); \ |
| 658 |
int32_t __res = __builtin_arm_ssat (__arg, __sat); \ |
| 659 |
__res; \ |
| 660 |
}) |
| 661 |
|
| 662 |
#define __usat(__a, __sat) \ |
| 663 |
__extension__ \ |
| 664 |
({ \ |
| 665 |
int32_t __arg = (__a); \ |
| 666 |
__builtin_sat_imm_check (__sat, 0, 31); \ |
| 667 |
uint32_t __res = __builtin_arm_usat (__arg, __sat); \ |
| 668 |
__res; \ |
| 669 |
}) |
| 670 |
|
| 671 |
#endif |
| 672 |
|
| 673 |
#ifdef __ARM_FEATURE_QBIT |
| 674 |
__extension__ extern __inline void |
| 675 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 676 |
__ignore_saturation (void) |
| 677 |
{ |
| 678 |
/* ACLE designates this intrinsic as a hint. |
| 679 |
Implement as a nop for now. */ |
| 680 |
} |
| 681 |
|
| 682 |
/* These are defined as macros because the implementation of the builtins |
| 683 |
requires easy access to the current function so wrapping it in an |
| 684 |
always_inline function complicates things. */ |
| 685 |
|
| 686 |
#define __saturation_occurred __builtin_arm_saturation_occurred |
| 687 |
|
| 688 |
#define __set_saturation_occurred(__a) \ |
| 689 |
__extension__ \ |
| 690 |
({ \ |
| 691 |
int __arg = (__a); \ |
| 692 |
__builtin_arm_set_saturation (__arg); \ |
| 693 |
}) |
| 694 |
#endif |
| 695 |
|
| 696 |
#ifdef __ARM_FEATURE_DSP |
| 697 |
__extension__ extern __inline int32_t |
| 698 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 699 |
__qadd (int32_t __a, int32_t __b) |
| 700 |
{ |
| 701 |
return __builtin_arm_qadd (__a, __b); |
| 702 |
} |
| 703 |
|
| 704 |
__extension__ extern __inline int32_t |
| 705 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 706 |
__qsub (int32_t __a, int32_t __b) |
| 707 |
{ |
| 708 |
return __builtin_arm_qsub (__a, __b); |
| 709 |
} |
| 710 |
|
| 711 |
__extension__ extern __inline int32_t |
| 712 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 713 |
__qdbl (int32_t __x) |
| 714 |
{ |
| 715 |
return __qadd (__x, __x); |
| 716 |
} |
| 717 |
|
| 718 |
__extension__ extern __inline int32_t |
| 719 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 720 |
__smlabb (int32_t __a, int32_t __b, int32_t __c) |
| 721 |
{ |
| 722 |
return __builtin_arm_smlabb (__a, __b, __c); |
| 723 |
} |
| 724 |
|
| 725 |
__extension__ extern __inline int32_t |
| 726 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 727 |
__smlatb (int32_t __a, int32_t __b, int32_t __c) |
| 728 |
{ |
| 729 |
return __builtin_arm_smlatb (__a, __b, __c); |
| 730 |
} |
| 731 |
|
| 732 |
/* smlatb is equivalent to smlabt with the two multiplication operands |
| 733 |
swapped around. */ |
| 734 |
__extension__ extern __inline int32_t |
| 735 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 736 |
__smlabt (int32_t __a, int32_t __b, int32_t __c) |
| 737 |
{ |
| 738 |
return __smlatb (__b, __a, __c); |
| 739 |
} |
| 740 |
|
| 741 |
__extension__ extern __inline int32_t |
| 742 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 743 |
__smlatt (int32_t __a, int32_t __b, int32_t __c) |
| 744 |
{ |
| 745 |
return __builtin_arm_smlatt (__a, __b, __c); |
| 746 |
} |
| 747 |
|
| 748 |
__extension__ extern __inline int32_t |
| 749 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 750 |
__smlawb (int32_t __a, int32_t __b, int32_t __c) |
| 751 |
{ |
| 752 |
return __builtin_arm_smlawb (__a, __b, __c); |
| 753 |
} |
| 754 |
|
| 755 |
__extension__ extern __inline int32_t |
| 756 |
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) |
| 757 |
__smlawt (int32_t __a, int32_t __b, int32_t __c) |
| 758 |
{ |
| 759 |
return __builtin_arm_smlawt (__a, __b, __c); |
| 760 |
} |
| 761 |
#endif |
| 762 |
|
| 763 |
#pragma GCC push_options |
| 764 |
#ifdef __ARM_FEATURE_CRC32 |
| 765 |
#ifdef __ARM_FP |
| 766 |
#pragma GCC target ("arch=armv8-a+crc+simd") |
| 767 |
#else |
| 768 |
#pragma GCC target ("arch=armv8-a+crc") |
| 769 |
#endif |
| 770 |
|
| 771 |
__extension__ static __inline uint32_t __attribute__ ((__always_inline__)) |
| 772 |
__crc32b (uint32_t __a, uint8_t __b) |
| 773 |
{ |
| 774 |
return __builtin_arm_crc32b (__a, __b); |
| 775 |
} |
| 776 |
|
| 777 |
__extension__ static __inline uint32_t __attribute__ ((__always_inline__)) |
| 778 |
__crc32h (uint32_t __a, uint16_t __b) |
| 779 |
{ |
| 780 |
return __builtin_arm_crc32h (__a, __b); |
| 781 |
} |
| 782 |
|
| 783 |
__extension__ static __inline uint32_t __attribute__ ((__always_inline__)) |
| 784 |
__crc32w (uint32_t __a, uint32_t __b) |
| 785 |
{ |
| 786 |
return __builtin_arm_crc32w (__a, __b); |
| 787 |
} |
| 788 |
|
| 789 |
#ifdef __ARM_32BIT_STATE |
| 790 |
__extension__ static __inline uint32_t __attribute__ ((__always_inline__)) |
| 791 |
__crc32d (uint32_t __a, uint64_t __b) |
| 792 |
{ |
| 793 |
uint32_t __d; |
| 794 |
|
| 795 |
__d = __crc32w (__crc32w (__a, __b & 0xffffffffULL), __b >> 32); |
| 796 |
return __d; |
| 797 |
} |
| 798 |
#endif |
| 799 |
|
| 800 |
__extension__ static __inline uint32_t __attribute__ ((__always_inline__)) |
| 801 |
__crc32cb (uint32_t __a, uint8_t __b) |
| 802 |
{ |
| 803 |
return __builtin_arm_crc32cb (__a, __b); |
| 804 |
} |
| 805 |
|
| 806 |
__extension__ static __inline uint32_t __attribute__ ((__always_inline__)) |
| 807 |
__crc32ch (uint32_t __a, uint16_t __b) |
| 808 |
{ |
| 809 |
return __builtin_arm_crc32ch (__a, __b); |
| 810 |
} |
| 811 |
|
| 812 |
__extension__ static __inline uint32_t __attribute__ ((__always_inline__)) |
| 813 |
__crc32cw (uint32_t __a, uint32_t __b) |
| 814 |
{ |
| 815 |
return __builtin_arm_crc32cw (__a, __b); |
| 816 |
} |
| 817 |
|
| 818 |
#ifdef __ARM_32BIT_STATE |
| 819 |
__extension__ static __inline uint32_t __attribute__ ((__always_inline__)) |
| 820 |
__crc32cd (uint32_t __a, uint64_t __b) |
| 821 |
{ |
| 822 |
uint32_t __d; |
| 823 |
|
| 824 |
__d = __crc32cw (__crc32cw (__a, __b & 0xffffffffULL), __b >> 32); |
| 825 |
return __d; |
| 826 |
} |
| 827 |
#endif |
| 828 |
|
| 829 |
#endif /* __ARM_FEATURE_CRC32 */ |
| 830 |
#pragma GCC pop_options |
| 831 |
|
| 832 |
#ifdef __cplusplus |
| 833 |
} |
| 834 |
#endif |
| 835 |
|
| 836 |
#endif |