AK: Add generic SIMD vector load/store functions

(cherry picked from commit 27c386797df64b9c4dcbe6a27e57d9f54837e9b4)
This commit is contained in:
Hendiadyoin1 2024-04-15 20:28:57 +02:00 committed by Andrew Kaster
parent 9ee334e970
commit 873b03f661
Notes: sideshowbarker 2024-07-18 02:44:32 +09:00

View file

@ -101,6 +101,21 @@ ALWAYS_INLINE static int maskcount(i32x4 mask)
// Load / Store
template<SIMDVector VectorType>
ALWAYS_INLINE static VectorType load_unaligned(void const* a)
{
VectorType v;
__builtin_memcpy(&v, a, sizeof(VectorType));
return v;
}
template<SIMDVector VectorType>
ALWAYS_INLINE static void store_unaligned(void* a, VectorType const& v)
{
// FIXME: Does this generate the right instructions?
__builtin_memcpy(a, &v, sizeof(VectorType));
}
ALWAYS_INLINE static f32x4 load4(float const* a, float const* b, float const* c, float const* d)
{
return f32x4 { *a, *b, *c, *d };