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