From b8a1f577034d16a928997f9368907c9f3b1b1bba Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Tue, 10 Sep 2019 10:44:10 +0200 Subject: Don't assume Intel architecture for compiler optimizations on Linux/gcc. This only adds SSE2 flags when the CPU architecture is correct for it. Resolves #1226 --- build/autoconf/compiler-opts.m4 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'build/autoconf/compiler-opts.m4') diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4 index 82d0b43fc..0848d78d9 100644 --- a/build/autoconf/compiler-opts.m4 +++ b/build/autoconf/compiler-opts.m4 @@ -176,8 +176,13 @@ if test "$GNU_CC"; then CFLAGS="$CFLAGS -ffunction-sections -fdata-sections" CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections" fi - CFLAGS="$CFLAGS -fno-math-errno -msse2 -mfpmath=sse" - CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-math-errno -msse2 -mfpmath=sse" + CFLAGS="$CFLAGS -fno-math-errno" + CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-math-errno" + + if test "$CPU_ARCH" = x86; then + CFLAGS="$CFLAGS -msse2 -mfpmath=sse" + CXXFLAGS="$CXXFLAGS -msse2 -mfpmath=sse" + fi if test -z "$CLANG_CC"; then case "$CC_VERSION" in -- cgit v1.2.3 From 18a2244f5b1e28c2d38dd95bf93d02cef0173178 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Tue, 10 Sep 2019 19:07:28 +0200 Subject: Issue #1226 - Explicitly enable sse2 on x86_64 also. Although it's enabled by default in gcc (should be, anyway!), we're being explicit here for 64-bit x86 platforms here also. This matches the old behavior. --- build/autoconf/compiler-opts.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build/autoconf/compiler-opts.m4') diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4 index 0848d78d9..77c2e85b5 100644 --- a/build/autoconf/compiler-opts.m4 +++ b/build/autoconf/compiler-opts.m4 @@ -179,7 +179,7 @@ if test "$GNU_CC"; then CFLAGS="$CFLAGS -fno-math-errno" CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-math-errno" - if test "$CPU_ARCH" = x86; then + if test "$CPU_ARCH" = "x86" -o "$CPU_ARCH" = "x86_64"; then CFLAGS="$CFLAGS -msse2 -mfpmath=sse" CXXFLAGS="$CXXFLAGS -msse2 -mfpmath=sse" fi -- cgit v1.2.3