summaryrefslogtreecommitdiffhomepage
path: root/src/compat/simd-asm/include/asm/simd.h
blob: a975b38b5578178b0ef62e647d0b9c76124026c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef _COMPAT_ASM_SIMD_H
#define _COMPAT_ASM_SIMD_H

#if defined(CONFIG_X86_64)
#include <asm/fpu/api.h>
#endif

static __must_check inline bool may_use_simd(void)
{
#if defined(CONFIG_X86_64)
	return irq_fpu_usable();
#elif defined(CONFIG_ARM64) && defined(CONFIG_KERNEL_MODE_NEON)
	return true;
#elif defined(CONFIG_ARM) && defined(CONFIG_KERNEL_MODE_NEON)
	return !in_nmi() && !in_irq() && !in_serving_softirq();
#else
	return false;
#endif
}

#endif