diff --git a/include/xsimd/arch/xsimd_neon.hpp b/include/xsimd/arch/xsimd_neon.hpp index 17642268d..dfbc235ff 100644 --- a/include/xsimd/arch/xsimd_neon.hpp +++ b/include/xsimd/arch/xsimd_neon.hpp @@ -2455,6 +2455,61 @@ namespace xsimd return vshlq_s32(lhs, vnegq_s32(rhs)); } + // first + template + XSIMD_INLINE float first(batch const& self, requires_arch) noexcept + { + return vgetq_lane_f32(self, 0); + } + + template = 0> + XSIMD_INLINE T first(batch val, requires_arch) noexcept + { + return vgetq_lane_u8(val, 0); + } + + template = 0> + XSIMD_INLINE T first(batch val, requires_arch) noexcept + { + return vgetq_lane_s8(val, 0); + } + + template = 0> + XSIMD_INLINE T first(batch val, requires_arch) noexcept + { + return vgetq_lane_u16(val, 0); + } + + template = 0> + XSIMD_INLINE T first(batch val, requires_arch) noexcept + { + return vgetq_lane_s16(val, 0); + } + + template = 0> + XSIMD_INLINE T first(batch val, requires_arch) noexcept + { + return vgetq_lane_u32(val, 0); + } + + template = 0> + XSIMD_INLINE T first(batch val, requires_arch) noexcept + { + return vgetq_lane_s32(val, 0); + } + + template = 0> + XSIMD_INLINE T first(batch val, requires_arch) noexcept + { + return vgetq_lane_u64(val, 0); + } + + template = 0> + XSIMD_INLINE T first(batch val, requires_arch) noexcept + { + return vgetq_lane_s64(val, 0); + } + // Overloads of bitwise shifts accepting two batches of uint64/int64 are not available with ARMv7 /******* diff --git a/include/xsimd/arch/xsimd_neon64.hpp b/include/xsimd/arch/xsimd_neon64.hpp index 933b1e680..c8e1330db 100644 --- a/include/xsimd/arch/xsimd_neon64.hpp +++ b/include/xsimd/arch/xsimd_neon64.hpp @@ -28,6 +28,13 @@ namespace xsimd { using namespace types; + // first + template + XSIMD_INLINE double first(batch const& self, requires_arch) noexcept + { + return vgetq_lane_f64(self, 0); + } + /******* * all * *******/