@@ -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.
@@ -1545,6 +1551,10 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
1545
1551
return AMDGPU::isGFX10_BEncoding (getSTI ());
1546
1552
}
1547
1553
1554
+ bool isWave32 () const { return getAvailableFeatures ()[Feature_isWave32Bit]; }
1555
+
1556
+ bool isWave64 () const { return getAvailableFeatures ()[Feature_isWave64Bit]; }
1557
+
1548
1558
bool hasInv2PiInlineImm () const {
1549
1559
return getFeatureBits ()[AMDGPU::FeatureInv2PiInlineImm];
1550
1560
}
@@ -1608,6 +1618,8 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
1608
1618
return &MII;
1609
1619
}
1610
1620
1621
+ // FIXME: This should not be used. Instead, should use queries derived from
1622
+ // getAvailableFeatures().
1611
1623
const FeatureBitset &getFeatureBits () const {
1612
1624
return getSTI ().getFeatureBits ();
1613
1625
}
@@ -2264,9 +2276,8 @@ bool AMDGPUOperand::isSDWAInt32Operand() const {
2264
2276
}
2265
2277
2266
2278
bool AMDGPUOperand::isBoolReg () const {
2267
- auto FB = AsmParser->getFeatureBits ();
2268
- return isReg () && ((FB[AMDGPU::FeatureWavefrontSize64] && isSCSrc_b64 ()) ||
2269
- (FB[AMDGPU::FeatureWavefrontSize32] && isSCSrc_b32 ()));
2279
+ return isReg () && ((AsmParser->isWave64 () && isSCSrc_b64 ()) ||
2280
+ (AsmParser->isWave32 () && isSCSrc_b32 ()));
2270
2281
}
2271
2282
2272
2283
uint64_t AMDGPUOperand::applyInputFPModifiers (uint64_t Val, unsigned Size) const
@@ -4984,9 +4995,8 @@ bool AMDGPUAsmParser::validateDPP(const MCInst &Inst,
4984
4995
4985
4996
// Check if VCC register matches wavefront size
4986
4997
bool AMDGPUAsmParser::validateVccOperand (MCRegister Reg) const {
4987
- auto FB = getFeatureBits ();
4988
- return (FB[AMDGPU::FeatureWavefrontSize64] && Reg == AMDGPU::VCC) ||
4989
- (FB[AMDGPU::FeatureWavefrontSize32] && Reg == AMDGPU::VCC_LO);
4998
+ return (Reg == AMDGPU::VCC && isWave64 ()) ||
4999
+ (Reg == AMDGPU::VCC_LO && isWave32 ());
4990
5000
}
4991
5001
4992
5002
// One unique literal can be used. VOP3 literal is only allowed in GFX10+
@@ -5671,7 +5681,7 @@ bool AMDGPUAsmParser::checkUnsupportedInstruction(StringRef Mnemo,
5671
5681
// Check if this instruction may be used with a different wavesize.
5672
5682
if (isGFX10Plus () && getFeatureBits ()[AMDGPU::FeatureWavefrontSize64] &&
5673
5683
!getFeatureBits ()[AMDGPU::FeatureWavefrontSize32]) {
5674
-
5684
+ // FIXME: Use getAvailableFeatures, and do not manually recompute
5675
5685
FeatureBitset FeaturesWS32 = getFeatureBits ();
5676
5686
FeaturesWS32.flip (AMDGPU::FeatureWavefrontSize64)
5677
5687
.flip (AMDGPU::FeatureWavefrontSize32);
@@ -6426,10 +6436,10 @@ bool AMDGPUAsmParser::ParseAMDKernelCodeTValue(StringRef ID,
6426
6436
if (C.code_properties & AMD_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32) {
6427
6437
if (!isGFX10Plus ())
6428
6438
return TokError (" enable_wavefront_size32=1 is only allowed on GFX10+" );
6429
- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize32] )
6439
+ if (!isWave32 () )
6430
6440
return TokError (" enable_wavefront_size32=1 requires +WavefrontSize32" );
6431
6441
} else {
6432
- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize64] )
6442
+ if (!isWave64 () )
6433
6443
return TokError (" enable_wavefront_size32=0 requires +WavefrontSize64" );
6434
6444
}
6435
6445
}
@@ -6438,10 +6448,10 @@ bool AMDGPUAsmParser::ParseAMDKernelCodeTValue(StringRef ID,
6438
6448
if (C.wavefront_size == 5 ) {
6439
6449
if (!isGFX10Plus ())
6440
6450
return TokError (" wavefront_size=5 is only allowed on GFX10+" );
6441
- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize32] )
6451
+ if (!isWave32 () )
6442
6452
return TokError (" wavefront_size=5 requires +WavefrontSize32" );
6443
6453
} else if (C.wavefront_size == 6 ) {
6444
- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize64] )
6454
+ if (!isWave64 () )
6445
6455
return TokError (" wavefront_size=6 requires +WavefrontSize64" );
6446
6456
}
6447
6457
}
@@ -10344,7 +10354,6 @@ LLVMInitializeAMDGPUAsmParser() {
10344
10354
RegisterMCAsmParser<AMDGPUAsmParser> B (getTheGCNTarget ());
10345
10355
}
10346
10356
10347
- #define GET_REGISTER_MATCHER
10348
10357
#define GET_MATCHER_IMPLEMENTATION
10349
10358
#define GET_MNEMONIC_SPELL_CHECKER
10350
10359
#define GET_MNEMONIC_CHECKER
0 commit comments