Bug 1110570: AVX instructions should be emitted only if XSAVE is enabled by the OS; r=sunfish

If the XSAVE functionality is disabled by the OS (which can happen in
virtualized environments, for instance), AVX instructions shouldn't be emitted
by the JITs. See also the assembly rountines for both x86 and x64 at
https://software.intel.com/en-us/blogs/2011/04/14/is-avx-enabled/

--HG--
extra : rebase_source : 9008ada71bfc33283578197e0257b30533c650b2
extra : amend_source : 5a796ac9d53b9104a19a7c2354c6201e3c77028d
This commit is contained in:
Benjamin Bouvier 2014-12-12 15:33:15 +01:00
parent 475547d1ef
commit 2735c5b8fc

View File

@ -200,5 +200,6 @@ CPUInfo::SetSSEVersion()
maxSSEVersion = Min(maxSSEVersion, maxEnabledSSEVersion);
static const int AVXBit = 1 << 28;
avxPresent = (flagsECX & AVXBit) && avxEnabled;
static const int XSAVEBit = 1 << 27;
avxPresent = (flagsECX & AVXBit) && (flagsECX & XSAVEBit) && avxEnabled;
}