Crafty 25.3 MSVS 2019

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Crafty 25.3 MSVS 2019

Post by bob »

Thanks. Have made the changes and sent to Joshua to confirm under microsoft compiler.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Crafty 25.3 MSVS 2019

Post by bob »

jdart wrote: Thu Sep 12, 2019 5:23 am For MSVC (_MSC_VER defined) you want:

_BitScanForward64, _BitScanReverse64 for LSB, MSB:

https://docs.microsoft.com/en-us/cpp/in ... ew=vs-2019
Those seem to be ugly, returning the result through a pointer passed as an argument. Not so good for me as ALL of my usages of these operations are done as part of an arithmetic expression. Seems like a poor idea to write a wrapper function that is called just to get to a basic hardware instruction...
D Sceviour
Posts: 570
Joined: Mon Jul 20, 2015 5:06 pm

Re: Crafty 25.3 MSVS 2019

Post by D Sceviour »

bob wrote: Sat Sep 14, 2019 8:04 pm
jdart wrote: Thu Sep 12, 2019 5:23 am For MSVC (_MSC_VER defined) you want:

_BitScanForward64, _BitScanReverse64 for LSB, MSB:

https://docs.microsoft.com/en-us/cpp/in ... ew=vs-2019
Those seem to be ugly, returning the result through a pointer passed as an argument. Not so good for me as ALL of my usages of these operations are done as part of an arithmetic expression. Seems like a poor idea to write a wrapper function that is called just to get to a basic hardware instruction...
Hello bob,

If the optimizer is working correctly, it should fill in the bsf/bsr instruction directly. This can be observed when examining the asm output code. I use gcc, but does not msvs 2019 perform the same?
Joost Buijs
Posts: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: Crafty 25.3 MSVS 2019

Post by Joost Buijs »

You can also use:

_lzcnt_u64() and _tzcnt_u64() which are declared in <intrin.h>

uint64_t _lzcnt_u64 (uint64_t b);
uint64_t _tzcnt_u64 (uint64_t b);
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: Crafty 25.3 MSVS 2019

Post by MikeB »

jdart wrote: Tue Sep 10, 2019 3:06 am I think it would be very helpful if this was hosted on a proper version control system such as Github. I know there was some unofficial hosting there but really it should be authorized by Bob. If that is done it is possible to submit patches via pull request. And there is a place to go for the latest code. Just IMO. I did not use version control for many, many years but since starting to, I have found it indispensable.

--JOn
Bob authorized me to host crafty on Github under MichaelB7 - please feel free to summit patches and we'll test it for compatibility. Or send patches directly to Bob an he will send me updates once approved ( prob better idea).

Thanks.
Image
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Crafty 25.3 MSVS 2019

Post by bob »

Mike:

Still working on this. Send me the email you are using and I will send the source code once I finish this cleanup...
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Crafty 25.3 MSVS 2019

Post by bob »

OK, we are still mucking around with this. Joshua is compiling using the latest MSVC stuff. Here's our problem (I don't have a windows box to try this on so am getting compile help.)

We can access __popcnt() with no problems including intrin.h. but we can NOT access __popcnt64(). Apparently the compiler does not recognize that intrinsic, and instead thinks it is an external function, which lets it compile cleanly, but fail when linking the executable.

Is there some compiler option he needs to use to let the compiler know what to do with the 64 bit intrinsics???
Karlo Bala
Posts: 373
Joined: Wed Mar 22, 2006 10:17 am
Location: Novi Sad, Serbia
Full name: Karlo Balla

Re: Crafty 25.3 MSVS 2019

Post by Karlo Bala »

bob wrote: Mon Sep 16, 2019 7:22 pm OK, we are still mucking around with this. Joshua is compiling using the latest MSVC stuff. Here's our problem (I don't have a windows box to try this on so am getting compile help.)

We can access __popcnt() with no problems including intrin.h. but we can NOT access __popcnt64(). Apparently the compiler does not recognize that intrinsic, and instead thinks it is an external function, which lets it compile cleanly, but fail when linking the executable.

Is there some compiler option he needs to use to let the compiler know what to do with the 64 bit intrinsics???
__popcnt64() is available only in a 64-bit mode. Are you sure you compiled sources as a 64-bit application?
Best Regards,
Karlo Balla Jr.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Crafty 25.3 MSVS 2019

Post by bob »

That's the big question. :) I'm not a windows user, and I am not doing these compiles. Can you give me any hints to pass on to Joshua as to what exactly is needed to indicate "this is a 64 bit application"???
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: Crafty 25.3 MSVS 2019

Post by jdart »

MSVC actually has two separate compilers, 32-bit and 64-bit. If using the IDE, open Configuration Manager from the Build menu and select x64 as the platform.

If using the command line, when you install, you get a couple shortcuts for command shells that are setup up with the right compiler and variables. You should search the start menu for "x64 Native Tools Command Prompt" and run that.