xor-neon.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * linux/arch/arm/lib/xor-neon.c
  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 <linux/raid/xor.h>
  11. #ifndef __ARM_NEON__
  12. #error You should compile this file with '-mfloat-abi=softfp -mfpu=neon'
  13. #endif
  14. /*
  15. * Pull in the reference implementations while instructing GCC (through
  16. * -ftree-vectorize) to attempt to exploit implicit parallelism and emit
  17. * NEON instructions.
  18. */
  19. #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
  20. #pragma GCC optimize "tree-vectorize"
  21. #else
  22. /*
  23. * While older versions of GCC do not generate incorrect code, they fail to
  24. * recognize the parallel nature of these functions, and emit plain ARM code,
  25. * which is known to be slower than the optimized ARM code in asm-arm/xor.h.
  26. */
  27. #warning This code requires at least version 4.6 of GCC
  28. #endif
  29. #pragma GCC diagnostic ignored "-Wunused-variable"
  30. #include <asm-generic/xor.h>
  31. struct xor_block_template const xor_block_neon_inner = {
  32. .name = "__inner_neon__",
  33. .do_2 = xor_8regs_2,
  34. .do_3 = xor_8regs_3,
  35. .do_4 = xor_8regs_4,
  36. .do_5 = xor_8regs_5,
  37. };