[PATCH] D87883: [X86] Add support for calling SimplifyDemandedBits on the input of PDEP with a constant mask.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 19 22:22:04 PDT 2020


craig.topper updated this revision to Diff 293006.
craig.topper added a comment.

We can do several optimizations for PDEP using computeKnownBits and SimplifyDemandedBits

-If the MSBs of the output aren't demanded, those MSBs of the mask input aren't demanded either. We need to keep the most significant demanded bit of the mask and any mask bits before it.
-The number of possible ones in the mask determines how many bits of the lsbs of the other operand are demanded. Any bits of the mask we don't demand by the previous rule should not be counted.
-The result will have zeros in any position that the mask is zero.
-Since non-mask input bits can only be output in the original position or a higher bit position, the result will have at least as many trailing zeroes as the non-mask input.

Test cases have not been committed yet. But this patch was written to show the test diffs. Wanted to get feedback on the tests before committing.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87883/new/

https://reviews.llvm.org/D87883

Files:
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/bmi2-x86_64.ll
  llvm/test/CodeGen/X86/bmi2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87883.293006.patch
Type: text/x-patch
Size: 8063 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200920/4f2302f2/attachment.bin>


More information about the llvm-commits mailing list