@@ -1247,6 +1247,12 @@ raw_ostream &operator <<(raw_ostream &OS, AMDGPUOperand::Modifiers Mods) {
1247
1247
// AsmParser
1248
1248
// ===----------------------------------------------------------------------===//
1249
1249
1250
+ // TODO: define GET_SUBTARGET_FEATURE_NAME
1251
+ #define GET_REGISTER_MATCHER
1252
+ #include " AMDGPUGenAsmMatcher.inc"
1253
+ #undef GET_REGISTER_MATCHER
1254
+ #undef GET_SUBTARGET_FEATURE_NAME
1255
+
1250
1256
// Holds info related to the current kernel, e.g. count of SGPRs used.
1251
1257
// Kernel scope begins at .amdgpu_hsa_kernel directive, ends at next
1252
1258
// .amdgpu_hsa_kernel or at EOF.
@@ -1537,6 +1543,10 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
1537
1543
return AMDGPU::isGFX10_BEncoding (getSTI ());
1538
1544
}
1539
1545
1546
+ bool isWave32 () const { return getAvailableFeatures ()[Feature_isWave32Bit]; }
1547
+
1548
+ bool isWave64 () const { return getAvailableFeatures ()[Feature_isWave64Bit]; }
1549
+
1540
1550
bool hasInv2PiInlineImm () const {
1541
1551
return getFeatureBits ()[AMDGPU::FeatureInv2PiInlineImm];
1542
1552
}
@@ -1600,6 +1610,8 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
1600
1610
return &MII;
1601
1611
}
1602
1612
1613
+ // FIXME: This should not be used. Instead, should use queries derived from
1614
+ // getAvailableFeatures().
1603
1615
const FeatureBitset &getFeatureBits () const {
1604
1616
return getSTI ().getFeatureBits ();
1605
1617
}
@@ -2256,9 +2268,8 @@ bool AMDGPUOperand::isSDWAInt32Operand() const {
2256
2268
}
2257
2269
2258
2270
bool AMDGPUOperand::isBoolReg () const {
2259
- auto FB = AsmParser->getFeatureBits ();
2260
- return isReg () && ((FB[AMDGPU::FeatureWavefrontSize64] && isSCSrc_b64 ()) ||
2261
- (FB[AMDGPU::FeatureWavefrontSize32] && isSCSrc_b32 ()));
2271
+ return isReg () && ((AsmParser->isWave64 () && isSCSrc_b64 ()) ||
2272
+ (AsmParser->isWave32 () && isSCSrc_b32 ()));
2262
2273
}
2263
2274
2264
2275
uint64_t AMDGPUOperand::applyInputFPModifiers (uint64_t Val, unsigned Size) const
@@ -4977,9 +4988,8 @@ bool AMDGPUAsmParser::validateDPP(const MCInst &Inst,
4977
4988
4978
4989
// Check if VCC register matches wavefront size
4979
4990
bool AMDGPUAsmParser::validateVccOperand (MCRegister Reg) const {
4980
- auto FB = getFeatureBits ();
4981
- return (FB[AMDGPU::FeatureWavefrontSize64] && Reg == AMDGPU::VCC) ||
4982
- (FB[AMDGPU::FeatureWavefrontSize32] && Reg == AMDGPU::VCC_LO);
4991
+ return (Reg == AMDGPU::VCC && isWave64 ()) ||
4992
+ (Reg == AMDGPU::VCC_LO && isWave32 ());
4983
4993
}
4984
4994
4985
4995
// One unique literal can be used. VOP3 literal is only allowed in GFX10+
@@ -5663,7 +5673,7 @@ bool AMDGPUAsmParser::checkUnsupportedInstruction(StringRef Mnemo,
5663
5673
// Check if this instruction may be used with a different wavesize.
5664
5674
if (isGFX10Plus () && getFeatureBits ()[AMDGPU::FeatureWavefrontSize64] &&
5665
5675
!getFeatureBits ()[AMDGPU::FeatureWavefrontSize32]) {
5666
-
5676
+ // FIXME: Use getAvailableFeatures, and do not manually recompute
5667
5677
FeatureBitset FeaturesWS32 = getFeatureBits ();
5668
5678
FeaturesWS32.flip (AMDGPU::FeatureWavefrontSize64)
5669
5679
.flip (AMDGPU::FeatureWavefrontSize32);
@@ -6418,10 +6428,10 @@ bool AMDGPUAsmParser::ParseAMDKernelCodeTValue(StringRef ID,
6418
6428
if (C.code_properties & AMD_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32) {
6419
6429
if (!isGFX10Plus ())
6420
6430
return TokError (" enable_wavefront_size32=1 is only allowed on GFX10+" );
6421
- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize32] )
6431
+ if (!isWave32 () )
6422
6432
return TokError (" enable_wavefront_size32=1 requires +WavefrontSize32" );
6423
6433
} else {
6424
- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize64] )
6434
+ if (!isWave64 () )
6425
6435
return TokError (" enable_wavefront_size32=0 requires +WavefrontSize64" );
6426
6436
}
6427
6437
}
@@ -6430,10 +6440,10 @@ bool AMDGPUAsmParser::ParseAMDKernelCodeTValue(StringRef ID,
6430
6440
if (C.wavefront_size == 5 ) {
6431
6441
if (!isGFX10Plus ())
6432
6442
return TokError (" wavefront_size=5 is only allowed on GFX10+" );
6433
- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize32] )
6443
+ if (!isWave32 () )
6434
6444
return TokError (" wavefront_size=5 requires +WavefrontSize32" );
6435
6445
} else if (C.wavefront_size == 6 ) {
6436
- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize64] )
6446
+ if (!isWave64 () )
6437
6447
return TokError (" wavefront_size=6 requires +WavefrontSize64" );
6438
6448
}
6439
6449
}
@@ -10336,7 +10346,6 @@ LLVMInitializeAMDGPUAsmParser() {
10336
10346
RegisterMCAsmParser<AMDGPUAsmParser> B (getTheGCNTarget ());
10337
10347
}
10338
10348
10339
- #define GET_REGISTER_MATCHER
10340
10349
#define GET_MATCHER_IMPLEMENTATION
10341
10350
#define GET_MNEMONIC_SPELL_CHECKER
10342
10351
#define GET_MNEMONIC_CHECKER
0 commit comments