neon.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * linux/arch/arm/include/asm/neon.h
  3. *
  4. * Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <asm/hwcap.h>
  11. #define cpu_has_neon() (!!(elf_hwcap & HWCAP_NEON))
  12. #ifdef __ARM_NEON__
  13. /*
  14. * If you are affected by the BUILD_BUG below, it probably means that you are
  15. * using NEON code /and/ calling the kernel_neon_begin() function from the same
  16. * compilation unit. To prevent issues that may arise from GCC reordering or
  17. * generating(1) NEON instructions outside of these begin/end functions, the
  18. * only supported way of using NEON code in the kernel is by isolating it in a
  19. * separate compilation unit, and calling it from another unit from inside a
  20. * kernel_neon_begin/kernel_neon_end pair.
  21. *
  22. * (1) Current GCC (4.7) might generate NEON instructions at O3 level if
  23. * -mpfu=neon is set.
  24. */
  25. #define kernel_neon_begin() \
  26. BUILD_BUG_ON_MSG(1, "kernel_neon_begin() called from NEON code")
  27. #else
  28. void kernel_neon_begin(void);
  29. #endif
  30. void kernel_neon_end(void);