mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 10:19:20 +00:00
LibWasm: Use shuffle_or_0
in for vector swizzles and shuffles
Otherwise we'd hit a VERIFY in AK::SIMD::shuffle() when that operand contains an out-of-range value, the spec tests indicate that a swizzle with an out-of-range index should return 0. (cherry picked from commit cd454a1e3d0bc8b3342ed39891c9b27409ecc829)
This commit is contained in:
parent
7e9dc9c1fd
commit
144e822de2
Notes:
sideshowbarker
2024-07-18 02:44:25 +09:00
Author: https://github.com/Hendiadyoin1
Commit: 144e822de2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/617
2 changed files with 5 additions and 2 deletions
|
@ -295,7 +295,7 @@ static u128 shuffle_vector(VectorType values, VectorType indices)
|
||||||
{
|
{
|
||||||
auto vector = bit_cast<VectorType>(values);
|
auto vector = bit_cast<VectorType>(values);
|
||||||
auto indices_vector = bit_cast<VectorType>(indices);
|
auto indices_vector = bit_cast<VectorType>(indices);
|
||||||
return bit_cast<u128>(shuffle(vector, indices_vector));
|
return bit_cast<u128>(shuffle_or_0(vector, indices_vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BytecodeInterpreter::call_address(Configuration& configuration, FunctionAddress address)
|
void BytecodeInterpreter::call_address(Configuration& configuration, FunctionAddress address)
|
||||||
|
|
|
@ -10,8 +10,10 @@
|
||||||
#include <AK/BuiltinWrappers.h>
|
#include <AK/BuiltinWrappers.h>
|
||||||
#include <AK/Result.h>
|
#include <AK/Result.h>
|
||||||
#include <AK/SIMD.h>
|
#include <AK/SIMD.h>
|
||||||
|
#include <AK/SIMDExtras.h>
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
|
#include <LibWasm/Types.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
@ -229,7 +231,7 @@ struct VectorSwizzle {
|
||||||
// https://webassembly.github.io/spec/core/bikeshed/#-mathsfi8x16hrefsyntax-instr-vecmathsfswizzle%E2%91%A0
|
// https://webassembly.github.io/spec/core/bikeshed/#-mathsfi8x16hrefsyntax-instr-vecmathsfswizzle%E2%91%A0
|
||||||
auto i = bit_cast<Native128ByteVectorOf<i8, MakeSigned>>(c2);
|
auto i = bit_cast<Native128ByteVectorOf<i8, MakeSigned>>(c2);
|
||||||
auto j = bit_cast<Native128ByteVectorOf<i8, MakeSigned>>(c1);
|
auto j = bit_cast<Native128ByteVectorOf<i8, MakeSigned>>(c1);
|
||||||
auto result = AK::SIMD::shuffle(i, j);
|
auto result = shuffle_or_0(i, j);
|
||||||
return bit_cast<u128>(result);
|
return bit_cast<u128>(result);
|
||||||
}
|
}
|
||||||
static StringView name() { return "vec(8x16).swizzle"sv; }
|
static StringView name() { return "vec(8x16).swizzle"sv; }
|
||||||
|
@ -1031,4 +1033,5 @@ struct SaturatingOp {
|
||||||
|
|
||||||
static StringView name() { return "saturating_op"sv; }
|
static StringView name() { return "saturating_op"sv; }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue