[DAGCombine][X86][AArch64][MIPS][LANAI] (C - x) - y -> C - (x + y) fold (PR41952)
authorRoman Lebedev <lebedev.ri@gmail.com>
Tue, 4 Jun 2019 11:06:21 +0000 (11:06 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Tue, 4 Jun 2019 11:06:21 +0000 (11:06 +0000)
commit3dce0326fe7c06561e74dc6c995cd329d376fd9f
tree9acae45ec1ea3c35d203d2e5b6614908cf3dfb74
parentbe6ce7b3f2258382a2a95263f67eb47cefe16f51
[DAGCombine][X86][AArch64][MIPS][LANAI] (C - x) - y  ->  C - (x + y) fold (PR41952)

Summary:
This *might* be the last fold for `sink-addsub-of-const.ll`, but i'm not sure yet.

As far as i can tell, there are no regressions here (ignoring x86-32),
all changes are either good or neutral.

This, almost surprisingly to me, fixes the motivational tests (in `shift-amount-mod.ll`)
`@reg32_lshr_by_sub_from_negated` from [[ https://bugs.llvm.org/show_bug.cgi?id=41952 | PR41952 ]].

https://rise4fun.com/Alive/vMd3

Reviewers: RKSimon, t.p.northover, craig.topper, spatel, efriedma

Reviewed By: RKSimon

Subscribers: sdardis, javed.absar, arichardson, kristof.beyls, jrtc27, atanasyan, llvm-commits

Tags: #llvm

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

llvm-svn: 362488
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/shift-amount-mod.ll
llvm/test/CodeGen/AArch64/sink-addsub-of-const.ll
llvm/test/CodeGen/Lanai/constant_multiply.ll
llvm/test/CodeGen/Mips/const-mult.ll
llvm/test/CodeGen/Mips/madd-msub.ll
llvm/test/CodeGen/X86/shift-amount-mod.ll
llvm/test/CodeGen/X86/sink-addsub-of-const.ll