Re: Using POPCNT and other advanced bit manipulation instructions

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Using POPCNT and other advanced bit manipulation instructions
Дата
Msg-id 20190213201211.GA5800@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: Using POPCNT and other advanced bit manipulation instructions  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On 2019-Feb-13, Andres Freund wrote:

> Hi,
> 
> On February 13, 2019 8:40:14 PM GMT+01:00, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> >> I've pushed this now.  Let's see what the buildfarm has to say about
> >it.
> >
> >It's likely to be hard to tell, given the amount of pink from the Ryu
> >patch.  If Andrew is not planning to clean that up PDQ, I'd suggest
> >reverting that patch pending having some repairs for it.
> 
> I'd assume that breaking bit counting would cause distinct enough
> damage (compile time or crashes).

I was a bit surprised to find out that the assembly generated by
compiling the code in test for __builtin_foo() does not actually include
the calls being tested ... (they're only used to generate the value for
a static variable, and that gets optimized away); but then the comment
for the test does say that we're only testing that the compiler
understands the construct, so I suppose that's fine.  Also, we already
do that for bswap.

This "compiler explorer" tool is nice:


https://gcc.godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(j:1,source:'int+main(int+argc+,+char**+argv)%0A%7B%0A%0A++return++__builtin_popcountll((unsigned)argc)%3B%0A%0A%7D'),l:'5',n:'0',o:'C%2B%2B+source+%231',t:'0')),k:45.01119572686435,l:'4',m:100,n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:g447,filters:(b:'0',commentOnly:'0',directives:'0',intel:'0'),libs:!(),options:'-Wall+-O3+-msse4.2',source:1),l:'5',n:'0',o:'x86-64+gcc+4.4.7+(Editor+%231,+Compiler+%231)',t:'0')),k:54.98880427313565,l:'4',m:100,n:'0',o:'',s:0,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Steele
Дата:
Сообщение: Re: Commit Fest 2019-01 is now closed
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Protect syscache from bloating with negative cache entries