simd.h 615 B

12345678910111213141516171819202122
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_GENERIC_SIMD_H
  3. #define _ASM_GENERIC_SIMD_H
  4. #include <linux/compiler_attributes.h>
  5. #include <linux/preempt.h>
  6. #include <linux/sched.h>
  7. #include <linux/types.h>
  8. /*
  9. * may_use_simd - whether it is allowable at this time to issue SIMD
  10. * instructions or access the SIMD register file
  11. *
  12. * As architectures typically don't preserve the SIMD register file when
  13. * taking an interrupt, !in_interrupt() should be a reasonable default.
  14. */
  15. static __must_check inline bool may_use_simd(void)
  16. {
  17. return !in_interrupt();
  18. }
  19. #endif /* _ASM_GENERIC_SIMD_H */