meson: Split sse2_arg and sse2_args out of c_cpp_args
authorYonggang Luo <luoyonggang@gmail.com>
Fri, 17 Feb 2023 06:24:20 +0000 (14:24 +0800)
committerMarge Bot <emma+marge@anholt.net>
Mon, 27 Feb 2023 13:50:11 +0000 (13:50 +0000)
This is used to replace c_sse2_arg and c_sse2_args in latter commits

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21375>

meson.build

index 36c1d0d..de030fb 100644 (file)
@@ -1104,6 +1104,8 @@ if host_machine.system() == 'windows'
   endif
 endif
 
+sse2_arg = []
+sse2_args = []
 sse41_args = []
 with_sse41 = false
 if host_machine.cpu_family().startswith('x86')
@@ -1114,6 +1116,9 @@ if host_machine.cpu_family().startswith('x86')
     sse41_args = ['-msse4.1']
 
     if host_machine.cpu_family() == 'x86'
+      # x86_64 have sse2 by default, so sse2 args only for x86
+      sse2_arg = ['-msse2', '-mfpmath=sse']
+      sse2_args = [sse2_arg, '-mstackrealign']
       if get_option('sse2')
         # These settings make generated GCC code match MSVC and follow
         # GCC advice on https://gcc.gnu.org/wiki/FloatingPointMath#x86note
@@ -1126,7 +1131,10 @@ if host_machine.cpu_family().startswith('x86')
         # XXX: We could have SSE without -mstackrealign if we always used
         # __attribute__((force_align_arg_pointer)), but that's not
         # always the case.
-        c_cpp_args += ['-msse2', '-mfpmath=sse', '-mstackrealign']
+        c_cpp_args += sse2_args
+        # sse2_args are adopted into c_cpp_args to avoid duplicated sse2 command line args
+        sse2_arg = []
+        sse2_args = []
       else
         # GCC on x86 (not x86_64) with -msse* assumes a 16 byte aligned stack, but
         # that's not guaranteed