Don't generate (S)SSE3 instructions in static code.
-march=core2 implies support for both the SSE3 and SSSE3 instruction
set extensions. Chrome should run on CPUs with only SSE2 as well.
Also, make use of SSE on x86-32 for floating-point operations, to be
consistent with x86-64, and don't favor any specific architecture for
tuning.
Bug chromium:797763
Change-Id: Ia17428734460ed855f3aa0f83c6d2f6b3775094c
Reviewed-on: https://swiftshader-review.googlesource.com/15688
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 6403ca8..9404d0b 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -74,13 +74,16 @@
cflags += [
"-m64",
"-fPIC",
- "-march=core2",
+ "-march=x86-64",
+ "-mtune=generic",
]
} else { # 32 bit version
cflags += [
"-m32",
"-msse2",
- "-march=i686",
+ "-mfpmath=sse",
+ "-march=pentium4",
+ "-mtune=generic",
]
}
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f60f6e1..4caad12 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -166,12 +166,15 @@
if(ARCH EQUAL "x86")
set_cpp_flag("-m32")
set_cpp_flag("-msse2")
- set_cpp_flag("-march=i686")
+ set_cpp_flag("-mfpmath=sse")
+ set_cpp_flag("-march=pentium4")
+ set_cpp_flag("-mtune=generic")
endif()
if(ARCH EQUAL "x86_64")
set_cpp_flag("-m64")
set_cpp_flag("-fPIC")
- set_cpp_flag("-march=core2")
+ set_cpp_flag("-march=x86-64")
+ set_cpp_flag("-mtune=generic")
endif()
# Use -g3 to have even more debug info