You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Intel and AMD advertise the presence of LZCNT via (the reuse of?) AMD's old ABM flag and not via BMI1/BMI2.
I think it's safe with a worst case scenario of testing for LZCNT via BMI1 giving you a false negative because I don't think any cpu advertising BMI1 or BMI2 doesn't implement LZCNT. You'll miss older (pre-Excavator, I think) AMD CPUs with ABM but no BMI1/BMI2, but I'm presuming that's fine.
Sorry if this is intentional to avoid any issues with the reuse of ABM - I couldn't find anything in the docs or the code.
Hi @mqudsi, thanks for the issue. As I understand correctly, you are concerned that we don't have the support of LZCNT explicitly and developers should check LZCNT via BMI1/BMI2. I found old processors that don't support BMI1. since leaf 0x07 is empty AuthenticAMD0600F12_K15_Zambezi8C_CPUID and there is the support of ABM. I think it is a good point and we should handle this case. Hence, according to Intel architecture-instruction-set-extensions-programming-reference.pdf P-40, we can get this info via CPUID Fn8000_0001_ECX[5](LZCNT), and according for AMD AMD Cpuid Specification P-20CPUID Fn8000_0001_ECX[5](ABM) as well.
Activity
toor1245 commentedon Jul 20, 2022
Hi @mqudsi, thanks for the issue. As I understand correctly, you are concerned that we don't have the support of LZCNT explicitly and developers should check LZCNT via BMI1/BMI2. I found old processors that don't support BMI1. since leaf 0x07 is empty AuthenticAMD0600F12_K15_Zambezi8C_CPUID and there is the support of ABM. I think it is a good point and we should handle this case. Hence, according to Intel architecture-instruction-set-extensions-programming-reference.pdf P-40, we can get this info via
CPUID Fn8000_0001_ECX[5](LZCNT), and according for AMD AMD Cpuid Specification P-20CPUID Fn8000_0001_ECX[5](ABM)as well.mqudsi commentedon Jul 21, 2022
Yup. Thanks for the fast response and the primary sources.
The first link you shared seems to be broken, though?
toor1245 commentedon Jul 21, 2022
Nope, it works, probably because this link is not safe
I'll send cpuid dump here:
mqudsi commentedon Jul 21, 2022
Thanks. It is indeed a proxy/firewall issue.
mqudsi commentedon Jul 28, 2022
Thanks, @gchatelet. I'm glad you named it LZCNT and not ABM, as ABM can be confusing!
Add detection LZCNT (google#254)