@@ -48,6 +48,14 @@ class FeatureBitset {
48
48
return (Bits[I / 32 ] & Mask) != 0 ;
49
49
}
50
50
51
+ constexpr FeatureBitset &operator &=(const FeatureBitset &RHS) {
52
+ for (unsigned I = 0 , E = array_lengthof (Bits); I != E; ++I) {
53
+ uint32_t NewBits = Bits[I] & RHS.Bits [I];
54
+ Bits[I] = NewBits;
55
+ }
56
+ return *this ;
57
+ }
58
+
51
59
constexpr FeatureBitset &operator |=(const FeatureBitset &RHS) {
52
60
for (unsigned I = 0 , E = array_lengthof (Bits); I != E; ++I) {
53
61
uint32_t NewBits = Bits[I] | RHS.Bits [I];
@@ -57,16 +65,14 @@ class FeatureBitset {
57
65
}
58
66
59
67
constexpr FeatureBitset operator &(const FeatureBitset &RHS) const {
60
- FeatureBitset Result;
61
- for (unsigned I = 0 , E = array_lengthof (Bits); I != E; ++I)
62
- Result.Bits [I] = Bits[I] & RHS.Bits [I];
68
+ FeatureBitset Result = *this ;
69
+ Result &= RHS;
63
70
return Result;
64
71
}
65
72
66
73
constexpr FeatureBitset operator |(const FeatureBitset &RHS) const {
67
- FeatureBitset Result;
68
- for (unsigned I = 0 , E = array_lengthof (Bits); I != E; ++I)
69
- Result.Bits [I] = Bits[I] | RHS.Bits [I];
74
+ FeatureBitset Result = *this ;
75
+ Result |= RHS;
70
76
return Result;
71
77
}
72
78
@@ -111,10 +117,10 @@ static constexpr FeatureBitset FeaturesPentium4 =
111
117
static constexpr FeatureBitset FeaturesPrescott =
112
118
FeaturesPentium4 | FeatureSSE3;
113
119
static constexpr FeatureBitset FeaturesNocona =
114
- FeaturesPrescott | FeatureEM64T | FeatureCMPXCHG16B;
120
+ FeaturesPrescott | Feature64BIT | FeatureCMPXCHG16B;
115
121
116
122
// Basic 64-bit capable CPU.
117
- static constexpr FeatureBitset FeaturesX86_64 = FeaturesPentium4 | FeatureEM64T ;
123
+ static constexpr FeatureBitset FeaturesX86_64 = FeaturesPentium4 | Feature64BIT ;
118
124
119
125
// Intel Core CPUs
120
126
static constexpr FeatureBitset FeaturesCore2 =
@@ -201,15 +207,15 @@ static constexpr FeatureBitset FeaturesAthlon =
201
207
static constexpr FeatureBitset FeaturesAthlonXP =
202
208
FeaturesAthlon | FeatureFXSR | FeatureSSE;
203
209
static constexpr FeatureBitset FeaturesK8 =
204
- FeaturesAthlonXP | FeatureSSE2 | FeatureEM64T ;
210
+ FeaturesAthlonXP | FeatureSSE2 | Feature64BIT ;
205
211
static constexpr FeatureBitset FeaturesK8SSE3 = FeaturesK8 | FeatureSSE3;
206
212
static constexpr FeatureBitset FeaturesAMDFAM10 =
207
213
FeaturesK8SSE3 | FeatureCMPXCHG16B | FeatureLZCNT | FeaturePOPCNT |
208
214
FeaturePRFCHW | FeatureSAHF | FeatureSSE4_A;
209
215
210
216
// Bobcat architecture processors.
211
217
static constexpr FeatureBitset FeaturesBTVER1 =
212
- FeatureX87 | FeatureCMPXCHG8B | FeatureCMPXCHG16B | FeatureEM64T |
218
+ FeatureX87 | FeatureCMPXCHG8B | FeatureCMPXCHG16B | Feature64BIT |
213
219
FeatureFXSR | FeatureLZCNT | FeatureMMX | FeaturePOPCNT | FeaturePRFCHW |
214
220
FeatureSSE | FeatureSSE2 | FeatureSSE3 | FeatureSSSE3 | FeatureSSE4_A |
215
221
FeatureSAHF;
@@ -220,7 +226,7 @@ static constexpr FeatureBitset FeaturesBTVER2 =
220
226
// AMD Bulldozer architecture processors.
221
227
static constexpr FeatureBitset FeaturesBDVER1 =
222
228
FeatureX87 | FeatureAES | FeatureAVX | FeatureCMPXCHG8B |
223
- FeatureCMPXCHG16B | FeatureEM64T | FeatureFMA4 | FeatureFXSR | FeatureLWP |
229
+ FeatureCMPXCHG16B | Feature64BIT | FeatureFMA4 | FeatureFXSR | FeatureLWP |
224
230
FeatureLZCNT | FeatureMMX | FeaturePCLMUL | FeaturePOPCNT | FeaturePRFCHW |
225
231
FeatureSAHF | FeatureSSE | FeatureSSE2 | FeatureSSE3 | FeatureSSSE3 |
226
232
FeatureSSE4_1 | FeatureSSE4_2 | FeatureSSE4_A | FeatureXOP | FeatureXSAVE;
@@ -236,7 +242,7 @@ static constexpr FeatureBitset FeaturesBDVER4 =
236
242
static constexpr FeatureBitset FeaturesZNVER1 =
237
243
FeatureX87 | FeatureADX | FeatureAES | FeatureAVX | FeatureAVX2 |
238
244
FeatureBMI | FeatureBMI2 | FeatureCLFLUSHOPT | FeatureCLZERO |
239
- FeatureCMPXCHG8B | FeatureCMPXCHG16B | FeatureEM64T | FeatureF16C |
245
+ FeatureCMPXCHG8B | FeatureCMPXCHG16B | Feature64BIT | FeatureF16C |
240
246
FeatureFMA | FeatureFSGSBASE | FeatureFXSR | FeatureLZCNT | FeatureMMX |
241
247
FeatureMOVBE | FeatureMWAITX | FeaturePCLMUL | FeaturePOPCNT |
242
248
FeaturePRFCHW | FeatureRDRND | FeatureRDSEED | FeatureSAHF | FeatureSHA |
@@ -363,7 +369,7 @@ static constexpr ProcInfo Processors[] = {
363
369
364
370
X86::CPUKind llvm::X86::parseArchX86 (StringRef CPU, bool Only64Bit) {
365
371
for (const auto &P : Processors)
366
- if (P.Name == CPU && (P.Features [FEATURE_EM64T ] || !Only64Bit))
372
+ if (P.Name == CPU && (P.Features [FEATURE_64BIT ] || !Only64Bit))
367
373
return P.Kind ;
368
374
369
375
return CK_None;
@@ -372,7 +378,7 @@ X86::CPUKind llvm::X86::parseArchX86(StringRef CPU, bool Only64Bit) {
372
378
void llvm::X86::fillValidCPUArchList (SmallVectorImpl<StringRef> &Values,
373
379
bool Only64Bit) {
374
380
for (const auto &P : Processors)
375
- if (!P.Name .empty () && (P.Features [FEATURE_EM64T ] || !Only64Bit))
381
+ if (!P.Name .empty () && (P.Features [FEATURE_64BIT ] || !Only64Bit))
376
382
Values.emplace_back (P.Name );
377
383
}
378
384
@@ -401,7 +407,6 @@ static constexpr FeatureBitset ImpliedFeaturesCLZERO = {};
401
407
static constexpr FeatureBitset ImpliedFeaturesCMOV = {};
402
408
static constexpr FeatureBitset ImpliedFeaturesCMPXCHG16B = {};
403
409
static constexpr FeatureBitset ImpliedFeaturesCMPXCHG8B = {};
404
- static constexpr FeatureBitset ImpliedFeaturesEM64T = {};
405
410
static constexpr FeatureBitset ImpliedFeaturesENQCMD = {};
406
411
static constexpr FeatureBitset ImpliedFeaturesFSGSBASE = {};
407
412
static constexpr FeatureBitset ImpliedFeaturesFXSR = {};
@@ -528,8 +533,14 @@ void llvm::X86::getFeaturesForCPU(StringRef CPU,
528
533
[&](const ProcInfo &P) { return P.Name == CPU; });
529
534
assert (I != std::end (Processors) && " Processor not found!" );
530
535
536
+ FeatureBitset Bits = I->Features ;
537
+
538
+ // Remove the 64-bit feature which we only use to validate if a CPU can
539
+ // be used with 64-bit mode.
540
+ Bits &= ~Feature64BIT;
541
+
531
542
// Add the string version of all set bits.
532
- getFeatureBitsAsStrings (I-> Features , EnabledFeatures);
543
+ getFeatureBitsAsStrings (Bits , EnabledFeatures);
533
544
}
534
545
535
546
// For each feature that is (transitively) implied by this feature, set it.
0 commit comments