4
4
* See https://llvm.org/LICENSE.txt for license information.
5
5
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
6
*
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
+ *
7
14
*===-----------------------------------------------------------------------===
8
15
*/
9
16
20
27
extern "C" {
21
28
#endif
22
29
23
- /* 8 SYNCHRONIZATION, BARRIER AND HINT INTRINSICS */
24
- /* 8 .3 Memory barriers */
30
+ /* 7 SYNCHRONIZATION, BARRIER AND HINT INTRINSICS */
31
+ /* 7 .3 Memory barriers */
25
32
#if !__has_builtin (__dmb )
26
33
#define __dmb (i ) __builtin_arm_dmb(i)
27
34
#endif
@@ -32,7 +39,7 @@ extern "C" {
32
39
#define __isb (i ) __builtin_arm_isb(i)
33
40
#endif
34
41
35
- /* 8 .4 Hints */
42
+ /* 7 .4 Hints */
36
43
37
44
#if !__has_builtin (__wfi )
38
45
static __inline__ void __attribute__((__always_inline__ , __nodebug__ )) __wfi (void ) {
@@ -68,7 +75,7 @@ static __inline__ void __attribute__((__always_inline__, __nodebug__)) __yield(v
68
75
#define __dbg (t ) __builtin_arm_dbg(t)
69
76
#endif
70
77
71
- /* 8 .5 Swap */
78
+ /* 7 .5 Swap */
72
79
static __inline__ uint32_t __attribute__((__always_inline__ , __nodebug__ ))
73
80
__swp (uint32_t __x , volatile uint32_t * __p ) {
74
81
uint32_t v ;
@@ -78,8 +85,8 @@ __swp(uint32_t __x, volatile uint32_t *__p) {
78
85
return v ;
79
86
}
80
87
81
- /* 8 .6 Memory prefetch intrinsics */
82
- /* 8 .6.1 Data prefetch */
88
+ /* 7 .6 Memory prefetch intrinsics */
89
+ /* 7 .6.1 Data prefetch */
83
90
#define __pld (addr ) __pldx(0, 0, 0, addr)
84
91
85
92
#if defined(__ARM_32BIT_STATE ) && __ARM_32BIT_STATE
@@ -90,7 +97,7 @@ __swp(uint32_t __x, volatile uint32_t *__p) {
90
97
__builtin_arm_prefetch(addr, access_kind, cache_level, retention_policy, 1)
91
98
#endif
92
99
93
- /* 8 .6.2 Instruction prefetch */
100
+ /* 7 .6.2 Instruction prefetch */
94
101
#define __pli (addr ) __plix(0, 0, addr)
95
102
96
103
#if defined(__ARM_32BIT_STATE ) && __ARM_32BIT_STATE
@@ -101,15 +108,15 @@ __swp(uint32_t __x, volatile uint32_t *__p) {
101
108
__builtin_arm_prefetch(addr, 0, cache_level, retention_policy, 0)
102
109
#endif
103
110
104
- /* 8 .7 NOP */
111
+ /* 7 .7 NOP */
105
112
#if !defined(_MSC_VER ) || !defined(__aarch64__ )
106
113
static __inline__ void __attribute__((__always_inline__ , __nodebug__ )) __nop (void ) {
107
114
__builtin_arm_nop ();
108
115
}
109
116
#endif
110
117
111
- /* 9 DATA-PROCESSING INTRINSICS */
112
- /* 9 .2 Miscellaneous data-processing intrinsics */
118
+ /* 8 DATA-PROCESSING INTRINSICS */
119
+ /* 8 .2 Miscellaneous data-processing intrinsics */
113
120
/* ROR */
114
121
static __inline__ uint32_t __attribute__((__always_inline__ , __nodebug__ ))
115
122
__ror (uint32_t __x , uint32_t __y ) {
@@ -248,9 +255,7 @@ __rbitl(unsigned long __t) {
248
255
#endif
249
256
}
250
257
251
- /*
252
- * 9.3 16-bit multiplications
253
- */
258
+ /* 8.3 16-bit multiplications */
254
259
#if defined(__ARM_FEATURE_DSP ) && __ARM_FEATURE_DSP
255
260
static __inline__ int32_t __attribute__((__always_inline__ ,__nodebug__ ))
256
261
__smulbb (int32_t __a , int32_t __b ) {
@@ -279,18 +284,18 @@ __smulwt(int32_t __a, int32_t __b) {
279
284
#endif
280
285
281
286
/*
282
- * 9 .4 Saturating intrinsics
287
+ * 8 .4 Saturating intrinsics
283
288
*
284
289
* FIXME: Change guard to their corresponding __ARM_FEATURE flag when Q flag
285
290
* intrinsics are implemented and the flag is enabled.
286
291
*/
287
- /* 9 .4.1 Width-specified saturation intrinsics */
292
+ /* 8 .4.1 Width-specified saturation intrinsics */
288
293
#if defined(__ARM_FEATURE_SAT ) && __ARM_FEATURE_SAT
289
294
#define __ssat (x , y ) __builtin_arm_ssat(x, y)
290
295
#define __usat (x , y ) __builtin_arm_usat(x, y)
291
296
#endif
292
297
293
- /* 9 .4.2 Saturating addition and subtraction intrinsics */
298
+ /* 8 .4.2 Saturating addition and subtraction intrinsics */
294
299
#if defined(__ARM_FEATURE_DSP ) && __ARM_FEATURE_DSP
295
300
static __inline__ int32_t __attribute__((__always_inline__ , __nodebug__ ))
296
301
__qadd (int32_t __t , int32_t __v ) {
@@ -308,7 +313,7 @@ __qdbl(int32_t __t) {
308
313
}
309
314
#endif
310
315
311
- /* 9 .4.3 Accumultating multiplications */
316
+ /* 8 .4.3 Accumultating multiplications */
312
317
#if defined(__ARM_FEATURE_DSP ) && __ARM_FEATURE_DSP
313
318
static __inline__ int32_t __attribute__((__always_inline__ , __nodebug__ ))
314
319
__smlabb (int32_t __a , int32_t __b , int32_t __c ) {
@@ -337,13 +342,13 @@ __smlawt(int32_t __a, int32_t __b, int32_t __c) {
337
342
#endif
338
343
339
344
340
- /* 9 .5.4 Parallel 16-bit saturation */
345
+ /* 8 .5.4 Parallel 16-bit saturation */
341
346
#if defined(__ARM_FEATURE_SIMD32 ) && __ARM_FEATURE_SIMD32
342
347
#define __ssat16 (x , y ) __builtin_arm_ssat16(x, y)
343
348
#define __usat16 (x , y ) __builtin_arm_usat16(x, y)
344
349
#endif
345
350
346
- /* 9 .5.5 Packing and unpacking */
351
+ /* 8 .5.5 Packing and unpacking */
347
352
#if defined(__ARM_FEATURE_SIMD32 ) && __ARM_FEATURE_SIMD32
348
353
typedef int32_t int8x4_t ;
349
354
typedef int32_t int16x2_t ;
@@ -368,15 +373,15 @@ __uxtb16(int8x4_t __a) {
368
373
}
369
374
#endif
370
375
371
- /* 9 .5.6 Parallel selection */
376
+ /* 8 .5.6 Parallel selection */
372
377
#if defined(__ARM_FEATURE_SIMD32 ) && __ARM_FEATURE_SIMD32
373
378
static __inline__ uint8x4_t __attribute__((__always_inline__ , __nodebug__ ))
374
379
__sel (uint8x4_t __a , uint8x4_t __b ) {
375
380
return __builtin_arm_sel (__a , __b );
376
381
}
377
382
#endif
378
383
379
- /* 9 .5.7 Parallel 8-bit addition and subtraction */
384
+ /* 8 .5.7 Parallel 8-bit addition and subtraction */
380
385
#if defined(__ARM_FEATURE_SIMD32 ) && __ARM_FEATURE_SIMD32
381
386
static __inline__ int8x4_t __attribute__((__always_inline__ , __nodebug__ ))
382
387
__qadd8 (int8x4_t __a , int8x4_t __b ) {
@@ -428,7 +433,7 @@ __usub8(uint8x4_t __a, uint8x4_t __b) {
428
433
}
429
434
#endif
430
435
431
- /* 9 .5.8 Sum of 8-bit absolute differences */
436
+ /* 8 .5.8 Sum of 8-bit absolute differences */
432
437
#if defined(__ARM_FEATURE_SIMD32 ) && __ARM_FEATURE_SIMD32
433
438
static __inline__ uint32_t __attribute__((__always_inline__ , __nodebug__ ))
434
439
__usad8 (uint8x4_t __a , uint8x4_t __b ) {
@@ -440,7 +445,7 @@ __usada8(uint8x4_t __a, uint8x4_t __b, uint32_t __c) {
440
445
}
441
446
#endif
442
447
443
- /* 9 .5.9 Parallel 16-bit addition and subtraction */
448
+ /* 8 .5.9 Parallel 16-bit addition and subtraction */
444
449
#if defined(__ARM_FEATURE_SIMD32 ) && __ARM_FEATURE_SIMD32
445
450
static __inline__ int16x2_t __attribute__((__always_inline__ , __nodebug__ ))
446
451
__qadd16 (int16x2_t __a , int16x2_t __b ) {
@@ -540,7 +545,7 @@ __usub16(uint16x2_t __a, uint16x2_t __b) {
540
545
}
541
546
#endif
542
547
543
- /* 9 .5.10 Parallel 16-bit multiplications */
548
+ /* 8 .5.10 Parallel 16-bit multiplications */
544
549
#if defined(__ARM_FEATURE_SIMD32 ) && __ARM_FEATURE_SIMD32
545
550
static __inline__ int32_t __attribute__((__always_inline__ , __nodebug__ ))
546
551
__smlad (int16x2_t __a , int16x2_t __b , int32_t __c ) {
@@ -607,7 +612,7 @@ __rintnf(float __a) {
607
612
}
608
613
#endif
609
614
610
- /* 9.7 CRC32 intrinsics */
615
+ /* 8.8 CRC32 intrinsics */
611
616
#if (defined(__ARM_FEATURE_CRC32 ) && __ARM_FEATURE_CRC32 ) || \
612
617
(defined(__ARM_64BIT_STATE ) && __ARM_64BIT_STATE )
613
618
static __inline__ uint32_t __attribute__((__always_inline__ , __nodebug__ , target ("crc" )))
@@ -651,6 +656,7 @@ __crc32cd(uint32_t __a, uint64_t __b) {
651
656
}
652
657
#endif
653
658
659
+ /* 8.6 Floating-point data-processing intrinsics */
654
660
/* Armv8.3-A Javascript conversion intrinsic */
655
661
#if defined(__ARM_64BIT_STATE ) && __ARM_64BIT_STATE
656
662
static __inline__ int32_t __attribute__((__always_inline__ , __nodebug__ , target ("v8.3a" )))
@@ -702,7 +708,7 @@ __rint64x(double __a) {
702
708
}
703
709
#endif
704
710
705
- /* Armv8.7-A load/store 64-byte intrinsics */
711
+ /* 8.9 Armv8.7-A load/store 64-byte intrinsics */
706
712
#if defined(__ARM_64BIT_STATE ) && __ARM_64BIT_STATE
707
713
typedef struct {
708
714
uint64_t val [8 ];
@@ -728,7 +734,7 @@ __arm_st64bv0(void *__addr, data512_t __value) {
728
734
}
729
735
#endif
730
736
731
- /* 10 .1 Special register intrinsics */
737
+ /* 11 .1 Special register intrinsics */
732
738
#define __arm_rsr (sysreg ) __builtin_arm_rsr(sysreg)
733
739
#define __arm_rsr64 (sysreg ) __builtin_arm_rsr64(sysreg)
734
740
#define __arm_rsr128 (sysreg ) __builtin_arm_rsr128(sysreg)
@@ -742,7 +748,7 @@ __arm_st64bv0(void *__addr, data512_t __value) {
742
748
#define __arm_wsrf (sysreg , v ) __arm_wsr(sysreg, __builtin_bit_cast(uint32_t, v))
743
749
#define __arm_wsrf64 (sysreg , v ) __arm_wsr64(sysreg, __builtin_bit_cast(uint64_t, v))
744
750
745
- /* Memory Tagging Extensions (MTE) Intrinsics */
751
+ /* 10.3 Memory Tagging Extensions (MTE) Intrinsics */
746
752
#if defined(__ARM_64BIT_STATE ) && __ARM_64BIT_STATE
747
753
#define __arm_mte_create_random_tag (__ptr , __mask ) __builtin_arm_irg(__ptr, __mask)
748
754
#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) {
751
757
#define __arm_mte_set_tag (__ptr ) __builtin_arm_stg(__ptr)
752
758
#define __arm_mte_ptrdiff (__ptra , __ptrb ) __builtin_arm_subp(__ptra, __ptrb)
753
759
754
- /* Memory Operations Intrinsics */
760
+ /* 18 Memory Operations Intrinsics */
755
761
#define __arm_mops_memset_tag (__tagged_address , __value , __size ) \
756
762
__builtin_arm_mops_memset_tag(__tagged_address, __value, __size)
757
763
#endif
758
764
759
- /* Coprocessor Intrinsics */
765
+ /* 11.3 Coprocessor Intrinsics */
760
766
#if defined(__ARM_FEATURE_COPROC )
761
767
762
768
#if (__ARM_FEATURE_COPROC & 0x1 )
@@ -815,7 +821,7 @@ __arm_st64bv0(void *__addr, data512_t __value) {
815
821
816
822
#endif // __ARM_FEATURE_COPROC
817
823
818
- /* Transactional Memory Extension (TME) Intrinsics */
824
+ /* 17 Transactional Memory Extension (TME) Intrinsics */
819
825
#if defined(__ARM_FEATURE_TME ) && __ARM_FEATURE_TME
820
826
821
827
#define _TMFAILURE_REASON 0x00007fffu
@@ -837,7 +843,7 @@ __arm_st64bv0(void *__addr, data512_t __value) {
837
843
838
844
#endif /* __ARM_FEATURE_TME */
839
845
840
- /* Armv8.5-A Random number generation intrinsics */
846
+ /* 8.7 Armv8.5-A Random number generation intrinsics */
841
847
#if defined(__ARM_64BIT_STATE ) && __ARM_64BIT_STATE
842
848
static __inline__ int __attribute__((__always_inline__ , __nodebug__ , target ("rand" )))
843
849
__rndr (uint64_t * __p ) {
0 commit comments