1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:37:34 +00:00

LibJS/JIT: Add fast path for LeftShift

This commit is contained in:
iliadsh 2023-11-07 04:22:35 +00:00 committed by Andreas Kling
parent a1cdfe1b54
commit 1244e91481
3 changed files with 55 additions and 1 deletions

View file

@ -566,6 +566,23 @@ struct X86_64Assembler {
}
}
void shift_left32(Operand dest, Optional<Operand> count)
{
VERIFY(dest.type == Operand::Type::Reg);
if (count.has_value()) {
VERIFY(count->type == Operand::Type::Imm);
VERIFY(count->fits_in_u8());
emit_rex_for_slash(dest, REX_W::No);
emit8(0xc1);
emit_modrm_slash(4, dest);
emit8(count->offset_or_immediate);
} else {
emit_rex_for_slash(dest, REX_W::No);
emit8(0xd3);
emit_modrm_slash(4, dest);
}
}
void enter()
{
push(Operand::Register(Reg::RBP));