mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09:00
LibWasm: Implement a few SIMD instructions
This commit is contained in:
parent
5f013e5374
commit
3c176bafee
Notes:
sideshowbarker
2024-07-16 17:12:03 +09:00
Author: https://github.com/alimpfard
Commit: 3c176bafee
Pull-request: https://github.com/SerenityOS/serenity/pull/19623
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/DanShaders
8 changed files with 356 additions and 11 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Concepts.h>
|
||||
#include <AK/SIMD.h>
|
||||
|
||||
// Functions returning vectors or accepting vector arguments have different calling conventions
|
||||
|
@ -166,6 +167,31 @@ ALWAYS_INLINE static void store4_masked(VectorType v, UnderlyingType* a, Underly
|
|||
*d = v[3];
|
||||
}
|
||||
|
||||
// Shuffle
|
||||
|
||||
template<OneOf<i8x16, u8x16> T>
|
||||
ALWAYS_INLINE static T shuffle(T a, T control)
|
||||
{
|
||||
// FIXME: This is probably not the fastest way to do this.
|
||||
return T {
|
||||
a[control[0] & 0xf],
|
||||
a[control[1] & 0xf],
|
||||
a[control[2] & 0xf],
|
||||
a[control[3] & 0xf],
|
||||
a[control[4] & 0xf],
|
||||
a[control[5] & 0xf],
|
||||
a[control[6] & 0xf],
|
||||
a[control[7] & 0xf],
|
||||
a[control[8] & 0xf],
|
||||
a[control[9] & 0xf],
|
||||
a[control[10] & 0xf],
|
||||
a[control[11] & 0xf],
|
||||
a[control[12] & 0xf],
|
||||
a[control[13] & 0xf],
|
||||
a[control[14] & 0xf],
|
||||
a[control[15] & 0xf],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue