diff --git a/libsrc/core/simd_arm64.hpp b/libsrc/core/simd_arm64.hpp index f5bf694f..13f57b14 100644 --- a/libsrc/core/simd_arm64.hpp +++ b/libsrc/core/simd_arm64.hpp @@ -14,9 +14,10 @@ namespace ngcore mask[1] = i > 1 ? -1 : 0; } - SIMD (bool i0, bool i1) { mask[0] = i0 ? -1:0; mask[1] = i1 ? -1 : 0; } + SIMD (bool i0, bool i1) { mask[0] = i0 ? -1 : 0; mask[1] = i1 ? -1 : 0; } SIMD (SIMD i0, SIMD i1) { mask[0] = i0[0]; mask[1] = i1[0]; } - SIMD (float64x2_t _data) : mask{_data} { } + // SIMD (float64x2_t _data) : mask{_data} { } + SIMD (int64x2_t _data) : mask{_data} { } auto Data() const { return mask; } static constexpr int Size() { return 2; } // static NETGEN_INLINE SIMD GetMaskFromBits (unsigned int i); @@ -165,7 +166,8 @@ namespace ngcore NETGEN_INLINE SIMD If (SIMD a, SIMD b, SIMD c) { // return { a[0] ? b[0] : c[0], a[1] ? b[1] : c[1] }; - return vbslq_f64(a.Data(), b.Data(), c.Data()); + uint64x2_t mask = vreinterpretq_u64_s64(a.Data()); + return vbslq_f64(mask, b.Data(), c.Data()); } NETGEN_INLINE SIMD If (SIMD a, SIMD b, SIMD c) { @@ -174,7 +176,10 @@ namespace ngcore NETGEN_INLINE SIMD operator&& (SIMD a, SIMD b) { - return vandq_u64 (a.Data(), b.Data()); + uint64x2_t m1 = vreinterpretq_u64_s64(a.Data()); + uint64x2_t m2 = vreinterpretq_u64_s64(b.Data()); + uint64x2_t res = vandq_u64 (m1, m2); + return vreinterpretq_s64_u64(res); } }