Commit 888514ae authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Andrei Vagin

compel: fpu -- Add compel_test_fpu_cap helper

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
Reviewed-by: 's avatarDmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent c926e2a7
......@@ -16,6 +16,7 @@ static bool rt_info_done = false;
void compel_set_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { }
void compel_clear_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { }
int compel_test_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; }
int compel_test_fpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; }
int compel_cpuid(compel_cpuinfo_t *info) { return 0; }
bool compel_cpu_has_feature(unsigned int feature)
......
......@@ -16,6 +16,7 @@ static bool rt_info_done = false;
void compel_set_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { }
void compel_clear_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { }
int compel_test_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; }
int compel_test_fpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; }
int compel_cpuid(compel_cpuinfo_t *info) { return 0; }
bool compel_cpu_has_feature(unsigned int feature)
......
......@@ -17,6 +17,7 @@ static bool rt_info_done = false;
void compel_set_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { }
void compel_clear_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { }
int compel_test_fpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; }
int compel_test_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; }
int compel_cpuid(compel_cpuinfo_t *info)
......
......@@ -17,6 +17,7 @@ static bool rt_info_done = false;
void compel_set_cpu_cap(compel_cpuinfo_t *c, unsigned int feature) { }
void compel_clear_cpu_cap(compel_cpuinfo_t *c, unsigned int feature) { }
int compel_test_fpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; }
int compel_test_cpu_cap(compel_cpuinfo_t *c, unsigned int feature) { return 0; }
int compel_cpuid(compel_cpuinfo_t *info)
......
......@@ -67,6 +67,13 @@ int compel_test_cpu_cap(compel_cpuinfo_t *c, unsigned int feature)
return 0;
}
int compel_test_fpu_cap(compel_cpuinfo_t *c, unsigned int feature)
{
if (likely(feature < XFEATURE_MAX))
return (c->xfeatures_mask & (1UL << feature));
return 0;
}
static int compel_fpuid(compel_cpuinfo_t *c)
{
unsigned int last_good_offset;
......
......@@ -63,6 +63,7 @@ enum xfeature {
#define XFEATURE_MASK_PT (1 << XFEATURE_PT)
#define XFEATURE_MASK_PKRU (1 << XFEATURE_PKRU)
#define XFEATURE_MASK_HDC (1 << XFEATURE_HDC)
#define XFEATURE_MASK_MAX (1 << XFEATURE_MAX)
#define XFEATURE_MASK_FPSSE (XFEATURE_MASK_FP | XFEATURE_MASK_SSE)
#define XFEATURE_MASK_AVX512 (XFEATURE_MASK_OPMASK | XFEATURE_MASK_ZMM_Hi256 | XFEATURE_MASK_Hi16_ZMM)
......
......@@ -7,5 +7,6 @@
extern void compel_set_cpu_cap(compel_cpuinfo_t *info, unsigned int feature);
extern void compel_clear_cpu_cap(compel_cpuinfo_t *info, unsigned int feature);
extern int compel_test_cpu_cap(compel_cpuinfo_t *info, unsigned int feature);
extern int compel_test_fpu_cap(compel_cpuinfo_t *c, unsigned int feature);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment