From 4afd782477b5a6fe569b0cd2480f5f09b1545ef9 Mon Sep 17 00:00:00 2001 From: Fabian Meyer <3982806+meyfa@users.noreply.github.com> Date: Sat, 28 Oct 2023 22:11:22 +0200 Subject: [PATCH] LibJIT: Fix Assembler::add(reg, reg) and sub(reg, reg) encoding --- Userland/Libraries/LibJIT/Assembler.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibJIT/Assembler.h b/Userland/Libraries/LibJIT/Assembler.h index 9414020ae96..fd3915cbe07 100644 --- a/Userland/Libraries/LibJIT/Assembler.h +++ b/Userland/Libraries/LibJIT/Assembler.h @@ -532,10 +532,10 @@ struct Assembler { { if (dst.type == Operand::Type::Reg && src.type == Operand::Type::Reg) { emit8(0x48 - | ((to_underlying(dst.reg) >= 8) ? 1 << 2 : 0) - | ((to_underlying(src.reg) >= 8) ? 1 << 0 : 0)); + | ((to_underlying(src.reg) >= 8) ? 1 << 2 : 0) + | ((to_underlying(dst.reg) >= 8) ? 1 << 0 : 0)); emit8(0x01); - emit8(0xc0 | (encode_reg(dst.reg) << 3) | encode_reg(src.reg)); + emit8(0xc0 | (encode_reg(src.reg) << 3) | encode_reg(dst.reg)); } else if (dst.type == Operand::Type::Reg && src.type == Operand::Type::Imm && src.fits_in_i8()) { emit8(0x48 | ((to_underlying(dst.reg) >= 8) ? 1 << 0 : 0)); emit8(0x83); @@ -555,10 +555,10 @@ struct Assembler { { if (dst.type == Operand::Type::Reg && src.type == Operand::Type::Reg) { emit8(0x48 - | ((to_underlying(dst.reg) >= 8) ? 1 << 2 : 0) - | ((to_underlying(src.reg) >= 8) ? 1 << 0 : 0)); + | ((to_underlying(src.reg) >= 8) ? 1 << 2 : 0) + | ((to_underlying(dst.reg) >= 8) ? 1 << 0 : 0)); emit8(0x29); - emit8(0xc0 | (encode_reg(dst.reg) << 3) | encode_reg(src.reg)); + emit8(0xc0 | (encode_reg(src.reg) << 3) | encode_reg(dst.reg)); } else if (dst.type == Operand::Type::Reg && src.type == Operand::Type::Imm && src.fits_in_i8()) { emit8(0x48 | ((to_underlying(dst.reg) >= 8) ? 1 << 0 : 0)); emit8(0x83);