From 569d61a4164fe8f3aa8ea4f0ef43ddef65671171 Mon Sep 17 00:00:00 2001 From: Brian Sullivan Date: Thu, 19 Apr 2018 17:03:27 -0700 Subject: [PATCH] Check for retail config for EnableAVX Disable AVX2 when AVX is disabled --- src/jit/compiler.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp index 8f43bcd..3daebc2 100644 --- a/src/jit/compiler.cpp +++ b/src/jit/compiler.cpp @@ -2528,7 +2528,8 @@ static bool configEnableISA(InstructionSet isa) case InstructionSet_AVX: return JitConfig.EnableAVX() != 0; case InstructionSet_AVX2: - return JitConfig.EnableAVX2() != 0; + // Don't enable AVX2 when AVX is disabled + return (JitConfig.EnableAVX() != 0) && (JitConfig.EnableAVX2() != 0); case InstructionSet_AES: return JitConfig.EnableAES() != 0; @@ -2548,7 +2549,15 @@ static bool configEnableISA(InstructionSet isa) return false; } #else - return true; + // We have a retail config switch that can disable AVX/AVX2 instructions + if ((isa == InstructionSet_AVX) || (isa == InstructionSet_AVX2)) + { + return JitConfig.EnableAVX() != 0; + } + else + { + return true; + } #endif } #endif // _TARGET_XARCH_ -- 2.7.4