[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:23 PST 2026
================
@@ -20,32 +20,32 @@ define void @scalar() {
; GFX7-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %F16toI16 = bitcast half poison to i16
; GFX7-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16toBF16 = bitcast i16 poison to bfloat
; GFX7-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %BF16toI16 = bitcast bfloat poison to i16
----------------
michaelselehov wrote:
I fixed it in this PR after all: a bitcast between scalars that are legalized to types of the same size is now free, so `i16 <-> half` and `i16 <-> bfloat` cost 0 on gfx6 and gfx7, where llc emits the same code with and without these casts. The same rule makes `i128 <-> fp128` free, and llc emits no code for that cast either.
https://github.com/llvm/llvm-project/pull/238412
More information about the llvm-branch-commits
mailing list