[DAGCombine][X86][AArch64][ARM] (C - x) + y -> (y - x) + C fold
authorRoman Lebedev <lebedev.ri@gmail.com>
Tue, 4 Jun 2019 11:06:08 +0000 (11:06 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Tue, 4 Jun 2019 11:06:08 +0000 (11:06 +0000)
commitbe6ce7b3f2258382a2a95263f67eb47cefe16f51
tree850430a4464c4dc61f689ef5f252ba9ae0edbdc9
parentad298f86b7ad2ab09a05e75663a8d0f621e478e6
[DAGCombine][X86][AArch64][ARM] (C - x) + y  ->  (y - x) + C  fold

Summary:
All changes except ARM look **great**.
https://rise4fun.com/Alive/R2M

The regression `test/CodeGen/ARM/addsubcarry-promotion.ll`
is recovered fully by D62392 + D62450.

Reviewers: RKSimon, craig.topper, spatel, rogfer01, efriedma

Reviewed By: efriedma

Subscribers: dmgreen, javed.absar, kristof.beyls, llvm-commits

Tags: #llvm

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

llvm-svn: 362487
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/ARM/addsubcarry-promotion.ll
llvm/test/CodeGen/X86/shift-amount-mod.ll
llvm/test/CodeGen/X86/sink-addsub-of-const.ll