Re: Use POPCNT on MSVC

2021-08-08 Thread David Rowley
On Mon, 9 Aug 2021 at 12:58, John Naylor wrote: > > On Sun, Aug 8, 2021 at 8:31 PM David Rowley wrote: > > > > I've attached a v2 patch which I think is more along the lines of what > > you had in mind. > > LGTM Thanks for the review. Pushed. David

Re: Use POPCNT on MSVC

2021-08-08 Thread John Naylor
On Sun, Aug 8, 2021 at 8:31 PM David Rowley wrote: > > I've attached a v2 patch which I think is more along the lines of what > you had in mind. LGTM -- John Naylor EDB: http://www.enterprisedb.com

Re: Use POPCNT on MSVC

2021-08-08 Thread David Rowley
On Thu, 5 Aug 2021 at 07:02, John Naylor wrote: > > #if defined(_MSC_VER) && defined(_WIN64) > > #define HAVE_X86_64_POPCNTQ > > #endif > > That seems fine. I don't know PG can build with Arm on Windows, but for the > cpuid to work, it seems safer to also check for __x86_64? That's a good point.

Re: Use POPCNT on MSVC

2021-08-04 Thread John Naylor
On Tue, Aug 3, 2021 at 11:36 PM David Rowley wrote: > > On Tue, 3 Aug 2021 at 22:43, John Naylor wrote: > > 1. the __popcnt64() intrinsic is put inside pg_popcount64_asm(), which is a bit of a misnomer since it's not assembly. Renaming s/_asm/_fast/ would help it look better. But then looking aro

Re: Use POPCNT on MSVC

2021-08-03 Thread David Rowley
On Tue, 3 Aug 2021 at 22:43, John Naylor wrote: > 1. the __popcnt64() intrinsic is put inside pg_popcount64_asm(), which is a > bit of a misnomer since it's not assembly. Renaming s/_asm/_fast/ would help > it look better. But then looking around, other platforms have intrinsics > coded, but fo

Re: Use POPCNT on MSVC

2021-08-03 Thread Thomas Munro
On Tue, Aug 3, 2021 at 10:43 PM John Naylor wrote: > (Side note, but sort of related to #1 above: non-x86 platforms have to > indirect through a function pointer even though they have no fast > implementation to make it worth their while. It would be better for them if > the "slow" implementati

Re: Use POPCNT on MSVC

2021-08-03 Thread John Naylor
On Tue, Aug 3, 2021 at 5:03 AM David Rowley wrote: > > Going by [1], it looks like we can use the __popcnt and __popcnt64 > intrinsic functions on MSVC if the CPU supports POPCNT. We already > have code to check for that, we just need to enable it on MSVC. > > The attached patch seems to be all t