mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-26 19:28:59 +00:00
LibJIT: Widen allowed argument range for add32 and use REX if necessary
The REX prefix is elided when it is not needed, so no change in code size is to be expected
This commit is contained in:
parent
248782461c
commit
a42d849ec1
Notes:
sideshowbarker
2024-07-17 10:31:19 +09:00
Author: https://github.com/Hendiadyoin1
Commit: a42d849ec1
Pull-request: https://github.com/SerenityOS/serenity/pull/21658
Reviewed-by: https://github.com/awesomekling
1 changed files with 6 additions and 3 deletions
|
@ -615,14 +615,17 @@ struct Assembler {
|
|||
|
||||
void add32(Operand dst, Operand src, Optional<Label&> label)
|
||||
{
|
||||
if (dst.type == Operand::Type::Reg && to_underlying(dst.reg) < 8 && src.type == Operand::Type::Reg && to_underlying(src.reg) < 8) {
|
||||
if (dst.is_register_or_memory() && src.type == Operand::Type::Reg) {
|
||||
emit_rex_for_mr(dst, src, REX_W::No);
|
||||
emit8(0x01);
|
||||
emit_modrm_mr(dst, src);
|
||||
} else if (dst.type == Operand::Type::Reg && to_underlying(dst.reg) < 8 && src.type == Operand::Type::Imm && src.fits_in_i8()) {
|
||||
} else if (dst.is_register_or_memory() && src.type == Operand::Type::Imm && src.fits_in_i8()) {
|
||||
emit_rex_for_slash(dst, REX_W::No);
|
||||
emit8(0x83);
|
||||
emit_modrm_slash(0, dst);
|
||||
emit8(src.offset_or_immediate);
|
||||
} else if (dst.type == Operand::Type::Reg && to_underlying(dst.reg) < 8 && src.type == Operand::Type::Imm && src.fits_in_i32()) {
|
||||
} else if (dst.is_register_or_memory() && src.type == Operand::Type::Imm && src.fits_in_i32()) {
|
||||
emit_rex_for_slash(dst, REX_W::No);
|
||||
emit8(0x81);
|
||||
emit_modrm_slash(0, dst);
|
||||
emit32(src.offset_or_immediate);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue