From: Jacob Lifshay Date: Wed, 14 Oct 2020 23:52:55 +0000 (-0700) Subject: add mulli X-Git-Tag: v0.2.0~8 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=720517cf0ff588aebcf97a5eadc566ab680b0791;p=power-instruction-analyzer.git add mulli --- diff --git a/src/instr_models.rs b/src/instr_models.rs index 8b335b2..5eee177 100644 --- a/src/instr_models.rs +++ b/src/instr_models.rs @@ -633,6 +633,16 @@ pub fn moduw(inputs: InstructionInput) -> InstructionResult { }) } +pub fn mulli(inputs: InstructionInput) -> InstructionResult { + let ra = inputs.try_get_ra()? as i64; + let immediate = inputs.try_get_immediate_s16()? as i64; + let result = ra.wrapping_mul(immediate) as u64; + Ok(InstructionOutput { + rt: Some(result), + ..InstructionOutput::default() + }) +} + create_instr_variants_ov_cr!(mullw, mullwo, mullw_, mullwo_, i64); pub fn mullwo(inputs: InstructionInput) -> InstructionResult { diff --git a/src/lib.rs b/src/lib.rs index e49374e..e5d26e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -695,6 +695,11 @@ instructions! { "moduw" } + #[enumerant = MulLI] + fn mulli(Ra, ImmediateS16) -> (Rt) { + "mulli" + } + // mullw #[enumerant = MulLW] fn mullw(Ra, Rb) -> (Rt) {