mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-08 02:26:10 +00:00
LibWasm: Implement SIMD bitwise operations
This commit is contained in:
parent
0a55e36403
commit
625fbc8085
Notes:
sideshowbarker
2024-07-17 11:06:06 +09:00
Author: https://github.com/dzfrias
Commit: 625fbc8085
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/558
2 changed files with 29 additions and 3 deletions
|
@ -1548,12 +1548,24 @@ void BytecodeInterpreter::interpret(Configuration& configuration, InstructionPoi
|
|||
return unary_operation<u128, u128, Operators::VectorFloatUnaryOp<2, Operators::Negate>>(configuration);
|
||||
case Instructions::f64x2_abs.value():
|
||||
return unary_operation<u128, u128, Operators::VectorFloatUnaryOp<2, Operators::Absolute>>(configuration);
|
||||
case Instructions::v128_not.value():
|
||||
case Instructions::v128_and.value():
|
||||
case Instructions::v128_andnot.value():
|
||||
return binary_numeric_operation<u128, u128, Operators::BitAnd>(configuration);
|
||||
case Instructions::v128_or.value():
|
||||
return binary_numeric_operation<u128, u128, Operators::BitOr>(configuration);
|
||||
case Instructions::v128_xor.value():
|
||||
case Instructions::v128_bitselect.value():
|
||||
return binary_numeric_operation<u128, u128, Operators::BitXor>(configuration);
|
||||
case Instructions::v128_not.value():
|
||||
return unary_operation<u128, u128, Operators::BitNot>(configuration);
|
||||
case Instructions::v128_andnot.value():
|
||||
return binary_numeric_operation<u128, u128, Operators::BitAndNot>(configuration);
|
||||
case Instructions::v128_bitselect.value(): {
|
||||
auto mask = *configuration.stack().pop().get<Value>().to<u128>();
|
||||
auto false_vector = *configuration.stack().pop().get<Value>().to<u128>();
|
||||
auto true_vector = *configuration.stack().pop().get<Value>().to<u128>();
|
||||
u128 result = (true_vector & mask) | (false_vector & ~mask);
|
||||
configuration.stack().push(Value(result));
|
||||
return;
|
||||
}
|
||||
case Instructions::v128_any_true.value():
|
||||
case Instructions::v128_load8_lane.value():
|
||||
case Instructions::v128_load16_lane.value():
|
||||
|
|
|
@ -96,6 +96,20 @@ struct BitShiftRight {
|
|||
static StringView name() { return ">>"sv; }
|
||||
};
|
||||
|
||||
struct BitAndNot {
|
||||
template<typename Lhs, typename Rhs>
|
||||
auto operator()(Lhs lhs, Rhs rhs) const { return lhs & ~rhs; }
|
||||
|
||||
static StringView name() { return "andnot"sv; }
|
||||
};
|
||||
|
||||
struct BitNot {
|
||||
template<typename Lhs>
|
||||
auto operator()(Lhs lhs) const { return ~lhs; }
|
||||
|
||||
static StringView name() { return "~"sv; }
|
||||
};
|
||||
|
||||
struct BitRotateLeft {
|
||||
template<typename Lhs, typename Rhs>
|
||||
auto operator()(Lhs lhs, Rhs rhs) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue