File tree 2 files changed +6
-4
lines changed
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,8 @@ extern "C" {
37
37
* Target specific
38
38
=========================================*/
39
39
#ifndef ZSTD_NO_INTRINSICS
40
- # if defined(__BMI__ ) && defined(__GNUC__ )
41
- # include <immintrin.h> /* support for bextr (experimental) */
40
+ # if ( defined(__BMI__ ) || defined( __BMI2__ ) ) && defined(__GNUC__ )
41
+ # include <immintrin.h> /* support for bextr (experimental)/bzhi */
42
42
# elif defined(__ICCARM__ )
43
43
# include <intrinsics.h>
44
44
# endif
@@ -164,8 +164,8 @@ MEM_STATIC size_t BIT_initCStream(BIT_CStream_t* bitC,
164
164
165
165
MEM_STATIC FORCE_INLINE_ATTR size_t BIT_getLowerBits (size_t bitContainer , U32 const nbBits )
166
166
{
167
- #if defined(STATIC_BMI2 ) && STATIC_BMI2 == 1
168
- return _bzhi_u64 (bitContainer , nbBits );
167
+ #if defined(STATIC_BMI2 ) && STATIC_BMI2 == 1 && !defined( ZSTD_NO_INTRINSICS )
168
+ return _bzhi_u64 (bitContainer , nbBits );
169
169
#else
170
170
assert (nbBits < BIT_MASK_SIZE );
171
171
return bitContainer & BIT_mask [nbBits ];
Original file line number Diff line number Diff line change 181
181
# ifdef __AVX2__ // MSVC does not have a BMI2 specific flag, but every CPU that supports AVX2 also supports BMI2
182
182
# define STATIC_BMI2 1
183
183
# endif
184
+ # elif defined(__BMI2__) && defined(__x86_64__) && defined(__GNUC__)
185
+ # define STATIC_BMI2 1
184
186
# endif
185
187
#endif
186
188
You can’t perform that action at this time.
0 commit comments