-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[AMDGPU][AsmParser] Eliminate validateExeczVcczOperands(). #102600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1777,7 +1777,6 @@ class AMDGPUAsmParser : public MCTargetAsmParser { | |
const SMLoc &IDLoc); | ||
bool validateTHAndScopeBits(const MCInst &Inst, const OperandVector &Operands, | ||
const unsigned CPol); | ||
bool validateExeczVcczOperands(const OperandVector &Operands); | ||
bool validateTFE(const MCInst &Inst, const OperandVector &Operands); | ||
std::optional<StringRef> validateLdsDirect(const MCInst &Inst); | ||
unsigned getConstantBusLimit(unsigned Opcode) const; | ||
|
@@ -3039,7 +3038,8 @@ bool AMDGPUAsmParser::ParseAMDGPURegister(RegisterKind &RegKind, unsigned &Reg, | |
if (Reg == AMDGPU::SGPR_NULL) { | ||
Error(Loc, "'null' operand is not supported on this GPU"); | ||
} else { | ||
Error(Loc, "register not available on this GPU"); | ||
Error(Loc, Twine(AMDGPUInstPrinter::getRegisterName(Reg)) + | ||
" register not available on this GPU"); | ||
} | ||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... and this line is dead. |
||
} | ||
|
@@ -5052,22 +5052,6 @@ bool AMDGPUAsmParser::validateTHAndScopeBits(const MCInst &Inst, | |
return true; | ||
} | ||
|
||
bool AMDGPUAsmParser::validateExeczVcczOperands(const OperandVector &Operands) { | ||
if (!isGFX11Plus()) | ||
return true; | ||
for (auto &Operand : Operands) { | ||
if (!Operand->isReg()) | ||
continue; | ||
unsigned Reg = Operand->getReg(); | ||
if (Reg == SRC_EXECZ || Reg == SRC_VCCZ) { | ||
Error(getRegLoc(Reg, Operands), | ||
"execz and vccz are not supported on this GPU"); | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
bool AMDGPUAsmParser::validateTFE(const MCInst &Inst, | ||
const OperandVector &Operands) { | ||
const MCInstrDesc &Desc = MII.get(Inst.getOpcode()); | ||
|
@@ -5203,9 +5187,6 @@ bool AMDGPUAsmParser::validateInstruction(const MCInst &Inst, | |
if (!validateWaitCnt(Inst, Operands)) { | ||
return false; | ||
} | ||
if (!validateExeczVcczOperands(Operands)) { | ||
return false; | ||
} | ||
if (!validateTFE(Inst, Operands)) { | ||
return false; | ||
} | ||
|
@@ -6247,39 +6228,41 @@ bool AMDGPUAsmParser::ParseDirective(AsmToken DirectiveID) { | |
|
||
bool AMDGPUAsmParser::subtargetHasRegister(const MCRegisterInfo &MRI, | ||
unsigned RegNo) { | ||
|
||
if (MRI.regsOverlap(AMDGPU::TTMP12_TTMP13_TTMP14_TTMP15, RegNo)) | ||
if (MRI.regsOverlap(TTMP12_TTMP13_TTMP14_TTMP15, RegNo)) | ||
return isGFX9Plus(); | ||
|
||
// GFX10+ has 2 more SGPRs 104 and 105. | ||
if (MRI.regsOverlap(AMDGPU::SGPR104_SGPR105, RegNo)) | ||
if (MRI.regsOverlap(SGPR104_SGPR105, RegNo)) | ||
return hasSGPR104_SGPR105(); | ||
|
||
switch (RegNo) { | ||
case AMDGPU::SRC_SHARED_BASE_LO: | ||
case AMDGPU::SRC_SHARED_BASE: | ||
case AMDGPU::SRC_SHARED_LIMIT_LO: | ||
case AMDGPU::SRC_SHARED_LIMIT: | ||
case AMDGPU::SRC_PRIVATE_BASE_LO: | ||
case AMDGPU::SRC_PRIVATE_BASE: | ||
case AMDGPU::SRC_PRIVATE_LIMIT_LO: | ||
case AMDGPU::SRC_PRIVATE_LIMIT: | ||
case SRC_SHARED_BASE_LO: | ||
case SRC_SHARED_BASE: | ||
case SRC_SHARED_LIMIT_LO: | ||
case SRC_SHARED_LIMIT: | ||
case SRC_PRIVATE_BASE_LO: | ||
case SRC_PRIVATE_BASE: | ||
case SRC_PRIVATE_LIMIT_LO: | ||
case SRC_PRIVATE_LIMIT: | ||
return isGFX9Plus(); | ||
case AMDGPU::SRC_POPS_EXITING_WAVE_ID: | ||
case SRC_POPS_EXITING_WAVE_ID: | ||
return isGFX9Plus() && !isGFX11Plus(); | ||
case AMDGPU::TBA: | ||
case AMDGPU::TBA_LO: | ||
case AMDGPU::TBA_HI: | ||
case AMDGPU::TMA: | ||
case AMDGPU::TMA_LO: | ||
case AMDGPU::TMA_HI: | ||
case TBA: | ||
case TBA_LO: | ||
case TBA_HI: | ||
case TMA: | ||
case TMA_LO: | ||
case TMA_HI: | ||
return !isGFX9Plus(); | ||
case AMDGPU::XNACK_MASK: | ||
case AMDGPU::XNACK_MASK_LO: | ||
case AMDGPU::XNACK_MASK_HI: | ||
case XNACK_MASK: | ||
case XNACK_MASK_LO: | ||
case XNACK_MASK_HI: | ||
return (isVI() || isGFX9()) && getTargetStreamer().getTargetID()->isXnackSupported(); | ||
case AMDGPU::SGPR_NULL: | ||
case SGPR_NULL: | ||
return isGFX10Plus(); | ||
case SRC_EXECZ: | ||
case SRC_VCCZ: | ||
return !isGFX11Plus(); | ||
default: | ||
break; | ||
} | ||
|
@@ -6292,9 +6275,9 @@ bool AMDGPUAsmParser::subtargetHasRegister(const MCRegisterInfo &MRI, | |
// On GFX10Plus flat scratch is not a valid register operand and can only be | ||
// accessed with s_setreg/s_getreg. | ||
switch (RegNo) { | ||
case AMDGPU::FLAT_SCR: | ||
case AMDGPU::FLAT_SCR_LO: | ||
case AMDGPU::FLAT_SCR_HI: | ||
case FLAT_SCR: | ||
case FLAT_SCR_LO: | ||
case FLAT_SCR_HI: | ||
return false; | ||
default: | ||
return true; | ||
|
@@ -6303,7 +6286,7 @@ bool AMDGPUAsmParser::subtargetHasRegister(const MCRegisterInfo &MRI, | |
|
||
// VI only has 102 SGPRs, so make sure we aren't trying to use the 2 more that | ||
// SI/CI have. | ||
if (MRI.regsOverlap(AMDGPU::SGPR102_SGPR103, RegNo)) | ||
if (MRI.regsOverlap(SGPR102_SGPR103, RegNo)) | ||
return hasSGPR102_SGPR103(); | ||
|
||
return true; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
else
is probably not needed,Error
shall act like a return.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it does not return, but can be used as
return Error()
instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MCAsmParser::Error()
seems to return true, so wouldn't work. (Confusingly, ourAMDGPUAsmParser::Error()
returns false, but from what I see that's not what we call here.)