aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2023-02-11 16:41:07 -0800
committeriximeow <me@iximeow.net>2023-07-04 19:01:38 -0700
commitc0769d677afdda22c1a8bbd2f54db19004c0e0b3 (patch)
tree4de753aa719ec36a58d14a58a289cdd45053f529 /src
parent1a26268c4485489d6a72349d48c252e47e99ce72 (diff)
new perf record: 50.79cpi (2316ms)
Diffstat (limited to 'src')
-rw-r--r--src/long_mode/mod.rs58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs
index 8772882..2f4b799 100644
--- a/src/long_mode/mod.rs
+++ b/src/long_mode/mod.rs
@@ -7122,6 +7122,35 @@ fn read_operands<
return Ok(());
}
+ if operand_code.has_imm() {
+ if operand_code.operand_case_handler_index() == OperandCase::Ibs {
+ instruction.imm =
+ read_imm_signed(words, 1)? as u64;
+ sink.record(
+ words.offset() as u32 * 8 - 8,
+ words.offset() as u32 * 8 - 1,
+ InnerDescription::Number("1-byte immediate", instruction.imm as i64)
+ .with_id(words.offset() as u32 * 8),
+ );
+ instruction.operands[0] = OperandSpec::ImmI8;
+ } else {
+ instruction.imm =
+ read_imm_signed(words, 4)? as u64;
+ sink.record(
+ words.offset() as u32 * 8 - 32,
+ words.offset() as u32 * 8 - 1,
+ InnerDescription::Number("4-byte immediate", instruction.imm as i64)
+ .with_id(words.offset() as u32 * 8),
+ );
+ if instruction.opcode == Opcode::CALL {
+ instruction.mem_size = 8;
+ }
+ instruction.operands[0] = OperandSpec::ImmI32;
+ }
+ instruction.operand_count = 1;
+ return Ok(());
+ }
+
let mut modrm = 0;
let mut opwidth = 0;
let mut mem_oper = OperandSpec::Nothing;
@@ -7166,35 +7195,6 @@ fn read_operands<
instruction.operands[1] = mem_oper;
}
- if operand_code.has_imm() {
- if operand_code.operand_case_handler_index() == OperandCase::Ibs {
- instruction.imm =
- read_imm_signed(words, 1)? as u64;
- sink.record(
- words.offset() as u32 * 8 - 8,
- words.offset() as u32 * 8 - 1,
- InnerDescription::Number("1-byte immediate", instruction.imm as i64)
- .with_id(words.offset() as u32 * 8),
- );
- instruction.operands[0] = OperandSpec::ImmI8;
- } else {
- instruction.imm =
- read_imm_signed(words, 4)? as u64;
- sink.record(
- words.offset() as u32 * 8 - 32,
- words.offset() as u32 * 8 - 1,
- InnerDescription::Number("4-byte immediate", instruction.imm as i64)
- .with_id(words.offset() as u32 * 8),
- );
- if instruction.opcode == Opcode::CALL {
- instruction.mem_size = 8;
- }
- instruction.operands[0] = OperandSpec::ImmI32;
- }
- instruction.operand_count = 1;
- return Ok(());
- }
-
if let Some(z_operand_code) = operand_code.get_embedded_instructions() {
let reg = z_operand_code.reg();
match z_operand_code.category() {