mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-30 21:02:14 +00:00
Fix emit_lea.
This commit is contained in:
parent
05557fc9ad
commit
d8b313e3fd
@ -325,10 +325,18 @@ impl Emitter for Assembler {
|
|||||||
fn emit_lea(&mut self, sz: Size, src: Location, dst: Location) {
|
fn emit_lea(&mut self, sz: Size, src: Location, dst: Location) {
|
||||||
match (sz, src, dst) {
|
match (sz, src, dst) {
|
||||||
(Size::S32, Location::Memory(src, disp), Location::GPR(dst)) => {
|
(Size::S32, Location::Memory(src, disp), Location::GPR(dst)) => {
|
||||||
|
if disp >= 0 {
|
||||||
dynasm!(self ; add W(map_gpr(dst).x()), W(map_gpr(src).x()), disp as u32);
|
dynasm!(self ; add W(map_gpr(dst).x()), W(map_gpr(src).x()), disp as u32);
|
||||||
|
} else {
|
||||||
|
dynasm!(self ; sub W(map_gpr(dst).x()), W(map_gpr(src).x()), (-disp) as u32);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
(Size::S64, Location::Memory(src, disp), Location::GPR(dst)) => {
|
(Size::S64, Location::Memory(src, disp), Location::GPR(dst)) => {
|
||||||
|
if disp >= 0 {
|
||||||
dynasm!(self ; add X(map_gpr(dst).x()), X(map_gpr(src).x()), disp as u32);
|
dynasm!(self ; add X(map_gpr(dst).x()), X(map_gpr(src).x()), disp as u32);
|
||||||
|
} else {
|
||||||
|
dynasm!(self ; sub X(map_gpr(dst).x()), X(map_gpr(src).x()), (-disp) as u32);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user