Quellcode durchsuchen

LibJIT: Fix Assembler::add(reg, reg) and sub(reg, reg) encoding

Fabian Meyer vor 1 Jahr
Ursprung
Commit
4afd782477
1 geänderte Dateien mit 6 neuen und 6 gelöschten Zeilen
  1. 6 6
      Userland/Libraries/LibJIT/Assembler.h

+ 6 - 6
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);