This is an archive of the discontinued LLVM Phabricator instance.

[X86][SSE] Resolve target shuffle inputs to sentinels to permit more combines
ClosedPublic

Authored by RKSimon on Jan 28 2016, 5:52 AM.

Details

Summary

The combineX86ShufflesRecursively only supports unary shuffles, but was missing the opportunity to combine binary shuffles with a zero / undef second input.

This patch resolves target shuffle inputs, converting the shuffle mask elements to SM_SentinelUndef/SM_SentinelZero where possible. It then resolves the updated mask to check if we have created a faux unary shuffle.

Additionally, we now attempt to recursively call combineX86ShufflesRecursively for all input operands (we used to just recurse for unary integer shuffles and unary unpacks) - it safely returns early if its not a target shuffle.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon updated this revision to Diff 46263.Jan 28 2016, 5:52 AM
RKSimon retitled this revision from to [X86][SSE] Resolve target shuffle inputs to sentinels to permit more combines.
RKSimon updated this object.
RKSimon added reviewers: qcolombet, andreadb, spatel.
RKSimon set the repository for this revision to rL LLVM.
RKSimon added a subscriber: llvm-commits.
spatel accepted this revision.Feb 7 2016, 1:56 PM
spatel edited edge metadata.

LGTM - see inline comments for a couple of nits.

lib/Target/X86/X86ISelLowering.cpp
23691 ↗(On Diff #46263)

it's

test/CodeGen/X86/pshufb-mask-comments.ll
34 ↗(On Diff #46263)

It would be better to check the correct/expected output instead.

This revision is now accepted and ready to land.Feb 7 2016, 1:56 PM
This revision was automatically updated to reflect the committed changes.

Thanks Sanjay