aboutsummaryrefslogtreecommitdiff
path: root/src/armv7
diff options
context:
space:
mode:
Diffstat (limited to 'src/armv7')
-rw-r--r--src/armv7/display.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/armv7/display.rs b/src/armv7/display.rs
index 29d3ed6..0e909f6 100644
--- a/src/armv7/display.rs
+++ b/src/armv7/display.rs
@@ -55,8 +55,18 @@ impl Instruction {
unsafe {
f.write_lt_8(opc.name())?;
}
+ // test/compare instructions always set flags and are consequently encoded with bit 20 set
+ // as most other instructions that sets flags are. because these instructions
+ // unconditionally set flags, though, their mnemonic skips the `s` suffix.
if self.s() {
- f.write_char('s')?;
+ let always_sets_flags =
+ *opc == Opcode::CMP ||
+ *opc == Opcode::CMN ||
+ *opc == Opcode::TST ||
+ *opc == Opcode::TEQ;
+ if !always_sets_flags {
+ f.write_char('s')?;
+ }
}
if self.w() {
f.write_fixed_size(".w")?;