[PATCH] D12833: Combines pair of rotr/rotl with constant shifts into one instruction with combined shift
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 3 13:36:05 PDT 2017
RKSimon added a reviewer: RKSimon.
RKSimon added a comment.
In https://reviews.llvm.org/D12833#798373, @delena wrote:
> I suggest to submit the test first to show the current code. It will let us to see the optimization.
+1
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5280
+ return DAG.getNode(N->getOpcode(), dl, VT, N0, NewOp1);
}
+ unsigned NextOp = N0.getOpcode();
----------------
You can do all of the above as a NFC pre-commit and simplify this patch
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5284
+ // fold (rot* (rot* x, c2), c1) -> (rot* x, c1 +- c2 % bitsize)
+ if (ConstantSDNode *C1 = getAsNonOpaqueConstant(N1))
+ if (NextOp == ISD::ROTL || NextOp == ISD::ROTR)
----------------
Ideally you should replace these with isConstantOrConstantVector calls to support vector rotates.
https://reviews.llvm.org/D12833
More information about the llvm-commits
mailing list