From c0769d677afdda22c1a8bbd2f54db19004c0e0b3 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 11 Feb 2023 16:41:07 -0800 Subject: new perf record: 50.79cpi (2316ms) --- src/long_mode/mod.rs | 58 ++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'src') 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() { -- cgit v1.1