From d304aac504af2c627ec2857cc2e86070de089851 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 18 Feb 2017 01:40:37 +0200 Subject: Created simd module. --- mesonbuild/compilers/compilers.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'mesonbuild/compilers/compilers.py') diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index a8ec5e3..0b196d2 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -228,6 +228,19 @@ base_options = {'b_pch': coredata.UserBooleanOption('b_pch', 'Use precompiled he True), } +gnulike_instruction_set_args = {'mmx': ['-mmmx'], + 'sse': ['-msse'], + 'sse2': ['-msse2'], + 'sse3': ['-msse3'], + 'ssse3': ['-mssse3'], + 'sse41': ['-msse4.1'], + 'sse42': ['-msse4.2'], + 'avx': ['-mavx'], + 'avx2': ['-mavx2'], + 'neon': ['-mfpu=neon'], + } + + def sanitizer_compile_args(value): if value == 'none': return [] @@ -755,6 +768,12 @@ class Compiler: return [] raise EnvironmentException('Language %s does not support linking whole archives.' % self.get_display_language()) + # Compiler arguments needed to enable the given instruction set. + # May be [] meaning nothing needed or None meaning the given set + # is not supported. + def get_instruction_set_args(self, instruction_set): + return None + def build_unix_rpath_args(self, build_dir, from_dir, rpath_paths, install_rpath): if not rpath_paths and not install_rpath: return [] @@ -933,6 +952,10 @@ class GnuCompiler: return ['-mwindows'] return [] + def get_instruction_set_args(self, instruction_set): + return gnulike_instruction_set_args.get(instruction_set, None) + + class ClangCompiler: def __init__(self, clang_type): self.id = 'clang' @@ -1010,6 +1033,9 @@ class ClangCompiler: return result return ['-Wl,--whole-archive'] + args + ['-Wl,--no-whole-archive'] + def get_instruction_set_args(self, instruction_set): + return gnulike_instruction_set_args.get(instruction_set, None) + # Tested on linux for ICC 14.0.3, 15.0.6, 16.0.4, 17.0.1 class IntelCompiler: -- cgit v1.1 From 16ec3f0e195f31ec1f64f406ad138ca94fe2f6f2 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 18 Feb 2017 16:46:50 +0200 Subject: Fix a few OSX "features". --- mesonbuild/compilers/compilers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mesonbuild/compilers/compilers.py') diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 0b196d2..9829d20 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1006,7 +1006,7 @@ class ClangCompiler: def has_multi_arguments(self, args, env): return super().has_multi_arguments( - ['-Werror=unknown-warning-option'] + args, + ['-Werror=unknown-warning-option', '-Werror=unused-command-line-argument'] + args, env) def has_function(self, funcname, prefix, env, extra_args=None, dependencies=None): -- cgit v1.1 From 8396c4f3e6bfea6bbef6539055090902c089d375 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 19 Feb 2017 16:34:17 +0200 Subject: Added VS support to simd detector. --- mesonbuild/compilers/compilers.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'mesonbuild/compilers/compilers.py') diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 9829d20..76e6f60 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -240,6 +240,30 @@ gnulike_instruction_set_args = {'mmx': ['-mmmx'], 'neon': ['-mfpu=neon'], } +vs32_instruction_set_args = {'mmx': ['/arch:SSE'], # There does not seem to be a flag just for MMX + 'sse': ['/arch:SSE'], + 'sse2': ['/arch:SSE2'], + 'sse3': ['/arch:AVX'], # VS leaped from SSE2 directly to AVX. + 'sse41': ['/arch:AVX'], + 'sse42': ['/arch:AVX'], + 'avx': ['/arch:AVX'], + 'avx2': ['/arch:AVX2'], + 'neon': None, +} + +# The 64 bit compiler defaults to /arch:avx. +vs64_instruction_set_args = {'mmx': ['/arch:AVX'], + 'sse': ['/arch:AVX'], + 'sse2': ['/arch:AVX'], + 'sse3': ['/arch:AVX'], + 'ssse3': ['/arch:AVX'], + 'sse41': ['/arch:AVX'], + 'sse42': ['/arch:AVX'], + 'avx': ['/arch:AVX'], + 'avx2': ['/arch:AVX2'], + 'neon': None, +} + def sanitizer_compile_args(value): if value == 'none': -- cgit v1.1 From 181510bd6eb767361da5e02e41be08cc65b36b08 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 19 Feb 2017 20:06:49 +0200 Subject: Fix checks on MinGW and VS2010. --- mesonbuild/compilers/compilers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mesonbuild/compilers/compilers.py') diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 76e6f60..0be3908 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -262,7 +262,7 @@ vs64_instruction_set_args = {'mmx': ['/arch:AVX'], 'avx': ['/arch:AVX'], 'avx2': ['/arch:AVX2'], 'neon': None, -} + } def sanitizer_compile_args(value): -- cgit v1.1