Go to the documentation of this file.
22 #if defined __linux__ || defined __ANDROID__
31 #if defined __linux__ || defined __ANDROID__
33 #define HWCAP_LOONGSON_CPUCFG (1 << 14)
35 static int cpucfg_available(
void)
41 static uint32_t read_cpucfg(uint32_t reg)
46 "parse_r __res,%0\n\t"
49 ".word (0xc8080118 | (reg << 21) | (__res << 11))\n\t"
57 #define LOONGSON_CFG1 0x1
59 #define LOONGSON_CFG1_MMI (1 << 4)
60 #define LOONGSON_CFG1_MSA1 (1 << 5)
62 static int cpu_flags_cpucfg(
void)
65 uint32_t cfg1 = read_cpucfg(LOONGSON_CFG1);
67 if (cfg1 & LOONGSON_CFG1_MMI)
70 if (cfg1 & LOONGSON_CFG1_MSA1)
76 static int cpu_flags_cpuinfo(
void)
78 FILE *
f = fopen(
"/proc/cpuinfo",
"r");
85 while (fgets(buf,
sizeof(buf),
f)) {
88 if (strstr(buf,
"Loongson-3 "))
93 if (strstr(buf,
" loongson-mmi"))
95 if (strstr(buf,
" msa"))
108 #if defined __linux__ || defined __ANDROID__
109 if (cpucfg_available())
110 return cpu_flags_cpucfg();
112 return cpu_flags_cpuinfo();
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
size_t ff_get_cpu_max_align_mips(void)
unsigned long ff_getauxval(unsigned long type)
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
__asm__(".macro parse_r var r\n\t" "\\var = -1\n\t" _IFC_REG(0) _IFC_REG(1) _IFC_REG(2) _IFC_REG(3) _IFC_REG(4) _IFC_REG(5) _IFC_REG(6) _IFC_REG(7) _IFC_REG(8) _IFC_REG(9) _IFC_REG(10) _IFC_REG(11) _IFC_REG(12) _IFC_REG(13) _IFC_REG(14) _IFC_REG(15) _IFC_REG(16) _IFC_REG(17) _IFC_REG(18) _IFC_REG(19) _IFC_REG(20) _IFC_REG(21) _IFC_REG(22) _IFC_REG(23) _IFC_REG(24) _IFC_REG(25) _IFC_REG(26) _IFC_REG(27) _IFC_REG(28) _IFC_REG(29) _IFC_REG(30) _IFC_REG(31) ".iflt \\var\n\t" ".error \"Unable to parse register name \\r\"\n\t" ".endif\n\t" ".endm")
int ff_get_cpu_flags_mips(void)
#define flags(name, subs,...)