[PATCH] D96345: [DAG] Fold shuffle(binop(shuffle(x,y),shuffle(z,w)),binop(shuffle(a,b),shuffle(c,d)))

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 07:42:08 PST 2021


RKSimon created this revision.
RKSimon added reviewers: spatel, craig.topper, lebedev.ri, dmgreen.
Herald added subscribers: ecnelises, steven.zhang, pengfei, hiraditya.
RKSimon requested review of this revision.
Herald added a project: LLVM.

Attempt to fold from a shuffle of a pair of binops to a binop of shuffles, as long as one/both of the binop sources are also shuffles that can be merged with the outer shuffle. This should guarantee that we remove one binop without introducing any additional shuffles.

Technically there's potential for a merged shuffle's lowering to be poorer than the original shuffle, but it could also be better, and I'm not seeing any regressions as long as we keep the 'don't merge splats' rule already present in MergeInnerShuffle.

This expands and generalizes an existing X86 combine and attempts to merge either of each binop's sources (with an on-the-fly commutation of the shuffle mask) - we couldn't do that in the x86 version as it had to stay in a form that DAGCombine's MergeInnerShuffle would still recognise.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96345

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/bitcast-and-setcc-256.ll
  llvm/test/CodeGen/X86/promote-cmp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96345.322388.patch
Type: text/x-patch
Size: 13790 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210209/3dd280ce/attachment.bin>


More information about the llvm-commits mailing list