10b57cec5SDimitry Andric /*===---- arm_acle.h - ARM Non-Neon intrinsics -----------------------------===
20b57cec5SDimitry Andric *
30b57cec5SDimitry Andric * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric * See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric *
77a6dacacSDimitry Andric * The Arm C Language Extensions specifications can be found in the following
87a6dacacSDimitry Andric * link: https://github.com/ARM-software/acle/releases
97a6dacacSDimitry Andric *
107a6dacacSDimitry Andric * The ACLE section numbers are subject to change. When consulting the
117a6dacacSDimitry Andric * specifications, it is recommended to search using section titles if
127a6dacacSDimitry Andric * the section numbers look outdated.
137a6dacacSDimitry Andric *
140b57cec5SDimitry Andric *===-----------------------------------------------------------------------===
150b57cec5SDimitry Andric */
160b57cec5SDimitry Andric
170b57cec5SDimitry Andric #ifndef __ARM_ACLE_H
180b57cec5SDimitry Andric #define __ARM_ACLE_H
190b57cec5SDimitry Andric
200b57cec5SDimitry Andric #ifndef __ARM_ACLE
210b57cec5SDimitry Andric #error "ACLE intrinsics support not enabled."
220b57cec5SDimitry Andric #endif
230b57cec5SDimitry Andric
240b57cec5SDimitry Andric #include <stdint.h>
250b57cec5SDimitry Andric
260b57cec5SDimitry Andric #if defined(__cplusplus)
270b57cec5SDimitry Andric extern "C" {
280b57cec5SDimitry Andric #endif
290b57cec5SDimitry Andric
307a6dacacSDimitry Andric /* 7 SYNCHRONIZATION, BARRIER AND HINT INTRINSICS */
317a6dacacSDimitry Andric /* 7.3 Memory barriers */
325ffd83dbSDimitry Andric #if !__has_builtin(__dmb)
330b57cec5SDimitry Andric #define __dmb(i) __builtin_arm_dmb(i)
345ffd83dbSDimitry Andric #endif
355ffd83dbSDimitry Andric #if !__has_builtin(__dsb)
360b57cec5SDimitry Andric #define __dsb(i) __builtin_arm_dsb(i)
375ffd83dbSDimitry Andric #endif
385ffd83dbSDimitry Andric #if !__has_builtin(__isb)
390b57cec5SDimitry Andric #define __isb(i) __builtin_arm_isb(i)
400b57cec5SDimitry Andric #endif
410b57cec5SDimitry Andric
427a6dacacSDimitry Andric /* 7.4 Hints */
430b57cec5SDimitry Andric
445ffd83dbSDimitry Andric #if !__has_builtin(__wfi)
__wfi(void)450b57cec5SDimitry Andric static __inline__ void __attribute__((__always_inline__, __nodebug__)) __wfi(void) {
460b57cec5SDimitry Andric __builtin_arm_wfi();
470b57cec5SDimitry Andric }
485ffd83dbSDimitry Andric #endif
490b57cec5SDimitry Andric
505ffd83dbSDimitry Andric #if !__has_builtin(__wfe)
__wfe(void)510b57cec5SDimitry Andric static __inline__ void __attribute__((__always_inline__, __nodebug__)) __wfe(void) {
520b57cec5SDimitry Andric __builtin_arm_wfe();
530b57cec5SDimitry Andric }
545ffd83dbSDimitry Andric #endif
550b57cec5SDimitry Andric
565ffd83dbSDimitry Andric #if !__has_builtin(__sev)
__sev(void)570b57cec5SDimitry Andric static __inline__ void __attribute__((__always_inline__, __nodebug__)) __sev(void) {
580b57cec5SDimitry Andric __builtin_arm_sev();
590b57cec5SDimitry Andric }
605ffd83dbSDimitry Andric #endif
610b57cec5SDimitry Andric
625ffd83dbSDimitry Andric #if !__has_builtin(__sevl)
__sevl(void)630b57cec5SDimitry Andric static __inline__ void __attribute__((__always_inline__, __nodebug__)) __sevl(void) {
640b57cec5SDimitry Andric __builtin_arm_sevl();
650b57cec5SDimitry Andric }
665ffd83dbSDimitry Andric #endif
670b57cec5SDimitry Andric
685ffd83dbSDimitry Andric #if !__has_builtin(__yield)
__yield(void)690b57cec5SDimitry Andric static __inline__ void __attribute__((__always_inline__, __nodebug__)) __yield(void) {
700b57cec5SDimitry Andric __builtin_arm_yield();
710b57cec5SDimitry Andric }
720b57cec5SDimitry Andric #endif
730b57cec5SDimitry Andric
74bdd1243dSDimitry Andric #if defined(__ARM_32BIT_STATE) && __ARM_32BIT_STATE
750b57cec5SDimitry Andric #define __dbg(t) __builtin_arm_dbg(t)
760b57cec5SDimitry Andric #endif
770b57cec5SDimitry Andric
78*0fca6ea1SDimitry Andric #if defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE
79*0fca6ea1SDimitry Andric #define _CHKFEAT_GCS 1
80*0fca6ea1SDimitry Andric static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
__chkfeat(uint64_t __features)81*0fca6ea1SDimitry Andric __chkfeat(uint64_t __features) {
82*0fca6ea1SDimitry Andric return __builtin_arm_chkfeat(__features) ^ __features;
83*0fca6ea1SDimitry Andric }
84*0fca6ea1SDimitry Andric #endif
85*0fca6ea1SDimitry Andric
867a6dacacSDimitry Andric /* 7.5 Swap */
870b57cec5SDimitry Andric static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__swp(uint32_t __x,volatile uint32_t * __p)880b57cec5SDimitry Andric __swp(uint32_t __x, volatile uint32_t *__p) {
890b57cec5SDimitry Andric uint32_t v;
900b57cec5SDimitry Andric do
910b57cec5SDimitry Andric v = __builtin_arm_ldrex(__p);
920b57cec5SDimitry Andric while (__builtin_arm_strex(__x, __p));
930b57cec5SDimitry Andric return v;
940b57cec5SDimitry Andric }
950b57cec5SDimitry Andric
967a6dacacSDimitry Andric /* 7.6 Memory prefetch intrinsics */
977a6dacacSDimitry Andric /* 7.6.1 Data prefetch */
980b57cec5SDimitry Andric #define __pld(addr) __pldx(0, 0, 0, addr)
990b57cec5SDimitry Andric
100bdd1243dSDimitry Andric #if defined(__ARM_32BIT_STATE) && __ARM_32BIT_STATE
1010b57cec5SDimitry Andric #define __pldx(access_kind, cache_level, retention_policy, addr) \
1020b57cec5SDimitry Andric __builtin_arm_prefetch(addr, access_kind, 1)
1030b57cec5SDimitry Andric #else
1040b57cec5SDimitry Andric #define __pldx(access_kind, cache_level, retention_policy, addr) \
1050b57cec5SDimitry Andric __builtin_arm_prefetch(addr, access_kind, cache_level, retention_policy, 1)
1060b57cec5SDimitry Andric #endif
1070b57cec5SDimitry Andric
1087a6dacacSDimitry Andric /* 7.6.2 Instruction prefetch */
1090b57cec5SDimitry Andric #define __pli(addr) __plix(0, 0, addr)
1100b57cec5SDimitry Andric
111bdd1243dSDimitry Andric #if defined(__ARM_32BIT_STATE) && __ARM_32BIT_STATE
1120b57cec5SDimitry Andric #define __plix(cache_level, retention_policy, addr) \
1130b57cec5SDimitry Andric __builtin_arm_prefetch(addr, 0, 0)
1140b57cec5SDimitry Andric #else
1150b57cec5SDimitry Andric #define __plix(cache_level, retention_policy, addr) \
1160b57cec5SDimitry Andric __builtin_arm_prefetch(addr, 0, cache_level, retention_policy, 0)
1170b57cec5SDimitry Andric #endif
1180b57cec5SDimitry Andric
1197a6dacacSDimitry Andric /* 7.7 NOP */
120*0fca6ea1SDimitry Andric #if !defined(_MSC_VER) || (!defined(__aarch64__) && !defined(__arm64ec__))
__nop(void)1210b57cec5SDimitry Andric static __inline__ void __attribute__((__always_inline__, __nodebug__)) __nop(void) {
1220b57cec5SDimitry Andric __builtin_arm_nop();
1230b57cec5SDimitry Andric }
124480093f4SDimitry Andric #endif
1250b57cec5SDimitry Andric
1267a6dacacSDimitry Andric /* 8 DATA-PROCESSING INTRINSICS */
1277a6dacacSDimitry Andric /* 8.2 Miscellaneous data-processing intrinsics */
1280b57cec5SDimitry Andric /* ROR */
1290b57cec5SDimitry Andric static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__ror(uint32_t __x,uint32_t __y)1300b57cec5SDimitry Andric __ror(uint32_t __x, uint32_t __y) {
1310b57cec5SDimitry Andric __y %= 32;
1320b57cec5SDimitry Andric if (__y == 0)
1330b57cec5SDimitry Andric return __x;
1340b57cec5SDimitry Andric return (__x >> __y) | (__x << (32 - __y));
1350b57cec5SDimitry Andric }
1360b57cec5SDimitry Andric
1370b57cec5SDimitry Andric static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
__rorll(uint64_t __x,uint32_t __y)1380b57cec5SDimitry Andric __rorll(uint64_t __x, uint32_t __y) {
1390b57cec5SDimitry Andric __y %= 64;
1400b57cec5SDimitry Andric if (__y == 0)
1410b57cec5SDimitry Andric return __x;
1420b57cec5SDimitry Andric return (__x >> __y) | (__x << (64 - __y));
1430b57cec5SDimitry Andric }
1440b57cec5SDimitry Andric
1450b57cec5SDimitry Andric static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
__rorl(unsigned long __x,uint32_t __y)1460b57cec5SDimitry Andric __rorl(unsigned long __x, uint32_t __y) {
1470b57cec5SDimitry Andric #if __SIZEOF_LONG__ == 4
1480b57cec5SDimitry Andric return __ror(__x, __y);
1490b57cec5SDimitry Andric #else
1500b57cec5SDimitry Andric return __rorll(__x, __y);
1510b57cec5SDimitry Andric #endif
1520b57cec5SDimitry Andric }
1530b57cec5SDimitry Andric
1540b57cec5SDimitry Andric
1550b57cec5SDimitry Andric /* CLZ */
15606c3fb27SDimitry Andric static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
__clz(uint32_t __t)1570b57cec5SDimitry Andric __clz(uint32_t __t) {
15806c3fb27SDimitry Andric return __builtin_arm_clz(__t);
1590b57cec5SDimitry Andric }
1600b57cec5SDimitry Andric
16106c3fb27SDimitry Andric static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
__clzl(unsigned long __t)1620b57cec5SDimitry Andric __clzl(unsigned long __t) {
16306c3fb27SDimitry Andric #if __SIZEOF_LONG__ == 4
16406c3fb27SDimitry Andric return __builtin_arm_clz(__t);
16506c3fb27SDimitry Andric #else
16606c3fb27SDimitry Andric return __builtin_arm_clz64(__t);
16706c3fb27SDimitry Andric #endif
1680b57cec5SDimitry Andric }
1690b57cec5SDimitry Andric
17006c3fb27SDimitry Andric static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
__clzll(uint64_t __t)1710b57cec5SDimitry Andric __clzll(uint64_t __t) {
17206c3fb27SDimitry Andric return __builtin_arm_clz64(__t);
1730b57cec5SDimitry Andric }
1740b57cec5SDimitry Andric
175480093f4SDimitry Andric /* CLS */
17606c3fb27SDimitry Andric static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
__cls(uint32_t __t)177480093f4SDimitry Andric __cls(uint32_t __t) {
178480093f4SDimitry Andric return __builtin_arm_cls(__t);
179480093f4SDimitry Andric }
180480093f4SDimitry Andric
18106c3fb27SDimitry Andric static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
__clsl(unsigned long __t)182480093f4SDimitry Andric __clsl(unsigned long __t) {
183480093f4SDimitry Andric #if __SIZEOF_LONG__ == 4
184480093f4SDimitry Andric return __builtin_arm_cls(__t);
185480093f4SDimitry Andric #else
186480093f4SDimitry Andric return __builtin_arm_cls64(__t);
187480093f4SDimitry Andric #endif
188480093f4SDimitry Andric }
189480093f4SDimitry Andric
19006c3fb27SDimitry Andric static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
__clsll(uint64_t __t)191480093f4SDimitry Andric __clsll(uint64_t __t) {
192480093f4SDimitry Andric return __builtin_arm_cls64(__t);
193480093f4SDimitry Andric }
194480093f4SDimitry Andric
1950b57cec5SDimitry Andric /* REV */
1960b57cec5SDimitry Andric static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__rev(uint32_t __t)1970b57cec5SDimitry Andric __rev(uint32_t __t) {
1980b57cec5SDimitry Andric return __builtin_bswap32(__t);
1990b57cec5SDimitry Andric }
2000b57cec5SDimitry Andric
2010b57cec5SDimitry Andric static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
__revl(unsigned long __t)2020b57cec5SDimitry Andric __revl(unsigned long __t) {
2030b57cec5SDimitry Andric #if __SIZEOF_LONG__ == 4
2040b57cec5SDimitry Andric return __builtin_bswap32(__t);
2050b57cec5SDimitry Andric #else
2060b57cec5SDimitry Andric return __builtin_bswap64(__t);
2070b57cec5SDimitry Andric #endif
2080b57cec5SDimitry Andric }
2090b57cec5SDimitry Andric
2100b57cec5SDimitry Andric static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
__revll(uint64_t __t)2110b57cec5SDimitry Andric __revll(uint64_t __t) {
2120b57cec5SDimitry Andric return __builtin_bswap64(__t);
2130b57cec5SDimitry Andric }
2140b57cec5SDimitry Andric
2150b57cec5SDimitry Andric /* REV16 */
2160b57cec5SDimitry Andric static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__rev16(uint32_t __t)2170b57cec5SDimitry Andric __rev16(uint32_t __t) {
2180b57cec5SDimitry Andric return __ror(__rev(__t), 16);
2190b57cec5SDimitry Andric }
2200b57cec5SDimitry Andric
2210b57cec5SDimitry Andric static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
__rev16ll(uint64_t __t)2220b57cec5SDimitry Andric __rev16ll(uint64_t __t) {
223bdd1243dSDimitry Andric return (((uint64_t)__rev16(__t >> 32)) << 32) | (uint64_t)__rev16((uint32_t)__t);
2240b57cec5SDimitry Andric }
2250b57cec5SDimitry Andric
2260b57cec5SDimitry Andric static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
__rev16l(unsigned long __t)2270b57cec5SDimitry Andric __rev16l(unsigned long __t) {
2280b57cec5SDimitry Andric #if __SIZEOF_LONG__ == 4
2290b57cec5SDimitry Andric return __rev16(__t);
2300b57cec5SDimitry Andric #else
2310b57cec5SDimitry Andric return __rev16ll(__t);
2320b57cec5SDimitry Andric #endif
2330b57cec5SDimitry Andric }
2340b57cec5SDimitry Andric
2350b57cec5SDimitry Andric /* REVSH */
2360b57cec5SDimitry Andric static __inline__ int16_t __attribute__((__always_inline__, __nodebug__))
__revsh(int16_t __t)2370b57cec5SDimitry Andric __revsh(int16_t __t) {
238bdd1243dSDimitry Andric return (int16_t)__builtin_bswap16((uint16_t)__t);
2390b57cec5SDimitry Andric }
2400b57cec5SDimitry Andric
2410b57cec5SDimitry Andric /* RBIT */
2420b57cec5SDimitry Andric static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__rbit(uint32_t __t)2430b57cec5SDimitry Andric __rbit(uint32_t __t) {
2440b57cec5SDimitry Andric return __builtin_arm_rbit(__t);
2450b57cec5SDimitry Andric }
2460b57cec5SDimitry Andric
2470b57cec5SDimitry Andric static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
__rbitll(uint64_t __t)2480b57cec5SDimitry Andric __rbitll(uint64_t __t) {
249bdd1243dSDimitry Andric #if defined(__ARM_32BIT_STATE) && __ARM_32BIT_STATE
2500b57cec5SDimitry Andric return (((uint64_t)__builtin_arm_rbit(__t)) << 32) |
2510b57cec5SDimitry Andric __builtin_arm_rbit(__t >> 32);
2520b57cec5SDimitry Andric #else
2530b57cec5SDimitry Andric return __builtin_arm_rbit64(__t);
2540b57cec5SDimitry Andric #endif
2550b57cec5SDimitry Andric }
2560b57cec5SDimitry Andric
2570b57cec5SDimitry Andric static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
__rbitl(unsigned long __t)2580b57cec5SDimitry Andric __rbitl(unsigned long __t) {
2590b57cec5SDimitry Andric #if __SIZEOF_LONG__ == 4
2600b57cec5SDimitry Andric return __rbit(__t);
2610b57cec5SDimitry Andric #else
2620b57cec5SDimitry Andric return __rbitll(__t);
2630b57cec5SDimitry Andric #endif
2640b57cec5SDimitry Andric }
2650b57cec5SDimitry Andric
2667a6dacacSDimitry Andric /* 8.3 16-bit multiplications */
267bdd1243dSDimitry Andric #if defined(__ARM_FEATURE_DSP) && __ARM_FEATURE_DSP
2680b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__,__nodebug__))
__smulbb(int32_t __a,int32_t __b)2690b57cec5SDimitry Andric __smulbb(int32_t __a, int32_t __b) {
2700b57cec5SDimitry Andric return __builtin_arm_smulbb(__a, __b);
2710b57cec5SDimitry Andric }
2720b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__,__nodebug__))
__smulbt(int32_t __a,int32_t __b)2730b57cec5SDimitry Andric __smulbt(int32_t __a, int32_t __b) {
2740b57cec5SDimitry Andric return __builtin_arm_smulbt(__a, __b);
2750b57cec5SDimitry Andric }
2760b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__,__nodebug__))
__smultb(int32_t __a,int32_t __b)2770b57cec5SDimitry Andric __smultb(int32_t __a, int32_t __b) {
2780b57cec5SDimitry Andric return __builtin_arm_smultb(__a, __b);
2790b57cec5SDimitry Andric }
2800b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__,__nodebug__))
__smultt(int32_t __a,int32_t __b)2810b57cec5SDimitry Andric __smultt(int32_t __a, int32_t __b) {
2820b57cec5SDimitry Andric return __builtin_arm_smultt(__a, __b);
2830b57cec5SDimitry Andric }
2840b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__,__nodebug__))
__smulwb(int32_t __a,int32_t __b)2850b57cec5SDimitry Andric __smulwb(int32_t __a, int32_t __b) {
2860b57cec5SDimitry Andric return __builtin_arm_smulwb(__a, __b);
2870b57cec5SDimitry Andric }
2880b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__,__nodebug__))
__smulwt(int32_t __a,int32_t __b)2890b57cec5SDimitry Andric __smulwt(int32_t __a, int32_t __b) {
2900b57cec5SDimitry Andric return __builtin_arm_smulwt(__a, __b);
2910b57cec5SDimitry Andric }
2920b57cec5SDimitry Andric #endif
2930b57cec5SDimitry Andric
2940b57cec5SDimitry Andric /*
2957a6dacacSDimitry Andric * 8.4 Saturating intrinsics
2960b57cec5SDimitry Andric *
297bdd1243dSDimitry Andric * FIXME: Change guard to their corresponding __ARM_FEATURE flag when Q flag
2980b57cec5SDimitry Andric * intrinsics are implemented and the flag is enabled.
2990b57cec5SDimitry Andric */
3007a6dacacSDimitry Andric /* 8.4.1 Width-specified saturation intrinsics */
301bdd1243dSDimitry Andric #if defined(__ARM_FEATURE_SAT) && __ARM_FEATURE_SAT
3020b57cec5SDimitry Andric #define __ssat(x, y) __builtin_arm_ssat(x, y)
3030b57cec5SDimitry Andric #define __usat(x, y) __builtin_arm_usat(x, y)
3040b57cec5SDimitry Andric #endif
3050b57cec5SDimitry Andric
3067a6dacacSDimitry Andric /* 8.4.2 Saturating addition and subtraction intrinsics */
307bdd1243dSDimitry Andric #if defined(__ARM_FEATURE_DSP) && __ARM_FEATURE_DSP
3080b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__qadd(int32_t __t,int32_t __v)3090b57cec5SDimitry Andric __qadd(int32_t __t, int32_t __v) {
3100b57cec5SDimitry Andric return __builtin_arm_qadd(__t, __v);
3110b57cec5SDimitry Andric }
3120b57cec5SDimitry Andric
3130b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__qsub(int32_t __t,int32_t __v)3140b57cec5SDimitry Andric __qsub(int32_t __t, int32_t __v) {
3150b57cec5SDimitry Andric return __builtin_arm_qsub(__t, __v);
3160b57cec5SDimitry Andric }
3170b57cec5SDimitry Andric
3180b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__qdbl(int32_t __t)3190b57cec5SDimitry Andric __qdbl(int32_t __t) {
3200b57cec5SDimitry Andric return __builtin_arm_qadd(__t, __t);
3210b57cec5SDimitry Andric }
3220b57cec5SDimitry Andric #endif
3230b57cec5SDimitry Andric
324*0fca6ea1SDimitry Andric /* 8.4.3 Accumulating multiplications */
325bdd1243dSDimitry Andric #if defined(__ARM_FEATURE_DSP) && __ARM_FEATURE_DSP
3260b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smlabb(int32_t __a,int32_t __b,int32_t __c)3270b57cec5SDimitry Andric __smlabb(int32_t __a, int32_t __b, int32_t __c) {
3280b57cec5SDimitry Andric return __builtin_arm_smlabb(__a, __b, __c);
3290b57cec5SDimitry Andric }
3300b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smlabt(int32_t __a,int32_t __b,int32_t __c)3310b57cec5SDimitry Andric __smlabt(int32_t __a, int32_t __b, int32_t __c) {
3320b57cec5SDimitry Andric return __builtin_arm_smlabt(__a, __b, __c);
3330b57cec5SDimitry Andric }
3340b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smlatb(int32_t __a,int32_t __b,int32_t __c)3350b57cec5SDimitry Andric __smlatb(int32_t __a, int32_t __b, int32_t __c) {
3360b57cec5SDimitry Andric return __builtin_arm_smlatb(__a, __b, __c);
3370b57cec5SDimitry Andric }
3380b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smlatt(int32_t __a,int32_t __b,int32_t __c)3390b57cec5SDimitry Andric __smlatt(int32_t __a, int32_t __b, int32_t __c) {
3400b57cec5SDimitry Andric return __builtin_arm_smlatt(__a, __b, __c);
3410b57cec5SDimitry Andric }
3420b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smlawb(int32_t __a,int32_t __b,int32_t __c)3430b57cec5SDimitry Andric __smlawb(int32_t __a, int32_t __b, int32_t __c) {
3440b57cec5SDimitry Andric return __builtin_arm_smlawb(__a, __b, __c);
3450b57cec5SDimitry Andric }
3460b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smlawt(int32_t __a,int32_t __b,int32_t __c)3470b57cec5SDimitry Andric __smlawt(int32_t __a, int32_t __b, int32_t __c) {
3480b57cec5SDimitry Andric return __builtin_arm_smlawt(__a, __b, __c);
3490b57cec5SDimitry Andric }
3500b57cec5SDimitry Andric #endif
3510b57cec5SDimitry Andric
3520b57cec5SDimitry Andric
3537a6dacacSDimitry Andric /* 8.5.4 Parallel 16-bit saturation */
354bdd1243dSDimitry Andric #if defined(__ARM_FEATURE_SIMD32) && __ARM_FEATURE_SIMD32
3550b57cec5SDimitry Andric #define __ssat16(x, y) __builtin_arm_ssat16(x, y)
3560b57cec5SDimitry Andric #define __usat16(x, y) __builtin_arm_usat16(x, y)
3570b57cec5SDimitry Andric #endif
3580b57cec5SDimitry Andric
3597a6dacacSDimitry Andric /* 8.5.5 Packing and unpacking */
360bdd1243dSDimitry Andric #if defined(__ARM_FEATURE_SIMD32) && __ARM_FEATURE_SIMD32
3610b57cec5SDimitry Andric typedef int32_t int8x4_t;
3620b57cec5SDimitry Andric typedef int32_t int16x2_t;
3630b57cec5SDimitry Andric typedef uint32_t uint8x4_t;
3640b57cec5SDimitry Andric typedef uint32_t uint16x2_t;
3650b57cec5SDimitry Andric
3660b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__sxtab16(int16x2_t __a,int8x4_t __b)3670b57cec5SDimitry Andric __sxtab16(int16x2_t __a, int8x4_t __b) {
3680b57cec5SDimitry Andric return __builtin_arm_sxtab16(__a, __b);
3690b57cec5SDimitry Andric }
3700b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__sxtb16(int8x4_t __a)3710b57cec5SDimitry Andric __sxtb16(int8x4_t __a) {
3720b57cec5SDimitry Andric return __builtin_arm_sxtb16(__a);
3730b57cec5SDimitry Andric }
3740b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__uxtab16(int16x2_t __a,int8x4_t __b)3750b57cec5SDimitry Andric __uxtab16(int16x2_t __a, int8x4_t __b) {
3760b57cec5SDimitry Andric return __builtin_arm_uxtab16(__a, __b);
3770b57cec5SDimitry Andric }
3780b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__uxtb16(int8x4_t __a)3790b57cec5SDimitry Andric __uxtb16(int8x4_t __a) {
3800b57cec5SDimitry Andric return __builtin_arm_uxtb16(__a);
3810b57cec5SDimitry Andric }
3820b57cec5SDimitry Andric #endif
3830b57cec5SDimitry Andric
3847a6dacacSDimitry Andric /* 8.5.6 Parallel selection */
385bdd1243dSDimitry Andric #if defined(__ARM_FEATURE_SIMD32) && __ARM_FEATURE_SIMD32
3860b57cec5SDimitry Andric static __inline__ uint8x4_t __attribute__((__always_inline__, __nodebug__))
__sel(uint8x4_t __a,uint8x4_t __b)3870b57cec5SDimitry Andric __sel(uint8x4_t __a, uint8x4_t __b) {
3880b57cec5SDimitry Andric return __builtin_arm_sel(__a, __b);
3890b57cec5SDimitry Andric }
3900b57cec5SDimitry Andric #endif
3910b57cec5SDimitry Andric
3927a6dacacSDimitry Andric /* 8.5.7 Parallel 8-bit addition and subtraction */
393bdd1243dSDimitry Andric #if defined(__ARM_FEATURE_SIMD32) && __ARM_FEATURE_SIMD32
3940b57cec5SDimitry Andric static __inline__ int8x4_t __attribute__((__always_inline__, __nodebug__))
__qadd8(int8x4_t __a,int8x4_t __b)3950b57cec5SDimitry Andric __qadd8(int8x4_t __a, int8x4_t __b) {
3960b57cec5SDimitry Andric return __builtin_arm_qadd8(__a, __b);
3970b57cec5SDimitry Andric }
3980b57cec5SDimitry Andric static __inline__ int8x4_t __attribute__((__always_inline__, __nodebug__))
__qsub8(int8x4_t __a,int8x4_t __b)3990b57cec5SDimitry Andric __qsub8(int8x4_t __a, int8x4_t __b) {
4000b57cec5SDimitry Andric return __builtin_arm_qsub8(__a, __b);
4010b57cec5SDimitry Andric }
4020b57cec5SDimitry Andric static __inline__ int8x4_t __attribute__((__always_inline__, __nodebug__))
__sadd8(int8x4_t __a,int8x4_t __b)4030b57cec5SDimitry Andric __sadd8(int8x4_t __a, int8x4_t __b) {
4040b57cec5SDimitry Andric return __builtin_arm_sadd8(__a, __b);
4050b57cec5SDimitry Andric }
4060b57cec5SDimitry Andric static __inline__ int8x4_t __attribute__((__always_inline__, __nodebug__))
__shadd8(int8x4_t __a,int8x4_t __b)4070b57cec5SDimitry Andric __shadd8(int8x4_t __a, int8x4_t __b) {
4080b57cec5SDimitry Andric return __builtin_arm_shadd8(__a, __b);
4090b57cec5SDimitry Andric }
4100b57cec5SDimitry Andric static __inline__ int8x4_t __attribute__((__always_inline__, __nodebug__))
__shsub8(int8x4_t __a,int8x4_t __b)4110b57cec5SDimitry Andric __shsub8(int8x4_t __a, int8x4_t __b) {
4120b57cec5SDimitry Andric return __builtin_arm_shsub8(__a, __b);
4130b57cec5SDimitry Andric }
4140b57cec5SDimitry Andric static __inline__ int8x4_t __attribute__((__always_inline__, __nodebug__))
__ssub8(int8x4_t __a,int8x4_t __b)4150b57cec5SDimitry Andric __ssub8(int8x4_t __a, int8x4_t __b) {
4160b57cec5SDimitry Andric return __builtin_arm_ssub8(__a, __b);
4170b57cec5SDimitry Andric }
4180b57cec5SDimitry Andric static __inline__ uint8x4_t __attribute__((__always_inline__, __nodebug__))
__uadd8(uint8x4_t __a,uint8x4_t __b)4190b57cec5SDimitry Andric __uadd8(uint8x4_t __a, uint8x4_t __b) {
4200b57cec5SDimitry Andric return __builtin_arm_uadd8(__a, __b);
4210b57cec5SDimitry Andric }
4220b57cec5SDimitry Andric static __inline__ uint8x4_t __attribute__((__always_inline__, __nodebug__))
__uhadd8(uint8x4_t __a,uint8x4_t __b)4230b57cec5SDimitry Andric __uhadd8(uint8x4_t __a, uint8x4_t __b) {
4240b57cec5SDimitry Andric return __builtin_arm_uhadd8(__a, __b);
4250b57cec5SDimitry Andric }
4260b57cec5SDimitry Andric static __inline__ uint8x4_t __attribute__((__always_inline__, __nodebug__))
__uhsub8(uint8x4_t __a,uint8x4_t __b)4270b57cec5SDimitry Andric __uhsub8(uint8x4_t __a, uint8x4_t __b) {
4280b57cec5SDimitry Andric return __builtin_arm_uhsub8(__a, __b);
4290b57cec5SDimitry Andric }
4300b57cec5SDimitry Andric static __inline__ uint8x4_t __attribute__((__always_inline__, __nodebug__))
__uqadd8(uint8x4_t __a,uint8x4_t __b)4310b57cec5SDimitry Andric __uqadd8(uint8x4_t __a, uint8x4_t __b) {
4320b57cec5SDimitry Andric return __builtin_arm_uqadd8(__a, __b);
4330b57cec5SDimitry Andric }
4340b57cec5SDimitry Andric static __inline__ uint8x4_t __attribute__((__always_inline__, __nodebug__))
__uqsub8(uint8x4_t __a,uint8x4_t __b)4350b57cec5SDimitry Andric __uqsub8(uint8x4_t __a, uint8x4_t __b) {
4360b57cec5SDimitry Andric return __builtin_arm_uqsub8(__a, __b);
4370b57cec5SDimitry Andric }
4380b57cec5SDimitry Andric static __inline__ uint8x4_t __attribute__((__always_inline__, __nodebug__))
__usub8(uint8x4_t __a,uint8x4_t __b)4390b57cec5SDimitry Andric __usub8(uint8x4_t __a, uint8x4_t __b) {
4400b57cec5SDimitry Andric return __builtin_arm_usub8(__a, __b);
4410b57cec5SDimitry Andric }
4420b57cec5SDimitry Andric #endif
4430b57cec5SDimitry Andric
4447a6dacacSDimitry Andric /* 8.5.8 Sum of 8-bit absolute differences */
445bdd1243dSDimitry Andric #if defined(__ARM_FEATURE_SIMD32) && __ARM_FEATURE_SIMD32
4460b57cec5SDimitry Andric static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__usad8(uint8x4_t __a,uint8x4_t __b)4470b57cec5SDimitry Andric __usad8(uint8x4_t __a, uint8x4_t __b) {
4480b57cec5SDimitry Andric return __builtin_arm_usad8(__a, __b);
4490b57cec5SDimitry Andric }
4500b57cec5SDimitry Andric static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__usada8(uint8x4_t __a,uint8x4_t __b,uint32_t __c)4510b57cec5SDimitry Andric __usada8(uint8x4_t __a, uint8x4_t __b, uint32_t __c) {
4520b57cec5SDimitry Andric return __builtin_arm_usada8(__a, __b, __c);
4530b57cec5SDimitry Andric }
4540b57cec5SDimitry Andric #endif
4550b57cec5SDimitry Andric
4567a6dacacSDimitry Andric /* 8.5.9 Parallel 16-bit addition and subtraction */
457bdd1243dSDimitry Andric #if defined(__ARM_FEATURE_SIMD32) && __ARM_FEATURE_SIMD32
4580b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__qadd16(int16x2_t __a,int16x2_t __b)4590b57cec5SDimitry Andric __qadd16(int16x2_t __a, int16x2_t __b) {
4600b57cec5SDimitry Andric return __builtin_arm_qadd16(__a, __b);
4610b57cec5SDimitry Andric }
4620b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__qasx(int16x2_t __a,int16x2_t __b)4630b57cec5SDimitry Andric __qasx(int16x2_t __a, int16x2_t __b) {
4640b57cec5SDimitry Andric return __builtin_arm_qasx(__a, __b);
4650b57cec5SDimitry Andric }
4660b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__qsax(int16x2_t __a,int16x2_t __b)4670b57cec5SDimitry Andric __qsax(int16x2_t __a, int16x2_t __b) {
4680b57cec5SDimitry Andric return __builtin_arm_qsax(__a, __b);
4690b57cec5SDimitry Andric }
4700b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__qsub16(int16x2_t __a,int16x2_t __b)4710b57cec5SDimitry Andric __qsub16(int16x2_t __a, int16x2_t __b) {
4720b57cec5SDimitry Andric return __builtin_arm_qsub16(__a, __b);
4730b57cec5SDimitry Andric }
4740b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__sadd16(int16x2_t __a,int16x2_t __b)4750b57cec5SDimitry Andric __sadd16(int16x2_t __a, int16x2_t __b) {
4760b57cec5SDimitry Andric return __builtin_arm_sadd16(__a, __b);
4770b57cec5SDimitry Andric }
4780b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__sasx(int16x2_t __a,int16x2_t __b)4790b57cec5SDimitry Andric __sasx(int16x2_t __a, int16x2_t __b) {
4800b57cec5SDimitry Andric return __builtin_arm_sasx(__a, __b);
4810b57cec5SDimitry Andric }
4820b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__shadd16(int16x2_t __a,int16x2_t __b)4830b57cec5SDimitry Andric __shadd16(int16x2_t __a, int16x2_t __b) {
4840b57cec5SDimitry Andric return __builtin_arm_shadd16(__a, __b);
4850b57cec5SDimitry Andric }
4860b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__shasx(int16x2_t __a,int16x2_t __b)4870b57cec5SDimitry Andric __shasx(int16x2_t __a, int16x2_t __b) {
4880b57cec5SDimitry Andric return __builtin_arm_shasx(__a, __b);
4890b57cec5SDimitry Andric }
4900b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__shsax(int16x2_t __a,int16x2_t __b)4910b57cec5SDimitry Andric __shsax(int16x2_t __a, int16x2_t __b) {
4920b57cec5SDimitry Andric return __builtin_arm_shsax(__a, __b);
4930b57cec5SDimitry Andric }
4940b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__shsub16(int16x2_t __a,int16x2_t __b)4950b57cec5SDimitry Andric __shsub16(int16x2_t __a, int16x2_t __b) {
4960b57cec5SDimitry Andric return __builtin_arm_shsub16(__a, __b);
4970b57cec5SDimitry Andric }
4980b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__ssax(int16x2_t __a,int16x2_t __b)4990b57cec5SDimitry Andric __ssax(int16x2_t __a, int16x2_t __b) {
5000b57cec5SDimitry Andric return __builtin_arm_ssax(__a, __b);
5010b57cec5SDimitry Andric }
5020b57cec5SDimitry Andric static __inline__ int16x2_t __attribute__((__always_inline__, __nodebug__))
__ssub16(int16x2_t __a,int16x2_t __b)5030b57cec5SDimitry Andric __ssub16(int16x2_t __a, int16x2_t __b) {
5040b57cec5SDimitry Andric return __builtin_arm_ssub16(__a, __b);
5050b57cec5SDimitry Andric }
5060b57cec5SDimitry Andric static __inline__ uint16x2_t __attribute__((__always_inline__, __nodebug__))
__uadd16(uint16x2_t __a,uint16x2_t __b)5070b57cec5SDimitry Andric __uadd16(uint16x2_t __a, uint16x2_t __b) {
5080b57cec5SDimitry Andric return __builtin_arm_uadd16(__a, __b);
5090b57cec5SDimitry Andric }
5100b57cec5SDimitry Andric static __inline__ uint16x2_t __attribute__((__always_inline__, __nodebug__))
__uasx(uint16x2_t __a,uint16x2_t __b)5110b57cec5SDimitry Andric __uasx(uint16x2_t __a, uint16x2_t __b) {
5120b57cec5SDimitry Andric return __builtin_arm_uasx(__a, __b);
5130b57cec5SDimitry Andric }
5140b57cec5SDimitry Andric static __inline__ uint16x2_t __attribute__((__always_inline__, __nodebug__))
__uhadd16(uint16x2_t __a,uint16x2_t __b)5150b57cec5SDimitry Andric __uhadd16(uint16x2_t __a, uint16x2_t __b) {
5160b57cec5SDimitry Andric return __builtin_arm_uhadd16(__a, __b);
5170b57cec5SDimitry Andric }
5180b57cec5SDimitry Andric static __inline__ uint16x2_t __attribute__((__always_inline__, __nodebug__))
__uhasx(uint16x2_t __a,uint16x2_t __b)5190b57cec5SDimitry Andric __uhasx(uint16x2_t __a, uint16x2_t __b) {
5200b57cec5SDimitry Andric return __builtin_arm_uhasx(__a, __b);
5210b57cec5SDimitry Andric }
5220b57cec5SDimitry Andric static __inline__ uint16x2_t __attribute__((__always_inline__, __nodebug__))
__uhsax(uint16x2_t __a,uint16x2_t __b)5230b57cec5SDimitry Andric __uhsax(uint16x2_t __a, uint16x2_t __b) {
5240b57cec5SDimitry Andric return __builtin_arm_uhsax(__a, __b);
5250b57cec5SDimitry Andric }
5260b57cec5SDimitry Andric static __inline__ uint16x2_t __attribute__((__always_inline__, __nodebug__))
__uhsub16(uint16x2_t __a,uint16x2_t __b)5270b57cec5SDimitry Andric __uhsub16(uint16x2_t __a, uint16x2_t __b) {
5280b57cec5SDimitry Andric return __builtin_arm_uhsub16(__a, __b);
5290b57cec5SDimitry Andric }
5300b57cec5SDimitry Andric static __inline__ uint16x2_t __attribute__((__always_inline__, __nodebug__))
__uqadd16(uint16x2_t __a,uint16x2_t __b)5310b57cec5SDimitry Andric __uqadd16(uint16x2_t __a, uint16x2_t __b) {
5320b57cec5SDimitry Andric return __builtin_arm_uqadd16(__a, __b);
5330b57cec5SDimitry Andric }
5340b57cec5SDimitry Andric static __inline__ uint16x2_t __attribute__((__always_inline__, __nodebug__))
__uqasx(uint16x2_t __a,uint16x2_t __b)5350b57cec5SDimitry Andric __uqasx(uint16x2_t __a, uint16x2_t __b) {
5360b57cec5SDimitry Andric return __builtin_arm_uqasx(__a, __b);
5370b57cec5SDimitry Andric }
5380b57cec5SDimitry Andric static __inline__ uint16x2_t __attribute__((__always_inline__, __nodebug__))
__uqsax(uint16x2_t __a,uint16x2_t __b)5390b57cec5SDimitry Andric __uqsax(uint16x2_t __a, uint16x2_t __b) {
5400b57cec5SDimitry Andric return __builtin_arm_uqsax(__a, __b);
5410b57cec5SDimitry Andric }
5420b57cec5SDimitry Andric static __inline__ uint16x2_t __attribute__((__always_inline__, __nodebug__))
__uqsub16(uint16x2_t __a,uint16x2_t __b)5430b57cec5SDimitry Andric __uqsub16(uint16x2_t __a, uint16x2_t __b) {
5440b57cec5SDimitry Andric return __builtin_arm_uqsub16(__a, __b);
5450b57cec5SDimitry Andric }
5460b57cec5SDimitry Andric static __inline__ uint16x2_t __attribute__((__always_inline__, __nodebug__))
__usax(uint16x2_t __a,uint16x2_t __b)5470b57cec5SDimitry Andric __usax(uint16x2_t __a, uint16x2_t __b) {
5480b57cec5SDimitry Andric return __builtin_arm_usax(__a, __b);
5490b57cec5SDimitry Andric }
5500b57cec5SDimitry Andric static __inline__ uint16x2_t __attribute__((__always_inline__, __nodebug__))
__usub16(uint16x2_t __a,uint16x2_t __b)5510b57cec5SDimitry Andric __usub16(uint16x2_t __a, uint16x2_t __b) {
5520b57cec5SDimitry Andric return __builtin_arm_usub16(__a, __b);
5530b57cec5SDimitry Andric }
5540b57cec5SDimitry Andric #endif
5550b57cec5SDimitry Andric
556*0fca6ea1SDimitry Andric /* 8.5.10 Parallel 16-bit multiplication */
557bdd1243dSDimitry Andric #if defined(__ARM_FEATURE_SIMD32) && __ARM_FEATURE_SIMD32
5580b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smlad(int16x2_t __a,int16x2_t __b,int32_t __c)5590b57cec5SDimitry Andric __smlad(int16x2_t __a, int16x2_t __b, int32_t __c) {
5600b57cec5SDimitry Andric return __builtin_arm_smlad(__a, __b, __c);
5610b57cec5SDimitry Andric }
5620b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smladx(int16x2_t __a,int16x2_t __b,int32_t __c)5630b57cec5SDimitry Andric __smladx(int16x2_t __a, int16x2_t __b, int32_t __c) {
5640b57cec5SDimitry Andric return __builtin_arm_smladx(__a, __b, __c);
5650b57cec5SDimitry Andric }
5660b57cec5SDimitry Andric static __inline__ int64_t __attribute__((__always_inline__, __nodebug__))
__smlald(int16x2_t __a,int16x2_t __b,int64_t __c)5670b57cec5SDimitry Andric __smlald(int16x2_t __a, int16x2_t __b, int64_t __c) {
5680b57cec5SDimitry Andric return __builtin_arm_smlald(__a, __b, __c);
5690b57cec5SDimitry Andric }
5700b57cec5SDimitry Andric static __inline__ int64_t __attribute__((__always_inline__, __nodebug__))
__smlaldx(int16x2_t __a,int16x2_t __b,int64_t __c)5710b57cec5SDimitry Andric __smlaldx(int16x2_t __a, int16x2_t __b, int64_t __c) {
5720b57cec5SDimitry Andric return __builtin_arm_smlaldx(__a, __b, __c);
5730b57cec5SDimitry Andric }
5740b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smlsd(int16x2_t __a,int16x2_t __b,int32_t __c)5750b57cec5SDimitry Andric __smlsd(int16x2_t __a, int16x2_t __b, int32_t __c) {
5760b57cec5SDimitry Andric return __builtin_arm_smlsd(__a, __b, __c);
5770b57cec5SDimitry Andric }
5780b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smlsdx(int16x2_t __a,int16x2_t __b,int32_t __c)5790b57cec5SDimitry Andric __smlsdx(int16x2_t __a, int16x2_t __b, int32_t __c) {
5800b57cec5SDimitry Andric return __builtin_arm_smlsdx(__a, __b, __c);
5810b57cec5SDimitry Andric }
5820b57cec5SDimitry Andric static __inline__ int64_t __attribute__((__always_inline__, __nodebug__))
__smlsld(int16x2_t __a,int16x2_t __b,int64_t __c)5830b57cec5SDimitry Andric __smlsld(int16x2_t __a, int16x2_t __b, int64_t __c) {
5840b57cec5SDimitry Andric return __builtin_arm_smlsld(__a, __b, __c);
5850b57cec5SDimitry Andric }
5860b57cec5SDimitry Andric static __inline__ int64_t __attribute__((__always_inline__, __nodebug__))
__smlsldx(int16x2_t __a,int16x2_t __b,int64_t __c)5870b57cec5SDimitry Andric __smlsldx(int16x2_t __a, int16x2_t __b, int64_t __c) {
5880b57cec5SDimitry Andric return __builtin_arm_smlsldx(__a, __b, __c);
5890b57cec5SDimitry Andric }
5900b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smuad(int16x2_t __a,int16x2_t __b)5910b57cec5SDimitry Andric __smuad(int16x2_t __a, int16x2_t __b) {
5920b57cec5SDimitry Andric return __builtin_arm_smuad(__a, __b);
5930b57cec5SDimitry Andric }
5940b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smuadx(int16x2_t __a,int16x2_t __b)5950b57cec5SDimitry Andric __smuadx(int16x2_t __a, int16x2_t __b) {
5960b57cec5SDimitry Andric return __builtin_arm_smuadx(__a, __b);
5970b57cec5SDimitry Andric }
5980b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smusd(int16x2_t __a,int16x2_t __b)5990b57cec5SDimitry Andric __smusd(int16x2_t __a, int16x2_t __b) {
6000b57cec5SDimitry Andric return __builtin_arm_smusd(__a, __b);
6010b57cec5SDimitry Andric }
6020b57cec5SDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smusdx(int16x2_t __a,int16x2_t __b)6030b57cec5SDimitry Andric __smusdx(int16x2_t __a, int16x2_t __b) {
6040b57cec5SDimitry Andric return __builtin_arm_smusdx(__a, __b);
6050b57cec5SDimitry Andric }
6060b57cec5SDimitry Andric #endif
6070b57cec5SDimitry Andric
6085f757f3fSDimitry Andric /* 8.6 Floating-point data-processing intrinsics */
6095f757f3fSDimitry Andric #if (defined(__ARM_FEATURE_DIRECTED_ROUNDING) && \
6105f757f3fSDimitry Andric (__ARM_FEATURE_DIRECTED_ROUNDING)) && \
6115f757f3fSDimitry Andric (defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE)
6125f757f3fSDimitry Andric static __inline__ double __attribute__((__always_inline__, __nodebug__))
__rintn(double __a)6135f757f3fSDimitry Andric __rintn(double __a) {
6145f757f3fSDimitry Andric return __builtin_roundeven(__a);
6155f757f3fSDimitry Andric }
6165f757f3fSDimitry Andric
6175f757f3fSDimitry Andric static __inline__ float __attribute__((__always_inline__, __nodebug__))
__rintnf(float __a)6185f757f3fSDimitry Andric __rintnf(float __a) {
6195f757f3fSDimitry Andric return __builtin_roundevenf(__a);
6205f757f3fSDimitry Andric }
6215f757f3fSDimitry Andric #endif
6225f757f3fSDimitry Andric
6237a6dacacSDimitry Andric /* 8.8 CRC32 intrinsics */
624bdd1243dSDimitry Andric #if (defined(__ARM_FEATURE_CRC32) && __ARM_FEATURE_CRC32) || \
625bdd1243dSDimitry Andric (defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE)
626bdd1243dSDimitry Andric static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__, target("crc")))
__crc32b(uint32_t __a,uint8_t __b)6270b57cec5SDimitry Andric __crc32b(uint32_t __a, uint8_t __b) {
6280b57cec5SDimitry Andric return __builtin_arm_crc32b(__a, __b);
6290b57cec5SDimitry Andric }
6300b57cec5SDimitry Andric
631bdd1243dSDimitry Andric static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__, target("crc")))
__crc32h(uint32_t __a,uint16_t __b)6320b57cec5SDimitry Andric __crc32h(uint32_t __a, uint16_t __b) {
6330b57cec5SDimitry Andric return __builtin_arm_crc32h(__a, __b);
6340b57cec5SDimitry Andric }
6350b57cec5SDimitry Andric
636bdd1243dSDimitry Andric static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__, target("crc")))
__crc32w(uint32_t __a,uint32_t __b)6370b57cec5SDimitry Andric __crc32w(uint32_t __a, uint32_t __b) {
6380b57cec5SDimitry Andric return __builtin_arm_crc32w(__a, __b);
6390b57cec5SDimitry Andric }
6400b57cec5SDimitry Andric
641bdd1243dSDimitry Andric static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__, target("crc")))
__crc32d(uint32_t __a,uint64_t __b)6420b57cec5SDimitry Andric __crc32d(uint32_t __a, uint64_t __b) {
6430b57cec5SDimitry Andric return __builtin_arm_crc32d(__a, __b);
6440b57cec5SDimitry Andric }
6450b57cec5SDimitry Andric
646bdd1243dSDimitry Andric static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__, target("crc")))
__crc32cb(uint32_t __a,uint8_t __b)6470b57cec5SDimitry Andric __crc32cb(uint32_t __a, uint8_t __b) {
6480b57cec5SDimitry Andric return __builtin_arm_crc32cb(__a, __b);
6490b57cec5SDimitry Andric }
6500b57cec5SDimitry Andric
651bdd1243dSDimitry Andric static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__, target("crc")))
__crc32ch(uint32_t __a,uint16_t __b)6520b57cec5SDimitry Andric __crc32ch(uint32_t __a, uint16_t __b) {
6530b57cec5SDimitry Andric return __builtin_arm_crc32ch(__a, __b);
6540b57cec5SDimitry Andric }
6550b57cec5SDimitry Andric
656bdd1243dSDimitry Andric static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__, target("crc")))
__crc32cw(uint32_t __a,uint32_t __b)6570b57cec5SDimitry Andric __crc32cw(uint32_t __a, uint32_t __b) {
6580b57cec5SDimitry Andric return __builtin_arm_crc32cw(__a, __b);
6590b57cec5SDimitry Andric }
6600b57cec5SDimitry Andric
661bdd1243dSDimitry Andric static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__, target("crc")))
__crc32cd(uint32_t __a,uint64_t __b)6620b57cec5SDimitry Andric __crc32cd(uint32_t __a, uint64_t __b) {
6630b57cec5SDimitry Andric return __builtin_arm_crc32cd(__a, __b);
6640b57cec5SDimitry Andric }
6650b57cec5SDimitry Andric #endif
6660b57cec5SDimitry Andric
6677a6dacacSDimitry Andric /* 8.6 Floating-point data-processing intrinsics */
6680b57cec5SDimitry Andric /* Armv8.3-A Javascript conversion intrinsic */
669bdd1243dSDimitry Andric #if defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE
670bdd1243dSDimitry Andric static __inline__ int32_t __attribute__((__always_inline__, __nodebug__, target("v8.3a")))
__jcvt(double __a)6710b57cec5SDimitry Andric __jcvt(double __a) {
6720b57cec5SDimitry Andric return __builtin_arm_jcvt(__a);
6730b57cec5SDimitry Andric }
6740b57cec5SDimitry Andric #endif
6750b57cec5SDimitry Andric
676fe6060f1SDimitry Andric /* Armv8.5-A FP rounding intrinsics */
677bdd1243dSDimitry Andric #if defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE
678bdd1243dSDimitry Andric static __inline__ float __attribute__((__always_inline__, __nodebug__, target("v8.5a")))
__rint32zf(float __a)679bdd1243dSDimitry Andric __rint32zf(float __a) {
680bdd1243dSDimitry Andric return __builtin_arm_rint32zf(__a);
681fe6060f1SDimitry Andric }
682fe6060f1SDimitry Andric
683bdd1243dSDimitry Andric static __inline__ double __attribute__((__always_inline__, __nodebug__, target("v8.5a")))
__rint32z(double __a)684bdd1243dSDimitry Andric __rint32z(double __a) {
685bdd1243dSDimitry Andric return __builtin_arm_rint32z(__a);
686fe6060f1SDimitry Andric }
687fe6060f1SDimitry Andric
688bdd1243dSDimitry Andric static __inline__ float __attribute__((__always_inline__, __nodebug__, target("v8.5a")))
__rint64zf(float __a)689bdd1243dSDimitry Andric __rint64zf(float __a) {
690bdd1243dSDimitry Andric return __builtin_arm_rint64zf(__a);
691fe6060f1SDimitry Andric }
692fe6060f1SDimitry Andric
693bdd1243dSDimitry Andric static __inline__ double __attribute__((__always_inline__, __nodebug__, target("v8.5a")))
__rint64z(double __a)694bdd1243dSDimitry Andric __rint64z(double __a) {
695bdd1243dSDimitry Andric return __builtin_arm_rint64z(__a);
696fe6060f1SDimitry Andric }
697fe6060f1SDimitry Andric
698bdd1243dSDimitry Andric static __inline__ float __attribute__((__always_inline__, __nodebug__, target("v8.5a")))
__rint32xf(float __a)699bdd1243dSDimitry Andric __rint32xf(float __a) {
700bdd1243dSDimitry Andric return __builtin_arm_rint32xf(__a);
701fe6060f1SDimitry Andric }
702fe6060f1SDimitry Andric
703bdd1243dSDimitry Andric static __inline__ double __attribute__((__always_inline__, __nodebug__, target("v8.5a")))
__rint32x(double __a)704bdd1243dSDimitry Andric __rint32x(double __a) {
705bdd1243dSDimitry Andric return __builtin_arm_rint32x(__a);
706fe6060f1SDimitry Andric }
707fe6060f1SDimitry Andric
708bdd1243dSDimitry Andric static __inline__ float __attribute__((__always_inline__, __nodebug__, target("v8.5a")))
__rint64xf(float __a)709bdd1243dSDimitry Andric __rint64xf(float __a) {
710bdd1243dSDimitry Andric return __builtin_arm_rint64xf(__a);
711fe6060f1SDimitry Andric }
712fe6060f1SDimitry Andric
713bdd1243dSDimitry Andric static __inline__ double __attribute__((__always_inline__, __nodebug__, target("v8.5a")))
__rint64x(double __a)714bdd1243dSDimitry Andric __rint64x(double __a) {
715bdd1243dSDimitry Andric return __builtin_arm_rint64x(__a);
716fe6060f1SDimitry Andric }
717fe6060f1SDimitry Andric #endif
718fe6060f1SDimitry Andric
7197a6dacacSDimitry Andric /* 8.9 Armv8.7-A load/store 64-byte intrinsics */
720bdd1243dSDimitry Andric #if defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE
721e8d8bef9SDimitry Andric typedef struct {
722e8d8bef9SDimitry Andric uint64_t val[8];
723e8d8bef9SDimitry Andric } data512_t;
724e8d8bef9SDimitry Andric
725bdd1243dSDimitry Andric static __inline__ data512_t __attribute__((__always_inline__, __nodebug__, target("ls64")))
__arm_ld64b(const void * __addr)726e8d8bef9SDimitry Andric __arm_ld64b(const void *__addr) {
727e8d8bef9SDimitry Andric data512_t __value;
728e8d8bef9SDimitry Andric __builtin_arm_ld64b(__addr, __value.val);
729e8d8bef9SDimitry Andric return __value;
730e8d8bef9SDimitry Andric }
731bdd1243dSDimitry Andric static __inline__ void __attribute__((__always_inline__, __nodebug__, target("ls64")))
__arm_st64b(void * __addr,data512_t __value)732e8d8bef9SDimitry Andric __arm_st64b(void *__addr, data512_t __value) {
733e8d8bef9SDimitry Andric __builtin_arm_st64b(__addr, __value.val);
734e8d8bef9SDimitry Andric }
735bdd1243dSDimitry Andric static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__, target("ls64")))
__arm_st64bv(void * __addr,data512_t __value)736e8d8bef9SDimitry Andric __arm_st64bv(void *__addr, data512_t __value) {
737e8d8bef9SDimitry Andric return __builtin_arm_st64bv(__addr, __value.val);
738e8d8bef9SDimitry Andric }
739bdd1243dSDimitry Andric static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__, target("ls64")))
__arm_st64bv0(void * __addr,data512_t __value)740e8d8bef9SDimitry Andric __arm_st64bv0(void *__addr, data512_t __value) {
741e8d8bef9SDimitry Andric return __builtin_arm_st64bv0(__addr, __value.val);
742e8d8bef9SDimitry Andric }
743e8d8bef9SDimitry Andric #endif
744e8d8bef9SDimitry Andric
7457a6dacacSDimitry Andric /* 11.1 Special register intrinsics */
7460b57cec5SDimitry Andric #define __arm_rsr(sysreg) __builtin_arm_rsr(sysreg)
7470b57cec5SDimitry Andric #define __arm_rsr64(sysreg) __builtin_arm_rsr64(sysreg)
748bdd1243dSDimitry Andric #define __arm_rsr128(sysreg) __builtin_arm_rsr128(sysreg)
7490b57cec5SDimitry Andric #define __arm_rsrp(sysreg) __builtin_arm_rsrp(sysreg)
750480093f4SDimitry Andric #define __arm_rsrf(sysreg) __builtin_bit_cast(float, __arm_rsr(sysreg))
751480093f4SDimitry Andric #define __arm_rsrf64(sysreg) __builtin_bit_cast(double, __arm_rsr64(sysreg))
7520b57cec5SDimitry Andric #define __arm_wsr(sysreg, v) __builtin_arm_wsr(sysreg, v)
7530b57cec5SDimitry Andric #define __arm_wsr64(sysreg, v) __builtin_arm_wsr64(sysreg, v)
754bdd1243dSDimitry Andric #define __arm_wsr128(sysreg, v) __builtin_arm_wsr128(sysreg, v)
7550b57cec5SDimitry Andric #define __arm_wsrp(sysreg, v) __builtin_arm_wsrp(sysreg, v)
756480093f4SDimitry Andric #define __arm_wsrf(sysreg, v) __arm_wsr(sysreg, __builtin_bit_cast(uint32_t, v))
757480093f4SDimitry Andric #define __arm_wsrf64(sysreg, v) __arm_wsr64(sysreg, __builtin_bit_cast(uint64_t, v))
7580b57cec5SDimitry Andric
759*0fca6ea1SDimitry Andric /* 10.3 MTE intrinsics */
760bdd1243dSDimitry Andric #if defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE
7610b57cec5SDimitry Andric #define __arm_mte_create_random_tag(__ptr, __mask) __builtin_arm_irg(__ptr, __mask)
7620b57cec5SDimitry Andric #define __arm_mte_increment_tag(__ptr, __tag_offset) __builtin_arm_addg(__ptr, __tag_offset)
7630b57cec5SDimitry Andric #define __arm_mte_exclude_tag(__ptr, __excluded) __builtin_arm_gmi(__ptr, __excluded)
7640b57cec5SDimitry Andric #define __arm_mte_get_tag(__ptr) __builtin_arm_ldg(__ptr)
7650b57cec5SDimitry Andric #define __arm_mte_set_tag(__ptr) __builtin_arm_stg(__ptr)
7660b57cec5SDimitry Andric #define __arm_mte_ptrdiff(__ptra, __ptrb) __builtin_arm_subp(__ptra, __ptrb)
7670b57cec5SDimitry Andric
768*0fca6ea1SDimitry Andric /* 18 memcpy family of operations intrinsics - MOPS */
7691fd87a68SDimitry Andric #define __arm_mops_memset_tag(__tagged_address, __value, __size) \
7701fd87a68SDimitry Andric __builtin_arm_mops_memset_tag(__tagged_address, __value, __size)
7711fd87a68SDimitry Andric #endif
7721fd87a68SDimitry Andric
7737a6dacacSDimitry Andric /* 11.3 Coprocessor Intrinsics */
7741db9f3b2SDimitry Andric #if defined(__ARM_FEATURE_COPROC)
7751db9f3b2SDimitry Andric
7761db9f3b2SDimitry Andric #if (__ARM_FEATURE_COPROC & 0x1)
7771db9f3b2SDimitry Andric
7781db9f3b2SDimitry Andric #if (__ARM_ARCH < 8)
7791db9f3b2SDimitry Andric #define __arm_cdp(coproc, opc1, CRd, CRn, CRm, opc2) \
7801db9f3b2SDimitry Andric __builtin_arm_cdp(coproc, opc1, CRd, CRn, CRm, opc2)
7811db9f3b2SDimitry Andric #endif /* __ARM_ARCH < 8 */
7821db9f3b2SDimitry Andric
7831db9f3b2SDimitry Andric #define __arm_ldc(coproc, CRd, p) __builtin_arm_ldc(coproc, CRd, p)
7841db9f3b2SDimitry Andric #define __arm_stc(coproc, CRd, p) __builtin_arm_stc(coproc, CRd, p)
7851db9f3b2SDimitry Andric
7861db9f3b2SDimitry Andric #define __arm_mcr(coproc, opc1, value, CRn, CRm, opc2) \
7871db9f3b2SDimitry Andric __builtin_arm_mcr(coproc, opc1, value, CRn, CRm, opc2)
7881db9f3b2SDimitry Andric #define __arm_mrc(coproc, opc1, CRn, CRm, opc2) \
7891db9f3b2SDimitry Andric __builtin_arm_mrc(coproc, opc1, CRn, CRm, opc2)
7901db9f3b2SDimitry Andric
7911db9f3b2SDimitry Andric #if (__ARM_ARCH != 4) && (__ARM_ARCH < 8)
7921db9f3b2SDimitry Andric #define __arm_ldcl(coproc, CRd, p) __builtin_arm_ldcl(coproc, CRd, p)
7931db9f3b2SDimitry Andric #define __arm_stcl(coproc, CRd, p) __builtin_arm_stcl(coproc, CRd, p)
7941db9f3b2SDimitry Andric #endif /* (__ARM_ARCH != 4) && (__ARM_ARCH != 8) */
7951db9f3b2SDimitry Andric
7961db9f3b2SDimitry Andric #if (__ARM_ARCH_8M_MAIN__) || (__ARM_ARCH_8_1M_MAIN__)
7971db9f3b2SDimitry Andric #define __arm_cdp(coproc, opc1, CRd, CRn, CRm, opc2) \
7981db9f3b2SDimitry Andric __builtin_arm_cdp(coproc, opc1, CRd, CRn, CRm, opc2)
7991db9f3b2SDimitry Andric #define __arm_ldcl(coproc, CRd, p) __builtin_arm_ldcl(coproc, CRd, p)
8001db9f3b2SDimitry Andric #define __arm_stcl(coproc, CRd, p) __builtin_arm_stcl(coproc, CRd, p)
8011db9f3b2SDimitry Andric #endif /* ___ARM_ARCH_8M_MAIN__ */
8021db9f3b2SDimitry Andric
8031db9f3b2SDimitry Andric #endif /* __ARM_FEATURE_COPROC & 0x1 */
8041db9f3b2SDimitry Andric
8051db9f3b2SDimitry Andric #if (__ARM_FEATURE_COPROC & 0x2)
8061db9f3b2SDimitry Andric #define __arm_cdp2(coproc, opc1, CRd, CRn, CRm, opc2) \
8071db9f3b2SDimitry Andric __builtin_arm_cdp2(coproc, opc1, CRd, CRn, CRm, opc2)
8081db9f3b2SDimitry Andric #define __arm_ldc2(coproc, CRd, p) __builtin_arm_ldc2(coproc, CRd, p)
8091db9f3b2SDimitry Andric #define __arm_stc2(coproc, CRd, p) __builtin_arm_stc2(coproc, CRd, p)
8101db9f3b2SDimitry Andric #define __arm_ldc2l(coproc, CRd, p) __builtin_arm_ldc2l(coproc, CRd, p)
8111db9f3b2SDimitry Andric #define __arm_stc2l(coproc, CRd, p) __builtin_arm_stc2l(coproc, CRd, p)
8121db9f3b2SDimitry Andric #define __arm_mcr2(coproc, opc1, value, CRn, CRm, opc2) \
8131db9f3b2SDimitry Andric __builtin_arm_mcr2(coproc, opc1, value, CRn, CRm, opc2)
8141db9f3b2SDimitry Andric #define __arm_mrc2(coproc, opc1, CRn, CRm, opc2) \
8151db9f3b2SDimitry Andric __builtin_arm_mrc2(coproc, opc1, CRn, CRm, opc2)
8161db9f3b2SDimitry Andric #endif
8171db9f3b2SDimitry Andric
8181db9f3b2SDimitry Andric #if (__ARM_FEATURE_COPROC & 0x4)
8191db9f3b2SDimitry Andric #define __arm_mcrr(coproc, opc1, value, CRm) \
8201db9f3b2SDimitry Andric __builtin_arm_mcrr(coproc, opc1, value, CRm)
8211db9f3b2SDimitry Andric #define __arm_mrrc(coproc, opc1, CRm) __builtin_arm_mrrc(coproc, opc1, CRm)
8221db9f3b2SDimitry Andric #endif
8231db9f3b2SDimitry Andric
8241db9f3b2SDimitry Andric #if (__ARM_FEATURE_COPROC & 0x8)
8251db9f3b2SDimitry Andric #define __arm_mcrr2(coproc, opc1, value, CRm) \
8261db9f3b2SDimitry Andric __builtin_arm_mcrr2(coproc, opc1, value, CRm)
8271db9f3b2SDimitry Andric #define __arm_mrrc2(coproc, opc1, CRm) __builtin_arm_mrrc2(coproc, opc1, CRm)
8281db9f3b2SDimitry Andric #endif
8291db9f3b2SDimitry Andric
8301db9f3b2SDimitry Andric #endif // __ARM_FEATURE_COPROC
8311db9f3b2SDimitry Andric
8327a6dacacSDimitry Andric /* 17 Transactional Memory Extension (TME) Intrinsics */
833bdd1243dSDimitry Andric #if defined(__ARM_FEATURE_TME) && __ARM_FEATURE_TME
834a7dea167SDimitry Andric
835a7dea167SDimitry Andric #define _TMFAILURE_REASON 0x00007fffu
836a7dea167SDimitry Andric #define _TMFAILURE_RTRY 0x00008000u
837a7dea167SDimitry Andric #define _TMFAILURE_CNCL 0x00010000u
838a7dea167SDimitry Andric #define _TMFAILURE_MEM 0x00020000u
839a7dea167SDimitry Andric #define _TMFAILURE_IMP 0x00040000u
840a7dea167SDimitry Andric #define _TMFAILURE_ERR 0x00080000u
841a7dea167SDimitry Andric #define _TMFAILURE_SIZE 0x00100000u
842a7dea167SDimitry Andric #define _TMFAILURE_NEST 0x00200000u
843a7dea167SDimitry Andric #define _TMFAILURE_DBG 0x00400000u
844a7dea167SDimitry Andric #define _TMFAILURE_INT 0x00800000u
845a7dea167SDimitry Andric #define _TMFAILURE_TRIVIAL 0x01000000u
846a7dea167SDimitry Andric
847a7dea167SDimitry Andric #define __tstart() __builtin_arm_tstart()
848a7dea167SDimitry Andric #define __tcommit() __builtin_arm_tcommit()
849a7dea167SDimitry Andric #define __tcancel(__arg) __builtin_arm_tcancel(__arg)
850a7dea167SDimitry Andric #define __ttest() __builtin_arm_ttest()
851a7dea167SDimitry Andric
852a7dea167SDimitry Andric #endif /* __ARM_FEATURE_TME */
853a7dea167SDimitry Andric
8547a6dacacSDimitry Andric /* 8.7 Armv8.5-A Random number generation intrinsics */
855bdd1243dSDimitry Andric #if defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE
856bdd1243dSDimitry Andric static __inline__ int __attribute__((__always_inline__, __nodebug__, target("rand")))
__rndr(uint64_t * __p)857fe6060f1SDimitry Andric __rndr(uint64_t *__p) {
858fe6060f1SDimitry Andric return __builtin_arm_rndr(__p);
859fe6060f1SDimitry Andric }
860bdd1243dSDimitry Andric static __inline__ int __attribute__((__always_inline__, __nodebug__, target("rand")))
__rndrrs(uint64_t * __p)861fe6060f1SDimitry Andric __rndrrs(uint64_t *__p) {
862fe6060f1SDimitry Andric return __builtin_arm_rndrrs(__p);
863fe6060f1SDimitry Andric }
864fe6060f1SDimitry Andric #endif
865fe6060f1SDimitry Andric
866*0fca6ea1SDimitry Andric /* 11.2 Guarded Control Stack intrinsics */
867*0fca6ea1SDimitry Andric #if defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE
868*0fca6ea1SDimitry Andric static __inline__ void * __attribute__((__always_inline__, __nodebug__))
__gcspr()869*0fca6ea1SDimitry Andric __gcspr() {
870*0fca6ea1SDimitry Andric return (void *)__builtin_arm_rsr64("gcspr_el0");
871*0fca6ea1SDimitry Andric }
872*0fca6ea1SDimitry Andric
873*0fca6ea1SDimitry Andric static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__, target("gcs")))
__gcspopm()874*0fca6ea1SDimitry Andric __gcspopm() {
875*0fca6ea1SDimitry Andric return __builtin_arm_gcspopm(0);
876*0fca6ea1SDimitry Andric }
877*0fca6ea1SDimitry Andric
878*0fca6ea1SDimitry Andric static __inline__ const void * __attribute__((__always_inline__, __nodebug__, target("gcs")))
__gcsss(const void * __stack)879*0fca6ea1SDimitry Andric __gcsss(const void *__stack) {
880*0fca6ea1SDimitry Andric return __builtin_arm_gcsss(__stack);
881*0fca6ea1SDimitry Andric }
882*0fca6ea1SDimitry Andric #endif
883*0fca6ea1SDimitry Andric
8840b57cec5SDimitry Andric #if defined(__cplusplus)
8850b57cec5SDimitry Andric }
8860b57cec5SDimitry Andric #endif
8870b57cec5SDimitry Andric
8880b57cec5SDimitry Andric #endif /* __ARM_ACLE_H */
889