From afabdf713262f6eb38fe912b854f1b39420e983e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 16 Jan 2022 02:30:55 +0100 Subject: [PATCH] Havok: Fix matching issue in hkVector4f::set Annoyingly, v = {x, y, z, w} and vcombine_f32({x, y}, {z, w} lead to different codegen. It is unclear why Havok decided to split the load in two parts. --- .../Havok/Common/Base/Math/Vector/hkVector4f.inl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/hkStubs/Havok/Common/Base/Math/Vector/hkVector4f.inl b/lib/hkStubs/Havok/Common/Base/Math/Vector/hkVector4f.inl index 07a7aefb..f4bbe66e 100644 --- a/lib/hkStubs/Havok/Common/Base/Math/Vector/hkVector4f.inl +++ b/lib/hkStubs/Havok/Common/Base/Math/Vector/hkVector4f.inl @@ -22,10 +22,13 @@ inline hkVector4f& hkVector4f::operator=(hkVector4fParameter other) { } inline void hkVector4f::set(hkFloat32 x, hkFloat32 y, hkFloat32 z, hkFloat32 w) { - v[0] = x; - v[1] = y; - v[2] = z; - v[3] = w; +#ifdef HK_VECTOR4F_AARCH64_NEON + // Annoyingly, v = {x, y, z, w} and vcombine_f32({x, y}, {z, w} lead to different codegen. + // It is unclear why Havok decided to split the load in two parts. + v = vcombine_f32(float32x2_t{x, y}, float32x2_t{z, w}); +#else + v = {x, y, z, w}; +#endif } inline void hkVector4f::setAll(hkReal x) {