Skip to content

Commit

Permalink
Add home made _mm256_set_m128i for compilers who are missing it
Browse files Browse the repository at this point in the history
  • Loading branch information
zanmato1984 committed Sep 14, 2024
1 parent 86569b7 commit 9134050
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
3 changes: 1 addition & 2 deletions cpp/src/arrow/acero/swiss_join_avx2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
// specific language governing permissions and limitations
// under the License.

#include <immintrin.h>

#include "arrow/acero/swiss_join_internal.h"
#include "arrow/util/bit_util.h"
#include "arrow/util/simd.h"

namespace arrow {
namespace acero {
Expand Down
3 changes: 1 addition & 2 deletions cpp/src/arrow/compute/row/compare_internal_avx2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
// specific language governing permissions and limitations
// under the License.

#include <immintrin.h>

#include "arrow/compute/row/compare_internal.h"
#include "arrow/compute/util.h"
#include "arrow/util/bit_util.h"
#include "arrow/util/simd.h"

namespace arrow {
namespace compute {
Expand Down
13 changes: 10 additions & 3 deletions cpp/src/arrow/util/simd.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,25 @@
#else
// gcc/clang (possibly others)

# if defined(ARROW_HAVE_BMI2)
# if defined(ARROW_HAVE_BMI2) || defined(ARROW_HAVE_RUNTIME_BMI2)
# include <x86intrin.h>
# endif

# if defined(ARROW_HAVE_AVX2) || defined(ARROW_HAVE_AVX512)
# if defined(ARROW_HAVE_AVX2) || defined(ARROW_HAVE_AVX512) || \
defined(ARROW_HAVE_RUNTIME_AVX2) || defined(ARROW_HAVE_RUNTIME_AVX512)
# include <immintrin.h>
# elif defined(ARROW_HAVE_SSE4_2)
# elif defined(ARROW_HAVE_SSE4_2) || defined(ARROW_HAVE_RUNTIME_SSE4_2)
# include <nmmintrin.h>
# endif

# ifdef ARROW_HAVE_NEON
# include <arm_neon.h>
# endif

// GH-44098: Workaround for missing _mm256_set_m128i in older versions of GCC.
# if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8
# define _mm256_set_m128i(hi, lo) \
_mm256_inserti128_si256(_mm256_castsi128_si256(lo), (hi), 1)
# endif

#endif

0 comments on commit 9134050

Please sign in to comment.