This is an archive of the discontinued LLVM Phabricator instance.

[X86] Basic lowering support for selection of COMPRESS with a constant mask
Changes PlannedPublic

Authored by RKSimon on Jul 1 2017, 11:43 PM.

Details

Summary

COMPRESS is good for cases where we construct a vector by picking
monotonically strictly increasing element indices from a source vector.
Due to the overhead of constructing the constant mask (mov
gpr,immediates + kmov k,gpr), we should prefer shuffle instruction with immediates over
COMRPESS (and possibly even shuffles which take the indices in a register
operand).

The pattern for shuffles is:

(shuffle (extract_subvector V, 0), (extract_subvector V, 4) <1, 3, 5, 7>)
-->
COMPRESS V, b01010101

and similarly:
build_vector (extractelt V, 1), (extractelt V, 3), (extractelt V, 5), extractelt (V, 7)
-->
COMPRESS V, b01010101

Event Timeline

zvi created this revision.Jul 1 2017, 11:43 PM
RKSimon edited edge metadata.Jul 31 2017, 5:56 AM

Why do you not try to perform lowerShuffleVectorAsCompress for 512-bit vectors?

@zvi I need to add compress shuffle lowering/combining support to help with some upcoming shuffle combine work - would you mind if I commandeered this and updated it?

RKSimon commandeered this revision.Oct 22 2020, 7:16 AM
RKSimon edited reviewers, added: zvi; removed: RKSimon.

Commandeering - I need to improve COMPRESS handling before we can start shuffle combining across different vector widths

RKSimon planned changes to this revision.Nov 12 2020, 4:29 AM