aboutsummaryrefslogtreecommitdiff
path: root/src/armv8
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2021-10-26 00:24:27 -0700
committeriximeow <me@iximeow.net>2021-10-26 00:24:27 -0700
commit135c63429f450dc8044fc97442dd33779050fec8 (patch)
tree8a07170734a9aa8847c1c6afc72bce8326c8d55b /src/armv8
parentd1213dc138d58678a1b4a9fe09dcb2ecf2147c18 (diff)
ubfm/sbfm aliases
Diffstat (limited to 'src/armv8')
-rw-r--r--src/armv8/a64.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/armv8/a64.rs b/src/armv8/a64.rs
index 07397ef..67cdb31 100644
--- a/src/armv8/a64.rs
+++ b/src/armv8/a64.rs
@@ -413,7 +413,14 @@ impl Display for Instruction {
}
}
}
- write!(fmt, "ubfm")?;
+ // `ubfm` is never actually displayed: in the remaining case, it is always aliased
+ // to `ubfx`
+ let width = if let (Operand::Immediate(lsb), Operand::Immediate(width)) = (self.operands[2], self.operands[3]) {
+ Operand::Immediate(width - lsb + 1)
+ } else {
+ unreachable!("last two operands of ubfm are always immediates");
+ };
+ return write!(fmt, "ubfx {}, {}, {}, {}", self.operands[0], self.operands[1], self.operands[2], width);
},
Opcode::SBFM => {
if let Operand::Immediate(0) = self.operands[2] {
@@ -459,7 +466,14 @@ impl Display for Instruction {
);
}
}
- write!(fmt, "sbfm")?;
+ // `sbfm` is never actually displayed: in the remaining case, it is always aliased
+ // to `sbfx`
+ let width = if let (Operand::Immediate(lsb), Operand::Immediate(width)) = (self.operands[2], self.operands[3]) {
+ Operand::Immediate(width - lsb + 1)
+ } else {
+ unreachable!("last two operands of sbfm are always immediates");
+ };
+ return write!(fmt, "sbfx {}, {}, {}, {}", self.operands[0], self.operands[1], self.operands[2], width);
},
Opcode::ADR => {
write!(fmt, "adr")?;