[PATCH] D47725: [SelectionDAG] Create rotates more aggressively, provide default expansion

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 4 09:16:29 PDT 2018


kparzysz created this revision.
kparzysz added a reviewer: spatel.

The DAG combiner can recognize a pattern of ORed shifts that evaluate to a bit rotation. When the rotation is ORed with another value, the OR operations can get reassociated in such a way that the rotation will no longer be identified. This patch implements a more aggressive analysis of OR operations to detect rotation patterns.

Implement generating of rotate instructions for Hexagon. Hexagon only supports rotates by an immediate value, so implement custom lowering of ROTL/ROTR on Hexagon. If a rotate is not legal, use the (provided) default expansion into shifts and OR.


Repository:
  rL LLVM

https://reviews.llvm.org/D47725

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  lib/Target/Hexagon/HexagonISelLowering.cpp
  lib/Target/Hexagon/HexagonISelLowering.h
  lib/Target/Hexagon/HexagonPatterns.td
  test/CodeGen/Hexagon/rotate.ll
  test/CodeGen/Hexagon/rotl-i64.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47725.149783.patch
Type: text/x-patch
Size: 16833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180604/22a6b934/attachment.bin>


More information about the llvm-commits mailing list