[llvm-branch-commits] [llvm] [AMDGPU] Treat a bitcast between legal types as free (PR #238412)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Nov 4 02:03:33 PST 2026
================
@@ -1066,6 +1066,12 @@ InstructionCost GCNTTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
Elts && Src->isIntegerTy(*Elts))
return InstructionCost(MaskUnpackCostPerElt) * *Elts *
getFullRateInstrCost();
+ // Integer and floating-point values share the same registers.
+ if (Src->getPrimitiveSizeInBits() == Dst->getPrimitiveSizeInBits() &&
----------------
michaelselehov wrote:
It is free while the value stays packed: a store of the `<8 x i8>` needs no extra instructions. The cost appears when the lanes are used separately. `<8 x i8>` is not a legal type, so it gets split into elements, and returning it from a function takes 6 shifts and 4 moves on gfx950. The cost of 8 on main models that split, and this patch keeps it.
https://github.com/llvm/llvm-project/pull/238412
More information about the llvm-branch-commits
mailing list