From 720517cf0ff588aebcf97a5eadc566ab680b0791 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Wed, 14 Oct 2020 16:52:55 -0700 Subject: [PATCH] add mulli --- src/instr_models.rs | 10 ++++++++++ src/lib.rs | 5 +++++ 2 files changed, 15 insertions(+) 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) { -- 2.30.2