@@ -1246,6 +1246,12 @@ raw_ostream &operator <<(raw_ostream &OS, AMDGPUOperand::Modifiers Mods) {
1246
1246
// AsmParser
1247
1247
// ===----------------------------------------------------------------------===//
1248
1248
1249
+ // TODO: define GET_SUBTARGET_FEATURE_NAME
1250
+ #define GET_REGISTER_MATCHER
1251
+ #include " AMDGPUGenAsmMatcher.inc"
1252
+ #undef GET_REGISTER_MATCHER
1253
+ #undef GET_SUBTARGET_FEATURE_NAME
1254
+
1249
1255
// Holds info related to the current kernel, e.g. count of SGPRs used.
1250
1256
// Kernel scope begins at .amdgpu_hsa_kernel directive, ends at next
1251
1257
// .amdgpu_hsa_kernel or at EOF.
@@ -1536,6 +1542,10 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
1536
1542
return AMDGPU::isGFX10_BEncoding (getSTI ());
1537
1543
}
1538
1544
1545
+ bool isWave32 () const { return getAvailableFeatures ()[Feature_isWave32Bit]; }
1546
+
1547
+ bool isWave64 () const { return getAvailableFeatures ()[Feature_isWave64Bit]; }
1548
+
1539
1549
bool hasInv2PiInlineImm () const {
1540
1550
return getFeatureBits ()[AMDGPU::FeatureInv2PiInlineImm];
1541
1551
}
@@ -1603,6 +1613,8 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
1603
1613
return &MII;
1604
1614
}
1605
1615
1616
+ // FIXME: This should not be used. Instead, should use queries derived from
1617
+ // getAvailableFeatures().
1606
1618
const FeatureBitset &getFeatureBits () const {
1607
1619
return getSTI ().getFeatureBits ();
1608
1620
}
@@ -2259,9 +2271,8 @@ bool AMDGPUOperand::isSDWAInt32Operand() const {
2259
2271
}
2260
2272
2261
2273
bool AMDGPUOperand::isBoolReg () const {
2262
- auto FB = AsmParser->getFeatureBits ();
2263
- return isReg () && ((FB[AMDGPU::FeatureWavefrontSize64] && isSCSrc_b64 ()) ||
2264
- (FB[AMDGPU::FeatureWavefrontSize32] && isSCSrc_b32 ()));
2274
+ return isReg () && ((AsmParser->isWave64 () && isSCSrc_b64 ()) ||
2275
+ (AsmParser->isWave32 () && isSCSrc_b32 ()));
2265
2276
}
2266
2277
2267
2278
uint64_t AMDGPUOperand::applyInputFPModifiers (uint64_t Val, unsigned Size) const
@@ -5025,9 +5036,8 @@ bool AMDGPUAsmParser::validateDPP(const MCInst &Inst,
5025
5036
5026
5037
// Check if VCC register matches wavefront size
5027
5038
bool AMDGPUAsmParser::validateVccOperand (MCRegister Reg) const {
5028
- auto FB = getFeatureBits ();
5029
- return (FB[AMDGPU::FeatureWavefrontSize64] && Reg == AMDGPU::VCC) ||
5030
- (FB[AMDGPU::FeatureWavefrontSize32] && Reg == AMDGPU::VCC_LO);
5039
+ return (Reg == AMDGPU::VCC && isWave64 ()) ||
5040
+ (Reg == AMDGPU::VCC_LO && isWave32 ());
5031
5041
}
5032
5042
5033
5043
// One unique literal can be used. VOP3 literal is only allowed in GFX10+
@@ -5717,7 +5727,7 @@ bool AMDGPUAsmParser::checkUnsupportedInstruction(StringRef Mnemo,
5717
5727
// Check if this instruction may be used with a different wavesize.
5718
5728
if (isGFX10Plus () && getFeatureBits ()[AMDGPU::FeatureWavefrontSize64] &&
5719
5729
!getFeatureBits ()[AMDGPU::FeatureWavefrontSize32]) {
5720
-
5730
+ // FIXME: Use getAvailableFeatures, and do not manually recompute
5721
5731
FeatureBitset FeaturesWS32 = getFeatureBits ();
5722
5732
FeaturesWS32.flip (AMDGPU::FeatureWavefrontSize64)
5723
5733
.flip (AMDGPU::FeatureWavefrontSize32);
@@ -6472,10 +6482,10 @@ bool AMDGPUAsmParser::ParseAMDKernelCodeTValue(StringRef ID,
6472
6482
if (C.code_properties & AMD_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32) {
6473
6483
if (!isGFX10Plus ())
6474
6484
return TokError (" enable_wavefront_size32=1 is only allowed on GFX10+" );
6475
- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize32] )
6485
+ if (!isWave32 () )
6476
6486
return TokError (" enable_wavefront_size32=1 requires +WavefrontSize32" );
6477
6487
} else {
6478
- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize64] )
6488
+ if (!isWave64 () )
6479
6489
return TokError (" enable_wavefront_size32=0 requires +WavefrontSize64" );
6480
6490
}
6481
6491
}
@@ -6484,10 +6494,10 @@ bool AMDGPUAsmParser::ParseAMDKernelCodeTValue(StringRef ID,
6484
6494
if (C.wavefront_size == 5 ) {
6485
6495
if (!isGFX10Plus ())
6486
6496
return TokError (" wavefront_size=5 is only allowed on GFX10+" );
6487
- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize32] )
6497
+ if (!isWave32 () )
6488
6498
return TokError (" wavefront_size=5 requires +WavefrontSize32" );
6489
6499
} else if (C.wavefront_size == 6 ) {
6490
- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize64] )
6500
+ if (!isWave64 () )
6491
6501
return TokError (" wavefront_size=6 requires +WavefrontSize64" );
6492
6502
}
6493
6503
}
@@ -10390,7 +10400,6 @@ LLVMInitializeAMDGPUAsmParser() {
10390
10400
RegisterMCAsmParser<AMDGPUAsmParser> B (getTheGCNTarget ());
10391
10401
}
10392
10402
10393
- #define GET_REGISTER_MATCHER
10394
10403
#define GET_MATCHER_IMPLEMENTATION
10395
10404
#define GET_MNEMONIC_SPELL_CHECKER
10396
10405
#define GET_MNEMONIC_CHECKER
0 commit comments