JDK-8059139 : It should be possible to explicitly disable usage of TZCNT instr w/ -XX:-UseBMI1Instructions
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8u40,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-09-25
  • Updated: 2015-06-03
  • Resolved: 2014-10-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u40Fixed 9 b40Fixed
Related Reports
Relates :  
Description
Before JDK-8055494 it was possible to disable usage of all BMI1-related instructions by passing -XX:-UseBMI1Instructions to JVM, but fix for JDK-8055494 made it impossible to disable usage of TZCNT.

TZCNT is part of BMI1 instruction set, so it should be possible to explicitly disable its usage via -XX:-UseBMI1Instuctions passed to JVM.
Comments
noreg-sqe: existing test compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java
17-10-2014

Rise priority because test failed.
10-10-2014

I thought we fixed this already! I sent fix 2 weeks ago!
10-10-2014

ILW=improve flag, for development, none=LLH=P5
29-09-2014

Here is reply from Vladimir ([~kvn]): The problem is BMI1 instructions, except tzcnt, require VEX encoding which we generate only when AVX is enabled. But TZCNT does not requires VEX encoding. The only thing 8055494 changed is how UseCountTrailingZerosInstruction is set. We want to be able to use TZCNT when AVX is not set. But we can disable TZCNT with -UseBMI1Instructions on command line with next change: src/cpu/x86/vm/vm_version_x86.cpp @@ -865,14 +865,19 @@ if (supports_bmi1()) { // tzcnt does not require VEX prefix if (FLAG_IS_DEFAULT(UseCountTrailingZerosInstruction)) { - UseCountTrailingZerosInstruction = true; + if (!UseBMI1Instructions && !FLAG_IS_DEFAULT(UseBMI1Instructions)) { + // Don't use tzcnt if BMI1 is switched off on command line. + UseCountTrailingZerosInstruction = false; + } else { + UseCountTrailingZerosInstruction = true; + } } } else if (UseCountTrailingZerosInstruction) { warning("tzcnt instruction is not available on this CPU"); FLAG_SET_DEFAULT(UseCountTrailingZerosInstruction, false); } - // BMI instructions use an encoding with VEX prefix. + // BMI instructions (except tzcnt) use an encoding with VEX prefix. // VEX prefix is generated only when AVX > 0. if (supports_bmi1() && supports_avx()) { if (FLAG_IS_DEFAULT(UseBMI1Instructions)) {
25-09-2014