This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Improve the target-specific cost model to better handle signed division by a power of 2.
ClosedPublic

Authored by mcrosier on Sep 23 2014, 10:03 AM.

Details

Summary

This patch improve the target-specific cost model to better handle signed division by a power of 2. The immediate result is that this enables the SLP vectorizer to do a better job.

The ADD/CMP/SELECT/SRA is the expansion for the scalar version, which was added in r213758. I assume this is the cost we should return. The generated vector code still uses the target-independent series of SRA/SRL/ADD/SRA, however. I may need to clarify the comments, so suggestions are welcome.

We could also investigate using the ADD/CMP/SELECT/SRA combination for vectors, but that would require additional performance evaluation (and I think it's an orthogonal issue).

This should address PR20714.

Chad

Diff Detail

Event Timeline

mcrosier updated this revision to Diff 13999.Sep 23 2014, 10:03 AM
mcrosier retitled this revision from to [AArch64] Improve the target-specific cost model to better handle signed division by a power of 2..
mcrosier updated this object.
mcrosier edited the test plan for this revision. (Show Details)
mcrosier added a subscriber: Unknown Object (MLST).
mcrosier edited subscribers, added: aschwaighofer, nadav; removed: aemerson.Sep 23 2014, 10:11 AM
mcrosier added inline comments.Sep 23 2014, 1:02 PM
lib/Target/AArch64/AArch64TargetTransformInfo.cpp
419

s/vector/scalar

jmolloy accepted this revision.Sep 28 2014, 1:26 PM
jmolloy edited edge metadata.

LGTM!

Cheers,

James

This revision is now accepted and ready to land.Sep 28 2014, 1:26 PM
mcrosier closed this revision.Sep 29 2014, 7:09 AM

Committed r218607.