14 #error "ACLE intrinsics support not enabled."
19 #if defined(__cplusplus)
25 #if !__has_builtin(__dmb)
26 #define __dmb(i) __builtin_arm_dmb(i)
28 #if !__has_builtin(__dsb)
29 #define __dsb(i) __builtin_arm_dsb(i)
31 #if !__has_builtin(__isb)
32 #define __isb(i) __builtin_arm_isb(i)
37 #if !__has_builtin(__wfi)
38 static __inline__
void __attribute__((__always_inline__, __nodebug__)) __wfi(
void) {
43 #if !__has_builtin(__wfe)
44 static __inline__
void __attribute__((__always_inline__, __nodebug__)) __wfe(
void) {
49 #if !__has_builtin(__sev)
50 static __inline__
void __attribute__((__always_inline__, __nodebug__)) __sev(
void) {
55 #if !__has_builtin(__sevl)
56 static __inline__
void __attribute__((__always_inline__, __nodebug__)) __sevl(
void) {
61 #if !__has_builtin(__yield)
62 static __inline__
void __attribute__((__always_inline__, __nodebug__)) __yield(
void) {
63 __builtin_arm_yield();
68 #define __dbg(t) __builtin_arm_dbg(t)
76 v = __builtin_arm_ldrex(
__p);
77 while (__builtin_arm_strex(
__x,
__p));
83 #define __pld(addr) __pldx(0, 0, 0, addr)
86 #define __pldx(access_kind, cache_level, retention_policy, addr) \
87 __builtin_arm_prefetch(addr, access_kind, 1)
89 #define __pldx(access_kind, cache_level, retention_policy, addr) \
90 __builtin_arm_prefetch(addr, access_kind, cache_level, retention_policy, 1)
94 #define __pli(addr) __plix(0, 0, addr)
97 #define __plix(cache_level, retention_policy, addr) \
98 __builtin_arm_prefetch(addr, 0, 0)
100 #define __plix(cache_level, retention_policy, addr) \
101 __builtin_arm_prefetch(addr, 0, cache_level, retention_policy, 0)
105 #if !defined(_MSC_VER) || !defined(__aarch64__)
106 static __inline__
void __attribute__((__always_inline__, __nodebug__)) __nop(
void) {
130 static __inline__
unsigned long __attribute__((__always_inline__, __nodebug__))
132 #if __SIZEOF_LONG__ == 4
143 return __builtin_clz(__t);
146 static __inline__
unsigned long __attribute__((__always_inline__, __nodebug__))
147 __clzl(
unsigned long __t) {
148 return __builtin_clzl(__t);
153 return __builtin_clzll(__t);
159 return __builtin_arm_cls(__t);
163 __clsl(
unsigned long __t) {
164 #if __SIZEOF_LONG__ == 4
165 return __builtin_arm_cls(__t);
167 return __builtin_arm_cls64(__t);
173 return __builtin_arm_cls64(__t);
179 return __builtin_bswap32(__t);
182 static __inline__
unsigned long __attribute__((__always_inline__, __nodebug__))
183 __revl(
unsigned long __t) {
184 #if __SIZEOF_LONG__ == 4
185 return __builtin_bswap32(__t);
187 return __builtin_bswap64(__t);
193 return __builtin_bswap64(__t);
199 return __ror(__rev(__t), 16);
204 return (((
uint64_t)__rev16(__t >> 32)) << 32) | __rev16(__t);
207 static __inline__
unsigned long __attribute__((__always_inline__, __nodebug__))
208 __rev16l(
unsigned long __t) {
209 #if __SIZEOF_LONG__ == 4
212 return __rev16ll(__t);
219 return __builtin_bswap16(__t);
225 return __builtin_arm_rbit(__t);
230 #if __ARM_32BIT_STATE
231 return (((
uint64_t)__builtin_arm_rbit(__t)) << 32) |
232 __builtin_arm_rbit(__t >> 32);
234 return __builtin_arm_rbit64(__t);
238 static __inline__
unsigned long __attribute__((__always_inline__, __nodebug__))
239 __rbitl(
unsigned long __t) {
240 #if __SIZEOF_LONG__ == 4
243 return __rbitll(__t);
250 #if __ARM_FEATURE_DSP
253 return __builtin_arm_smulbb(
__a,
__b);
257 return __builtin_arm_smulbt(
__a,
__b);
261 return __builtin_arm_smultb(
__a,
__b);
265 return __builtin_arm_smultt(
__a,
__b);
269 return __builtin_arm_smulwb(
__a,
__b);
273 return __builtin_arm_smulwt(
__a,
__b);
284 #if __ARM_FEATURE_SAT
285 #define __ssat(x, y) __builtin_arm_ssat(x, y)
286 #define __usat(x, y) __builtin_arm_usat(x, y)
290 #if __ARM_FEATURE_DSP
293 return __builtin_arm_qadd(__t,
__v);
298 return __builtin_arm_qsub(__t,
__v);
303 return __builtin_arm_qadd(__t, __t);
308 #if __ARM_FEATURE_DSP
311 return __builtin_arm_smlabb(
__a,
__b,
__c);
315 return __builtin_arm_smlabt(
__a,
__b,
__c);
319 return __builtin_arm_smlatb(
__a,
__b,
__c);
323 return __builtin_arm_smlatt(
__a,
__b,
__c);
327 return __builtin_arm_smlawb(
__a,
__b,
__c);
331 return __builtin_arm_smlawt(
__a,
__b,
__c);
337 #if __ARM_FEATURE_SIMD32
338 #define __ssat16(x, y) __builtin_arm_ssat16(x, y)
339 #define __usat16(x, y) __builtin_arm_usat16(x, y)
343 #if __ARM_FEATURE_SIMD32
349 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
350 __sxtab16(int16x2_t
__a, int8x4_t
__b) {
351 return __builtin_arm_sxtab16(
__a,
__b);
353 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
354 __sxtb16(int8x4_t
__a) {
355 return __builtin_arm_sxtb16(
__a);
357 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
358 __uxtab16(int16x2_t
__a, int8x4_t
__b) {
359 return __builtin_arm_uxtab16(
__a,
__b);
361 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
362 __uxtb16(int8x4_t
__a) {
363 return __builtin_arm_uxtb16(
__a);
368 #if __ARM_FEATURE_SIMD32
369 static __inline__ uint8x4_t
__attribute__((__always_inline__, __nodebug__))
370 __sel(uint8x4_t
__a, uint8x4_t
__b) {
371 return __builtin_arm_sel(
__a,
__b);
376 #if __ARM_FEATURE_SIMD32
377 static __inline__ int8x4_t
__attribute__((__always_inline__, __nodebug__))
378 __qadd8(int8x4_t
__a, int8x4_t
__b) {
379 return __builtin_arm_qadd8(
__a,
__b);
381 static __inline__ int8x4_t
__attribute__((__always_inline__, __nodebug__))
382 __qsub8(int8x4_t
__a, int8x4_t
__b) {
383 return __builtin_arm_qsub8(
__a,
__b);
385 static __inline__ int8x4_t
__attribute__((__always_inline__, __nodebug__))
386 __sadd8(int8x4_t
__a, int8x4_t
__b) {
387 return __builtin_arm_sadd8(
__a,
__b);
389 static __inline__ int8x4_t
__attribute__((__always_inline__, __nodebug__))
390 __shadd8(int8x4_t
__a, int8x4_t
__b) {
391 return __builtin_arm_shadd8(
__a,
__b);
393 static __inline__ int8x4_t
__attribute__((__always_inline__, __nodebug__))
394 __shsub8(int8x4_t
__a, int8x4_t
__b) {
395 return __builtin_arm_shsub8(
__a,
__b);
397 static __inline__ int8x4_t
__attribute__((__always_inline__, __nodebug__))
398 __ssub8(int8x4_t
__a, int8x4_t
__b) {
399 return __builtin_arm_ssub8(
__a,
__b);
401 static __inline__ uint8x4_t
__attribute__((__always_inline__, __nodebug__))
402 __uadd8(uint8x4_t
__a, uint8x4_t
__b) {
403 return __builtin_arm_uadd8(
__a,
__b);
405 static __inline__ uint8x4_t
__attribute__((__always_inline__, __nodebug__))
406 __uhadd8(uint8x4_t
__a, uint8x4_t
__b) {
407 return __builtin_arm_uhadd8(
__a,
__b);
409 static __inline__ uint8x4_t
__attribute__((__always_inline__, __nodebug__))
410 __uhsub8(uint8x4_t
__a, uint8x4_t
__b) {
411 return __builtin_arm_uhsub8(
__a,
__b);
413 static __inline__ uint8x4_t
__attribute__((__always_inline__, __nodebug__))
414 __uqadd8(uint8x4_t
__a, uint8x4_t
__b) {
415 return __builtin_arm_uqadd8(
__a,
__b);
417 static __inline__ uint8x4_t
__attribute__((__always_inline__, __nodebug__))
418 __uqsub8(uint8x4_t
__a, uint8x4_t
__b) {
419 return __builtin_arm_uqsub8(
__a,
__b);
421 static __inline__ uint8x4_t
__attribute__((__always_inline__, __nodebug__))
422 __usub8(uint8x4_t
__a, uint8x4_t
__b) {
423 return __builtin_arm_usub8(
__a,
__b);
428 #if __ARM_FEATURE_SIMD32
430 __usad8(uint8x4_t
__a, uint8x4_t
__b) {
431 return __builtin_arm_usad8(
__a,
__b);
435 return __builtin_arm_usada8(
__a,
__b,
__c);
440 #if __ARM_FEATURE_SIMD32
441 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
442 __qadd16(int16x2_t
__a, int16x2_t
__b) {
443 return __builtin_arm_qadd16(
__a,
__b);
445 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
446 __qasx(int16x2_t
__a, int16x2_t
__b) {
447 return __builtin_arm_qasx(
__a,
__b);
449 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
450 __qsax(int16x2_t
__a, int16x2_t
__b) {
451 return __builtin_arm_qsax(
__a,
__b);
453 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
454 __qsub16(int16x2_t
__a, int16x2_t
__b) {
455 return __builtin_arm_qsub16(
__a,
__b);
457 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
458 __sadd16(int16x2_t
__a, int16x2_t
__b) {
459 return __builtin_arm_sadd16(
__a,
__b);
461 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
462 __sasx(int16x2_t
__a, int16x2_t
__b) {
463 return __builtin_arm_sasx(
__a,
__b);
465 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
466 __shadd16(int16x2_t
__a, int16x2_t
__b) {
467 return __builtin_arm_shadd16(
__a,
__b);
469 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
470 __shasx(int16x2_t
__a, int16x2_t
__b) {
471 return __builtin_arm_shasx(
__a,
__b);
473 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
474 __shsax(int16x2_t
__a, int16x2_t
__b) {
475 return __builtin_arm_shsax(
__a,
__b);
477 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
478 __shsub16(int16x2_t
__a, int16x2_t
__b) {
479 return __builtin_arm_shsub16(
__a,
__b);
481 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
482 __ssax(int16x2_t
__a, int16x2_t
__b) {
483 return __builtin_arm_ssax(
__a,
__b);
485 static __inline__ int16x2_t
__attribute__((__always_inline__, __nodebug__))
486 __ssub16(int16x2_t
__a, int16x2_t
__b) {
487 return __builtin_arm_ssub16(
__a,
__b);
489 static __inline__ uint16x2_t
__attribute__((__always_inline__, __nodebug__))
490 __uadd16(uint16x2_t
__a, uint16x2_t
__b) {
491 return __builtin_arm_uadd16(
__a,
__b);
493 static __inline__ uint16x2_t
__attribute__((__always_inline__, __nodebug__))
494 __uasx(uint16x2_t
__a, uint16x2_t
__b) {
495 return __builtin_arm_uasx(
__a,
__b);
497 static __inline__ uint16x2_t
__attribute__((__always_inline__, __nodebug__))
498 __uhadd16(uint16x2_t
__a, uint16x2_t
__b) {
499 return __builtin_arm_uhadd16(
__a,
__b);
501 static __inline__ uint16x2_t
__attribute__((__always_inline__, __nodebug__))
502 __uhasx(uint16x2_t
__a, uint16x2_t
__b) {
503 return __builtin_arm_uhasx(
__a,
__b);
505 static __inline__ uint16x2_t
__attribute__((__always_inline__, __nodebug__))
506 __uhsax(uint16x2_t
__a, uint16x2_t
__b) {
507 return __builtin_arm_uhsax(
__a,
__b);
509 static __inline__ uint16x2_t
__attribute__((__always_inline__, __nodebug__))
510 __uhsub16(uint16x2_t
__a, uint16x2_t
__b) {
511 return __builtin_arm_uhsub16(
__a,
__b);
513 static __inline__ uint16x2_t
__attribute__((__always_inline__, __nodebug__))
514 __uqadd16(uint16x2_t
__a, uint16x2_t
__b) {
515 return __builtin_arm_uqadd16(
__a,
__b);
517 static __inline__ uint16x2_t
__attribute__((__always_inline__, __nodebug__))
518 __uqasx(uint16x2_t
__a, uint16x2_t
__b) {
519 return __builtin_arm_uqasx(
__a,
__b);
521 static __inline__ uint16x2_t
__attribute__((__always_inline__, __nodebug__))
522 __uqsax(uint16x2_t
__a, uint16x2_t
__b) {
523 return __builtin_arm_uqsax(
__a,
__b);
525 static __inline__ uint16x2_t
__attribute__((__always_inline__, __nodebug__))
526 __uqsub16(uint16x2_t
__a, uint16x2_t
__b) {
527 return __builtin_arm_uqsub16(
__a,
__b);
529 static __inline__ uint16x2_t
__attribute__((__always_inline__, __nodebug__))
530 __usax(uint16x2_t
__a, uint16x2_t
__b) {
531 return __builtin_arm_usax(
__a,
__b);
533 static __inline__ uint16x2_t
__attribute__((__always_inline__, __nodebug__))
534 __usub16(uint16x2_t
__a, uint16x2_t
__b) {
535 return __builtin_arm_usub16(
__a,
__b);
540 #if __ARM_FEATURE_SIMD32
543 return __builtin_arm_smlad(
__a,
__b,
__c);
547 return __builtin_arm_smladx(
__a,
__b,
__c);
549 static __inline__ int64_t
__attribute__((__always_inline__, __nodebug__))
550 __smlald(int16x2_t
__a, int16x2_t
__b, int64_t
__c) {
551 return __builtin_arm_smlald(
__a,
__b,
__c);
553 static __inline__ int64_t
__attribute__((__always_inline__, __nodebug__))
554 __smlaldx(int16x2_t
__a, int16x2_t
__b, int64_t
__c) {
555 return __builtin_arm_smlaldx(
__a,
__b,
__c);
559 return __builtin_arm_smlsd(
__a,
__b,
__c);
563 return __builtin_arm_smlsdx(
__a,
__b,
__c);
565 static __inline__ int64_t
__attribute__((__always_inline__, __nodebug__))
566 __smlsld(int16x2_t
__a, int16x2_t
__b, int64_t
__c) {
567 return __builtin_arm_smlsld(
__a,
__b,
__c);
569 static __inline__ int64_t
__attribute__((__always_inline__, __nodebug__))
570 __smlsldx(int16x2_t
__a, int16x2_t
__b, int64_t
__c) {
571 return __builtin_arm_smlsldx(
__a,
__b,
__c);
574 __smuad(int16x2_t
__a, int16x2_t
__b) {
575 return __builtin_arm_smuad(
__a,
__b);
578 __smuadx(int16x2_t
__a, int16x2_t
__b) {
579 return __builtin_arm_smuadx(
__a,
__b);
582 __smusd(int16x2_t
__a, int16x2_t
__b) {
583 return __builtin_arm_smusd(
__a,
__b);
586 __smusdx(int16x2_t
__a, int16x2_t
__b) {
587 return __builtin_arm_smusdx(
__a,
__b);
592 #if __ARM_FEATURE_CRC32
595 return __builtin_arm_crc32b(
__a,
__b);
600 return __builtin_arm_crc32h(
__a,
__b);
605 return __builtin_arm_crc32w(
__a,
__b);
610 return __builtin_arm_crc32d(
__a,
__b);
615 return __builtin_arm_crc32cb(
__a,
__b);
620 return __builtin_arm_crc32ch(
__a,
__b);
625 return __builtin_arm_crc32cw(
__a,
__b);
630 return __builtin_arm_crc32cd(
__a,
__b);
635 #if __ARM_64BIT_STATE && defined(__ARM_FEATURE_JCVT)
638 return __builtin_arm_jcvt(
__a);
643 #define __arm_rsr(sysreg) __builtin_arm_rsr(sysreg)
644 #define __arm_rsr64(sysreg) __builtin_arm_rsr64(sysreg)
645 #define __arm_rsrp(sysreg) __builtin_arm_rsrp(sysreg)
646 #define __arm_rsrf(sysreg) __builtin_bit_cast(float, __arm_rsr(sysreg))
647 #define __arm_rsrf64(sysreg) __builtin_bit_cast(double, __arm_rsr64(sysreg))
648 #define __arm_wsr(sysreg, v) __builtin_arm_wsr(sysreg, v)
649 #define __arm_wsr64(sysreg, v) __builtin_arm_wsr64(sysreg, v)
650 #define __arm_wsrp(sysreg, v) __builtin_arm_wsrp(sysreg, v)
651 #define __arm_wsrf(sysreg, v) __arm_wsr(sysreg, __builtin_bit_cast(uint32_t, v))
652 #define __arm_wsrf64(sysreg, v) __arm_wsr64(sysreg, __builtin_bit_cast(uint64_t, v))
655 #if __ARM_FEATURE_MEMORY_TAGGING
656 #define __arm_mte_create_random_tag(__ptr, __mask) __builtin_arm_irg(__ptr, __mask)
657 #define __arm_mte_increment_tag(__ptr, __tag_offset) __builtin_arm_addg(__ptr, __tag_offset)
658 #define __arm_mte_exclude_tag(__ptr, __excluded) __builtin_arm_gmi(__ptr, __excluded)
659 #define __arm_mte_get_tag(__ptr) __builtin_arm_ldg(__ptr)
660 #define __arm_mte_set_tag(__ptr) __builtin_arm_stg(__ptr)
661 #define __arm_mte_ptrdiff(__ptra, __ptrb) __builtin_arm_subp(__ptra, __ptrb)
665 #if __ARM_FEATURE_TME
667 #define _TMFAILURE_REASON 0x00007fffu
668 #define _TMFAILURE_RTRY 0x00008000u
669 #define _TMFAILURE_CNCL 0x00010000u
670 #define _TMFAILURE_MEM 0x00020000u
671 #define _TMFAILURE_IMP 0x00040000u
672 #define _TMFAILURE_ERR 0x00080000u
673 #define _TMFAILURE_SIZE 0x00100000u
674 #define _TMFAILURE_NEST 0x00200000u
675 #define _TMFAILURE_DBG 0x00400000u
676 #define _TMFAILURE_INT 0x00800000u
677 #define _TMFAILURE_TRIVIAL 0x01000000u
679 #define __tstart() __builtin_arm_tstart()
680 #define __tcommit() __builtin_arm_tcommit()
681 #define __tcancel(__arg) __builtin_arm_tcancel(__arg)
682 #define __ttest() __builtin_arm_ttest()
686 #if defined(__cplusplus)
__DEVICE__ int __clzll(long long __a)
__DEVICE__ int __clz(int __a)
static __inline unsigned char unsigned int __x
static __inline__ vector float vector float vector float __c
static __inline__ vector float vector float __b
static __inline__ uint32_t volatile uint32_t * __p
static __inline__ void __attribute__((__always_inline__, __nodebug__)) __wfi(void)
static __inline__ uint32_t uint32_t __y
static __inline__ uint32_t
static __inline__ uint64_t
static __inline__ int32_t
static __inline__ uint8_t
static __inline__ int16_t
static __inline__ uint16_t
static __inline__ void int __a
struct __storeu_i16 *__P __v