diff options
| author | Grond <grond@grondhaus.net> | 2026-06-24 14:58:13 -0700 |
|---|---|---|
| committer | iximeow <me@iximeow.net> | 2026-07-28 02:53:24 +0000 |
| commit | 0b4ce1210eb90aa370d286390c8566f2bee133bd (patch) | |
| tree | f4431708e688ebf81e7a726560c6f329886c5186 /src/armv7/display.rs | |
| parent | 485aaac0f82e6b5546ae392b6be626c4558cc26a (diff) | |
Do not add an 's' when outputing opcodes that always set flags
Diffstat (limited to 'src/armv7/display.rs')
| -rw-r--r-- | src/armv7/display.rs | 12 |
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")?; |
