Module: Mesa
Branch: master
Commit: 12fa2d2ac22ef3ddbc8c5efaf55064fe1a19fd29
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=12fa2d2ac22ef3ddbc8c5efaf55064fe1a19fd29

Author: Neha Bhende <[email protected]>
Date:   Thu Nov 26 08:47:10 2020 -0800

meson.build: Use SSE math for MinGW X86 build as per sse2 option

This patch adds missing compiler flags to build 32bit driver. It helps to build 
32bit
using mingw successfully

Generated GL driver is tested using piglit, glretrace, conform and
some opengl apps

Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Charmaine Lee <[email protected]>
Reviewed-by: Jose Fonseca <[email protected]>
Reviewed-by: Erik Faye-Lund <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7806>

---

 meson.build       | 15 +++++++++++++++
 meson_options.txt |  6 ++++++
 2 files changed, 21 insertions(+)

diff --git a/meson.build b/meson.build
index d6cd3136b36..6089a620eaf 100644
--- a/meson.build
+++ b/meson.build
@@ -1129,6 +1129,21 @@ if host_machine.system() == 'windows'
   endif
 endif
 
+if get_option('sse2') and host_machine.system() == 'windows' and 
host_machine.cpu_family() == 'x86' and cc.get_id() == 'gcc'
+  # These settings make generated MinGW 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 += ['-msse', '-msse2', '-mfpmath=sse', '-mstackrealign']
+endif
+
 if host_machine.cpu_family().startswith('x86') and cc.get_id() != 'msvc'
   pre_args += '-DUSE_SSE41'
   with_sse41 = true
diff --git a/meson_options.txt b/meson_options.txt
index 8bc3a228f25..949d7d39774 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -441,3 +441,9 @@ option(
   value : 'auto',
   description : 'Use ZSTD instead of ZLIB in some cases.'
 )
+option(
+  'sse2',
+  type : 'boolean',
+  value : true,
+  description : 'use msse2 flag for mingw x86. Default: true',
+)

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to