[clang] [llvm] [APFloat] Add APFloat support for FP6 data types (PR #94735)
Jakub Kuderski via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 7 07:24:38 PDT 2024
================
@@ -1499,16 +1521,18 @@ static void tcSetLeastSignificantBits(APInt::WordType *dst, unsigned parts,
/* Handle overflow. Sign is preserved. We either become infinity or
the largest finite number. */
IEEEFloat::opStatus IEEEFloat::handleOverflow(roundingMode rounding_mode) {
- /* Infinity? */
- if (rounding_mode == rmNearestTiesToEven ||
- rounding_mode == rmNearestTiesToAway ||
- (rounding_mode == rmTowardPositive && !sign) ||
- (rounding_mode == rmTowardNegative && sign)) {
- if (semantics->nonFiniteBehavior == fltNonfiniteBehavior::NanOnly)
- makeNaN(false, sign);
- else
- category = fcInfinity;
- return (opStatus) (opOverflow | opInexact);
+ if (semantics->nonFiniteBehavior != fltNonfiniteBehavior::NoNanInf) {
+ /* Infinity? */
+ if (rounding_mode == rmNearestTiesToEven ||
+ rounding_mode == rmNearestTiesToAway ||
+ (rounding_mode == rmTowardPositive && !sign) ||
+ (rounding_mode == rmTowardNegative && sign)) {
+ if (semantics->nonFiniteBehavior == fltNonfiniteBehavior::NanOnly)
+ makeNaN(false, sign);
+ else
+ category = fcInfinity;
+ return (opStatus)(opOverflow | opInexact);
----------------
kuhar wrote:
nit: prefer `static_cast`
https://github.com/llvm/llvm-project/pull/94735
More information about the cfe-commits
mailing list