summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorJesse Natalie <jenatali@microsoft.com>2022-06-03 07:38:40 -0700
committerMarge Bot <emma+marge@anholt.net>2022-11-17 02:14:39 +0000
commit2d042066735bad4c1842502f233695ef3340f573 (patch)
tree5f9de85dd9c125a8419403062db808bd9609be98 /meson.build
parentad0d39efed503b8144dd2db72f467dc22b508ab7 (diff)
downloadmesa-2d042066735bad4c1842502f233695ef3340f573.tar.gz
meson: Enable SSE4.1 for MSVC
Modern MSVC always supports compiling with the SSE4.1 intrinsics with no additional command line options, but doesn't have any options for auto-vectorizing into SSE4.1. Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Reviewed-by: Yonggang Luo <luoyonggang@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16840>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build50
1 files changed, 26 insertions, 24 deletions
diff --git a/meson.build b/meson.build
index 77cbe5efef6..7f62618e8f2 100644
--- a/meson.build
+++ b/meson.build
@@ -1260,34 +1260,36 @@ if host_machine.system() == 'windows'
endif
endif
-if host_machine.cpu_family().startswith('x86') and cc.get_argument_syntax() != 'msvc'
+sse41_args = []
+with_sse41 = false
+if host_machine.cpu_family().startswith('x86')
pre_args += '-DUSE_SSE41'
with_sse41 = true
- sse41_args = ['-msse4.1']
-
- if host_machine.cpu_family() == 'x86'
- if get_option('sse2')
- # These settings make generated GCC code match MSVC and follow
- # GCC advice on https://gcc.gnu.org/wiki/FloatingPointMath#x86note
- #
- # NOTE: We need to ensure stack is realigned given that we
- # produce shared objects, and have no control over the stack
- # alignment policy of the application. Therefore we need
- # -mstackrealign or -mincoming-stack-boundary=2.
- #
- # XXX: We could have SSE without -mstackrealign if we always used
- # __attribute__((force_align_arg_pointer)), but that's not
- # always the case.
- c_args += ['-msse2', '-mfpmath=sse', '-mstackrealign']
- else
- # GCC on x86 (not x86_64) with -msse* assumes a 16 byte aligned stack, but
- # that's not guaranteed
- sse41_args += '-mstackrealign'
+
+ if cc.get_id() != 'msvc'
+ sse41_args = ['-msse4.1']
+
+ if host_machine.cpu_family() == 'x86'
+ if get_option('sse2')
+ # These settings make generated GCC code match MSVC and follow
+ # GCC advice on https://gcc.gnu.org/wiki/FloatingPointMath#x86note
+ #
+ # NOTE: We need to ensure stack is realigned given that we
+ # produce shared objects, and have no control over the stack
+ # alignment policy of the application. Therefore we need
+ # -mstackrealign or -mincoming-stack-boundary=2.
+ #
+ # XXX: We could have SSE without -mstackrealign if we always used
+ # __attribute__((force_align_arg_pointer)), but that's not
+ # always the case.
+ c_args += ['-msse2', '-mfpmath=sse', '-mstackrealign']
+ else
+ # GCC on x86 (not x86_64) with -msse* assumes a 16 byte aligned stack, but
+ # that's not guaranteed
+ sse41_args += '-mstackrealign'
+ endif
endif
endif
-else
- with_sse41 = false
- sse41_args = []
endif
# Check for GCC style atomics