--- old/src/cpu/x86/vm/vm_version_x86.cpp 2015-04-06 14:41:07.712471400 -0700 +++ new/src/cpu/x86/vm/vm_version_x86.cpp 2015-04-06 14:41:07.519452100 -0700 @@ -35,7 +35,7 @@ int VM_Version::_cpu; int VM_Version::_model; int VM_Version::_stepping; -int VM_Version::_cpuFeatures; +uint64_t VM_Version::_cpuFeatures; const char* VM_Version::_features_str = ""; VM_Version::CpuidInfo VM_Version::_cpuid_info = { 0, }; @@ -470,6 +470,29 @@ if (UseSSE < 1) _cpuFeatures &= ~CPU_SSE; + // first try initial setting and detect what we can support + if (UseAVX > 0) { + if (UseAVX > 2 && supports_evex()) { + UseAVX = 3; + } else if (UseAVX > 1 && supports_avx2()) { + UseAVX = 2; + } else if (UseAVX > 0 && supports_avx()) { + UseAVX = 1; + } else { + UseAVX = 0; + } + } else if (UseAVX < 0) { + UseAVX = 0; + } + + if (UseAVX < 3) { + _cpuFeatures &= ~CPU_AVX512F; + _cpuFeatures &= ~CPU_AVX512DQ; + _cpuFeatures &= ~CPU_AVX512CD; + _cpuFeatures &= ~CPU_AVX512BW; + _cpuFeatures &= ~CPU_AVX512VL; + } + if (UseAVX < 2) _cpuFeatures &= ~CPU_AVX2; @@ -485,7 +508,7 @@ } char buf[256]; - jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", + jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", cores_per_cpu(), threads_per_core(), cpu_family(), _model, _stepping, (supports_cmov() ? ", cmov" : ""), @@ -515,7 +538,8 @@ (supports_tscinv() ? ", tscinv": ""), (supports_bmi1() ? ", bmi1" : ""), (supports_bmi2() ? ", bmi2" : ""), - (supports_adx() ? ", adx" : "")); + (supports_adx() ? ", adx" : ""), + (supports_evex() ? ", evex" : "")); _features_str = os::strdup(buf); // UseSSE is set to the smaller of what hardware supports and what @@ -532,13 +556,6 @@ if (!supports_sse ()) // Drop to 0 if no SSE support UseSSE = 0; - if (UseAVX > 2) UseAVX=2; - if (UseAVX < 0) UseAVX=0; - if (!supports_avx2()) // Drop to 1 if no AVX2 support - UseAVX = MIN2((intx)1,UseAVX); - if (!supports_avx ()) // Drop to 0 if no AVX support - UseAVX = 0; - // Use AES instructions if available. if (supports_aes()) { if (FLAG_IS_DEFAULT(UseAES)) { @@ -609,7 +626,8 @@ if ((_model == CPU_MODEL_HASWELL_E3) || (_model == CPU_MODEL_HASWELL_E7 && _stepping < 3) || (_model == CPU_MODEL_BROADWELL && _stepping < 4)) { - if (!UnlockExperimentalVMOptions) { + // currently a collision between SKL and HSW_E3 + if (!UnlockExperimentalVMOptions && UseAVX < 3) { vm_exit_during_initialization("UseRTMLocking is only available as experimental option on this platform. It must be enabled via -XX:+UnlockExperimentalVMOptions flag."); } else { warning("UseRTMLocking is only available as experimental option on this platform."); @@ -662,10 +680,10 @@ if (MaxVectorSize > 0) { if (!is_power_of_2(MaxVectorSize)) { warning("MaxVectorSize must be a power of 2"); - FLAG_SET_DEFAULT(MaxVectorSize, 32); + FLAG_SET_DEFAULT(MaxVectorSize, 64); } - if (MaxVectorSize > 32) { - FLAG_SET_DEFAULT(MaxVectorSize, 32); + if (MaxVectorSize > 64) { + FLAG_SET_DEFAULT(MaxVectorSize, 64); } if (MaxVectorSize > 16 && (UseAVX == 0 || !os_supports_avx_vectors())) { // 32 bytes vectors (in YMM) are only supported with AVX+