This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine][X86] Add DemandedElts support for PMULDQ/PMULUDQ instructions
ClosedPublic

Authored by RKSimon on Dec 26 2016, 10:41 AM.

Details

Summary

PMULDQ/PMULUDQ vXi64 instructions only use the even numbered v2Xi32 input elements which SimplifyDemandedVectorElts should try and use.

We can't do much with the undef demanded elts - we should probably only support the (mul X, undef -> 0) pattern the same as regular integer multiplies. I can add support for it if you guys want but I can't see it being used by real world code. Same with constant folding support.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon updated this revision to Diff 82514.Dec 26 2016, 10:41 AM
RKSimon retitled this revision from to [InstCombine][X86] Add DemandedElts support for PMULDQ/PMULUDQ instructions.
RKSimon updated this object.
RKSimon set the repository for this revision to rL LLVM.
RKSimon added a subscriber: llvm-commits.
craig.topper added inline comments.Dec 26 2016, 11:03 AM
lib/Transforms/InstCombine/InstCombineCalls.cpp
1999 ↗(On Diff #82514)

Can we just call SimplifyDemandedVectorElts on the Intrinsic node here with an all 1s demanded mask. This allows reuse of the code in InstCombineSimplifyDemanded. See the code at line 1879 in this file in this diff.

lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
1459 ↗(On Diff #82514)

Why is this code formatted differently than the same code for ArgOperand 0?

RKSimon updated this revision to Diff 82519.Dec 26 2016, 3:19 PM

Updated based on Craig's feedback

RKSimon marked 2 inline comments as done.Dec 26 2016, 3:19 PM
RKSimon added inline comments.
lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
1459 ↗(On Diff #82514)

Because for some reason I used clang-format on one and kept to the formatting for the rest of the file for the other.....

craig.topper accepted this revision.Dec 26 2016, 3:33 PM
craig.topper edited edge metadata.

LGTM

This revision is now accepted and ready to land.Dec 26 2016, 3:33 PM
This revision was automatically updated to reflect the committed changes.
RKSimon marked an inline comment as done.