MIPS SIMD: Always honor JSIMD_FORCE* env vars

Previously, these environment variables were not honored unless a 74K
CPU was detected, but this detection doesn't work properly with QEMU's
user mode emulation.  With all other CPU types, libjpeg-turbo honors
JSIMD_FORCE* regardless of CPU detection.
This commit is contained in:
DRC
2020-02-17 15:19:32 -06:00
parent 044c22e12f
commit 42d679b9fc

View File

@@ -2,7 +2,7 @@
* jsimd_mips.c * jsimd_mips.c
* *
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2009-2011, 2014, 2016, 2018, D. R. Commander. * Copyright (C) 2009-2011, 2014, 2016, 2018, 2020, D. R. Commander.
* Copyright (C) 2013-2014, MIPS Technologies, Inc., California. * Copyright (C) 2013-2014, MIPS Technologies, Inc., California.
* Copyright (C) 2015-2016, 2018, Matthieu Darbois. * Copyright (C) 2015-2016, 2018, Matthieu Darbois.
* *
@@ -31,7 +31,7 @@ static unsigned int simd_support = ~0;
#if defined(__linux__) #if defined(__linux__)
LOCAL(int) LOCAL(void)
parse_proc_cpuinfo(const char *search_string) parse_proc_cpuinfo(const char *search_string)
{ {
const char *file_name = "/proc/cpuinfo"; const char *file_name = "/proc/cpuinfo";
@@ -45,13 +45,12 @@ parse_proc_cpuinfo(const char *search_string)
if (strstr(cpuinfo_line, search_string) != NULL) { if (strstr(cpuinfo_line, search_string) != NULL) {
fclose(f); fclose(f);
simd_support |= JSIMD_DSPR2; simd_support |= JSIMD_DSPR2;
return 1; return;
} }
} }
fclose(f); fclose(f);
} }
/* Did not find string in the proc file, or not Linux ELF. */ /* Did not find string in the proc file, or not Linux ELF. */
return 0;
} }
#endif #endif
@@ -79,8 +78,7 @@ init_simd(void)
/* We still have a chance to use MIPS DSPR2 regardless of globally used /* We still have a chance to use MIPS DSPR2 regardless of globally used
* -mdspr2 options passed to gcc by performing runtime detection via * -mdspr2 options passed to gcc by performing runtime detection via
* /proc/cpuinfo parsing on linux */ * /proc/cpuinfo parsing on linux */
if (!parse_proc_cpuinfo("MIPS 74K")) parse_proc_cpuinfo("MIPS 74K");
return;
#endif #endif
#ifndef NO_GETENV #ifndef NO_GETENV