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 } |