Adds an extra explicit cast to fix Bug 7931 and removes codepaths that were never used
llvm-svn: 111269
This commit is contained in:
parent
51b8b1d36c
commit
5f0e6e7b92
@ -35,17 +35,11 @@ fp_t __floatsidf(int a) {
|
|||||||
const int exponent = (aWidth - 1) - __builtin_clz(a);
|
const int exponent = (aWidth - 1) - __builtin_clz(a);
|
||||||
rep_t result;
|
rep_t result;
|
||||||
|
|
||||||
// Shift a into the significand field, rounding if it is a right-shift
|
// Shift a into the significand field and clear the implicit bit. Extra
|
||||||
if (exponent <= significandBits) {
|
// cast to unsigned int is necessary to get the correct behavior for
|
||||||
|
// the input INT_MIN.
|
||||||
const int shift = significandBits - exponent;
|
const int shift = significandBits - exponent;
|
||||||
result = (rep_t)a << shift ^ implicitBit;
|
result = (rep_t)(unsigned int)a << shift ^ implicitBit;
|
||||||
} else {
|
|
||||||
const int shift = exponent - significandBits;
|
|
||||||
result = (rep_t)a >> shift ^ implicitBit;
|
|
||||||
rep_t round = (rep_t)a << (typeWidth - shift);
|
|
||||||
if (round > signBit) result++;
|
|
||||||
if (round == signBit) result += result & 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert the exponent
|
// Insert the exponent
|
||||||
result += (rep_t)(exponent + exponentBias) << significandBits;
|
result += (rep_t)(exponent + exponentBias) << significandBits;
|
||||||
|
@ -27,17 +27,9 @@ fp_t __floatunsidf(unsigned int a) {
|
|||||||
const int exponent = (aWidth - 1) - __builtin_clz(a);
|
const int exponent = (aWidth - 1) - __builtin_clz(a);
|
||||||
rep_t result;
|
rep_t result;
|
||||||
|
|
||||||
// Shift a into the significand field, rounding if it is a right-shift
|
// Shift a into the significand field and clear the implicit bit.
|
||||||
if (exponent <= significandBits) {
|
|
||||||
const int shift = significandBits - exponent;
|
const int shift = significandBits - exponent;
|
||||||
result = (rep_t)a << shift ^ implicitBit;
|
result = (rep_t)a << shift ^ implicitBit;
|
||||||
} else {
|
|
||||||
const int shift = exponent - significandBits;
|
|
||||||
result = (rep_t)a >> shift ^ implicitBit;
|
|
||||||
rep_t round = (rep_t)a << (typeWidth - shift);
|
|
||||||
if (round > signBit) result++;
|
|
||||||
if (round == signBit) result += result & 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert the exponent
|
// Insert the exponent
|
||||||
result += (rep_t)(exponent + exponentBias) << significandBits;
|
result += (rep_t)(exponent + exponentBias) << significandBits;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user