diff options
Diffstat (limited to 'riscv/insns/divw.h')
-rw-r--r-- | riscv/insns/divw.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/riscv/insns/divw.h b/riscv/insns/divw.h index 84f42a9..b51d9b7 100644 --- a/riscv/insns/divw.h +++ b/riscv/insns/divw.h @@ -1,7 +1,7 @@ require_xpr64; -if(int32_t(RS2) == 0) +sreg_t lhs = sext32(RS1); +sreg_t rhs = sext32(RS2); +if(rhs == 0) RD = UINT64_MAX; -else if(int32_t(RS1) == INT32_MIN && int32_t(RS2) == -1) - RD = RS1; else - RD = sext32(int32_t(RS1) / int32_t(RS2)); + RD = sext32(lhs / rhs); |