[DAGCombiner] Support non-uniform X%C -> X-(X/C)*C folds
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 11 Jul 2018 09:22:42 +0000 (09:22 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 11 Jul 2018 09:22:42 +0000 (09:22 +0000)
commitdf9d59771be1fac62718023528c678bcaf7c28b4
treece5a9a78277e4ceb694d7de8179350f1de2a0f2c
parent97cf111689572b6c14c04554e1194406e758ca96
[DAGCombiner] Support non-uniform X%C -> X-(X/C)*C folds

First stage in PR38057 - support non-uniform constant vectors in the combine to reuse the division-by-constant logic.

We can definitely do better for srem pow2 remainders (and avoid that extra multiply....) but this at least helps keep everything on the vector unit.

Differential Revision: https://reviews.llvm.org/D48975

llvm-svn: 336774
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/combine-srem.ll