-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Enable logf128 constant folding for hosts with 128bit long double #104929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,6 @@ | |
|
|
||
| #include "llvm/Support/Compiler.h" | ||
| #include "llvm/Support/MathExtras.h" | ||
| #include "llvm/Support/float128.h" | ||
| #include <cassert> | ||
| #include <climits> | ||
| #include <cstring> | ||
|
|
@@ -1679,13 +1678,6 @@ class [[nodiscard]] APInt { | |
| /// any bit width. Exactly 64 bits will be translated. | ||
| double bitsToDouble() const { return llvm::bit_cast<double>(getWord(0)); } | ||
|
|
||
| #ifdef HAS_IEE754_FLOAT128 | ||
| float128 bitsToQuad() const { | ||
| __uint128_t ul = ((__uint128_t)U.pVal[1] << 64) + U.pVal[0]; | ||
| return llvm::bit_cast<float128>(ul); | ||
| } | ||
| #endif | ||
|
|
||
| /// Converts APInt bits to a float | ||
| /// | ||
| /// The conversion does not do a translation from integer to float, it just | ||
|
|
@@ -1883,6 +1875,12 @@ class [[nodiscard]] APInt { | |
| /// Returns whether this instance allocated memory. | ||
| bool needsCleanup() const { return !isSingleWord(); } | ||
|
|
||
| /// Get the word corresponding to a bit position | ||
| /// \returns the corresponding word for the specified bit position. | ||
| uint64_t getWord(unsigned bitPosition) const { | ||
|
||
| return isSingleWord() ? U.VAL : U.pVal[whichWord(bitPosition)]; | ||
| } | ||
|
|
||
| private: | ||
| /// This union is used to store the integer value. When the | ||
| /// integer bit-width <= 64, it uses VAL, otherwise it uses pVal. | ||
|
|
@@ -1948,12 +1946,6 @@ class [[nodiscard]] APInt { | |
| return *this; | ||
| } | ||
|
|
||
| /// Get the word corresponding to a bit position | ||
| /// \returns the corresponding word for the specified bit position. | ||
| uint64_t getWord(unsigned bitPosition) const { | ||
| return isSingleWord() ? U.VAL : U.pVal[whichWord(bitPosition)]; | ||
| } | ||
|
|
||
| /// Utility method to change the bit width of this APInt to new bit width, | ||
| /// allocating and/or deallocating as necessary. There is no guarantee on the | ||
| /// value of any bits upon return. Caller should populate the bits after. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this have a cmakedefine entry in llvm/Config/config.h.cmake instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was meant to always be enabled if available, and thus cmake would do a test and define the cmake variable LLVM_HAS_LOGF128 if the test passed. This patch has been reverted now, but what is likely to happen is this behaviour will be enabled by default, but be eligible to opt-out via a cmake definition which will have an entry in
llvm/Config/config.h.cmake