Bug 1271794 - Use SSE2 instructions on win32. r=glandium

We've decided supporting the small number of x86 machines
without SSE2 instructions is no longer worth the cost in
developer time nor the performance impact for other users.

https://groups.google.com/d/msg/mozilla.dev.platform/dZC39mj5V-s/Xt_UqZXkAAAJ

Set -arch:SSE2 by default on x86 if an arch hasn't already
been supplied. This ensures we'll continue to build with
the right instruction set if the compiler changes its default
in the future, while still allowing custom builds to set
a lower minimum.

Also updates the filter to strip all arch switches on win64
when building the sandbox. The 64-bit compiler doesn't
support -arch:SSE2 either.

MozReview-Commit-ID: JzTRGPn9vzI
This commit is contained in:
Ralph Giles 2016-05-10 14:55:51 -07:00
Родитель 55a7384c6e
Коммит 0946db2658
3 изменённых файлов: 20 добавлений и 8 удалений

Просмотреть файл

@ -982,10 +982,16 @@ case "$target" in
_DEFINES_CXXFLAGS='-FI $(topobjdir)/js/src/js-confdefs.h -DMOZILLA_CLIENT' _DEFINES_CXXFLAGS='-FI $(topobjdir)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
CFLAGS="$CFLAGS -W3 -Gy" CFLAGS="$CFLAGS -W3 -Gy"
CXXFLAGS="$CXXFLAGS -W3 -Gy" CXXFLAGS="$CXXFLAGS -W3 -Gy"
if test "$CPU_ARCH" = "x86"; then if test "$CPU_ARCH" = "x86";then
dnl VS2012+ defaults to -arch:SSE2. dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
CFLAGS="$CFLAGS -arch:IA32" dnl more recent, so set that explicitly here unless another
CXXFLAGS="$CXXFLAGS -arch:IA32" dnl target arch has already been set.
if test -z `echo $CFLAGS | grep -i [-/]arch:` ; then
CFLAGS="$CFLAGS -arch:SSE2"
fi
if test -z `echo $CXXFLAGS | grep -i [-/]arch:` ; then
CXXFLAGS="$CXXFLAGS -arch:SSE2"
fi
fi fi
dnl VS2013+ requires -FS when parallel building by make -jN. dnl VS2013+ requires -FS when parallel building by make -jN.
dnl If nothing, compiler sometimes causes C1041 error. dnl If nothing, compiler sometimes causes C1041 error.

Просмотреть файл

@ -1367,9 +1367,15 @@ case "$target" in
CFLAGS="$CFLAGS -W3 -Gy" CFLAGS="$CFLAGS -W3 -Gy"
CXXFLAGS="$CXXFLAGS -W3 -Gy" CXXFLAGS="$CXXFLAGS -W3 -Gy"
if test "$CPU_ARCH" = "x86"; then if test "$CPU_ARCH" = "x86"; then
dnl VS2012+ defaults to -arch:SSE2. dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
CFLAGS="$CFLAGS -arch:IA32" dnl more recent, so set that explicitly here unless another
CXXFLAGS="$CXXFLAGS -arch:IA32" dnl target arch has already been set.
if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
CFLAGS="$CFLAGS -arch:SSE2"
fi
if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
CXXFLAGS="$CXXFLAGS -arch:SSE2"
fi
SSE_FLAGS="-arch:SSE" SSE_FLAGS="-arch:SSE"
SSE2_FLAGS="-arch:SSE2" SSE2_FLAGS="-arch:SSE2"
dnl MSVC allows the use of intrinsics without any flags dnl MSVC allows the use of intrinsics without any flags

Просмотреть файл

@ -32,7 +32,7 @@ include $(topsrcdir)/config/config.mk
# compiler path above. # compiler path above.
LIB = $(call lazy,LIB,$$(shell python -c 'import os; print ";".join(s.lower().replace(os.sep, "/").replace("/vc/lib", "/vc/lib/amd64").replace("/um/x86", "/um/x64").replace("/ucrt/x86", "/ucrt/x64") for s in os.environ["LIB"].split(";"))')) LIB = $(call lazy,LIB,$$(shell python -c 'import os; print ";".join(s.lower().replace(os.sep, "/").replace("/vc/lib", "/vc/lib/amd64").replace("/um/x86", "/um/x64").replace("/ucrt/x86", "/ucrt/x64") for s in os.environ["LIB"].split(";"))'))
CXXFLAGS := $(filter-out -arch:IA32,$(CXXFLAGS)) CXXFLAGS := $(filter-out -arch:%,$(CXXFLAGS))
# OS_COMPILE_CXXFLAGS includes mozilla-config.h, which contains x86-specific # OS_COMPILE_CXXFLAGS includes mozilla-config.h, which contains x86-specific
# defines breaking the build. # defines breaking the build.