1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:37:36 +00:00

LibJS+LibJIT: Add fast path for Int32 ^ Int32

This commit is contained in:
Andreas Kling 2023-11-03 08:54:50 +01:00
parent 3a5c177025
commit 0aeb83b03f
3 changed files with 56 additions and 1 deletions

View file

@ -525,6 +525,27 @@ struct Assembler {
}
}
void bitwise_xor32(Operand dst, Operand src)
{
if (dst.is_register_or_memory() && src.type == Operand::Type::Reg) {
emit_rex_for_mr(dst, src, REX_W::No);
emit8(0x31);
emit_modrm_mr(dst, src);
} else if (dst.type == Operand::Type::Reg && src.type == Operand::Type::Imm && src.fits_in_i8()) {
emit_rex_for_slash(dst, REX_W::No);
emit8(0x83);
emit_modrm_slash(6, dst);
emit8(src.offset_or_immediate);
} else if (dst.type == Operand::Type::Reg && src.type == Operand::Type::Imm && src.fits_in_i32()) {
emit_rex_for_slash(dst, REX_W::No);
emit8(0x81);
emit_modrm_slash(6, dst);
emit32(src.offset_or_immediate);
} else {
VERIFY_NOT_REACHED();
}
}
void enter()
{
push(Operand::Register(Reg::RBP));