[llvm] [AMDGPU] Do not use 64-bit literals with VOP3* encodings (PR #156602)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 4 00:29:24 PDT 2025


================
@@ -621,20 +622,23 @@ void AMDGPUInstPrinter::printImmediate64(uint64_t Imm,
            STI.hasFeature(AMDGPU::FeatureInv2PiInlineImm))
     O << "0.15915494309189532";
   else
-    printLiteral64(Imm, STI, O, IsFP);
+    printLiteral64(Desc, Imm, STI, O, IsFP);
 }
 
-void AMDGPUInstPrinter::printLiteral64(uint64_t Imm, const MCSubtargetInfo &STI,
+void AMDGPUInstPrinter::printLiteral64(const MCInstrDesc &Desc, uint64_t Imm,
+                                       const MCSubtargetInfo &STI,
                                        raw_ostream &O, bool IsFP) {
   // This part needs to align with AMDGPUOperand::addLiteralImmOperand.
+  bool CanUse64BitLiterals =
+      STI.hasFeature(AMDGPU::Feature64BitLiterals) &&
+      !(Desc.TSFlags & (SIInstrFlags::VOP3 | SIInstrFlags::VOP3P));
----------------
jayfoad wrote:

Nice idea, but in practice that doesn't work for instructions like V_FMAAK_F64. This is VOP2 but Size is set to 12, i.e. the size _including_ the mandatory literal. Changing that feels like a big project...

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


More information about the llvm-commits mailing list