1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Recommit "[X86] Calculate the needed size of the feature arrays in _cpu_indicator_init and getHostCPUName using the size of the feature enum."

Hopefully this version will fix the previously buildbot failure
This commit is contained in:
Craig Topper 2020-06-22 13:29:43 -07:00
parent 4b574421cc
commit 23cda02b12
2 changed files with 5 additions and 8 deletions

View File

@ -56,7 +56,7 @@ enum ProcessorFeatures {
#define X86_FEATURE(ENUM) \
ENUM,
#include "llvm/Support/X86TargetParser.def"
CPU_FEATURE_MAX
};
enum CPUKind {

View File

@ -582,7 +582,7 @@ static void detectX86FamilyModel(unsigned EAX, unsigned *Family,
static void
getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
const unsigned (&Features)[3],
const unsigned *Features,
unsigned *Type, unsigned *Subtype) {
auto testFeature = [&](unsigned F) {
return (Features[F / 32] & (1U << (F % 32))) != 0;
@ -910,7 +910,7 @@ getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
}
static void getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model,
const unsigned (&Features)[3],
const unsigned *Features,
unsigned *Type, unsigned *Subtype) {
auto testFeature = [&](unsigned F) {
return (Features[F / 32] & (1U << (F % 32))) != 0;
@ -1012,10 +1012,7 @@ static void getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model,
}
static void getAvailableFeatures(unsigned ECX, unsigned EDX, unsigned MaxLeaf,
unsigned (&Features)[3]) {
Features[0] = 0;
Features[1] = 0;
Features[2] = 0;
unsigned *Features) {
unsigned EAX, EBX;
auto setFeature = [&](unsigned F) {
@ -1157,7 +1154,7 @@ StringRef sys::getHostCPUName() {
getX86CpuIDAndInfo(0x1, &EAX, &EBX, &ECX, &EDX);
unsigned Family = 0, Model = 0;
unsigned Features[3] = {0, 0, 0};
unsigned Features[(X86::CPU_FEATURE_MAX + 31) / 32] = {0};
detectX86FamilyModel(EAX, &Family, &Model);
getAvailableFeatures(ECX, EDX, MaxLeaf, Features);