From d9adbba7c049092cd474efc9b6cea9aecb966f25 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Mon, 15 May 2023 23:48:28 -0700 Subject: [PATCH] fix mis-computed exponent in bfp_CONVERT_FROM_BFP64 --- openpower/isafunctions/bfp.mdwn | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openpower/isafunctions/bfp.mdwn b/openpower/isafunctions/bfp.mdwn index 7ab2ab2b..08409e8f 100644 --- a/openpower/isafunctions/bfp.mdwn +++ b/openpower/isafunctions/bfp.mdwn @@ -57,7 +57,7 @@ section 7.6.2.2 # x is a Denormal result.class.Denormal <- 1 result.sign <- x[0] - result.exp <- -1022 + result.exponent <- -1022 result.significand[0] <- 0 result.significand[1:52] <- fraction do while result.significand[0] != 1 @@ -66,7 +66,10 @@ section 7.6.2.2 else result.class.Normal <- 1 result.sign <- x[0] - result.exponent <- exponent - 1023 + result.exponent <- exponent + # have to do the subtraction separately since SelectableInt won't + # give negative results + result.exponent <- result.exponent - 1023 result.significand[0] <- 1 result.significand[1:52] <- fraction return result -- 2.30.2