Re: use CLZ instruction in AllocSetFreeIndex() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: use CLZ instruction in AllocSetFreeIndex()
Date
Msg-id 8398.1577464998@sss.pgh.pa.us
Whole thread Raw
In response to Re: use CLZ instruction in AllocSetFreeIndex()  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> On 2019-Dec-27, Tom Lane wrote:
>> ... Perhaps what we really ought to be working on is
>> finding MSVC equivalents for __builtin_clz and friends.

> Apparently clz() can be written using _BitScanReverse(), per
> https://stackoverflow.com/a/20468180
> https://docs.microsoft.com/en-us/cpp/intrinsics/bitscanreverse-bitscanreverse64?view=vs-2015

Yeah, I found that too.  It looks promising, but we need to look into
* portability to different MSVC versions? (I guess the buildfarm would
  tell us)
* performance, does it actually generate comparable code?
* intrinsics for the other bit instructions we use?

            regards, tom lane



pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: use CLZ instruction in AllocSetFreeIndex()
Next
From: Justin Pryzby
Date:
Subject: Re: [PATCH v1] pg_ls_tmpdir to show directories