Re: Using POPCNT and other advanced bit manipulation instructions
| От | Alvaro Herrera |
|---|---|
| Тема | Re: Using POPCNT and other advanced bit manipulation instructions |
| Дата | |
| Msg-id | 20190213231709.GA12159@alvherre.pgsql обсуждение исходный текст |
| Ответ на | Re: Using POPCNT and other advanced bit manipulation instructions (Tom Lane <tgl@sss.pgh.pa.us>) |
| Список | pgsql-hackers |
On 2019-Feb-13, Tom Lane wrote:
> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> > and we have defined pg_popcount64() like this:
>
> > static int
> > pg_popcount64_sse42(uint64 word)
> > {
> > return __builtin_popcountl(word);
> > }
>
> That is clearly completely broken.
Pushed my proposed fix, which includes removing the configure tests for
builtins of varying widths. I couldn't resist sorting entries
alphabetically in configure.in. (I also used autoheader to produce the
new pg_config.h, which showed me that David had not used it to generate
his diffs there.)
For pg_config.h.win32 I used the compiler explorer tool I just learned
about, and came to the conclusion that MSVC's compiler does not
implement these builtins.
I didn't do anything about the const-cast-away in pg_popcount() yet.
I think that should use PointerIsAligned() instead of what it's doing
now.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-hackers по дате отправления: