Re: Using POPCNT and other advanced bit manipulation instructions
От
Alvaro Herrera
Тема
Re: Using POPCNT and other advanced bit manipulation instructions
Дата
Msg-id
20190215160412.GA7354@alvherre.pgsql
Ответ на
Список
Дерево обсуждения
Using POPCNT and other advanced bit manipulation instructions David Rowley <david.rowley@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Michael Paquier <michael@paquier.xyz>
Re: Using POPCNT and other advanced bit manipulation instructions David Rowley <david.rowley@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Tom Lane <tgl@sss.pgh.pa.us>
Re: Using POPCNT and other advanced bit manipulation instructions Andres Freund <andres@anarazel.de>
Re: Using POPCNT and other advanced bit manipulation instructions Tom Lane <tgl@sss.pgh.pa.us>
Re: Using POPCNT and other advanced bit manipulation instructions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Andrew Gierth <andrew@tao11.riddles.org.uk>
Re: Using POPCNT and other advanced bit manipulation instructions Andrew Gierth <andrew@tao11.riddles.org.uk>
Re: Using POPCNT and other advanced bit manipulation instructions Andrew Gierth <andrew@tao11.riddles.org.uk>
Re: Using POPCNT and other advanced bit manipulation instructions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Tom Lane <tgl@sss.pgh.pa.us>
Re: Using POPCNT and other advanced bit manipulation instructions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Tom Lane <tgl@sss.pgh.pa.us>
Re: Using POPCNT and other advanced bit manipulation instructions Tom Lane <tgl@sss.pgh.pa.us>
Re: Using POPCNT and other advanced bit manipulation instructions Thomas Munro <thomas.munro@enterprisedb.com>
Re: Using POPCNT and other advanced bit manipulation instructions Tom Lane <tgl@sss.pgh.pa.us>
Re: Using POPCNT and other advanced bit manipulation instructions Tom Lane <tgl@sss.pgh.pa.us>
Re: Using POPCNT and other advanced bit manipulation instructions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Andres Freund <andres@anarazel.de>
Re: Using POPCNT and other advanced bit manipulation instructions Tom Lane <tgl@sss.pgh.pa.us>
Re: Using POPCNT and other advanced bit manipulation instructions Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Re: Using POPCNT and other advanced bit manipulation instructions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Tom Lane <tgl@sss.pgh.pa.us>
Re: Using POPCNT and other advanced bit manipulation instructions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Tom Lane <tgl@sss.pgh.pa.us>
Re: Using POPCNT and other advanced bit manipulation instructions Andres Freund <andres@anarazel.de>
Re: Using POPCNT and other advanced bit manipulation instructions Tom Lane <tgl@sss.pgh.pa.us>
Re: Using POPCNT and other advanced bit manipulation instructions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Tom Lane <tgl@sss.pgh.pa.us>
Re: Using POPCNT and other advanced bit manipulation instructions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Tom Lane <tgl@sss.pgh.pa.us>
Re: Using POPCNT and other advanced bit manipulation instructions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Gavin Flower <GavinFlower@archidevsys.co.nz>
Re: Using POPCNT and other advanced bit manipulation instructions Tom Lane <tgl@sss.pgh.pa.us>
Re: Using POPCNT and other advanced bit manipulation instructions Andrew Gierth <andrew@tao11.riddles.org.uk>
Re: Using POPCNT and other advanced bit manipulation instructions Gavin Flower <GavinFlower@archidevsys.co.nz>
Re: Using POPCNT and other advanced bit manipulation instructions David Rowley <david.rowley@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Dmitry Dolgov <9erthalion6@gmail.com>
Re: Using POPCNT and other advanced bit manipulation instructions David Rowley <david.rowley@2ndquadrant.com>
Re: Using POPCNT and other advanced bit manipulation instructions Dmitry Dolgov <9erthalion6@gmail.com>
Re: Using POPCNT and other advanced bit manipulation instructions Jose Luis Tallon <jltallon@adv-solutions.net>
Re: Using POPCNT and other advanced bit manipulation instructions David Rowley <david.rowley@2ndquadrant.com>
On 2019-Feb-15, Tom Lane wrote: > Alvaro Herrera writes: > > Ah, I understand it now: > > https://stackoverflow.com/questions/25683690/confusion-about-bsr-and-lzcnt/43443701#43443701 > > if you call LZCNT/TZCNT on a CPU that doesn't support it, it won't raise > > SIGILL or anything ... it'll just silently compute the wrong result. > > That's certainly not what I call a fallback! > > Yeah, that's pretty nasty; it means there's no backstop for whether > your choose function gets it right :-( Hopefully other tests will fail in some visible way, though. My fear is whether we have such systems in buildfarm. > Is POPCNT any better in this respect? I couldn't find how is POPCNT encoded. https://stackoverflow.com/a/28803917/242383 I did find these articles: http://danluu.com/assembly-intrinsics/ https://stackoverflow.com/questions/25078285/replacing-a-32-bit-loop-counter-with-64-bit-introduces-crazy-performance-deviati This suggests that this all a largely pointless exercise at least on Intel and GCC/Clang. It may be better on AMD ... but to get really better performance we'd need to be coding the popcnt calls in assembly rather than using the compiler intrinsics, even with -mpopcnt, because the intrinsics suck. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-hackers по дате отправления
От: Tomas Vondra
Дата: