Bug 979118 - Add global MMX_FLAGS, SSE_FLAGS and SSE2_FLAGS variables; r=glandium

This commit is contained in:
Ehsan Akhgari 2014-03-19 21:55:00 -04:00
parent 2b5f53de81
commit 17c8d2bddd
16 changed files with 83 additions and 79 deletions

View File

@ -11,24 +11,39 @@ dnl can mess around with things like:
dnl AC_SOMETHING(foo,AC_SUBST(),bar)
define([AC_SUBST],
[ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
[ifdef([AC_SUBST_LIST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
[ifdef([AC_SUBST_$1], ,
[define([AC_SUBST_$1], )dnl
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
(''' $1 ''', r''' [$]$1 ''')
AC_DIVERT_POP()dnl
])])])
])])])])
dnl Like AC_SUBST, but makes the value available as a set in python,
dnl with values got from the value of the environment variable, split on
dnl whitespaces.
define([AC_SUBST_SET],
[ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
[ifdef([AC_SUBST_LIST$1], [m4_fatal([Cannot use AC_SUBST_LIST and AC_SUBST_SET on the same variable ($1)])],
[ifdef([AC_SUBST_SET_$1], ,
[define([AC_SUBST_SET_$1], )dnl
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
(''' $1 ''', set(r''' [$]$1 '''.split()))
AC_DIVERT_POP()dnl
])])])
])])])])
dnl Like AC_SUBST, but makes the value available as a list in python,
dnl with values got from the value of the environment variable, split on
dnl whitespaces.
define([AC_SUBST_LIST],
[ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
[ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST_SET and AC_SUBST_LIST on the same variable ($1)])],
[ifdef([AC_SUBST_LIST_$1], ,
[define([AC_SUBST_LIST_$1], )dnl
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
(''' $1 ''', list(r''' [$]$1 '''.split()))
AC_DIVERT_POP()dnl
])])])])
dnl Wrap AC_DEFINE to store values in a format suitable for python.
dnl autoconf's AC_DEFINE still needs to be used to fill confdefs.h,

View File

@ -1912,6 +1912,9 @@ case "$target" in
fi
TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
MMX_FLAGS="-mmmx"
SSE_FLAGS="-msse"
SSE2_FLAGS="-msse2"
if test "x$lto_is_enabled" = "xyes"; then
echo "Skipping -dead_strip because lto is enabled."
@ -2004,6 +2007,10 @@ ia64*-hpux*)
fi
TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
MMX_FLAGS="-mmmx"
SSE_FLAGS="-msse"
SSE2_FLAGS="-msse2"
MOZ_GFX_OPTIMIZE_MOBILE=1
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
;;
@ -2025,6 +2032,10 @@ ia64*-hpux*)
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
fi
MMX_FLAGS="-mmmx"
SSE_FLAGS="-msse"
SSE2_FLAGS="-msse2"
TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
MOZ_MEMORY=1
@ -2070,6 +2081,10 @@ ia64*-hpux*)
DLL_PREFIX=
IMPORT_LIB_SUFFIX=dll.a
MMX_FLAGS="-mmmx"
SSE_FLAGS="-msse"
SSE2_FLAGS="-msse2"
# We use mix of both POSIX and Win32 printf format across the tree, so format
# warnings are useless on mingw.
MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
@ -2271,6 +2286,9 @@ ia64*-hpux*)
fi
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@)) -o $@'
MMX_FLAGS="-mmmx"
SSE_FLAGS="-msse"
SSE2_FLAGS="-msse2"
;;
*-openbsd*)
@ -2286,6 +2304,9 @@ ia64*-hpux*)
if test "$LIBRUNPATH"; then
DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
fi
MMX_FLAGS="-mmmx"
SSE_FLAGS="-msse"
SSE2_FLAGS="-msse2"
;;
*-solaris*)
@ -2301,6 +2322,9 @@ ia64*-hpux*)
CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
LDFLAGS="-xildoff $LDFLAGS"
MMX_FLAGS="-xarch=mmx -xO4"
SSE_FLAGS="-xarch=sse"
SSE2_FLAGS="-xarch=ssei2 -xO4"
if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
_SAVE_LDFLAGS=$LDFLAGS
LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
@ -2364,6 +2388,9 @@ ia64*-hpux*)
if test "$OS_RELEASE" = "5.3"; then
AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
fi
MMX_FLAGS="-mmmx"
SSE_FLAGS="-msse"
SSE2_FLAGS="-msse2"
fi
if test "$OS_RELEASE" = "5.5.1"; then
AC_DEFINE(NEED_USLEEP_PROTOTYPE)
@ -2385,6 +2412,10 @@ ia64*-hpux*)
esac
AC_SUBST_LIST(MMX_FLAGS)
AC_SUBST_LIST(SSE_FLAGS)
AC_SUBST_LIST(SSE2_FLAGS)
case "$target" in
*-*linux*)
# Includes linux-android

