From 4e62197336ede3baa9da6f6aa0d98102a537d915 Mon Sep 17 00:00:00 2001 From: Fikret Ardal Date: Tue, 13 Oct 2026 10:16:32 -0400 Subject: [PATCH] added the missing namespace detail for some avx2 functions --- include/xsimd/arch/xsimd_avx2.hpp | 83 ++++++++++++++++--------------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/include/xsimd/arch/xsimd_avx2.hpp b/include/xsimd/arch/xsimd_avx2.hpp index ba6825cb8..fe5b99dc4 100644 --- a/include/xsimd/arch/xsimd_avx2.hpp +++ b/include/xsimd/arch/xsimd_avx2.hpp @@ -487,28 +487,27 @@ namespace xsimd return _mm256_xor_si256(self, other); } - // complex_low - template - XSIMD_INLINE batch complex_low(batch, A> const& self, requires_arch) noexcept - { - __m256d tmp0 = _mm256_permute4x64_pd(self.real(), _MM_SHUFFLE(3, 1, 1, 0)); - __m256d tmp1 = _mm256_permute4x64_pd(self.imag(), _MM_SHUFFLE(1, 2, 0, 0)); - return _mm256_blend_pd(tmp0, tmp1, 10); - } - - // complex_high - template - XSIMD_INLINE batch complex_high(batch, A> const& self, requires_arch) noexcept - { - __m256d tmp0 = _mm256_permute4x64_pd(self.real(), _MM_SHUFFLE(3, 3, 1, 2)); - __m256d tmp1 = _mm256_permute4x64_pd(self.imag(), _MM_SHUFFLE(3, 2, 2, 0)); - return _mm256_blend_pd(tmp0, tmp1, 10); - } - - // fast_cast namespace detail { + // complex_low + template + XSIMD_INLINE batch complex_low(batch, A> const& self, requires_arch) noexcept + { + __m256d tmp0 = _mm256_permute4x64_pd(self.real(), _MM_SHUFFLE(3, 1, 1, 0)); + __m256d tmp1 = _mm256_permute4x64_pd(self.imag(), _MM_SHUFFLE(1, 2, 0, 0)); + return _mm256_blend_pd(tmp0, tmp1, 10); + } + // complex_high + template + XSIMD_INLINE batch complex_high(batch, A> const& self, requires_arch) noexcept + { + __m256d tmp0 = _mm256_permute4x64_pd(self.real(), _MM_SHUFFLE(3, 3, 1, 2)); + __m256d tmp1 = _mm256_permute4x64_pd(self.imag(), _MM_SHUFFLE(3, 2, 2, 0)); + return _mm256_blend_pd(tmp0, tmp1, 10); + } + + // fast_cast template XSIMD_INLINE batch fast_cast(batch const& x, batch const&, requires_arch) noexcept { @@ -656,29 +655,31 @@ namespace xsimd return lt(self, other, avx {}); } } - - // load_complex - template - XSIMD_INLINE batch, A> load_complex(batch const& hi, batch const& lo, requires_arch) noexcept - { - using batch_type = batch; - batch_type real = _mm256_castpd_ps( - _mm256_permute4x64_pd( - _mm256_castps_pd(_mm256_shuffle_ps(hi, lo, _MM_SHUFFLE(2, 0, 2, 0))), - _MM_SHUFFLE(3, 1, 2, 0))); - batch_type imag = _mm256_castpd_ps( - _mm256_permute4x64_pd( - _mm256_castps_pd(_mm256_shuffle_ps(hi, lo, _MM_SHUFFLE(3, 1, 3, 1))), - _MM_SHUFFLE(3, 1, 2, 0))); - return { real, imag }; - } - template - XSIMD_INLINE batch, A> load_complex(batch const& hi, batch const& lo, requires_arch) noexcept + namespace detail { - using batch_type = batch; - batch_type real = _mm256_permute4x64_pd(_mm256_unpacklo_pd(hi, lo), _MM_SHUFFLE(3, 1, 2, 0)); - batch_type imag = _mm256_permute4x64_pd(_mm256_unpackhi_pd(hi, lo), _MM_SHUFFLE(3, 1, 2, 0)); - return { real, imag }; + // load_complex + template + XSIMD_INLINE batch, A> load_complex(batch const& hi, batch const& lo, requires_arch) noexcept + { + using batch_type = batch; + batch_type real = _mm256_castpd_ps( + _mm256_permute4x64_pd( + _mm256_castps_pd(_mm256_shuffle_ps(hi, lo, _MM_SHUFFLE(2, 0, 2, 0))), + _MM_SHUFFLE(3, 1, 2, 0))); + batch_type imag = _mm256_castpd_ps( + _mm256_permute4x64_pd( + _mm256_castps_pd(_mm256_shuffle_ps(hi, lo, _MM_SHUFFLE(3, 1, 3, 1))), + _MM_SHUFFLE(3, 1, 2, 0))); + return { real, imag }; + } + template + XSIMD_INLINE batch, A> load_complex(batch const& hi, batch const& lo, requires_arch) noexcept + { + using batch_type = batch; + batch_type real = _mm256_permute4x64_pd(_mm256_unpacklo_pd(hi, lo), _MM_SHUFFLE(3, 1, 2, 0)); + batch_type imag = _mm256_permute4x64_pd(_mm256_unpackhi_pd(hi, lo), _MM_SHUFFLE(3, 1, 2, 0)); + return { real, imag }; + } } // load_unaligned