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 <brianp@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7806>
This commit is contained in:
Neha Bhende 2020-11-26 08:47:10 -08:00 committed by Marge Bot
parent 81702c0ba6
commit 12fa2d2ac2
2 changed files with 21 additions and 0 deletions

View File

@ -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

View File

@ -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',
)