Repository: arrow
Updated Branches:
  refs/heads/master 6d31d5928 -> 79fddd113


ARROW-90: [C++] Check for SIMD instruction set support

This also adds an option to disable the usage of a specific instruction
set, e.g. you compile on a machine that supports SSE3 but you want to
use the binary also on machines without SSE3. (Distribution packagers
will love that option!)

Author: Uwe L. Korn <uw...@xhochy.com>

Closes #50 from xhochy/arrow-90 and squashes the following commits:

6fd80d3 [Uwe L. Korn] ARROW-90: Check for SIMD instruction set support


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/79fddd11
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/79fddd11
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/79fddd11

Branch: refs/heads/master
Commit: 79fddd1138ff69953e943f5980533dc01eabbb97
Parents: 6d31d59
Author: Uwe L. Korn <uw...@xhochy.com>
Authored: Thu Mar 31 17:48:38 2016 -0700
Committer: Wes McKinney <w...@apache.org>
Committed: Thu Mar 31 17:48:38 2016 -0700

----------------------------------------------------------------------
 cpp/CMakeLists.txt | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/79fddd11/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 6ed2768..26d12d2 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -66,6 +66,14 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL 
"${CMAKE_CURRENT_SOURCE_DIR}")
     "Build the Arrow IPC extensions"
     ON)
 
+  option(ARROW_SSE3
+    "Build Arrow with SSE3"
+    ON)
+
+  option(ARROW_ALTIVEC
+    "Build Arrow with Altivec"
+    ON)
+
 endif()
 
 if(NOT ARROW_BUILD_TESTS)
@@ -81,9 +89,25 @@ endif()
 # Compiler flags
 ############################################################
 
+# Check if the target architecture and compiler supports some special
+# instruction sets that would boost performance.
+include(CheckCXXCompilerFlag)
+# x86/amd64 compiler flags
+CHECK_CXX_COMPILER_FLAG("-msse3" CXX_SUPPORTS_SSE3)
+# power compiler flags
+CHECK_CXX_COMPILER_FLAG("-maltivec" CXX_SUPPORTS_ALTIVEC)
+
 # compiler flags that are common across debug/release builds
 #  - Wall: Enable all warnings.
-set(CXX_COMMON_FLAGS "-std=c++11 -msse3 -Wall")
+set(CXX_COMMON_FLAGS "-std=c++11 -Wall")
+
+# Only enable additional instruction sets if they are supported
+if (CXX_SUPPORTS_SSE3 AND ARROW_SSE3)
+    set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -msse3")
+endif()
+if (CXX_SUPPORTS_ALTIVEC AND ARROW_ALTIVEC)
+    set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -maltivec")
+endif()
 
 if (APPLE)
   # Depending on the default OSX_DEPLOYMENT_TARGET (< 10.9), libstdc++ may be

Reply via email to