mirror of
https://github.com/OpenMathLib/OpenBLAS
synced 2026-05-31 00:45:48 +08:00
MIPS: fix implicit declarations found in the cpuinfo detector
This commit is contained in:
81
cpuid_mips.c
81
cpuid_mips.c
@@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
Copyright (c) 2011-2014, The OpenBLAS Project
|
||||
Copyright (c) 2011-2026, The OpenBLAS Project
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -13,9 +13,9 @@ met:
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
3. Neither the name of the OpenBLAS project nor the names of
|
||||
its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written
|
||||
3. Neither the name of the OpenBLAS project nor the names of
|
||||
its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
@@ -109,7 +109,7 @@ int detect(void){
|
||||
return CPU_1004K;
|
||||
} else if (strstr(p, " 24K")) {
|
||||
return CPU_24K;
|
||||
} else
|
||||
} else
|
||||
return CPU_UNKNOWN;
|
||||
}
|
||||
#endif
|
||||
@@ -136,6 +136,40 @@ void get_subdirname(void){
|
||||
printf("mips");
|
||||
}
|
||||
|
||||
int get_feature(char *search) {
|
||||
|
||||
#ifdef __linux
|
||||
FILE *infile;
|
||||
char buffer[2048], *p, *t;
|
||||
p = (char *)NULL;
|
||||
|
||||
infile = fopen("/proc/cpuinfo", "r");
|
||||
|
||||
while (fgets(buffer, sizeof(buffer), infile)) {
|
||||
|
||||
if (!strncmp("Features", buffer, 8) ||
|
||||
!strncmp("ASEs implemented", buffer, 16)) {
|
||||
p = strchr(buffer, ':') + 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(infile);
|
||||
|
||||
if (p == NULL)
|
||||
return 0;
|
||||
|
||||
t = strtok(p, " ");
|
||||
while (t = strtok(NULL, " ")) {
|
||||
if (strstr(t, search)) {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
void get_cpuconfig(void){
|
||||
if(detect()==CPU_P5600){
|
||||
printf("#define P5600\n");
|
||||
@@ -165,7 +199,7 @@ void get_cpuconfig(void){
|
||||
}else{
|
||||
printf("#define UNKNOWN\n");
|
||||
}
|
||||
#ifndef NO_MSA
|
||||
#ifndef NO_MSA
|
||||
if (get_feature("msa")) printf("#define HAVE_MSA\n");
|
||||
#endif
|
||||
}
|
||||
@@ -181,38 +215,3 @@ void get_libname(void){
|
||||
printf("mips\n");
|
||||
}
|
||||
}
|
||||
|
||||
int get_feature(char *search)
|
||||
{
|
||||
|
||||
#ifdef __linux
|
||||
FILE *infile;
|
||||
char buffer[2048], *p,*t;
|
||||
p = (char *) NULL ;
|
||||
|
||||
infile = fopen("/proc/cpuinfo", "r");
|
||||
|
||||
while (fgets(buffer, sizeof(buffer), infile))
|
||||
{
|
||||
|
||||
if (!strncmp("Features", buffer, 8) || !strncmp("ASEs implemented", buffer, 16))
|
||||
{
|
||||
p = strchr(buffer, ':') + 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(infile);
|
||||
|
||||
if( p == NULL ) return 0;
|
||||
|
||||
t = strtok(p," ");
|
||||
while( t = strtok(NULL," "))
|
||||
{
|
||||
if (strstr(t, search)) { return(1); }
|
||||
}
|
||||
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
Copyright (c) 2011-2014, The OpenBLAS Project
|
||||
Copyright (c) 2011-2026, The OpenBLAS Project
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -13,9 +13,9 @@ met:
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
3. Neither the name of the OpenBLAS project nor the names of
|
||||
its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written
|
||||
3. Neither the name of the OpenBLAS project nor the names of
|
||||
its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
@@ -145,13 +145,47 @@ void get_subarchitecture(void){
|
||||
printf("SICORTEX");
|
||||
}else{
|
||||
printf("MIPS64_GENERIC");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void get_subdirname(void){
|
||||
printf("mips64");
|
||||
}
|
||||
|
||||
int get_feature(char *search) {
|
||||
|
||||
#ifdef __linux
|
||||
FILE *infile;
|
||||
char buffer[2048], *p, *t;
|
||||
p = (char *)NULL;
|
||||
|
||||
infile = fopen("/proc/cpuinfo", "r");
|
||||
|
||||
while (fgets(buffer, sizeof(buffer), infile)) {
|
||||
|
||||
if (!strncmp("Features", buffer, 8) ||
|
||||
!strncmp("ASEs implemented", buffer, 16)) {
|
||||
p = strchr(buffer, ':') + 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(infile);
|
||||
|
||||
if (p == NULL)
|
||||
return 0;
|
||||
|
||||
t = strtok(p, " ");
|
||||
while (t = strtok(NULL, " ")) {
|
||||
if (strstr(t, search)) {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
void get_cpuconfig(void){
|
||||
if(detect()==CPU_LOONGSON3R3) {
|
||||
printf("#define LOONGSON3R3\n");
|
||||
@@ -228,38 +262,3 @@ void get_libname(void){
|
||||
printf("mips64_generic\n");
|
||||
}
|
||||
}
|
||||
|
||||
int get_feature(char *search)
|
||||
{
|
||||
|
||||
#ifdef __linux
|
||||
FILE *infile;
|
||||
char buffer[2048], *p,*t;
|
||||
p = (char *) NULL ;
|
||||
|
||||
infile = fopen("/proc/cpuinfo", "r");
|
||||
|
||||
while (fgets(buffer, sizeof(buffer), infile))
|
||||
{
|
||||
|
||||
if (!strncmp("Features", buffer, 8) || !strncmp("ASEs implemented", buffer, 16))
|
||||
{
|
||||
p = strchr(buffer, ':') + 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(infile);
|
||||
|
||||
if( p == NULL ) return 0;
|
||||
|
||||
t = strtok(p," ");
|
||||
while( t = strtok(NULL," "))
|
||||
{
|
||||
if (strstr(t, search)) { return(1); }
|
||||
}
|
||||
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user