1 /* ARM Non-NEON ACLE intrinsics include file.
2 
3    Copyright (C) 2013-2018 Free Software Foundation, Inc.
4    Contributed by ARM Ltd.
5 
6    This file is part of GCC.
7 
8    GCC is free software; you can redistribute it and/or modify it
9    under the terms of the GNU General Public License as published
10    by the Free Software Foundation; either version 3, or (at your
11    option) any later version.
12 
13    GCC is distributed in the hope that it will be useful, but WITHOUT
14    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16    License for more details.
17 
18    Under Section 7 of GPL version 3, you are granted additional
19    permissions described in the GCC Runtime Library Exception, version
20    3.1, as published by the Free Software Foundation.
21 
22    You should have received a copy of the GNU General Public License and
23    a copy of the GCC Runtime Library Exception along with this program;
24    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
25    <http://www.gnu.org/licenses/>.  */
26 
27 #ifndef _GCC_ARM_ACLE_H
28 #define _GCC_ARM_ACLE_H
29 
30 #include <stdint.h>
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #if (!__thumb__ || __thumb2__) &&  __ARM_ARCH >= 4
36 __extension__ static __inline void __attribute__ ((__always_inline__))
__arm_cdp(const unsigned int __coproc,const unsigned int __opc1,const unsigned int __CRd,const unsigned int __CRn,const unsigned int __CRm,const unsigned int __opc2)37 __arm_cdp (const unsigned int __coproc, const unsigned int __opc1,
38 	   const unsigned int __CRd, const unsigned int __CRn,
39 	   const unsigned int __CRm, const unsigned int __opc2)
40 {
41   __builtin_arm_cdp (__coproc, __opc1, __CRd, __CRn, __CRm, __opc2);
42 }
43 
44 __extension__ static __inline void __attribute__ ((__always_inline__))
__arm_ldc(const unsigned int __coproc,const unsigned int __CRd,const void * __p)45 __arm_ldc (const unsigned int __coproc, const unsigned int __CRd,
46 	   const void * __p)
47 {
48   __builtin_arm_ldc (__coproc, __CRd, __p);
49 }
50 
51 __extension__ static __inline void __attribute__ ((__always_inline__))
__arm_ldcl(const unsigned int __coproc,const unsigned int __CRd,const void * __p)52 __arm_ldcl (const unsigned int __coproc, const unsigned int __CRd,
53 	    const void * __p)
54 {
55   __builtin_arm_ldcl (__coproc, __CRd, __p);
56 }
57 
58 __extension__ static __inline void __attribute__ ((__always_inline__))
__arm_stc(const unsigned int __coproc,const unsigned int __CRd,void * __p)59 __arm_stc (const unsigned int __coproc, const unsigned int __CRd,
60 	   void * __p)
61 {
62   __builtin_arm_stc (__coproc, __CRd, __p);
63 }
64 
65 __extension__ static __inline void __attribute__ ((__always_inline__))
__arm_stcl(const unsigned int __coproc,const unsigned int __CRd,void * __p)66 __arm_stcl (const unsigned int __coproc, const unsigned int __CRd,
67 	    void * __p)
68 {
69   __builtin_arm_stcl (__coproc, __CRd, __p);
70 }
71 
72 __extension__ static __inline void __attribute__ ((__always_inline__))
__arm_mcr(const unsigned int __coproc,const unsigned int __opc1,uint32_t __value,const unsigned int __CRn,const unsigned int __CRm,const unsigned int __opc2)73 __arm_mcr (const unsigned int __coproc, const unsigned int __opc1,
74 	   uint32_t __value, const unsigned int __CRn, const unsigned int __CRm,
75 	   const unsigned int __opc2)
76 {
77   __builtin_arm_mcr (__coproc, __opc1, __value, __CRn, __CRm, __opc2);
78 }
79 
80 __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
__arm_mrc(const unsigned int __coproc,const unsigned int __opc1,const unsigned int __CRn,const unsigned int __CRm,const unsigned int __opc2)81 __arm_mrc (const unsigned int __coproc, const unsigned int __opc1,
82 	   const unsigned int __CRn, const unsigned int __CRm,
83 	   const unsigned int __opc2)
84 {
85   return __builtin_arm_mrc (__coproc, __opc1, __CRn, __CRm, __opc2);
86 }
87 #if __ARM_ARCH >= 5
88 __extension__ static __inline void __attribute__ ((__always_inline__))
__arm_cdp2(const unsigned int __coproc,const unsigned int __opc1,const unsigned int __CRd,const unsigned int __CRn,const unsigned int __CRm,const unsigned int __opc2)89 __arm_cdp2 (const unsigned int __coproc, const unsigned int __opc1,
90 	    const unsigned int __CRd, const unsigned int __CRn,
91 	    const unsigned int __CRm, const unsigned int __opc2)
92 {
93   __builtin_arm_cdp2 (__coproc, __opc1, __CRd, __CRn, __CRm, __opc2);
94 }
95 
96 __extension__ static __inline void __attribute__ ((__always_inline__))
__arm_ldc2(const unsigned int __coproc,const unsigned int __CRd,const void * __p)97 __arm_ldc2 (const unsigned int __coproc, const unsigned int __CRd,
98 	    const void * __p)
99 {
100   __builtin_arm_ldc2 (__coproc, __CRd, __p);
101 }
102 
103 __extension__ static __inline void __attribute__ ((__always_inline__))
__arm_ldc2l(const unsigned int __coproc,const unsigned int __CRd,const void * __p)104 __arm_ldc2l (const unsigned int __coproc, const unsigned int __CRd,
105 	     const void * __p)
106 {
107   __builtin_arm_ldc2l (__coproc, __CRd, __p);
108 }
109 
110 __extension__ static __inline void __attribute__ ((__always_inline__))
__arm_stc2(const unsigned int __coproc,const unsigned int __CRd,void * __p)111 __arm_stc2 (const unsigned int __coproc, const unsigned int __CRd,
112 	    void * __p)
113 {
114   __builtin_arm_stc2 (__coproc, __CRd, __p);
115 }
116 
117 __extension__ static __inline void __attribute__ ((__always_inline__))
__arm_stc2l(const unsigned int __coproc,const unsigned int __CRd,void * __p)118 __arm_stc2l (const unsigned int __coproc, const unsigned int __CRd,
119 	     void * __p)
120 {
121   __builtin_arm_stc2l (__coproc, __CRd, __p);
122 }
123 
124 __extension__ static __inline void __attribute__ ((__always_inline__))
__arm_mcr2(const unsigned int __coproc,const unsigned int __opc1,uint32_t __value,const unsigned int __CRn,const unsigned int __CRm,const unsigned int __opc2)125 __arm_mcr2 (const unsigned int __coproc, const unsigned int __opc1,
126 	    uint32_t __value, const unsigned int __CRn,
127 	    const unsigned int __CRm, const unsigned int __opc2)
128 {
129   __builtin_arm_mcr2 (__coproc, __opc1, __value, __CRn, __CRm, __opc2);
130 }
131 
132 __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
__arm_mrc2(const unsigned int __coproc,const unsigned int __opc1,const unsigned int __CRn,const unsigned int __CRm,const unsigned int __opc2)133 __arm_mrc2 (const unsigned int __coproc, const unsigned int __opc1,
134 	    const unsigned int __CRn, const unsigned int __CRm,
135 	    const unsigned int __opc2)
136 {
137   return __builtin_arm_mrc2 (__coproc, __opc1, __CRn, __CRm, __opc2);
138 }
139 
140 #if __ARM_ARCH >= 6 ||  defined (__ARM_ARCH_5TE__)
141 
142 __extension__ static __inline void __attribute__ ((__always_inline__))
__arm_mcrr(const unsigned int __coproc,const unsigned int __opc1,uint64_t __value,const unsigned int __CRm)143 __arm_mcrr (const unsigned int __coproc, const unsigned int __opc1,
144 	    uint64_t __value, const unsigned int __CRm)
145 {
146   __builtin_arm_mcrr (__coproc, __opc1, __value, __CRm);
147 }
148 
149 __extension__ static __inline uint64_t __attribute__ ((__always_inline__))
__arm_mrrc(const unsigned int __coproc,const unsigned int __opc1,const unsigned int __CRm)150 __arm_mrrc (const unsigned int __coproc, const unsigned int __opc1,
151 	    const unsigned int __CRm)
152 {
153   return __builtin_arm_mrrc (__coproc, __opc1, __CRm);
154 }
155 
156 #if __ARM_ARCH >= 6
157 
158 __extension__ static __inline void __attribute__ ((__always_inline__))
__arm_mcrr2(const unsigned int __coproc,const unsigned int __opc1,uint64_t __value,const unsigned int __CRm)159 __arm_mcrr2 (const unsigned int __coproc, const unsigned int __opc1,
160 	    uint64_t __value, const unsigned int __CRm)
161 {
162   __builtin_arm_mcrr2 (__coproc, __opc1, __value, __CRm);
163 }
164 
165 __extension__ static __inline uint64_t __attribute__ ((__always_inline__))
__arm_mrrc2(const unsigned int __coproc,const unsigned int __opc1,const unsigned int __CRm)166 __arm_mrrc2 (const unsigned int __coproc, const unsigned int __opc1,
167 	     const unsigned int __CRm)
168 {
169   return __builtin_arm_mrrc2 (__coproc, __opc1,  __CRm);
170 }
171 #endif /* __ARM_ARCH >= 6.  */
172 #endif /* __ARM_ARCH >= 6 ||  defined (__ARM_ARCH_5TE__).  */
173 #endif /*  __ARM_ARCH >= 5.  */
174 #endif /* (!__thumb__ || __thumb2__) &&  __ARM_ARCH >= 4.  */
175 
176 #pragma GCC push_options
177 #ifdef __ARM_FEATURE_CRC32
178 #ifdef __ARM_FP
179 #pragma GCC target ("arch=armv8-a+crc+simd")
180 #else
181 #pragma GCC target ("arch=armv8-a+crc")
182 #endif
183 
184 __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
__crc32b(uint32_t __a,uint8_t __b)185 __crc32b (uint32_t __a, uint8_t __b)
186 {
187   return __builtin_arm_crc32b (__a, __b);
188 }
189 
190 __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
__crc32h(uint32_t __a,uint16_t __b)191 __crc32h (uint32_t __a, uint16_t __b)
192 {
193   return __builtin_arm_crc32h (__a, __b);
194 }
195 
196 __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
__crc32w(uint32_t __a,uint32_t __b)197 __crc32w (uint32_t __a, uint32_t __b)
198 {
199   return __builtin_arm_crc32w (__a, __b);
200 }
201 
202 #ifdef __ARM_32BIT_STATE
203 __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
__crc32d(uint32_t __a,uint64_t __b)204 __crc32d (uint32_t __a, uint64_t __b)
205 {
206   uint32_t __d;
207 
208   __d = __crc32w (__crc32w (__a, __b & 0xffffffffULL), __b >> 32);
209   return __d;
210 }
211 #endif
212 
213 __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
__crc32cb(uint32_t __a,uint8_t __b)214 __crc32cb (uint32_t __a, uint8_t __b)
215 {
216   return __builtin_arm_crc32cb (__a, __b);
217 }
218 
219 __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
__crc32ch(uint32_t __a,uint16_t __b)220 __crc32ch (uint32_t __a, uint16_t __b)
221 {
222   return __builtin_arm_crc32ch (__a, __b);
223 }
224 
225 __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
__crc32cw(uint32_t __a,uint32_t __b)226 __crc32cw (uint32_t __a, uint32_t __b)
227 {
228   return __builtin_arm_crc32cw (__a, __b);
229 }
230 
231 #ifdef __ARM_32BIT_STATE
232 __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
__crc32cd(uint32_t __a,uint64_t __b)233 __crc32cd (uint32_t __a, uint64_t __b)
234 {
235   uint32_t __d;
236 
237   __d = __crc32cw (__crc32cw (__a, __b & 0xffffffffULL), __b >> 32);
238   return __d;
239 }
240 #endif
241 
242 #endif /* __ARM_FEATURE_CRC32  */
243 #pragma GCC pop_options
244 
245 #ifdef __cplusplus
246 }
247 #endif
248 
249 #endif
250