Hello Tony Gutierrez,
I'd like you to do a code review. Please visit
https://gem5-review.googlesource.com/c/public/gem5/+/29967
to review the following change.
Change subject: arch-gcn3: Replace some instances of std::isnormal with
std::fpclassify
......................................................................
arch-gcn3: Replace some instances of std::isnormal with std::fpclassify
Affected instructions: V_DIV_SCALE_F64, V_CMP_CLASS_F64,
V_CMPX_CLASS_F64 and their VOPC, VOP3, F32 variants.
These instances of std::isnormal were being used to check for
subnormal (denorms) values. std::isnormal is not specific enough.
It returns true for normal values but false for NaN, Inf, 0.0, and
subnormals. std::fpclassify returns macros for each category of
floating point numbers. Now we only catch subnormals.
Change-Id: I8d8f4452ff58de71e7c8e0b2b5e73467b532e196
---
M src/arch/gcn3/insts/instructions.cc
1 file changed, 23 insertions(+), 21 deletions(-)
diff --git a/src/arch/gcn3/insts/instructions.cc
b/src/arch/gcn3/insts/instructions.cc
index 302dad4..9987fad 100644
--- a/src/arch/gcn3/insts/instructions.cc
+++ b/src/arch/gcn3/insts/instructions.cc
@@ -9439,7 +9439,7 @@
}
if (bits(src1[lane], 4)) {
// is -denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& std::signbit(src0[lane])) {
vcc.setBit(lane, 1);
continue;
@@ -9463,7 +9463,7 @@
}
if (bits(src1[lane], 7)) {
// is +denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& !std::signbit(src0[lane])) {
vcc.setBit(lane, 1);
continue;
@@ -9551,7 +9551,7 @@
}
if (bits(src1[lane], 4)) {
// is -denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& std::signbit(src0[lane])) {
vcc.setBit(lane, 1);
continue;
@@ -9575,7 +9575,7 @@
}
if (bits(src1[lane], 7)) {
// is +denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& !std::signbit(src0[lane])) {
vcc.setBit(lane, 1);
continue;
@@ -9664,7 +9664,7 @@
}
if (bits(src1[lane], 4)) {
// is -denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& std::signbit(src0[lane])) {
vcc.setBit(lane, 1);
continue;
@@ -9688,7 +9688,7 @@
}
if (bits(src1[lane], 7)) {
// is +denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& !std::signbit(src0[lane])) {
vcc.setBit(lane, 1);
continue;
@@ -9777,7 +9777,7 @@
}
if (bits(src1[lane], 4)) {
// is -denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& std::signbit(src0[lane])) {
vcc.setBit(lane, 1);
continue;
@@ -9801,7 +9801,7 @@
}
if (bits(src1[lane], 7)) {
// is +denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& !std::signbit(src0[lane])) {
vcc.setBit(lane, 1);
continue;
@@ -15550,7 +15550,7 @@
}
if (bits(src1[lane], 4)) {
// is -denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& std::signbit(src0[lane])) {
sdst.setBit(lane, 1);
continue;
@@ -15574,7 +15574,7 @@
}
if (bits(src1[lane], 7)) {
// is +denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& !std::signbit(src0[lane])) {
sdst.setBit(lane, 1);
continue;
@@ -15665,7 +15665,7 @@
}
if (bits(src1[lane], 4)) {
// is -denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& std::signbit(src0[lane])) {
sdst.setBit(lane, 1);
continue;
@@ -15689,7 +15689,7 @@
}
if (bits(src1[lane], 7)) {
// is +denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& !std::signbit(src0[lane])) {
sdst.setBit(lane, 1);
continue;
@@ -15780,7 +15780,7 @@
}
if (bits(src1[lane], 4)) {
// is -denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& std::signbit(src0[lane])) {
sdst.setBit(lane, 1);
continue;
@@ -15804,7 +15804,7 @@
}
if (bits(src1[lane], 7)) {
// is +denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& !std::signbit(src0[lane])) {
sdst.setBit(lane, 1);
continue;
@@ -15895,7 +15895,7 @@
}
if (bits(src1[lane], 4)) {
// is -denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& std::signbit(src0[lane])) {
sdst.setBit(lane, 1);
continue;
@@ -15919,7 +15919,7 @@
}
if (bits(src1[lane], 7)) {
// is +denormal
- if (!std::isnormal(src0[lane])
+ if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
&& !std::signbit(src0[lane])) {
sdst.setBit(lane, 1);
continue;
@@ -29249,17 +29249,19 @@
if (src0[lane] == src1[lane]) {
vdst[lane] = std::ldexp(src0[lane], 128);
}
- } else if (!std::isnormal(src1[lane])) {
+ } else if (std::fpclassify(src1[lane]) == FP_SUBNORMAL) {
vdst[lane] = std::ldexp(src0[lane], 128);
- } else if (!std::isnormal(1.0 / src1[lane])
- && !std::isnormal(src2[lane] / src1[lane])) {
+ } else if (std::fpclassify(1.0 / src1[lane]) ==
FP_SUBNORMAL
+ && std::fpclassify(src2[lane] / src1[lane])
+ == FP_SUBNORMAL) {
vcc.setBit(lane, 1);
if (src0[lane] == src1[lane]) {
vdst[lane] = std::ldexp(src0[lane], 128);
}
- } else if (!std::isnormal(1.0 / src1[lane])) {
+ } else if (std::fpclassify(1.0 / src1[lane]) ==
FP_SUBNORMAL) {
vdst[lane] = std::ldexp(src0[lane], -128);
- } else if (!std::isnormal(src2[lane] / src1[lane])) {
+ } else if (std::fpclassify(src2[lane] / src1[lane])
+ == FP_SUBNORMAL) {
vcc.setBit(lane, 1);
if (src0[lane] == src2[lane]) {
vdst[lane] = std::ldexp(src0[lane], 128);
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/29967
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: I8d8f4452ff58de71e7c8e0b2b5e73467b532e196
Gerrit-Change-Number: 29967
Gerrit-PatchSet: 1
Gerrit-Owner: Anthony Gutierrez <[email protected]>
Gerrit-Reviewer: Tony Gutierrez <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s