From 2aa7dc2652361fc58bf21fea2969f1a7e7bcee9e Mon Sep 17 00:00:00 2001 From: trav90 Date: Fri, 22 Mar 2024 10:28:06 -0500 Subject: [PATCH] No Issue - Only explicitly enforce GCC SSE2 optimizations when building on Intel 32-bit architectures SSE2 optimizations are used by default on 64-bit platforms. By no longer explicitly enabling SSE2 on 64-bit GCC, we can more easily enable other optimizations (e.g. AVX) without worrying about them being overridden by the SSE2 flags. --- build/autoconf/compiler-opts.m4 | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4 index 77c2e85b5e..c5cc8730a9 100644 --- a/build/autoconf/compiler-opts.m4 +++ b/build/autoconf/compiler-opts.m4 @@ -176,22 +176,24 @@ if test "$GNU_CC"; then CFLAGS="$CFLAGS -ffunction-sections -fdata-sections" CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections" fi - CFLAGS="$CFLAGS -fno-math-errno" - CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-math-errno" + CFLAGS="$CFLAGS -fno-math-errno -pipe" + CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-math-errno -pipe" - if test "$CPU_ARCH" = "x86" -o "$CPU_ARCH" = "x86_64"; then - CFLAGS="$CFLAGS -msse2 -mfpmath=sse" - CXXFLAGS="$CXXFLAGS -msse2 -mfpmath=sse" - fi + case "${host_cpu}" in + i*86) + CFLAGS="$CFLAGS -msse2 -mfpmath=sse" + CXXFLAGS="$CXXFLAGS -msse2 -mfpmath=sse" + ;; + esac if test -z "$CLANG_CC"; then case "$CC_VERSION" in 4.* | 5.*) ;; *) - # Lifetime Dead Store Elimination level 2 (default in GCC6+) breaks Gecko. - # Instead of completely disabling this optimization on newer GCC's, - # we'll force them to use level 1 optimization with -flifetime-dse=1. + # Lifetime Dead Store Elimination level 2 (default in GCC) breaks Goanna. + # Instead of completely disabling this optimization, we force level 1 + # optimization instead with -flifetime-dse=1. # Add it first so that a mozconfig can override by setting CFLAGS/CXXFLAGS. CFLAGS="-flifetime-dse=1 $CFLAGS" CXXFLAGS="-flifetime-dse=1 $CXXFLAGS"