From 5014f12509980d51cfbb34bb61b1605356592afd Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Thu, 24 Jun 2021 14:20:15 +0100 Subject: [PATCH] libstdc++: Fix condition when AVX512F ldexp implementation is used This improves codegen of ldexp if AVX512VL is available. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_x86.h (_S_ldexp): The AVX512F implementation doesn't require a _VecBltnBtmsk ABI tag, it requires either a 64-Byte input (in which case AVX512F must be available) or AVX512VL. --- libstdc++-v3/include/experimental/bits/simd_x86.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/experimental/bits/simd_x86.h b/libstdc++-v3/include/experimental/bits/simd_x86.h index 305d7a9fa548..5706bf638459 100644 --- a/libstdc++-v3/include/experimental/bits/simd_x86.h +++ b/libstdc++-v3/include/experimental/bits/simd_x86.h @@ -2611,13 +2611,14 @@ template _S_ldexp(_SimdWrapper<_Tp, _Np> __x, __fixed_size_storage_t __exp) { - if constexpr (__is_avx512_abi<_Abi>()) + if constexpr (sizeof(__x) == 64 || __have_avx512vl) { const auto __xi = __to_intrin(__x); constexpr _SimdConverter, _Tp, _Abi> __cvt; const auto __expi = __to_intrin(__cvt(__exp)); - constexpr auto __k1 = _Abi::template _S_implicit_mask_intrin<_Tp>(); + using _Up = __bool_storage_member_type_t<_Np>; + constexpr _Up __k1 = _Np < sizeof(_Up) * __CHAR_BIT__ ? _Up((1ULL << _Np) - 1) : ~_Up(); if constexpr (sizeof(__xi) == 16) { if constexpr (sizeof(_Tp) == 8) -- 2.47.2