diff options
Diffstat (limited to 'compiler-rt/lib/builtins/cpu_model.c')
-rw-r--r-- | compiler-rt/lib/builtins/cpu_model.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler-rt/lib/builtins/cpu_model.c b/compiler-rt/lib/builtins/cpu_model.c index cdeb03794ecc..fb619037d398 100644 --- a/compiler-rt/lib/builtins/cpu_model.c +++ b/compiler-rt/lib/builtins/cpu_model.c @@ -471,9 +471,9 @@ static void getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model, break; // "btver2" case 23: *Type = AMDFAM17H; - if (Model >= 0x30 && Model <= 0x3f) { + if ((Model >= 0x30 && Model <= 0x3f) || Model == 0x71) { *Subtype = AMDFAM17H_ZNVER2; - break; // "znver2"; 30h-3fh: Zen2 + break; // "znver2"; 30h-3fh, 71h: Zen2 } if (Model <= 0x0f) { *Subtype = AMDFAM17H_ZNVER1; @@ -532,7 +532,15 @@ static void getAvailableFeatures(unsigned ECX, unsigned EDX, unsigned MaxLeaf, const unsigned AVXBits = (1 << 27) | (1 << 28); bool HasAVX = ((ECX & AVXBits) == AVXBits) && !getX86XCR0(&EAX, &EDX) && ((EAX & 0x6) == 0x6); +#if defined(__APPLE__) + // Darwin lazily saves the AVX512 context on first use: trust that the OS will + // save the AVX512 context if we use AVX512 instructions, even the bit is not + // set right now. + bool HasAVX512Save = true; +#else + // AVX512 requires additional context to be saved by the OS. bool HasAVX512Save = HasAVX && ((EAX & 0xe0) == 0xe0); +#endif if (HasAVX) setFeature(FEATURE_AVX); |