Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * linux/arch/arm/include/asm/neon.h
0004  *
0005  * Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
0006  */
0007 
0008 #include <asm/hwcap.h>
0009 
0010 #define cpu_has_neon()      (!!(elf_hwcap & HWCAP_NEON))
0011 
0012 #ifdef __ARM_NEON__
0013 
0014 /*
0015  * If you are affected by the BUILD_BUG below, it probably means that you are
0016  * using NEON code /and/ calling the kernel_neon_begin() function from the same
0017  * compilation unit. To prevent issues that may arise from GCC reordering or
0018  * generating(1) NEON instructions outside of these begin/end functions, the
0019  * only supported way of using NEON code in the kernel is by isolating it in a
0020  * separate compilation unit, and calling it from another unit from inside a
0021  * kernel_neon_begin/kernel_neon_end pair.
0022  *
0023  * (1) Current GCC (4.7) might generate NEON instructions at O3 level if
0024  *     -mpfu=neon is set.
0025  */
0026 
0027 #define kernel_neon_begin() \
0028     BUILD_BUG_ON_MSG(1, "kernel_neon_begin() called from NEON code")
0029 
0030 #else
0031 void kernel_neon_begin(void);
0032 #endif
0033 void kernel_neon_end(void);