diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp index d7af1a7af7041f..005f0dad2226ca 100644 --- a/src/coreclr/vm/codeman.cpp +++ b/src/coreclr/vm/codeman.cpp @@ -1539,7 +1539,15 @@ void EEJitManager::SetCpuInfo() // x86-64-v3 - if (((cpuFeatures & XArchIntrinsicConstants_Avx) != 0) && CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableAVX)) + bool enableAVX = ((cpuFeatures & XArchIntrinsicConstants_Avx) != 0) && CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableAVX); + +#if defined(FEATURE_INTERPRETER) + // The interpreter only supports 128-bit vectors, so don't enable AVX. The ISA + // dependency normalization below then removes the dependent AVX2/AVX512. + enableAVX = enableAVX && !interpreterOnly; +#endif + + if (enableAVX) { CPUCompileFlags.Set(InstructionSet_AVX); } @@ -1883,6 +1891,15 @@ void EEJitManager::SetCpuInfo() preferredVectorBitWidth = 256; } +#if defined(FEATURE_INTERPRETER) + if (interpreterOnly && (preferredVectorBitWidth > 128)) + { + // Limit the preferred vector width so the Vector256/Vector512 marker ISAs + // set below are not reported after AVX was left disabled above. + preferredVectorBitWidth = 128; + } +#endif + if (preferredVectorBitWidth >= 512) { CPUCompileFlags.Set(InstructionSet_Vector512);