12#if defined(SK_CPU_X86)
15 static void cpuid (uint32_t abcd[4]) { __cpuid ((
int*)abcd, 1); }
16 static void cpuid7(uint32_t abcd[4]) { __cpuidex((
int*)abcd, 7, 0); }
17 static uint64_t xgetbv(uint32_t xcr) {
return _xgetbv(xcr); }
20 #if !defined(__cpuid_count)
21 #define __cpuid_count(eax, ecx, a, b, c, d) \
22 __asm__("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(eax), "2"(ecx))
24 static void cpuid (uint32_t abcd[4]) { __get_cpuid(1, abcd+0, abcd+1, abcd+2, abcd+3); }
25 static void cpuid7(uint32_t abcd[4]) {
26 __cpuid_count(7, 0, abcd[0], abcd[1], abcd[2], abcd[3]);
28 static uint64_t xgetbv(uint32_t xcr) {
30 __asm__ __volatile__ (
"xgetbv" :
"=a"(eax),
"=d"(edx) :
"c"(xcr));
31 return (uint64_t)(edx) << 32 | eax;
36 uint32_t features = 0;
37 uint32_t abcd[4] = {0,0,0,0};
49 if ((abcd[2] & (3<<26)) == (3<<26)
50 && (xgetbv(0) & (3<<1)) == (3<<1)) {
61 if ((xgetbv(0) & (7<<5)) == (7<<5)) {
74#elif defined(SK_CPU_LOONGARCH)
78 uint64_t features = 0;
79 uint64_t hwcap = getauxval(AT_HWCAP);
92uint32_t SkCpu::gCachedFeatures = 0;
static uint32_t read_cpu_features()
__asm__(".symver expf,expf@GLIBC_2.4")
static void CacheRuntimeFeatures()