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

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 15 12:28:47 PDT 2017


RKSimon added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4672
       if (LHSMask.getNode()) {
-        APInt RHSBits = APInt::getLowBitsSet(EltSizeInBits, LShVal);
+        SDValue RHSBits = buildLoHiRotateVecBitmask(RHSShiftAmt, true, DL, VT);
         Mask = DAG.getNode(ISD::AND, DL, VT, Mask,
----------------
This can be done with
```
SDValue RHSBits = DAG.getNode(ISD::SRL, DL, VT, AllOnes, RHSShiftAmt);
```
(Taking AllOnes from the value initially assigned to Mask).


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4677
       if (RHSMask.getNode()) {
-        APInt LHSBits = APInt::getHighBitsSet(EltSizeInBits, RShVal);
+        SDValue LHSBits = buildLoHiRotateVecBitmask(LHSShiftAmt, false, DL, VT);
         Mask = DAG.getNode(ISD::AND, DL, VT, Mask,
----------------
This can be done with
```
SDValue LHSBits = DAG.getNode(ISD::SHL, DL, VT, AllOnes, LHSShiftAmt);
```
(Taking AllOnes from the value initially assigned to Mask).


https://reviews.llvm.org/D35381





More information about the llvm-commits mailing list