13
0

Fix optimized armhf builds

Apparently gcc-6.2 with -O3 and -mfpu=neon can use ARM instructions
that requires 64bit alignment (here vst1.64) with data that
is not 64bit aligned (g->strcache) https://i.imgur.com/vYktsUn.png

So we need to be able to build "arm_neon_functions.cc" with
-mfpu=neon, while not automatically using NEON for the rest
of the codebase, unless explicitly asked for.
This commit is contained in:
Robin Gareus 2020-08-22 02:29:05 +02:00
parent 81fb723561
commit 773a1a0725
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 19 additions and 1 deletions

View File

@ -481,10 +481,25 @@ def build(bld):
obj.source += [ 'sse_functions_xmm.cc' ] obj.source += [ 'sse_functions_xmm.cc' ]
obj.source += [ 'sse_functions_64bit_win.s', 'sse_avx_functions_64bit_win.s' ] obj.source += [ 'sse_functions_64bit_win.s', 'sse_avx_functions_64bit_win.s' ]
avx_sources = [ 'sse_functions_avx.cc' ] avx_sources = [ 'sse_functions_avx.cc' ]
elif bld.env['build_target'] == 'armhf' or bld.env['build_target'] == 'aarch64': elif bld.env['build_target'] == 'aarch64':
obj.source += ['arm_neon_functions.cc'] obj.source += ['arm_neon_functions.cc']
obj.defines += [ 'ARM_NEON_SUPPORT' ] obj.defines += [ 'ARM_NEON_SUPPORT' ]
elif bld.env['build_target'] == 'armhf':
# 32bit ARM needs -mfpu=neon
obj.defines += [ 'ARM_NEON_SUPPORT' ]
arm_neon_cxxflags = list(bld.env['CXXFLAGS'])
arm_neon_cxxflags.append (bld.env['compiler_flags_dict']['neon'])
bld(features = 'cxx cxxstlib asm',
source = ['arm_neon_functions.cc'],
cxxflags = arm_neon_cxxflags,
includes = [ '.' ],
definfes = obj.defines,
use = [ 'libpbd', 'libevoral'],
target = 'arm_neon_functions')
obj.use += ['arm_neon_functions' ]
if avx_sources: if avx_sources:
# as long as we want to use AVX intrinsics in this file, # as long as we want to use AVX intrinsics in this file,
# compile it with -mavx flag - append avx flag to the existing # compile it with -mavx flag - append avx flag to the existing

View File

@ -86,6 +86,8 @@ compiler_flags_dictionaries= {
'attasm': '-masm=att', 'attasm': '-masm=att',
# Flags to make AVX instructions/intrinsics available # Flags to make AVX instructions/intrinsics available
'avx': '-mavx', 'avx': '-mavx',
# Flags to make ARM/NEON instructions/intrinsics available
'neon': '-mfpu=neon',
# Flags to generate position independent code, when needed to build a shared object # Flags to generate position independent code, when needed to build a shared object
'pic': '-fPIC', 'pic': '-fPIC',
# Flags required to compile C code with anonymous unions (only part of C11) # Flags required to compile C code with anonymous unions (only part of C11)
@ -120,6 +122,7 @@ compiler_flags_dictionaries= {
'c99': '/TP', 'c99': '/TP',
'attasm': '', 'attasm': '',
'avx': '', 'avx': '',
'neon': '',
'pic': '', 'pic': '',
'c-anonymous-union': '', 'c-anonymous-union': '',
}, },