Page 3 of 4

Re: Crafty 25.3 MSVS 2019

Posted: Thu Sep 12, 2019 4:06 am
by bob
Thanks. Have made the changes and sent to Joshua to confirm under microsoft compiler.

Re: Crafty 25.3 MSVS 2019

Posted: Sat Sep 14, 2019 6:04 pm
by bob
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...

Re: Crafty 25.3 MSVS 2019

Posted: Sat Sep 14, 2019 7:42 pm
by D Sceviour
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?

Re: Crafty 25.3 MSVS 2019

Posted: Sun Sep 15, 2019 4:34 am
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);

Re: Crafty 25.3 MSVS 2019

Posted: Sun Sep 15, 2019 4:54 am
by MikeB
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.

Re: Crafty 25.3 MSVS 2019

Posted: Sun Sep 15, 2019 4:20 pm
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...

Re: Crafty 25.3 MSVS 2019

Posted: Mon Sep 16, 2019 5:22 pm
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???

Re: Crafty 25.3 MSVS 2019

Posted: Mon Sep 16, 2019 10:59 pm
by Karlo Bala
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?

Re: Crafty 25.3 MSVS 2019

Posted: Tue Sep 17, 2019 4:54 am
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"???

Re: Crafty 25.3 MSVS 2019

Posted: Tue Sep 17, 2019 3:05 pm
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.