This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Add larger than legal ICmp costs
ClosedPublic

Authored by dmgreen on Feb 15 2021, 1:25 AM.

Details

Summary

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.

Diff Detail

Event Timeline

dmgreen created this revision.Feb 15 2021, 1:25 AM
dmgreen requested review of this revision.Feb 15 2021, 1:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2021, 1:25 AM
SjoerdMeijer accepted this revision.Feb 16 2021, 8:09 AM

Looks reasonable.

llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
863

Nit: *Sel

896

Nit: if (IID)

937

Nit: do we need in comments what these false/true booleans are?

This revision is now accepted and ready to land.Feb 16 2021, 8:09 AM
This revision was automatically updated to reflect the committed changes.