arch-gcn3: Fix VOP3 V_LDEXP_F64

Replaced !std::isnormal with std::fpclassify because std::isnormal
is not specific enough. !std::isnormal was incorrectly catching
NaN, Inf, 0.0, and subnormals (aka denormals), where as it was only
suppose to catch subnormals.

The return value and error handling spec of std::ldexp listed on
cppreference.com appears to match up in nearly all cases after
making these changes. If std::ldexp handled subnormals as described
in the GCN3 2016 guide, we could have used vdst[lane] = std::ldexp
and not need to check for any corner cases.

Change-Id: I4c77af77c3b7798f86d40442610cef1296a28441
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/29966
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
This commit is contained in:
Travis Boraten
2019-04-18 18:03:14 -04:00
committed by Anthony Gutierrez
parent 83fe4754e7
commit e1d10c3894

View File

@@ -30282,10 +30282,11 @@ namespace Gcn3ISA
for (int lane = 0; lane < NumVecElemPerVecReg; ++lane) {
if (wf->execMask(lane)) {
if (std::isnan(src1[lane]) || std::isinf(src1[lane])) {
if (std::isnan(src0[lane]) || std::isinf(src0[lane])) {
vdst[lane] = src0[lane];
} else if (!std::isnormal(src1[lane])) {
if (std::signbit(src1[lane])) {
} else if (std::fpclassify(src0[lane]) == FP_SUBNORMAL
|| std::fpclassify(src0[lane]) == FP_ZERO) {
if (std::signbit(src0[lane])) {
vdst[lane] = -0.0;
} else {
vdst[lane] = +0.0;