162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * linux/arch/arm/include/asm/neon.h 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org> 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#include <asm/hwcap.h> 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#define cpu_has_neon() (!!(elf_hwcap & HWCAP_NEON)) 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#ifdef __ARM_NEON__ 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci/* 1562306a36Sopenharmony_ci * If you are affected by the BUILD_BUG below, it probably means that you are 1662306a36Sopenharmony_ci * using NEON code /and/ calling the kernel_neon_begin() function from the same 1762306a36Sopenharmony_ci * compilation unit. To prevent issues that may arise from GCC reordering or 1862306a36Sopenharmony_ci * generating(1) NEON instructions outside of these begin/end functions, the 1962306a36Sopenharmony_ci * only supported way of using NEON code in the kernel is by isolating it in a 2062306a36Sopenharmony_ci * separate compilation unit, and calling it from another unit from inside a 2162306a36Sopenharmony_ci * kernel_neon_begin/kernel_neon_end pair. 2262306a36Sopenharmony_ci * 2362306a36Sopenharmony_ci * (1) Current GCC (4.7) might generate NEON instructions at O3 level if 2462306a36Sopenharmony_ci * -mpfu=neon is set. 2562306a36Sopenharmony_ci */ 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci#define kernel_neon_begin() \ 2862306a36Sopenharmony_ci BUILD_BUG_ON_MSG(1, "kernel_neon_begin() called from NEON code") 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci#else 3162306a36Sopenharmony_civoid kernel_neon_begin(void); 3262306a36Sopenharmony_ci#endif 3362306a36Sopenharmony_civoid kernel_neon_end(void); 34