comparison src/cpu/x86/vm/vm_version_x86.cpp @ 20555:e48395e6a91b

8059139: It should be possible to explicitly disable usage of TZCNT instr w/ -XX:-UseBMI1Instructions Reviewed-by: iveresov
author kvn
date Fri, 17 Oct 2014 15:35:25 -0700
parents 166d744df0de
children 7848fc12602b daaf806995b3
comparison
equal deleted inserted replaced
20554:af6ff94a005d 20555:e48395e6a91b
871 871
872 // Use count trailing zeros instruction if available 872 // Use count trailing zeros instruction if available
873 if (supports_bmi1()) { 873 if (supports_bmi1()) {
874 // tzcnt does not require VEX prefix 874 // tzcnt does not require VEX prefix
875 if (FLAG_IS_DEFAULT(UseCountTrailingZerosInstruction)) { 875 if (FLAG_IS_DEFAULT(UseCountTrailingZerosInstruction)) {
876 UseCountTrailingZerosInstruction = true; 876 if (!UseBMI1Instructions && !FLAG_IS_DEFAULT(UseBMI1Instructions)) {
877 // Don't use tzcnt if BMI1 is switched off on command line.
878 UseCountTrailingZerosInstruction = false;
879 } else {
880 UseCountTrailingZerosInstruction = true;
881 }
877 } 882 }
878 } else if (UseCountTrailingZerosInstruction) { 883 } else if (UseCountTrailingZerosInstruction) {
879 warning("tzcnt instruction is not available on this CPU"); 884 warning("tzcnt instruction is not available on this CPU");
880 FLAG_SET_DEFAULT(UseCountTrailingZerosInstruction, false); 885 FLAG_SET_DEFAULT(UseCountTrailingZerosInstruction, false);
881 } 886 }
882 887
883 // BMI instructions use an encoding with VEX prefix. 888 // BMI instructions (except tzcnt) use an encoding with VEX prefix.
884 // VEX prefix is generated only when AVX > 0. 889 // VEX prefix is generated only when AVX > 0.
885 if (supports_bmi1() && supports_avx()) { 890 if (supports_bmi1() && supports_avx()) {
886 if (FLAG_IS_DEFAULT(UseBMI1Instructions)) { 891 if (FLAG_IS_DEFAULT(UseBMI1Instructions)) {
887 UseBMI1Instructions = true; 892 UseBMI1Instructions = true;
888 } 893 }