aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/compilers/c.py10
-rw-r--r--mesonbuild/compilers/compilers.py24
-rw-r--r--mesonbuild/compilers/cpp.py4
-rw-r--r--mesonbuild/environment.py3
-rw-r--r--mesonbuild/modules/simd.py1
5 files changed, 38 insertions, 4 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index cf9d1ee..99c7cf4 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -810,7 +810,7 @@ class VisualStudioCCompiler(CCompiler):
std_warn_args = ['/W3']
std_opt_args = ['/O2']
- def __init__(self, exelist, version, is_cross, exe_wrap):
+ def __init__(self, exelist, version, is_cross, exe_wrap, is_64):
CCompiler.__init__(self, exelist, version, is_cross, exe_wrap)
self.id = 'msvc'
# /showIncludes is needed for build dependency tracking in Ninja
@@ -820,6 +820,7 @@ class VisualStudioCCompiler(CCompiler):
'2': ['/W3'],
'3': ['/W4']}
self.base_options = ['b_pch'] # FIXME add lto, pgo and the like
+ self.is_64 = True
# Override CCompiler.get_always_args
def get_always_args(self):
@@ -1005,3 +1006,10 @@ class VisualStudioCCompiler(CCompiler):
if not isinstance(args, list):
args = [args]
return ['/WHOLEARCHIVE:' + x for x in args]
+
+ def get_instruction_set_args(self, instruction_set):
+ if self.is_64:
+ return vs64_instruction_set_args.get(instruction_set, None)
+ return vs32_instruction_set_args.get(instruction_set, None)
+
+
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':
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py
index 01525b0..a8fc8a3 100644
--- a/mesonbuild/compilers/cpp.py
+++ b/mesonbuild/compilers/cpp.py
@@ -173,10 +173,10 @@ class IntelCPPCompiler(IntelCompiler, CPPCompiler):
class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler):
- def __init__(self, exelist, version, is_cross, exe_wrap):
+ def __init__(self, exelist, version, is_cross, exe_wrap, is_64):
self.language = 'cpp'
CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap)
- VisualStudioCCompiler.__init__(self, exelist, version, is_cross, exe_wrap)
+ VisualStudioCCompiler.__init__(self, exelist, version, is_cross, exe_wrap, is_64)
self.base_options = ['b_pch'] # FIXME add lto, pgo and the like
def get_options(self):
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index b3d72e6..ed5a216 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -537,8 +537,9 @@ class Environment:
# Visual Studio prints version number to stderr but
# everything else to stdout. Why? Lord only knows.
version = search_version(err)
+ is_64 = err.split()[0].endswith(' x64')
cls = VisualStudioCCompiler if lang == 'c' else VisualStudioCPPCompiler
- return cls(compiler, version, is_cross, exe_wrap)
+ return cls(compiler, version, is_cross, exe_wrap, is_64)
if '(ICC)' in out:
# TODO: add microsoft add check OSX
inteltype = ICC_STANDARD
diff --git a/mesonbuild/modules/simd.py b/mesonbuild/modules/simd.py
index 3a9fe59..4a9bdd7 100644
--- a/mesonbuild/modules/simd.py
+++ b/mesonbuild/modules/simd.py
@@ -57,6 +57,7 @@ class SimdModule(ExtensionModule):
iset_fname = kwargs[iset] # Migth also be an array or Files. static_library will validate.
args = compiler.get_instruction_set_args(iset)
if args is None:
+ mlog.log('Compiler supports %s:' % iset, mlog.red('NO'))
continue
if len(args) > 0:
if not compiler.has_multi_arguments(args, state.environment):