[all-commits] [llvm/llvm-project] 160310: [TargetLowering] Improve expandFunnelShift shift a...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Sun May 24 03:29:26 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 16031067252dc466cdc4311ab1491f996e5b4848
      https://github.com/llvm/llvm-project/commit/16031067252dc466cdc4311ab1491f996e5b4848
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2020-05-24 (Sun, 24 May 2020)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
    M llvm/test/CodeGen/X86/fshl.ll
    M llvm/test/CodeGen/X86/fshr.ll

  Log Message:
  -----------
  [TargetLowering] Improve expandFunnelShift shift amount masking

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 + D80466.

http://volta.cs.utah.edu:8080/z/Nod0Gr

Differential Revision: https://reviews.llvm.org/D80489




More information about the All-commits mailing list