Skip to content

Commit

Permalink
limit scope of the rd position to a local variable in set less than i…
Browse files Browse the repository at this point in the history
…mmediate
  • Loading branch information
svv232 committed Dec 17, 2024
1 parent ca33f21 commit fddf9f2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions o1vm/src/interpreters/riscv32im/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1811,8 +1811,10 @@ pub fn interpret_itype<Env: InterpreterEnv>(env: &mut Env, instr: IInstruction)
// sltiu: x[rd] = (x[rs1] < (u)sext(immediate)) ? 1 : 0
let local_rs1 = env.read_register(&rs1);
let local_imm = env.sign_extend(&imm, 12);
let rd_scratch = env.alloc_scratch();
let local_rd = unsafe { env.test_less_than(&local_rs1, &local_imm, rd_scratch) };
let local_rd = {
let pos = env.alloc_scratch();
unsafe { env.test_less_than(&local_rs1, &local_imm, pos) }
};
env.write_register(&rd, local_rd);
env.set_instruction_pointer(next_instruction_pointer.clone());
env.set_next_instruction_pointer(next_instruction_pointer + Env::constant(4u32));
Expand Down

0 comments on commit fddf9f2

Please sign in to comment.