Lines Matching +full:2 +full:x32 +full:- +full:bit

1 //===-- lib/fp_lib.h - Floating-point utilities -------------------*- C -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file is a configuration header for soft-float routines in compiler-rt.
10 // This file does not provide any part of the compiler-rt interface, but defines
12 // implementation of the soft-float routines in compiler-rt.
14 // Assumes that float, double and long double correspond to the IEEE-754
18 //===----------------------------------------------------------------------===//
43 // 32x32 --> 64 bit multiply
66 // 64x64 -> 128 wide multiply for platforms that don't have such an operation;
67 // many 64-bit platforms have this operation, but they tend to have hardware
68 // floating-point, so we don't bother with a special case for them here.
70 // Each of the component 32x32 -> 64 products in wideMultiply()
97 // 128-bit integer, we let the constant be casted to 128-bit integer
136 // 128x128 -> 256 wide multiply for platforms that don't have such an operation;
137 // many 64-bit platforms have this operation, but they tend to have hardware
138 // floating-point, so we don't bother with a special case for them here.
213 #define exponentBits (typeWidth - significandBits - 1)
214 #define maxExponent ((1 << exponentBits) - 1)
218 #define significandMask (implicitBit - 1U)
220 #define absMask (signBit - 1U)
228 const int shift = rep_clz(*significand) - rep_clz(implicitBit); in normalize()
230 return 1 - shift; in normalize()
234 *hi = *hi << count | *lo >> (typeWidth - count); in wideLeftShift()
241 const bool sticky = (*lo << (typeWidth - count)) != 0; in wideRightShiftWithSticky()
242 *lo = *hi << (typeWidth - count) | *lo >> count | sticky; in wideRightShiftWithSticky()
244 } else if (count < 2 * typeWidth) { in wideRightShiftWithSticky()
245 const bool sticky = *hi << (2 * typeWidth - count) | *lo; in wideRightShiftWithSticky()
246 *lo = *hi >> (count - typeWidth) | sticky; in wideRightShiftWithSticky()
255 // Implements logb methods (logb, logbf, logbl) for IEEE-754. This avoids
256 // pulling in a libm dependency from compiler-rt, but is not meant to replace
264 // 1) +/- inf returns +inf; NaN returns NaN in __compiler_rt_logbX()
265 // 2) 0.0 returns -inf in __compiler_rt_logbX()
270 return -x; // -inf: return -x in __compiler_rt_logbX()
273 // 0.0: return -inf in __compiler_rt_logbX()
279 return exp - exponentBias; // Unbias exponent in __compiler_rt_logbX()
283 const int shift = 1 - normalize(&rep); in __compiler_rt_logbX()
285 return exp - exponentBias - shift; // Unbias exponent in __compiler_rt_logbX()
296 return x; // +/- 0.0, NaN, or inf: return x in __compiler_rt_scalbnX()
302 sig &= ~implicitBit; // clear the implicit bit again in __compiler_rt_scalbnX()
310 // Return this value: [+/-] 1.sig * 2 ** (exp - exponentBias). in __compiler_rt_scalbnX()
313 // Overflow, which could produce infinity or the largest-magnitude value, in __compiler_rt_scalbnX()
315 return fromRep(sign | ((rep_t)(maxExponent - 1) << significandBits)) * 2.0f; in __compiler_rt_scalbnX()
317 // Subnormal or underflow. Use floating-point multiply to handle truncation in __compiler_rt_scalbnX()
320 exp += exponentBias - 1; in __compiler_rt_scalbnX()
334 // arbitrarily return the second one. Otherwise, if both arguments are +/-0, in __compiler_rt_fmaxX()