xor.h 1017 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. *
  4. * Copyright (C) IBM Corporation, 2012
  5. *
  6. * Author: Anton Blanchard <[email protected]>
  7. */
  8. #ifndef _ASM_POWERPC_XOR_H
  9. #define _ASM_POWERPC_XOR_H
  10. #ifdef CONFIG_ALTIVEC
  11. #include <asm/cputable.h>
  12. #include <asm/cpu_has_feature.h>
  13. #include <asm/xor_altivec.h>
  14. static struct xor_block_template xor_block_altivec = {
  15. .name = "altivec",
  16. .do_2 = xor_altivec_2,
  17. .do_3 = xor_altivec_3,
  18. .do_4 = xor_altivec_4,
  19. .do_5 = xor_altivec_5,
  20. };
  21. #define XOR_SPEED_ALTIVEC() \
  22. do { \
  23. if (cpu_has_feature(CPU_FTR_ALTIVEC)) \
  24. xor_speed(&xor_block_altivec); \
  25. } while (0)
  26. #else
  27. #define XOR_SPEED_ALTIVEC()
  28. #endif
  29. /* Also try the generic routines. */
  30. #include <asm-generic/xor.h>
  31. #undef XOR_TRY_TEMPLATES
  32. #define XOR_TRY_TEMPLATES \
  33. do { \
  34. xor_speed(&xor_block_8regs); \
  35. xor_speed(&xor_block_8regs_p); \
  36. xor_speed(&xor_block_32regs); \
  37. xor_speed(&xor_block_32regs_p); \
  38. XOR_SPEED_ALTIVEC(); \
  39. } while (0)
  40. #endif /* _ASM_POWERPC_XOR_H */