<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/Support/APFloat.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[Support] Remove redundant declarations (NFC) (#165971)</title>
<updated>2025-11-01T16:25:12+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2025-11-01T16:25:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0f76fbf546cccb48300a25ae965a715957cd04ac'/>
<id>0f76fbf546cccb48300a25ae965a715957cd04ac</id>
<content type='text'>
In C++17, static constexpr members are implicitly inline, so they no
longer require an out-of-line definition.

Identified with readability-redundant-declaration.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In C++17, static constexpr members are implicitly inline, so they no
longer require an out-of-line definition.

Identified with readability-redundant-declaration.</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm] Migrate away from a soft-deprecated constructor of APInt (NFC) (#165164)</title>
<updated>2025-10-26T22:20:00+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2025-10-26T22:20:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=50a37c022626816614a9d7da0a69bb77045e9e05'/>
<id>50a37c022626816614a9d7da0a69bb77045e9e05</id>
<content type='text'>
We have:

/// Once all uses of this constructor are migrated to other
constructors,
/// consider marking this overload ""= delete" to prevent calls from
being
/// incorrectly bound to the APInt(unsigned, uint64_t, bool)
constructor.
LLVM_ABI APInt(unsigned numBits, unsigned numWords, const uint64_t
bigVal[]);

This patch migrates away from this soft-deprecated constructor.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We have:

/// Once all uses of this constructor are migrated to other
constructors,
/// consider marking this overload ""= delete" to prevent calls from
being
/// incorrectly bound to the APInt(unsigned, uint64_t, bool)
constructor.
LLVM_ABI APInt(unsigned numBits, unsigned numWords, const uint64_t
bigVal[]);

This patch migrates away from this soft-deprecated constructor.</pre>
</div>
</content>
</entry>
<entry>
<title>[ADT, Support] Use std::min and std::max (NFC) (#164145)</title>
<updated>2025-10-19T19:37:43+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2025-10-19T19:37:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d43ad92e20072d648a61170acf354bc4eb473b3c'/>
<id>d43ad92e20072d648a61170acf354bc4eb473b3c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[APFloat] Outline special member functions (#164073)</title>
<updated>2025-10-18T14:48:05+00:00</updated>
<author>
<name>Yingwei Zheng</name>
<email>dtcxzyw2333@gmail.com</email>
</author>
<published>2025-10-18T14:48:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=035f81138888f30aab67ee12ce09982cd03370cb'/>
<id>035f81138888f30aab67ee12ce09982cd03370cb</id>
<content type='text'>
As discussed in
https://github.com/llvm/llvm-project/pull/111544#issuecomment-3405281695,
large special member functions in APFloat prevent function inlining and
cause compile-time regression. This patch moves them into the cpp file.

Compile-time improvement (-0.1%):
https://llvm-compile-time-tracker.com/compare.php?from=0f68dc6cffd93954188f73bff8aced93aab63687&amp;to=d3105c0860920651a7e939346e67c040776b2278&amp;stat=instructions:u</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As discussed in
https://github.com/llvm/llvm-project/pull/111544#issuecomment-3405281695,
large special member functions in APFloat prevent function inlining and
cause compile-time regression. This patch moves them into the cpp file.

Compile-time improvement (-0.1%):
https://llvm-compile-time-tracker.com/compare.php?from=0f68dc6cffd93954188f73bff8aced93aab63687&amp;to=d3105c0860920651a7e939346e67c040776b2278&amp;stat=instructions:u</pre>
</div>
</content>
</entry>
<entry>
<title>[APFloat] Inline static getters (#163794)</title>
<updated>2025-10-18T09:07:25+00:00</updated>
<author>
<name>Yingwei Zheng</name>
<email>dtcxzyw2333@gmail.com</email>
</author>
<published>2025-10-18T09:07:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0f68dc6cffd93954188f73bff8aced93aab63687'/>
<id>0f68dc6cffd93954188f73bff8aced93aab63687</id>
<content type='text'>
This patch exposes the declaration of fltSemantics to inline
PPCDoubleDouble() calls in the IEEEFloat/DoubleAPFloat dispatch.
It slightly improves the compile time:
https://llvm-compile-time-tracker.com/compare.php?from=f4359301c033694d36865c7560714164d2050240&amp;to=68de94d77d5bd33603193e8769829345b18fbae3&amp;stat=instructions:u
With https://github.com/llvm/llvm-project/pull/111544, the improvement
is more significant:
https://llvm-compile-time-tracker.com/compare.php?from=e438bae71d1fd55640d942b9ad795de2f60e44f2&amp;to=04751477940890c092dc4edb74e284de8f746d5a&amp;stat=instructions:u
 
Address comment
https://github.com/llvm/llvm-project/pull/111544#issuecomment-3405281695.

If breaking changes are allowed, we can encode all the properties of
fltSemantics within a 64-bit integer. Then we don't need `Semantics &lt;-&gt;
const fltSemantic` conversion.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch exposes the declaration of fltSemantics to inline
PPCDoubleDouble() calls in the IEEEFloat/DoubleAPFloat dispatch.
It slightly improves the compile time:
https://llvm-compile-time-tracker.com/compare.php?from=f4359301c033694d36865c7560714164d2050240&amp;to=68de94d77d5bd33603193e8769829345b18fbae3&amp;stat=instructions:u
With https://github.com/llvm/llvm-project/pull/111544, the improvement
is more significant:
https://llvm-compile-time-tracker.com/compare.php?from=e438bae71d1fd55640d942b9ad795de2f60e44f2&amp;to=04751477940890c092dc4edb74e284de8f746d5a&amp;stat=instructions:u
 
Address comment
https://github.com/llvm/llvm-project/pull/111544#issuecomment-3405281695.

If breaking changes are allowed, we can encode all the properties of
fltSemantics within a 64-bit integer. Then we don't need `Semantics &lt;-&gt;
const fltSemantic` conversion.</pre>
</div>
</content>
</entry>
<entry>
<title>[ADT] Fix a bug in DoubleAPFloat::frexp (#161625)</title>
<updated>2025-10-02T16:26:46+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2025-10-02T16:26:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=18997b5a8fafe3b176529b83700d00d5b5876335'/>
<id>18997b5a8fafe3b176529b83700d00d5b5876335</id>
<content type='text'>
Without this patch, we call APFloat::makeQuiet() in frexp like so:

  Quiet.getFirst().makeQuiet();

The problem is that makeQuiet returns a new value instead of modifying
"*this" in place, so we end up discarding the newly returned value.

This patch fixes the problem by assigning the result back to
Quiet.getFirst().

We should put [[nodiscard]] on APFloat::makeQuiet, but I'll do that in
another patch.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Without this patch, we call APFloat::makeQuiet() in frexp like so:

  Quiet.getFirst().makeQuiet();

The problem is that makeQuiet returns a new value instead of modifying
"*this" in place, so we end up discarding the newly returned value.

This patch fixes the problem by assigning the result back to
Quiet.getFirst().

We should put [[nodiscard]] on APFloat::makeQuiet, but I'll do that in
another patch.</pre>
</div>
</content>
</entry>
<entry>
<title>[APFloat] Properly implement DoubleAPFloat::convertFromAPInt</title>
<updated>2025-08-24T22:47:54+00:00</updated>
<author>
<name>David Majnemer</name>
<email>david.majnemer@gmail.com</email>
</author>
<published>2025-08-13T18:36:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=45f3263c6f93cc07faedb9b3ca2c56349f55e6e0'/>
<id>45f3263c6f93cc07faedb9b3ca2c56349f55e6e0</id>
<content type='text'>
The old implementation converted to the legacy semantics, inducing
rounding and not properly handling inputs like (2^1000 + 2^200) which
have have more precision than the legacy semantics can represent.

Instead, we convert the integer into two floats and an error.  The error
is used to implement the rounding behavior.

Remove related dead, untested code: convertFrom*ExtendedInteger
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The old implementation converted to the legacy semantics, inducing
rounding and not properly handling inputs like (2^1000 + 2^200) which
have have more precision than the legacy semantics can represent.

Instead, we convert the integer into two floats and an error.  The error
is used to implement the rounding behavior.

Remove related dead, untested code: convertFrom*ExtendedInteger
</pre>
</div>
</content>
</entry>
<entry>
<title>[APFloat] Properly implement DoubleAPFloat::compareAbsoluteValue</title>
<updated>2025-08-21T22:42:07+00:00</updated>
<author>
<name>David Majnemer</name>
<email>david.majnemer@gmail.com</email>
</author>
<published>2025-08-15T20:14:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f961b61f8841c8488ab2194ac7a82e557736a949'/>
<id>f961b61f8841c8488ab2194ac7a82e557736a949</id>
<content type='text'>
The prior implementation would treat X+Y and X-Y as having equal
magnitude.  Rework the implementation to be more resilient.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The prior implementation would treat X+Y and X-Y as having equal
magnitude.  Rework the implementation to be more resilient.
</pre>
</div>
</content>
</entry>
<entry>
<title>Reapply "[APFloat] Fix getExactInverse for DoubleAPFloat"</title>
<updated>2025-08-20T21:02:36+00:00</updated>
<author>
<name>David Majnemer</name>
<email>david.majnemer@gmail.com</email>
</author>
<published>2025-08-15T20:15:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0a7eabcc56c6ef141923783a56460cbe94f13ba2'/>
<id>0a7eabcc56c6ef141923783a56460cbe94f13ba2</id>
<content type='text'>
The previous implementation of getExactInverse used the following check
to identify powers of two:

  // Check that the number is a power of two by making sure that only the
  // integer bit is set in the significand.
  if (significandLSB() != semantics-&gt;precision - 1)
    return false;

This condition verifies that the only set bit in the significand is the
integer bit, which is correct for normal numbers. However, this logic is
not correct for subnormal values.

APFloat represents subnormal numbers by shifting the significand right
while holding the exponent at its minimum value. For a power of two in
the subnormal range, its single set bit will therefore be at a position
lower than precision - 1. The original check would consequently fail,
causing the function to determine that these numbers do not have an
exact multiplicative inverse.

The new logic calculated this correctly but it seems that
test/CodeGen/Thumb2/mve-vcvt-fixed-to-float.ll expected the old
behavior.

Seeing as how getExactInverse does not have tests or documentation, we
conservatively maintain (and document) this behavior.

This reverts commit 47e62e846beb267aad50eb9195dfd855e160483e.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The previous implementation of getExactInverse used the following check
to identify powers of two:

  // Check that the number is a power of two by making sure that only the
  // integer bit is set in the significand.
  if (significandLSB() != semantics-&gt;precision - 1)
    return false;

This condition verifies that the only set bit in the significand is the
integer bit, which is correct for normal numbers. However, this logic is
not correct for subnormal values.

APFloat represents subnormal numbers by shifting the significand right
while holding the exponent at its minimum value. For a power of two in
the subnormal range, its single set bit will therefore be at a position
lower than precision - 1. The original check would consequently fail,
causing the function to determine that these numbers do not have an
exact multiplicative inverse.

The new logic calculated this correctly but it seems that
test/CodeGen/Thumb2/mve-vcvt-fixed-to-float.ll expected the old
behavior.

Seeing as how getExactInverse does not have tests or documentation, we
conservatively maintain (and document) this behavior.

This reverts commit 47e62e846beb267aad50eb9195dfd855e160483e.
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[APFloat] Fix getExactInverse for DoubleAPFloat"</title>
<updated>2025-08-14T04:39:50+00:00</updated>
<author>
<name>Aiden Grossman</name>
<email>aidengrossman@google.com</email>
</author>
<published>2025-08-14T04:39:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=47e62e846beb267aad50eb9195dfd855e160483e'/>
<id>47e62e846beb267aad50eb9195dfd855e160483e</id>
<content type='text'>
This reverts commit f4941319cba19d7691baa6ec783c84be4d847637.

This broke llvm/test/CodeGen/Thumb2/mve-vcvt-fixed-to-float.ll which
took out a ton of buildbots and also broke premerge.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit f4941319cba19d7691baa6ec783c84be4d847637.

This broke llvm/test/CodeGen/Thumb2/mve-vcvt-fixed-to-float.ll which
took out a ton of buildbots and also broke premerge.
</pre>
</div>
</content>
</entry>
</feed>
