[llvm] [AMDGPU] Price scalar integer to fp casts by source width and sign (PR #225343)

Dmitry Sidorov via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 3 04:44:05 PDT 2026


================
@@ -1098,22 +1098,34 @@ InstructionCost GCNTTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
   };
 
   if (IsIntToFP) {
-    const unsigned ExtOps = UsesInt64 && SrcBits < 64 ? (IsSigned ? 2 : 1) : 0;
+    // A scalar load of 24, 40, 48 or 56 bits is split and its high part load
+    // extends the source. A constant or invariant load aligned to 4 bytes may
+    // be widened instead and then still needs the extension.
+    const auto *Load =
+        I && Src->isIntegerTy() && I->getOperand(0)->getType() == Src
----------------
MrSidims wrote:

Thanks! Now written as SrcBits % 8 == 0 && !isPowerOf2_32(SrcBits).

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


More information about the llvm-commits mailing list