mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 05:38:22 +01:00
Enable SSE2 for Visual Studio builds
Based on the remnants of change #2273. Adds an auto-detect for ARCH based on the environment. Change-Id: I4644eae7509f3982a8b385b49beac03675a2e0e8
This commit is contained in:
parent
af10db4aa4
commit
003417c7c7
16
Makefile.vc
16
Makefile.vc
@ -15,14 +15,17 @@ DEPS_PATH = ../../deps
|
||||
!ENDIF
|
||||
|
||||
!IFNDEF ARCH
|
||||
!IFDEF TARGET_CPU
|
||||
ARCH = $(TARGET_CPU)
|
||||
!IF ! [ cl 2>&1 | find "x86" > NUL ]
|
||||
ARCH = x86
|
||||
!ELSE IF ! [ cl 2>&1 | find "x64" > NUL ]
|
||||
ARCH = x64
|
||||
!ELSE
|
||||
ARCH = x86
|
||||
!ERROR Unable to auto-detect toolchain architecture! \
|
||||
If cl.exe is in your PATH rerun nmake with ARCH=<arch>.
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
!IF "$(TARGET_CPU)" == "x86"
|
||||
!IF "$(ARCH)" == "x86"
|
||||
PLATFORM_LDFLAGS = /SAFESEH
|
||||
PLATFORM_SSE2 = /arch:SSE2
|
||||
!ENDIF
|
||||
@ -40,7 +43,7 @@ LNKDLL = link.exe /DLL
|
||||
LNKLIB = link.exe /lib
|
||||
LNKEXE = link.exe
|
||||
LFLAGS = /nologo /machine:$(ARCH)
|
||||
CFLAGS = $(CFLAGS)
|
||||
CFLAGS = $(CFLAGS) $(PLATFORM_SSE2)
|
||||
|
||||
CFGSET = FALSE
|
||||
!IF "$(OBJDIR)" == ""
|
||||
@ -189,9 +192,6 @@ $(DIRINC):
|
||||
$(DIRBIN):
|
||||
@if not exist "$(DIRBIN)" mkdir $(DIRBIN)
|
||||
|
||||
# Special case - compile with SSE2.
|
||||
$(DIROBJ)\enc\dsp_sse2.obj: src\enc\dsp_sse2.c
|
||||
$(CC) $(CFLAGS) $(PLATFORM_SSE2) /Fo"$@" src\enc\dsp_sse2.c
|
||||
.SUFFIXES: .c .obj .res .exe
|
||||
{examples}.c{$(DIROBJ)\examples}.obj:
|
||||
$(CC) $(CFLAGS) /Fo"$@" $<
|
||||
|
@ -685,9 +685,12 @@ static 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"(info_type));
|
||||
}
|
||||
#elif defined(_M_IX86) || defined(_M_X64) // Visual C++
|
||||
#define GetCPUInfo __cpuid
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || \
|
||||
defined(_M_IX86) || defined(_M_X64)
|
||||
static int x86CPUInfo(CPUFeature feature) {
|
||||
int cpu_info[4];
|
||||
GetCPUInfo(cpu_info, 1);
|
||||
@ -753,7 +756,8 @@ void VP8EncDspInit(void) {
|
||||
// If defined, use CPUInfo() to overwrite some pointers with faster versions.
|
||||
if (VP8GetCPUInfo) {
|
||||
if (VP8GetCPUInfo(kSSE2)) {
|
||||
#if defined(__SSE2__)
|
||||
#if defined(__SSE2__) || \
|
||||
(defined(_M_IX86_FP) && _M_IX86_FP >= 2) || defined(_M_X64)
|
||||
VP8EncDspInitSSE2();
|
||||
#endif
|
||||
}
|
||||
|
@ -9,7 +9,8 @@
|
||||
//
|
||||
// Author: Christian Duvivier (cduvivier@google.com)
|
||||
|
||||
#if defined(__SSE2__)
|
||||
#if defined(__SSE2__) || \
|
||||
(defined(_M_IX86_FP) && _M_IX86_FP >= 2) || defined(_M_X64)
|
||||
#include <emmintrin.h>
|
||||
|
||||
#include "vp8enci.h"
|
||||
|
Loading…
Reference in New Issue
Block a user