Skip to content

Commit

Permalink
improv(compiler) Added a few more arm64 emitter, just in case
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed Jan 19, 2022
1 parent 80f9c8f commit 61609c9
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions lib/compiler-singlepass/src/emitter_arm64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,30 @@ impl EmitterARM64 for Assembler {
assert!((disp & 0x3) == 0 && (disp < 0x4000));
dynasm!(self ; str S(reg), [X(addr), disp]);
}
(Size::S64, Location::GPR(reg), Location::Memory2(addr, r2, mult, offs)) => {
let reg = reg.into_index() as u32;
let addr = addr.into_index() as u32;
let r2 = r2.into_index() as u32;
assert!(offs == 0);
let mult = mult as u32;
match mult {
0 => dynasm!(self ; str X(reg), [X(addr)]),
1 => dynasm!(self ; str X(reg), [X(addr), X(r2)]),
_ => dynasm!(self ; str X(reg), [X(addr), X(r2), LSL mult]),
};
}
(Size::S32, Location::GPR(reg), Location::Memory2(addr, r2, mult, offs)) => {
let reg = reg.into_index() as u32;
let addr = addr.into_index() as u32;
let r2 = r2.into_index() as u32;
assert!(offs == 0);
let mult = mult as u32;
match mult {
0 => dynasm!(self ; str W(reg), [X(addr)]),
1 => dynasm!(self ; str W(reg), [X(addr), X(r2)]),
_ => dynasm!(self ; str W(reg), [X(addr), X(r2), LSL mult]),
};
}
_ => panic!("singlepass can't emit STR {:?}, {:?}, {:?}", sz, reg, addr),
}
}
Expand Down Expand Up @@ -329,6 +353,18 @@ impl EmitterARM64 for Assembler {
_ => dynasm!(self ; ldr X(reg), [X(addr), X(r2), LSL mult]),
};
}
(Size::S32, Location::GPR(reg), Location::Memory2(addr, r2, mult, offs)) => {
let reg = reg.into_index() as u32;
let addr = addr.into_index() as u32;
let r2 = r2.into_index() as u32;
assert!(offs == 0);
let mult = mult as u32;
match mult {
0 => dynasm!(self ; ldr W(reg), [X(addr)]),
1 => dynasm!(self ; ldr W(reg), [X(addr), X(r2)]),
_ => dynasm!(self ; ldr W(reg), [X(addr), X(r2), LSL mult]),
};
}
(Size::S64, Location::SIMD(reg), Location::Memory(addr, disp)) => {
let reg = reg.into_index() as u32;
let addr = addr.into_index() as u32;
Expand Down

0 comments on commit 61609c9

Please sign in to comment.