This is an archive of the discontinued LLVM Phabricator instance.

[X86][SSE] Improve cost model for i64 vector comparisons on pre-SSE42 targets
ClosedPublic

Authored by RKSimon on May 8 2016, 9:01 AM.

Details

Summary

As discussed on PR24888, until SSE42 we don't have access to PCMPGTQ for v2i64 comparisons, but the cost models don't reflect this, resulting in over-optimistic vectorizaton.

This patch adds SSE2 'base level' costs that match what a typical target is capable of and only reduces the v2i64 costs at SSE42.

Technically SSE41 provides a PCMPEQQ v2i64 equality test, but as getCmpSelInstrCost doesn't give us a way to discriminate between comparision test types we can't easily make use of this, otherwise we could split the cost of integer equality and greater-than tests to give better costings of each.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon updated this revision to Diff 56519.May 8 2016, 9:01 AM
RKSimon retitled this revision from to [X86][SSE] Improve cost model for i64 vector comparisons on pre-SSE42 targets.
RKSimon updated this object.
RKSimon added reviewers: silvas, ab, andreadb, spatel.
RKSimon set the repository for this revision to rL LLVM.
RKSimon added a subscriber: llvm-commits.
spatel accepted this revision.May 9 2016, 9:06 AM
spatel edited edge metadata.

LGTM.

Looks like another case that suggests the correct way to solve these kinds of problems in general: derive the TTI cost model directly from the sched machine model.

This revision is now accepted and ready to land.May 9 2016, 9:06 AM
This revision was automatically updated to reflect the committed changes.