To reproduce bugs like JDK-8256823 on my machine (which supports BMI2), I had to manually disable BMI2 capabilities by overwriting supports_bmi2 (-XX:-UseBMI2Instructions is not sufficient). We should add functionality that allows to selectively disable CPU capabilities. The user of that new functionality would of course need to make sure that the setting exists in actual CPUs.
In addition, we could also support setting arbitrary CPU capabilities (including CPU model, name, ...) but would either need to make sure that the CPU that we execute on does support these feature or make sure that the generated code using these is never executed (this is often good enough to trigger asserts).
I'm initially filing this in hotspot/compiler but it's probably more of a hotspot/runtime enhancement.
In addition, we could also support setting arbitrary CPU capabilities (including CPU model, name, ...) but would either need to make sure that the CPU that we execute on does support these feature or make sure that the generated code using these is never executed (this is often good enough to trigger asserts).
I'm initially filing this in hotspot/compiler but it's probably more of a hotspot/runtime enhancement.