[PATCH] D123523: [DAG] Add non-uniform vector support to (shl (srl x, c1), c2) -> (and (shift x, c3))

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 12 01:31:26 PDT 2022


RKSimon added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:8948
+      SDValue Mask = DAG.getAllOnesConstant(DL, VT);
+      Mask = DAG.getNode(ISD::SHL, DL, VT, Mask, N01);
+      Mask = DAG.getNode(ISD::SHL, DL, VT, Mask, Diff);
----------------
craig.topper wrote:
> Can these two SHL of mask be replaced with
> 
> ```
> Mask = DAG.getNode(ISD::SHL, DL, VT, Mask, N1)
> ```
> 
> As far as I can tell we're shifting by N01 + (N1 - N01) which should just be N1?
Agreed: https://alive2.llvm.org/ce/z/rf8VHG

I'll add an explicit test and update the patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123523/new/

https://reviews.llvm.org/D123523



More information about the llvm-commits mailing list