aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2023-05-09 16:05:56 -0700
committerGitHub <noreply@github.com>2023-05-09 16:05:56 -0700
commitdc3eb2d9e3b805ed1a1416c1e66584cf6520d0f1 (patch)
treeeac4d1b8f645f90cea0a01a539917fde73d1cbfd
parentc10ed407cab8be2cbe993323952aa4fba9985b80 (diff)
parentd6731d58d43cbfd239f249803dc928d98fd996ca (diff)
downloadspike-dc3eb2d9e3b805ed1a1416c1e66584cf6520d0f1.zip
spike-dc3eb2d9e3b805ed1a1416c1e66584cf6520d0f1.tar.gz
spike-dc3eb2d9e3b805ed1a1416c1e66584cf6520d0f1.tar.bz2
Merge pull request #1357 from ptomsich/ptomsich/1312-fix-fcvtmod_w_d-exceptions
Zfa: fix exception behaviour for fcvtmod.w.d
-rw-r--r--riscv/insns/fcvtmod_w_d.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/riscv/insns/fcvtmod_w_d.h b/riscv/insns/fcvtmod_w_d.h
index 89b9b95..e39400d 100644
--- a/riscv/insns/fcvtmod_w_d.h
+++ b/riscv/insns/fcvtmod_w_d.h
@@ -38,12 +38,14 @@ if (exp == 0) {
} else {
/* The fraction is shifted out entirely. */
frac = 0;
+ inexact = true;
}
- /* Notice overflow or inexact exceptions. */
+ /* Handle overflows */
if (true_exp > 31 || frac > (sign ? 0x80000000ull : 0x7fffffff)) {
/* Overflow, for which this operation raises invalid. */
invalid = true;
+ inexact = false; /* invalid takes precedence */
}
/* Honor the sign. */