<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/Support/APInt.cpp, branch users/nico/python-2</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>[APInt] APInt::clearBitsSlowCase - fix cut+paste typo when merging lo/himasks (#141108)</title>
<updated>2025-05-22T20:52:59+00:00</updated>
<author>
<name>Simon Pilgrim</name>
<email>llvm-dev@redking.me.uk</email>
</author>
<published>2025-05-22T20:52:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=23f0fbf8fff563c77f770f83096b522c3c99a82d'/>
<id>23f0fbf8fff563c77f770f83096b522c3c99a82d</id>
<content type='text'>
Fixes #141098</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #141098</pre>
</div>
</content>
</entry>
<entry>
<title>[NFC][ADT/Support] Add {} for else when if body has {} (#140758)</title>
<updated>2025-05-21T20:19:09+00:00</updated>
<author>
<name>Rahul Joshi</name>
<email>rjoshi@nvidia.com</email>
</author>
<published>2025-05-21T20:19:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a76bf4da53182baace54fd69f9d38fc10e6b8e85'/>
<id>a76bf4da53182baace54fd69f9d38fc10e6b8e85</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[APInt] Added APInt::clearBits() method (#137098)</title>
<updated>2025-05-19T11:41:04+00:00</updated>
<author>
<name>Liam Semeria</name>
<email>56208783+liamsemeria@users.noreply.github.com</email>
</author>
<published>2025-05-19T11:41:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d067014f13871642888afde850cdc558c32f350c'/>
<id>d067014f13871642888afde850cdc558c32f350c</id>
<content type='text'>
Added APInt::clearBits(unsigned loBit, unsigned hiBit) that clears bits within a certain range.

Fixes #136550

---------

Co-authored-by: Simon Pilgrim &lt;llvm-dev@redking.me.uk&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Added APInt::clearBits(unsigned loBit, unsigned hiBit) that clears bits within a certain range.

Fixes #136550

---------

Co-authored-by: Simon Pilgrim &lt;llvm-dev@redking.me.uk&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>remove extra ; (#123352)</title>
<updated>2025-01-17T15:11:52+00:00</updated>
<author>
<name>Iman Hosseini</name>
<email>imanhosseini@google.com</email>
</author>
<published>2025-01-17T15:11:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=63b0ab84253f29f1f9b9136a02d589552b29c645'/>
<id>63b0ab84253f29f1f9b9136a02d589552b29c645</id>
<content type='text'>
Remove erroneous extra semicolon in:
https://github.com/llvm/llvm-project/pull/122788

Co-authored-by: ImanHosseini &lt;imanhosseini.17@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove erroneous extra semicolon in:
https://github.com/llvm/llvm-project/pull/122788

Co-authored-by: ImanHosseini &lt;imanhosseini.17@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>add power function to APInt (#122788)</title>
<updated>2025-01-17T14:40:31+00:00</updated>
<author>
<name>Iman Hosseini</name>
<email>imanhosseini@google.com</email>
</author>
<published>2025-01-17T14:40:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8ae1cb2bcb55293cce31bb75c38d6b4e8a13cc23'/>
<id>8ae1cb2bcb55293cce31bb75c38d6b4e8a13cc23</id>
<content type='text'>
I am trying to calculate power function for APFloat, APInt to constant
fold vector reductions: https://github.com/llvm/llvm-project/pull/122450
I need this utility to fold N `mul`s into power.

---------

Co-authored-by: ImanHosseini &lt;imanhosseini.17@gmail.com&gt;
Co-authored-by: Jakub Kuderski &lt;kubakuderski@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I am trying to calculate power function for APFloat, APInt to constant
fold vector reductions: https://github.com/llvm/llvm-project/pull/122450
I need this utility to fold N `mul`s into power.

---------

Co-authored-by: ImanHosseini &lt;imanhosseini.17@gmail.com&gt;
Co-authored-by: Jakub Kuderski &lt;kubakuderski@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>APInt.cpp: Prune a stray semicolon.</title>
<updated>2024-10-17T11:04:00+00:00</updated>
<author>
<name>NAKAMURA Takumi</name>
<email>geek4civic@gmail.com</email>
</author>
<published>2024-10-15T12:12:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=83953c7df107af26ebf9ab82e01623c991637199'/>
<id>83953c7df107af26ebf9ab82e01623c991637199</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[APInt] Slightly simplify APInt::ashrSlowCase. NFC (#111220)</title>
<updated>2024-10-05T17:25:50+00:00</updated>
<author>
<name>Craig Topper</name>
<email>craig.topper@sifive.com</email>
</author>
<published>2024-10-05T17:25:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=bcb15d00596f8f25310887494f171e7f70386e7c'/>
<id>bcb15d00596f8f25310887494f171e7f70386e7c</id>
<content type='text'>
Use an arithmetic shift for the last word copy when BitShift!=0. This
avoids an explicit sign extend after the shift.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use an arithmetic shift for the last word copy when BitShift!=0. This
avoids an explicit sign extend after the shift.</pre>
</div>
</content>
</entry>
<entry>
<title>[APInt] improve initialization performance (#106945)</title>
<updated>2024-09-04T06:54:36+00:00</updated>
<author>
<name>Princeton Ferro</name>
<email>princetonferro@gmail.com</email>
</author>
<published>2024-09-04T06:54:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=427e202a401514cb28bf2ca621baae8e1b2f552f'/>
<id>427e202a401514cb28bf2ca621baae8e1b2f552f</id>
<content type='text'>
The purpose is to save an extra memset in both cases:

1. When `int64_t(val) &lt; 0`, zeroing out is redundant as the subsequent
for-loop will initialize to `val .. 0xFFFFF ....`. Instead we should
only create an uninitialized buffer, and transform the slow for-loop
into a memset to initialize the higher words to `0xFF`.
2. In the other case, first we create an uninitialized array (`new
int64_t[]`) and _then_ we zero it out with `memset`. But this can be
combined in one operation with `new int64_t[]()`, which
default-initializes the array.

On one example where use of APInt was heavy, this improved compile time
by 1%.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The purpose is to save an extra memset in both cases:

1. When `int64_t(val) &lt; 0`, zeroing out is redundant as the subsequent
for-loop will initialize to `val .. 0xFFFFF ....`. Instead we should
only create an uninitialized buffer, and transform the slow for-loop
into a memset to initialize the higher words to `0xFF`.
2. In the other case, first we create an uninitialized array (`new
int64_t[]`) and _then_ we zero it out with `memset`. But this can be
combined in one operation with `new int64_t[]()`, which
default-initializes the array.

On one example where use of APInt was heavy, this improved compile time
by 1%.</pre>
</div>
</content>
</entry>
<entry>
<title>[APInt] Add default-disabled assertion to APInt constructor (#106524)</title>
<updated>2024-09-02T07:48:54+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>npopov@redhat.com</email>
</author>
<published>2024-09-02T07:48:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=30cc198c2d4ad784f18cc10a03d45a19145357af'/>
<id>30cc198c2d4ad784f18cc10a03d45a19145357af</id>
<content type='text'>
If the uint64_t constructor is used, assert that the value is actually a
signed or unsigned N-bit integer depending on whether the isSigned flag
is set. Provide an implicitTrunc flag to restore the previous behavior,
where the argument is silently truncated instead.

In this commit, implicitTrunc is enabled by default, which means that
the new assertions are disabled and no actual change in behavior occurs.
The plan is to flip the default once all places violating the assertion
have been fixed. See #80309 for the scope of the necessary changes.

The primary motivation for this change is to avoid incorrectly specified
isSigned flags. A recurring problem we have is that people write
something like `APInt(BW, -1)` and this works perfectly fine -- until
the code path is hit with `BW &gt; 64`. Most of our i128 specific
miscompilations are caused by variants of this issue.

The cost of the change is that we have to specify the correct isSigned
flag (and make sure there are no excess bits) for uses where BW is
always &lt;= 64 as well.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the uint64_t constructor is used, assert that the value is actually a
signed or unsigned N-bit integer depending on whether the isSigned flag
is set. Provide an implicitTrunc flag to restore the previous behavior,
where the argument is silently truncated instead.

In this commit, implicitTrunc is enabled by default, which means that
the new assertions are disabled and no actual change in behavior occurs.
The plan is to flip the default once all places violating the assertion
have been fixed. See #80309 for the scope of the necessary changes.

The primary motivation for this change is to avoid incorrectly specified
isSigned flags. A recurring problem we have is that people write
something like `APInt(BW, -1)` and this works perfectly fine -- until
the code path is hit with `BW &gt; 64`. Most of our i128 specific
miscompilations are caused by variants of this issue.

The cost of the change is that we have to specify the correct isSigned
flag (and make sure there are no excess bits) for uses where BW is
always &lt;= 64 as well.</pre>
</div>
</content>
</entry>
<entry>
<title>[APInt] Correct backwards static_assert condition. (#103641)</title>
<updated>2024-08-14T07:28:24+00:00</updated>
<author>
<name>Craig Topper</name>
<email>craig.topper@sifive.com</email>
</author>
<published>2024-08-14T07:28:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=cbd306806ad4b518e664f122838e45d709db0ef6'/>
<id>cbd306806ad4b518e664f122838e45d709db0ef6</id>
<content type='text'>
In order to guarantee that extracting 64 bits doesn't require more than
2 words, the word size would need to be 64 bits or more. If the word
size was smaller than 64, like 32, you may need to read 3 words to get
64 bits.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In order to guarantee that extracting 64 bits doesn't require more than
2 words, the word size would need to be 64 bits or more. If the word
size was smaller than 64, like 32, you may need to read 3 words to get
64 bits.</pre>
</div>
</content>
</entry>
</feed>
