Convert some fp reg from array to struct call

This commit is contained in:
Quentin Legot 2023-02-01 17:32:17 +01:00
parent 658502d353
commit bce7047c5c

View File

@ -470,20 +470,20 @@ impl Machine {
machine.fp_reg.set_reg(inst.rd as usize, machine.fp_reg.get_reg(inst.rs1 as usize).sqrt()); machine.fp_reg.set_reg(inst.rd as usize, machine.fp_reg.get_reg(inst.rs1 as usize).sqrt());
}, },
RISCV_FP_FSGN => { RISCV_FP_FSGN => {
let local_float = machine.fp_reg[inst.rs1 as usize]; let local_float = machine.fp_reg.get_reg(inst.rs1 as usize);
match inst.funct3 { match inst.funct3 {
RISCV_FP_FSGN_J => { RISCV_FP_FSGN_J => {
if machine.fp_reg[inst.rs2 as usize] < 0 { if machine.fp_reg.get_reg(inst.rs2 as usize) < 0f32 {
machine.fp_reg[inst.rd as usize] = -local_float; machine.fp_reg.set_reg(inst.rd as usize, -local_float);
} else { } else {
machine.fp_reg[inst.rd as usize] = local_float; machine.fp_reg.set_reg(inst.rd as usize, local_float);
} }
} }
RISCV_FP_FSGN_JN => { RISCV_FP_FSGN_JN => {
if machine.fp_reg[inst.rs2 as usize] < 0 { if machine.fp_reg.get_reg(inst.rs2 as usize) < 0f32 {
machine.fp_reg[inst.rd as usize] = local_float; machine.fp_reg.set_reg(inst.rd as usize, local_float);
} else { } else {
machine.fp_reg[inst.rd as usize] = -local_float; machine.fp_reg.set_reg(inst.rd as usize, -local_float);
} }
} }
RISCV_FP_FSGN_JX => { RISCV_FP_FSGN_JX => {