diff --git a/Makefile.system b/Makefile.system index 16e8fcbd6..3b55fb104 100644 --- a/Makefile.system +++ b/Makefile.system @@ -1664,8 +1664,10 @@ export HAVE_VFP export HAVE_VFPV3 export HAVE_VFPV4 export HAVE_NEON -export HAVE_MSA -export MSA_FLAGS +ifndef NO_MSA + export HAVE_MSA + export MSA_FLAGS +endif export KERNELDIR export FUNCTION_PROFILE export TARGET_CORE diff --git a/cpuid_mips.c b/cpuid_mips.c index e6e837f73..1946455d8 100644 --- a/cpuid_mips.c +++ b/cpuid_mips.c @@ -165,6 +165,7 @@ void get_cpuconfig(void){ }else{ printf("#define UNKNOWN\n"); } + if (!get_feature(msa)) printf("#define NO_MSA\n"); } void get_libname(void){ @@ -178,3 +179,38 @@ 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)) + { + p = strchr(buffer, ':') + 2; + break; + } + } + + fclose(infile); + + if( p == NULL ) return 0; + + t = strtok(p," "); + while( t = strtok(NULL," ")) + { + if (!strcmp(t, search)) { return(1); } + } + +#endif + return(0); +} + diff --git a/cpuid_mips64.c b/cpuid_mips64.c index 674b65908..8d6a1d93d 100644 --- a/cpuid_mips64.c +++ b/cpuid_mips64.c @@ -201,6 +201,7 @@ void get_cpuconfig(void){ printf("#define DTB_SIZE 4096\n"); printf("#define L2_ASSOCIATIVE 8\n"); } + if (!get_feature(msa)) printf("#define NO_MSA\n"); } void get_libname(void){ @@ -218,3 +219,38 @@ void get_libname(void){ printf("mips64\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)) + { + p = strchr(buffer, ':') + 2; + break; + } + } + + fclose(infile); + + if( p == NULL ) return 0; + + t = strtok(p," "); + while( t = strtok(NULL," ")) + { + if (!strcmp(t, search)) { return(1); } + } + +#endif + return(0); +} + diff --git a/getarch.c b/getarch.c index 60bfe05ce..8187a28fe 100644 --- a/getarch.c +++ b/getarch.c @@ -1013,7 +1013,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define ARCHCONFIG "-DP5600 " \ "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \ "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \ - "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 " + "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 -DNO_MSA" #define LIBNAME "p5600" #define CORENAME "P5600" #else @@ -1027,7 +1027,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define ARCHCONFIG "-DMIPS1004K " \ "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \ "-DL2_SIZE=262144 -DL2_LINESIZE=32 " \ - "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 " + "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 -DNO_MSA" #define LIBNAME "mips1004K" #define CORENAME "MIPS1004K" #else @@ -1041,7 +1041,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define ARCHCONFIG "-DMIPS24K " \ "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \ "-DL2_SIZE=32768 -DL2_LINESIZE=32 " \ - "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 " + "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 -DNO_MSA" #define LIBNAME "mips24K" #define CORENAME "MIPS24K" #else diff --git a/param.h b/param.h index 23f406d74..22f7b83ad 100644 --- a/param.h +++ b/param.h @@ -2884,7 +2884,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define GEMM_DEFAULT_OFFSET_B 0 #define GEMM_DEFAULT_ALIGN (BLASLONG) 0x03fffUL -#ifdef HAVE_MSA +#if defined(HAVE_MSA) && !defined(NO_MSA) #define SGEMM_DEFAULT_UNROLL_M 8 #define SGEMM_DEFAULT_UNROLL_N 8