[llvm] [AMDGPU][CodeGen][True16] Correct size calculation for d16 insts (PR #151042)

Brox Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 07:27:03 PDT 2025


================
@@ -9269,6 +9269,15 @@ unsigned SIInstrInfo::getInstSizeInBytes(const MachineInstr &MI) const {
     return 8 + 4 * ((RSrcIdx - VAddr0Idx + 2) / 4);
   }
 
+  // if D16 Pseudo inst, get correct MC code size
+  const auto *D16Info = AMDGPU::getT16D16Helper(Opc);
+  if (D16Info) {
+    // assume d16_lo/hi inst are always in same size
+    unsigned LoInstOpcode = D16Info->LoOp;
+    const MCInstrDesc &Desc = getMCOpcodeFromPseudo(LoInstOpcode);
+    DescSize = Desc.getSize();
+  }
----------------
broxigarchen wrote:

done

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


More information about the llvm-commits mailing list