neon.h 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * linux/arch/arm/include/asm/neon.h
  4. *
  5. * Copyright (C) 2013 Linaro Ltd <[email protected]>
  6. */
  7. #include <asm/hwcap.h>
  8. #define cpu_has_neon() (!!(elf_hwcap & HWCAP_NEON))
  9. #ifdef __ARM_NEON__
  10. /*
  11. * If you are affected by the BUILD_BUG below, it probably means that you are
  12. * using NEON code /and/ calling the kernel_neon_begin() function from the same
  13. * compilation unit. To prevent issues that may arise from GCC reordering or
  14. * generating(1) NEON instructions outside of these begin/end functions, the
  15. * only supported way of using NEON code in the kernel is by isolating it in a
  16. * separate compilation unit, and calling it from another unit from inside a
  17. * kernel_neon_begin/kernel_neon_end pair.
  18. *
  19. * (1) Current GCC (4.7) might generate NEON instructions at O3 level if
  20. * -mpfu=neon is set.
  21. */
  22. #define kernel_neon_begin() \
  23. BUILD_BUG_ON_MSG(1, "kernel_neon_begin() called from NEON code")
  24. #else
  25. void kernel_neon_begin(void);
  26. #endif
  27. void kernel_neon_end(void);