[llvm] [AMDGPU] Add asm comments if setreg changes MSBs (PR #185774)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 18:44:59 PDT 2026


================
@@ -436,11 +436,19 @@ void AMDGPUAsmPrinter::emitInstruction(const MachineInstr *MI) {
                              MF->getInfo<SIMachineFunctionInfo>(),
                              *OutStreamer);
 
-    if (isVerbose() && MI->getOpcode() == AMDGPU::S_SET_VGPR_MSB) {
-      unsigned V = MI->getOperand(0).getImm() & 0xff;
-      OutStreamer->AddComment(
-          " msbs: dst=" + Twine(V >> 6) + " src0=" + Twine(V & 3) +
-          " src1=" + Twine((V >> 2) & 3) + " src2=" + Twine((V >> 4) & 3));
+    if (isVerbose() && (MI->getOpcode() == AMDGPU::S_SET_VGPR_MSB ||
+                        (MI->getOpcode() == AMDGPU::S_SETREG_IMM32_B32 &&
+                         STI.has1024AddressableVGPRs()))) {
+      std::optional<unsigned> V;
+      if (MI->getOpcode() == AMDGPU::S_SETREG_IMM32_B32)
+        V = AMDGPU::convertSetRegImmToVgprMSBs(*MI,
----------------
shiltian wrote:

That said, we need to check the target feature here.

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


More information about the llvm-commits mailing list