[llvm] AMDGPU: Fix packed 16-bit inline constants (PR #76522)

Joe Nash via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 2 13:14:42 PST 2024


================
@@ -532,7 +560,24 @@ void AMDGPUInstPrinter::printImmediate32(uint32_t Imm,
            STI.hasFeature(AMDGPU::FeatureInv2PiInlineImm))
     O << "0.15915494";
   else
-    O << formatHex(static_cast<uint64_t>(Imm));
+    return false;
+
+  return true;
+}
+
+void AMDGPUInstPrinter::printImmediate32(uint32_t Imm,
+                                         const MCSubtargetInfo &STI,
+                                         raw_ostream &O) {
+  int32_t SImm = static_cast<int32_t>(Imm);
+  if (SImm >= -16 && SImm <= 64) {
----------------
Sisyph wrote:


```suggestion
  if (isInlinableIntLiteral(SImm)) {
```

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


More information about the llvm-commits mailing list