[PATCH] D35381: [DAGCombiner] Recognise vector rotations with non-splat constants

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 14 02:06:16 PDT 2017


RKSimon added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4708
   }
+  if (areNonSplatRotateCombinableVecs(LHSShiftAmt, RHSShiftAmt, EltSizeInBits)) {
+    SDValue Rot = DAG.getNode(HasROTL ? ISD::ROTL : ISD::ROTR, DL, VT,
----------------
It would be tidier to merge this into the scalar/splat version above. Adding a predicate to pattern match all constants would be useful (and possibly reusable elsewhere - @majnemer has suggested a DAGCombiner equivalent of llvm::PatternMatch in the past).

The bitmasks should be creatable using SelectionDAG::FoldConstantArithmetic from logical shifts of the all ones mask and LHSShiftAmt/RHSShiftAmt.


https://reviews.llvm.org/D35381





More information about the llvm-commits mailing list