1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:17:44 +00:00

LibJS/JIT: Fix encoding of CMP reg,reg

This commit is contained in:
Andreas Kling 2023-10-23 10:52:46 +02:00
parent ea65214c57
commit 895c613400

View file

@ -262,10 +262,10 @@ struct Assembler {
{ {
if (lhs.type == Operand::Type::Reg && rhs.type == Operand::Type::Reg) { if (lhs.type == Operand::Type::Reg && rhs.type == Operand::Type::Reg) {
emit8(0x48 emit8(0x48
| ((to_underlying(lhs.reg) >= 8) ? 1 << 2 : 0) | ((to_underlying(rhs.reg) >= 8) ? 1 << 2 : 0)
| ((to_underlying(rhs.reg) >= 8) ? 1 << 0 : 0)); | ((to_underlying(lhs.reg) >= 8) ? 1 << 0 : 0));
emit8(0x39); emit8(0x39);
emit8(0xc0 | (encode_reg(lhs.reg) << 3) | encode_reg(rhs.reg)); emit8(0xc0 | (encode_reg(rhs.reg) << 3) | encode_reg(lhs.reg));
} else if (lhs.type == Operand::Type::Reg && rhs.type == Operand::Type::Imm32) { } else if (lhs.type == Operand::Type::Reg && rhs.type == Operand::Type::Imm32) {
emit8(0x48 | ((to_underlying(lhs.reg) >= 8) ? 1 << 0 : 0)); emit8(0x48 | ((to_underlying(lhs.reg) >= 8) ? 1 << 0 : 0));
emit8(0x81); emit8(0x81);