--- old/src/cpu/x86/vm/vm_version_x86.cpp 2017-04-20 13:47:29.207684000 -0700 +++ new/src/cpu/x86/vm/vm_version_x86.cpp 2017-04-20 13:47:28.747638000 -0700 @@ -469,11 +469,12 @@ __ evmovdqul(xmm7, Address(rsp, 0), Assembler::AVX_512bit); __ addptr(rsp, 64); #endif // _WINDOWS + __ vzeroupper(); VM_Version::clean_cpuFeatures(); UseAVX = saved_useavx; UseSSE = saved_usesse; __ jmp(wrapup); - } + } __ bind(legacy_save_restore); // AVX check @@ -498,6 +499,7 @@ __ vmovdqu(xmm7, Address(rsp, 0)); __ addptr(rsp, 32); #endif // _WINDOWS + __ vzeroupper(); VM_Version::clean_cpuFeatures(); UseAVX = saved_useavx; UseSSE = saved_usesse; @@ -619,8 +621,10 @@ if (UseAVX < 2) _features &= ~CPU_AVX2; - if (UseAVX < 1) + if (UseAVX < 1) { _features &= ~CPU_AVX; + _features &= ~CPU_VZEROUPPER; + } if (!UseAES && !FLAG_IS_DEFAULT(UseAES)) _features &= ~CPU_AES; @@ -630,6 +634,14 @@ _features &= ~CPU_HT; } + if( is_intel() ) { // Intel cpus specific settings + if ((cpu_family() == 0x06) && + ((extended_cpu_model() == 0x57) || // Xeon Phi 3200/5200/7200 + (extended_cpu_model() == 0x85))) { // Future Xeon Phi + _features &= ~CPU_VZEROUPPER; + } + } + 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%s%s%s", cores_per_cpu(), threads_per_core(), @@ -918,16 +930,36 @@ warning("MaxVectorSize must be a power of 2"); FLAG_SET_DEFAULT(MaxVectorSize, 64); } - if (MaxVectorSize > 64) { - FLAG_SET_DEFAULT(MaxVectorSize, 64); + if (UseSSE < 2) { + // Vectors (in XMM) are only supported with SSE2+ + if (MaxVectorSize > 0) { + if (!FLAG_IS_DEFAULT(MaxVectorSize)) + warning("MaxVectorSize must be 0"); + FLAG_SET_DEFAULT(MaxVectorSize, 0); + } } - if (MaxVectorSize > 16 && (UseAVX == 0 || !os_supports_avx_vectors())) { + else if (UseAVX == 0 || !os_supports_avx_vectors()) { // 32 bytes vectors (in YMM) are only supported with AVX+ - FLAG_SET_DEFAULT(MaxVectorSize, 16); + if (MaxVectorSize > 16) { + if (!FLAG_IS_DEFAULT(MaxVectorSize)) + warning("MaxVectorSize must be <= 16"); + FLAG_SET_DEFAULT(MaxVectorSize, 16); + } } - if (UseSSE < 2) { - // Vectors (in XMM) are only supported with SSE2+ - FLAG_SET_DEFAULT(MaxVectorSize, 0); + else if (UseAVX == 1 || UseAVX == 2) { + // 64 bytes vectors (in ZMM) are only supported with AVX 3 + if (MaxVectorSize > 32) { + if (!FLAG_IS_DEFAULT(MaxVectorSize)) + warning("MaxVectorSize must be <= 32"); + FLAG_SET_DEFAULT(MaxVectorSize, 32); + } + } + else if (UseAVX > 2 ) { + if (MaxVectorSize > 64) { + if (!FLAG_IS_DEFAULT(MaxVectorSize)) + warning("MaxVectorSize must be <= 64"); + FLAG_SET_DEFAULT(MaxVectorSize, 64); + } } #if defined(COMPILER2) && defined(ASSERT) if (supports_avx() && PrintMiscellaneous && Verbose && TraceNewVectors) {