diff options
author | Matthew Devereau <matthew.devereau@arm.com> | 2024-08-22 10:12:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-22 10:12:59 +0100 |
commit | 14c7e4a1844904f3db9b2dc93b722925a8c66b27 (patch) | |
tree | e692c84833844ae07faa1fcfc0bd143f382d0b5b /llvm/lib/Support/APFloat.cpp | |
parent | 00a1a45a7dcdcd8b1f969958a6d927b595567090 (diff) | |
download | llvm-14c7e4a1844904f3db9b2dc93b722925a8c66b27.zip llvm-14c7e4a1844904f3db9b2dc93b722925a8c66b27.tar.gz llvm-14c7e4a1844904f3db9b2dc93b722925a8c66b27.tar.bz2 |
Enable logf128 constant folding for hosts with 128bit long double (#104929)
This is a reland of (#96287). This patch attempts to reduce the reverted
patch's clang compile time by removing #includes of float128.h and
inlining convertToQuad functions instead.
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r-- | llvm/lib/Support/APFloat.cpp | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index 7f68c5a..2ddf99f 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -3749,15 +3749,6 @@ double IEEEFloat::convertToDouble() const { return api.bitsToDouble(); } -#ifdef HAS_IEE754_FLOAT128 -float128 IEEEFloat::convertToQuad() const { - assert(semantics == (const llvm::fltSemantics *)&semIEEEquad && - "Float semantics are not IEEEquads"); - APInt api = bitcastToAPInt(); - return api.bitsToQuad(); -} -#endif - /// Integer bit is explicit in this format. Intel hardware (387 and later) /// does not support these bit patterns: /// exponent = all 1's, integer bit 0, significand 0 ("pseudoinfinity") @@ -5406,20 +5397,9 @@ double APFloat::convertToDouble() const { return Temp.getIEEE().convertToDouble(); } -#ifdef HAS_IEE754_FLOAT128 -float128 APFloat::convertToQuad() const { - if (&getSemantics() == (const llvm::fltSemantics *)&semIEEEquad) - return getIEEE().convertToQuad(); - assert(getSemantics().isRepresentableBy(semIEEEquad) && - "Float semantics is not representable by IEEEquad"); - APFloat Temp = *this; - bool LosesInfo; - opStatus St = Temp.convert(semIEEEquad, rmNearestTiesToEven, &LosesInfo); - assert(!(St & opInexact) && !LosesInfo && "Unexpected imprecision"); - (void)St; - return Temp.getIEEE().convertToQuad(); +bool APFloat::isValidIEEEQuad() const { + return (&getSemantics() == (const llvm::fltSemantics *)&semIEEEquad); } -#endif float APFloat::convertToFloat() const { if (&getSemantics() == (const llvm::fltSemantics *)&semIEEEsingle) |