summaryrefslogtreecommitdiff
path: root/yjit/src/asm/arm64/inst/load_store.rs
diff options
context:
space:
mode:
Diffstat (limited to 'yjit/src/asm/arm64/inst/load_store.rs')
-rw-r--r--yjit/src/asm/arm64/inst/load_store.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/yjit/src/asm/arm64/inst/load_store.rs b/yjit/src/asm/arm64/inst/load_store.rs
index 80a67c837e..ea42f2d17f 100644
--- a/yjit/src/asm/arm64/inst/load_store.rs
+++ b/yjit/src/asm/arm64/inst/load_store.rs
@@ -1,3 +1,5 @@
+use super::super::arg::truncate_imm;
+
/// The size of the operands being operated on.
enum Size {
Size32 = 0b10,
@@ -110,14 +112,12 @@ const FAMILY: u32 = 0b0100;
impl From<LoadStore> for u32 {
/// Convert an instruction into a 32-bit value.
fn from(inst: LoadStore) -> Self {
- let imm9 = (inst.imm9 as u32) & ((1 << 9) - 1);
-
0
| ((inst.size as u32) << 30)
| (0b11 << 28)
| (FAMILY << 25)
| ((inst.opc as u32) << 22)
- | (imm9 << 12)
+ | (truncate_imm::<_, 9>(inst.imm9) << 12)
| ((inst.idx as u32) << 10)
| ((inst.rn as u32) << 5)
| (inst.rt as u32)