[PATCH] D96692: [ARM] Add larger than legal ICmp costs

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 15 01:25:54 PST 2021


dmgreen created this revision.
dmgreen added reviewers: SjoerdMeijer, NickGuy, efriedma, ostannard, simon_tatham.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls.
dmgreen requested review of this revision.
Herald added a project: LLVM.

A v8i32 compare will produce a v8i1 predicate, but during codegen the v8i32 will be split into two v4i32, potentially requiring two v4i1 predicates to be merged into a single v8i1. Because this merging of two v4i1's into a v8i1 is very expensive, we need to make the cost of the compare equally high.

This patch adds the cost of that to ARMTTIImpl::getCmpSelInstrCost. Because we don't know whether the user of the predicate can be split, and the cost model is mostly pre-instruction, we may be pessimistic, but that should only be for larger and legal types.  This does add a min/max detection to the costmodel where it can be detected, to keep those in line with the cost of simple min/max instructions. Otherwise for the most part, costs that were already expensive have become more expensive.


https://reviews.llvm.org/D96692

Files:
  llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
  llvm/test/Analysis/CostModel/ARM/arith-overflow.ll
  llvm/test/Analysis/CostModel/ARM/intrinsic-cost-kinds.ll
  llvm/test/Analysis/CostModel/ARM/mve-cmp.ll
  llvm/test/Analysis/CostModel/ARM/reduce-smax.ll
  llvm/test/Analysis/CostModel/ARM/reduce-smin.ll
  llvm/test/Analysis/CostModel/ARM/reduce-umax.ll
  llvm/test/Analysis/CostModel/ARM/reduce-umin.ll
  llvm/test/CodeGen/ARM/vselect_imax.ll
  llvm/test/Transforms/LoopVectorize/ARM/mve-icmpcost.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96692.323685.patch
Type: text/x-patch
Size: 81490 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210215/b7d4b3bc/attachment-0001.bin>


More information about the llvm-commits mailing list