Skip to content

Commit acafe62

Browse files
committed
guarding against avx512vl operations
1 parent f7ddaf5 commit acafe62

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

include/xsimd/arch/xsimd_avx2.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,12 @@ namespace xsimd
200200
{
201201
return _mm256_sllv_epi32(self, other);
202202
}
203+
#if XSIMD_WITH_AVX512VL
203204
else XSIMD_IF_CONSTEXPR(sizeof(T) == 8)
204205
{
205206
return _mm256_sllv_epi64(self, other);
206207
}
208+
#endif
207209
else
208210
{
209211
return bitwise_lshift(self, other, avx {});
@@ -343,10 +345,12 @@ namespace xsimd
343345
{
344346
return _mm256_srlv_epi32(self, other);
345347
}
348+
#if XSIMD_WITH_AVX512VL
346349
else XSIMD_IF_CONSTEXPR(sizeof(T) == 8)
347350
{
348351
return _mm256_srlv_epi64(self, other);
349352
}
353+
#endif
350354
else
351355
{
352356
return bitwise_rshift(self, other, avx {});

include/xsimd/config/xsimd_config.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,17 @@
244244
#define XSIMD_WITH_AVX512DQ 0
245245
#endif
246246

247+
/**
248+
* @ingroup xsimd_config_macro
249+
*
250+
* Set to 1 if AVX512VL is available at compile-time, to 0 otherwise.
251+
*/
252+
#ifdef __AVX512VL__
253+
#define XSIMD_WITH_AVX512VL XSIMD_WITH_AVX512F
254+
#else
255+
#define XSIMD_WITH_AVX512VL 0
256+
#endif
257+
247258
/**
248259
* @ingroup xsimd_config_macro
249260
*

0 commit comments

Comments
 (0)