xref: /linux/arch/arm/include/asm/neon-intrinsics.h (revision 0eaed89c18aeedf0898baf2dbf5ff027c6795152)
1*4156e656SArd Biesheuvel /* SPDX-License-Identifier: GPL-2.0-only */
2*4156e656SArd Biesheuvel 
3*4156e656SArd Biesheuvel #ifndef __ASM_NEON_INTRINSICS_H
4*4156e656SArd Biesheuvel #define __ASM_NEON_INTRINSICS_H
5*4156e656SArd Biesheuvel 
6*4156e656SArd Biesheuvel #ifndef __ARM_NEON__
7*4156e656SArd Biesheuvel #error You should compile this file with '-march=armv7-a -mfloat-abi=softfp -mfpu=neon'
8*4156e656SArd Biesheuvel #endif
9*4156e656SArd Biesheuvel 
10*4156e656SArd Biesheuvel #include <asm-generic/int-ll64.h>
11*4156e656SArd Biesheuvel 
12*4156e656SArd Biesheuvel /*
13*4156e656SArd Biesheuvel  * The C99 types uintXX_t that are usually defined in 'stdint.h' are not as
14*4156e656SArd Biesheuvel  * unambiguous on ARM as you would expect. For the types below, there is a
15*4156e656SArd Biesheuvel  * difference on ARM between GCC built for bare metal ARM, GCC built for glibc
16*4156e656SArd Biesheuvel  * and the kernel itself, which results in build errors if you try to build
17*4156e656SArd Biesheuvel  * with -ffreestanding and include 'stdint.h' (such as when you include
18*4156e656SArd Biesheuvel  * 'arm_neon.h' in order to use NEON intrinsics)
19*4156e656SArd Biesheuvel  *
20*4156e656SArd Biesheuvel  * As the typedefs for these types in 'stdint.h' are based on builtin defines
21*4156e656SArd Biesheuvel  * supplied by GCC, we can tweak these to align with the kernel's idea of those
22*4156e656SArd Biesheuvel  * types, so 'linux/types.h' and 'stdint.h' can be safely included from the
23*4156e656SArd Biesheuvel  * same source file (provided that -ffreestanding is used).
24*4156e656SArd Biesheuvel  *
25*4156e656SArd Biesheuvel  *                    int32_t     uint32_t          intptr_t     uintptr_t
26*4156e656SArd Biesheuvel  * bare metal GCC     long        unsigned long     int          unsigned int
27*4156e656SArd Biesheuvel  * glibc GCC          int         unsigned int      int          unsigned int
28*4156e656SArd Biesheuvel  * kernel             int         unsigned int      long         unsigned long
29*4156e656SArd Biesheuvel  */
30*4156e656SArd Biesheuvel 
31*4156e656SArd Biesheuvel #ifdef __INT32_TYPE__
32*4156e656SArd Biesheuvel #undef __INT32_TYPE__
33*4156e656SArd Biesheuvel #define __INT32_TYPE__		int
34*4156e656SArd Biesheuvel #endif
35*4156e656SArd Biesheuvel 
36*4156e656SArd Biesheuvel #ifdef __UINT32_TYPE__
37*4156e656SArd Biesheuvel #undef __UINT32_TYPE__
38*4156e656SArd Biesheuvel #define __UINT32_TYPE__		unsigned int
39*4156e656SArd Biesheuvel #endif
40*4156e656SArd Biesheuvel 
41*4156e656SArd Biesheuvel #ifdef __INTPTR_TYPE__
42*4156e656SArd Biesheuvel #undef __INTPTR_TYPE__
43*4156e656SArd Biesheuvel #define __INTPTR_TYPE__		long
44*4156e656SArd Biesheuvel #endif
45*4156e656SArd Biesheuvel 
46*4156e656SArd Biesheuvel #ifdef __UINTPTR_TYPE__
47*4156e656SArd Biesheuvel #undef __UINTPTR_TYPE__
48*4156e656SArd Biesheuvel #define __UINTPTR_TYPE__	unsigned long
49*4156e656SArd Biesheuvel #endif
50*4156e656SArd Biesheuvel 
51*4156e656SArd Biesheuvel /*
52*4156e656SArd Biesheuvel  * genksyms chokes on the ARM NEON instrinsics system header, but we
53*4156e656SArd Biesheuvel  * don't export anything it defines anyway, so just disregard when
54*4156e656SArd Biesheuvel  * genksyms execute.
55*4156e656SArd Biesheuvel  */
56*4156e656SArd Biesheuvel #ifndef __GENKSYMS__
57*4156e656SArd Biesheuvel #include <arm_neon.h>
58*4156e656SArd Biesheuvel #endif
59*4156e656SArd Biesheuvel 
60*4156e656SArd Biesheuvel #endif /* __ASM_NEON_INTRINSICS_H */
61