This is an archive of the discontinued LLVM Phabricator instance.

[X86][SSE] Add cost model for BSWAP of vectors
ClosedPublic

Authored by RKSimon on Jun 20 2016, 10:47 AM.

Details

Summary

The BSWAP of vector types is quite efficiently implemented using vector shuffles on SSE/AVX targets, we should reflect the typical cost of this to encourage vectorization.

Also, we're not making much use of the intrinsic costings on any target - for instance why do we not use this for CTPOP instead of the rather limited getPopcntSupport() approach? CTLZ/CTTZ would probably benefit as well.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon updated this revision to Diff 61267.Jun 20 2016, 10:47 AM
RKSimon retitled this revision from to [X86][SSE] Add cost model for BSWAP of vectors.
RKSimon updated this object.
RKSimon added reviewers: hfinkel, delena, mkuper, andreadb, spatel.
RKSimon set the repository for this revision to rL LLVM.
RKSimon added a subscriber: llvm-commits.
mkuper accepted this revision.Jun 20 2016, 11:02 AM
mkuper edited edge metadata.

I assume the costs are based on the lowering we have in test/CodeGen/X86/bswap-vector.ll ?
In any case, this LGTM.

(Out of curiosity, do you see this get hit in practice?)

This revision is now accepted and ready to land.Jun 20 2016, 11:02 AM

I assume the costs are based on the lowering we have in test/CodeGen/X86/bswap-vector.ll ?
In any case, this LGTM.

(Out of curiosity, do you see this get hit in practice?)

Thanks Michael - yes the costs are based off the codegen from bswap-vector.ll

I have a couple of examples where this patch (along with enabling the loadcombine pass) can help vectorize the loading/conversion of big endian float data.

This revision was automatically updated to reflect the committed changes.