Crafty 25.3 MSVS 2019

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
bob
Posts: 20478
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: Crafty 25.3 MSVS 2019

Post by bob » Thu Sep 12, 2019 4:06 am

Thanks. Have made the changes and sent to Joshua to confirm under microsoft compiler.

bob
Posts: 20478
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: Crafty 25.3 MSVS 2019

Post by bob » Sat Sep 14, 2019 6:04 pm

jdart wrote:
Thu Sep 12, 2019 3: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: 449
Joined: Mon Jul 20, 2015 3:06 pm
Contact:

Re: Crafty 25.3 MSVS 2019

Post by D Sceviour » Sat Sep 14, 2019 7:42 pm

bob wrote:
Sat Sep 14, 2019 6:04 pm
jdart wrote:
Thu Sep 12, 2019 3: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: 960
Joined: Thu Jul 16, 2009 8:47 am
Location: Almere, The Netherlands

Re: Crafty 25.3 MSVS 2019

Post by Joost Buijs » Sun Sep 15, 2019 4:34 am

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);

MikeB
Posts: 3393
Joined: Thu Mar 09, 2006 5:34 am
Location: Pen Argyl, Pennsylvania

Re: Crafty 25.3 MSVS 2019

Post by MikeB » Sun Sep 15, 2019 4:54 am

jdart wrote:
Tue Sep 10, 2019 1: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.

bob
Posts: 20478
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: Crafty 25.3 MSVS 2019

Post by bob » Sun Sep 15, 2019 4:20 pm

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: 20478
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: Crafty 25.3 MSVS 2019

Post by bob » Mon Sep 16, 2019 5: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???

Karlo Bala
Posts: 301
Joined: Wed Mar 22, 2006 9:17 am
Location: Novi Sad, Serbia

Re: Crafty 25.3 MSVS 2019

Post by Karlo Bala » Mon Sep 16, 2019 10:59 pm

bob wrote:
Mon Sep 16, 2019 5: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: 20478
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: Crafty 25.3 MSVS 2019

Post by bob » Tue Sep 17, 2019 4:54 am

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: 3817
Joined: Fri Mar 10, 2006 4:23 am
Location: http://www.arasanchess.org

Re: Crafty 25.3 MSVS 2019

Post by jdart » Tue Sep 17, 2019 3:05 pm

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.

Post Reply