mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
dsp.h: allow config.h to override MSVC SIMD autodetection
this fixes builds with cmake targeting visual studio that set -DWEBP_ENABLE_SIMD=0 BUG=webp:478 Change-Id: I21b61b112c79ff9cbab9e4502a25d3f1fa096c8b
This commit is contained in:
parent
fef789f366
commit
ae54553461
@ -55,12 +55,18 @@ static WEBP_INLINE void GetCPUInfo(int cpu_info[4], int info_type) {
|
|||||||
: "=a"(cpu_info[0]), "=b"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
|
: "=a"(cpu_info[0]), "=b"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
|
||||||
: "a"(info_type), "c"(0));
|
: "a"(info_type), "c"(0));
|
||||||
}
|
}
|
||||||
#elif (defined(_M_X64) || defined(_M_IX86)) && \
|
#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
|
||||||
defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 150030729 // >= VS2008 SP1
|
|
||||||
|
#if defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 150030729 // >= VS2008 SP1
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#define GetCPUInfo(info, type) __cpuidex(info, type, 0) // set ecx=0
|
#define GetCPUInfo(info, type) __cpuidex(info, type, 0) // set ecx=0
|
||||||
#elif defined(WEBP_MSC_SSE2)
|
#define WEBP_HAVE_MSC_CPUID
|
||||||
|
#elif _MSC_VER > 1310
|
||||||
|
#include <intrin.h>
|
||||||
#define GetCPUInfo __cpuid
|
#define GetCPUInfo __cpuid
|
||||||
|
#define WEBP_HAVE_MSC_CPUID
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// NaCl has no support for xgetbv or the raw opcode.
|
// NaCl has no support for xgetbv or the raw opcode.
|
||||||
@ -94,7 +100,7 @@ static WEBP_INLINE uint64_t xgetbv(void) {
|
|||||||
#define xgetbv() 0U // no AVX for older x64 or unrecognized toolchains.
|
#define xgetbv() 0U // no AVX for older x64 or unrecognized toolchains.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__i386__) || defined(__x86_64__) || defined(WEBP_MSC_SSE2)
|
#if defined(__i386__) || defined(__x86_64__) || defined(WEBP_HAVE_MSC_CPUID)
|
||||||
|
|
||||||
// helper function for run-time detection of slow SSSE3 platforms
|
// helper function for run-time detection of slow SSSE3 platforms
|
||||||
static int CheckSlowModel(int info) {
|
static int CheckSlowModel(int info) {
|
||||||
|
@ -51,6 +51,7 @@ extern "C" {
|
|||||||
# define __has_builtin(x) 0
|
# define __has_builtin(x) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(HAVE_CONFIG_H)
|
||||||
#if defined(_MSC_VER) && _MSC_VER > 1310 && \
|
#if defined(_MSC_VER) && _MSC_VER > 1310 && \
|
||||||
(defined(_M_X64) || defined(_M_IX86))
|
(defined(_M_X64) || defined(_M_IX86))
|
||||||
#define WEBP_MSC_SSE2 // Visual C++ SSE2 targets
|
#define WEBP_MSC_SSE2 // Visual C++ SSE2 targets
|
||||||
@ -60,6 +61,7 @@ extern "C" {
|
|||||||
(defined(_M_X64) || defined(_M_IX86))
|
(defined(_M_X64) || defined(_M_IX86))
|
||||||
#define WEBP_MSC_SSE41 // Visual C++ SSE4.1 targets
|
#define WEBP_MSC_SSE41 // Visual C++ SSE4.1 targets
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// WEBP_HAVE_* are used to indicate the presence of the instruction set in dsp
|
// WEBP_HAVE_* are used to indicate the presence of the instruction set in dsp
|
||||||
// files without intrinsics, allowing the corresponding Init() to be called.
|
// files without intrinsics, allowing the corresponding Init() to be called.
|
||||||
@ -73,6 +75,9 @@ extern "C" {
|
|||||||
#define WEBP_USE_SSE41
|
#define WEBP_USE_SSE41
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#undef WEBP_MSC_SSE41
|
||||||
|
#undef WEBP_MSC_SSE2
|
||||||
|
|
||||||
// The intrinsics currently cause compiler errors with arm-nacl-gcc and the
|
// The intrinsics currently cause compiler errors with arm-nacl-gcc and the
|
||||||
// inline assembly would need to be modified for use with Native Client.
|
// inline assembly would need to be modified for use with Native Client.
|
||||||
#if (defined(__ARM_NEON__) || \
|
#if (defined(__ARM_NEON__) || \
|
||||||
|
Loading…
Reference in New Issue
Block a user