[all-commits] [llvm/llvm-project] 6547a5: [DAG] Add TODO comment regarding ADD(X, X) -> SHL(X...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Thu Apr 30 04:59:09 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6547a5ceb2213dc49ba2b8a7d98913b39cb331d9
      https://github.com/llvm/llvm-project/commit/6547a5ceb2213dc49ba2b8a7d98913b39cb331d9
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

  Log Message:
  -----------
  [DAG] Add TODO comment regarding ADD(X,X) -> SHL(X,1) canonicalization

As discussed on D78935


  Commit: 96238486ed627f1bad2c327f72a5a2b1d301d84d
      https://github.com/llvm/llvm-project/commit/96238486ed627f1bad2c327f72a5a2b1d301d84d
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/pr32282.ll

  Log Message:
  -----------
  [DAGCombine] Move the remaining X86 funnel shift patterns to DAGCombine

X86 matches several 'shift+xor' funnel shift patterns:

  fold (or (srl (srl x1, 1), (xor y, 31)), (shl x0, y))  -> (fshl x0, x1, y)
  fold (or (shl (shl x0, 1), (xor y, 31)), (srl x1, y))  -> (fshr x0, x1, y)
  fold (or (shl (add x0, x0), (xor y, 31)), (srl x1, y)) -> (fshr x0, x1, y)

These patterns are also what we end up with the proposed expansion changes in D77301.

This patch moves these to DAGCombine's generic MatchFunnelPosNeg.

All existing X86 test cases still pass, and we just have a small codegen change in pr32282.ll.

Reviewed By: @spatel

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


Compare: https://github.com/llvm/llvm-project/compare/2cfeaf3b2db8...96238486ed62


More information about the All-commits mailing list