Giacomo Travaglini has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/28107 )
Change subject: arch-arm: Do not increment exponent if FPSCR.FZ in fplib
..
arch-arm: Do not increment exponent if FPSCR.FZ in fplib
If flushing to zero, the exponent shouldn't be incremented since
we are supposed to produce a 0 value and not a denormal number
Change-Id: Ib6dd594a6555b2fd9a20a52b59cbf1f5f94c2eb5
Signed-off-by: Giacomo Travaglini
Reviewed-by: Nikos Nikoleris
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28107
Reviewed-by: Jordi Vaquero
Tested-by: kokoro
---
M src/arch/arm/insts/fplib.cc
1 file changed, 25 insertions(+), 15 deletions(-)
Approvals:
Jordi Vaquero: Looks good to me, approved
Giacomo Travaglini: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/arch/arm/insts/fplib.cc b/src/arch/arm/insts/fplib.cc
index 84ebe6d..a97943f 100644
--- a/src/arch/arm/insts/fplib.cc
+++ b/src/arch/arm/insts/fplib.cc
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2012-2013, 2017-2018 ARM Limited
+* Copyright (c) 2012-2013, 2017-2018, 2020 ARM Limited
* Copyright (c) 2020 Metempsy Technology Consulting
* All rights reserved
*
@@ -393,14 +393,18 @@
*exp = FP16_EXP(x);
*mnt = FP16_MANT(x);
-// Handle subnormals:
if (*exp) {
*mnt |= 1ULL << FP16_MANT_BITS;
} else {
-++*exp;
+// Handle subnormals:
// IDC (Input Denormal) is not set in this case.
-if (mode & FPLIB_FZ16)
-*mnt = 0;
+if (*mnt) {
+if (mode & FPLIB_FZ16) {
+*mnt = 0;
+} else {
+++*exp;
+}
+}
}
}
@@ -412,14 +416,17 @@
*exp = FP32_EXP(x);
*mnt = FP32_MANT(x);
-// Handle subnormals:
if (*exp) {
*mnt |= 1ULL << FP32_MANT_BITS;
} else {
-++*exp;
-if ((mode & FPLIB_FZ) && *mnt) {
-*flags |= FPLIB_IDC;
-*mnt = 0;
+// Handle subnormals:
+if (*mnt) {
+if (mode & FPLIB_FZ) {
+*flags |= FPLIB_IDC;
+*mnt = 0;
+} else {
+++*exp;
+}
}
}
}
@@ -434,14 +441,17 @@
*exp = FP64_EXP(x);
*mnt = FP64_MANT(x);
-// Handle subnormals:
if (*exp) {
*mnt |= 1ULL << FP64_MANT_BITS;
} else {
-++*exp;
-if ((mode & FPLIB_FZ) && *mnt) {
-*flags |= FPLIB_IDC;
-*mnt = 0;
+// Handle subnormals:
+if (*mnt) {
+if (mode & FPLIB_FZ) {
+*flags |= FPLIB_IDC;
+*mnt = 0;
+} else {
+++*exp;
+}
}
}
}
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/28107
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ib6dd594a6555b2fd9a20a52b59cbf1f5f94c2eb5
Gerrit-Change-Number: 28107
Gerrit-PatchSet: 2
Gerrit-Owner: Giacomo Travaglini
Gerrit-Reviewer: Giacomo Travaglini
Gerrit-Reviewer: Jordi Vaquero
Gerrit-Reviewer: Nikos Nikoleris
Gerrit-Reviewer: kokoro
Gerrit-MessageType: merged
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s