Skip to content

Commit

Permalink
n_fermion_sector_view: Carefully check availability of BMI2 intrinsics
Browse files Browse the repository at this point in the history
  • Loading branch information
krivenko committed Jul 18, 2024
1 parent d664293 commit 8860314
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/libcommute/loperator/n_fermion_sector_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <utility>
#include <vector>

#if defined(__GNUC__) || defined(__clang__)
#if (defined(__GNUC__) || defined(__clang__)) && defined(__BMI2__)
#include <immintrin.h>
#endif

Expand Down Expand Up @@ -117,7 +117,7 @@ inline unsigned int popcount(sv_index_type i) {

// Parallel bits deposit
inline sv_index_type deposit_bits(sv_index_type src, sv_index_type mask) {
#if defined(__GNUC__) || defined(__clang__)
#if (defined(__GNUC__) || defined(__clang__)) && defined(__BMI2__)
return _pdep_u64(src, mask);
#else
// https://www.chessprogramming.org/BMI2#Serial_Implementation
Expand All @@ -132,7 +132,7 @@ inline sv_index_type deposit_bits(sv_index_type src, sv_index_type mask) {

// Parallel bits extract
inline sv_index_type extract_bits(sv_index_type val, sv_index_type mask) {
#if defined(__GNUC__) || defined(__clang__)
#if (defined(__GNUC__) || defined(__clang__)) && defined(__BMI2__)
return _pext_u64(val, mask);
#else
// From https://www.chessprogramming.org/BMI2#Serial_Implementation_2
Expand Down

0 comments on commit 8860314

Please sign in to comment.