You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by uw...@apache.org on 2019/03/16 16:39:02 UTC

[arrow] branch master updated: ARROW-4900: [C++] polyfill __cpuidex on mingw-w64

This is an automated email from the ASF dual-hosted git repository.

uwe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 100dab0  ARROW-4900: [C++] polyfill __cpuidex on mingw-w64
100dab0 is described below

commit 100dab0cb7e61e3871023a95cd26037ff08fdca7
Author: Jeroen Ooms <je...@gmail.com>
AuthorDate: Sat Mar 16 17:38:52 2019 +0100

    ARROW-4900: [C++] polyfill __cpuidex on mingw-w64
    
    Author: Jeroen Ooms <je...@gmail.com>
    
    Closes #3923 from jeroen/cpuidex and squashes the following commits:
    
    59429f02 <Jeroen Ooms> Mention mingw-w64 polyfill in LICENSE.txt
    28619330 <Jeroen Ooms> run clang-format
    9e780465 <Jeroen Ooms> polyfill for __cpuidex on mingw-w64
---
 LICENSE.txt                    | 10 ++++++++++
 cpp/src/arrow/util/cpu-info.cc |  9 +++++++++
 2 files changed, 19 insertions(+)

diff --git a/LICENSE.txt b/LICENSE.txt
index 1605d4c..d66d4ba 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -847,3 +847,13 @@ This project include code from CMake.
 Copyright: Copyright 2000-2019 Kitware, Inc. and Contributors
 Homepage: https://gitlab.kitware.com/cmake/cmake
 License: 3-clause BSD
+
+--------------------------------------------------------------------------------
+
+This project include code from mingw-w64.
+
+* cpp/src/arrow/util/cpu-info.cc has a polyfill for mingw-w64 < 5
+
+Copyright (c) 2009 - 2013 by the mingw-w64 project
+Homepage: https://mingw-w64.org
+License: Zope Public License (ZPL) Version 2.1.
diff --git a/cpp/src/arrow/util/cpu-info.cc b/cpp/src/arrow/util/cpu-info.cc
index 41f240b..9a8cde6 100644
--- a/cpp/src/arrow/util/cpu-info.cc
+++ b/cpp/src/arrow/util/cpu-info.cc
@@ -54,6 +54,15 @@ using boost::algorithm::contains;
 using boost::algorithm::trim;
 using std::max;
 
+#if defined(__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR < 5
+void __cpuidex(int CPUInfo[4], int function_id, int subfunction_id) {
+  __asm__ __volatile__("cpuid"
+                       : "=a"(CPUInfo[0]), "=b"(CPUInfo[1]), "=c"(CPUInfo[2]),
+                         "=d"(CPUInfo[3])
+                       : "a"(function_id), "c"(subfunction_id));
+}
+#endif
+
 namespace arrow {
 namespace internal {