On Fri, May 17, 2013 at 11:17:07AM +0200, Ard Biesheuvel wrote:
The GCC support header for NEON intrinsics <arm_neon.h> cannot be included directly due to its dependency on <stdint.h>.
Add a header <asm/neon.h> that checks/tweaks the environment so <arm_neon.h> can be included without problems.
Hi Ard
AFAIK NEON intrinsics requires -mfpu=neon GCC option. I wonder if you have any approach to prevent code outside kernel_fpu_begin/kernel_fpu_end guards being optimized for VFP/NEON?
Personally I end up with two options while doing NEON optimized syndrome generation for RAID: * consolidate all NEON specific code into separate compilation unit, i.e. S-file * inline bare opcodes into C source
Vladimir Murzin
Signed-off-by: Ard Biesheuvel ard.biesheuvel@linaro.org
arch/arm/include/asm/neon.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 arch/arm/include/asm/neon.h
diff --git a/arch/arm/include/asm/neon.h b/arch/arm/include/asm/neon.h new file mode 100644 index 0000000..0f76dc3 --- /dev/null +++ b/arch/arm/include/asm/neon.h @@ -0,0 +1,44 @@ +/*
- linux/arch/arm/include/asm/neon.h
- Copyright (C) 2013 Linaro Ltd ard.biesheuvel@linaro.org
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation.
- */
+#ifndef _ASM_NEON_H +#define _ASM_NEON_H
+/*
- The GCC support header file for NEON intrinsics, <arm_neon.h>, does an
- unconditional #include of <stdint.h>, assuming it will never be used outside
- a C99 conformant environment. Sadly, this is not the case for the kernel.
- The only dependencies <arm_neon.h> has on <stdint.h> are the
- uint[8|16|32|64]_t types, which the kernel defines in <linux/types.h>.
- */
+#include <linux/types.h>
+/*
- The GCC option -ffreestanding prevents GCC's internal <stdint.h> from
- including the <stdint.h> system header, it will #include "stdint-gcc.h"
- instead.
- */
+#if __STDC_HOSTED__ != 0 +#error You must compile with -ffreestanding to use NEON intrinsics +#endif
+/*
- The type uintptr_t is typedef'ed to __UINTPTR_TYPE__ by "stdint-gcc.h".
- However, the bare metal and GLIBC versions of GCC don't agree on the
- definition of __UINTPTR_TYPE__. Bare metal agrees with the kernel
- (unsigned long), but GCC for GLIBC uses 'unsigned int' instead.
- */
+#ifdef __linux__ +#undef __UINTPTR_TYPE__ +#endif
+#include <arm_neon.h>
+#endif
1.8.1.2
linaro-kernel mailing list linaro-kernel@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-kernel