44 * See https://llvm.org/LICENSE.txt for license information.
55 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66 *
7+ * The Arm C Language Extensions specifications can be found in the following
8+ * link: https://github.com/ARM-software/acle/releases
9+ *
10+ * The ACLE section numbers are subject to change. When consulting the
11+ * specifications, it is recommended to search using section titles if
12+ * the section numbers look outdated.
13+ *
714 *===-----------------------------------------------------------------------===
815 */
916
2027extern "C" {
2128#endif
2229
23- /* 8 SYNCHRONIZATION, BARRIER AND HINT INTRINSICS */
24- /* 8 .3 Memory barriers */
30+ /* 7 SYNCHRONIZATION, BARRIER AND HINT INTRINSICS */
31+ /* 7 .3 Memory barriers */
2532#if !__has_builtin (__dmb )
2633#define __dmb (i ) __builtin_arm_dmb(i)
2734#endif
@@ -32,7 +39,7 @@ extern "C" {
3239#define __isb (i ) __builtin_arm_isb(i)
3340#endif
3441
35- /* 8 .4 Hints */
42+ /* 7 .4 Hints */
3643
3744#if !__has_builtin (__wfi )
3845static __inline__ void __attribute__((__always_inline__ , __nodebug__ )) __wfi (void ) {
@@ -68,7 +75,7 @@ static __inline__ void __attribute__((__always_inline__, __nodebug__)) __yield(v
6875#define __dbg (t ) __builtin_arm_dbg(t)
6976#endif
7077
71- /* 8 .5 Swap */
78+ /* 7 .5 Swap */
7279static __inline__ uint32_t __attribute__((__always_inline__ , __nodebug__ ))
7380__swp (uint32_t __x , volatile uint32_t * __p ) {
7481 uint32_t v ;
@@ -78,8 +85,8 @@ __swp(uint32_t __x, volatile uint32_t *__p) {
7885 return v ;
7986}
8087
81- /* 8 .6 Memory prefetch intrinsics */
82- /* 8 .6.1 Data prefetch */
88+ /* 7 .6 Memory prefetch intrinsics */
89+ /* 7 .6.1 Data prefetch */
8390#define __pld (addr ) __pldx(0, 0, 0, addr)
8491
8592#if defined(__ARM_32BIT_STATE ) && __ARM_32BIT_STATE
@@ -90,7 +97,7 @@ __swp(uint32_t __x, volatile uint32_t *__p) {
9097 __builtin_arm_prefetch(addr, access_kind, cache_level, retention_policy, 1)
9198#endif
9299
93- /* 8 .6.2 Instruction prefetch */
100+ /* 7 .6.2 Instruction prefetch */
94101#define __pli (addr ) __plix(0, 0, addr)
95102
96103#if defined(__ARM_32BIT_STATE ) && __ARM_32BIT_STATE
@@ -101,15 +108,15 @@ __swp(uint32_t __x, volatile uint32_t *__p) {
101108 __builtin_arm_prefetch(addr, 0, cache_level, retention_policy, 0)
102109#endif
103110
104- /* 8 .7 NOP */
111+ /* 7 .7 NOP */
105112#if !defined(_MSC_VER ) || !defined(__aarch64__ )
106113static __inline__ void __attribute__((__always_inline__ , __nodebug__ )) __nop (void ) {
107114 __builtin_arm_nop ();
108115}
109116#endif
110117
111- /* 9 DATA-PROCESSING INTRINSICS */
112- /* 9 .2 Miscellaneous data-processing intrinsics */
118+ /* 8 DATA-PROCESSING INTRINSICS */
119+ /* 8 .2 Miscellaneous data-processing intrinsics */
113120/* ROR */
114121static __inline__ uint32_t __attribute__((__always_inline__ , __nodebug__ ))
115122__ror (uint32_t __x , uint32_t __y ) {
@@ -248,9 +255,7 @@ __rbitl(unsigned long __t) {
248255#endif
249256}
250257
251- /*
252- * 9.3 16-bit multiplications
253- */
258+ /* 8.3 16-bit multiplications */
254259#if defined(__ARM_FEATURE_DSP ) && __ARM_FEATURE_DSP
255260static __inline__ int32_t __attribute__((__always_inline__ ,__nodebug__ ))
256261__smulbb (int32_t __a , int32_t __b ) {
@@ -279,18 +284,18 @@ __smulwt(int32_t __a, int32_t __b) {
279284#endif
280285
281286/*
282- * 9 .4 Saturating intrinsics
287+ * 8 .4 Saturating intrinsics
283288 *
284289 * FIXME: Change guard to their corresponding __ARM_FEATURE flag when Q flag
285290 * intrinsics are implemented and the flag is enabled.
286291 */
287- /* 9 .4.1 Width-specified saturation intrinsics */
292+ /* 8 .4.1 Width-specified saturation intrinsics */
288293#if defined(__ARM_FEATURE_SAT ) && __ARM_FEATURE_SAT
289294#define __ssat (x , y ) __builtin_arm_ssat(x, y)
290295#define __usat (x , y ) __builtin_arm_usat(x, y)
291296#endif
292297
293- /* 9 .4.2 Saturating addition and subtraction intrinsics */
298+ /* 8 .4.2 Saturating addition and subtraction intrinsics */
294299#if defined(__ARM_FEATURE_DSP ) && __ARM_FEATURE_DSP
295300static __inline__ int32_t __attribute__((__always_inline__ , __nodebug__ ))
296301__qadd (int32_t __t , int32_t __v ) {
@@ -308,7 +313,7 @@ __qdbl(int32_t __t) {
308313}
309314#endif
310315
311- /* 9 .4.3 Accumultating multiplications */
316+ /* 8 .4.3 Accumultating multiplications */
312317#if defined(__ARM_FEATURE_DSP ) && __ARM_FEATURE_DSP
313318static __inline__ int32_t __attribute__((__always_inline__ , __nodebug__ ))
314319__smlabb (int32_t __a , int32_t __b , int32_t __c ) {
@@ -337,13 +342,13 @@ __smlawt(int32_t __a, int32_t __b, int32_t __c) {
337342#endif
338343
339344
340- /* 9 .5.4 Parallel 16-bit saturation */
345+ /* 8 .5.4 Parallel 16-bit saturation */
341346#if defined(__ARM_FEATURE_SIMD32 ) && __ARM_FEATURE_SIMD32
342347#define __ssat16 (x , y ) __builtin_arm_ssat16(x, y)
343348#define __usat16 (x , y ) __builtin_arm_usat16(x, y)
344349#endif
345350
346- /* 9 .5.5 Packing and unpacking */
351+ /* 8 .5.5 Packing and unpacking */
347352#if defined(__ARM_FEATURE_SIMD32 ) && __ARM_FEATURE_SIMD32
348353typedef int32_t int8x4_t ;
349354typedef int32_t int16x2_t ;
@@ -368,15 +373,15 @@ __uxtb16(int8x4_t __a) {
368373}
369374#endif
370375
371- /* 9 .5.6 Parallel selection */
376+ /* 8 .5.6 Parallel selection */
372377#if defined(__ARM_FEATURE_SIMD32 ) && __ARM_FEATURE_SIMD32
373378static __inline__ uint8x4_t __attribute__((__always_inline__ , __nodebug__ ))
374379__sel (uint8x4_t __a , uint8x4_t __b ) {
375380 return __builtin_arm_sel (__a , __b );
376381}
377382#endif
378383
379- /* 9 .5.7 Parallel 8-bit addition and subtraction */
384+ /* 8 .5.7 Parallel 8-bit addition and subtraction */
380385#if defined(__ARM_FEATURE_SIMD32 ) && __ARM_FEATURE_SIMD32
381386static __inline__ int8x4_t __attribute__((__always_inline__ , __nodebug__ ))
382387__qadd8 (int8x4_t __a , int8x4_t __b ) {
@@ -428,7 +433,7 @@ __usub8(uint8x4_t __a, uint8x4_t __b) {
428433}
429434#endif
430435
431- /* 9 .5.8 Sum of 8-bit absolute differences */
436+ /* 8 .5.8 Sum of 8-bit absolute differences */
432437#if defined(__ARM_FEATURE_SIMD32 ) && __ARM_FEATURE_SIMD32
433438static __inline__ uint32_t __attribute__((__always_inline__ , __nodebug__ ))
434439__usad8 (uint8x4_t __a , uint8x4_t __b ) {
@@ -440,7 +445,7 @@ __usada8(uint8x4_t __a, uint8x4_t __b, uint32_t __c) {
440445}
441446#endif
442447
443- /* 9 .5.9 Parallel 16-bit addition and subtraction */
448+ /* 8 .5.9 Parallel 16-bit addition and subtraction */
444449#if defined(__ARM_FEATURE_SIMD32 ) && __ARM_FEATURE_SIMD32
445450static __inline__ int16x2_t __attribute__((__always_inline__ , __nodebug__ ))
446451__qadd16 (int16x2_t __a , int16x2_t __b ) {
@@ -540,7 +545,7 @@ __usub16(uint16x2_t __a, uint16x2_t __b) {
540545}
541546#endif
542547
543- /* 9 .5.10 Parallel 16-bit multiplications */
548+ /* 8 .5.10 Parallel 16-bit multiplications */
544549#if defined(__ARM_FEATURE_SIMD32 ) && __ARM_FEATURE_SIMD32
545550static __inline__ int32_t __attribute__((__always_inline__ , __nodebug__ ))
546551__smlad (int16x2_t __a , int16x2_t __b , int32_t __c ) {
@@ -607,7 +612,7 @@ __rintnf(float __a) {
607612}
608613#endif
609614
610- /* 9.7 CRC32 intrinsics */
615+ /* 8.8 CRC32 intrinsics */
611616#if (defined(__ARM_FEATURE_CRC32 ) && __ARM_FEATURE_CRC32 ) || \
612617 (defined(__ARM_64BIT_STATE ) && __ARM_64BIT_STATE )
613618static __inline__ uint32_t __attribute__((__always_inline__ , __nodebug__ , target ("crc" )))
@@ -651,6 +656,7 @@ __crc32cd(uint32_t __a, uint64_t __b) {
651656}
652657#endif
653658
659+ /* 8.6 Floating-point data-processing intrinsics */
654660/* Armv8.3-A Javascript conversion intrinsic */
655661#if defined(__ARM_64BIT_STATE ) && __ARM_64BIT_STATE
656662static __inline__ int32_t __attribute__((__always_inline__ , __nodebug__ , target ("v8.3a" )))
@@ -702,7 +708,7 @@ __rint64x(double __a) {
702708}
703709#endif
704710
705- /* Armv8.7-A load/store 64-byte intrinsics */
711+ /* 8.9 Armv8.7-A load/store 64-byte intrinsics */
706712#if defined(__ARM_64BIT_STATE ) && __ARM_64BIT_STATE
707713typedef struct {
708714 uint64_t val [8 ];
@@ -728,7 +734,7 @@ __arm_st64bv0(void *__addr, data512_t __value) {
728734}
729735#endif
730736
731- /* 10 .1 Special register intrinsics */
737+ /* 11 .1 Special register intrinsics */
732738#define __arm_rsr (sysreg ) __builtin_arm_rsr(sysreg)
733739#define __arm_rsr64 (sysreg ) __builtin_arm_rsr64(sysreg)
734740#define __arm_rsr128 (sysreg ) __builtin_arm_rsr128(sysreg)
@@ -742,7 +748,7 @@ __arm_st64bv0(void *__addr, data512_t __value) {
742748#define __arm_wsrf (sysreg , v ) __arm_wsr(sysreg, __builtin_bit_cast(uint32_t, v))
743749#define __arm_wsrf64 (sysreg , v ) __arm_wsr64(sysreg, __builtin_bit_cast(uint64_t, v))
744750
745- /* Memory Tagging Extensions (MTE) Intrinsics */
751+ /* 10.3 Memory Tagging Extensions (MTE) Intrinsics */
746752#if defined(__ARM_64BIT_STATE ) && __ARM_64BIT_STATE
747753#define __arm_mte_create_random_tag (__ptr , __mask ) __builtin_arm_irg(__ptr, __mask)
748754#define __arm_mte_increment_tag (__ptr , __tag_offset ) __builtin_arm_addg(__ptr, __tag_offset)
@@ -751,12 +757,12 @@ __arm_st64bv0(void *__addr, data512_t __value) {
751757#define __arm_mte_set_tag (__ptr ) __builtin_arm_stg(__ptr)
752758#define __arm_mte_ptrdiff (__ptra , __ptrb ) __builtin_arm_subp(__ptra, __ptrb)
753759
754- /* Memory Operations Intrinsics */
760+ /* 18 Memory Operations Intrinsics */
755761#define __arm_mops_memset_tag (__tagged_address , __value , __size ) \
756762 __builtin_arm_mops_memset_tag(__tagged_address, __value, __size)
757763#endif
758764
759- /* Coprocessor Intrinsics */
765+ /* 11.3 Coprocessor Intrinsics */
760766#if defined(__ARM_FEATURE_COPROC )
761767
762768#if (__ARM_FEATURE_COPROC & 0x1 )
@@ -815,7 +821,7 @@ __arm_st64bv0(void *__addr, data512_t __value) {
815821
816822#endif // __ARM_FEATURE_COPROC
817823
818- /* Transactional Memory Extension (TME) Intrinsics */
824+ /* 17 Transactional Memory Extension (TME) Intrinsics */
819825#if defined(__ARM_FEATURE_TME ) && __ARM_FEATURE_TME
820826
821827#define _TMFAILURE_REASON 0x00007fffu
@@ -837,7 +843,7 @@ __arm_st64bv0(void *__addr, data512_t __value) {
837843
838844#endif /* __ARM_FEATURE_TME */
839845
840- /* Armv8.5-A Random number generation intrinsics */
846+ /* 8.7 Armv8.5-A Random number generation intrinsics */
841847#if defined(__ARM_64BIT_STATE ) && __ARM_64BIT_STATE
842848static __inline__ int __attribute__((__always_inline__ , __nodebug__ , target ("rand" )))
843849__rndr (uint64_t * __p ) {
0 commit comments