diff --git a/optimism/src/mips/interpreter.rs b/optimism/src/mips/interpreter.rs index 7a0c327c30..d9b9b4a554 100644 --- a/optimism/src/mips/interpreter.rs +++ b/optimism/src/mips/interpreter.rs @@ -828,7 +828,25 @@ pub fn interpret_itype(env: &mut Env, instr: ITypeInstructi // REMOVEME: when all itype instructions are implemented. return; } - ITypeInstruction::BranchNeq => (), + ITypeInstruction::BranchNeq => { + let offset = env.sign_extend(&(immediate * Env::constant(1 << 2)), 18); + let rs = env.read_register(&rs); + let rt = env.read_register(&rt); + let equals = { + // FIXME: Requires constraints + let pos = env.alloc_scratch(); + unsafe { env.test_zero(&(rs - rt), pos) } + }; + let offset = equals.clone() * Env::constant(4) + (Env::constant(1) - equals) * offset; + let addr = { + let pos = env.alloc_scratch(); + env.copy(&(next_instruction_pointer.clone() + offset), pos) + }; + env.set_instruction_pointer(next_instruction_pointer); + env.set_next_instruction_pointer(addr); + // REMOVEME: when all itype instructions are implemented. + return; + } ITypeInstruction::BranchLeqZero => (), ITypeInstruction::BranchGtZero => (), ITypeInstruction::AddImmediate => {