[llvm] [AMDGPU] Use a generic printer for NamedIntOperands. (PR #100399)
Ivan Kosarev via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 26 08:36:27 PDT 2024
================
@@ -1812,14 +1711,18 @@ void AMDGPUInstPrinter::printEndpgm(const MCInst *MI, unsigned OpNo,
O << ' ' << formatDec(Imm);
}
-void AMDGPUInstPrinter::printByteSel(const MCInst *MI, unsigned OpNo,
- const MCSubtargetInfo &STI,
- raw_ostream &O) {
- uint8_t Imm = MI->getOperand(OpNo).getImm();
- if (!Imm)
- return;
-
- O << " byte_sel:" << formatDec(Imm);
+void AMDGPUInstPrinter::printNamedInt(const MCInst *MI, unsigned OpNo,
+ const MCSubtargetInfo &STI,
+ raw_ostream &O, StringRef Prefix,
+ unsigned Width, bool PrintInHex,
+ bool AlwaysPrint) {
+ int64_t V = MI->getOperand(OpNo).getImm();
+ if (AlwaysPrint || V != 0) {
+ if (Width)
+ V &= maxUIntN(Width);
----------------
kosarev wrote:
I think if we drop significant bits here, then this should rather suggest the operand has a value that it's not supposed to have. This made me wondering why do we need the masking in the first place, which turns out we don't.
https://github.com/llvm/llvm-project/pull/100399
More information about the llvm-commits
mailing list