This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine][X86] Expand PACKSS/PACKUS if the operands won't saturate
Changes PlannedPublic

Authored by RKSimon on Apr 25 2019, 7:22 AM.

Details

Summary

If we know the source operands are already in range for PACKS/PACKUS then expand these to generic shuffle+truncate IR to allow us to further combine them.

DAG can lower these back to PACKSS/PACKUS without much trouble if they don't fold.

This was noticed while investigating PR39984.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Apr 25 2019, 7:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 25 2019, 7:22 AM
RKSimon planned changes to this revision.Apr 25 2019, 7:56 AM
RKSimon retitled this revision from [InstSimplify][X86] Expand PACKSS/PACKUS if the operands won't saturate to [InstCombine][X86] Expand PACKSS/PACKUS if the operands won't saturate.
RKSimon marked an inline comment as done.
RKSimon added inline comments.
test/Transforms/InstCombine/X86/x86-pack.ll
363

It looks like we're actually better off truncating before shuffling - it creates more IR but gives us more scope for folding - I'll revert rL359191