[Summary] To make build portable on systems with a processor which does not support AVX, only file which contains AVX intrinsics should be compiled with -mavx flag

[Reviewed by] Paul Davis
This commit is contained in:
Greg Zharun 2015-04-22 11:06:26 +03:00
parent 20ceb76ead
commit 8a06144bd0
2 changed files with 14 additions and 2 deletions

View file

@ -414,8 +414,20 @@ def build(bld):
u = PLATFORM.uname ()
cpu = u[4]
if re.search ("(x86_64|AMD64)", cpu) != None:
obj.source += [ 'sse_functions_xmm.cc', 'sse_functions_avx.cc' ]
obj.source += [ 'sse_functions_xmm.cc' ]
obj.source += [ 'sse_functions_64bit_win.s', 'sse_avx_functions_64bit_win.s' ]
# as long as we want to use AVX intrinsics in this file,
# compile it with -mavx flag - append avx flag to the existing
avx_cxxflags = list(bld.env['CXXFLAGS'])
avx_cxxflags.append ('-mavx')
bld(features = 'cxx',
source = 'sse_functions_avx.cc',
cxxflags = avx_cxxflags,
target = 'sse_avx_functions')
obj.use += ['sse_avx_functions']
# i18n
if bld.is_defined('ENABLE_NLS'):

View file

@ -266,7 +266,7 @@ def set_compiler_flags (conf,opt):
# mingw GCC compiler to uses at&t (Unix specific) assembler dialect by default
# compiler_flags.append (["--mmnemonic=att", "msyntax=att")
compiler_flags.extend (["-mavx", "-mvzeroupper", "-DUSE_XMMINTRIN"])
compiler_flags.extend (["-DUSE_XMMINTRIN"])
# end of processor-specific section