diff options
Diffstat (limited to 'riscv/insns/div.h')
-rw-r--r-- | riscv/insns/div.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/riscv/insns/div.h b/riscv/insns/div.h index 9b752aa..f6a9b6b 100644 --- a/riscv/insns/div.h +++ b/riscv/insns/div.h @@ -1,2 +1,5 @@ require64; -RD = sreg_t(RS1) / sreg_t(RS2); +if(RS2 == 0 || sreg_t(RS1) == INT64_MIN && sreg_t(RS2) == -1) + RD = sreg_t(RS1) < 0 ? INT64_MIN : INT64_MAX; +else + RD = sreg_t(RS1) / sreg_t(RS2); |