diff options
author | iximeow <me@iximeow.net> | 2020-08-09 00:47:02 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2020-08-09 01:39:01 -0700 |
commit | e433752d59c1bb790c2de86f2b5e327de8de793d (patch) | |
tree | 3db5ef37a1a4a95cb095cb5474c2a9ed439bb727 /src/long_mode/display.rs | |
parent | 2bf6df7ff4101b4e7cf14807b5e9def85d92e1cd (diff) |
avoid a bunch of checks in the likely display path
rep_any will get speculated `false` quite quickly, whereas checking if
the opcode is a string instruction will be costly no matter what. in the
rare case rep_any is true, i don't care how costly displaying the
instruction is - string instructions are relatively rare, and rep movs
is typically not more than one instance when it shows up.
Diffstat (limited to 'src/long_mode/display.rs')
-rw-r--r-- | src/long_mode/display.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/long_mode/display.rs b/src/long_mode/display.rs index 42d3683..5dac6cf 100644 --- a/src/long_mode/display.rs +++ b/src/long_mode/display.rs @@ -2244,18 +2244,18 @@ impl <T: fmt::Write, Color: fmt::Display, Y: YaxColors<Color>> ShowContextual<u6 write!(out, "lock ")?; } - /* - if [Opcode::MOVS, Opcode::CMPS, Opcode::LODS, Opcode::STOS, Opcode::INS, Opcode::OUTS].contains(&self.opcode) { - // only a few of you actually use the prefix... - if self.prefixes.rep() { - write!(out, "rep ")?; - } else if self.prefixes.repz() { - write!(out, "repz ")?; - } else if self.prefixes.repnz() { - write!(out, "repnz ")?; + if self.prefixes.rep_any() { + if [Opcode::MOVS, Opcode::CMPS, Opcode::LODS, Opcode::STOS, Opcode::INS, Opcode::OUTS].contains(&self.opcode) { + // only a few of you actually use the prefix... + if self.prefixes.rep() { + write!(out, "rep ")?; + } else if self.prefixes.repz() { + write!(out, "repz ")?; + } else if self.prefixes.repnz() { + write!(out, "repnz ")?; + } } } - */ out.write_str(self.opcode.name())?; |