зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1160148: Disable CRT use of FMA3 on non-AVX2 processors. r=froydnj
This commit is contained in:
Родитель
0fadb86c8f
Коммит
b1551721e5
|
@ -11,6 +11,8 @@
|
|||
#endif
|
||||
|
||||
#include "nsUTF8Utils.h"
|
||||
#include <intrin.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifndef XRE_DONT_PROTECT_DLL_LOAD
|
||||
#include "nsSetDllDirectory.h"
|
||||
|
@ -88,6 +90,17 @@ int wmain(int argc, WCHAR **argv)
|
|||
WindowsCrtPatch::Init();
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900 && defined(_M_X64)
|
||||
// Disable CRT use of FMA3 on non-AVX2 processors because of bug 1160148
|
||||
int cpuid0[4] = {0};
|
||||
int cpuid7[4] = {0};
|
||||
__cpuid(cpuid0, 0); // Get the maximum supported CPUID function
|
||||
__cpuid(cpuid7, 7); // AVX2 is function 7, subfunction 0, EBX, bit 5
|
||||
if (cpuid0[0] < 7 || !(cpuid7[1] & 0x20)) {
|
||||
_set_FMA3_enable(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef XRE_DONT_PROTECT_DLL_LOAD
|
||||
mozilla::SanitizeEnvironmentVariables();
|
||||
SetDllDirectoryW(L"");
|
||||
|
|
Загрузка…
Ссылка в новой задаче