[PATCH] D148123: [AArch64][CostModel] Make sext/zext free if folded into a masked load
David Sherwood via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 18 01:01:24 PDT 2023
david-arm marked an inline comment as done.
david-arm added inline comments.
================
Comment at: llvm/test/Analysis/CostModel/AArch64/masked_ldst.ll:113
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv16i8 = call <vscale x 16 x i8> @llvm.masked.load.nxv16i8.p0(ptr undef, i32 8, <vscale x 16 x i1> undef, <vscale x 16 x i8> undef)
-; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %zext.nxv16i8to16 = zext <vscale x 16 x i8> %load.nxv16i8 to <vscale x 16 x i16>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %zext.nxv16i8to16 = zext <vscale x 16 x i8> %load.nxv16i8 to <vscale x 16 x i16>
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv8i8 = call <vscale x 8 x i8> @llvm.masked.load.nxv8i8.p0(ptr undef, i32 8, <vscale x 8 x i1> undef, <vscale x 8 x i8> undef)
----------------
dmgreen wrote:
> Do you know why this has gone from 3 to 1, if the Dst type is not legal? I think I would expect the score to be 2!
I assumed this was because it was deciding to create two legal extending loads and then stitch the results together, i.e. reinvoke getCastInstrCost with the type split in half.
%load.nxv88.1 = call <vscale x 16 x i8> @llvm.masked.load.nxv8i8.p0(ptr undef, i32 8, <vscale x 8 x i1> undef, <vscale x 8 x i8> undef)
%zext.nxv16i8to16.1 = zext <vscale x 8 x i8> %load.nxv8i8.1 to <vscale x 8 x i16>
%load.nxv8i8.2 = call <vscale x 16 x i8> @llvm.masked.load.nxv8i8.p0(ptr undef, i32 8, <vscale x 8 x i1> undef, <vscale x 8 x i8> undef)
%zext.nxv16i8to16.2 = zext <vscale x 8 x i8> %load.nxv8i8.2 to <vscale x 8 x i16>
%zext.nxv16i8to16 = concat (%load.nxv8i8.1, %load.nxv8i8.2)
so that the only cost of the zext is just the concat, but it's a good question. I can double check.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148123/new/
https://reviews.llvm.org/D148123
More information about the llvm-commits
mailing list