@@ -2914,6 +2914,55 @@ namespace xsimd
29142914 {
29152915 return vreinterpretq_s64_u64 (swizzle (vreinterpretq_u64_s64 (self), mask, A {}));
29162916 }
2917+
2918+ template <class A , uint32_t V0, uint32_t V1, uint32_t V2, uint32_t V3>
2919+ XSIMD_INLINE batch<uint32_t , A> swizzle (batch<uint32_t , A> const & self,
2920+ batch_constant<uint32_t , A, V0, V1, V2, V3> mask,
2921+ requires_arch<neon>) noexcept
2922+ {
2923+ constexpr bool is_identity = detail::is_identity (mask);
2924+ constexpr bool is_dup_lo = detail::is_dup_lo (mask);
2925+ constexpr bool is_dup_hi = detail::is_dup_hi (mask);
2926+
2927+ XSIMD_IF_CONSTEXPR (is_identity)
2928+ {
2929+ return self;
2930+ }
2931+ XSIMD_IF_CONSTEXPR (is_dup_lo)
2932+ {
2933+ XSIMD_IF_CONSTEXPR (V0 == 0 && V1 == 1 )
2934+ {
2935+ return vreinterpretq_u32_u64 (vdupq_lane_u64 (vget_low_u64 (vreinterpretq_u64_u32 (self)), 0 ));
2936+ }
2937+ else
2938+ {
2939+ return vreinterpretq_u32_u64 (vdupq_lane_u64 (vreinterpret_u64_u32 (vrev64_u32 (vget_low_u32 (self))), 0 ));
2940+ }
2941+ }
2942+ XSIMD_IF_CONSTEXPR (is_dup_hi)
2943+ {
2944+ XSIMD_IF_CONSTEXPR (V0 == 2 && V1 == 3 )
2945+ {
2946+ return vreinterpretq_u32_u64 (vdupq_lane_u64 (vget_high_u64 (vreinterpretq_u64_u32 (self)), 0 ));
2947+ }
2948+ else
2949+ {
2950+ return vreinterpretq_u32_u64 (vdupq_lane_u64 (vreinterpret_u64_u32 (vrev64_u32 (vget_high_u32 (self))), 0 ));
2951+ }
2952+ return lo_all;
2953+ }
2954+ std::array<T, batch<T, A>::size> data;
2955+ self.store_aligned (data.data ());
2956+ return set (batch<T, A>(), A (), data[idx]...);
2957+ }
2958+
2959+ template <class A , uint32_t V0, uint32_t V1>
2960+ XSIMD_INLINE batch<int32_t , A> swizzle (batch<int32_t , A> const & self,
2961+ batch_constant<int32_t , A, V0, V1> mask,
2962+ requires_arch<neon>) noexcept
2963+ {
2964+ return vreinterpretq_s32_u32 (swizzle (vreinterpretq_u32_s32 (self), mask, A {}));
2965+ }
29172966 }
29182967
29192968}
0 commit comments