aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
authorDiego Caballero <diego.caballero@intel.com>2020-06-05 17:06:42 -0700
committerDiego Caballero <diego.caballero@intel.com>2020-06-05 17:22:43 -0700
commita2588948febccfed5ba074fc32dcb093484fa5c8 (patch)
tree2d89f03f46953a9bc7e3ef464d8e45da29c27a84 /llvm/lib/Support/APFloat.cpp
parentf39e12a06b6018db195848ca1f7bd01bf0240fac (diff)
downloadllvm-a2588948febccfed5ba074fc32dcb093484fa5c8.zip
llvm-a2588948febccfed5ba074fc32dcb093484fa5c8.tar.gz
llvm-a2588948febccfed5ba074fc32dcb093484fa5c8.tar.bz2
Fix convertBFloatAPFloatToAPInt for NaN/Inf values
Bfloat type has an 8-bit exponent so the exponent of NaN/Inf numbers must be 0xff instead of 0x1f. This is probably a copy-paste mistake from the half float type. Reviewed By: lattner Differential Revision: https://reviews.llvm.org/D81302
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r--llvm/lib/Support/APFloat.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 78f44c5..569cac7 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -3278,11 +3278,11 @@ APInt IEEEFloat::convertBFloatAPFloatToAPInt() const {
myexponent = 0;
mysignificand = 0;
} else if (category == fcInfinity) {
- myexponent = 0x1f;
+ myexponent = 0xff;
mysignificand = 0;
} else {
assert(category == fcNaN && "Unknown category!");
- myexponent = 0x1f;
+ myexponent = 0xff;
mysignificand = (uint32_t)*significandParts();
}