LibWasm: Fix sign issues in SIMD cmp ops

This commit is contained in:
Diego 2024-07-11 21:23:00 -07:00 committed by Ali Mohammad Pur
parent 0a0651f34e
commit 4c7ef01b44
Notes: sideshowbarker 2024-07-17 06:51:10 +09:00

View file

@ -289,8 +289,11 @@ struct VectorCmpOp {
auto result = bit_cast<Native128ByteVectorOf<ElementType, SetSign>>(c1);
auto other = bit_cast<Native128ByteVectorOf<ElementType, SetSign>>(c2);
Op op;
for (size_t i = 0; i < VectorSize; ++i)
result[i] = op(result[i], other[i]) ? static_cast<MakeUnsigned<ElementType>>(-1) : 0;
for (size_t i = 0; i < VectorSize; ++i) {
SetSign<ElementType> lhs = result[i];
SetSign<ElementType> rhs = other[i];
result[i] = op(lhs, rhs) ? static_cast<MakeUnsigned<ElementType>>(-1) : 0;
}
return bit_cast<u128>(result);
}