[llvm] [AMDGPU] Introduce custom MIR formatting for s_wait_alu (PR #176316)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 27 02:13:24 PST 2026


================
@@ -16,10 +16,56 @@
 
 using namespace llvm;
 
+const char SWaitAluImmPrefix = '.';
+StringLiteral SWaitAluDelim = "_";
+
+StringLiteral VaVdstName = "VaVdst";
+StringLiteral VaSdstName = "VaSdst";
+StringLiteral VaSsrcName = "VaSsrc";
+StringLiteral HoldCntName = "HoldCnt";
+StringLiteral VmVsrcName = "VmVsrc";
+StringLiteral VaVccName = "VaVcc";
+StringLiteral SaSdstName = "SaSdst";
+
+StringLiteral AllOff = "AllOff";
+
+void AMDGPUMIRFormatter::printSWaitAluImm(uint64_t Imm,
+                                          llvm::raw_ostream &OS) const {
+  bool NonePrinted = true;
+  ListSeparator Delim(SWaitAluDelim);
+  auto PrintFieldIfNotMax = [&](StringRef Descr, auto &Fn, unsigned Max) {
----------------
jayfoad wrote:

Optional nit: personally I find it a bit "too clever" passing in a function Fn, when you could just pass in `unsigned Num` instead, by having the callers call the decode function, just like they already call the getBitMask function.

https://github.com/llvm/llvm-project/pull/176316


More information about the llvm-commits mailing list