mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibJIT: Emit 8-bit displacement variants for mov when possible
This commit is contained in:
parent
d09bc54586
commit
fb483f1950
Notes:
sideshowbarker
2024-07-17 07:14:09 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/fb483f1950 Pull-request: https://github.com/SerenityOS/serenity/pull/21619 Reviewed-by: https://github.com/Hendiadyoin1
1 changed files with 14 additions and 4 deletions
|
@ -140,8 +140,13 @@ struct Assembler {
|
|||
| ((to_underlying(src.reg) >= 8) ? 1 << 2 : 0)
|
||||
| ((to_underlying(dst.reg) >= 8) ? 1 << 0 : 0));
|
||||
emit8(0x89);
|
||||
emit8(0x80 | (encode_reg(src.reg) << 3) | encode_reg(dst.reg));
|
||||
emit32(dst.offset_or_immediate);
|
||||
if (dst.offset_or_immediate <= 127) {
|
||||
emit8(0x40 | (encode_reg(src.reg) << 3) | encode_reg(dst.reg));
|
||||
emit8(dst.offset_or_immediate);
|
||||
} else {
|
||||
emit8(0x80 | (encode_reg(src.reg) << 3) | encode_reg(dst.reg));
|
||||
emit32(dst.offset_or_immediate);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -150,8 +155,13 @@ struct Assembler {
|
|||
| ((to_underlying(dst.reg) >= 8) ? 1 << 2 : 0)
|
||||
| ((to_underlying(src.reg) >= 8) ? 1 << 0 : 0));
|
||||
emit8(0x8b);
|
||||
emit8(0x80 | (encode_reg(dst.reg) << 3) | encode_reg(src.reg));
|
||||
emit32(src.offset_or_immediate);
|
||||
if (src.offset_or_immediate <= 127) {
|
||||
emit8(0x40 | (encode_reg(dst.reg) << 3) | encode_reg(src.reg));
|
||||
emit8(src.offset_or_immediate);
|
||||
} else {
|
||||
emit8(0x80 | (encode_reg(dst.reg) << 3) | encode_reg(src.reg));
|
||||
emit32(src.offset_or_immediate);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue