Author: Omid David Tabibi
Date: 20:14:12 02/02/04
Go up one level in this thread
On February 02, 2004 at 22:41:19, Robert Hyatt wrote:
>On February 02, 2004 at 20:06:29, David Rasmussen wrote:
>
>>Does the Opteron have firstBit, lastBit and popCount instructions? Or at least
>>something that makes calculating them easier than on x86-32?
>>
>>/David
>
>
>Has the same BSF/BSR instructions, but no popcnt that I have found. Note
>that BSF/BSR work on 64 bit values if you want. I have inline asm to do
>all three for gcc if you are interested.
Currently, my only critical assembly parts are the following:
__forceinline UINT32 findFirstBitTrue(UINT32 data) {
__asm bsf eax, dword ptr[data]
};
__forceinline UINT32 countBitsTrue(UINT32 data) {
__asm {
mov ecx, dword ptr data
xor eax, eax
test ecx, ecx
jz l1
l0: lea edx, [ecx-1]
inc eax
and ecx, edx
jnz l0
l1:
}
}
If migrating to 64 bit, I can replace my popcount with:
__forceinline UINT32 countBitsTrue(UINT32 data) {
UINT32 count = 0;
while (data) {
count++;
data &= data - 1;
};
return count;
};
But any replacement for findFirstBitTrue on 32 bit data in Opteron?
The efficiency of findFirstBitTrue on 32 bit data is very important for me, as
it is used very heavily throughout the program.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.