This works only when the behavior of all versions are known, and they
can be differentiated by software tests.
Since it is difficult to predict which undocumented behavior(s) would
be present in a future chip, it cannot, in general, allow for future
chips, except in the special case where the "test" encompasses *exactly*
the behavior that the exploiting code uses (no more, no less).
Modern programming practice does allow for code (and even algorithms)
tailored to specific processor levels, but only when there is a method
for differentiating implementations that is architectural, and therefore
sanctioned by the manufacturer(s). Of course, most compilers don't
offer support for this, except in some embedded environments.