[PATCH] D32616: [X86] Add more patterns for BZHI isel
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 27 14:20:05 PDT 2017
craig.topper created this revision.
This patch adds more patterns that a reasonable person might write that can be compiled to BZHI.
This adds support for
(~0U >> (32 - b)) & a;
and
a << (32 - b) >> (32 - b);
This was inspired by the code in APInt::clearUnusedBits.
This can pass an index of 32 to the bzhi instruction which a quick test of Haswell hardware shows will not mask any bits. Though the description text in the Intel manual says the "index is saturated to OperandSize-1". The pseudocode in the same manual indicates no bits will be zeroed for this case.
I think this is still missing cases where the subtract portion is an 8-bit operation.
https://reviews.llvm.org/D32616
Files:
lib/Target/X86/X86InstrInfo.td
test/CodeGen/X86/bmi.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32616.96997.patch
Type: text/x-patch
Size: 4269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170427/799ffe23/attachment.bin>
More information about the llvm-commits
mailing list