diff --git a/include/athena/simd/simd_neon.hpp b/include/athena/simd/simd_neon.hpp index 93cd04d..5deec5c 100644 --- a/include/athena/simd/simd_neon.hpp +++ b/include/athena/simd/simd_neon.hpp @@ -35,12 +35,7 @@ public: } template [[nodiscard]] inline __simd_storage __shuffle() const noexcept { - storage_type ret; - ret = vmovq_n_f32(vgetq_lane_f32(__storage_, x)); - ret = vsetq_lane_f32(vgetq_lane_f32(__storage_, y), ret, 1); - ret = vsetq_lane_f32(vgetq_lane_f32(__storage_, z), ret, 2); - ret = vsetq_lane_f32(vgetq_lane_f32(__storage_, w), ret, 3); - return __simd_storage(ret); + return __simd_storage{__storage_[x], __storage_[y], __storage_[z], __storage_[w]}; } inline void __copy_from(const simd_data>& __buffer) noexcept { @@ -71,8 +66,7 @@ public: template <> inline simd simd::operator-() const { - return vreinterpretq_f32_s32( - veorq_s32(vreinterpretq_s32_f32(__s_.__storage_), vreinterpretq_s32_f32(vdupq_n_f32(-0.f)))); + return vnegq_f32(__s_.__storage_); } inline simd operator+(const simd& a, const simd& b) { @@ -172,7 +166,7 @@ public: [[nodiscard]] inline double __dot3(const __simd_storage& other) const noexcept { const vector_type mul1 = vmulq_f64(__storage_.val[0], other.__storage_.val[0]); const vector_type mul2 = vmulq_f64(__storage_.val[1], other.__storage_.val[1]); - return vaddvq_f64(vcombine_f64(vcreate_f64(vaddvq_f64(mul1)), vget_low_f64(mul2))); + return vaddvq_f64(vcombine_f64(vdup_n_f64(vaddvq_f64(mul1)), vget_low_f64(mul2))); } [[nodiscard]] inline double __dot4(const __simd_storage& other) const noexcept { const vector_type mul1 = vmulq_f64(__storage_.val[0], other.__storage_.val[0]); @@ -215,8 +209,7 @@ template <> inline simd simd::operator-() const { simd ret; for (int i = 0; i < 2; ++i) - ret.__s_.__storage_.val[i] = vreinterpretq_f64_s64( - veorq_s64(vreinterpretq_s64_f64(__s_.__storage_.val[i]), vreinterpretq_s64_f64(vdupq_n_f64(-0.0)))); + ret.__s_.__storage_.val[i] = vnegq_f64(__s_.__storage_.val[i]); return ret; }