[PATCH] D80489: [TargetLowering] Improve expandFunnelShift shift amount masking

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 24 02:40:33 PDT 2020


RKSimon created this revision.
RKSimon added reviewers: foad, craig.topper, spatel, lebedev.ri.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

For the 'inverse shift', we currently always perform a subtraction of the original (masked) shift amount.

But for the case where we are handling power-of-2 type widths, we can replace:

  (sub bw-1, (and amt, bw-1) ) -> (and (xor amt, bw-1), bw-1) -> (and ~amt, bw-1)

This allows x86 shifts to fold away the and-mask.

Followup to D77301 <https://reviews.llvm.org/D77301> + D80466 <https://reviews.llvm.org/D80466>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80489

Files:
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/test/CodeGen/X86/fshl.ll
  llvm/test/CodeGen/X86/fshr.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80489.265916.patch
Type: text/x-patch
Size: 9472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200524/9ae52ecd/attachment-0001.bin>


More information about the llvm-commits mailing list