core2 popcnt
Moderators: hgm, Rebel, chrisw
-
- Posts: 228
- Joined: Sun Mar 12, 2006 3:11 pm
core2 popcnt
Does the core2 (Yorkfield 45nm) have hardware popcount, or is it only the i7 Nahalem - and later cores?
Re: core2 popcnt
The latter, unfortunately my QX9650 (Yorkfield 45nm) does not have POPCNT. The AMD 10h processor range has POPCNT also.Does the core2 (Yorkfield 45nm) have hardware popcount, or is it only the i7 Nahalem - and later cores?
Re: core2 popcnt
During runtime you can test CPU capabilities using the 'cpuid' instruction:
Code: Select all
get_cpu_caps PROC
mov eax, 01h
cpuid ; ecx=feature info 1, edx=feature info 2
xor eax, eax ; prepare return value
test edx, 1 SHL 0
jz not_fpu
or eax, CPUCAP_FPU
not_fpu:
test edx, 1 SHL 23
... blah blah blah ....
test ecx, 1 SHL 23
jz not_popcnt
or eax, CPUCAP_POPCNT
not_popcnt:
ret
get_cpu_caps ENDP