View File

@ -51,12 +51,7 @@ if CONFIG['MOZ_WEBRTC']:
# nsTextFragment.cpp
if CONFIG['INTEL_ARCHITECTURE']:
SOURCES += ['nsTextFragmentSSE2.cpp']
if CONFIG['GNU_CC']:
# gcc requires -msse2 for this file since it uses SSE2 intrinsics. (See bug
# 585538 comment 12.)
SOURCES['nsTextFragmentSSE2.cpp'].flags += ['-msse2']
if CONFIG['SOLARIS_SUNPRO_CXX']:
SOURCES['nsTextFragmentSSE2.cpp'].flags += ['-xarch=sse2', '-xO4']
SOURCES['nsTextFragmentSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
EXPORTS.mozilla.dom += [
'Attr.h',

View File

@ -90,14 +90,9 @@ if CONFIG['INTEL_ARCHITECTURE']:
DEFINES['USE_SSE2'] = True
# The file uses SSE2 intrinsics, so it needs special compile flags on some
# compilers.
if CONFIG['GNU_CC']:
SOURCES['BlurSSE2.cpp'].flags += ['-msse2']
SOURCES['FilterProcessingSSE2.cpp'].flags += ['-msse2']
SOURCES['ImageScalingSSE2.cpp'].flags += ['-msse2']
if CONFIG['SOLARIS_SUNPRO_CXX']:
SOURCES['BlurSSE2.cpp'].flags += ['-xarch=sse2', '-xO4']
SOURCES['FilterProcessingSSE2.cpp'].flags += ['-xarch=sse2', '-xO4']
SOURCES['ImageScalingSSE2.cpp'].flags += ['-xarch=sse2', '-xO4']
SOURCES['BlurSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES['FilterProcessingSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES['ImageScalingSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
UNIFIED_SOURCES += [
'Blur.cpp',

View File

@ -172,8 +172,7 @@ SOURCES += ['renderer/' + src for src in [
'VertexDeclarationCache.cpp',
]]
if CONFIG['GNU_CC']:
SOURCES['renderer/ImageSSE2.cpp'].flags += ['-msse2']
SOURCES['renderer/ImageSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
# On Windows, we don't automatically get "lib" prepended, but we need it.
LIBRARY_NAME = 'libGLESv2'

View File

@ -110,9 +110,9 @@ elif 'arm' in CONFIG['OS_TEST']:
if use_mmx:
DEFINES['USE_MMX'] = True
SOURCES += ['pixman-mmx.c']
SOURCES['pixman-mmx.c'].flags += CONFIG['MMX_FLAGS']
if CONFIG['GNU_CC']:
SOURCES['pixman-mmx.c'].flags += [
'-mmmx',
'-Winline',
'--param inline-unit-growth=10000',
'--param large-function-growth=10000',
@ -122,12 +122,9 @@ if use_sse2:
DEFINES['USE_SSE'] = True
DEFINES['USE_SSE2'] = True
SOURCES += ['pixman-sse2.c']
SOURCES['pixman-sse2.c'].flags += CONFIG['SSE_FLAGS'] + CONFIG['SSE2_FLAGS']
if CONFIG['GNU_CC']:
SOURCES['pixman-sse2.c'].flags += [
'-msse',
'-msse2',
'-Winline',
]
SOURCES['pixman-sse2.c'].flags += ['-Winline']
if use_vmx:
DEFINES['USE_VMX'] = True

View File

@ -40,9 +40,8 @@ elif 'ppc' in CONFIG['CPU_ARCH']:
if use_sse1:
SOURCES += ['transform-sse1.c']
if CONFIG['GNU_CC']:
SOURCES['transform-sse1.c'].flags += ['-msse']
elif CONFIG['SOLARIS_SUNPRO_CC']:
SOURCES['transform-sse1.c'].flags += CONFIG['SSE_FLAGS']
if CONFIG['SOLARIS_SUNPRO_CC']:
if '64' in CONFIG['OS_TEST']:
# Sun Studio doesn't work correctly for x86 intristics
# with -m64 and without optimization.
@ -52,9 +51,8 @@ if use_sse1:
if use_sse2:
SOURCES += ['transform-sse2.c']
if CONFIG['GNU_CC']:
SOURCES['transform-sse2.c'].flags += ['-msse2']
elif CONFIG['SOLARIS_SUNPRO_CC']:
SOURCES['transform-sse2.c'].flags += CONFIG['SSE2_FLAGS']
if CONFIG['SOLARIS_SUNPRO_CC']:
if '64' in CONFIG['OS_TEST']:
# Sun Studio doesn't work correctly for x86 intristics
# with -m64 and without optimization.

View File

@ -80,14 +80,14 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
DEFINES['GR_DLL'] = 1
if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['GNU_CC']:
SOURCES['trunk/src/opts/SkBitmapFilter_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBitmapProcState_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBitmapFilter_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES['trunk/src/opts/SkBitmapProcState_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES['trunk/src/opts/SkBitmapProcState_opts_SSSE3.cpp'].flags += ['-mssse3']
SOURCES['trunk/src/opts/SkBlitRect_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBlurImage_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkMorphology_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkUtils_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBlitRect_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES['trunk/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES['trunk/src/opts/SkBlurImage_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES['trunk/src/opts/SkMorphology_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES['trunk/src/opts/SkUtils_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
elif CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_CC'] and CONFIG['BUILD_ARM_NEON']:
DEFINES['__ARM_HAVE_OPTIONAL_NEON_SUPPORT'] = 1
DEFINES['USE_ANDROID_NDK_CPU_FEATURES'] = 0

View File

@ -881,14 +881,14 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
DEFINES['GR_DLL'] = 1
if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['GNU_CC']:
SOURCES['trunk/src/opts/SkBitmapFilter_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBitmapProcState_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBitmapFilter_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES['trunk/src/opts/SkBitmapProcState_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES['trunk/src/opts/SkBitmapProcState_opts_SSSE3.cpp'].flags += ['-mssse3']
SOURCES['trunk/src/opts/SkBlitRect_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBlurImage_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkMorphology_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkUtils_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBlitRect_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES['trunk/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES['trunk/src/opts/SkBlurImage_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES['trunk/src/opts/SkMorphology_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES['trunk/src/opts/SkUtils_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
elif CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_CC'] and CONFIG['BUILD_ARM_NEON']:
DEFINES['__ARM_HAVE_OPTIONAL_NEON_SUPPORT'] = 1
DEFINES['USE_ANDROID_NDK_CPU_FEATURES'] = 0

View File

@ -202,10 +202,7 @@ if CONFIG['INTEL_ARCHITECTURE']:
SOURCES += ['gfxAlphaRecoverySSE2.cpp']
# The file uses SSE2 intrinsics, so it needs special compile flags on some
# compilers.
if CONFIG['GNU_CC']:
SOURCES['gfxAlphaRecoverySSE2.cpp'].flags += ['-msse2']
if CONFIG['SOLARIS_SUNPRO_CXX']:
SOURCES['gfxAlphaRecoverySSE2.cpp'].flags += ['-xarch=sse2', '-xO4']
SOURCES['gfxAlphaRecoverySSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES += [
# Includes mac system header conflicting with point/size,

View File

@ -24,10 +24,7 @@ if CONFIG['INTEL_ARCHITECTURE']:
# These files use MMX and SSE2 intrinsics, so they need special compile flags
# on some compilers.
SOURCES += ['yuv_convert_sse2.cpp']
if CONFIG['GNU_CC']:
SOURCES['yuv_convert_sse2.cpp'].flags += ['-msse2']
if CONFIG['SOLARIS_SUNPRO_CXX']:
SOURCES['yuv_convert_sse2.cpp'].flags += ['-xarch=sse2', '-xO4']
SOURCES['yuv_convert_sse2.cpp'].flags += CONFIG['SSE2_FLAGS']
# MSVC doesn't support MMX when targeting AMD64.
if CONFIG['_MSC_VER']:
@ -37,10 +34,7 @@ if CONFIG['INTEL_ARCHITECTURE']:
]
else:
SOURCES += ['yuv_convert_mmx.cpp']
if CONFIG['GNU_CC']:
SOURCES['yuv_convert_mmx.cpp'].flags += ['-mmmx']
if CONFIG['SOLARIS_SUNPRO_CXX']:
SOURCES['yuv_convert_mmx.cpp'].flags += ['-xarch=mmx', '-xO4']
SOURCES['yuv_convert_mmx.cpp'].flags += CONFIG['MMX_FLAGS']
if CONFIG['_MSC_VER']:
if CONFIG['OS_TEST'] == 'x86_64':

View File

@ -202,12 +202,7 @@ UNIFIED_SOURCES += [
if CONFIG['INTEL_ARCHITECTURE']:
SOURCES += ['nsUTF8ToUnicodeSSE2.cpp']
if CONFIG['GNU_CC']:
# nsUTF8ToUnicodeSSE2.cpp uses SSE2 intrinsics, so we need to pass -msse2 if
# we're using gcc. (See bug 585538 comment 12.)
SOURCES['nsUTF8ToUnicodeSSE2.cpp'].flags += ['-msse2']
if CONFIG['SOLARIS_SUNPRO_CXX']:
SOURCES['nsUTF8ToUnicodeSSE2.cpp'].flags += ['-xarch=sse2', '-xO4']
SOURCES['nsUTF8ToUnicodeSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
MSVC_ENABLE_PGO = True

View File

@ -24,16 +24,10 @@ UNIFIED_SOURCES += [
if CONFIG['INTEL_ARCHITECTURE']:
if CONFIG['MOZ_SAMPLE_TYPE_FLOAT32']:
SOURCES += ['sse_optimized.cpp']
if CONFIG['GNU_CC']:
SOURCES['sse_optimized.cpp'].flags += ['-msse2']
if CONFIG['SOLARIS_SUNPRO_CXX']:
SOURCES['sse_optimized.cpp'].flags += ['-xarch=sse2', '-xO4']
SOURCES['sse_optimized.cpp'].flags += CONFIG['SSE2_FLAGS']
else:
SOURCES += ['mmx_optimized.cpp']
if CONFIG['GNU_CC']:
SOURCES['mmx_optimized.cpp'].flags += ['-mmmx']
if CONFIG['SOLARIS_SUNPRO_CXX']:
SOURCES['mmx_optimized.cpp'].flags += ['-xarch=mmx', '-xO4']
SOURCES['mmx_optimized.cpp'].flags += CONFIG['MMX_FLAGS']
MSVC_ENABLE_PGO = True
if CONFIG['GKMEDIAS_SHARED_LIBRARY']:

View File

@ -39,8 +39,7 @@ else:
if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['OS_TARGET'] != 'Android':
DEFINES['_USE_SSE'] = True
DEFINES['_USE_SSE2'] = True
if CONFIG['GNU_CC']:
SOURCES['resample.c'].flags += ['-msse2']
SOURCES['resample.c'].flags += CONFIG['SSE2_FLAGS']
# Suppress warnings in third-party code.
if CONFIG['GNU_CC']:

View File

@ -92,7 +92,7 @@ if not CONFIG['_MSC_VER']:
for f in SOURCES:
if f.endswith('.c'):
if 'sse2' in f:
SOURCES[f].flags += ['-msse2']
SOURCES[f].flags += CONFIG['SSE2_FLAGS']
if 'ssse3' in f:
SOURCES[f].flags += ['-mssse3']
if 'avx2' in f:

View File

@ -20,12 +20,7 @@ UNIFIED_SOURCES += [
# nsUTF8Utils.cpp.
if CONFIG['INTEL_ARCHITECTURE']:
SOURCES += ['nsUTF8UtilsSSE2.cpp']
if CONFIG['GNU_CC']:
# gcc requires -msse2 on nsUTF8UtilsSSE2.cpp since it uses SSE2 intrinsics.
# (See bug 585538 comment 12.)
SOURCES['nsUTF8UtilsSSE2.cpp'].flags += ['-msse2']
if CONFIG['SOLARIS_SUNPRO_CXX']:
SOURCES['nsUTF8UtilsSSE2.cpp'].flags += ['-xarch=sse2', '-xO4']
SOURCES['nsUTF8UtilsSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
LOCAL_INCLUDES += [
'/mfbt/double-conversion',