x64 intrinsics

x64 intrinsics

Hi,

are there any x64 intrinsics for 64-bit bswap, bsf and bsr which would map directly to processor instructions? Or is there any way to use these instructions directly in my code? I can only see intrinsics for 32-bit int.

Thanks for any advice.

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

If you are trying to use 64-bit instructions in 32-bit code that won't work. If you want to use them in 64-bit code then just append 64 to the intrinsic name. For example _bswap() becomes _bswap64().

-- Regards, Igor Levicki If you find my post helpfull, please rate it and/or select it as a best answer where applies. Thank you.

Thanks for your reply. However, appending "64" seems to work only with _bswap, compiler reports unknown function for both _bit_scan_forward/reverse64.

Here is an excerpt from an old post which you could have found yourself if you bothered to search for "bit test intrinsics":

_BitScanForward
_BitScanReverse
_bittest
_bittestandcomplement
_bittestandreset
_bittestandset
_BitScanForward64
_BitScanReverse64
_bittest64
_bittestandcomplement64
_bittestandreset64
_bittestandset64

As you see the case matters, and there are no underscores in those names. Finally

The definitions of those intrinsics are in the VS2005 header file

.

-- Regards, Igor Levicki If you find my post helpfull, please rate it and/or select it as a best answer where applies. Thank you.

I "bothered" to find this information before posting the question, it was just that i overlooked support for msvc intrinsics. And in intel intrinsics reference, this function is written with underscores. If its so annoying for you to reply, then why do you do it at all...

If its so annoying for you to reply, then why do you do it at all...

Why are people always so sensitive when they receive some constructive criticism?

You asked about x64 intrinsics. To be able to answer your question I had to create test.cpp file, write short test function using _bswap64() and compile it with Intel C/C++ Compiler to verify that _bswap64() is supported.

Then you said that appending 64 doesn't work for all intrinsics. To be able to help you further, I had to search EM64T version of mcpcom.exe for any occurences of "bit", "scan", or "forward", then I realized that the syntax is different and I searched for "bit test intrinsics" here on the forum and found that post.

So basically, you are asking me why it is annoying for me to do your homework? Tell me honestly which part of what I have done you couldn't figure out if you really bothered instead of "bothered" to do a little research on your own?

I like helping people, but I prefer those who are willing to accept clues and who are motivated by someone's help to continue digging on their own instead of waiting for someone to do their work. To paraphrase your question "If its so annoying for you to do a little research on your own, then why do you work as a developer at all..."

Finally, if you have already spotted the inconsistency in the compiler documentation (I wasn't aware of it until you mentioned it), you should have submitted an issue to the Premier Support. Since it is obvious from your overly sensitive reply that you don't care whether someone else will have the same problem in the future, I have submitted an issue (#471766) on your behalf.

-- Regards, Igor Levicki If you find my post helpfull, please rate it and/or select it as a best answer where applies. Thank you.

Leave a Comment

Please sign in to add a comment. Not a member? Join today