I have some code that relies on AVX.
In the same code base I also use TZCNT
.
The latter is part of BMI1. I know I can test for this instruction using CPUID, but I'm lazy so I did not actually implement that.
To test for support I simply perform an AVX instruction. If I get a #UD
undefined instruction exception back I know the CPU does not support AVX.
However tzcnt
is backwards compatible (kind of) with the bsf
(or bsr
- I always forget which is which), so that will not trigger an exception.
If I have AVX
support, does that imply BMI1
support?
For the record, I do not have AVX2 on the CPU that I'm testing with right now.