diff options
author | Andrew Waterman <waterman@s144.Millennium.Berkeley.EDU> | 2010-11-11 15:49:21 -0800 |
---|---|---|
committer | Andrew Waterman <waterman@s144.Millennium.Berkeley.EDU> | 2010-11-21 16:54:35 -0800 |
commit | 3ebbeba6d5daa236ff346f313e79a9359d1a37bd (patch) | |
tree | 37fc8bae27357ac4e312d5e45ea32f0288faa604 /riscv/insns/remu.h | |
parent | 259d20a35dde46c51878dfd3afb7b8c518ed3dcf (diff) | |
download | spike-3ebbeba6d5daa236ff346f313e79a9359d1a37bd.zip spike-3ebbeba6d5daa236ff346f313e79a9359d1a37bd.tar.gz spike-3ebbeba6d5daa236ff346f313e79a9359d1a37bd.tar.bz2 |
[sim] handle integer division overflow
Behavior is now same as GCC's optimizer. Previously, we just crashed :)
Diffstat (limited to 'riscv/insns/remu.h')
-rw-r--r-- | riscv/insns/remu.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/riscv/insns/remu.h b/riscv/insns/remu.h index e6af512..3b6c44f 100644 --- a/riscv/insns/remu.h +++ b/riscv/insns/remu.h @@ -1,2 +1,5 @@ require64; -RD = RS1 % RS2; +if(RS2 == 0) + RD = 0; +else + RD = RS1 % RS2; |